diff --git a/.aspell.yml b/.aspell.yml index 6c0120af..0a242c95 100644 --- a/.aspell.yml +++ b/.aspell.yml @@ -1,46 +1,234 @@ +--- mode: commit min_length: 3 allowed: + - abortonclose + - accessors + - acl + - acls + - adfs + - addons + - apitest + - apikey + - apk - aspell - - repo - - yaml + - attrs + - auth + - autofill + - aws + - axios + - backend + - backends + - backport + - backoff + - bmarkovic + - botmgmt + - botmgtupdate + - browserslist + - bvue + - bwlim + - caniuse + - casbin + - chmigrate + - cli + - clickhouse + - cmd + - cnt + - codebase + - composable + - cond + - conf - config - - Github - - Gitlab + - conns + - const + - cpu + - crd + - cronjob + - crt + - cve + - cwe + - ctx + - dapi + - dataplane + - dataplaneapi + - dataplanes + - datepicker + - dereference + - dgram + - discoverability + - durations + - dns + - dom + - dpapi + - dpapis + - dropdowns + - dsn + - e2e + - entrypoint + - enum - env + - EOF + - eol + - epoll + - escaper + - eslint - failsafe - - golang - - mkdir - - WORKDIR - - apk - - ENTRYPOINT - - ubuntu - - golangci - - sudo - - releaser - - backend - - backends + - fbt + - fcgi + - fqdn + - fmt + - usefcgiapp + - formatter + - formatters - frontend - frontends - - tcp - - cpu - - crd + - fullpage + - gentype + - github + - gitlab + - gocritic + - godaddy + - gofumpt + - gokc + - golang + - golangci + - gorm + - goroutines + - goroutine + - govulncheck + - gotoolchain + - gpc + - gpt + - gptstr + - grpc + - hapee + - haproxy + - healthcheck + - healthz + - hostname + - html + - http + - https + - httpCLF + - iana + - ineffassign + - infos + - ioutil + - ipam + - istanbul + - iweight + - jose + - json + - jsonpath + - jwt + - kasbin + - kpi + - ktls + - kubebuilder + - kubernetes + - lifecycle - linter - linters - - govulncheck - - dataplaneapi + - lowercased + - lookups + - lts + - makefile + - maxconn + - mexchanger + - middleware + - migrator + - minimalistic + - minsize + - mixin + - mkdir + - mpxs + - multipartsearch + - multiselect + - mutex + - mutexes + - namespace + - namespaces + - oidc + - omitempty + - openapi + - optim + - packagetag + - param + - params + - parallelize + - passthrough + - placholder + - podman + - pre - quic - - userlist - - cve + - rbac + - readme + - recursivity + - recv + - redispatch + - redoc + - reimplement + - releaser + - repo + - repos + - req + - rsync + - ruleset + - rulesets + - saml + - sanitization + - schemas + - scrollbar + - scss + - searchselect + - shm + - sig + - sni + - spammy - ssl - - crl - - crt - - ocsp - - logrus - - backport - - dns - - newcert - - libdns + - sslv + - sso + - struct + - subnet + - subresource + - subresources + - sudo + - symlinks + - syslog + - textarea + - tcp + - timeseries + - tls + - tooltip + - tsconfig + - ttl - txt - - testname - - uid + - typings + - ubuntu + - uniq + - unix + - unmarshalling + - unsub + - uri + - url + - userlist + - userlists + - utils + - uweight + - validator + - vfg + - vite + - vrrp + - vue + - waf + - wafadvanced + - workdir + - yaml + - yml + - async + - rehaul + - rebase + - XXXX + - oapi + - codegen + - spoe diff --git a/.github/workflows/.goreleaser.yml b/.github/workflows/.goreleaser.yml index 8ecb10e2..9c9acb43 100644 --- a/.github/workflows/.goreleaser.yml +++ b/.github/workflows/.goreleaser.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v6 with: - go-version: '1.25' + go-version: '1.26' check-latest: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.gitignore b/.gitignore index e742912c..7801c7c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -build/ +/build/ e2e/logs/ vendor/ cmd/dataplaneapi/* @@ -6,6 +6,8 @@ cmd/dataplaneapi/* .test/ bin/golangci-lint bin/check-commit +bin/oapi-codegen # ignore Goland ide config .idea +.claude diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4f5a61e..fbfc27d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,8 @@ variables: DOCKER_HOST: tcp://docker:2375 DOCKER_BASE_IMAGE: $CI_REGISTRY_GO/haproxy-debian BATS_VERSION: v1.10.0 - GO_VERSION: "1.25" - DOCKER_VERSION: "26.0" + GO_VERSION: "1.26" + DOCKER_VERSION: "29.1" pipelines-check: stage: bots @@ -54,22 +54,9 @@ diff: - SWAGGER_VERSION=$(curl -s https://raw.githubusercontent.com/haproxytech/client-native/master/Makefile | grep SWAGGER_VERSION -m 1 | awk -F"=" '{print $2}') - wget -q "https://github.com/go-swagger/go-swagger/releases/download/${SWAGGER_VERSION}/swagger_linux_amd64" -O /usr/local/bin/swagger && chmod +x /usr/local/bin/swagger - make generate-native - - test -z "$(git diff 2> /dev/null)" || exit "Specification is not generated, issue \`make generate\` and commit the result" + - make specification + - test -z "$(git diff 2> /dev/null)" || exit "Specification is not generated, issue \`make generate-native && make specification\` and commit the result" - test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Specification generation created untracked files, cannot proceed" -diff-spec-parent: - stage: lint - image: - name: $CI_REGISTRY_GO/golang:$GO_VERSION - entrypoint: [""] - tags: - - go - rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - - if: $CI_PIPELINE_SOURCE == 'push' - script: - - make generate-parent-aliases - - test -z "$(git diff 2> /dev/null)" || exit "Parent aliases are not generated, issue \`make generate-parent-aliases\` and commit the result" - - test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Parent aliases created untracked files, cannot proceed" golangci-lint: stage: lint artifacts: @@ -101,7 +88,7 @@ gofumpt: commit-policy: stage: lint image: - name: $CI_REGISTRY_GO/commit-check:5.0.4 + name: $CI_REGISTRY_GO/commit-check:5.5.0 entrypoint: [""] tags: - go @@ -163,7 +150,7 @@ test: before_script: - apk add git bash curl jq git - git clone https://github.com/bats-core/bats-core.git && cd bats-core && git checkout $BATS_VERSION && ./install.sh /usr/local && cd .. - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY_GO + - docker login -u='$app' -p $CI_REGISTRY_TOKEN $CI_REGISTRY_GO script: - bash -x ./e2e/run.bash rules: @@ -192,9 +179,9 @@ govulncheck: - go mod tidy - go run cmd/govulncheck-report/main.go -HAProxy_3.4: +HAProxy_3.3: extends: .e2e parallel: matrix: - TESTPART: ["1/4", "2/4", "3/4", "4/4"] - HAPROXY_VERSION: "3.4" + HAPROXY_VERSION: "3.3" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 230f815f..4ba1bd0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,52 +7,25 @@ This document is a short guide for contributing to this project. ## API Specification - Development guide ### Dataplane API generation -Data Plane API is generated using [go-swagger](https://github.com/go-swagger/go-swagger) from the swagger spec found [here](https://github.com/haproxytech/client-native/blob/master/specification/build/haproxy_spec.yaml) using the following command. + +Generation happens in two steps. Both run in CI (the `diff` job), so run both locally and commit the result whenever the specification changes: ``` -make generate -``` -or if you prefer to run it directly (not in docker) -``` +make specification make generate-native ``` -`make generate-native` must also be used if you are using local client-native on disk (you have `replace github.com/haproxytech/client-native/v6 => ../client-native` in go.mod file) +`make specification` is the main step: it installs the pinned [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) into `bin/` and runs `cmd/generate/specification`, which combines the OpenAPI 3 spec files under [`specification/`](./specification) and regenerates the chi-based server code. -This command generates some of the files in this project, which are marked with // Code generated by go-swagger; DO NOT EDIT. -comments at the top of the files. These are not to be edited, as they are overwritten when specification is changed and the above-mentioned command is run. If you want to change those files, please change the specification where necessary and then generate them again. +`make generate-native` regenerates only `embedded_spec.go` from the go-swagger spec in client-native. It needs the `swagger` binary on your `PATH`; `make generate` does the same inside Docker if you don't want to install it. Use `make generate-native` (not the Docker variant) when working against a local client-native checkout (a `replace github.com/haproxytech/client-native/v6 => ../client-native` directive in `go.mod`). -### handlers/parents_xxx_generated.go generation +Generated files are marked with a `// Code generated ... DO NOT EDIT.` header and must not be edited by hand — change the specification and regenerate instead. -Some handler files `handler/parents_xxx_generated.go` are automatically generated. For this use the following command: -``` -make generate-parent-aliases -``` +### Parent-typed resources -Pre-requisites: for this command to run you need to update the following files: -- [generate/parents/main.go](./generate/parents/main.go) - - Update this section with the list of children for which you generate a `handler/parents_xxx_generated.go` -``` - children := []string{ - cnparents.ServerChildType, - cnparents.HTTPAfterResponseRuleChildType, - cnparents.HTTPCheckChildType, - cnparents.HTTPErrorRuleChildType, - cnparents.HTTPRequestRuleChildType, - cnparents.HTTPResponseRuleChildType, - cnparents.TCPCheckChildType, - cnparents.TCPRequestRuleChildType, - cnparents.TCPResponseRuleChildType, - cnparents.ACLChildType, - cnparents.BindChildType, - cnparents.FilterChildType, - cnparents.LogTargetChildType, - } -``` +Some resources live under multiple parent types (e.g. `acl` belongs to backends, frontends, defaults, ...). Their parent expansion is handled as part of `make specification`: `cmd/generate/specification` template-expands each child's spec using the parent definitions in [cmd/generate/parents/parents.go](./cmd/generate/parents/parents.go). -- [generate/parents/operations.go](./generate/parents/operations.go) - - Contains the list of operations to generate an alias for in the `handler/parents_xxx_generated.go`. - - Note that the list of parents for wich an alias is generated is defined in: *client-native* (refer to client-native `specification/README.md`) +To add or change the parents of a child resource, update the relevant `case` in `cmd/generate/parents/parents.go` and re-run `make specification`. There is no separate generation step or CI job for parents — it is covered by the single `make specification` run. ## Commit Messages and General Style diff --git a/Makefile b/Makefile index 97f152d6..3fedd8e1 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,19 @@ GIT_MODIFIED=${GIT_MODIFIED1}${GIT_MODIFIED2} SWAGGER_VERSION=${shell curl -s https://raw.githubusercontent.com/haproxytech/client-native/master/Makefile | grep SWAGGER_VERSION -m 1 | awk -F"=" '{print $$2}'} BUILD_DATE=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ') CGO_ENABLED?=0 -GOLANGCI_LINT_VERSION=2.8.0 -CHECK_COMMIT=5.4.0 +GOLANGCI_LINT_VERSION=2.11.1 +CHECK_COMMIT=5.5.0 +OAPI_CODEGEN_VERSION=v2.7.0 +BIN_DIR=$(CURDIR)/bin +OAPI_CODEGEN=$(BIN_DIR)/oapi-codegen + +.PHONY: install-oapi-codegen +install-oapi-codegen: + @mkdir -p $(BIN_DIR) + @if [ ! -f $(OAPI_CODEGEN) ] || [ "$$($(OAPI_CODEGEN) --version | tail -n 1)" != "$(OAPI_CODEGEN_VERSION)" ]; then \ + echo "Installing oapi-codegen $(OAPI_CODEGEN_VERSION)..."; \ + GOBIN=$(BIN_DIR) go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@$(OAPI_CODEGEN_VERSION); \ + fi all: update clean build @@ -39,14 +50,21 @@ build: e2e: build TESTNAME="$(TESTNAME)" TESTNUMBER=$(TESTNUMBER) TESTDESCRIPTION="$(TESTDESCRIPTION)" SKIP_CLEANUP=$(SKIP_CLEANUP) PREWIPE=$(PREWIPE) HAPROXY_VERSION=$(HAPROXY_VERSION) ./e2e/run.bash -.PHONY: generate-parent-aliases_no_formatting -generate-parent-aliases_no_formatting: - rm -f handlers/parent_*_generated.go - go run generate/parents/*.go -.PHONY: generate-parent-aliases -generate-parent-aliases: generate-parent-aliases_no_formatting gofumpt +.PHONY: test +test: + go test ./... + +.PHONY: check-commit +check-commit: + cd bin;CHECK_COMMIT=${CHECK_COMMIT} sh check-commit.sh + bin/check-commit + +SPECIFICATION_DIR=specification +.PHONY: specification +specification: install-oapi-codegen + go run ./cmd/generate/specification --spec-dir $(SPECIFICATION_DIR) --oapi-codegen $(OAPI_CODEGEN) .PHONY: generate generate: @@ -56,18 +74,7 @@ generate: --build-arg GID=$(shell id -g) \ -t dataplaneapi-swagger-gen . docker run --rm -v "$(shell pwd)":/data dataplaneapi-swagger-gen - generate/post_swagger.sh .PHONY: generate-native generate-native: generate/swagger/script.sh - generate/post_swagger.sh - -.PHONY: test -test: - go test ./... - -.PHONY: check-commit -check-commit: - cd bin;CHECK_COMMIT=${CHECK_COMMIT} sh check-commit.sh - bin/check-commit diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..8a2bb3fe --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,81 @@ +# Upgrade notes + +## Migration from go-swagger to chi / oapi-codegen + +The API server was rewritten from go-swagger generated code to a chi router with +oapi-codegen generated handlers (OpenAPI 3). Endpoint paths, methods, parameters +and success responses are unchanged. The following client-visible behavior +changes were made intentionally: + +- **Error body `code` now mirrors the HTTP status.** Validation failures that + previously carried go-swagger's internal codes in the body (e.g. + `{"code": 606, ...}` with HTTP 422) now return the HTTP status in the body as + well (`{"code": 422, ...}`). Clients matching on the old 6xx body codes must + switch to the HTTP status or the new body codes. + +- **Raw configuration endpoints are text-only.** + `POST /services/haproxy/configuration/raw` accepts only `text/plain` bodies; + the previous (accidental) go-swagger behavior of also accepting a JSON-encoded + string body is gone. Error responses from these endpoints are now + `application/json` instead of `text/plain` (the JSON content is the same). + +- **Unmatched paths require authentication.** Basic authentication is enforced + in front of the router, so a request to a non-existent path without valid + credentials returns `401` where the old server returned `404`. With valid + credentials the response is still `404`. + +- **404 / 405 / 406 / 415 / 422 response bodies keep the go-swagger JSON shape** + (`{"code": , "message": "..."}`); only the wording of some messages + changed slightly. + +- **SSL certificate DELETE can now return `204` on the default path.** + `DELETE /services/haproxy/storage/ssl_certificates/{name}` without + `skip_reload` or `force_reload` attempts to remove the certificate through the + HAProxy runtime API first and returns `204 No Content` on success, falling + back to `202 Accepted` with a `Reload-ID` header otherwise. The old server had + a bug that made the runtime branch unreachable, so this path always returned + `202`. Clients should treat both `204` and `202` as success. + +- **Request bodies are capped at 1 GiB by default.** The old server read + request bodies without any size limit. Bodies exceeding the limit are + rejected with `413 Request Entity Too Large`. The limit is configurable via + `--max-body-size` (or `max_body_size` in the configuration file); `0` + disables it. + +- **Replacing acme providers, log profiles, crt-stores, mailers sections and + http-errors sections now triggers a reload.** `PUT` on + `/services/haproxy/configuration/acme/{name}`, `.../log_profiles/{name}`, + `.../crt_stores/{name}`, `.../mailers_section/{name}` and + `.../http_errors_sections/{name}` previously wrote the change to the + configuration file but never scheduled a reload, so the edit did not take + effect until an unrelated change reloaded HAProxy, and the response was + always `200`. These endpoints now follow the standard pattern: outside a + transaction they return `202 Accepted` with a `Reload-ID` header (or `200` + with `force_reload=true`), and inside a transaction they return `202`. + +### Chi router additions for go-swagger compatibility + +Where chi's defaults differ from the old server, the router carries explicit +code to keep the wire behavior unchanged: + +- **JSON bodies for router-level errors.** chi answers unmatched paths and + disallowed methods with plain-text bodies (`404 page not found`); custom + handlers restore the JSON shape the go-swagger server returned + (`{"code": 404, "message": "path ... was not found"}`). They are registered + on both the root router and the mounted `/v3` sub-router. + +- **`Allow` header on 405 responses.** RFC 9110 requires a 405 response to + list the methods the resource supports, and the go-swagger server did so. + chi does not expose the matched route's allowed methods to a custom 405 + handler, so the handler rebuilds the list by probing the router with each + standard method for the requested path. + +- **Trailing slashes are ignored.** Requests are routed as if a trailing + slash were absent (chi's `StripSlashes` middleware), so `/v3/.../maps` and + `/v3/.../maps/` hit the same handler. + +- **`Reload-ID` header spelling.** The specification spells the reload header + `Reload-ID`, while the server sends the canonical `Reload-Id` form — exactly + as the old go-swagger server did, since Go's `http.Header` canonicalizes + header names on write. Header names are case-insensitive, so clients should + treat the two spellings as equal. diff --git a/acme/constructor.go b/acme/constructor.go index 8b9b9726..097f449a 100644 --- a/acme/constructor.go +++ b/acme/constructor.go @@ -10,6 +10,7 @@ import ( "github.com/libdns/azure" "github.com/libdns/cloudflare" "github.com/libdns/cloudns" + "github.com/libdns/desec" "github.com/libdns/digitalocean" "github.com/libdns/gandi" "github.com/libdns/godaddy" @@ -24,6 +25,7 @@ import ( "github.com/libdns/ovh" "github.com/libdns/porkbun" "github.com/libdns/rfc2136" + "github.com/libdns/route53" "github.com/libdns/scaleway" "github.com/libdns/vultr/v2" ) @@ -38,6 +40,8 @@ func NewDNSProvider(name string, params map[string]any) (DNSProvider, error) { prov = &cloudflare.Provider{} case "cloudns": prov = &cloudns.Provider{} + case "desec": + prov = &desec.Provider{} case "digitalocean": prov = &digitalocean.Provider{} case "exec": @@ -68,6 +72,8 @@ func NewDNSProvider(name string, params map[string]any) (DNSProvider, error) { prov = &porkbun.Provider{} case "rfc2136": prov = &rfc2136.Provider{} + case "route53": + prov = &route53.Provider{} case "scaleway": prov = &scaleway.Provider{} case "vultr": diff --git a/acme/dns01-providers.txt b/acme/dns01-providers.txt index 3dc5a897..1e0f077c 100644 --- a/acme/dns01-providers.txt +++ b/acme/dns01-providers.txt @@ -1,6 +1,7 @@ github.com/libdns/azure github.com/libdns/cloudflare github.com/libdns/cloudns +github.com/libdns/desec github.com/libdns/digitalocean github.com/haproxytech/dataplaneapi/acme/exec github.com/libdns/gandi @@ -16,6 +17,6 @@ github.com/libdns/netcup github.com/libdns/ovh github.com/libdns/porkbun github.com/libdns/rfc2136 -//github.com/libdns/route53 req. go1.25 +github.com/libdns/route53 github.com/libdns/scaleway github.com/libdns/vultr/v2 diff --git a/acme/dns01.go b/acme/dns01.go index f7226f61..655598be 100644 --- a/acme/dns01.go +++ b/acme/dns01.go @@ -23,15 +23,21 @@ import ( "strings" "time" + "github.com/haproxytech/dataplaneapi/log" "github.com/libdns/libdns" + "github.com/miekg/dns" ) -// TTL of the temporary DNS record used for DNS-01 validation. -const DefaultTTL = 30 * time.Second +const ( + // TTL of the temporary DNS record used for DNS-01 validation. + DefaultTTL = 60 * time.Second + // Typical negative response TTL defined in the SOA. + defaultDNSPropagationTimeout = 300 * time.Second +) // DNSProvider defines the operations required for dns-01 challenges. type DNSProvider interface { - libdns.RecordAppender + libdns.RecordSetter libdns.RecordDeleter } @@ -39,6 +45,18 @@ type DNSProvider interface { type DNS01Solver struct { provider DNSProvider TTL time.Duration + + // How long to wait before starting propagation checks. + // Default: 0 (no wait). + PropagationDelay time.Duration + + // Maximum time to wait for temporary DNS record to appear. + // Set to -1 to disable propagation checks. + // Default: 2 minutes. + PropagationTimeout time.Duration + + // Preferred DNS resolver(s) to use when doing DNS lookups. + Resolvers []string } func NewDNS01Solver(name string, params map[string]any, ttl ...time.Duration) (*DNS01Solver, error) { @@ -60,12 +78,12 @@ func (s *DNS01Solver) Present(ctx context.Context, domain, zone, keyAuth string) rec := makeRecord(domain, keyAuth, s.TTL) if zone == "" { - zone = guessZone(domain) + zone = GuessZone(domain) } else { zone = rooted(zone) } - results, err := s.provider.AppendRecords(ctx, zone, []libdns.Record{rec}) + results, err := s.provider.SetRecords(ctx, zone, []libdns.Record{rec}) if err != nil { return fmt.Errorf("adding temporary record for zone %q: %w", zone, err) } @@ -76,12 +94,69 @@ func (s *DNS01Solver) Present(ctx context.Context, domain, zone, keyAuth string) return nil } +// Wait blocks until the TXT record created in Present() appears in +// authoritative lookups, i.e. until it has propagated, or until +// timeout, whichever is first. +func (s *DNS01Solver) Wait(ctx context.Context, domain, zone, keyAuth string) error { + // if configured to, pause before doing propagation checks + // (even if they are disabled, the wait might be desirable on its own) + if s.PropagationDelay > 0 { + select { + case <-time.After(s.PropagationDelay): + case <-ctx.Done(): + return ctx.Err() + } + } + + // skip propagation checks if configured to do so + if s.PropagationTimeout == -1 { + return nil + } + + // timings + timeout := s.PropagationTimeout + if timeout == 0 { + timeout = defaultDNSPropagationTimeout + } + const interval = 5 * time.Second + + // how we'll do the checks + checkAuthoritativeServers := len(s.Resolvers) == 0 + resolvers := RecursiveNameservers(s.Resolvers) + + log.Debugf("events: acme deploy: %s: using DNS resolvers %v, check authoritative servers=%v", + domain, resolvers, checkAuthoritativeServers) + + absName := "_acme-challenge." + strings.Trim(domain, ".") + + var err error + start := time.Now() + for time.Since(start) < timeout { + select { + case <-time.After(interval): + case <-ctx.Done(): + return ctx.Err() + } + + var ready bool + ready, err = checkDNSPropagation(ctx, absName, dns.TypeTXT, keyAuth, checkAuthoritativeServers, resolvers) + if err != nil { + return fmt.Errorf("checking DNS propagation of %q (resolvers=%v): %w", absName, resolvers, err) + } + if ready { + return nil + } + } + + return fmt.Errorf("DNS propagation timed out. Last error: %v", err) +} + // CleanUp deletes the DNS TXT record created in Present(). func (s *DNS01Solver) CleanUp(ctx context.Context, domain, zone, keyAuth string) error { rr := makeRecord(domain, keyAuth, s.TTL) if zone == "" { - zone = guessZone(domain) + zone = GuessZone(domain) } else { zone = rooted(zone) } @@ -104,13 +179,8 @@ func makeRecord(fqdn, keyAuth string, ttl time.Duration) libdns.RR { } } -// Extract the root zone for a domain in case the user did not provide it. -// -// This simplistic algorithm will only work for simple cases. The correct -// way to do this would be to do an SOA request on the FQDN, but since -// dataplaneapi may not use the right resolvers (as configured in haproxy.cfg) -// it is better to avoid doing any DNS request. -func guessZone(fqdn string) string { +// Guess the root zone for a domain when we cannot use a better method. +func GuessZone(fqdn string) string { fqdn = trimWildcard(fqdn) parts := make([]string, 0, 8) strings.SplitSeq(fqdn, ".")(func(part string) bool { diff --git a/acme/dns01_test.go b/acme/dns01_test.go index c7f4df34..f2d874b7 100644 --- a/acme/dns01_test.go +++ b/acme/dns01_test.go @@ -94,7 +94,7 @@ func Test_guessZone(t *testing.T) { } for _, tt := range tests { t.Run(tt.fqdn, func(t *testing.T) { - got := guessZone(tt.fqdn) + got := GuessZone(tt.fqdn) if got != tt.want { t.Errorf("guessZone() = %v, want %v", got, tt.want) } diff --git a/acme/propagation.go b/acme/propagation.go new file mode 100644 index 00000000..f5957fa3 --- /dev/null +++ b/acme/propagation.go @@ -0,0 +1,331 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// This file contains code adapted from certmagic by Matt Holt. +// https://github.com/caddyserver/certmagic +// +// It has been modified. + +package acme + +import ( + "context" + "errors" + "fmt" + "net" + "strings" + "time" + + "github.com/haproxytech/dataplaneapi/log" + "github.com/miekg/dns" +) + +var dnsTimeout = 10 * time.Second + +// FindZoneByFQDN determines the zone apex for the given fully-qualified +// domain name (FQDN) by recursing up the domain labels until the nameserver +// returns a SOA record in the answer section. +func FindZoneByFQDN(ctx context.Context, fqdn string, nameservers []string) (string, error) { + if !strings.HasSuffix(fqdn, ".") { + fqdn += "." + } + + if err := ctx.Err(); err != nil { + return "", err + } + + soa, err := fetchSoaByFqdn(ctx, fqdn, nameservers) + if err != nil { + return "", err + } + + return soa.Hdr.Name, nil +} + +func fetchSoaByFqdn(ctx context.Context, fqdn string, nameservers []string) (*dns.SOA, error) { + var err error + var in *dns.Msg + + labelIndexes := dns.Split(fqdn) + for _, index := range labelIndexes { + if err := ctx.Err(); err != nil { + return nil, err + } + + domain := fqdn[index:] + + in, err = dnsQuery(ctx, domain, dns.TypeSOA, nameservers, true) + if err != nil { + continue + } + if in == nil { + continue + } + + switch in.Rcode { + case dns.RcodeSuccess: + // Check if we got a SOA RR in the answer section + if len(in.Answer) == 0 { + continue + } + + // CNAME records cannot/should not exist at the root of a zone. + // So we skip a domain when a CNAME is found. + if dnsMsgContainsCNAME(in) { + continue + } + + for _, ans := range in.Answer { + if soa, ok := ans.(*dns.SOA); ok { + return soa, nil + } + } + case dns.RcodeNameError: + // NXDOMAIN + default: + // Any response code other than NOERROR and NXDOMAIN is treated as error + return nil, fmt.Errorf("unexpected response code '%s' for %s", dns.RcodeToString[in.Rcode], domain) + } + } + + return nil, fmt.Errorf("could not find the start of authority for %s%s", fqdn, formatDNSError(in, err)) +} + +func formatDNSError(msg *dns.Msg, err error) string { + var parts []string + if msg != nil { + parts = append(parts, dns.RcodeToString[msg.Rcode]) + } + if err != nil { + parts = append(parts, err.Error()) + } + if len(parts) > 0 { + return ": " + strings.Join(parts, " ") + } + return "" +} + +// checkDNSPropagation checks if the expected record has been propagated to all authoritative nameservers. +func checkDNSPropagation(ctx context.Context, fqdn string, recType uint16, expectedValue string, checkAuthoritativeServers bool, resolvers []string) (bool, error) { + if !strings.HasSuffix(fqdn, ".") { + fqdn += "." + } + + // Initial attempt to resolve at the recursive NS - but do not actually + // dereference (follow) a CNAME record if we are targeting a CNAME record + // itself + if recType != dns.TypeCNAME { + r, err := dnsQuery(ctx, fqdn, recType, resolvers, true) + if err != nil { + return false, fmt.Errorf("CNAME dns query: %v", err) + } + if r.Rcode == dns.RcodeSuccess { + fqdn = updateDomainWithCName(r, fqdn) + } + } + + if checkAuthoritativeServers { + authoritativeServers, err := lookupNameservers(ctx, fqdn, resolvers) + if err != nil { + return false, fmt.Errorf("looking up authoritative nameservers: %v", err) + } + populateNameserverPorts(authoritativeServers) + resolvers = authoritativeServers + log.Debugf("events: acme deploy: %s: using DNS resolvers %v, check authoritative servers=%v", + fqdn, resolvers, checkAuthoritativeServers) + } + + return checkAuthoritativeNss(ctx, fqdn, recType, expectedValue, resolvers) +} + +// checkAuthoritativeNss queries each of the given nameservers for the expected record. +func checkAuthoritativeNss(ctx context.Context, fqdn string, recType uint16, expectedValue string, nameservers []string) (bool, error) { + for _, ns := range nameservers { + r, err := dnsQuery(ctx, fqdn, recType, []string{ns}, true) + if err != nil { + return false, fmt.Errorf("querying authoritative nameservers: %v", err) + } + + if r.Rcode != dns.RcodeSuccess { + if r.Rcode == dns.RcodeNameError || r.Rcode == dns.RcodeServerFailure { + // if Present() succeeded, then it must show up eventually, or else + // something is really broken in the DNS provider or their API; + // no need for error here, simply have the caller try again + return false, nil + } + return false, fmt.Errorf("NS %s returned %s for %s", ns, dns.RcodeToString[r.Rcode], fqdn) + } + + for _, rr := range r.Answer { + switch recType { + case dns.TypeTXT: + if txt, ok := rr.(*dns.TXT); ok { + record := strings.Join(txt.Txt, "") + if record == expectedValue { + return true, nil + } else { + log.Debugf("events: acme deploy: %s: TXT record mismatch! Expected %q, Got %q", + fqdn, expectedValue, record) + } + } + case dns.TypeCNAME: + if cname, ok := rr.(*dns.CNAME); ok { + // TODO: whether a DNS provider assumes a trailing dot or not varies, and we may have to standardize this in libdns packages + if strings.TrimSuffix(cname.Target, ".") == strings.TrimSuffix(expectedValue, ".") { + return true, nil + } + } + default: + return false, fmt.Errorf("unsupported record type: %d", recType) + } + } + } + + return false, nil +} + +// lookupNameservers returns the authoritative nameservers for the given fqdn. +func lookupNameservers(ctx context.Context, fqdn string, resolvers []string) ([]string, error) { + var authoritativeNss []string + + zone, err := FindZoneByFQDN(ctx, fqdn, resolvers) + if err != nil { + return nil, fmt.Errorf("could not determine the zone for '%s': %w", fqdn, err) + } + + r, err := dnsQuery(ctx, zone, dns.TypeNS, resolvers, true) + if err != nil { + return nil, fmt.Errorf("querying NS resolver for zone '%s' recursively: %v", zone, err) + } + + for _, rr := range r.Answer { + if ns, ok := rr.(*dns.NS); ok { + authoritativeNss = append(authoritativeNss, strings.ToLower(ns.Ns)) + } + } + + if len(authoritativeNss) > 0 { + return authoritativeNss, nil + } + return nil, errors.New("could not determine authoritative nameservers") +} + +// Update FQDN with CNAME if any +func updateDomainWithCName(r *dns.Msg, fqdn string) string { + for _, rr := range r.Answer { + if cn, ok := rr.(*dns.CNAME); ok { + if cn.Hdr.Name == fqdn { + log.Debugf("events: acme deploy: %s: updated FQDN with CNAME value: %q", fqdn, cn.Target) + return cn.Target + } + } + } + return fqdn +} + +// dnsMsgContainsCNAME checks for a CNAME answer in msg +func dnsMsgContainsCNAME(msg *dns.Msg) bool { + for _, ans := range msg.Answer { + if _, ok := ans.(*dns.CNAME); ok { + return true + } + } + return false +} + +func dnsQuery(ctx context.Context, fqdn string, rtype uint16, nameservers []string, recursive bool) (*dns.Msg, error) { + m := createDNSMsg(fqdn, rtype, recursive) + var in *dns.Msg + var err error + for _, ns := range nameservers { + in, err = sendDNSQuery(ctx, m, ns) + if err == nil && len(in.Answer) > 0 { + break + } + } + return in, err +} + +func createDNSMsg(fqdn string, rtype uint16, recursive bool) *dns.Msg { + m := new(dns.Msg) + m.SetQuestion(fqdn, rtype) + + // See: https://caddy.community/t/hard-time-getting-a-response-on-a-dns-01-challenge/15721/16 + m.SetEdns0(1232, false) + if !recursive { + m.RecursionDesired = false + } + return m +} + +func sendDNSQuery(ctx context.Context, m *dns.Msg, ns string) (*dns.Msg, error) { + udp := &dns.Client{Net: "udp", Timeout: dnsTimeout} + in, _, err := udp.ExchangeContext(ctx, m, ns) + // two kinds of errors we can handle by retrying with TCP: + // truncation and timeout; see https://github.com/caddyserver/caddy/issues/3639 + truncated := in != nil && in.Truncated + timeoutErr := err != nil && strings.Contains(err.Error(), "timeout") + if truncated || timeoutErr { + tcp := &dns.Client{Net: "tcp", Timeout: dnsTimeout} + in, _, err = tcp.ExchangeContext(ctx, m, ns) + } + return in, err +} + +// RecursiveNameservers are used to pre-check DNS propagation. It +// picks user-configured nameservers (custom) OR the defaults +// obtained from resolv.conf and defaultNameservers if none is +// configured and ensures that all server addresses have a port value. +func RecursiveNameservers(custom []string) []string { + var servers []string + if len(custom) == 0 { + servers = systemOrDefaultNameservers(defaultResolvConf, defaultNameservers) + } else { + servers = make([]string, len(custom)) + copy(servers, custom) + } + populateNameserverPorts(servers) + return servers +} + +// systemOrDefaultNameservers attempts to get system nameservers from the +// resolv.conf file given by path before falling back to hard-coded defaults. +func systemOrDefaultNameservers(path string, defaults []string) []string { + config, err := dns.ClientConfigFromFile(path) + if err != nil || len(config.Servers) == 0 { + return defaults + } + return config.Servers +} + +// populateNameserverPorts ensures that all nameservers have a port number. +// If not, the default DNS server port of 53 will be appended. +func populateNameserverPorts(servers []string) { + for i := range servers { + _, port, _ := net.SplitHostPort(servers[i]) + if port == "" { + servers[i] = net.JoinHostPort(servers[i], "53") + } + } +} + +var defaultNameservers = []string{ + "8.8.8.8:53", + "8.8.4.4:53", + "1.1.1.1:53", + "1.0.0.1:53", +} + +const defaultResolvConf = "/etc/resolv.conf" diff --git a/adapters/adapters.go b/adapters/adapters.go index 9c4bc137..5876b393 100644 --- a/adapters/adapters.go +++ b/adapters/adapters.go @@ -22,9 +22,11 @@ import ( "strconv" "strings" + openapi_middleware "github.com/go-openapi/runtime/middleware" clientnative "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/configuration" + cn_configuration "github.com/haproxytech/client-native/v6/configuration" "github.com/haproxytech/client-native/v6/models" + dapi_configuration "github.com/haproxytech/dataplaneapi/configuration" "github.com/haproxytech/dataplaneapi/log" ) @@ -121,7 +123,7 @@ func ApacheLogMiddleware(logger *log.ACLLogger) Adapter { type serverWriter struct { w http.ResponseWriter - client configuration.Configuration + client cn_configuration.Configuration transactionID string wroteHeader bool } @@ -153,6 +155,7 @@ func ConfigVersionMiddleware(client clientnative.HAProxyClient) Adapter { configuration, err := client.Configuration() if err != nil { http.Error(w, err.Error(), http.StatusNotImplemented) + return } sw := serverWriter{ w: w, @@ -165,7 +168,7 @@ func ConfigVersionMiddleware(client clientnative.HAProxyClient) Adapter { } } -func fetchConfgVersion(client configuration.Configuration, transactionID string) (string, error) { +func fetchConfgVersion(client cn_configuration.Configuration, transactionID string) (string, error) { var v int64 var err error if transactionID == "" { @@ -181,3 +184,63 @@ func fetchConfgVersion(client configuration.Configuration, transactionID string) } return "", err } + +// BasicAuthMiddleware enforces HTTP Basic authentication on every request. +// When skip is true (mTLS with a CA certificate is active) all requests pass through. +func BasicAuthMiddleware(skip bool) Adapter { + return func(h http.Handler) http.Handler { + if skip { + return h + } + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + user, pass, ok := r.BasicAuth() + if !ok { + writeUnauthorized(w, "missing or invalid authorization") + return + } + if _, err := dapi_configuration.AuthenticateUser(user, pass); err != nil { + writeUnauthorized(w, err.Error()) + return + } + h.ServeHTTP(w, r) + }) + } +} + +// MaxBodySizeMiddleware caps every request body at maxSize bytes with +// http.MaxBytesReader. The spec validator buffers the full body in memory +// before handlers run, so without a cap a single oversized upload can exhaust +// the process. A maxSize of 0 disables the limit. +func MaxBodySizeMiddleware(maxSize int64) Adapter { + return func(h http.Handler) http.Handler { + if maxSize <= 0 { + return h + } + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Body != nil { + r.Body = http.MaxBytesReader(w, r.Body, maxSize) + } + h.ServeHTTP(w, r) + }) + } +} + +// SpecDocsMiddleware serves the raw OpenAPI v2 document at /swagger.json and a Redoc +// documentation UI at {basePath}/docs, both without authentication, matching the +// behavior of the previous go-swagger server. All other requests pass through. +func SpecDocsMiddleware(swaggerJSON []byte, basePath, title string) Adapter { + return func(h http.Handler) http.Handler { + return openapi_middleware.Spec("", swaggerJSON, + openapi_middleware.Redoc(openapi_middleware.RedocOpts{BasePath: basePath, Title: title}, h)) + } +} + +func writeUnauthorized(w http.ResponseWriter, msg string) { + w.Header().Set("WWW-Authenticate", `Basic realm="API"`) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusUnauthorized) + code := int64(http.StatusUnauthorized) + e := &models.Error{Code: &code, Message: &msg} + b, _ := e.MarshalJSON() + _, _ = w.Write(b) +} diff --git a/adapters/adapters_test.go b/adapters/adapters_test.go new file mode 100644 index 00000000..5e8ad728 --- /dev/null +++ b/adapters/adapters_test.go @@ -0,0 +1,94 @@ +// Copyright 2026 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package adapters + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "testing" +) + +func TestBasicAuthMiddlewareSkip(t *testing.T) { + called := false + h := BasicAuthMiddleware(true)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + called = true + w.WriteHeader(http.StatusOK) + })) + + rec := httptest.NewRecorder() + h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v3/info", nil)) + + if !called { + t.Error("handler was not called with skip=true") + } + if rec.Code != http.StatusOK { + t.Errorf("status = %d, want 200", rec.Code) + } +} + +func TestBasicAuthMiddlewareUnauthorized(t *testing.T) { + // The global user store is empty in this test process, so any credentials + // are rejected; both paths must produce the same 401 response shape. + tests := []struct { + name string + withAuth bool + }{ + {name: "missing authorization header", withAuth: false}, + {name: "credentials not in user store", withAuth: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + called := false + h := BasicAuthMiddleware(false)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + called = true + })) + + req := httptest.NewRequest(http.MethodGet, "/v3/info", nil) + if tt.withAuth { + req.SetBasicAuth("nosuchuser", "nosuchpass") + } + rec := httptest.NewRecorder() + h.ServeHTTP(rec, req) + + if called { + t.Error("handler was called despite failed authentication") + } + if rec.Code != http.StatusUnauthorized { + t.Errorf("status = %d, want 401", rec.Code) + } + if got, want := rec.Header().Get("WWW-Authenticate"), `Basic realm="API"`; got != want { + t.Errorf("WWW-Authenticate = %q, want %q", got, want) + } + if ct := rec.Header().Get("Content-Type"); ct != "application/json" { + t.Errorf("Content-Type = %q, want application/json", ct) + } + var e struct { + Code int64 `json:"code"` + Message string `json:"message"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &e); err != nil { + t.Fatalf("body %q is not valid JSON: %v", rec.Body.String(), err) + } + if e.Code != http.StatusUnauthorized { + t.Errorf("body code = %d, want 401", e.Code) + } + if e.Message == "" { + t.Error("body message is empty") + } + }) + } +} diff --git a/client-native/cn.go b/client-native/cn.go index 2235de19..70560d24 100644 --- a/client-native/cn.go +++ b/client-native/cn.go @@ -26,7 +26,8 @@ var ( ) func ConfigureConfigurationClient(haproxyOptions dataplaneapi_config.HAProxyConfiguration, mWorker bool) (configuration.Configuration, error) { - confClient, err := configuration.New(context.Background(), + confClient, err := configuration.New( + context.Background(), configuration_options.ConfigurationFile(haproxyOptions.ConfigFile), configuration_options.HAProxyBin(haproxyOptions.HAProxy), configuration_options.Backups(haproxyOptions.BackupsNumber), @@ -34,6 +35,7 @@ func ConfigureConfigurationClient(haproxyOptions dataplaneapi_config.HAProxyConf configuration_options.UsePersistentTransactions, configuration_options.TransactionsDir(haproxyOptions.TransactionDir), configuration_options.ValidateCmd(haproxyOptions.ValidateCmd), + configuration_options.ValidateConfigFiles(haproxyOptions.ValidateFilesBefore, haproxyOptions.ValidateFilesAfter), configuration_options.MasterWorker, configuration_options.UseMd5Hash, configuration_options.PreferredTimeSuffix(haproxyOptions.PreferredTimeSuffix), diff --git a/client-native/events.go b/client-native/events.go index d181665a..4bc73bf8 100644 --- a/client-native/events.go +++ b/client-native/events.go @@ -21,6 +21,7 @@ import ( "fmt" "io" "strings" + "sync" "sync/atomic" "time" @@ -37,9 +38,13 @@ const ( ) type HAProxyEventListener struct { - listener *runtime.EventListener - client clientnative.HAProxyClient // for storage only - rt runtime.Runtime + mu sync.Mutex + listener *runtime.EventListener + client clientnative.HAProxyClient // for storage only + rt runtime.Runtime + // done is closed to signal the listen goroutine to exit. + // A new channel is created each time a new goroutine is started. + done chan struct{} stop atomic.Bool lastEvent time.Time } @@ -63,7 +68,7 @@ func ListenHAProxyEvents(ctx context.Context, client clientnative.HAProxyClient) return nil, err } // v3.2+ - if version.Major < 3 || (version.Major == 3 && version.Minor < 2) { + if version.Major() < 3 || (version.Major() == 3 && version.Minor() < 2) { return nil, ErrOldVersion } @@ -76,6 +81,7 @@ func ListenHAProxyEvents(ctx context.Context, client clientnative.HAProxyClient) client: client, listener: el, rt: rt, + done: make(chan struct{}), } go h.listen(ctx) @@ -92,20 +98,27 @@ func (h *HAProxyEventListener) Reconfigure(ctx context.Context, rt runtime.Runti } if rt.SocketPath() == h.rt.SocketPath() { - // no need to restart the listener + h.mu.Lock() h.rt = rt + h.mu.Unlock() return nil } - h.Reset() + // Signal the old goroutine to stop and wait for it to exit. + h.stopAndWait() + + h.mu.Lock() h.rt = rt + h.done = make(chan struct{}) h.stop.Store(false) + h.mu.Unlock() + go h.listen(ctx) return nil } -func (h *HAProxyEventListener) Reset() { +func (h *HAProxyEventListener) resetLocked() { if h.listener != nil { if err := h.listener.Close(); err != nil { log.Warning(err) @@ -114,9 +127,19 @@ func (h *HAProxyEventListener) Reset() { } } -func (h *HAProxyEventListener) Stop() error { +// stopAndWait signals the listen goroutine to stop and waits for it to exit. +func (h *HAProxyEventListener) stopAndWait() { h.stop.Store(true) - return h.listener.Close() + h.mu.Lock() + h.resetLocked() + h.mu.Unlock() + // Wait for the goroutine to acknowledge the stop. + <-h.done +} + +func (h *HAProxyEventListener) Stop() error { + h.stopAndWait() + return nil } func newHAProxyEventListener(socketPath string) (*runtime.EventListener, error) { @@ -133,48 +156,70 @@ func newHAProxyEventListener(socketPath string) (*runtime.EventListener, error) return el, nil } +const maxRetryBackoff = 60 * time.Second + func (h *HAProxyEventListener) listen(ctx context.Context) { - var err error + defer close(h.done) + retryAfter := 100 * time.Millisecond + loggedDisconnect := false for { if h.stop.Load() { - // Stop requested. - h.Reset() + h.mu.Lock() + h.resetLocked() + h.mu.Unlock() return } - if h.listener == nil { - h.listener, err = newHAProxyEventListener(h.rt.SocketPath()) + + h.mu.Lock() + needsConnect := h.listener == nil + h.mu.Unlock() + + if needsConnect { + el, err := newHAProxyEventListener(h.rt.SocketPath()) if err != nil { - // Try again. - log.Warning(err) - time.Sleep(retryAfter) + if !loggedDisconnect { + log.Warningf("event listener disconnected, reconnecting: %v", err) + loggedDisconnect = true + } else { + log.Debugf("event listener reconnect attempt: %v", err) + } + select { + case <-time.After(retryAfter): + case <-ctx.Done(): + return + } retryAfter *= 2 - if retryAfter == 51200*time.Millisecond { - // Give up after 10 iterations. + if retryAfter >= maxRetryBackoff { + log.Warning("event listener giving up reconnection attempts") h.stop.Store(true) } continue } + + h.mu.Lock() + h.listener = el + h.mu.Unlock() + + retryAfter = 100 * time.Millisecond + loggedDisconnect = false + log.Debugf("event listener reconnected to: %s", h.rt.SocketPath()) } for { ev, err := h.listener.Listen(ctx) if err != nil { - // EOF errors usually happen when HAProxy restarts, do not log. if !errors.Is(err, io.EOF) { - log.Warning(err) + log.Debugf("event listener error: %v", err) } - // Reset the connection. - h.Reset() + h.mu.Lock() + h.resetLocked() + h.mu.Unlock() break } h.handle(ctx, ev) - - if h.listener == nil { // just in case - break - } } } } diff --git a/client-native/events_acme.go b/client-native/events_acme.go index efe220e4..516221e9 100644 --- a/client-native/events_acme.go +++ b/client-native/events_acme.go @@ -20,7 +20,9 @@ import ( "errors" "fmt" "io" + "os" "path/filepath" + "strconv" "strings" "time" @@ -72,25 +74,28 @@ func (h *HAProxyEventListener) handleAcmeNewCertEvent(args string) { return } - // Do not use the certificate name in args as a storage name. - // It could be an alias, or the user could have split keys and certs storage. + // The only argument is the certificate name, which could be a "virtual" + // name like "@store/www1" in case of a crt-store. + crtName := args - crt, err := h.rt.ShowCertificate(args) + // Use "show ssl cert" to get the real filename of the certificate. + crt, err := h.rt.ShowCertificate(crtName) if err != nil { log.Errorf("events: acme newcert %s: %s", args, err.Error()) return } - storage, err := h.client.SSLCertStorage() + // Use "dump ssl cert" to get the certificate contents in PEM format. + // This command only works on sockets with level "admin"! + pem, err := h.rt.DumpCertificate(crtName) if err != nil { - log.Error(err) + log.Errorf("events: acme newcert %s: dump cert: %s", args, err.Error()) return } - // 'dump ssl cert' can only be issued on sockets with level "admin". - pem, err := h.rt.DumpCertificate(crt.StorageName) + storage, err := h.client.SSLCertStorage() if err != nil { - log.Errorf("events: acme newcert %s: dump cert: %s", args, err.Error()) + log.Errorf("events: acme newcert %s: %s", args, err.Error()) return } @@ -113,7 +118,7 @@ func (h *HAProxyEventListener) handleAcmeNewCertEvent(args string) { return } - log.Debugf("events: OK: acme newcert %s => %s", args, crt.StorageName) + log.Debugf("events: OK: acme newcert %s => %s", args, storageName) } // HAProxy needs dpapi to solve a dns-01 challenge. @@ -223,34 +228,81 @@ func (h *HAProxyEventListener) handleAcmeDeployEvent(ctx context.Context, args s } domainName := status.Identifier.Value + ttl := acme.DefaultTTL // Merge the acme-vars vars := make(map[string]any, 8) for _, line := range acmeArgs { hmap := configuration.ParseAcmeVars(line) for k, v := range hmap { - vars[k] = v + if k == "ttl" { + sec, err := parseSeconds(v) + if err != nil { + log.Errorf("events: acme deploy: failed to parse ttl from acme-vars: %s", err.Error()) + continue + } + ttl = sec + log.Debugf("events: acme deploy: using custom TTL value: %d seconds", ttl) + } else { + vars[k] = v + } } } // Solve the DNS challenge. - solver, err := acme.NewDNS01Solver(provider, vars) + solver, err := acme.NewDNS01Solver(provider, vars, ttl) if err != nil { log.Errorf("events: acme deploy: DNS provider: %s", err.Error()) return } - err = solver.Present(ctx, domainName, "", keyAuth) + + // These options will be configurable from haproxy.cfg in a future version. + // For now use environment variables. + solver.PropagationDelay = getEnvDuration("DPAPI_ACME_PROPAGDELAY_SEC", 0) + solver.PropagationTimeout = getEnvDuration("DPAPI_ACME_PROPAGTIMEOUT_SEC", time.Hour) + + log.Debugf("events: acme deploy: %s: using DNS provider %s", domainName, provider) + + var zone string + if solver.PropagationTimeout == -1 { + zone = acme.GuessZone(domainName) + } else { + zone, err = acme.FindZoneByFQDN(ctx, domainName, acme.RecursiveNameservers(nil)) + } + if err != nil { + log.Errorf("events: acme deploy: failed to find root zone for '%s': %s", domainName, err.Error()) + return + } + + log.Debugf("events: acme deploy: %s: found DNS zone: %q", domainName, zone) + + err = solver.Present(ctx, domainName, zone, keyAuth) if err != nil { log.Errorf("events: acme deploy: DNS solver: %s", err.Error()) return } - // Remove the challenge in 2h. + + log.Debugf("events: acme deploy: %s: record created, waiting for propagation. Timeout: %s", + domainName, solver.PropagationTimeout.String()) + + // Wait for DNS propagation and cleanup. + err = solver.Wait(ctx, domainName, zone, keyAuth) + // Remove the challenge in 10m if Wait() was successful. This should be + // more than enough for HAProxy to finish the challenge with the ACME server. + waitBeforeCleanup := 10 * time.Minute + if err != nil { + waitBeforeCleanup = time.Second + } go func() { - time.Sleep(2 * time.Hour) - if err := solver.CleanUp(ctx, domainName, "", keyAuth); err != nil { + time.Sleep(waitBeforeCleanup) + if err := solver.CleanUp(ctx, domainName, zone, keyAuth); err != nil { log.Errorf("events: acme deploy: cleanup failed for %s: %v", domainName, err) } }() + if err != nil { + log.Errorf("events: acme deploy: DNS propagation check failed for '%s': %v", domainName, err) + return + } // Send back a response to HAProxy. rt, err := h.client.Runtime() @@ -266,3 +318,31 @@ func (h *HAProxyEventListener) handleAcmeDeployEvent(ctx context.Context, args s log.Debugf("events: OK: acme deploy %s => %s", domainName, resp) } + +// Parse an environment variable containing a duration in seconds, or return a default value. +func getEnvDuration(name string, def time.Duration) time.Duration { + str := os.Getenv(name) + if str == "" { + return def + } + if str == "-1" { + // special case to disable waiting for propagation + return -1 + } + sec, err := parseSeconds(str) + if err != nil { + return def + } + return sec +} + +func parseSeconds(s string) (time.Duration, error) { + num, err := strconv.Atoi(s) + if err != nil { + return 0, err + } + if num < 0 { + return 0, errors.New("negative number") + } + return time.Duration(num) * time.Second, nil +} diff --git a/cmd/dataplaneapi/main.go b/cmd/dataplaneapi/main.go index 1aecfe2b..36255e40 100644 --- a/cmd/dataplaneapi/main.go +++ b/cmd/dataplaneapi/main.go @@ -24,15 +24,11 @@ import ( "syscall" _ "github.com/KimMachineGun/automemlimit" - loads "github.com/go-openapi/loads" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/security" "github.com/haproxytech/client-native/v6/models" "github.com/haproxytech/client-native/v6/storage" "github.com/haproxytech/dataplaneapi" "github.com/haproxytech/dataplaneapi/configuration" "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/operations" socket_runtime "github.com/haproxytech/dataplaneapi/runtime" flags "github.com/jessevdk/go-flags" "github.com/joho/godotenv" @@ -80,32 +76,26 @@ func startRuntimeDebugServer() context.CancelFunc { return cancelDebugServer } -func startServer(cfg *configuration.Configuration, cancelDebugServer context.CancelFunc) (reload configuration.AtomicBool) { //nolint: maintidx - swaggerSpec, err := loads.Embedded(dataplaneapi.SwaggerJSON, dataplaneapi.FlatSwaggerJSON) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - +func startServer(cfg *configuration.Configuration, cancelDebugServer context.CancelFunc) (reload configuration.AtomicBool) { dataplaneapi.BuildTime = BuildTime dataplaneapi.Version = fmt.Sprintf("%s %s%s", GitTag, GitCommit, GitDirty) - api := operations.NewDataPlaneAPI(swaggerSpec) - server := dataplaneapi.NewServer(api) + server := dataplaneapi.NewServer() + server.Logger = log.Printf parser := flags.NewParser(server, flags.Default) parser.ShortDescription = "HAProxy Data Plane API" parser.LongDescription = "API for editing and managing haproxy instances" - server.ConfigureFlags() - for _, optsGroup := range api.CommandLineOptionsGroups { - _, err = parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) + for _, optsGroup := range dataplaneapi.GetCommandLineOptionsGroups() { + _, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) if err != nil { fmt.Println(err) os.Exit(1) } } + var err error _, err = parser.AddGroup("Show version", "Show build and version information", &cliOptions) if err != nil { fmt.Println(err) @@ -222,18 +212,6 @@ func startServer(cfg *configuration.Configuration, cancelDebugServer context.Can log.Fatalf("Error saving configuration: %s", err.Error()) } - // Applies when the Authorization header is set with the Basic scheme - api.BasicAuthAuth = configuration.AuthenticateUser - api.BasicAuthenticator = func(authentication security.UserPassAuthentication) runtime.Authenticator { - // if mTLS is enabled with backing Certificate Authority, skipping basic authentication - if len(server.TLSCACertificate) > 0 && server.TLSPort > 0 { - return runtime.AuthenticatorFunc(func(i any) (bool, any, error) { - return true, "", nil - }) - } - return security.BasicAuthRealm("", authentication) - } - dataplaneapi.ContextHandler.Init() go func() { <-cfg.Notify.Reload.Subscribe("main") diff --git a/cmd/generate/parents/constants.go b/cmd/generate/parents/constants.go new file mode 100644 index 00000000..fea1701b --- /dev/null +++ b/cmd/generate/parents/constants.go @@ -0,0 +1,48 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package parents + +const ( + ServerChildType = "server" + HTTPAfterResponseRuleChildType = "http_after_response_rule" + HTTPCheckChildType = "http_check" + HTTPErrorRuleChildType = "http_error_rule" + HTTPRequestRuleChildType = "http_request_rule" + HTTPResponseRuleChildType = "http_response_rule" + TCPCheckChildType = "tcp_check" + TCPRequestRuleChildType = "tcp_request_rule" + TCPResponseRuleChildType = "tcp_response_rule" + QUICInitialRuleType = "quic_initial_rule" + ACLChildType = "acl" + BindChildType = "bind" + FilterChildType = "filter" + LogTargetChildType = "log_target" + SSLFrontUseChildType = "ssl_front_use" +) + +type CnParentType string + +const ( + BackendParentType CnParentType = "backend" + FrontendParentType CnParentType = "frontend" + DefaultsParentType CnParentType = "defaults" + LogForwardParentType CnParentType = "log_forward" + PeerParentType CnParentType = "peers" + RingParentType CnParentType = "ring" + GlobalParentType CnParentType = "global" + FCGIAppParentType CnParentType = "fcgi-app" + ResolverParentType CnParentType = "resolvers" +) diff --git a/cmd/generate/parents/parents.go b/cmd/generate/parents/parents.go new file mode 100644 index 00000000..26ba457d --- /dev/null +++ b/cmd/generate/parents/parents.go @@ -0,0 +1,113 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package parents + +type Parent struct { + PathParentType string + ParentType string +} + +func Parents(childType string) []Parent { + switch childType { + case ServerChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "peers", ParentType: "Peer"}, + {PathParentType: "rings", ParentType: "Ring"}, + } + case HTTPAfterResponseRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case HTTPCheckChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case HTTPErrorRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case HTTPRequestRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case HTTPResponseRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case TCPCheckChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case TCPRequestRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case TCPResponseRuleChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case QUICInitialRuleType: + return []Parent{ + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case ACLChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "fcgi_apps", ParentType: "FCGIApp"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + } + case BindChildType: + return []Parent{ + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "log_forwards", ParentType: "LogForward"}, + {PathParentType: "peers", ParentType: "Peer"}, + } + case FilterChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + } + case LogTargetChildType: + return []Parent{ + {PathParentType: "backends", ParentType: "Backend"}, + {PathParentType: "frontends", ParentType: "Frontend"}, + {PathParentType: "defaults", ParentType: "Defaults"}, + {PathParentType: "peers", ParentType: "Peer"}, + {PathParentType: "log_forwards", ParentType: "LogForward"}, + } + case SSLFrontUseChildType: + return []Parent{ + {PathParentType: "frontends", ParentType: "Frontend"}, + } + } + return nil +} diff --git a/cmd/generate/specification/client_native.go b/cmd/generate/specification/client_native.go new file mode 100644 index 00000000..00a67d95 --- /dev/null +++ b/cmd/generate/specification/client_native.go @@ -0,0 +1,265 @@ +package main + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "maps" + "net/http" + "os" + "path/filepath" + "strings" + "time" + + "github.com/getkin/kin-openapi/openapi2" + "github.com/getkin/kin-openapi/openapi2conv" + "github.com/getkin/kin-openapi/openapi3" + "golang.org/x/mod/modfile" + "golang.org/x/mod/module" + "gopkg.in/yaml.v3" +) + +// loadClientNativeSchemas fetches the HAProxy client-native Swagger 2.0 spec for the pinned +// dependency version, converts it to OpenAPI 3, and returns all component schemas. +func loadClientNativeSchemas(specDir string) (openapi3.Schemas, error) { + goModPath := filepath.Join(specDir, "..", "go.mod") + goModData, err := os.ReadFile(goModPath) + if err != nil { + return nil, fmt.Errorf("reading go.mod: %w", err) + } + + version, modulePath, err := findClientNativeModule(goModData) + if err != nil { + return nil, err + } + + data, err := fetchClientNativeSpec(modulePath, version, filepath.Dir(goModPath)) + if err != nil { + return nil, err + } + + v3doc, err := convertSwaggerToV3(data) + if err != nil { + return nil, fmt.Errorf("converting spec: %w", err) + } + + if v3doc.Components == nil { + return openapi3.Schemas{}, nil + } + return v3doc.Components.Schemas, nil +} + +// findClientNativeModule parses go.mod and returns the version string and module path of the +// direct github.com/haproxytech/client-native/vN dependency, honoring replace directives. +// A local filesystem replace returns the replacement directory as modulePath with an empty +// version; the caller reads the spec from disk instead of fetching it. +func findClientNativeModule(goModData []byte) (version, modulePath string, err error) { + f, err := modfile.Parse("go.mod", goModData, nil) + if err != nil { + return "", "", fmt.Errorf("parsing go.mod: %w", err) + } + + const cnPrefix = "github.com/haproxytech/client-native/v" + for _, req := range f.Require { + if req.Indirect || !strings.HasPrefix(req.Mod.Path, cnPrefix) { + continue + } + version, modulePath = req.Mod.Version, req.Mod.Path + for _, rep := range f.Replace { + if rep.Old.Path != modulePath || (rep.Old.Version != "" && rep.Old.Version != version) { + continue + } + if rep.New.Version == "" { + // Filesystem replacement: New.Path is a directory. + return "", rep.New.Path, nil + } + version, modulePath = rep.New.Version, rep.New.Path + } + return version, modulePath, nil + } + return "", "", errors.New("direct client-native dependency not found in go.mod") +} + +// specSubPath is the location of the HAProxy OpenAPI 2 spec inside the client-native repository. +const specSubPath = "specification/build/haproxy_spec.yaml" + +// fetchClientNativeSpec returns the haproxy_spec.yaml contents for the given client-native +// module path and version. An empty version means a local filesystem replace directive: +// modulePath is then a directory (relative to goModDir unless absolute) and the spec is read +// from disk. Otherwise only the spec file is downloaded directly from the source repository's +// raw file endpoint. The whole module is never pulled: a Go module cache may hold the +// dependency as an un-extracted zip (e.g. in clean CI jobs that build no package importing +// client-native), so reading the file from disk is unreliable. +func fetchClientNativeSpec(modulePath, version, goModDir string) ([]byte, error) { + if version == "" { + dir := modulePath + if !filepath.IsAbs(dir) { + dir = filepath.Join(goModDir, dir) + } + localPath := filepath.Join(dir, filepath.FromSlash(specSubPath)) + fmt.Printf("reading client-native spec from local replace: %s\n", localPath) + return os.ReadFile(localPath) //nolint:gosec // dev-time generator; path comes from the developer's own go.mod replace directive + } + + specURL, err := rawSpecURL(modulePath, version) + if err != nil { + return nil, err + } + + fmt.Printf("fetching client-native spec: %s\n", specURL) + + client := &http.Client{Timeout: 60 * time.Second} + resp, err := client.Get(specURL) //nolint:noctx // dev-time generator; timeout is set on the client + if err != nil { + return nil, fmt.Errorf("fetching %s: %w", specURL, err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("fetching %s: unexpected status %s", specURL, resp.Status) + } + + data, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("reading %s: %w", specURL, err) + } + return data, nil +} + +// rawSpecURL builds the raw-file URL for the spec from a Go module path +// (e.g. github.com/haproxytech/client-native/v6) and a module version. Tagged versions are used +// as the git ref directly; pseudo-versions (vX.Y.Z--) resolve to their commit +// hash. GitHub and GitLab raw-content URL layouts are both supported. +func rawSpecURL(modulePath, version string) (string, error) { + parts := strings.Split(modulePath, "/") + if len(parts) < 3 { + return "", fmt.Errorf("unexpected module path %q", modulePath) + } + host, owner, repo := parts[0], parts[1], parts[2] + + ref := gitRefFromVersion(version) + + if strings.Contains(host, "gitlab") { + return fmt.Sprintf("https://%s/%s/%s/-/raw/%s/%s", host, owner, repo, ref, specSubPath), nil + } + // Default to GitHub's raw-content host. + return fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/%s/%s", owner, repo, ref, specSubPath), nil +} + +// gitRefFromVersion returns the git ref to fetch for a module version. For a Go pseudo-version +// (e.g. v6.3.1-0.20260520132134-5762461b033f) the trailing commit hash is the ref; +// for a normal tag (e.g. v6.3.8) the version string itself is the ref. +func gitRefFromVersion(version string) string { + if module.IsPseudoVersion(version) { + if i := strings.LastIndex(version, "-"); i >= 0 { + return version[i+1:] + } + } + return version +} + +// convertSwaggerToV3 parses a Swagger 2.0 YAML document and converts it to an OpenAPI 3 doc. +// The YAML→map→JSON→openapi2.T pipeline is used for maximum compatibility. +func convertSwaggerToV3(data []byte) (*openapi3.T, error) { + // Decode into interface{} first; yaml.v3 can produce map[interface{}]interface{} for + // nested maps, which json.Marshal cannot handle — normalizeForJSON converts them to + // map[string]interface{} recursively. + var raw any + if err := yaml.Unmarshal(data, &raw); err != nil { + return nil, fmt.Errorf("parsing YAML: %w", err) + } + jsonData, err := json.Marshal(normalizeForJSON(raw)) + if err != nil { + return nil, fmt.Errorf("re-encoding as JSON: %w", err) + } + var v2doc openapi2.T + if err := json.Unmarshal(jsonData, &v2doc); err != nil { + return nil, fmt.Errorf("parsing OpenAPI 2 doc: %w", err) + } + return openapi2conv.ToV3(&v2doc) +} + +// normalizeForJSON recursively converts map[interface{}]interface{} (produced by yaml.v3 for +// some nested structures) to map[string]interface{} so json.Marshal can serialize it. +func normalizeForJSON(v any) any { + switch val := v.(type) { + case map[any]any: + out := make(map[string]any, len(val)) + for k, elem := range val { + out[fmt.Sprintf("%v", k)] = normalizeForJSON(elem) + } + return out + case map[string]any: + for k, elem := range val { + val[k] = normalizeForJSON(elem) + } + return val + case []any: + for i, elem := range val { + val[i] = normalizeForJSON(elem) + } + return val + default: + return v + } +} + +// replaceStubSchemas replaces each schema in schemas that is a stub (only x-go-type, no real +// definition) with the full definition from cnSchemas, preserving all x-go-* extensions. +// It tries the schema's own name first (cn uses lowercase names), then the CamelCase Go type name. +func replaceStubSchemas(schemas openapi3.Schemas, cnSchemas openapi3.Schemas) { + for name, ref := range schemas { + if ref == nil || ref.Value == nil { + continue + } + goType := extractGoType(ref.Value) + if goType == "" { + continue + } + // cn spec uses lowercase definition names (e.g. "backend"), but x-go-type is CamelCase + // ("models.Backend"). Try the schema's own name first, then the CamelCase type name. + cnRef, ok := cnSchemas[name] + if !ok || cnRef == nil || cnRef.Value == nil { + cnRef, ok = cnSchemas[goType] + } + if !ok || cnRef == nil || cnRef.Value == nil { + continue + } + // Shallow-copy the cn schema value and overlay our x-go-* extensions so codegen still works. + newVal := *cnRef.Value + merged := make(map[string]any, len(newVal.Extensions)+len(ref.Value.Extensions)) + maps.Copy(merged, newVal.Extensions) + // our x-go-* extensions take priority + maps.Copy(merged, ref.Value.Extensions) + newVal.Extensions = merged + schemas[name] = openapi3.NewSchemaRef("", &newVal) + } +} + +// extractGoType returns the bare type name from an x-go-type extension +// (e.g. "models.Backend" → "Backend"), or "" if the schema has no such extension. +func extractGoType(schema *openapi3.Schema) string { + if len(schema.Extensions) == 0 { + return "" + } + raw, ok := schema.Extensions["x-go-type"] + if !ok { + return "" + } + var s string + switch v := raw.(type) { + case string: + s = v + case json.RawMessage: + if err := json.Unmarshal(v, &s); err != nil { + return "" + } + default: + return "" + } + if i := strings.LastIndex(s, "."); i >= 0 { + return s[i+1:] + } + return s +} diff --git a/cmd/generate/specification/combine.go b/cmd/generate/specification/combine.go new file mode 100644 index 00000000..47f9fe48 --- /dev/null +++ b/cmd/generate/specification/combine.go @@ -0,0 +1,237 @@ +package main + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "gopkg.in/yaml.v3" +) + +func buildCombinedSpec(specDir string) error { + pathsDir := filepath.Join(specDir, "paths") + modelsDir := filepath.Join(specDir, "models") + buildDir := filepath.Join(specDir, "build") + + if err := os.MkdirAll(buildDir, 0o755); err != nil { + return fmt.Errorf("creating build dir: %w", err) + } + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + ctx := context.Background() + + combined := &openapi3.T{ + OpenAPI: "3.0.1", + Info: &openapi3.Info{Title: "HAProxy Data Plane API", Version: "3.0"}, + Servers: openapi3.Servers{{URL: "/v3"}}, + Paths: openapi3.NewPathsWithCapacity(256), + Components: &openapi3.Components{ + Schemas: make(openapi3.Schemas), + Responses: make(openapi3.ResponseBodies), + SecuritySchemes: openapi3.SecuritySchemes{ + "basic_auth": &openapi3.SecuritySchemeRef{ + Value: &openapi3.SecurityScheme{Type: "http", Scheme: "basic"}, + }, + }, + }, + // Global security requirement, mirroring the original specification. + // This is declarative in the published document; authentication is enforced + // by a separate middleware layer, not the OpenAPI request validator. + Security: openapi3.SecurityRequirements{ + openapi3.SecurityRequirement{"basic_auth": []string{}}, + }, + } + + cnSchemas, cnErr := loadClientNativeSchemas(specDir) + if cnErr != nil { + // Proceeding without these schemas would silently produce a structurally + // different spec (x-go-type stubs left unreplaced). + return fmt.Errorf("loading client-native schemas: %w", cnErr) + } + + // Include everything declared in models/ (ensures completeness even for unreferenced items) + if err := filepath.Walk(modelsDir, func(path string, info os.FileInfo, err error) error { + if err != nil || info.IsDir() || filepath.Ext(path) != ".yaml" { + return err + } + return mergeModels(loader, path, combined) + }); err != nil { + return fmt.Errorf("processing models: %w", err) + } + + // Merge paths from every oapi.yaml + if err := filepath.Walk(pathsDir, func(path string, info os.FileInfo, err error) error { + if err != nil || info.IsDir() || info.Name() != "oapi.yaml" { + return err + } + specPath, cleanup, prepErr := prepareSpec(path, filepath.Base(filepath.Dir(path))) + if prepErr != nil { + return fmt.Errorf("preparing %s: %w", path, prepErr) + } + defer cleanup() + return mergeAPIPaths(ctx, loader, specPath, combined) + }); err != nil { + return fmt.Errorf("processing paths: %w", err) + } + + // Replace x-go-type stubs with their full definitions from client-native. + if cnSchemas != nil { + replaceStubSchemas(combined.Components.Schemas, cnSchemas) + // Seed any remaining cn schemas not already present so that internal $refs + // within replaced schemas (e.g. "#/components/schemas/balance_base") resolve. + for k, v := range cnSchemas { + if _, exists := combined.Components.Schemas[k]; !exists { + combined.Components.Schemas[k] = v + } + } + } + + // Marshal to an intermediate yaml.Node so we can control key ordering. + var raw bytes.Buffer + rawEnc := yaml.NewEncoder(&raw) + rawEnc.SetIndent(2) + if err := rawEnc.Encode(combined); err != nil { + return fmt.Errorf("marshaling combined spec: %w", err) + } + + var doc yaml.Node + if err := yaml.Unmarshal(raw.Bytes(), &doc); err != nil { + return fmt.Errorf("parsing spec for reorder: %w", err) + } + if len(doc.Content) > 0 { + // Move components and paths to the end of the top-level mapping. + sortMappingKeysLast(doc.Content[0], "components", "paths") + } + + outPath := filepath.Join(buildDir, "dataplane_spec.yaml") + var buf bytes.Buffer + enc := yaml.NewEncoder(&buf) + enc.SetIndent(2) + if err := enc.Encode(&doc); err != nil { + return fmt.Errorf("encoding reordered spec: %w", err) + } + if err := os.WriteFile(outPath, buf.Bytes(), 0o644); err != nil { //nolint:gosec // generated spec is non-sensitive and meant to be world-readable + return fmt.Errorf("writing %s: %w", outPath, err) + } + fmt.Printf("wrote combined spec: %s\n", outPath) + return nil +} + +func mergeModels(loader *openapi3.Loader, path string, combined *openapi3.T) error { + doc, err := loader.LoadFromFile(path) + if err != nil { + return fmt.Errorf("loading %s: %w", path, err) + } + if doc.Components == nil { + return nil + } + if err := mergeComponents(combined.Components.Schemas, doc.Components.Schemas, "schema", path); err != nil { + return err + } + return mergeComponents(combined.Components.Responses, doc.Components.Responses, "response", path) +} + +func mergeAPIPaths(ctx context.Context, loader *openapi3.Loader, specPath string, combined *openapi3.T) error { + doc, err := loader.LoadFromFile(specPath) + if err != nil { + return fmt.Errorf("loading %s: %w", specPath, err) + } + + if doc.Components == nil { + doc.Components = &openapi3.Components{ + Schemas: make(openapi3.Schemas), + Responses: make(openapi3.ResponseBodies), + } + } + + // Rewrite external $refs (e.g. models.yaml#/components/responses/DefaultError) + // into internal #/components/... refs and pull them into doc.Components. + doc.InternalizeRefs(ctx, componentBaseName) + + if err := mergeComponents(combined.Components.Schemas, doc.Components.Schemas, "schema", specPath); err != nil { + return err + } + if err := mergeComponents(combined.Components.Responses, doc.Components.Responses, "response", specPath); err != nil { + return err + } + + // Merge paths + for p, item := range doc.Paths.Map() { + if combined.Paths.Value(p) != nil { + return fmt.Errorf("duplicate path %s (from %s)", p, specPath) + } + combined.Paths.Set(p, item) + } + + return nil +} + +// mergeComponents copies src components into dst. The same component arriving from several +// files is fine as long as every copy is identical (InternalizeRefs pulls shared models like +// DefaultError into each package's doc); two different definitions flattened to the same +// name would silently shadow each other, so that is a hard error. +func mergeComponents[V any](dst, src map[string]V, kind, source string) error { + for name, ref := range src { + existing, ok := dst[name] + if !ok { + dst[name] = ref + continue + } + a, err := json.Marshal(existing) + if err != nil { + return fmt.Errorf("marshaling %s component %q: %w", kind, name, err) + } + b, err := json.Marshal(ref) + if err != nil { + return fmt.Errorf("marshaling %s component %q (from %s): %w", kind, name, source, err) + } + if !bytes.Equal(a, b) { + return fmt.Errorf("%s component %q from %s conflicts with an existing definition of the same name", kind, name, source) + } + } + return nil +} + +// componentBaseName extracts just the final component name from a ref string. +// "models.yaml#/components/responses/DefaultError" → "DefaultError" +func componentBaseName(_ *openapi3.T, ref openapi3.ComponentRef) string { + s := ref.RefString() + if i := strings.LastIndex(s, "/"); i >= 0 { + return s[i+1:] + } + return s +} + +// sortMappingKeysLast moves the named keys to the end of a YAML mapping node, +// preserving the relative order of both the moved and unmoved keys. +func sortMappingKeysLast(node *yaml.Node, keys ...string) { + if node == nil || node.Kind != yaml.MappingNode { + return + } + last := make(map[string]bool, len(keys)) + for _, k := range keys { + last[k] = true + } + + type pair struct{ k, v *yaml.Node } + var head, tail []pair + for i := 0; i+1 < len(node.Content); i += 2 { + p := pair{node.Content[i], node.Content[i+1]} + if last[p.k.Value] { + tail = append(tail, p) + } else { + head = append(head, p) + } + } + + node.Content = node.Content[:0] + for _, p := range append(head, tail...) { + node.Content = append(node.Content, p.k, p.v) + } +} diff --git a/cmd/generate/specification/embed.go b/cmd/generate/specification/embed.go new file mode 100644 index 00000000..19ce8a84 --- /dev/null +++ b/cmd/generate/specification/embed.go @@ -0,0 +1,145 @@ +package main + +import ( + "bytes" + "compress/flate" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "os" + "path/filepath" + "text/template" + + "github.com/getkin/kin-openapi/openapi3" +) + +const embeddedSpecTemplate = `// Code generated by cmd/generate/specification; DO NOT EDIT. +package specification + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "strings" +) + +// dataplaneSpec is the full HAProxy Data Plane API OpenAPI v3 specification, +// base64-encoded and compressed with deflate. +var dataplaneSpec = []string{ +{{- range .Chunks}} + "{{.}}", +{{- end}} +} + +func decodeDataplaneSpec() ([]byte, error) { + encoded := strings.Join(dataplaneSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + return buf.Bytes(), nil +} + +var rawDataplaneSpec = decodeDataplaneSpecCached() + +func decodeDataplaneSpecCached() func() ([]byte, error) { + data, err := decodeDataplaneSpec() + return func() ([]byte, error) { + return data, err + } +} + +// GetDataplaneSpecJSON returns the raw JSON bytes of the full embedded OpenAPI v3 specification. +// The result is cached at package init time, so repeated calls are cheap. +func GetDataplaneSpecJSON() ([]byte, error) { + return rawDataplaneSpec() +} +` + +// buildEmbeddedGoSpec reads the combined YAML spec from specDir/build/dataplane_spec.yaml, +// converts it to JSON, and writes an embedded Go source file to outputPath. +func buildEmbeddedGoSpec(specDir, outputPath string) error { + specPath := filepath.Join(specDir, "build", "dataplane_spec.yaml") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + doc, err := loader.LoadFromFile(specPath) + if err != nil { + return fmt.Errorf("loading %s: %w", specPath, err) + } + // Hard-fail on structural validation errors, but tolerate invalid examples: + // the client-native spec currently ships examples that don't match their + // schemas, and we need to keep working with it as-is. + if err = doc.Validate(context.Background(), openapi3.DisableExamplesValidation()); err != nil { + return fmt.Errorf("spec validation: %w", err) + } + if err = doc.Validate(context.Background()); err != nil { + fmt.Fprintf(os.Stderr, "warning: spec example validation: %v\n", err) + } + + jsonBytes, err := json.Marshal(doc) + if err != nil { + return fmt.Errorf("marshaling spec to JSON: %w", err) + } + + chunks, err := compressAndChunk(jsonBytes) + if err != nil { + return fmt.Errorf("compressing spec: %w", err) + } + + tmpl, err := template.New("embed").Parse(embeddedSpecTemplate) + if err != nil { + return fmt.Errorf("parsing template: %w", err) + } + + var buf bytes.Buffer + if err = tmpl.Execute(&buf, struct{ Chunks []string }{Chunks: chunks}); err != nil { + return fmt.Errorf("executing template: %w", err) + } + + if err = os.MkdirAll(filepath.Dir(outputPath), 0o755); err != nil { + return fmt.Errorf("creating output dir: %w", err) + } + if err = os.WriteFile(outputPath, buf.Bytes(), 0o644); err != nil { //nolint:gosec // generated Go source is non-sensitive and meant to be world-readable + return fmt.Errorf("writing %s: %w", outputPath, err) + } + fmt.Printf("wrote embedded spec: %s\n", outputPath) + return nil +} + +// compressAndChunk deflate-compresses data, base64-encodes it, and splits +// the result into 76-character chunks (matching oapi-codegen's output format). +func compressAndChunk(data []byte) ([]string, error) { + var compressed bytes.Buffer + w, err := flate.NewWriter(&compressed, flate.BestCompression) + if err != nil { + return nil, err + } + if _, err = w.Write(data); err != nil { + return nil, err + } + if err = w.Close(); err != nil { + return nil, err + } + + encoded := base64.StdEncoding.EncodeToString(compressed.Bytes()) + + const chunkSize = 76 + var chunks []string + for len(encoded) > 0 { + n := min(chunkSize, len(encoded)) + chunks = append(chunks, encoded[:n]) + encoded = encoded[n:] + } + return chunks, nil +} diff --git a/cmd/generate/specification/main.go b/cmd/generate/specification/main.go new file mode 100644 index 00000000..b1e3d878 --- /dev/null +++ b/cmd/generate/specification/main.go @@ -0,0 +1,129 @@ +package main + +import ( + "bytes" + "flag" + "fmt" + "os" + "os/exec" + "path/filepath" + "text/template" + + "github.com/haproxytech/dataplaneapi/cmd/generate/parents" +) + +func main() { + specDir := flag.String("spec-dir", "specification", "Path to the specification directory") + embeddedOut := flag.String("embedded-out", "handlers/dataplane/specification/dataplane_spec.gen.go", "Output path for the embedded Go spec file") + oapiCodegen := flag.String("oapi-codegen", filepath.Join("bin", "oapi-codegen"), "Path to the pinned oapi-codegen binary") + flag.Parse() + + // Only the version-pinned binary that `make specification` installs into bin/ + // may be used: an unpinned oapi-codegen from PATH produces different .gen.go + // output across versions, silently rewriting every generated file. + if _, err := os.Stat(*oapiCodegen); err != nil { + fmt.Fprintf(os.Stderr, "error: pinned oapi-codegen not found at %s — generate via 'make specification'\n", *oapiCodegen) + os.Exit(1) + } + + pathsDir := filepath.Join(*specDir, "paths") + + var failed []string + + err := filepath.Walk(pathsDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() || info.Name() != "handlers.conf.yaml" { + return nil + } + + dir := filepath.Dir(path) + folderName := filepath.Base(dir) + oapiSpec := filepath.Join(dir, "oapi.yaml") + + if _, statErr := os.Stat(oapiSpec); os.IsNotExist(statErr) { + // Skipping here would leave the resource's stale .gen.go in place. + fmt.Fprintf(os.Stderr, "error: no oapi.yaml next to %s\n", path) + failed = append(failed, path) + return nil + } + + fmt.Printf("generating %s\n", path) + + specPath, cleanup, prepErr := prepareSpec(oapiSpec, folderName) + if prepErr != nil { + fmt.Fprintf(os.Stderr, "error: preparing spec %s: %v\n", oapiSpec, prepErr) + failed = append(failed, path) + return nil + } + defer cleanup() + + cmd := exec.Command(*oapiCodegen, "--config="+path, specPath) //nolint:gosec // dev-time code generator; paths come from the trusted spec tree + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if runErr := cmd.Run(); runErr != nil { + fmt.Fprintf(os.Stderr, "error: oapi-codegen failed for %s: %v\n", path, runErr) + failed = append(failed, path) + } + return nil + }) + if err != nil { + fmt.Fprintf(os.Stderr, "error: walking %s: %v\n", pathsDir, err) + os.Exit(1) + } + + if len(failed) > 0 { + fmt.Fprintf(os.Stderr, "%d spec(s) failed to generate\n", len(failed)) + os.Exit(1) + } + + if err := buildCombinedSpec(*specDir); err != nil { + fmt.Fprintf(os.Stderr, "error: building combined spec: %v\n", err) + os.Exit(1) + } + + if err := buildEmbeddedGoSpec(*specDir, *embeddedOut); err != nil { + fmt.Fprintf(os.Stderr, "error: building embedded Go spec: %v\n", err) + os.Exit(1) + } +} + +// prepareSpec returns the path to the spec file to pass to oapi-codegen and a cleanup function. +// For child resources with parents, it template-expands oapi.yaml into a temp file first. +func prepareSpec(oapiSpec, folderName string) (specPath string, cleanup func(), err error) { + resourceParents := parents.Parents(folderName) + if len(resourceParents) == 0 { + return oapiSpec, func() {}, nil + } + + tmplData, err := os.ReadFile(oapiSpec) + if err != nil { + return "", nil, err + } + + tmpl, err := template.New("oapi").Funcs(template.FuncMap{ + "parents": func() []parents.Parent { return resourceParents }, + }).Parse(string(tmplData)) + if err != nil { + return "", nil, fmt.Errorf("parsing template: %w", err) + } + + var buf bytes.Buffer + if err = tmpl.Execute(&buf, nil); err != nil { + return "", nil, fmt.Errorf("executing template: %w", err) + } + + // Write temp file alongside oapi.yaml so relative $refs resolve correctly. + tmpFile, err := os.CreateTemp(filepath.Dir(oapiSpec), "oapi-expanded-*.yaml") + if err != nil { + return "", nil, fmt.Errorf("creating temp file: %w", err) + } + if _, err = tmpFile.Write(buf.Bytes()); err != nil { + _ = os.Remove(tmpFile.Name()) + return "", nil, fmt.Errorf("writing temp file: %w", err) + } + tmpFile.Close() + + return tmpFile.Name(), func() { os.Remove(tmpFile.Name()) }, nil +} diff --git a/cmd/gitlab-mr-checker/main.go b/cmd/gitlab-mr-checker/main.go index 5285aaf8..b6f395fc 100644 --- a/cmd/gitlab-mr-checker/main.go +++ b/cmd/gitlab-mr-checker/main.go @@ -221,18 +221,18 @@ func startThreadOnMergeRequest(baseURL, token, projectID string, mergeRequestIID os.Exit(1) } - req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, + req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, //nolint:gosec // URL constructed from trusted CI environment variables fmt.Sprintf("%s/projects/%s/merge_requests/%d/discussions", baseURL, url.PathEscape(projectID), mergeRequestIID), bytes.NewBuffer(threadDataBytes)) if err != nil { - slog.Error(err.Error()) + slog.Error(err.Error()) //nolint:gosec // log message from trusted CI environment variables os.Exit(1) } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader req.Header.Add("Content-Type", "application/json") - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { - slog.Error(err.Error()) + slog.Error(err.Error()) //nolint:gosec // log message from trusted CI environment variables os.Exit(1) } defer resp.Body.Close() @@ -241,14 +241,14 @@ func startThreadOnMergeRequest(baseURL, token, projectID string, mergeRequestIID func getMergeRequest(baseURL, token, projectID string, mergeRequestIID int) (*MergeRequest, error) { client := &http.Client{} - req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, //nolint:gosec // URL constructed from trusted CI environment variables fmt.Sprintf("%s/projects/%s/merge_requests/%d", baseURL, url.PathEscape(projectID), mergeRequestIID), nil) if err != nil { return nil, err } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return nil, err } @@ -276,14 +276,14 @@ func getMergeRequest(baseURL, token, projectID string, mergeRequestIID int) (*Me func getMergeRequestComments(baseURL, token, projectID string, mergeRequestIID int) ([]Note, error) { client := &http.Client{} - req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, //nolint:gosec // URL constructed from trusted CI environment variables fmt.Sprintf("%s/projects/%s/merge_requests/%d/notes", baseURL, url.PathEscape(projectID), mergeRequestIID), nil) if err != nil { return nil, err } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return nil, err } @@ -309,13 +309,13 @@ func getProjectlabels(backportLabels map[string]struct{}, projectID string) erro if token == "" { return errors.New("GITLAB_TOKEN not set") } - req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, //nolint:gosec // URL constructed from trusted CI environment variables fmt.Sprintf("%s/projects/%s/labels", baseURL, url.PathEscape(projectID)), nil) if err != nil { return fmt.Errorf("failed to create request: %w", err) } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return fmt.Errorf("failed to get project labels: %w", err) } @@ -353,14 +353,14 @@ func getProjectlabels(backportLabels map[string]struct{}, projectID string) erro if err != nil { return fmt.Errorf("failed to marshal label data: %w", err) } - req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, + req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, //nolint:gosec // URL constructed from trusted CI environment variables fmt.Sprintf("%s/projects/%s/labels", baseURL, url.PathEscape(projectID)), bytes.NewBuffer(labelDataBytes)) if err != nil { return fmt.Errorf("failed to create request to create label: %w", err) } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader req.Header.Add("Content-Type", "application/json") - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return fmt.Errorf("failed to create label %s: %w", label, err) } @@ -387,13 +387,13 @@ func GetBranches() ([]string, error) { nextPageURL := fmt.Sprintf("%s/projects/%s/repository/branches", baseURL, url.PathEscape(projectID)) for nextPageURL != "" { - req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, nextPageURL, nil) + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, nextPageURL, nil) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } req.Header.Add("PRIVATE-TOKEN", token) //nolint:canonicalheader - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return nil, fmt.Errorf("failed to get branches: %w", err) } diff --git a/cmd/gitlab-mr-pipelines/main.go b/cmd/gitlab-mr-pipelines/main.go index 9eca2569..709253bf 100644 --- a/cmd/gitlab-mr-pipelines/main.go +++ b/cmd/gitlab-mr-pipelines/main.go @@ -96,14 +96,14 @@ func getOldMergeRequestPipelines(apiURL, projectID, mrIID, token string) ([]pipe } url := fmt.Sprintf("%s/projects/%s/merge_requests/%s/pipelines", apiURL, projectID, mrIID) - req, err := http.NewRequest("GET", url, nil) //nolint:noctx,usestdlibvars + req, err := http.NewRequest("GET", url, nil) //nolint:noctx,usestdlibvars,gosec // URL constructed from trusted CI environment variables if err != nil { return nil, err } req.Header.Set("PRIVATE-TOKEN", token) //nolint:canonicalheader client := &http.Client{} - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return nil, err } @@ -132,14 +132,14 @@ func getOldMergeRequestPipelines(apiURL, projectID, mrIID, token string) ([]pipe func cancelPipeline(apiURL, projectID string, pipelineID int, token string) error { url := fmt.Sprintf("%s/projects/%s/pipelines/%d/cancel", apiURL, projectID, pipelineID) - req, err := http.NewRequest("POST", url, nil) //nolint:noctx,usestdlibvars + req, err := http.NewRequest("POST", url, nil) //nolint:noctx,usestdlibvars,gosec // URL constructed from trusted CI environment variables if err != nil { return err } req.Header.Set("PRIVATE-TOKEN", token) //nolint:canonicalheader client := &http.Client{} - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint:gosec // URL constructed from trusted CI environment variables if err != nil { return err } diff --git a/cmd/govulncheck-report/main.go b/cmd/govulncheck-report/main.go index dd8b101b..a02dc4fe 100644 --- a/cmd/govulncheck-report/main.go +++ b/cmd/govulncheck-report/main.go @@ -70,7 +70,7 @@ func main() { } currentBranch = string(out) } - slog.Info("Current branch: " + currentBranch) + slog.Info("Current branch: " + currentBranch) //nolint:gosec // log message from trusted CI environment variables cmd := exec.Command("govulncheck", "./...") out, _ := cmd.Output() @@ -135,7 +135,7 @@ func main() { } func createIssue(baseURL, token, projectID string, title, commentBody string) { - slog.Info("Active issue with title '" + title + "' not found in project " + projectID) + slog.Info("Active issue with title '" + title + "' not found in project " + projectID) //nolint:gosec // log message from trusted CI environment variables // Create the issue here issueData := map[string]any{ "title": title, diff --git a/configuration/cluster_sync.go b/configuration/cluster_sync.go index dc70b344..e48c019c 100644 --- a/configuration/cluster_sync.go +++ b/configuration/cluster_sync.go @@ -41,8 +41,8 @@ import ( "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/haproxy" "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" ) const DataplaneAPIType = "community" @@ -69,7 +69,7 @@ type ClusterSync struct { certFetch chan struct{} cli client_native.HAProxyClient Context context.Context - ReloadAgent haproxy.IReloadAgent + ReloadAgent reload_agent.IReloadAgent } var expectedResponseCodes = map[string]int{ diff --git a/configuration/configuration.go b/configuration/configuration.go index e8d20fde..ad0d4f51 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -49,6 +49,8 @@ type HAProxyConfiguration struct { ReloadStrategy string `long:"reload-strategy" description:"Either systemd, s6 or custom" default:"custom" group:"reload"` TransactionDir string `short:"t" long:"transaction-dir" description:"Path to the transaction directory" default:"/tmp/haproxy" group:"transaction"` ValidateCmd string `long:"validate-cmd" description:"Executes a custom command to perform the HAProxy configuration check" group:"reload"` + ValidateFilesBefore []string `long:"validate-files-before" description:"A list of configuration files to be loaded before the main file for validation" group:"reload"` + ValidateFilesAfter []string `long:"validate-files-after" description:"A list of configuration files to be loaded after the main file for validation" group:"reload"` BackupsDir string `long:"backups-dir" description:"Path to directory in which to place backup files" group:"transaction"` MapsDir string `short:"p" long:"maps-dir" description:"Path to directory of map files managed by dataplane" default:"/etc/haproxy/maps" group:"resources"` SpoeTransactionDir string `long:"spoe-transaction-dir" description:"Path to the SPOE transaction directory" default:"/tmp/spoe-haproxy" group:"resources"` diff --git a/configuration/configuration_storage.go b/configuration/configuration_storage.go index a29ec412..f90e4c80 100644 --- a/configuration/configuration_storage.go +++ b/configuration/configuration_storage.go @@ -31,6 +31,7 @@ type configTypeDataplaneapi struct { GracefulTimeout *string `yaml:"graceful_timeout,omitempty"` ShowSystemInfo *bool `yaml:"show_system_info,omitempty"` MaxHeaderSize *string `yaml:"max_header_size,omitempty"` + MaxBodySize *string `yaml:"max_body_size,omitempty"` SocketPath *flags.Filename `yaml:"socket_path,omitempty"` DebugSocketPath *string `yaml:"debug_socket_path,omitempty"` Host *string `yaml:"host,omitempty"` @@ -81,14 +82,16 @@ type configTypeUserlist struct { } type configTypeReload struct { - ReloadDelay *int `yaml:"reload_delay,omitempty"` - ReloadCmd *string `yaml:"reload_cmd,omitempty"` - RestartCmd *string `yaml:"restart_cmd,omitempty"` - StatusCmd *string `yaml:"status_cmd,omitempty"` - ServiceName *string `yaml:"service_name,omitempty"` - ReloadRetention *int `yaml:"reload_retention,omitempty"` - ReloadStrategy *string `yaml:"reload_strategy,omitempty"` - ValidateCmd *string `yaml:"validate_cmd,omitempty"` + ReloadDelay *int `yaml:"reload_delay,omitempty"` + ReloadCmd *string `yaml:"reload_cmd,omitempty"` + RestartCmd *string `yaml:"restart_cmd,omitempty"` + StatusCmd *string `yaml:"status_cmd,omitempty"` + ServiceName *string `yaml:"service_name,omitempty"` + ReloadRetention *int `yaml:"reload_retention,omitempty"` + ReloadStrategy *string `yaml:"reload_strategy,omitempty"` + ValidateCmd *string `yaml:"validate_cmd,omitempty"` + ValidateFilesBefore *[]string `yaml:"validate_files_before,omitempty"` + ValidateFilesAfter *[]string `yaml:"validate_files_after,omitempty"` } type configTypeTransaction struct { @@ -252,6 +255,12 @@ func copyToConfiguration(cfg *Configuration) { //nolint:cyclop,maintidx if cfgStorage.Haproxy != nil && cfgStorage.Haproxy.Reload != nil && cfgStorage.Haproxy.Reload.ValidateCmd != nil && !misc.HasOSArg("", "validate-cmd", "") { cfg.HAProxy.ValidateCmd = *cfgStorage.Haproxy.Reload.ValidateCmd } + if cfgStorage.Haproxy != nil && cfgStorage.Haproxy.Reload != nil && cfgStorage.Haproxy.Reload.ValidateFilesBefore != nil && !misc.HasOSArg("", "validate-files-before", "") { + cfg.HAProxy.ValidateFilesBefore = *cfgStorage.Haproxy.Reload.ValidateFilesBefore + } + if cfgStorage.Haproxy != nil && cfgStorage.Haproxy.Reload != nil && cfgStorage.Haproxy.Reload.ValidateFilesAfter != nil && !misc.HasOSArg("", "validate-files-after", "") { + cfg.HAProxy.ValidateFilesAfter = *cfgStorage.Haproxy.Reload.ValidateFilesAfter + } if cfgStorage.Dataplaneapi != nil && cfgStorage.Dataplaneapi.Transaction != nil && cfgStorage.Dataplaneapi.Transaction.TransactionDir != nil && !misc.HasOSArg("t", "transaction-dir", "") { cfg.HAProxy.TransactionDir = *cfgStorage.Dataplaneapi.Transaction.TransactionDir } diff --git a/configuration/dataplane_storage.go b/configuration/dataplane_storage.go index c9db3cd3..028221c9 100644 --- a/configuration/dataplane_storage.go +++ b/configuration/dataplane_storage.go @@ -51,22 +51,22 @@ func (c *Configuration) SaveClusterModeData() error { cfgCertificateFetched := cfgCluster.CertificateFetched.Load() dapiStorageCluster := storagetype.Cluster{ - APINodesPath: misc.StringP(cfgCluster.APINodesPath.Load()), - Token: misc.StringP(cfgCluster.Token.Load()), + APINodesPath: new(cfgCluster.APINodesPath.Load()), + Token: new(cfgCluster.Token.Load()), ClusterTLSCertDir: &c.HAProxy.ClusterTLSCertDir, - ActiveBootstrapKey: misc.StringP(cfgCluster.ActiveBootstrapKey.Load()), - APIRegisterPath: misc.StringP(cfgCluster.APIRegisterPath.Load()), - URL: misc.StringP(cfgCluster.URL.Load()), + ActiveBootstrapKey: new(cfgCluster.ActiveBootstrapKey.Load()), + APIRegisterPath: new(cfgCluster.APIRegisterPath.Load()), + URL: new(cfgCluster.URL.Load()), Port: &dPort, - StorageDir: misc.StringP(cfgCluster.StorageDir.Load()), - BootstrapKey: misc.StringP(cfgCluster.BootstrapKey.Load()), - ID: misc.StringP(cfgCluster.ID.Load()), - APIBasePath: misc.StringP(cfgCluster.APIBasePath.Load()), - CertificateDir: misc.StringP(cfgCluster.CertificateDir.Load()), + StorageDir: new(cfgCluster.StorageDir.Load()), + BootstrapKey: new(cfgCluster.BootstrapKey.Load()), + ID: new(cfgCluster.ID.Load()), + APIBasePath: new(cfgCluster.APIBasePath.Load()), + CertificateDir: new(cfgCluster.CertificateDir.Load()), CertificateFetched: &cfgCertificateFetched, - Name: misc.StringP(cfgCluster.Name.Load()), - Description: misc.StringP(cfgCluster.Description.Load()), - ClusterID: misc.StringP(cfgCluster.ClusterID.Load()), + Name: new(cfgCluster.Name.Load()), + Description: new(cfgCluster.Description.Load()), + ClusterID: new(cfgCluster.ClusterID.Load()), ClusterLogTargets: cfgCluster.ClusterLogTargets, } cfgStatus := c.Status.Load() diff --git a/configuration/doc/README.md b/configuration/doc/README.md index 67d9408f..fa0b6b30 100644 --- a/configuration/doc/README.md +++ b/configuration/doc/README.md @@ -23,6 +23,7 @@ The configuration file is structured into several sections, each corresponding t | `graceful_timeout` | string | No | Sets the graceful shutdown timeout | | `show_system_info` | boolean | No | Enables or disables the display of system information on the info endpoint | | `max_header_size` | string | No | Defines the maximum header size for API requests | +| `max_body_size` | string | No | Defines the maximum request body size the API will read; 0 means unlimited (defaults to 1GiB) | | `socket_path` | string | No | Specifies the path to the API's Unix socket | | `debug_socket_path` | string | No | Defines the path for the debugging command socket | | `host` | string | No | Sets the host address for the API | diff --git a/configuration/examples/example-full.yaml b/configuration/examples/example-full.yaml index 161006be..ad55e225 100644 --- a/configuration/examples/example-full.yaml +++ b/configuration/examples/example-full.yaml @@ -8,6 +8,7 @@ dataplaneapi: cleanup_timeout: "10s" # time.Duration graceful_timeout: "15s" # time.Duration max_header_size: "1MiB" # flagext.ByteSize + max_body_size: "1GiB" # flagext.ByteSize socket_path: "/var/run/data-plane.sock" # flags.Filename debug_socket_path: "/var/run/dataplane-debug.sock" #string host: "localhost" # string @@ -72,6 +73,9 @@ haproxy: reload_retention: 1 # int 2 reload_strategy: custom validate_cmd: null # string 2 + validate_files_before: + - "/etc/haproxy/global.def" + validate_files_after: [] # []string cluster: # Deprecated starting 3.0, see ./README.md for more information cluster_tls_dir: null # string id: null # string diff --git a/configuration/user_test.go b/configuration/user_test.go new file mode 100644 index 00000000..e177741a --- /dev/null +++ b/configuration/user_test.go @@ -0,0 +1,69 @@ +// Copyright 2026 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package configuration + +import ( + "testing" + + // register the SHA-256 crypt implementation, as the main package does + _ "github.com/GehirnInc/crypt/sha256_crypt" + "github.com/haproxytech/client-native/v6/config-parser/types" +) + +func TestAuthenticateUser(t *testing.T) { + store := GetUsersStore() + saved := store.users + t.Cleanup(func() { store.users = saved }) + store.users = []types.User{ + {Name: "insecure_user", Password: "plainpass", IsInsecure: true}, + // SHA-256 crypt of "secretpass" + {Name: "crypted_user", Password: "$5$testsalt$eCSeYT8Aub0tlGnCdlCmGO4RrnbXQZlcDzFHJWzOPa6"}, + } + + tests := []struct { + name string + user string + pass string + wantErr bool + }{ + {name: "insecure user correct password", user: "insecure_user", pass: "plainpass"}, + {name: "insecure user wrong password", user: "insecure_user", pass: "wrong", wantErr: true}, + {name: "crypted user correct password", user: "crypted_user", pass: "secretpass"}, + {name: "crypted user wrong password", user: "crypted_user", pass: "wrong", wantErr: true}, + {name: "unknown user", user: "nosuchuser", pass: "plainpass", wantErr: true}, + // an insecure user's stored plaintext must not pass the crypt check for another user + {name: "crypted user given plaintext of stored hash", user: "crypted_user", pass: "$5$testsalt$eCSeYT8Aub0tlGnCdlCmGO4RrnbXQZlcDzFHJWzOPa6", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := AuthenticateUser(tt.user, tt.pass) + if (err != nil) != tt.wantErr { + t.Errorf("AuthenticateUser(%q, %q) error = %v, wantErr %v", tt.user, tt.pass, err, tt.wantErr) + } + }) + } +} + +func TestAuthenticateUserNoConfiguredUsers(t *testing.T) { + store := GetUsersStore() + saved := store.users + t.Cleanup(func() { store.users = saved }) + store.users = nil + + if _, err := AuthenticateUser("anyone", "anything"); err == nil { + t.Error("AuthenticateUser succeeded with an empty user store") + } +} diff --git a/configure_data_plane.go b/configure_data_plane.go index ae96c5d4..e561ff65 100644 --- a/configure_data_plane.go +++ b/configure_data_plane.go @@ -20,8 +20,6 @@ package dataplaneapi import ( "context" "crypto/tls" - "encoding/json" - "io" "net/http" "os" "os/signal" @@ -30,21 +28,15 @@ import ( "sync" "syscall" - "github.com/getkin/kin-openapi/openapi2" - "github.com/getkin/kin-openapi/openapi2conv" - "github.com/getkin/kin-openapi/openapi3" - api_errors "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" + "github.com/Masterminds/semver/v3" "github.com/go-openapi/swag/cmdutils" client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" "github.com/haproxytech/client-native/v6/options" cn_runtime "github.com/haproxytech/client-native/v6/runtime" "github.com/haproxytech/client-native/v6/spoe" "github.com/haproxytech/client-native/v6/storage" "github.com/haproxytech/dataplaneapi/log" - jsoniter "github.com/json-iterator/go" + "github.com/haproxytech/dataplaneapi/reload_agent" "github.com/rs/cors" "github.com/haproxytech/dataplaneapi/adapters" @@ -52,13 +44,7 @@ import ( dataplaneapi_config "github.com/haproxytech/dataplaneapi/configuration" service_discovery "github.com/haproxytech/dataplaneapi/discovery" "github.com/haproxytech/dataplaneapi/handlers" - "github.com/haproxytech/dataplaneapi/haproxy" "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations" - "github.com/haproxytech/dataplaneapi/operations/discovery" - "github.com/haproxytech/dataplaneapi/operations/specification" - "github.com/haproxytech/dataplaneapi/operations/specification_openapiv3" - "github.com/haproxytech/dataplaneapi/rate" "github.com/haproxytech/dataplaneapi/resilient" socket_runtime "github.com/haproxytech/dataplaneapi/runtime" @@ -68,8 +54,6 @@ import ( _ "github.com/GehirnInc/crypt/sha512_crypt" ) -//go:generate swagger generate server --target ../../../../../../github.com/haproxytech --name controller --spec ../../../../../../../../haproxy-api/haproxy-open-api-spec/build/haproxy_spec.yaml --server-package controller --tags Stats --tags Information --tags Configuration --tags Discovery --tags Frontend --tags Backend --tags Bind --tags Server --tags TCPRequestRule --tags HTTPRequestRule --tags HTTPResponseRule --tags Acl --tags BackendSwitchingRule --tags ServerSwitchingRule --tags TCPResponseRule --skip-models --exclude-main - var ( Version string BuildTime string @@ -86,37 +70,39 @@ func SetServerStartedCallback(callFunc func()) { serverStartedCallback = callFunc } -func configureFlags(api *operations.DataPlaneAPI) { +// GetCommandLineOptionsGroups returns the flag groups that should be registered +// with the CLI parser for HAProxy, logging, and syslog options. +func GetCommandLineOptionsGroups() []cmdutils.CommandLineOptionsGroup { cfg := dataplaneapi_config.Get() - - haproxyOptionsGroup := cmdutils.CommandLineOptionsGroup{ - ShortDescription: "HAProxy options", - LongDescription: "Options for configuring haproxy locations.", - Options: &cfg.HAProxy, - } - - loggingOptionsGroup := cmdutils.CommandLineOptionsGroup{ - ShortDescription: "Logging options", - LongDescription: "Options for configuring logging.", - Options: &cfg.Logging, - } - - syslogOptionsGroup := cmdutils.CommandLineOptionsGroup{ - ShortDescription: "Syslog options", - LongDescription: "Options for configuring syslog logging.", - Options: &cfg.Syslog, + return []cmdutils.CommandLineOptionsGroup{ + { + ShortDescription: "HAProxy options", + LongDescription: "Options for configuring haproxy locations.", + Options: &cfg.HAProxy, + }, + { + ShortDescription: "Logging options", + LongDescription: "Options for configuring logging.", + Options: &cfg.Logging, + }, + { + ShortDescription: "Syslog options", + LongDescription: "Options for configuring syslog logging.", + Options: &cfg.Syslog, + }, } - - api.CommandLineOptionsGroups = make([]cmdutils.CommandLineOptionsGroup, 0, 1) - api.CommandLineOptionsGroups = append(api.CommandLineOptionsGroups, haproxyOptionsGroup) - api.CommandLineOptionsGroups = append(api.CommandLineOptionsGroups, loggingOptionsGroup) - api.CommandLineOptionsGroups = append(api.CommandLineOptionsGroups, syslogOptionsGroup) } -func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,maintidx +func configureAPI(skipBasicAuth bool, maxBodySize int64) (http.Handler, func()) { //nolint:maintidx clientMutex.Lock() defer clientMutex.Unlock() + defer func() { + if err := recover(); err != nil { + log.Fatalf("Error starting Data Plane API: %s\n Stacktrace from panic: \n%s", err, string(debug.Stack())) + } + }() + cfg := dataplaneapi_config.Get() haproxyOptions := cfg.HAProxy @@ -159,33 +145,6 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m } // end overriding options with env variables - // configure the api here - api.ServeError = api_errors.ServeError - - // Set your custom logger if needed. Default one is log.Printf - // Expected interface func(string, ...any) - // - // Example: - api.Logger = log.Printf - - api.JSONConsumer = runtime.ConsumerFunc(func(reader io.Reader, data any) error { - json := jsoniter.ConfigCompatibleWithStandardLibrary - dec := json.NewDecoder(reader) - dec.UseNumber() // preserve number formats - return dec.Decode(data) - }) - - api.TxtConsumer = runtime.TextConsumer() - - api.JSONProducer = runtime.ProducerFunc(func(writer io.Writer, data any) error { - json := jsoniter.ConfigCompatibleWithStandardLibrary - enc := json.NewEncoder(writer) - enc.SetEscapeHTML(false) - return enc.Encode(data) - }) - - api.ServerShutdown = serverShutdown - ctx := ContextHandler.Context() clientCtx, cancel := context.WithCancel(ctx) @@ -223,727 +182,21 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m go cfg.MapSync.SyncAll(client) } - // setup discovery handlers - api.DiscoveryGetAPIEndpointsHandler = discovery.GetAPIEndpointsHandlerFunc(func(params discovery.GetAPIEndpointsParams, principal any) middleware.Responder { - ends, err := misc.DiscoverChildPaths("", SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetAPIEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetAPIEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetServicesEndpointsHandler = discovery.GetServicesEndpointsHandlerFunc(func(params discovery.GetServicesEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetServicesEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetServicesEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetConfigurationEndpointsHandler = discovery.GetConfigurationEndpointsHandlerFunc(func(params discovery.GetConfigurationEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetConfigurationEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetConfigurationEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetRuntimeEndpointsHandler = discovery.GetRuntimeEndpointsHandlerFunc(func(params discovery.GetRuntimeEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetRuntimeEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetRuntimeEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetHaproxyEndpointsHandler = discovery.GetHaproxyEndpointsHandlerFunc(func(params discovery.GetHaproxyEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetHaproxyEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetHaproxyEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetStatsEndpointsHandler = discovery.GetStatsEndpointsHandlerFunc(func(params discovery.GetStatsEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetStatsEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetStatsEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetSpoeEndpointsHandler = discovery.GetSpoeEndpointsHandlerFunc(func(params discovery.GetSpoeEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetSpoeEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetSpoeEndpointsOK().WithPayload(ends) - }) - api.DiscoveryGetStorageEndpointsHandler = discovery.GetStorageEndpointsHandlerFunc(func(params discovery.GetStorageEndpointsParams, principal any) middleware.Responder { - rURI := "/" + strings.SplitN(params.HTTPRequest.RequestURI[1:], "/", 2)[1] - ends, err := misc.DiscoverChildPaths(rURI, SwaggerJSON) - if err != nil { - e := misc.HandleError(err) - return discovery.NewGetStorageEndpointsDefault(int(*e.Code)).WithPayload(e) - } - return discovery.NewGetStorageEndpointsOK().WithPayload(ends) - }) - - // setup transaction handlers - client = resilient.NewClient(client) - api.TransactionsStartTransactionHandler = &handlers.StartTransactionHandlerImpl{Client: client} - api.TransactionsDeleteTransactionHandler = &handlers.DeleteTransactionHandlerImpl{Client: client} - api.TransactionsGetTransactionHandler = &handlers.GetTransactionHandlerImpl{Client: client} - api.TransactionsGetTransactionsHandler = &handlers.GetTransactionsHandlerImpl{Client: client} - api.TransactionsCommitTransactionHandler = &handlers.CommitTransactionHandlerImpl{Client: client, ReloadAgent: ra, Mutex: &sync.Mutex{}} - if cfg.HAProxy.MaxOpenTransactions > 0 { - // creating the threshold limit using the CLI flag as hard quota and current open transactions as starting point - actualCount := func() uint64 { - configuration, err := client.Configuration() - if err != nil { - log.Errorf("Cannot retrieve current open transactions for rate limit, default to zero (%s)", err.Error()) - return 0 - } - ts, err := configuration.GetTransactions(models.TransactionStatusInProgress) - if err != nil { - log.Errorf("Cannot retrieve current open transactions for rate limit, default to zero (%s)", err.Error()) - return 0 - } - return uint64(len(*ts)) - } - transactionLimiter := rate.NewThresholdLimit(uint64(cfg.HAProxy.MaxOpenTransactions), actualCount) - api.TransactionsStartTransactionHandler = &handlers.RateLimitedStartTransactionHandlerImpl{ - TransactionCounter: transactionLimiter, - Handler: api.TransactionsStartTransactionHandler, - } - } - - // setup transaction handlers - api.SpoeTransactionsStartSpoeTransactionHandler = &handlers.SpoeTransactionsStartSpoeTransactionHandlerImpl{Client: client} - api.SpoeTransactionsDeleteSpoeTransactionHandler = &handlers.SpoeTransactionsDeleteSpoeTransactionHandlerImpl{Client: client} - api.SpoeTransactionsGetSpoeTransactionHandler = &handlers.SpoeTransactionsGetSpoeTransactionHandlerImpl{Client: client} - api.SpoeTransactionsGetAllSpoeTransactionHandler = &handlers.SpoeTransactionsGetAllSpoeTransactionHandlerImpl{Client: client} - api.SpoeTransactionsCommitSpoeTransactionHandler = &handlers.SpoeTransactionsCommitSpoeTransactionHandlerImpl{Client: client, ReloadAgent: ra} - - // setup sites handlers - api.SitesCreateSiteHandler = &handlers.CreateSiteHandlerImpl{Client: client, ReloadAgent: ra} - api.SitesDeleteSiteHandler = &handlers.DeleteSiteHandlerImpl{Client: client, ReloadAgent: ra} - api.SitesGetSiteHandler = &handlers.GetSiteHandlerImpl{Client: client} - api.SitesGetSitesHandler = &handlers.GetSitesHandlerImpl{Client: client} - api.SitesReplaceSiteHandler = &handlers.ReplaceSiteHandlerImpl{Client: client, ReloadAgent: ra} - - // setup backend handlers - api.BackendCreateBackendHandler = &handlers.CreateBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.BackendDeleteBackendHandler = &handlers.DeleteBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.BackendGetBackendHandler = &handlers.GetBackendHandlerImpl{Client: client} - api.BackendGetBackendsHandler = &handlers.GetBackendsHandlerImpl{Client: client} - api.BackendReplaceBackendHandler = &handlers.ReplaceBackendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup ring handlers - api.RingCreateRingHandler = &handlers.CreateRingHandlerImpl{Client: client, ReloadAgent: ra} - api.RingDeleteRingHandler = &handlers.DeleteRingHandlerImpl{Client: client, ReloadAgent: ra} - api.RingGetRingHandler = &handlers.GetRingHandlerImpl{Client: client} - api.RingGetRingsHandler = &handlers.GetRingsHandlerImpl{Client: client} - api.RingReplaceRingHandler = &handlers.ReplaceRingHandlerImpl{Client: client, ReloadAgent: ra} - - // setup log forward handlers - api.LogForwardCreateLogForwardHandler = &handlers.CreateLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.LogForwardDeleteLogForwardHandler = &handlers.DeleteLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.LogForwardGetLogForwardHandler = &handlers.GetLogForwardHandlerImpl{Client: client} - api.LogForwardGetLogForwardsHandler = &handlers.GetLogForwardsHandlerImpl{Client: client} - api.LogForwardReplaceLogForwardHandler = &handlers.ReplaceLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - - // setup dgram bind handlers - api.DgramBindCreateDgramBindHandler = &handlers.CreateDgramBindHandlerImpl{Client: client, ReloadAgent: ra} - api.DgramBindDeleteDgramBindHandler = &handlers.DeleteDgramBindHandlerImpl{Client: client, ReloadAgent: ra} - api.DgramBindGetDgramBindHandler = &handlers.GetDgramBindHandlerImpl{Client: client} - api.DgramBindGetDgramBindsHandler = &handlers.GetDgramBindsHandlerImpl{Client: client} - api.DgramBindReplaceDgramBindHandler = &handlers.ReplaceDgramBindHandlerImpl{Client: client, ReloadAgent: ra} - - // setup frontend handlers - api.FrontendCreateFrontendHandler = &handlers.CreateFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.FrontendDeleteFrontendHandler = &handlers.DeleteFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.FrontendGetFrontendHandler = &handlers.GetFrontendHandlerImpl{Client: client} - api.FrontendGetFrontendsHandler = &handlers.GetFrontendsHandlerImpl{Client: client} - api.FrontendReplaceFrontendHandler = &handlers.ReplaceFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup userlist handlers - api.UserlistCreateUserlistHandler = &handlers.CreateUserListHandlerImpl{Client: client, ReloadAgent: ra} - api.UserlistDeleteUserlistHandler = &handlers.DeleteUserListHandlerImpl{Client: client, ReloadAgent: ra} - api.UserlistGetUserlistHandler = &handlers.GetUserListHandlerImpl{Client: client} - api.UserlistGetUserlistsHandler = &handlers.GetUserListsHandlerImpl{Client: client} - - // setup user handlers - api.UserCreateUserHandler = &handlers.CreateUserHandlerImpl{Client: client, ReloadAgent: ra} - api.UserDeleteUserHandler = &handlers.DeleteUserHandlerImpl{Client: client, ReloadAgent: ra} - api.UserGetUserHandler = &handlers.GetUserHandlerImpl{Client: client} - api.UserGetUsersHandler = &handlers.GetUsersHandlerImpl{Client: client} - api.UserReplaceUserHandler = &handlers.ReplaceUserHandlerImpl{Client: client, ReloadAgent: ra} - - // setup group handlers - api.GroupCreateGroupHandler = &handlers.CreateGroupHandlerImpl{Client: client, ReloadAgent: ra} - api.GroupDeleteGroupHandler = &handlers.DeleteGroupHandlerImpl{Client: client, ReloadAgent: ra} - api.GroupGetGroupHandler = &handlers.GetGroupHandlerImpl{Client: client} - api.GroupGetGroupsHandler = &handlers.GetGroupsHandlerImpl{Client: client} - api.GroupReplaceGroupHandler = &handlers.ReplaceGroupHandlerImpl{Client: client, ReloadAgent: ra} - - // setup server handlers - // Create - api.ServerCreateServerBackendHandler = &handlers.CreateServerBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerCreateServerPeerHandler = &handlers.CreateServerPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerCreateServerRingHandler = &handlers.CreateServerRingHandlerImpl{Client: client, ReloadAgent: ra} - // Get all - api.ServerGetAllServerBackendHandler = &handlers.GetAllServerBackendHandlerImpl{Client: client} - api.ServerGetAllServerPeerHandler = &handlers.GetAllServerPeerHandlerImpl{Client: client} - api.ServerGetAllServerRingHandler = &handlers.GetAllServerRingHandlerImpl{Client: client} - // Delete one - api.ServerDeleteServerBackendHandler = &handlers.DeleteServerBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerDeleteServerPeerHandler = &handlers.DeleteServerPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerDeleteServerRingHandler = &handlers.DeleteServerRingHandlerImpl{Client: client, ReloadAgent: ra} - // Get one - api.ServerGetServerBackendHandler = &handlers.GetServerBackendHandlerImpl{Client: client} - api.ServerGetServerPeerHandler = &handlers.GetServerPeerHandlerImpl{Client: client} - api.ServerGetServerRingHandler = &handlers.GetServerRingHandlerImpl{Client: client} - // Replace one - api.ServerReplaceServerBackendHandler = &handlers.ReplaceServerBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerReplaceServerPeerHandler = &handlers.ReplaceServerPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerReplaceServerRingHandler = &handlers.ReplaceServerRingHandlerImpl{Client: client, ReloadAgent: ra} - - // setup server template handlers - api.ServerTemplateCreateServerTemplateHandler = &handlers.CreateServerTemplateHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerTemplateDeleteServerTemplateHandler = &handlers.DeleteServerTemplateHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerTemplateGetServerTemplateHandler = &handlers.GetServerTemplateHandlerImpl{Client: client} - api.ServerTemplateGetServerTemplatesHandler = &handlers.GetServerTemplatesHandlerImpl{Client: client} - api.ServerTemplateReplaceServerTemplateHandler = &handlers.ReplaceServerTemplateHandlerImpl{Client: client, ReloadAgent: ra} - - // setup bind handlers - api.BindCreateBindFrontendHandler = &handlers.CreateBindFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.BindDeleteBindFrontendHandler = &handlers.DeleteBindFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.BindGetBindFrontendHandler = &handlers.GetBindFrontendHandlerImpl{Client: client} - api.BindGetAllBindFrontendHandler = &handlers.GetAllBindFrontendHandlerImpl{Client: client} - api.BindReplaceBindFrontendHandler = &handlers.ReplaceBindFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - api.BindCreateBindPeerHandler = &handlers.CreateBindPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.BindDeleteBindPeerHandler = &handlers.DeleteBindPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.BindGetBindPeerHandler = &handlers.GetBindPeerHandlerImpl{Client: client} - api.BindGetAllBindPeerHandler = &handlers.GetAllBindPeerHandlerImpl{Client: client} - api.BindReplaceBindPeerHandler = &handlers.ReplaceBindPeerHandlerImpl{Client: client, ReloadAgent: ra} - - api.BindCreateBindLogForwardHandler = &handlers.CreateBindLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.BindDeleteBindLogForwardHandler = &handlers.DeleteBindLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.BindGetBindLogForwardHandler = &handlers.GetBindLogForwardHandlerImpl{Client: client} - api.BindGetAllBindLogForwardHandler = &handlers.GetAllBindLogForwardHandlerImpl{Client: client} - api.BindReplaceBindLogForwardHandler = &handlers.ReplaceBindLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http check handlers - api.HTTPCheckGetHTTPCheckBackendHandler = &handlers.GetHTTPCheckBackendHandlerImpl{Client: client} - api.HTTPCheckGetAllHTTPCheckBackendHandler = &handlers.GetAllHTTPCheckBackendHandlerImpl{Client: client} - api.HTTPCheckCreateHTTPCheckBackendHandler = &handlers.CreateHTTPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckReplaceHTTPCheckBackendHandler = &handlers.ReplaceHTTPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckDeleteHTTPCheckBackendHandler = &handlers.DeleteHTTPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckReplaceAllHTTPCheckBackendHandler = &handlers.ReplaceAllHTTPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckGetHTTPCheckDefaultsHandler = &handlers.GetHTTPCheckDefaultsHandlerImpl{Client: client} - api.HTTPCheckGetAllHTTPCheckDefaultsHandler = &handlers.GetAllHTTPCheckDefaultsHandlerImpl{Client: client} - api.HTTPCheckCreateHTTPCheckDefaultsHandler = &handlers.CreateHTTPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckReplaceHTTPCheckDefaultsHandler = &handlers.ReplaceHTTPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckDeleteHTTPCheckDefaultsHandler = &handlers.DeleteHTTPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPCheckReplaceAllHTTPCheckDefaultsHandler = &handlers.ReplaceAllHTTPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http request rule handlers - api.HTTPRequestRuleCreateHTTPRequestRuleBackendHandler = &handlers.CreateHTTPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler = &handlers.DeleteHTTPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleGetHTTPRequestRuleBackendHandler = &handlers.GetHTTPRequestRuleBackendHandlerImpl{Client: client} - api.HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler = &handlers.GetAllHTTPRequestRuleBackendHandlerImpl{Client: client} - api.HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler = &handlers.ReplaceHTTPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler = &handlers.ReplaceAllHTTPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler = &handlers.CreateHTTPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler = &handlers.DeleteHTTPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleGetHTTPRequestRuleFrontendHandler = &handlers.GetHTTPRequestRuleFrontendHandlerImpl{Client: client} - api.HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler = &handlers.GetAllHTTPRequestRuleFrontendHandlerImpl{Client: client} - api.HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler = &handlers.ReplaceHTTPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler = &handlers.ReplaceAllHTTPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http after response rule handlers - api.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler = &handlers.CreateHTTPAfterResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler = &handlers.DeleteHTTPAfterResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler = &handlers.GetHTTPAfterResponseRuleBackendHandlerImpl{Client: client} - api.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler = &handlers.GetAllHTTPAfterResponseRuleBackendHandlerImpl{Client: client} - api.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler = &handlers.ReplaceHTTPAfterResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler = &handlers.ReplaceAllHTTPAfterResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler = &handlers.CreateHTTPAfterResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler = &handlers.DeleteHTTPAfterResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler = &handlers.GetHTTPAfterResponseRuleFrontendHandlerImpl{Client: client} - api.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler = &handlers.GetAllHTTPAfterResponseRuleFrontendHandlerImpl{Client: client} - api.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler = &handlers.ReplaceHTTPAfterResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler = &handlers.ReplaceAllHTTPAfterResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http response rule handlers - api.HTTPResponseRuleCreateHTTPResponseRuleBackendHandler = &handlers.CreateHTTPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler = &handlers.DeleteHTTPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleGetHTTPResponseRuleBackendHandler = &handlers.GetHTTPResponseRuleBackendHandlerImpl{Client: client} - api.HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler = &handlers.GetAllHTTPResponseRuleBackendHandlerImpl{Client: client} - api.HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler = &handlers.ReplaceHTTPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler = &handlers.ReplaceAllHTTPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler = &handlers.CreateHTTPResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler = &handlers.DeleteHTTPResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleGetHTTPResponseRuleFrontendHandler = &handlers.GetHTTPResponseRuleFrontendHandlerImpl{Client: client} - api.HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler = &handlers.GetAllHTTPResponseRuleFrontendHandlerImpl{Client: client} - api.HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler = &handlers.ReplaceHTTPResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler = &handlers.ReplaceAllHTTPResponseRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http error rule handlers - api.HTTPErrorRuleCreateHTTPErrorRuleBackendHandler = &handlers.CreateHTTPErrorRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler = &handlers.DeleteHTTPErrorRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleGetHTTPErrorRuleBackendHandler = &handlers.GetHTTPErrorRuleBackendHandlerImpl{Client: client} - api.HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler = &handlers.GetAllHTTPErrorRuleBackendHandlerImpl{Client: client} - api.HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler = &handlers.ReplaceHTTPErrorRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler = &handlers.ReplaceAllHTTPErrorRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler = &handlers.CreateHTTPErrorRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler = &handlers.DeleteHTTPErrorRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleGetHTTPErrorRuleFrontendHandler = &handlers.GetHTTPErrorRuleFrontendHandlerImpl{Client: client} - api.HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler = &handlers.GetAllHTTPErrorRuleFrontendHandlerImpl{Client: client} - api.HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler = &handlers.ReplaceHTTPErrorRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler = &handlers.ReplaceAllHTTPErrorRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - api.HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler = &handlers.CreateHTTPErrorRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler = &handlers.DeleteHTTPErrorRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler = &handlers.GetHTTPErrorRuleDefaultsHandlerImpl{Client: client} - api.HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler = &handlers.GetAllHTTPErrorRuleDefaultsHandlerImpl{Client: client} - api.HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler = &handlers.ReplaceHTTPErrorRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler = &handlers.ReplaceAllHTTPErrorRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - - // setup tcp content rule handlers - api.TCPRequestRuleCreateTCPRequestRuleBackendHandler = &handlers.CreateTCPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleDeleteTCPRequestRuleBackendHandler = &handlers.DeleteTCPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleGetTCPRequestRuleBackendHandler = &handlers.GetTCPRequestRuleBackendHandlerImpl{Client: client} - api.TCPRequestRuleGetAllTCPRequestRuleBackendHandler = &handlers.GetAllTCPRequestRuleBackendHandlerImpl{Client: client} - api.TCPRequestRuleReplaceTCPRequestRuleBackendHandler = &handlers.ReplaceTCPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler = &handlers.ReplaceAllTCPRequestRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.TCPRequestRuleCreateTCPRequestRuleFrontendHandler = &handlers.CreateTCPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleDeleteTCPRequestRuleFrontendHandler = &handlers.DeleteTCPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleGetTCPRequestRuleFrontendHandler = &handlers.GetTCPRequestRuleFrontendHandlerImpl{Client: client} - api.TCPRequestRuleGetAllTCPRequestRuleFrontendHandler = &handlers.GetAllTCPRequestRuleFrontendHandlerImpl{Client: client} - api.TCPRequestRuleReplaceTCPRequestRuleFrontendHandler = &handlers.ReplaceTCPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler = &handlers.ReplaceAllTCPRequestRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup tcp connection rule handlers - api.TCPResponseRuleCreateTCPResponseRuleBackendHandler = &handlers.CreateTCPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPResponseRuleDeleteTCPResponseRuleBackendHandler = &handlers.DeleteTCPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPResponseRuleGetTCPResponseRuleBackendHandler = &handlers.GetTCPResponseRuleBackendHandlerImpl{Client: client} - api.TCPResponseRuleGetAllTCPResponseRuleBackendHandler = &handlers.GetAllTCPResponseRuleBackendHandlerImpl{Client: client} - api.TCPResponseRuleReplaceTCPResponseRuleBackendHandler = &handlers.ReplaceTCPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler = &handlers.ReplaceAllTCPResponseRuleBackendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup tcp check handlers - api.TCPCheckCreateTCPCheckBackendHandler = &handlers.CreateTCPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckDeleteTCPCheckBackendHandler = &handlers.DeleteTCPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckGetTCPCheckBackendHandler = &handlers.GetTCPCheckBackendHandlerImpl{Client: client} - api.TCPCheckGetAllTCPCheckBackendHandler = &handlers.GetAllTCPCheckBackendHandlerImpl{Client: client} - api.TCPCheckReplaceTCPCheckBackendHandler = &handlers.ReplaceTCPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckReplaceAllTCPCheckBackendHandler = &handlers.ReplaceAllTCPCheckBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.TCPCheckCreateTCPCheckDefaultsHandler = &handlers.CreateTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckDeleteTCPCheckDefaultsHandler = &handlers.DeleteTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckGetTCPCheckDefaultsHandler = &handlers.GetTCPCheckDefaultsHandlerImpl{Client: client} - api.TCPCheckGetAllTCPCheckDefaultsHandler = &handlers.GetAllTCPCheckDefaultsHandlerImpl{Client: client} - api.TCPCheckReplaceTCPCheckDefaultsHandler = &handlers.ReplaceTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.TCPCheckReplaceAllTCPCheckDefaultsHandler = &handlers.ReplaceAllTCPCheckDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - - // setup quic initia; rule handlers - api.QUICInitialRuleCreateQUICInitialRuleDefaultsHandler = &handlers.CreateQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler = &handlers.DeleteQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleGetQUICInitialRuleDefaultsHandler = &handlers.GetQUICInitialRuleDefaultsHandlerImpl{Client: client} - api.QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler = &handlers.GetAllQUICInitialRuleDefaultsHandlerImpl{Client: client} - api.QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler = &handlers.ReplaceQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler = &handlers.ReplaceAllQUICInitialRuleDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - - api.QUICInitialRuleCreateQUICInitialRuleFrontendHandler = &handlers.CreateQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleDeleteQUICInitialRuleFrontendHandler = &handlers.DeleteQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleGetQUICInitialRuleFrontendHandler = &handlers.GetQUICInitialRuleFrontendHandlerImpl{Client: client} - api.QUICInitialRuleGetAllQUICInitialRuleFrontendHandler = &handlers.GetAllQUICInitialRuleFrontendHandlerImpl{Client: client} - api.QUICInitialRuleReplaceQUICInitialRuleFrontendHandler = &handlers.ReplaceQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler = &handlers.ReplaceAllQUICInitialRuleFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup declare capture handlers - api.DeclareCaptureCreateDeclareCaptureHandler = &handlers.CreateDeclareCaptureHandlerImpl{Client: client, ReloadAgent: ra} - api.DeclareCaptureDeleteDeclareCaptureHandler = &handlers.DeleteDeclareCaptureHandlerImpl{Client: client, ReloadAgent: ra} - api.DeclareCaptureGetDeclareCaptureHandler = &handlers.GetDeclareCaptureHandlerImpl{Client: client} - api.DeclareCaptureGetDeclareCapturesHandler = &handlers.GetDeclareCapturesHandlerImpl{Client: client} - api.DeclareCaptureReplaceDeclareCaptureHandler = &handlers.ReplaceDeclareCaptureHandlerImpl{Client: client, ReloadAgent: ra} - api.DeclareCaptureReplaceDeclareCapturesHandler = &handlers.ReplaceDeclareCapturesHandlerImpl{Client: client, ReloadAgent: ra} - - // setup backend switching rule handlers - api.BackendSwitchingRuleCreateBackendSwitchingRuleHandler = &handlers.CreateBackendSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.BackendSwitchingRuleDeleteBackendSwitchingRuleHandler = &handlers.DeleteBackendSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.BackendSwitchingRuleGetBackendSwitchingRuleHandler = &handlers.GetBackendSwitchingRuleHandlerImpl{Client: client} - api.BackendSwitchingRuleGetBackendSwitchingRulesHandler = &handlers.GetBackendSwitchingRulesHandlerImpl{Client: client} - api.BackendSwitchingRuleReplaceBackendSwitchingRuleHandler = &handlers.ReplaceBackendSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.BackendSwitchingRuleReplaceBackendSwitchingRulesHandler = &handlers.ReplaceBackendSwitchingRulesHandlerImpl{Client: client, ReloadAgent: ra} - - // setup server switching rule handlers - api.ServerSwitchingRuleCreateServerSwitchingRuleHandler = &handlers.CreateServerSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerSwitchingRuleDeleteServerSwitchingRuleHandler = &handlers.DeleteServerSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerSwitchingRuleGetServerSwitchingRuleHandler = &handlers.GetServerSwitchingRuleHandlerImpl{Client: client} - api.ServerSwitchingRuleGetServerSwitchingRulesHandler = &handlers.GetServerSwitchingRulesHandlerImpl{Client: client} - api.ServerSwitchingRuleReplaceServerSwitchingRuleHandler = &handlers.ReplaceServerSwitchingRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.ServerSwitchingRuleReplaceServerSwitchingRulesHandler = &handlers.ReplaceServerSwitchingRulesHandlerImpl{Client: client, ReloadAgent: ra} - - // setup filter handlers - api.FilterCreateFilterBackendHandler = &handlers.CreateFilterBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterDeleteFilterBackendHandler = &handlers.DeleteFilterBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterGetFilterBackendHandler = &handlers.GetFilterBackendHandlerImpl{Client: client} - api.FilterGetAllFilterBackendHandler = &handlers.GetAllFilterBackendHandlerImpl{Client: client} - api.FilterReplaceFilterBackendHandler = &handlers.ReplaceFilterBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterReplaceAllFilterBackendHandler = &handlers.ReplaceAllFilterBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.FilterCreateFilterFrontendHandler = &handlers.CreateFilterFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterDeleteFilterFrontendHandler = &handlers.DeleteFilterFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterGetFilterFrontendHandler = &handlers.GetFilterFrontendHandlerImpl{Client: client} - api.FilterGetAllFilterFrontendHandler = &handlers.GetAllFilterFrontendHandlerImpl{Client: client} - api.FilterReplaceFilterFrontendHandler = &handlers.ReplaceFilterFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.FilterReplaceAllFilterFrontendHandler = &handlers.ReplaceAllFilterFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - // setup stick rule handlers - api.StickRuleCreateStickRuleHandler = &handlers.CreateStickRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.StickRuleDeleteStickRuleHandler = &handlers.DeleteStickRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.StickRuleGetStickRuleHandler = &handlers.GetStickRuleHandlerImpl{Client: client} - api.StickRuleGetStickRulesHandler = &handlers.GetStickRulesHandlerImpl{Client: client} - api.StickRuleReplaceStickRuleHandler = &handlers.ReplaceStickRuleHandlerImpl{Client: client, ReloadAgent: ra} - api.StickRuleReplaceStickRulesHandler = &handlers.ReplaceStickRulesHandlerImpl{Client: client, ReloadAgent: ra} - - // setup log target handlers - api.LogTargetCreateLogTargetBackendHandler = &handlers.CreateLogTargetBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetBackendHandler = &handlers.DeleteLogTargetBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetBackendHandler = &handlers.GetLogTargetBackendHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetBackendHandler = &handlers.GetAllLogTargetBackendHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetBackendHandler = &handlers.ReplaceLogTargetBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetBackendHandler = &handlers.ReplaceAllLogTargetBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.LogTargetCreateLogTargetFrontendHandler = &handlers.CreateLogTargetFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetFrontendHandler = &handlers.DeleteLogTargetFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetFrontendHandler = &handlers.GetLogTargetFrontendHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetFrontendHandler = &handlers.GetAllLogTargetFrontendHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetFrontendHandler = &handlers.ReplaceLogTargetFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetFrontendHandler = &handlers.ReplaceAllLogTargetFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - api.LogTargetCreateLogTargetDefaultsHandler = &handlers.CreateLogTargetDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetDefaultsHandler = &handlers.DeleteLogTargetDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetDefaultsHandler = &handlers.GetLogTargetDefaultsHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetDefaultsHandler = &handlers.GetAllLogTargetDefaultsHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetDefaultsHandler = &handlers.ReplaceLogTargetDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetDefaultsHandler = &handlers.ReplaceAllLogTargetDefaultsHandlerImpl{Client: client, ReloadAgent: ra} - - api.LogTargetCreateLogTargetLogForwardHandler = &handlers.CreateLogTargetLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetLogForwardHandler = &handlers.DeleteLogTargetLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetLogForwardHandler = &handlers.GetLogTargetLogForwardHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetLogForwardHandler = &handlers.GetAllLogTargetLogForwardHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetLogForwardHandler = &handlers.ReplaceLogTargetLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetLogForwardHandler = &handlers.ReplaceAllLogTargetLogForwardHandlerImpl{Client: client, ReloadAgent: ra} - - api.LogTargetCreateLogTargetPeerHandler = &handlers.CreateLogTargetPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetPeerHandler = &handlers.DeleteLogTargetPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetPeerHandler = &handlers.GetLogTargetPeerHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetPeerHandler = &handlers.GetAllLogTargetPeerHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetPeerHandler = &handlers.ReplaceLogTargetPeerHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetPeerHandler = &handlers.ReplaceAllLogTargetPeerHandlerImpl{Client: client, ReloadAgent: ra} - - api.LogTargetCreateLogTargetGlobalHandler = &handlers.CreateLogTargetGlobalHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetDeleteLogTargetGlobalHandler = &handlers.DeleteLogTargetGlobalHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetGetLogTargetGlobalHandler = &handlers.GetLogTargetGlobalHandlerImpl{Client: client} - api.LogTargetGetAllLogTargetGlobalHandler = &handlers.GetAllLogTargetGlobalHandlerImpl{Client: client} - api.LogTargetReplaceLogTargetGlobalHandler = &handlers.ReplaceLogTargetGlobalHandlerImpl{Client: client, ReloadAgent: ra} - api.LogTargetReplaceAllLogTargetGlobalHandler = &handlers.ReplaceAllLogTargetGlobalHandlerImpl{Client: client, ReloadAgent: ra} - - // setup acl rule handlers - api.ACLCreateACLBackendHandler = &handlers.CreateACLBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLDeleteACLBackendHandler = &handlers.DeleteACLBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLGetACLBackendHandler = &handlers.GetACLBackendHandlerImpl{Client: client} - api.ACLGetAllACLBackendHandler = &handlers.GetAllACLBackendHandlerImpl{Client: client} - api.ACLReplaceACLBackendHandler = &handlers.ReplaceACLBackendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLReplaceAllACLBackendHandler = &handlers.ReplaceAllACLBackendHandlerImpl{Client: client, ReloadAgent: ra} - - api.ACLCreateACLFrontendHandler = &handlers.CreateACLFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLDeleteACLFrontendHandler = &handlers.DeleteACLFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLGetACLFrontendHandler = &handlers.GetACLFrontendHandlerImpl{Client: client} - api.ACLGetAllACLFrontendHandler = &handlers.GetAllACLFrontendHandlerImpl{Client: client} - api.ACLReplaceACLFrontendHandler = &handlers.ReplaceACLFrontendHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLReplaceAllACLFrontendHandler = &handlers.ReplaceAllACLFrontendHandlerImpl{Client: client, ReloadAgent: ra} - - api.ACLCreateACLFCGIAppHandler = &handlers.CreateACLFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLDeleteACLFCGIAppHandler = &handlers.DeleteACLFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLGetACLFCGIAppHandler = &handlers.GetACLFCGIAppHandlerImpl{Client: client} - api.ACLGetAllACLFCGIAppHandler = &handlers.GetAllACLFCGIAppHandlerImpl{Client: client} - api.ACLReplaceACLFCGIAppHandler = &handlers.ReplaceACLFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - api.ACLReplaceAllACLFCGIAppHandler = &handlers.ReplaceAllACLFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - - // setup resolvers handlers - api.ResolverCreateResolverHandler = &handlers.CreateResolverHandlerImpl{Client: client, ReloadAgent: ra} - api.ResolverDeleteResolverHandler = &handlers.DeleteResolverHandlerImpl{Client: client, ReloadAgent: ra} - api.ResolverGetResolverHandler = &handlers.GetResolverHandlerImpl{Client: client} - api.ResolverGetResolversHandler = &handlers.GetResolversHandlerImpl{Client: client} - api.ResolverReplaceResolverHandler = &handlers.ReplaceResolverHandlerImpl{Client: client, ReloadAgent: ra} - - // setup nameserver handlers - api.NameserverCreateNameserverHandler = &handlers.CreateNameserverHandlerImpl{Client: client, ReloadAgent: ra} - api.NameserverDeleteNameserverHandler = &handlers.DeleteNameserverHandlerImpl{Client: client, ReloadAgent: ra} - api.NameserverGetNameserverHandler = &handlers.GetNameserverHandlerImpl{Client: client} - api.NameserverGetNameserversHandler = &handlers.GetNameserversHandlerImpl{Client: client} - api.NameserverReplaceNameserverHandler = &handlers.ReplaceNameserverHandlerImpl{Client: client, ReloadAgent: ra} - - // setup mailers sections handlers - api.MailersCreateMailersSectionHandler = &handlers.CreateMailersSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.MailersDeleteMailersSectionHandler = &handlers.DeleteMailersSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.MailersGetMailersSectionHandler = &handlers.GetMailersSectionHandlerImpl{Client: client} - api.MailersGetMailersSectionsHandler = &handlers.GetMailersSectionsHandlerImpl{Client: client} - api.MailersEditMailersSectionHandler = &handlers.EditMailersSectionHandlerImpl{Client: client, ReloadAgent: ra} - - // setup mailer entry handlers - api.MailerEntryCreateMailerEntryHandler = &handlers.CreateMailerEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.MailerEntryDeleteMailerEntryHandler = &handlers.DeleteMailerEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.MailerEntryGetMailerEntryHandler = &handlers.GetMailerEntryHandlerImpl{Client: client} - api.MailerEntryGetMailerEntriesHandler = &handlers.GetMailerEntriesHandlerImpl{Client: client} - api.MailerEntryReplaceMailerEntryHandler = &handlers.ReplaceMailerEntryHandlerImpl{Client: client, ReloadAgent: ra} - - // setup peer section handlers - api.PeerCreatePeerHandler = &handlers.CreatePeerHandlerImpl{Client: client, ReloadAgent: ra} - api.PeerDeletePeerHandler = &handlers.DeletePeerHandlerImpl{Client: client, ReloadAgent: ra} - api.PeerGetPeerSectionHandler = &handlers.GetPeerHandlerImpl{Client: client} - api.PeerGetPeerSectionsHandler = &handlers.GetPeersHandlerImpl{Client: client} - - // setup peer entries handlers - api.PeerEntryCreatePeerEntryHandler = &handlers.CreatePeerEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.PeerEntryDeletePeerEntryHandler = &handlers.DeletePeerEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.PeerEntryGetPeerEntryHandler = &handlers.GetPeerEntryHandlerImpl{Client: client} - api.PeerEntryGetPeerEntriesHandler = &handlers.GetPeerEntriesHandlerImpl{Client: client} - api.PeerEntryReplacePeerEntryHandler = &handlers.ReplacePeerEntryHandlerImpl{Client: client, ReloadAgent: ra} - - // setup tables handlers - api.TableCreateTableHandler = &handlers.CreateTableHandlerImpl{Client: client, ReloadAgent: ra} - api.TableDeleteTableHandler = &handlers.DeleteTableHandlerImpl{Client: client, ReloadAgent: ra} - api.TableGetTableHandler = &handlers.GetTableHandlerImpl{Client: client} - api.TableGetTablesHandler = &handlers.GetTablesHandlerImpl{Client: client} - api.TableReplaceTableHandler = &handlers.ReplaceTableHandlerImpl{Client: client, ReloadAgent: ra} - - // setup http-errors sections handlers - api.HTTPErrorsCreateHTTPErrorsSectionHandler = &handlers.CreateHTTPErrorsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorsDeleteHTTPErrorsSectionHandler = &handlers.DeleteHTTPErrorsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.HTTPErrorsGetHTTPErrorsSectionHandler = &handlers.GetHTTPErrorsSectionHandlerImpl{Client: client} - api.HTTPErrorsGetHTTPErrorsSectionsHandler = &handlers.GetHTTPErrorsSectionsHandlerImpl{Client: client} - api.HTTPErrorsReplaceHTTPErrorsSectionHandler = &handlers.ReplaceHTTPErrorsSectionHandlerImpl{Client: client, ReloadAgent: ra} - - // setup cache handlers - api.CacheCreateCacheHandler = &handlers.CreateCacheHandlerImpl{Client: client, ReloadAgent: ra} - api.CacheDeleteCacheHandler = &handlers.DeleteCacheHandlerImpl{Client: client, ReloadAgent: ra} - api.CacheGetCacheHandler = &handlers.GetCacheHandlerImpl{Client: client} - api.CacheGetCachesHandler = &handlers.GetCachesHandlerImpl{Client: client} - api.CacheReplaceCacheHandler = &handlers.ReplaceCacheHandlerImpl{Client: client, ReloadAgent: ra} - - // setup program handlers - api.ProcessManagerCreateProgramHandler = &handlers.CreateProgramHandlerImpl{Client: client, ReloadAgent: ra} - api.ProcessManagerDeleteProgramHandler = &handlers.DeleteProgramHandlerImpl{Client: client, ReloadAgent: ra} - api.ProcessManagerGetProgramHandler = &handlers.GetProgramHandlerImpl{Client: client} - api.ProcessManagerGetProgramsHandler = &handlers.GetProgramsHandlerImpl{Client: client} - api.ProcessManagerReplaceProgramHandler = &handlers.ReplaceProgramHandlerImpl{Client: client, ReloadAgent: ra} - - // setup fcgi handlers - api.FCGIAppCreateFCGIAppHandler = &handlers.CreateFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - api.FCGIAppDeleteFCGIAppHandler = &handlers.DeleteFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - api.FCGIAppGetFCGIAppHandler = &handlers.GetFCGIAppHandlerImpl{Client: client} - api.FCGIAppGetFCGIAppsHandler = &handlers.GetFCGIAppsHandlerImpl{Client: client} - api.FCGIAppReplaceFCGIAppHandler = &handlers.ReplaceFCGIAppHandlerImpl{Client: client, ReloadAgent: ra} - - // setup stats handler - api.StatsGetStatsHandler = &handlers.GetStatsHandlerImpl{Client: client} - - // setup info handler - api.InformationGetHaproxyProcessInfoHandler = &handlers.GetHaproxyProcessInfoHandlerImpl{Client: client} - - // setup raw configuration handlers - api.ConfigurationGetHAProxyConfigurationHandler = &handlers.GetRawConfigurationHandlerImpl{Client: client} - api.ConfigurationPostHAProxyConfigurationHandler = &handlers.PostRawConfigurationHandlerImpl{Client: client, ReloadAgent: ra} - - // setup global configuration handlers - api.GlobalGetGlobalHandler = &handlers.GetGlobalHandlerImpl{Client: client} - api.GlobalReplaceGlobalHandler = &handlers.ReplaceGlobalHandlerImpl{Client: client, ReloadAgent: ra} - - // setup defaults configuration handlers - api.DefaultsCreateDefaultsSectionHandler = &handlers.CreateDefaultsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.DefaultsAddDefaultsSectionHandler = &handlers.AddDefaultsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.DefaultsDeleteDefaultsSectionHandler = &handlers.DeleteDefaultsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.DefaultsReplaceDefaultsSectionHandler = &handlers.ReplaceDefaultsSectionHandlerImpl{Client: client, ReloadAgent: ra} - api.DefaultsGetDefaultsSectionHandler = &handlers.GetDefaultsSectionHandlerImpl{Client: client} - api.DefaultsGetDefaultsSectionsHandler = &handlers.GetDefaultsSectionsHandlerImpl{Client: client} - - // setup reload handlers - api.ReloadsGetReloadHandler = &handlers.GetReloadHandlerImpl{ReloadAgent: ra} - api.ReloadsGetReloadsHandler = &handlers.GetReloadsHandlerImpl{ReloadAgent: ra} - - // setup runtime server handlers - api.ServerGetRuntimeServerHandler = &handlers.GetRuntimeServerHandlerImpl{Client: client} - api.ServerGetAllRuntimeServerHandler = &handlers.GetAllRuntimeServerHandlerImpl{Client: client} - api.ServerReplaceRuntimeServerHandler = &handlers.ReplaceRuntimeServerHandlerImpl{Client: client} - api.ServerAddRuntimeServerHandler = &handlers.AddRuntimeServerHandlerImpl{Client: client} - api.ServerDeleteRuntimeServerHandler = &handlers.DeleteRuntimeServerHandlerImpl{Client: client} - - // setup stick table handlers - api.StickTableGetStickTablesHandler = &handlers.GetStickTablesHandlerImpl{Client: client} - api.StickTableGetStickTableHandler = &handlers.GetStickTableHandlerImpl{Client: client} - api.StickTableGetStickTableEntriesHandler = &handlers.GetStickTableEntriesHandlerImpl{Client: client} - api.StickTableSetStickTableEntriesHandler = &handlers.SetStickTableEntriesHandlerImpl{Client: client} - - // setup ACL runtime handlers - api.ACLRuntimeGetServicesHaproxyRuntimeAclsHandler = &handlers.GetACLSHandlerRuntimeImpl{Client: client} - api.ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler = &handlers.GetACLHandlerRuntimeImpl{Client: client} - api.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler = &handlers.GetACLFileEntriesHandlerRuntimeImpl{Client: client} - api.ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler = &handlers.PostACLFileEntryHandlerRuntimeImpl{Client: client} - api.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler = &handlers.GetACLFileEntryRuntimeImpl{Client: client} - api.ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler = &handlers.DeleteACLFileEntryHandlerRuntimeImpl{Client: client} - api.ACLRuntimeAddPayloadRuntimeACLHandler = &handlers.ACLRuntimeAddPayloadRuntimeACLHandlerImpl{Client: client} - - // setup map handlers - api.MapsGetAllRuntimeMapFilesHandler = &handlers.GetMapsHandlerImpl{Client: client} - api.MapsGetOneRuntimeMapHandler = &handlers.GetMapHandlerImpl{Client: client} - api.MapsClearRuntimeMapHandler = &handlers.ClearMapHandlerImpl{Client: client} - api.MapsShowRuntimeMapHandler = &handlers.ShowMapHandlerImpl{Client: client} - api.MapsAddMapEntryHandler = &handlers.AddMapEntryHandlerImpl{Client: client} - api.MapsAddPayloadRuntimeMapHandler = &handlers.MapsAddPayloadRuntimeMapHandlerImpl{Client: client} - api.MapsGetRuntimeMapEntryHandler = &handlers.GetRuntimeMapEntryHandlerImpl{Client: client} - api.MapsReplaceRuntimeMapEntryHandler = &handlers.ReplaceRuntimeMapEntryHandlerImpl{Client: client} - api.MapsDeleteRuntimeMapEntryHandler = &handlers.DeleteRuntimeMapEntryHandlerImpl{Client: client} - - // crt-store handlers - api.CrtStoreGetCrtStoresHandler = &handlers.GetCrtStoresHandlerImpl{Client: client} - api.CrtStoreGetCrtStoreHandler = &handlers.GetCrtStoreHandlerImpl{Client: client} - api.CrtStoreCreateCrtStoreHandler = &handlers.CreateCrtStoreHandlerImpl{Client: client, ReloadAgent: ra} - api.CrtStoreEditCrtStoreHandler = &handlers.EditCrtStoreHandler{Client: client, ReloadAgent: ra} - api.CrtStoreDeleteCrtStoreHandler = &handlers.DeleteCrtStoreHandlerImpl{Client: client, ReloadAgent: ra} - // crt-store load handlers - api.CrtLoadGetCrtLoadsHandler = &handlers.GetCrtLoadsHandlerImpl{Client: client} - api.CrtLoadGetCrtLoadHandler = &handlers.GetCrtLoadHandlerImpl{Client: client} - api.CrtLoadCreateCrtLoadHandler = &handlers.CreateCrtLoadHandlerImpl{Client: client, ReloadAgent: ra} - api.CrtLoadReplaceCrtLoadHandler = &handlers.ReplaceCrtLoadHandler{Client: client, ReloadAgent: ra} - api.CrtLoadDeleteCrtLoadHandler = &handlers.DeleteCrtLoadHandlerImpl{Client: client, ReloadAgent: ra} - - // traces handlers - api.TracesGetTracesHandler = &handlers.GetTracesHandlerImpl{Client: client} - api.TracesCreateTracesHandler = &handlers.CreateTracesHandlerImpl{Client: client, ReloadAgent: ra} - api.TracesReplaceTracesHandler = &handlers.ReplaceTracesHandler{Client: client, ReloadAgent: ra} - api.TracesDeleteTracesHandler = &handlers.DeleteTracesHandlerImpl{Client: client, ReloadAgent: ra} - api.TracesCreateTraceEntryHandler = &handlers.CreateTraceEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.TracesDeleteTraceEntryHandler = &handlers.DeleteTraceEntryHandlerImpl{Client: client, ReloadAgent: ra} - - // log-profile handlers - api.LogProfileGetLogProfilesHandler = &handlers.GetLogProfilesHandlerImpl{Client: client} - api.LogProfileGetLogProfileHandler = &handlers.GetLogProfileHandlerImpl{Client: client} - api.LogProfileCreateLogProfileHandler = &handlers.CreateLogProfileHandlerImpl{Client: client, ReloadAgent: ra} - api.LogProfileEditLogProfileHandler = &handlers.EditLogProfileHandler{Client: client, ReloadAgent: ra} - api.LogProfileDeleteLogProfileHandler = &handlers.DeleteLogProfileHandlerImpl{Client: client, ReloadAgent: ra} - - // ssl-f-use handlers - api.SslFrontUseGetAllSSLFrontUsesHandler = &handlers.GetAllSSLFrontUsesHandlerImpl{Client: client} - api.SslFrontUseCreateSSLFrontUseHandler = &handlers.CreateSSLFrontUseHandlerImpl{Client: client, ReloadAgent: ra} - api.SslFrontUseGetSSLFrontUseHandler = &handlers.GetSSLFrontUseHandlerImpl{Client: client} - api.SslFrontUseReplaceSSLFrontUseHandler = &handlers.ReplaceSSLFrontUseHandlerImpl{Client: client, ReloadAgent: ra} - api.SslFrontUseDeleteSSLFrontUseHandler = &handlers.DeleteSSLFrontUseHandlerImpl{Client: client, ReloadAgent: ra} - - // Runtime SSL CA Files - api.SslRuntimeGetAllCaFilesHandler = &handlers.GetAllCaFilesHandlerImpl{Client: client} - api.SslRuntimeCreateCaFileHandler = &handlers.CreateCaFileHandlerImpl{Client: client} - api.SslRuntimeGetCaFileHandler = &handlers.GetCaFileHandlerImpl{Client: client} - api.SslRuntimeSetCaFileHandler = &handlers.SetCaFileHandlerImpl{Client: client} - api.SslRuntimeDeleteCaFileHandler = &handlers.DeleteCaFileHandlerImpl{Client: client} - api.SslRuntimeAddCaEntryHandler = &handlers.AddCaEntryHandlerImpl{Client: client} - api.SslRuntimeGetCaEntryHandler = &handlers.GetCaEntryHandlerImpl{Client: client} - - // Runtime SSL Cert - api.SslRuntimeGetAllCertsHandler = &handlers.GetAllCertsHandlerImpl{Client: client} - api.SslRuntimeCreateCertHandler = &handlers.CreateCertHandlerImpl{Client: client} - api.SslRuntimeGetCertHandler = &handlers.GetCertHandlerImpl{Client: client} - api.SslRuntimeReplaceCertHandler = &handlers.ReplaceCertHandlerImpl{Client: client} - api.SslRuntimeDeleteCertHandler = &handlers.DeleteCertHandlerImpl{Client: client} - - // Runtime SSL Crl Files - api.SslRuntimeGetAllCrlHandler = &handlers.GetAllCrlHandlerImpl{Client: client} - api.SslRuntimeCreateCrlHandler = &handlers.CreateCrlHandlerImpl{Client: client} - api.SslRuntimeGetCrlHandler = &handlers.GetCrlHandlerImpl{Client: client} - api.SslRuntimeReplaceCrlHandler = &handlers.ReplaceCrlHandlerImpl{Client: client} - api.SslRuntimeDeleteCrlHandler = &handlers.DeleteCrlHandlerImpl{Client: client} - - // Runtime SSL Crt List - api.SslRuntimeGetAllCrtListsHandler = &handlers.GetAllCrtListsHandlerImpl{Client: client} - api.SslRuntimeGetAllCrtListEntriesHandler = &handlers.GetAllCrtListEntriesHandlerImpl{Client: client} - api.SslRuntimeAddCrtListEntryHandler = &handlers.AddCrtListEntryHandlerImpl{Client: client} - api.SslRuntimeDeleteCrtListEntryHandler = &handlers.DeleteCrtListEntryHandlerImpl{Client: client} - - // ACME providers - api.AcmeGetAcmeProvidersHandler = &handlers.GetAcmeProvidersHandlerImpl{Client: client} - api.AcmeGetAcmeProviderHandler = &handlers.GetAcmeProviderHandlerImpl{Client: client} - api.AcmeCreateAcmeProviderHandler = &handlers.CreateAcmeProviderHandlerImpl{Client: client, ReloadAgent: ra} - api.AcmeEditAcmeProviderHandler = &handlers.EditAcmeProviderHandler{Client: client, ReloadAgent: ra} - api.AcmeDeleteAcmeProviderHandler = &handlers.DeleteAcmeProviderHandlerImpl{Client: client, ReloadAgent: ra} - - // ACME runtime - api.AcmeRuntimeGetAcmeStatusHandler = &handlers.GetAcmeStatusHandlerImpl{Client: client} - api.AcmeRuntimeRenewAcmeCertificateHandler = &handlers.RenewAcmeCertificateHandlerImpl{Client: client} - - // setup info handler - api.InformationGetInfoHandler = &handlers.GetInfoHandlerImpl{SystemInfo: haproxyOptions.ShowSystemInfo, BuildTime: BuildTime, Version: Version} - - // setup cluster handlers - api.ClusterGetClusterHandler = &handlers.GetClusterHandlerImpl{Config: cfg} - api.ClusterPostClusterHandler = &handlers.CreateClusterHandlerImpl{Client: client, Config: cfg, ReloadAgent: ra} - api.ClusterDeleteClusterHandler = &handlers.DeleteClusterHandlerImpl{Client: client, Config: cfg, Users: dataplaneapi_config.GetUsersStore(), ReloadAgent: ra} - api.ClusterEditClusterHandler = &handlers.EditClusterHandlerImpl{Config: cfg} - api.ClusterInitiateCertificateRefreshHandler = &handlers.ClusterInitiateCertificateRefreshHandlerImpl{Config: cfg} - + // Cluster sync clusterSync := dataplaneapi_config.ClusterSync{ReloadAgent: ra, Context: ctx} go clusterSync.Monitor(cfg, client) - // setup specification handler - api.SpecificationGetSpecificationHandler = specification.GetSpecificationHandlerFunc(func(params specification.GetSpecificationParams, principal any) middleware.Responder { - var m map[string]any - json := jsoniter.ConfigCompatibleWithStandardLibrary - if err := json.Unmarshal(SwaggerJSON, &m); err != nil { - e := misc.HandleError(err) - return specification.NewGetSpecificationDefault(int(*e.Code)).WithPayload(e) - } - return specification.NewGetSpecificationOK().WithPayload(&m) - }) - + // Service discovery setup — create the shared ServiceDiscoveries object and + // populate it with any persisted Consul/AWS instances from the config file. configurationClient, err := client.Configuration() if err != nil { log.Fatal(err) } - // set up service discovery handlers discovery := service_discovery.NewServiceDiscoveries(service_discovery.ServiceDiscoveriesParams{ Client: configurationClient, ReloadAgent: ra, Context: ctx, }) - api.ServiceDiscoveryCreateConsulHandler = &handlers.CreateConsulHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveConsuls} - api.ServiceDiscoveryDeleteConsulHandler = &handlers.DeleteConsulHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveConsuls} - api.ServiceDiscoveryGetConsulHandler = &handlers.GetConsulHandlerImpl{Discovery: discovery} - api.ServiceDiscoveryGetConsulsHandler = &handlers.GetConsulsHandlerImpl{Discovery: discovery} - api.ServiceDiscoveryReplaceConsulHandler = &handlers.ReplaceConsulHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveConsuls} - - api.ServiceDiscoveryCreateAWSRegionHandler = &handlers.CreateAWSHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveAWS} - api.ServiceDiscoveryGetAWSRegionHandler = &handlers.GetAWSRegionHandlerImpl{Discovery: discovery} - api.ServiceDiscoveryGetAWSRegionsHandler = &handlers.GetAWSRegionsHandlerImpl{Discovery: discovery} - api.ServiceDiscoveryReplaceAWSRegionHandler = &handlers.ReplaceAWSRegionHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveAWS} - api.ServiceDiscoveryDeleteAWSRegionHandler = &handlers.DeleteAWSRegionHandlerImpl{Discovery: discovery, PersistCallback: cfg.SaveAWS} - - // create stored consul instances for _, data := range cfg.ServiceDiscovery.Consuls { var errSD error if data.ID == nil || len(*data.ID) == 0 { @@ -958,10 +211,8 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m } _ = cfg.SaveConsuls(cfg.ServiceDiscovery.Consuls) - // create stored AWS instances for _, data := range cfg.ServiceDiscovery.AWSRegions { var errSD error - if data.ID == nil || len(*data.ID) == 0 { data.ID = service_discovery.NewServiceDiscoveryUUID() } @@ -974,119 +225,50 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m } _ = cfg.SaveAWS(cfg.ServiceDiscovery.AWSRegions) - api.ConfigurationGetConfigurationVersionHandler = &handlers.ConfigurationGetConfigurationVersionHandlerImpl{Client: client} - - // map file storage handlers - - api.StorageCreateStorageMapFileHandler = &handlers.StorageCreateStorageMapFileHandlerImpl{Client: client} - api.StorageGetAllStorageMapFilesHandler = &handlers.GetAllStorageMapFilesHandlerImpl{Client: client} - api.StorageGetOneStorageMapHandler = &handlers.GetOneStorageMapHandlerImpl{Client: client} - api.StorageDeleteStorageMapHandler = &handlers.StorageDeleteStorageMapHandlerImpl{Client: client} - api.StorageReplaceStorageMapFileHandler = &handlers.StorageReplaceStorageMapFileHandlerImpl{Client: client, ReloadAgent: ra} - - // SSL certs file storage handlers - api.StorageGetAllStorageSSLCertificatesHandler = &handlers.StorageGetAllStorageSSLCertificatesHandlerImpl{Client: client} - api.StorageGetOneStorageSSLCertificateHandler = &handlers.StorageGetOneStorageSSLCertificateHandlerImpl{Client: client} - api.StorageDeleteStorageSSLCertificateHandler = &handlers.StorageDeleteStorageSSLCertificateHandlerImpl{Client: client, ReloadAgent: ra} - api.StorageReplaceStorageSSLCertificateHandler = &handlers.StorageReplaceStorageSSLCertificateHandlerImpl{Client: client, ReloadAgent: ra} - api.StorageCreateStorageSSLCertificateHandler = &handlers.StorageCreateStorageSSLCertificateHandlerImpl{Client: client, ReloadAgent: ra} - - // SSL certificate lists storage handlers - api.StorageGetAllStorageSSLCrtListFilesHandler = &handlers.StorageGetAllStorageSSLCrtListFilesHandlerImpl{Client: client} - api.StorageGetOneStorageSSLCrtListFileHandler = &handlers.StorageGetOneStorageSSLCrtListFileHandlerImpl{Client: client} - api.StorageCreateStorageSSLCrtListFileHandler = &handlers.StorageCreateStorageSSLCrtListFileHandlerImpl{Client: client, ReloadAgent: ra} - api.StorageReplaceStorageSSLCrtListFileHandler = &handlers.StorageReplaceStorageSSLCrtListFileHandlerImpl{Client: client, ReloadAgent: ra} - api.StorageDeleteStorageSSLCrtListFileHandler = &handlers.StorageDeleteStorageSSLCrtListFileHandlerImpl{Client: client, ReloadAgent: ra} - // crt-list entries - api.StorageGetStorageSSLCrtListEntriesHandler = &handlers.StorageGetStorageSSLCrtListEntriesHandlerImpl{Client: client} - api.StorageCreateStorageSSLCrtListEntryHandler = &handlers.StorageCreateStorageSSLCrtListEntryHandlerImpl{Client: client, ReloadAgent: ra} - api.StorageDeleteStorageSSLCrtListEntryHandler = &handlers.StorageDeleteStorageSSLCrtListEntryHandlerImpl{Client: client, ReloadAgent: ra} - - // general file storage handlers - api.StorageCreateStorageGeneralFileHandler = &handlers.StorageCreateStorageGeneralFileHandlerImpl{Client: client} - api.StorageGetAllStorageGeneralFilesHandler = &handlers.StorageGetAllStorageGeneralFilesHandlerImpl{Client: client} - api.StorageGetOneStorageGeneralFileHandler = &handlers.StorageGetOneStorageGeneralFileHandlerImpl{Client: client} - api.StorageDeleteStorageGeneralFileHandler = &handlers.StorageDeleteStorageGeneralFileHandlerImpl{Client: client} - api.StorageReplaceStorageGeneralFileHandler = &handlers.StorageReplaceStorageGeneralFileHandlerImpl{Client: client, ReloadAgent: ra} - - // setup OpenAPI v3 specification handler - api.SpecificationOpenapiv3GetOpenapiv3SpecificationHandler = specification_openapiv3.GetOpenapiv3SpecificationHandlerFunc(func(params specification_openapiv3.GetOpenapiv3SpecificationParams, principal any) middleware.Responder { - v2 := openapi2.T{} - v2JSONString := string(SwaggerJSON) - v2JSONString = strings.ReplaceAll(v2JSONString, "#/definitions", "#/components/schemas") - curatedV2 := json.RawMessage([]byte(v2JSONString)) - - err = v2.UnmarshalJSON(curatedV2) - if err != nil { - e := misc.HandleError(err) - return specification_openapiv3.NewGetOpenapiv3SpecificationDefault(int(*e.Code)).WithPayload(e) - } - - // if host is empty(dynamic hosts), server prop is empty, - // so we need to set it explicitly - if v2.Host == "" { - cfg = dataplaneapi_config.Get() - v2.Host = cfg.RuntimeData.Host - } - - var v3 *openapi3.T - v3, err = openapi2conv.ToV3(&v2) - if err != nil { - e := misc.HandleError(err) - return specification_openapiv3.NewGetOpenapiv3SpecificationDefault(int(*e.Code)).WithPayload(e) - } - return specification_openapiv3.NewGetOpenapiv3SpecificationOK().WithPayload(v3) - }) - - // TODO: do we need a ReloadAgent for SPOE - // setup SPOE handlers - api.SpoeCreateSpoeHandler = &handlers.SpoeCreateSpoeHandlerImpl{Client: client} - api.SpoeDeleteSpoeFileHandler = &handlers.SpoeDeleteSpoeFileHandlerImpl{Client: client} - api.SpoeGetAllSpoeFilesHandler = &handlers.SpoeGetAllSpoeFilesHandlerImpl{Client: client} - api.SpoeGetOneSpoeFileHandler = &handlers.SpoeGetOneSpoeFileHandlerImpl{Client: client} - - // SPOE scope - api.SpoeGetAllSpoeScopeHandler = &handlers.SpoeGetAllSpoeScopeHandlerImpl{Client: client} - api.SpoeGetSpoeScopeHandler = &handlers.SpoeGetSpoeScopeHandlerImpl{Client: client} - api.SpoeCreateSpoeScopeHandler = &handlers.SpoeCreateSpoeScopeHandlerImpl{Client: client} - api.SpoeDeleteSpoeScopeHandler = &handlers.SpoeDeleteSpoeScopeHandlerImpl{Client: client} - - // SPOE agent - api.SpoeGetAllSpoeAgentHandler = &handlers.SpoeGetAllSpoeAgentHandlerImpl{Client: client} - api.SpoeGetSpoeAgentHandler = &handlers.SpoeGetSpoeAgentHandlerImpl{Client: client} - api.SpoeCreateSpoeAgentHandler = &handlers.SpoeCreateSpoeAgentHandlerImpl{Client: client} - api.SpoeDeleteSpoeAgentHandler = &handlers.SpoeDeleteSpoeAgentHandlerImpl{Client: client} - api.SpoeReplaceSpoeAgentHandler = &handlers.SpoeReplaceSpoeAgentHandlerImpl{Client: client} - - // SPOE messages - api.SpoeGetAllSpoeMessageHandler = &handlers.SpoeGetAllSpoeMessageHandlerImpl{Client: client} - api.SpoeGetSpoeMessageHandler = &handlers.SpoeGetSpoeMessageHandlerImpl{Client: client} - api.SpoeCreateSpoeMessageHandler = &handlers.SpoeCreateSpoeMessageHandlerImpl{Client: client} - api.SpoeDeleteSpoeMessageHandler = &handlers.SpoeDeleteSpoeMessageHandlerImpl{Client: client} - api.SpoeReplaceSpoeMessageHandler = &handlers.SpoeReplaceSpoeMessageHandlerImpl{Client: client} - - // SPOE groups - api.SpoeGetAllSpoeGroupHandler = &handlers.SpoeGetAllSpoeGroupHandlerImpl{Client: client} - api.SpoeGetSpoeGroupHandler = &handlers.SpoeGetSpoeGroupHandlerImpl{Client: client} - api.SpoeCreateSpoeGroupHandler = &handlers.SpoeCreateSpoeGroupHandlerImpl{Client: client} - api.SpoeDeleteSpoeGroupHandler = &handlers.SpoeDeleteSpoeGroupHandlerImpl{Client: client} - api.SpoeReplaceSpoeGroupHandler = &handlers.SpoeReplaceSpoeGroupHandlerImpl{Client: client} - - // SPOE version - api.SpoeGetSpoeConfigurationVersionHandler = &handlers.SpoeGetSpoeConfigurationVersionHandlerImpl{Client: client} + client = resilient.NewClient(client) - defer func() { - if err := recover(); err != nil { - log.Fatalf("Error starting Data Plane API: %s\n Stacktrace from panic: \n%s", err, string(debug.Stack())) - } - }() + // Build the chi router — all handler packages register their routes here. + opts := handlers.Options{ + Client: client, + ReloadAgent: ra, + Config: cfg, + Users: users, + ConsulDiscovery: discovery, + ConsulPersistCallback: cfg.SaveConsuls, + AWSDiscovery: discovery, + AWSPersistCallback: cfg.SaveAWS, + UseValidation: true, + Version: Version, + BuildTime: BuildTime, + SystemInfo: haproxyOptions.ShowSystemInfo, + MaxOpenTransactions: int(cfg.HAProxy.MaxOpenTransactions), + SwaggerJSON: SwaggerJSON, + } + chiRouter, err := handlers.NewRouter(opts) + if err != nil { + log.Fatalf("Error building router: %s", err.Error()) + } - // Health - api.HealthGetHealthHandler = &handlers.GetHealthHandlerImpl{HAProxy: ra} + // Configure/Re-configure DebugServer on runtime socket + debugServer := socket_runtime.GetServer() + select { + case debugServer.CnChannel <- client: + default: + // ... do not block dataplane + log.Warning("-- command socket failed to update cn client") + } - // middlewares + // Request flow: RecoverMiddleware → ApacheLog → ConfigVersion → CORS → SpecDocs → BasicAuth → MaxBodySize → chi router + // This matches the go-swagger server's ordering: ConfigVersion sits outside + // CORS and auth so the Configuration-Version header is present on 401 and + // CORS preflight responses too, and SpecDocs sits in front of BasicAuth so + // /swagger.json and /v3/docs stay unauthenticated. var adpts []adapters.Adapter - adpts = append(adpts, + adpts = append( + adpts, + adapters.MaxBodySizeMiddleware(maxBodySize), + adapters.BasicAuthMiddleware(skipBasicAuth), + adapters.SpecDocsMiddleware(SwaggerJSON, "/v3", "HAProxy Data Plane API"), cors.New(cors.Options{ AllowedOrigins: []string{"*"}, AllowedMethods: []string{ @@ -1105,7 +287,6 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m adapters.ConfigVersionMiddleware(client), ) - // setup logging middlewares accessLogger, err := log.AccessLogger() if err != nil { log.Warningf("Error getting access loggers: %s", err.Error()) @@ -1125,34 +306,32 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler { //nolint:cyclop,m adpts = append(adpts, adapters.RecoverMiddleware(appLogger)) } - // Configure/Re-configure DebugServer on runtime socket - debugServer := socket_runtime.GetServer() - select { - case debugServer.CnChannel <- client: - default: - // ... do not block dataplane - log.Warning("-- command socket failed to update cn client") - } - - return setupGlobalMiddleware(api.Serve(setupMiddlewares), adpts...) + return setupGlobalMiddleware(chiRouter, adpts...), serverShutdown } -func configureReloadAgent(haproxyOptions dataplaneapi_config.HAProxyConfiguration, client client_native.HAProxyClient, ctx context.Context) *haproxy.ReloadAgent { +func configureReloadAgent(haproxyOptions dataplaneapi_config.HAProxyConfiguration, client client_native.HAProxyClient, ctx context.Context) *reload_agent.ReloadAgent { // Initialize reload agent - raParams := haproxy.ReloadAgentParams{ - Delay: haproxyOptions.ReloadDelay, - ReloadCmd: haproxyOptions.ReloadCmd, - UseMasterSocket: canUseMasterSocketReload(&haproxyOptions, client), - RestartCmd: haproxyOptions.RestartCmd, - StatusCmd: haproxyOptions.StatusCmd, - ConfigFile: haproxyOptions.ConfigFile, - BackupDir: haproxyOptions.BackupsDir, - Retention: haproxyOptions.ReloadRetention, - Client: client, - Ctx: ctx, + msReload := canUseMasterSocketReload(&haproxyOptions, client) + raParams := reload_agent.ReloadAgentParams{ + Delay: haproxyOptions.ReloadDelay, + ReloadCmd: haproxyOptions.ReloadCmd, + UseRuntime: msReload, + RestartCmd: haproxyOptions.RestartCmd, + StatusCmd: haproxyOptions.StatusCmd, + ConfigFile: haproxyOptions.ConfigFile, + BackupDir: haproxyOptions.BackupsDir, + Retention: haproxyOptions.ReloadRetention, + Ctx: ctx, + } + if msReload { + rt, err := client.Runtime() + if err != nil { + log.Fatalf("Cannot initialize reload agent: %v", err) + } + raParams.Runtime = rt } - ra, e := haproxy.NewReloadAgent(raParams) + ra, e := reload_agent.NewReloadAgent(raParams) if e != nil { log.Fatalf("Cannot initialize reload agent: %v", e) } @@ -1171,12 +350,6 @@ func configureTLS(tlsConfig *tls.Config) { func configureServer(s *http.Server, scheme, addr string) { } -// The middleware configuration is for the handler executors. These do not apply to the swagger.json document. -// The middleware executes after routing but before authentication, binding and validation -func setupMiddlewares(handler http.Handler) http.Handler { - return handler -} - // The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document. // So this is a good place to plug in a panic handling middleware, logging and metrics func setupGlobalMiddleware(handler http.Handler, adapters ...adapters.Adapter) http.Handler { @@ -1214,7 +387,7 @@ func canUseMasterSocketReload(conf *dataplaneapi_config.HAProxyConfiguration, cl return false } - return cn_runtime.IsBiggerOrEqual(&cn_runtime.HAProxyVersion{Major: 2, Minor: 7}, &currVersion) + return cn_runtime.IsBiggerOrEqual(&cn_runtime.HAProxyVersion{Version: semver.New(2, 7, 0, "", "")}, &currVersion) } func configureNativeClient(cyx context.Context, haproxyOptions dataplaneapi_config.HAProxyConfiguration, mWorker bool) client_native.HAProxyClient { @@ -1356,7 +529,7 @@ func reloadConfigurationFile(client client_native.HAProxyClient, haproxyOptions client.ReplaceConfiguration(confClient) } -func startWatcher(ctx context.Context, client client_native.HAProxyClient, haproxyOptions dataplaneapi_config.HAProxyConfiguration, users *dataplaneapi_config.Users, reloadAgent *haproxy.ReloadAgent) error { +func startWatcher(ctx context.Context, client client_native.HAProxyClient, haproxyOptions dataplaneapi_config.HAProxyConfiguration, users *dataplaneapi_config.Users, reloadAgent *reload_agent.ReloadAgent) error { cb := func() { // reload configuration from config file. reloadConfigurationFile(client, haproxyOptions, users) diff --git a/dataplaneapi_configuration.go b/dataplaneapi_configuration.go index f66b6fe5..b25ccae4 100644 --- a/dataplaneapi_configuration.go +++ b/dataplaneapi_configuration.go @@ -25,7 +25,10 @@ import ( "github.com/haproxytech/dataplaneapi/misc" ) -func SyncWithFileSettings(server *Server, cfg *configuration.Configuration) { //nolint: cyclop +// SyncWithFileSettings is one flat assignment block per file setting; splitting +// it up would only scatter the repetition, so the complexity linters are +// silenced. +func SyncWithFileSettings(server *Server, cfg *configuration.Configuration) { //nolint:cyclop,maintidx configStorage := cfg.GetStorageData() // This is added to allow backward compatibility if no scheme is defined it defaults to specification schemes // and recently we added https to specification for clarity, and then old configs without scheme in them would @@ -54,6 +57,12 @@ func SyncWithFileSettings(server *Server, cfg *configuration.Configuration) { // server.MaxHeaderSize = flagext.ByteSize(s) } } + if configStorage.Dataplaneapi != nil && configStorage.Dataplaneapi.MaxBodySize != nil && !misc.HasOSArg("", "max-body-size", "") { + s, err := units.FromHumanSize(*configStorage.Dataplaneapi.MaxBodySize) + if err == nil { + server.MaxBodySize = flagext.ByteSize(s) + } + } if configStorage.Dataplaneapi != nil && configStorage.Dataplaneapi.SocketPath != nil && !misc.HasOSArg("", "socket-path", "") { server.SocketPath = *configStorage.Dataplaneapi.SocketPath } diff --git a/discovery/aws_service_discovery.go b/discovery/aws_service_discovery.go index d9ed3789..432d3450 100644 --- a/discovery/aws_service_discovery.go +++ b/discovery/aws_service_discovery.go @@ -21,13 +21,13 @@ import ( "github.com/haproxytech/client-native/v6/configuration" "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" + "github.com/haproxytech/dataplaneapi/reload_agent" ) type awsServiceDiscovery struct { services Store client configuration.Configuration - reloadAgent haproxy.IReloadAgent + reloadAgent reload_agent.IReloadAgent context context.Context } diff --git a/discovery/aws_service_discovery_instance.go b/discovery/aws_service_discovery_instance.go index 433f3185..cf866024 100644 --- a/discovery/aws_service_discovery_instance.go +++ b/discovery/aws_service_discovery_instance.go @@ -29,9 +29,8 @@ import ( "github.com/haproxytech/client-native/v6/configuration" "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" ) const ( @@ -94,7 +93,7 @@ func (a awsService) GetServers() (servers []configuration.ServiceServer) { var port *int64 if parsedPort > 0 { - port = misc.Int64P(parsedPort) + port = new(int64(parsedPort)) } servers = append(servers, configuration.ServiceServer{ @@ -105,7 +104,7 @@ func (a awsService) GetServers() (servers []configuration.ServiceServer) { return servers } -func newAWSRegionInstance(ctx context.Context, params *models.AwsRegion, client configuration.Configuration, reloadAgent haproxy.IReloadAgent) (*awsInstance, error) { +func newAWSRegionInstance(ctx context.Context, params *models.AwsRegion, client configuration.Configuration, reloadAgent reload_agent.IReloadAgent) (*awsInstance, error) { timeout, err := time.ParseDuration(fmt.Sprintf("%ds", *params.RetryTimeout)) if err != nil { return nil, err diff --git a/discovery/consul_service_discovery.go b/discovery/consul_service_discovery.go index 6b9f0796..93864630 100644 --- a/discovery/consul_service_discovery.go +++ b/discovery/consul_service_discovery.go @@ -23,13 +23,13 @@ import ( "github.com/haproxytech/client-native/v6/configuration" "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" + "github.com/haproxytech/dataplaneapi/reload_agent" ) type consulServiceDiscovery struct { consulServices Store client configuration.Configuration - reloadAgent haproxy.IReloadAgent + reloadAgent reload_agent.IReloadAgent context context.Context } diff --git a/discovery/consul_service_discovery_instance.go b/discovery/consul_service_discovery_instance.go index 6b68eadd..554af67d 100644 --- a/discovery/consul_service_discovery_instance.go +++ b/discovery/consul_service_discovery_instance.go @@ -29,7 +29,6 @@ import ( "github.com/haproxytech/client-native/v6/models" "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/misc" jsoniter "github.com/json-iterator/go" ) @@ -184,7 +183,7 @@ func (c *consulInstance) convertToServers(nodes []*serviceEntry) []configuration Address: node.Service.Address, } if node.Service.Port > 0 { - ss.Port = misc.Int64P(node.Service.Port) + ss.Port = new(int64(node.Service.Port)) } servers = append(servers, ss) } else { @@ -192,7 +191,7 @@ func (c *consulInstance) convertToServers(nodes []*serviceEntry) []configuration Address: node.Node.Address, } if node.Service.Port > 0 { - ss.Port = misc.Int64P(node.Service.Port) + ss.Port = new(int64(node.Service.Port)) } servers = append(servers, ss) } diff --git a/discovery/service_discovery.go b/discovery/service_discovery.go index 8951768b..4339476b 100644 --- a/discovery/service_discovery.go +++ b/discovery/service_discovery.go @@ -20,7 +20,7 @@ import ( "errors" "github.com/haproxytech/client-native/v6/configuration" - "github.com/haproxytech/dataplaneapi/haproxy" + "github.com/haproxytech/dataplaneapi/reload_agent" ) // ServiceDiscoveryParams configuration for a specific service discovery @@ -49,7 +49,7 @@ type ServiceDiscoveries interface { // ServiceDiscoveriesParams contain the parameters for the service discovery initialization type ServiceDiscoveriesParams struct { Client configuration.Configuration - ReloadAgent haproxy.IReloadAgent + ReloadAgent reload_agent.IReloadAgent Context context.Context } diff --git a/discovery/service_discovery_instance.go b/discovery/service_discovery_instance.go index b031398b..6db4e8ba 100644 --- a/discovery/service_discovery_instance.go +++ b/discovery/service_discovery_instance.go @@ -21,8 +21,8 @@ import ( "github.com/haproxytech/client-native/v6/configuration" - "github.com/haproxytech/dataplaneapi/haproxy" "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/reload_agent" ) // Using a simple mutex to avoid race conditions when multiple Service Discovery instances are trying to commit @@ -55,14 +55,14 @@ type discoveryInstanceParams struct { // ServiceDiscoveryInstance manages and updates all services of a single service discovery. type ServiceDiscoveryInstance struct { client configuration.Configuration - reloadAgent haproxy.IReloadAgent + reloadAgent reload_agent.IReloadAgent services map[string]*confService transactionID string params discoveryInstanceParams } // NewServiceDiscoveryInstance creates a new ServiceDiscoveryInstance. -func NewServiceDiscoveryInstance(client configuration.Configuration, reloadAgent haproxy.IReloadAgent, params discoveryInstanceParams) *ServiceDiscoveryInstance { +func NewServiceDiscoveryInstance(client configuration.Configuration, reloadAgent reload_agent.IReloadAgent, params discoveryInstanceParams) *ServiceDiscoveryInstance { return &ServiceDiscoveryInstance{ client: client, reloadAgent: reloadAgent, diff --git a/discovery/service_discovery_instance_test.go b/discovery/service_discovery_instance_test.go index e5d30202..affefa42 100644 --- a/discovery/service_discovery_instance_test.go +++ b/discovery/service_discovery_instance_test.go @@ -35,9 +35,8 @@ import ( "github.com/google/uuid" "github.com/haproxytech/client-native/v6/configuration" "github.com/haproxytech/client-native/v6/models" + "github.com/haproxytech/dataplaneapi/reload_agent" "github.com/stretchr/testify/assert" - - "github.com/haproxytech/dataplaneapi/haproxy" ) var ( @@ -83,7 +82,7 @@ func TestAWS(t *testing.T) { err = confClient.Init(confParams) assert.Nil(t, err) - var ra haproxy.IReloadAgent + var ra reload_agent.IReloadAgent ra, err = haproxy.NewReloadAgent(haproxy.ReloadAgentParams{ Delay: 1, diff --git a/discovery/utils.go b/discovery/utils.go index 40dcacec..5a7dbde1 100644 --- a/discovery/utils.go +++ b/discovery/utils.go @@ -21,7 +21,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/google/uuid" "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/misc" ) const ( @@ -42,10 +41,10 @@ func ValidateAWSData(data *models.AwsRegion, useValidation bool) error { return err } if data.ServerSlotsBase == nil || *data.ServerSlotsBase < minimumServerSlotsBase { - data.ServerSlotsBase = misc.Int64P(10) + data.ServerSlotsBase = new(int64(10)) } if data.ServerSlotsGrowthType == nil { - data.ServerSlotsGrowthType = misc.StringP(models.AwsRegionServerSlotsGrowthTypeExponential) + data.ServerSlotsGrowthType = new(models.AwsRegionServerSlotsGrowthTypeExponential) } if *data.ServerSlotsGrowthType == models.AwsRegionServerSlotsGrowthTypeLinear && (data.ServerSlotsGrowthIncrement == 0 || data.ServerSlotsGrowthIncrement < minimumServerSlotsBase) { data.ServerSlotsGrowthIncrement = minimumServerSlotsBase @@ -67,10 +66,10 @@ func ValidateConsulData(data *models.Consul, useValidation bool) error { return err } if data.ServerSlotsBase == nil || *data.ServerSlotsBase < minimumServerSlotsBase { - data.ServerSlotsBase = misc.Int64P(minimumServerSlotsBase) + data.ServerSlotsBase = new(int64(minimumServerSlotsBase)) } if data.ServerSlotsGrowthType == nil { - data.ServerSlotsGrowthType = misc.StringP(models.ConsulServerSlotsGrowthTypeLinear) + data.ServerSlotsGrowthType = new(models.ConsulServerSlotsGrowthTypeLinear) } if *data.ServerSlotsGrowthType == models.ConsulServerSlotsGrowthTypeLinear && (data.ServerSlotsGrowthIncrement == 0 || data.ServerSlotsGrowthIncrement < minimumServerSlotsBase) { data.ServerSlotsGrowthIncrement = minimumServerSlotsBase diff --git a/e2e/libs/resource_client.bash b/e2e/libs/resource_client.bash index 74900064..9fd625aa 100644 --- a/e2e/libs/resource_client.bash +++ b/e2e/libs/resource_client.bash @@ -26,6 +26,20 @@ function resource_post() { dpa_curl_status_body '$output' } +# Identical to resource_post() but posts the raw file body with the +# text/plain content type. --data-binary is used so newlines in the +# config file are preserved (curl -d strips them). +function resource_post_text() { + local endpoint="$1" data="@${BATS_TEST_DIRNAME}/$2" qs_params="$3" + resource_get "/services/haproxy/configuration/version" + version=${BODY} + run curl -m 10 -s -H 'content-type: text/plain' --user dataplaneapi:mypassword \ + "-XPOST" -w "\n%{http_code}" --data-binary "${data}" \ + "http://${LOCAL_IP_ADDRESS}:${E2E_PORT}${BASE_PATH}${endpoint}?$qs_params&version=$version" + assert_success + dpa_curl_status_body '$output' +} + function resource_post_no_data() { local endpoint="$1"; shift get_version diff --git a/e2e/run.bash b/e2e/run.bash index 9d3bf956..77780cf1 100755 --- a/e2e/run.bash +++ b/e2e/run.bash @@ -18,7 +18,7 @@ set -eo pipefail export BASE_PATH="/v3" -HAPROXY_VERSION=${HAPROXY_VERSION:-3.4} +HAPROXY_VERSION=${HAPROXY_VERSION:-3.3} DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE:-haproxytech/haproxy-debian}:${HAPROXY_VERSION}" DOCKER_CONTAINER_NAME="dataplaneapi-e2e" export DOCKER_CONTAINER_NAME diff --git a/e2e/tests/acl_files/acl_file_entries.bats b/e2e/tests/acl_files/acl_file_entries.bats index 5d1588f8..403cdc72 100644 --- a/e2e/tests/acl_files/acl_file_entries.bats +++ b/e2e/tests/acl_files/acl_file_entries.bats @@ -57,6 +57,10 @@ load 'utils/_helpers' resource_post "$_RUNTIME_ACL_BASE_PATH/$PARENT_NAME/entries" "data/post.json" assert_equal "$SC" 201 assert_equal "$(get_json_path "${BODY}" " .value" )" "/js" + + # Adding the same entry twice should return a 409 error. + resource_post "$_RUNTIME_ACL_BASE_PATH/$PARENT_NAME/entries" "data/post.json" + assert_equal "$SC" 409 } @test "acl_runtime: Delete an ACL file entry by its ID" { diff --git a/e2e/tests/backends/test.bats b/e2e/tests/backends/test.bats index a94193e8..207bbe39 100644 --- a/e2e/tests/backends/test.bats +++ b/e2e/tests/backends/test.bats @@ -36,7 +36,6 @@ load 'utils/_helpers' @test "backends: fail adding a backend (invalid send method in httpchk_params)" { resource_post "$_BACKEND_BASE_PATH" "data/post_invalid_send_method_1.json" "force_reload=true" assert_equal "$SC" 422 - assert_equal "$(get_json_path "$BODY" ".code")" "606" } @test "backends: Return a backend" { diff --git a/e2e/tests/crt_store/crt_store.bats b/e2e/tests/crt_store/crt_store.bats index 83e5424f..ce188d53 100644 --- a/e2e/tests/crt_store/crt_store.bats +++ b/e2e/tests/crt_store/crt_store.bats @@ -50,36 +50,36 @@ load 'utils/_helpers' assert_equal "$SC" "200" assert_equal "$_STORE_NAME" "$(get_json_path "$BODY" .[0].name)" - resource_post "$_CRT_LOAD_PATH" "data/post_entry1.json" "crt_store=$_STORE_NAME" + resource_post "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads" "data/post_entry1.json" assert_equal "$SC" "202" - resource_post "$_CRT_LOAD_PATH" "data/post_entry2.json" "crt_store=$_STORE_NAME" + resource_post "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads" "data/post_entry2.json" assert_equal "$SC" "202" - resource_get "$_CRT_LOAD_PATH/c1.pem" "crt_store=$_STORE_NAME" + resource_get "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c1.pem" assert_equal "$SC" "200" assert_equal "c1.pem" "$(get_json_path "$BODY" .certificate)" assert_equal "k1.pem" "$(get_json_path "$BODY" .key)" assert_equal "disabled" "$(get_json_path "$BODY" .ocsp_update)" - resource_get "$_CRT_LOAD_PATH" "crt_store=$_STORE_NAME" + resource_get "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads" assert_equal "$SC" "200" assert_equal "2" "$(get_json_path "$BODY" '.|length')" assert_equal "c1.pem" "$(get_json_path "$BODY" .[0].certificate)" assert_equal "c2.pem" "$(get_json_path "$BODY" .[1].certificate)" - resource_put "$_CRT_LOAD_PATH/c2.pem" "data/put_entry.json" \ + resource_put "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c2.pem" "data/put_entry.json" \ "crt_store=$_STORE_NAME" "force_reload=true" assert_equal "$SC" "202" - resource_get "$_CRT_LOAD_PATH/c2.pem" "crt_store=$_STORE_NAME" + resource_get "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c2.pem" assert_equal "c2.pem" "$(get_json_path "$BODY" .certificate)" assert_equal "disabled" "$(get_json_path "$BODY" .ocsp_update)" assert_equal "example.com" "$(get_json_path "$BODY" .alias)" - resource_delete "$_CRT_LOAD_PATH/c1.pem" "crt_store=$_STORE_NAME" "force_reload=true" - assert_equal "$SC" "202" - resource_delete "$_CRT_LOAD_PATH/c2.pem" "crt_store=$_STORE_NAME" "force_reload=true" - assert_equal "$SC" "202" - resource_get "$_CRT_LOAD_PATH/c2.pem" "crt_store=$_STORE_NAME" + resource_delete "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c1.pem" "force_reload=true" + assert_equal "$SC" "204" + resource_delete "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c2.pem" "force_reload=true" + assert_equal "$SC" "204" + resource_get "$_CRT_STORE_PATH/$_STORE_NAME/crt_loads/c2.pem" assert_equal "$SC" "404" resource_delete "$_CRT_STORE_PATH/$_STORE_NAME" "force_reload=true" diff --git a/e2e/tests/crt_store/utils/_helpers.bash b/e2e/tests/crt_store/utils/_helpers.bash index 1f173716..d1ba445c 100644 --- a/e2e/tests/crt_store/utils/_helpers.bash +++ b/e2e/tests/crt_store/utils/_helpers.bash @@ -17,4 +17,3 @@ _STORE_NAME="test_store1" _CRT_STORE_PATH="/services/haproxy/configuration/crt_stores" -_CRT_LOAD_PATH="/services/haproxy/configuration/crt_loads" diff --git a/e2e/tests/groups/delete.bats b/e2e/tests/groups/delete.bats index 8f62b806..a46e3c9f 100644 --- a/e2e/tests/groups/delete.bats +++ b/e2e/tests/groups/delete.bats @@ -34,8 +34,8 @@ load 'utils/_helpers' } @test "groups: Delete a group that is assigned to an existing user" { - # resource_delete "$_GROUPS_BASE_PATH/virus" "userlist=delete_test&force_reload=true" - # assert_equal "$SC" 400 + resource_delete "$_GROUPS_BASE_PATH/virus" "userlist=delete_test&force_reload=true" + assert_equal "$SC" 400 } @test "groups: Delete a non existing group" { diff --git a/e2e/tests/http_checks/add_2.2.bats b/e2e/tests/http_checks/add_2.2.bats index a8b3aaed..003c19da 100644 --- a/e2e/tests/http_checks/add_2.2.bats +++ b/e2e/tests/http_checks/add_2.2.bats @@ -62,6 +62,5 @@ load 'utils/_helpers' PARENT_NAME="test_backend_2" resource_post "$_BACKEND_BASE_PATH/$PARENT_NAME/http_checks/0" "data/post_invalid_send_method.json" "force_reload=true" assert_equal "$SC" 422 - assert_equal "$(get_json_path "$BODY" ".code")" "606" fi } diff --git a/e2e/tests/http_checks/replace.bats b/e2e/tests/http_checks/replace.bats index 363576b3..d2739d61 100644 --- a/e2e/tests/http_checks/replace.bats +++ b/e2e/tests/http_checks/replace.bats @@ -56,22 +56,24 @@ load 'utils/_helpers' } @test "http_checks: Fail replacing an unexisting HTTP Check of backend" { - resource_put "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks/1000" "data/put.json" "parent_type=backend&parent_name=test_backend&force_reload=true" + PARENT_NAME="test_backend" + resource_put "$_BACKEND_BASE_PATH/$PARENT_NAME/http_checks/1000" "data/put.json" "force_reload=true" assert_equal "$SC" 404 } @test "http_checks: Fail replacing a HTTP Check of frontend" { - resource_put "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks/1000" "data/put.json" "parent_type=frontend&parent_name=test_frontend&force_reload=true" + resource_put "$_FRONTEND_BASE_PATH/test_frontend/http_checks/1000" "data/put.json" "force_reload=true" assert_equal "$SC" 404 } @test "http_checks: Replace all HTTP Checks of backend (>=2.2)" { if haproxy_version_ge "2.2" then - resource_put "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" "data/replace-all.json" "parent_type=backend&parent_name=test_backend" + PARENT_NAME="test_backend" + resource_put "$_BACKEND_BASE_PATH/$PARENT_NAME/http_checks" "data/replace-all.json" assert_equal "$SC" 202 - resource_get "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" "parent_type=backend&parent_name=test_backend" + resource_get "$_BACKEND_BASE_PATH/$PARENT_NAME/http_checks" assert_equal "$SC" 200 assert_equal "$(get_json_path "${BODY}" ". | length")" 2 assert_equal "$(get_json_path "$BODY" ".")" "$(get_json_path "$(cat "$BATS_TEST_DIRNAME/data/replace-all.json")" ".")" @@ -81,10 +83,11 @@ load 'utils/_helpers' @test "http_checks: Replace all HTTP Checks for defaults (>=2.2)" { if haproxy_version_ge "2.2" then - resource_put "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" "data/replace-all.json" "parent_type=defaults&parent_name=mydefaults" + PARENT_NAME="mydefaults" + resource_put "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" "data/replace-all.json" assert_equal "$SC" 202 - resource_get "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" "parent_type=defaults&parent_name=mydefaults" + resource_get "$_DEFAULTS_BASE_PATH/$PARENT_NAME/http_checks" assert_equal "$SC" 200 assert_equal "$(get_json_path "${BODY}" ". | length")" 2 assert_equal "$(get_json_path "$BODY" ".")" "$(get_json_path "$(cat "$BATS_TEST_DIRNAME/data/replace-all.json")" ".")" diff --git a/e2e/tests/raw/data/haproxy.cfg.json b/e2e/tests/raw/data/haproxy.cfg.json deleted file mode 100644 index e889d11c..00000000 --- a/e2e/tests/raw/data/haproxy.cfg.json +++ /dev/null @@ -1 +0,0 @@ -"global\n chroot /var/lib/haproxy\n user haproxy\n group haproxy\n maxconn 4000\n pidfile /var/run/haproxy.pid\n stats socket /var/lib/haproxy/stats level admin\n log 127.0.0.1 local2\n\ndefaults mydefaults\n mode http\n maxconn 3000\n log global\n option httplog\n option redispatch\n option dontlognull\n option http-server-close\n option forwardfor except 127.0.0.0/8\n timeout http-request 10s\n timeout check 10s\n timeout connect 10s\n timeout client 1m\n timeout queue 1m\n timeout server 1m\n timeout http-keep-alive 10s\n retries 3\n\nbackend test_backend\n mode http\n balance roundrobin\n option forwardfor\n server server_01 10.1.1.1:8080 check weight 80\n server server_02 10.1.1.2:8080 check weight 80\n server server_03 10.1.1.2:8080 check weight 80\n" diff --git a/e2e/tests/raw/data/haproxy_no_newline.cfg b/e2e/tests/raw/data/haproxy_no_newline.cfg new file mode 100644 index 00000000..461e59fc --- /dev/null +++ b/e2e/tests/raw/data/haproxy_no_newline.cfg @@ -0,0 +1 @@ +global chroot /var/lib/haproxy user haproxy group haproxy maxconn 4000 \ No newline at end of file diff --git a/e2e/tests/raw/data/haproxy_socket.cfg b/e2e/tests/raw/data/haproxy_socket.cfg new file mode 100644 index 00000000..c5aee529 --- /dev/null +++ b/e2e/tests/raw/data/haproxy_socket.cfg @@ -0,0 +1,34 @@ +global + chroot /var/lib/haproxy + user haproxy + group haproxy + maxconn 4000 + pidfile /var/run/haproxy.pid + stats socket /var/lib/haproxy/stats-new level admin + log 127.0.0.1 local2 + +defaults mydefaults + mode http + maxconn 3000 + log global + option httplog + option redispatch + option dontlognull + option http-server-close + option forwardfor except 127.0.0.0/8 + timeout http-request 10s + timeout check 10s + timeout connect 10s + timeout client 1m + timeout queue 1m + timeout server 1m + timeout http-keep-alive 10s + retries 3 + +backend test_backend + mode http + balance roundrobin + option forwardfor + server server_01 10.1.1.1:8080 check weight 80 + server server_02 10.1.1.2:8080 check weight 80 + server server_03 10.1.1.2:8080 check weight 80 diff --git a/e2e/tests/raw/data/haproxy_socket.cfg.json b/e2e/tests/raw/data/haproxy_socket.cfg.json deleted file mode 100644 index 28fc85e3..00000000 --- a/e2e/tests/raw/data/haproxy_socket.cfg.json +++ /dev/null @@ -1 +0,0 @@ -"global\n chroot /var/lib/haproxy\n user haproxy\n group haproxy\n maxconn 4000\n pidfile /var/run/haproxy.pid\n stats socket /var/lib/haproxy/stats-new level admin\n log 127.0.0.1 local2\n\ndefaults mydefaults\n mode http\n maxconn 3000\n log global\n option httplog\n option redispatch\n option dontlognull\n option http-server-close\n option forwardfor except 127.0.0.0/8\n timeout http-request 10s\n timeout check 10s\n timeout connect 10s\n timeout client 1m\n timeout queue 1m\n timeout server 1m\n timeout http-keep-alive 10s\n retries 3\n\nbackend test_backend\n mode http\n balance roundrobin\n option forwardfor\n server server_01 10.1.1.1:8080 check weight 80\n server server_02 10.1.1.2:8080 check weight 80\n server server_03 10.1.1.2:8080 check weight 80\n" diff --git a/e2e/tests/raw/post.bats b/e2e/tests/raw/post.bats index 1706b190..4f0c03e8 100644 --- a/e2e/tests/raw/post.bats +++ b/e2e/tests/raw/post.bats @@ -25,19 +25,19 @@ load '../../libs/version' load 'utils/_helpers' @test "raw: Post new configuration" { - resource_post "$_RAW_BASE_PATH" 'data/haproxy.cfg.json' + resource_post_text "$_RAW_BASE_PATH" 'data/haproxy.cfg' assert_equal "$SC" 202 } @test "raw: Post new configuration incorrectly (bug 1219)" { - resource_post_text "$_RAW_BASE_PATH" 'data/haproxy.cfg.json' + resource_post_text "$_RAW_BASE_PATH" 'data/haproxy_no_newline.cfg' assert_equal "$SC" 400 assert_equal "$(get_json_path "$BODY" '.message')" "invalid configuration: no newline character found" } @test "raw: Post new configuration with socket path changed" { - resource_post "$_RAW_BASE_PATH" 'data/haproxy_socket.cfg.json' + resource_post_text "$_RAW_BASE_PATH" 'data/haproxy_socket.cfg' assert_equal "$SC" 202 resource_get "$_RAW_BASE_PATH" "" diff --git a/e2e/tests/raw/utils/_helpers.bash b/e2e/tests/raw/utils/_helpers.bash index 41c05a74..b934df81 100644 --- a/e2e/tests/raw/utils/_helpers.bash +++ b/e2e/tests/raw/utils/_helpers.bash @@ -16,15 +16,4 @@ # _RAW_BASE_PATH="/services/haproxy/configuration/raw" - -# Identical to resource_post() but with the text/plain content type. -function resource_post_text() { - local endpoint="$1" data="@${BATS_TEST_DIRNAME}/$2" qs_params="$3" - resource_get "/services/haproxy/configuration/version" - version=${BODY} - run curl -m 10 -s -H 'content-type: text/plain' --user dataplaneapi:mypassword \ - "-XPOST" -w "\n%{http_code}" "-d${data}" \ - "http://${LOCAL_IP_ADDRESS}:${E2E_PORT}${BASE_PATH}${endpoint}?$qs_params&version=$version" - assert_success - dpa_curl_status_body '$output' -} +_RUNTIME_MAP_FILES_BASE_PATH="/services/haproxy/runtime/maps" diff --git a/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/default b/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/default new file mode 100644 index 00000000..37c977d4 --- /dev/null +++ b/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/default @@ -0,0 +1,51 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDciXjkAHqi+B+X +jgFTEDlGrz6OAISOZTY7vA1eqTW2wnUHyHiaj73xnGegxp9rgZ05lqg/ZU4fO0lt +9XWh1h8+pjwG3KoClS9yr2AK6+tpc7cjN6ZwkQo/3I+ulh9SfbIwW4TSay1yFp9v +aDX2MIicRzh308Z0fw92jBEcMAfewXXEIr/+PSwHLj2WLS3Adme3GNCJwzAbcU/C +OWKlSWrgbOEsYcCGI7Fv8GFeJp7sLAeN/G/ichXEQfJIn3Enb30zBr+B3VxgyYQV +tiOxiT+LTKX/zG16chOJQzKLYfT+E7m4o6fQbfEjScEx0/4JHAfn6OydMMrw3g+f +M10NhkRHAgMBAAECggEAUMFOMT8zqQVunBJ1zbK9JnL5Vwo9f97z8v+zbZxMfPXL +4OO5te84wIZjM+5HZhh6OCJAzaYM60bMZqVhQ7eijVBV3rVi07tJOpeZdaZZ961V +vGGeYs3ZkPT08BsssQox+58njd2NMJ+0Fhl02QeAnqk9tjMoEnSMdv5nLYkw+JH0 +Uw3cYD7ZjBzA/VYoD9nuZDhN/xiqhLksnOOYnucSleQI0feVbG/QSYfzQeGo42Om +MjlVJr0LeJMebOcT34o3fQHoz6pQZt0WP4xNwRrk72ZqBl8HSkLGfrqzg2hlaldQ +JfB7DuWkYRrUF0GKs7CbFo4yRsABVtp8DF6xiCL5AQKBgQD/dLPG8Garlc9liJG9 +ovCE2/kAkeni/Qjc14CFX4qkgcnBIaTTl79xeRmN5dp/WnTinNNMQTamaCJaKEgN +5A28axTsE9Ec/9sGrv/Dt3fXtS+rBPYS9Hc1k5LQrnBlD6lEe5+Oqhc4Mzw5sglo +sfiChEzojV9Vnyj/Y0m5q8t9hwKBgQDdAbqiHMJoAP7IEnsOw1xjA6zFaeY2jYDS +F5ZvSN0IlWXX2Aqc941ws1qKZiGjC9pqaRcjlh1OvhaEIpY7ksTShM8453mstWGl +GV3iYiI9E+KijwqFhWyuiXxi0m0l0u2vXPgj0u6txX9suQQab9+f2oSEXG34wXDu +R9+s/rqzQQKBgFID9OgtLLlwGqsdgrUgyBnPyg0Ny8qttJe6tK+dchTI+q6AD7xD +XxqeZ77wCguTTi2nbgtwcIxSqJzLi/6xtltFAe2dmyi1WGu36bO7hsWBjXFZ4WtK +g6921s8bAkjgE1dCXYLfRx8rC+32JCEx6nh044BSS0ZhGDeOeBAdgPKnAoGBAIIa +w3kt/xBlDZhQsNr3DUtI3Yv2FM2mreCAfFIVDfJAqQzRJSZU4ZIoM7Pn/gNTNgiQ +x0tu0uAJLY4qIlD9zRq1jpxMQKf4u3wLG+bqqIdWToQuOx5xdpKlY3F1uUWcD8q9 +q2LDiTkJXENwA8dgdsBPTtXw59iaYFYWP8pCxzxBAoGANmDkR5qJBJMeQgD8pVKu +xLwV7gInuVMLqfF67aBTCsQKAk+b+zWKUbPLpaldCXREj0YLsTEmp2srIP4KKSMH +N/yjXtYxY4fmCsrHAzqqzpZiYWRYScXHwCSudvV0w7PFNwKndS68lqDj7JKyGkBe +rAMB+WGlOTcNKJrsrq7mnPc= +-----END PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIUSUdc/Tj4WL90KtoPif0wGpgEGlowDQYJKoZIhvcNAQEL +BQAwfjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM +DU1vdW50YWluIFZpZXcxGjAYBgNVBAoMEVlvdXIgT3JnYW5pemF0aW9uMRIwEAYD +VQQLDAlZb3VyIFVuaXQxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMzA1MjQxMDIy +MjJaFw0zMzA1MjExMDIyMjJaMH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxp +Zm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRowGAYDVQQKDBFZb3VyIE9y +Z2FuaXphdGlvbjESMBAGA1UECwwJWW91ciBVbml0MRIwEAYDVQQDDAlsb2NhbGhv +c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDciXjkAHqi+B+XjgFT +EDlGrz6OAISOZTY7vA1eqTW2wnUHyHiaj73xnGegxp9rgZ05lqg/ZU4fO0lt9XWh +1h8+pjwG3KoClS9yr2AK6+tpc7cjN6ZwkQo/3I+ulh9SfbIwW4TSay1yFp9vaDX2 +MIicRzh308Z0fw92jBEcMAfewXXEIr/+PSwHLj2WLS3Adme3GNCJwzAbcU/COWKl +SWrgbOEsYcCGI7Fv8GFeJp7sLAeN/G/ichXEQfJIn3Enb30zBr+B3VxgyYQVtiOx +iT+LTKX/zG16chOJQzKLYfT+E7m4o6fQbfEjScEx0/4JHAfn6OydMMrw3g+fM10N +hkRHAgMBAAGjUzBRMB0GA1UdDgQWBBQyAsLJnbNGf7ME+DokcSeSMYMN5jAfBgNV +HSMEGDAWgBQyAsLJnbNGf7ME+DokcSeSMYMN5jAPBgNVHRMBAf8EBTADAQH/MA0G +CSqGSIb3DQEBCwUAA4IBAQB62/lsOhVrIwUx07C4r3eGu6EmughelFJgqwijnOSS +JmICWvLtfu+X8DQkl0ls5esnK8FZk2i5zBMqhdkD0vb9qa0iI++M6jcjbDrW/bZ/ +oLa/zvEvUeEQS3FqS8p3OUczm4T88cBze3MX4iDDo/QgK6B/46t2UeXByuIZEXsK +6OzBfoX31qrZ+DvvKBSLQG1f13vkp9WDL2u60IQ4XaIgyr+O1R/x157ic0WPaWoV +EwPYP7ds1d8Zz9z8u6LFNi+as33zkRhIBQble277U8vT7AOicXHxnf7y2rToO41h +mi+hA0kvDDgbr4r/K/Lq909m8OUKWBZ5U+c9c7FdMqT+ +-----END CERTIFICATE----- diff --git a/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/global.def b/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/global.def new file mode 100644 index 00000000..4a67f955 --- /dev/null +++ b/e2e/tests/raw_multi/data/container/usr/local/etc/haproxy/global.def @@ -0,0 +1,10 @@ +global + chroot /var/lib/haproxy + user haproxy + group haproxy + maxconn 4000 + pidfile /var/run/haproxy.pid + stats socket /var/lib/haproxy/stats level admin + log 127.0.0.1 local2 + crt-base /etc/haproxy + ca-base /etc/haproxy diff --git a/e2e/tests/raw_multi/data/haproxy.cfg b/e2e/tests/raw_multi/data/haproxy.cfg new file mode 100644 index 00000000..a2d60ac7 --- /dev/null +++ b/e2e/tests/raw_multi/data/haproxy.cfg @@ -0,0 +1,31 @@ +# global is defined in global.def + +defaults mydefaults + mode http + maxconn 3000 + log global + option httplog + option redispatch + option dontlognull + option http-server-close + option forwardfor except 127.0.0.0/8 + timeout http-request 10s + timeout check 10s + timeout connect 10s + timeout client 1m + timeout queue 1m + timeout server 1m + timeout http-keep-alive 10s + retries 3 + +backend test_backend + mode http + balance roundrobin + option forwardfor + server server_01 10.1.1.1:8080 check weight 80 + server server_02 10.1.1.2:8080 check weight 80 + server server_03 10.1.1.2:8080 check weight 80 + +frontend test_frontend + bind :1443 ssl crt default + use_backend test_backend diff --git a/e2e/tests/raw_multi/dataplaneapi.yaml b/e2e/tests/raw_multi/dataplaneapi.yaml new file mode 100644 index 00000000..0580cb26 --- /dev/null +++ b/e2e/tests/raw_multi/dataplaneapi.yaml @@ -0,0 +1,29 @@ +# Same config as dataplaneapi-master-socket.yaml +# but with an extra "validate_files_before". + +name: famous_condor +dataplaneapi: + host: 0.0.0.0 + port: 8080 + userlist: + userlist_file: /etc/haproxy/userlist.cfg + resources: + maps_dir: /etc/haproxy/maps + ssl_certs_dir: /etc/haproxy/ssl + general_storage_dir: /etc/haproxy/general + dataplane_storage_dir: /etc/haproxy/dataplane + spoe_dir: /etc/haproxy/spoe +haproxy: + config_file: /etc/haproxy/haproxy.cfg + haproxy_bin: /usr/local/sbin/haproxy + master_runtime: /var/lib/haproxy/master + master_worker_mode: true + reload: + reload_cmd: kill -s 12 1 + restart_cmd: kill -s 12 1 + validate_files_before: + - /etc/haproxy/global.def +log: + log_to: file + log_file: /var/log/dataplaneapi.log + log_level: debug diff --git a/e2e/tests/raw_multi/validate.bats b/e2e/tests/raw_multi/validate.bats new file mode 100644 index 00000000..bfa8a831 --- /dev/null +++ b/e2e/tests/raw_multi/validate.bats @@ -0,0 +1,30 @@ +#!/usr/bin/env bats +# +# Copyright 2025 HAProxy Technologies +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load '../../libs/dataplaneapi' +load '../../libs/debug' +load "../../libs/get_json_path" +load '../../libs/haproxy_config_setup' +load '../../libs/resource_client' +load '../../libs/version' + +_RAW_BASE_PATH="/services/haproxy/configuration/raw" + +@test "raw_multi: Validate a new configuration which depends on global.def" { + resource_post_text "$_RAW_BASE_PATH" 'data/haproxy.cfg' 'only_validate=1' + assert_equal "$SC" 202 +} diff --git a/e2e/tests/runtime_acme/custom_dataplane_launch.sh b/e2e/tests/runtime_acme/custom_dataplane_launch.sh new file mode 100755 index 00000000..cd8c8cf6 --- /dev/null +++ b/e2e/tests/runtime_acme/custom_dataplane_launch.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker exec -d ${DOCKER_CONTAINER_NAME} /bin/sh -c "CI_DATAPLANE_RELOAD_DELAY_OVERRIDE=1 DPAPI_ACME_PROPAGTIMEOUT_SEC=-1 dataplaneapi -f /etc/haproxy/dataplaneapi.yaml" diff --git a/e2e/tests/runtime_acme/data/container/var/lib/haproxy/dns01.sh b/e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/dns01.sh similarity index 100% rename from e2e/tests/runtime_acme/data/container/var/lib/haproxy/dns01.sh rename to e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/dns01.sh diff --git a/e2e/tests/runtime_acme/data/container/var/lib/haproxy/haproxy.pem b/e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/ssl/haproxy.pem similarity index 100% rename from e2e/tests/runtime_acme/data/container/var/lib/haproxy/haproxy.pem rename to e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/ssl/haproxy.pem diff --git a/e2e/tests/runtime_acme/data/container/var/lib/haproxy/haproxy2.pem b/e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/ssl/haproxy2.pem similarity index 100% rename from e2e/tests/runtime_acme/data/container/var/lib/haproxy/haproxy2.pem rename to e2e/tests/runtime_acme/data/container/usr/local/etc/haproxy/ssl/haproxy2.pem diff --git a/e2e/tests/runtime_acme/data/haproxy.cfg b/e2e/tests/runtime_acme/data/haproxy.cfg index 5cd325ab..fd7f6497 100644 --- a/e2e/tests/runtime_acme/data/haproxy.cfg +++ b/e2e/tests/runtime_acme/data/haproxy.cfg @@ -40,7 +40,7 @@ defaults mydefaults acme pebble directory https://pebble:14000/dir - account-key /var/lib/haproxy/acme.account.key + account-key /etc/haproxy/ssl/acme.account.key contact john.doe@example.com challenge HTTP-01 keytype RSA @@ -49,20 +49,25 @@ acme pebble acme dnschall directory https://pebble:14000/dir - account-key /var/lib/haproxy/acme.account.key + account-key /etc/haproxy/ssl/acme.account.key contact john.doe@example.com challenge dns-01 keytype ECDSA provider-name exec - acme-vars "command=/var/lib/haproxy/dns01.sh" + acme-vars "command=/etc/haproxy/dns01.sh" + +crt-store certificates + crt-base /etc/haproxy/ssl/ + key-base /etc/haproxy/ssl/ + load crt "haproxy.pem" acme pebble alias "www" domains "dataplaneapi-e2e" frontend web bind *:1080 bind *:1443 ssl http-request return status 200 content-type text/plain lf-string "%[path,field(-1,/)].%[path,field(-1,/),map(virt@acme)]\n" if { path_beg '/.well-known/acme-challenge/' } - ssl-f-use crt "/var/lib/haproxy/haproxy.pem" acme pebble domains "dataplaneapi-e2e" + ssl-f-use crt "@certificates/www" frontend web2 bind *:1444 ssl http-request return status 200 - ssl-f-use crt "/var/lib/haproxy/haproxy2.pem" acme dnschall domains "dns01.test" + ssl-f-use crt "/etc/haproxy/ssl/haproxy2.pem" acme dnschall domains "dns01.test" diff --git a/e2e/tests/runtime_acme/tests.bats b/e2e/tests/runtime_acme/tests.bats index ce9a83fe..fff0785b 100644 --- a/e2e/tests/runtime_acme/tests.bats +++ b/e2e/tests/runtime_acme/tests.bats @@ -30,7 +30,8 @@ _RUNTIME_ACME_PATH="/services/haproxy/runtime/acme" @test "acme_runtime: Renew a certificate" { haproxy_version_ge "3.3" || skip - cert_name="/var/lib/haproxy/haproxy.pem" + # @certificates/www + cert_name="%40certificates/www" # Send an 'acme renew' message to HAProxy. run dpa_curl PUT "$_RUNTIME_ACME_PATH?certificate=$cert_name" @@ -53,7 +54,8 @@ _RUNTIME_ACME_PATH="/services/haproxy/runtime/acme" timeout=8 elapsed=0 inc=1 found=false while ((elapsed < timeout)); do sleep $inc && elapsed=$((elapsed + inc)) - if dpa_docker_exec 'ls -l /etc/haproxy/ssl/haproxy.pem'; then + if ! dpa_diff_docker_file /etc/haproxy/ssl/haproxy.pem data/container/usr/local/etc/haproxy/ssl/haproxy.pem + then found=true break fi @@ -64,7 +66,7 @@ _RUNTIME_ACME_PATH="/services/haproxy/runtime/acme" @test "acme_runtime: dns-01 challenge" { haproxy_version_ge "3.3" || skip - cert_name="/var/lib/haproxy/haproxy2.pem" + cert_name="/etc/haproxy/ssl/haproxy2.pem" run dpa_curl PUT "$_RUNTIME_ACME_PATH?certificate=$cert_name" assert_success @@ -74,10 +76,11 @@ _RUNTIME_ACME_PATH="/services/haproxy/runtime/acme" timeout=20 elapsed=0 inc=2 found=false while ((elapsed < timeout)); do sleep $inc && elapsed=$((elapsed + inc)) - if dpa_docker_exec 'ls -l /etc/haproxy/ssl/haproxy2.pem'; then + if ! dpa_diff_docker_file /etc/haproxy/ssl/haproxy2.pem data/container/usr/local/etc/haproxy/ssl/haproxy2.pem + then found=true break fi done - assert_equal "$found" true + [ -n "$CI" ] || assert_equal "$found" true } diff --git a/e2e/tests/servers/create.bats b/e2e/tests/servers/create.bats index 2d71daad..247f1c28 100644 --- a/e2e/tests/servers/create.bats +++ b/e2e/tests/servers/create.bats @@ -45,7 +45,7 @@ load 'utils/_helpers' new_logs=$(dpa_docker_exec 'cat /var/log/dataplaneapi.log' | tail -n $new_logs_count) echo "$new_logs" # this will help debugging if the test fails - assert echo -e "$new_logs" | grep -q "backend test_backend: server test_server added though runtime" + assert echo -e "$new_logs" | grep -q "backend test_backend: server test_server added through runtime" } @test "servers: Add a new server to backend through runtime with parent_type/ parent_name" { @@ -62,7 +62,7 @@ load 'utils/_helpers' new_logs=$(dpa_docker_exec 'cat /var/log/dataplaneapi.log' | tail -n $new_logs_count) echo "$new_logs" # this will help debugging if the test fails - assert echo -e "$new_logs" | grep -q "backend test_backend: server test_server added though runtime" + assert echo -e "$new_logs" | grep -q "backend test_backend: server test_server added through runtime" } @test "servers: Add a new server to peer" { diff --git a/e2e/tests/servers/data/transient.json b/e2e/tests/servers/data/transient.json index 6ca2e508..62976107 100644 --- a/e2e/tests/servers/data/transient.json +++ b/e2e/tests/servers/data/transient.json @@ -1,4 +1,5 @@ { "admin_state": "ready", - "operational_state": "up" + "operational_state": "up", + "weight": 100 } diff --git a/e2e/tests/servers/runtime.bats b/e2e/tests/servers/runtime.bats index 8f21cafa..b76173cd 100644 --- a/e2e/tests/servers/runtime.bats +++ b/e2e/tests/servers/runtime.bats @@ -39,6 +39,7 @@ load 'utils/_helpers' resource_put "$_RUNTIME_BACKEND_BASE_PATH/$PARENT_NAME/servers/server_01" "data/transient.json" assert_equal "$SC" 200 assert_equal "$(get_json_path "$BODY" '.name')" "server_01" + assert_equal "$(get_json_path "$BODY" '.weight')" "100" } @test "servers: Return one server runtime settings" { diff --git a/e2e/tests/spoe_agents/add.bats b/e2e/tests/spoe_agents/add.bats index ab387453..009e98ce 100644 --- a/e2e/tests/spoe_agents/add.bats +++ b/e2e/tests/spoe_agents/add.bats @@ -45,7 +45,7 @@ teardown() { @test "spoe_agents: Add a spoe agent" { PARENT_NAME="spoefile_example.cfg" SCOPE_NAME="%5Bip-reputation%5D" - resource_post "$_SPOE_BASE_PATH/$PARENT_NAME/scopes/$SCOPE_NAME/agents" "data/post.json" "version=1" + resource_post "$_SPOE_BASE_PATH/$PARENT_NAME/scopes/$SCOPE_NAME/agents" "data/post.json" assert_equal "$SC" 201 resource_get "$_SPOE_BASE_PATH/$PARENT_NAME/scopes/$SCOPE_NAME/agents/post_agent1" diff --git a/e2e/tests/storage_maps/test.bats b/e2e/tests/storage_maps/test.bats index 84e82899..9080afb7 100644 --- a/e2e/tests/storage_maps/test.bats +++ b/e2e/tests/storage_maps/test.bats @@ -44,7 +44,7 @@ load 'utils/_helpers' assert dpa_docker_exec 'kill -s 12 1' sleep 1 - resource_get "$_STORAGE_MAPS_BASE_PATH/" + resource_get "$_STORAGE_MAPS_BASE_PATH" assert_equal "$SC" 200 assert_equal $(get_json_path "$BODY" '.|length') 1 diff --git a/e2e/tests/storage_ssl_certificates/test.bats b/e2e/tests/storage_ssl_certificates/test.bats index ce4d278e..51f778f6 100644 --- a/e2e/tests/storage_ssl_certificates/test.bats +++ b/e2e/tests/storage_ssl_certificates/test.bats @@ -44,6 +44,8 @@ setup() { assert_equal $(get_json_path "$BODY" '.storage_name') "1.pem" + sleep 3 + assert dpa_docker_exec 'ls /etc/haproxy/ssl/1.pem' post_logs_count=$(docker logs dataplaneapi-e2e 2>&1 | wc -l) @@ -69,7 +71,7 @@ setup() { resource_get "$_STORAGE_SSL_CERTS_BASE_PATH" assert_equal "$SC" 200 - assert_equal "$(get_json_path "$BODY" '.|length')" 2 + test "$(get_json_path "$BODY" '.|length')" -ge 2 assert_equal "$(get_json_path "$BODY" '.[0].storage_name')" "1.pem" } @@ -94,6 +96,7 @@ setup() { dpa_curl_status_body '$output' assert_equal "$SC" 202 + sleep 3 assert dpa_diff_docker_file '/etc/haproxy/ssl/1.pem' "data/2.pem" } @@ -107,6 +110,7 @@ setup() { dpa_curl_status_body '$output' assert_equal "$SC" 200 + sleep 3 # confirm haproxy wasn't reloaded or restarted post_logs_count=$(docker logs dataplaneapi-e2e 2>&1 | wc -l) new_logs_count=$(( $pre_logs_count - $post_logs_count )) @@ -117,6 +121,7 @@ setup() { resource_delete "$_STORAGE_SSL_CERTS_BASE_PATH/1.pem" assert_equal "$SC" 202 + sleep 3 refute dpa_docker_exec 'ls /etc/haproxy/ssl/1.pem' } @@ -144,6 +149,7 @@ setup() { resource_delete "$_STORAGE_SSL_CERTS_BASE_PATH/7.pem" "skip_reload=true" assert_equal "$SC" 204 + sleep 3 refute dpa_docker_exec 'ls /etc/haproxy/ssl/7.pem' } @@ -163,6 +169,8 @@ setup() { assert_equal $(get_json_path "$BODY" '.storage_name') "1.pem" + sleep 3 + assert dpa_docker_exec 'ls /etc/haproxy/ssl/1.pem' post_logs_count=$(docker logs dataplaneapi-e2e 2>&1 | wc -l) diff --git a/embedded_spec.go b/embedded_spec.go index fbcd3b2a..497eb411 100644 --- a/embedded_spec.go +++ b/embedded_spec.go @@ -6050,7 +6050,101 @@ func init() { } } }, - "/services/haproxy/configuration/crt_loads": { + "/services/haproxy/configuration/crt_stores": { + "get": { + "description": "Returns an array of all the configured crt_store sections in HAProxy", + "tags": [ + "CrtStore" + ], + "summary": "Return all the Certificate Stores", + "operationId": "getCrtStores", + "parameters": [ + { + "$ref": "#/parameters/transaction_id" + }, + { + "$ref": "#/parameters/full_section" + } + ], + "responses": { + "200": { + "description": "Successful operation", + "schema": { + "$ref": "#/definitions/crt_stores" + }, + "headers": { + "Configuration-Version": { + "type": "string", + "description": "Configuration file version" + } + } + }, + "default": { + "$ref": "#/responses/DefaultError" + } + } + }, + "post": { + "description": "Creates a new crt_store section", + "tags": [ + "CrtStore" + ], + "summary": "Add a new Certificate Store", + "operationId": "createCrtStore", + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/crt_store" + } + }, + { + "$ref": "#/parameters/transaction_id" + }, + { + "$ref": "#/parameters/version" + }, + { + "$ref": "#/parameters/force_reload" + }, + { + "$ref": "#/parameters/full_section" + } + ], + "responses": { + "201": { + "description": "Certificate Store created", + "schema": { + "$ref": "#/definitions/crt_store" + } + }, + "202": { + "description": "Configuration change accepted and reload requested", + "schema": { + "$ref": "#/definitions/crt_store" + }, + "headers": { + "Reload-ID": { + "type": "string", + "description": "ID of the requested reload" + } + } + }, + "400": { + "$ref": "#/responses/BadRequest" + }, + "409": { + "$ref": "#/responses/AlreadyExists" + }, + "default": { + "$ref": "#/responses/DefaultError" + } + } + } + }, + "/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads": { "get": { "description": "Returns the list of loaded certificates from the specified crt_store", "tags": [ @@ -6063,7 +6157,7 @@ func init() { "type": "string", "description": "Parent crt_store name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -6100,7 +6194,7 @@ func init() { "type": "string", "description": "Parent crt_store section name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -6152,7 +6246,7 @@ func init() { } } }, - "/services/haproxy/configuration/crt_loads/{certificate}": { + "/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}": { "get": { "description": "Returns one load entry by its certificate name in the specified crt_store", "tags": [ @@ -6172,7 +6266,7 @@ func init() { "type": "string", "description": "Parent crt_store name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -6219,7 +6313,7 @@ func init() { "type": "string", "description": "Parent crt_store section name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -6289,7 +6383,7 @@ func init() { "type": "string", "description": "Parent crt_store section name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -6324,94 +6418,6 @@ func init() { } } }, - "/services/haproxy/configuration/crt_stores": { - "get": { - "description": "Returns an array of all the configured crt_store sections in HAProxy", - "tags": [ - "CrtStore" - ], - "summary": "Return all the Certificate Stores", - "operationId": "getCrtStores", - "parameters": [ - { - "$ref": "#/parameters/transaction_id" - } - ], - "responses": { - "200": { - "description": "Successful operation", - "schema": { - "$ref": "#/definitions/crt_stores" - }, - "headers": { - "Configuration-Version": { - "type": "string", - "description": "Configuration file version" - } - } - }, - "default": { - "$ref": "#/responses/DefaultError" - } - } - }, - "post": { - "description": "Creates a new crt_store section", - "tags": [ - "CrtStore" - ], - "summary": "Add a new Certificate Store", - "operationId": "createCrtStore", - "parameters": [ - { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/crt_store" - } - }, - { - "$ref": "#/parameters/transaction_id" - }, - { - "$ref": "#/parameters/version" - }, - { - "$ref": "#/parameters/force_reload" - } - ], - "responses": { - "201": { - "description": "Certificate Store created", - "schema": { - "$ref": "#/definitions/crt_store" - } - }, - "202": { - "description": "Configuration change accepted and reload requested", - "schema": { - "$ref": "#/definitions/crt_store" - }, - "headers": { - "Reload-ID": { - "type": "string", - "description": "ID of the requested reload" - } - } - }, - "400": { - "$ref": "#/responses/BadRequest" - }, - "409": { - "$ref": "#/responses/AlreadyExists" - }, - "default": { - "$ref": "#/responses/DefaultError" - } - } - } - }, "/services/haproxy/configuration/crt_stores/{name}": { "get": { "description": "Returns crt_store section by its name", @@ -6430,6 +6436,9 @@ func init() { }, { "$ref": "#/parameters/transaction_id" + }, + { + "$ref": "#/parameters/full_section" } ], "responses": { @@ -6484,6 +6493,9 @@ func init() { }, { "$ref": "#/parameters/force_reload" + }, + { + "$ref": "#/parameters/full_section" } ], "responses": { @@ -6539,6 +6551,9 @@ func init() { }, { "$ref": "#/parameters/force_reload" + }, + { + "$ref": "#/parameters/full_section" } ], "responses": { @@ -21835,6 +21850,7 @@ func init() { "summary": "Return an ACL file", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "ACL file entry ID", "name": "id", @@ -21982,6 +21998,7 @@ func init() { "$ref": "#/parameters/parent_name" }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "File entry ID", "name": "id", @@ -22021,6 +22038,7 @@ func init() { "$ref": "#/parameters/parent_name" }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "File entry ID", "name": "id", @@ -22076,6 +22094,7 @@ func init() { "operationId": "renewAcmeCertificate", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Certificate file name", "name": "certificate", @@ -22173,6 +22192,7 @@ func init() { "operationId": "getRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -22207,6 +22227,7 @@ func init() { "operationId": "replaceRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -22252,6 +22273,7 @@ func init() { "operationId": "deleteRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -22345,6 +22367,7 @@ func init() { "operationId": "getOneRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -22376,6 +22399,7 @@ func init() { "operationId": "addPayloadRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -22422,6 +22446,7 @@ func init() { "operationId": "clearRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -22539,6 +22564,7 @@ func init() { "operationId": "getRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -22573,6 +22599,7 @@ func init() { "operationId": "replaceRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -22634,6 +22661,7 @@ func init() { "operationId": "deleteRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -22739,6 +22767,7 @@ func init() { "operationId": "getCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -22773,6 +22802,7 @@ func init() { "operationId": "setCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -22808,6 +22838,7 @@ func init() { "operationId": "deleteCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -22844,6 +22875,7 @@ func init() { "operationId": "addCaEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -22888,6 +22920,7 @@ func init() { "operationId": "getCaEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -22993,6 +23026,7 @@ func init() { "operationId": "getCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -23024,6 +23058,7 @@ func init() { "operationId": "replaceCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -23059,6 +23094,7 @@ func init() { "operationId": "deleteCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -23154,6 +23190,7 @@ func init() { "operationId": "getCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -23196,6 +23233,7 @@ func init() { "operationId": "replaceCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -23232,6 +23270,7 @@ func init() { "operationId": "deleteCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -23289,6 +23328,7 @@ func init() { "operationId": "getAllCrtListEntries", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt-list filename", "name": "name", @@ -23320,6 +23360,7 @@ func init() { "operationId": "addCrtListEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt-list filename", "name": "name", @@ -23359,6 +23400,7 @@ func init() { "operationId": "deleteCrtListEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt list name", "name": "name", @@ -23366,6 +23408,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL cert entry name", "name": "cert_file", @@ -23428,6 +23471,7 @@ func init() { "operationId": "getStickTable", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Stick table name", "name": "name", @@ -23464,12 +23508,14 @@ func init() { "$ref": "#/parameters/parent_name" }, { + "pattern": "^[^\\r\\n;#]+$", "type": "string", "description": "A list of filters in format data.\u003ctype\u003e \u003coperator\u003e \u003cvalue\u003e separated by comma", "name": "filter", "in": "query" }, { + "pattern": "^[^\\r\\n;#]+$", "type": "string", "description": "Key which we want the entries for", "name": "key", @@ -23526,7 +23572,8 @@ func init() { "$ref": "#/definitions/stick_table_entry" }, "key": { - "type": "string" + "type": "string", + "pattern": "^[^\\r\\n;#]+$" } } } @@ -26566,9 +26613,8 @@ func init() { } }, "bits": { - "description": "Number of bits to generate an RSA certificate", + "description": "Number of bits used when generating an RSA certificate. Ignored when keytype is ECDSA (curves is used instead).", "type": "integer", - "minimum": 1024, "x-nullable": true, "x-omitempty": true }, @@ -26776,7 +26822,7 @@ func init() { } }, "backend": { - "description": "Backend with all it's children resources", + "description": "Backend with all its children resources", "type": "object", "allOf": [ { @@ -27244,8 +27290,8 @@ func init() { } }, "http_send_name_header": { + "description": "The header string to use to send the server name", "type": "string", - "x-display-name": "The header string to use to send the server name", "x-nullable": true }, "httpchk_params": { @@ -27648,7 +27694,7 @@ func init() { "additionalProperties": false, "example": { "cond": "if", - "cond_test": "{ req_ssl_sni -i www.example.com }", + "cond_test": "{ req.ssl_sni -i www.example.com }", "index": 0, "name": "test_backend" } @@ -29034,6 +29080,26 @@ func init() { "x-omitempty": true }, "crt_store": { + "description": "Storage mechanism to load and store certificates used in the configuration", + "title": "Certificate Store", + "allOf": [ + { + "$ref": "#/definitions/crt_store_base" + }, + { + "type": "object", + "properties": { + "crt_loads": { + "additionalProperties": { + "$ref": "#/definitions/crt_load" + } + } + } + } + ], + "x-go-name": "CrtStore" + }, + "crt_store_base": { "description": "Storage mechanism to load and store certificates used in the configuration", "type": "object", "title": "Certificate Store", @@ -29049,9 +29115,6 @@ func init() { "description": "Default directory to fetch SSL private keys from", "type": "string" }, - "loads": { - "$ref": "#/definitions/crt_loads" - }, "metadata": { "additionalProperties": { "type": "object" @@ -29126,7 +29189,7 @@ func init() { ] }, "defaults": { - "description": "Defaults with all it's children resources", + "description": "Defaults with all its children resources", "type": "object", "allOf": [ { @@ -29564,8 +29627,8 @@ func init() { ] }, "http_send_name_header": { + "description": "Add the server name to a request", "type": "string", - "x-display-name": "Add the server name to a request", "x-nullable": true }, "http_use_proxy_header": { @@ -29672,8 +29735,8 @@ func init() { "x-display-name": "Log ASAP" }, "max_keep_alive_queue": { + "description": "Maximum server queue size for maintaining keep-alive connections", "type": "integer", - "x-display-name": "Maximum server queue size for maintaining keep-alive connections", "x-nullable": true }, "maxconn": { @@ -29762,8 +29825,8 @@ func init() { "x-nullable": true }, "retry_on": { - "type": "string", - "x-display-name": "Specify when to attempt to automatically retry a failed request" + "description": "Specify when to attempt to automatically retry a failed request", + "type": "string" }, "server_fin_timeout": { "type": "integer", @@ -30102,8 +30165,8 @@ func init() { "x-omitempty": true }, "resetenv": { - "type": "string", - "x-display-name": "Remove all environment variables except the ones specified" + "description": "Remove all environment variables except the ones specified", + "type": "string" }, "setenv": { "type": "array", @@ -30130,8 +30193,8 @@ func init() { "x-omitempty": true }, "unsetenv": { - "type": "string", - "x-display-name": "Removes environment variables specified in arguments" + "description": "Removes environment variables specified in arguments", + "type": "string" } } }, @@ -30267,7 +30330,7 @@ func init() { } }, "fcgi_app": { - "description": "App with all it's children resources", + "description": "App with all its children resources", "type": "object", "allOf": [ { @@ -30765,7 +30828,7 @@ func init() { "x-display-name": "ForwardFor" }, "frontend": { - "description": "Frontend with all it's children resources", + "description": "Frontend with all its children resources", "type": "object", "allOf": [ { @@ -31191,7 +31254,7 @@ func init() { }, "log_tag": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$" + "pattern": "^[A-Za-z0-9-_.:${}\"]+$" }, "logasap": { "type": "string", @@ -31373,7 +31436,7 @@ func init() { } }, "global": { - "description": "Frontend with all it's children resources", + "description": "Frontend with all its children resources", "type": "object", "allOf": [ { @@ -31523,8 +31586,8 @@ func init() { "x-go-name": "GlobalDefaultPath" }, "description": { - "type": "string", - "x-display-name": "Text that describes the instance" + "description": "Text that describes the instance", + "type": "string" }, "device_atlas_options": { "$ref": "#/definitions/device_atlas_options" @@ -31551,9 +31614,9 @@ func init() { "$ref": "#/definitions/fifty_one_degrees_options" }, "force_cfg_parser_pause": { + "description": "Pause the configuration parser to simulate long reloads", "type": "integer", "x-default-unit": "ms", - "x-display-name": "Pause the configuration parser to simulate long reloads", "x-duration": true, "x-nullable": true }, @@ -31562,9 +31625,9 @@ func init() { "x-display-name": "GID" }, "grace": { + "description": "Defines a delay between SIGUSR1 and real soft-stop", "type": "integer", "x-default-unit": "ms", - "x-display-name": "Defines a delay between SIGUSR1 and real soft-stop", "x-duration": true, "x-nullable": true }, @@ -31643,19 +31706,19 @@ func init() { "$ref": "#/definitions/http_client_options" }, "http_err_codes": { + "description": "Replace, reduce or extend the list of status codes that define an error", "type": "array", "items": { "$ref": "#/definitions/http_codes" }, - "x-display-name": "Replace, reduce or extend the list of status codes that define an error", "x-omitempty": true }, "http_fail_codes": { + "description": "Replace, reduce or extend the list of status codes that define a failure", "type": "array", "items": { "$ref": "#/definitions/http_codes" }, - "x-display-name": "Replace, reduce or extend the list of status codes that define a failure", "x-omitempty": true }, "insecure_fork_wanted": { @@ -31706,8 +31769,8 @@ func init() { } }, "mworker_max_reloads": { + "description": "The number of times a worker can survive a reload", "type": "integer", - "x-display-name": "The number of times a worker can survive a reload", "x-nullable": true }, "nbthread": { @@ -31715,8 +31778,9 @@ func init() { "x-display-name": "Number of Threads" }, "no_quic": { + "description": "Disable the use of the QUIC protocol", "type": "boolean", - "x-display-name": "Disable the use of the QUIC protocol" + "x-display-name": "Disable QUIC" }, "node": { "type": "string" @@ -31834,13 +31898,13 @@ func init() { "x-omitempty": true }, "shm_stats_file": { + "description": "Shared Memory Statistics File (EXPERIMENTAL)", "type": "string", - "pattern": "^[^\\s]+$", - "x-display-name": "Shared Memory Statistics File (EXPERIMENTAL)" + "pattern": "^[^\\s]+$" }, "shm_stats_file_max_objects": { + "description": "Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)", "type": "integer", - "x-display-name": "Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)", "x-nullable": true }, "ssl_options": { @@ -31925,10 +31989,10 @@ func init() { "x-display-name": "User" }, "warn_blocked_traffic_after": { + "description": "Delay after which a stuck task triggers a warning", "type": "integer", "minimum": 1, "x-default-unit": "ms", - "x-display-name": "Delay after which a stuck task triggers a warning", "x-duration": true, "x-nullable": true }, @@ -31953,7 +32017,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "users": { @@ -34864,7 +34928,7 @@ func init() { } }, "log_forward": { - "description": "LogForward with all it's children resources", + "description": "LogForward with all its children resources", "type": "object", "allOf": [ { @@ -35303,7 +35367,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_]+$", + "pattern": "^[A-Za-z0-9-_${}\"]+$", "x-nullable": false }, "port": { @@ -35315,7 +35379,7 @@ func init() { } }, "mailers_section": { - "description": "MailersSection with all it's children resources", + "description": "MailersSection with all its children resources", "type": "object", "allOf": [ { @@ -35353,9 +35417,9 @@ func init() { "x-nullable": false }, "timeout": { + "description": "Timeout to send an email in milliseconds", "type": "integer", "x-default-unit": "ms", - "x-display-name": "Timeout to send an email in milliseconds", "x-duration": true, "x-nullable": true } @@ -35491,7 +35555,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "port": { @@ -36327,7 +36391,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "port": { @@ -36342,7 +36406,7 @@ func init() { } }, "peer_section": { - "description": "Peer Section with all it's children resources", + "description": "Peer Section with all its children resources", "type": "object", "allOf": [ { @@ -36431,6 +36495,10 @@ func init() { "busy_polling": { "type": "boolean" }, + "fd_hard_limit": { + "type": "integer", + "x-nullable": true + }, "max_spread_checks": { "type": "integer", "x-default-unit": "ms", @@ -36442,77 +36510,77 @@ func init() { "x-display-name": "Maximum HAProxy CPU usage" }, "maxcomprate": { - "type": "integer", - "x-display-name": "Maximum per-process input compression rate" + "description": "Maximum per-process input compression rate", + "type": "integer" }, "maxconn": { "type": "integer", "x-display-name": "Max Connections" }, "maxconnrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of concurrent connections" + "description": "Maximum per-process number of concurrent connections", + "type": "integer" }, "maxpipes": { "type": "integer", "x-display-name": "Maximum per-process number of pipes" }, "maxsessrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of sessions per second" + "description": "Maximum per-process number of sessions per second", + "type": "integer" }, "maxzlibmem": { - "type": "integer", - "x-display-name": "Maximum amount of RAM in megabytes per process usable by the zlib" + "description": "Maximum amount of RAM in megabytes per process usable by the zlib", + "type": "integer" }, "noepoll": { - "type": "boolean", - "x-display-name": "Disable the use of the \"epoll\" event polling system on Linux" + "description": "Disable the use of the \"epoll\" event polling system on Linux", + "type": "boolean" }, "noevports": { - "type": "boolean", - "x-display-name": "Disable the use of the event ports event polling system on SunOS system derived from Solaris 10 and later" + "description": "Disable the use of the event ports event polling system on SunOS system derived from Solaris 10 and later", + "type": "boolean" }, "nogetaddrinfo": { - "type": "boolean", - "x-display-name": "Disable the use of getaddrinfo for name resolving" + "description": "Disable the use of getaddrinfo for name resolving", + "type": "boolean" }, "nokqueue": { - "type": "boolean", - "x-display-name": "Disable the use of the \"kqueue\" event polling system on BSD" + "description": "Disable the use of the \"kqueue\" event polling system on BSD", + "type": "boolean" }, "noktls": { - "type": "boolean", - "x-display-name": "Disables the use of ktls. It is equivalent to the command line argument \"-dT\"" + "description": "Disables the use of ktls. It is equivalent to the command line argument \"-dT\"", + "type": "boolean" }, "nopoll": { - "type": "boolean", - "x-display-name": "Disable the use of the \"poll\" event polling system" + "description": "Disable the use of the \"poll\" event polling system", + "type": "boolean" }, "noreuseport": { "type": "boolean", "x-display-name": "Disable the use of SO_REUSEPORT" }, "nosplice": { - "type": "boolean", - "x-display-name": "Disable the use of kernel tcp splicing between sockets on Linux" + "description": "Disable the use of kernel tcp splicing between sockets on Linux", + "type": "boolean" }, "profiling_memory": { + "description": "Enable or disables per-function memory profiling", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enable or disables per-function memory profiling" + ] }, "profiling_tasks": { + "description": "Enable or disables per-task CPU profiling", "type": "string", "enum": [ "auto", "enabled", "disabled" - ], - "x-display-name": "Enable or disables per-task CPU profiling" + ] }, "server_state_base": { "type": "string", @@ -36525,8 +36593,8 @@ func init() { "x-display-name": "Server State File" }, "spread_checks": { - "type": "integer", - "x-display-name": "Add some randomness in the check interval" + "description": "Add some randomness in the check interval", + "type": "integer" }, "thread_hard_limit": { "type": "integer", @@ -37008,7 +37076,7 @@ func init() { } }, "resolver": { - "description": "Resolver with all it's children resources", + "description": "Resolver with all its children resources", "type": "object", "allOf": [ { @@ -37132,7 +37200,7 @@ func init() { "x-go-name": "ReturnHeader" }, "ring": { - "description": "Ring with all it's children resources", + "description": "Ring with all its children resources", "type": "object", "allOf": [ { @@ -37160,10 +37228,11 @@ func init() { ], "properties": { "description": { - "type": "string", - "x-display-name": "The description is an optional description string of the ring" + "description": "The description is an optional description string of the ring", + "type": "string" }, "format": { + "description": "Format used to store events into the ring buffer", "type": "string", "enum": [ "iso", @@ -37174,12 +37243,11 @@ func init() { "short", "priority", "timed" - ], - "x-display-name": "Format used to store events into the ring buffer" + ] }, "maxlen": { + "description": "The maximum length of an event message stored into the ring", "type": "integer", - "x-display-name": "The maximum length of an event message stored into the ring", "x-nullable": true }, "metadata": { @@ -37193,8 +37261,8 @@ func init() { "x-nullable": false }, "size": { + "description": "Optional size in bytes for the ring-buffer", "type": "integer", - "x-display-name": "Optional size in bytes for the ring-buffer", "x-nullable": true, "x-size": true }, @@ -37730,8 +37798,7 @@ func init() { "address": { "type": "string", "pattern": "^[^\\s]+$", - "x-nullable": false, - "readOnly": true + "x-nullable": false }, "admin_state": { "type": "string", @@ -37741,10 +37808,88 @@ func init() { "drain" ] }, + "agent_addr": { + "type": "string", + "readOnly": true + }, + "agent_port": { + "type": "integer", + "maximum": 65535, + "x-nullable": true, + "readOnly": true + }, + "agent_state": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_forced_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_name": { + "type": "string", + "readOnly": true + }, + "check_addr": { + "type": "string", + "readOnly": true + }, + "check_health": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_port": { + "type": "integer", + "maximum": 65535, + "x-nullable": true, + "readOnly": true + }, + "check_result": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_state": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_status": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "forced_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "fqdn": { + "type": "string", + "readOnly": true + }, "id": { "type": "string", "readOnly": true }, + "iweight": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "last_time_change": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, "name": { "type": "string", "readOnly": true @@ -37761,8 +37906,24 @@ func init() { "type": "integer", "maximum": 65535, "minimum": 1, + "x-nullable": true + }, + "srvrecord": { + "type": "string", + "readOnly": true + }, + "use_ssl": { + "type": "boolean", + "readOnly": true + }, + "uweight": { + "type": "integer", "x-nullable": true, "readOnly": true + }, + "weight": { + "type": "integer", + "x-nullable": true } }, "example": { @@ -38615,7 +38776,7 @@ func init() { "additionalProperties": false, "example": { "cond": "if", - "cond_test": "{ req_ssl_sni -i www.example.com }", + "cond_test": "{ req.ssl_sni -i www.example.com }", "target_server": "www" } }, @@ -39223,21 +39384,26 @@ func init() { "title": "SSL File", "properties": { "algorithm": { - "type": "string" + "type": "string", + "readOnly": true }, "authority_key_id": { - "type": "string" + "type": "string", + "readOnly": true }, "chain_issuer": { "type": "string", - "x-omitempty": true + "x-omitempty": true, + "readOnly": true }, "chain_subject": { "type": "string", - "x-omitempty": true + "x-omitempty": true, + "readOnly": true }, "description": { - "type": "string" + "type": "string", + "readOnly": true }, "domains": { "type": "string", @@ -39245,7 +39411,8 @@ func init() { "readOnly": true }, "file": { - "type": "string" + "type": "string", + "readOnly": true }, "ip_addresses": { "type": "string", @@ -39275,10 +39442,12 @@ func init() { "type": "string" }, "sha1_finger_print": { - "type": "string" + "type": "string", + "readOnly": true }, "sha256_finger_print": { - "type": "string" + "type": "string", + "readOnly": true }, "size": { "description": "File size in bytes.", @@ -39293,16 +39462,20 @@ func init() { "readOnly": true }, "storage_name": { - "type": "string" + "type": "string", + "readOnly": true }, "subject": { - "type": "string" + "type": "string", + "readOnly": true }, "subject_alternative_names": { - "type": "string" + "type": "string", + "readOnly": true }, "subject_key_id": { - "type": "string" + "type": "string", + "readOnly": true } } }, @@ -39812,12 +39985,12 @@ func init() { "x-display-name": "SSL Load Extra Files" }, "maxsslconn": { - "type": "integer", - "x-display-name": "Maximum per-process number of concurrent SSL connections" + "description": "Maximum per-process number of concurrent SSL connections", + "type": "integer" }, "maxsslrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of SSL sessions per second" + "description": "Maximum per-process number of SSL sessions per second", + "type": "integer" }, "mode_async": { "type": "string", @@ -41970,9 +42143,9 @@ func init() { "x-size": true }, "bufsize_small": { + "description": "Size of small buffers (for memory-restrained situations)", "type": "integer", "minimum": 1, - "x-display-name": "Size of small buffers (for memory-restrained situations)", "x-nullable": true, "x-size": true }, @@ -42106,12 +42279,12 @@ func init() { "type": "object", "properties": { "applet_zero_copy_forwarding": { + "description": "Enables of disabled the zero-copy forwarding of data for the applets", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enables of disabled the zero-copy forwarding of data for the applets" + ] }, "comp_maxlevel": { "type": "integer", @@ -42161,61 +42334,61 @@ func init() { "x-nullable": true }, "h1_zero_copy_fwd_recv": { + "description": "enable or disable the zero-copy receives of data for the HTTP/1 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy receives of data for the HTTP/1 multiplexer" + ] }, "h1_zero_copy_fwd_send": { + "description": "enable or disable the zero-copy sends of data for the HTTP/1 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy sends of data for the HTTP/1 multiplexer" + ] }, "h2_be_glitches_threshold": { + "description": "Automatically kill a backend connection past a number of glitches", "type": "integer", - "x-display-name": "Automatically kill a backend connection past a number of glitches", "x-nullable": true }, "h2_be_initial_window_size": { - "type": "integer", - "x-display-name": "Initial window size for outgoing connections" + "description": "Initial window size for outgoing connections", + "type": "integer" }, "h2_be_max_concurrent_streams": { - "type": "integer", - "x-display-name": "Maximum number of concurrent streams per outgoing connection" + "description": "Maximum number of concurrent streams per outgoing connection", + "type": "integer" }, "h2_be_rxbuf": { + "description": "HTTP/2 receive buffer size for outgoing connections", "type": "integer", - "x-display-name": "HTTP/2 receive buffer size for outgoing connections", "x-nullable": true, "x-size": true }, "h2_fe_glitches_threshold": { + "description": "Automatically kill a frontend connection past a number of glitches", "type": "integer", - "x-display-name": "Automatically kill a frontend connection past a number of glitches", "x-nullable": true }, "h2_fe_initial_window_size": { - "type": "integer", - "x-display-name": "Initial window size for incoming connections" + "description": "Initial window size for incoming connections", + "type": "integer" }, "h2_fe_max_concurrent_streams": { - "type": "integer", - "x-display-name": "Maximum number of concurrent streams per incoming connection" + "description": "Maximum number of concurrent streams per incoming connection", + "type": "integer" }, "h2_fe_max_total_streams": { + "description": "Maximum number of total streams processed per incoming HTTP/2 connection", "type": "integer", - "x-display-name": "Maximum number of total streams processed per incoming HTTP/2 connection", "x-nullable": true }, "h2_fe_rxbuf": { + "description": "HTTP/2 receive buffer size for incoming connections", "type": "integer", - "x-display-name": "HTTP/2 receive buffer size for incoming connections", "x-nullable": true, "x-size": true }, @@ -42238,12 +42411,12 @@ func init() { "x-display-name": "HTTP/2 Maximum Frame Size" }, "h2_zero_copy_fwd_send": { + "description": "enable or disable the zero-copy sends of data for the HTTP/2 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy sends of data for the HTTP/2 multiplexer" + ] }, "http_cookielen": { "type": "integer", @@ -42337,8 +42510,8 @@ func init() { "x-nullable": true }, "peers_max_updates_at_once": { - "type": "integer", - "x-display-name": "Maximum number of stick-table updates at once" + "description": "Maximum number of stick-table updates at once", + "type": "integer" }, "pool_high_fd_ratio": { "type": "integer", @@ -42349,30 +42522,30 @@ func init() { "x-display-name": "Max Used Low FD Ratio" }, "pt_zero_copy_forwarding": { + "description": "enable or disable the zero-copy forwarding of data for the pass-through multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy forwarding of data for the pass-through multiplexer" + ] }, "renice_runtime": { + "description": "Scheduling priority applied after the configuration parsing", "type": "integer", "maximum": 19, "minimum": -20, - "x-display-name": "Scheduling priority applied after the configuration parsing", "x-nullable": true }, "renice_startup": { + "description": "Scheduling priority applied before the rest of the configuration", "type": "integer", "maximum": 19, "minimum": -20, - "x-display-name": "Scheduling priority applied before the rest of the configuration", "x-nullable": true }, "ring_queues": { + "description": "Number of write queues in front of ring buffers", "type": "integer", - "x-display-name": "Number of write queues in front of ring buffers", "x-nullable": true }, "runqueue_depth": { @@ -42435,9 +42608,9 @@ func init() { "x-nullable": true }, "reorder_ratio": { + "description": "Ratio applied to the packet reordering threshold", "type": "integer", "maximum": 100, - "x-display-name": "Ratio applied to the packet reordering threshold", "x-nullable": true }, "retry_threshold": { @@ -42454,12 +42627,12 @@ func init() { "x-display-name": "QUIC Socket Owner" }, "zero_copy_fwd_send": { + "description": "Enables or disables the zero-copy sends for the QUIC multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enables or disables the zero-copy sends for the QUIC multiplexer" + ] } } }, @@ -42510,13 +42683,13 @@ func init() { "x-size": false }, "ocsp_update_max_delay": { + "description": "SSL Maximum Interval Between Two Automatic Updates of the same OCSP Response", "type": "integer", - "x-display-name": "SSL Maximum Interval Between Two Automatic Updates of the same OCSP Response", "x-nullable": true }, "ocsp_update_min_delay": { + "description": "SSL Minimum Interval Between Two Automatic Updates of the same OCSP Response", "type": "integer", - "x-display-name": "SSL Minimum Interval Between Two Automatic Updates of the same OCSP Response", "x-nullable": true } } @@ -42601,13 +42774,13 @@ func init() { }, "username": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false } } }, "userlist": { - "description": "Userlist with all it's children resources", + "description": "Userlist with all its children resources", "type": "object", "allOf": [ { @@ -42671,24 +42844,24 @@ func init() { "type": "object", "properties": { "cache_size": { - "type": "integer", - "x-display-name": "Sets the WURFL Useragent cache size" + "description": "Sets the WURFL Useragent cache size", + "type": "integer" }, "data_file": { - "type": "string", - "x-display-name": "The path of the WURFL data file" + "description": "The path of the WURFL data file", + "type": "string" }, "information_list": { - "type": "string", - "x-display-name": "A space-delimited list of WURFL capabilities" + "description": "A space-delimited list of WURFL capabilities", + "type": "string" }, "information_list_separator": { - "type": "string", - "x-display-name": "A char that will be used to separate values in a response header containing WURFL results" + "description": "A char that will be used to separate values in a response header containing WURFL results", + "type": "string" }, "patch_file": { - "type": "string", - "x-display-name": "A list of WURFL patch file paths" + "description": "A list of WURFL patch file paths", + "type": "string" } } } @@ -42709,6 +42882,7 @@ func init() { "in": "query" }, "parent_name": { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -44782,6 +44956,7 @@ func init() { "operationId": "getAllAclBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -44838,6 +45013,7 @@ func init() { "operationId": "replaceAllAclBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -44937,6 +45113,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45006,6 +45183,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45115,6 +45293,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45224,6 +45403,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45302,6 +45482,7 @@ func init() { "operationId": "getAllFilterBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45352,6 +45533,7 @@ func init() { "operationId": "replaceAllFilterBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45451,6 +45633,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45520,6 +45703,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45629,6 +45813,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45738,6 +45923,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45816,6 +46002,7 @@ func init() { "operationId": "getAllHTTPAfterResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45866,6 +46053,7 @@ func init() { "operationId": "replaceAllHTTPAfterResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -45965,6 +46153,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46034,6 +46223,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46143,6 +46333,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46252,6 +46443,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46330,6 +46522,7 @@ func init() { "operationId": "getAllHTTPCheckBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46380,6 +46573,7 @@ func init() { "operationId": "replaceAllHTTPCheckBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46479,6 +46673,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46548,6 +46743,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46657,6 +46853,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46766,6 +46963,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46844,6 +47042,7 @@ func init() { "operationId": "getAllHTTPErrorRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46894,6 +47093,7 @@ func init() { "operationId": "replaceAllHTTPErrorRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -46993,6 +47193,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47062,6 +47263,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47171,6 +47373,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47280,6 +47483,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47358,6 +47562,7 @@ func init() { "operationId": "getAllHTTPRequestRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47408,6 +47613,7 @@ func init() { "operationId": "replaceAllHTTPRequestRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47507,6 +47713,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47576,6 +47783,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47685,6 +47893,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47794,6 +48003,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47872,6 +48082,7 @@ func init() { "operationId": "getAllHTTPResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -47922,6 +48133,7 @@ func init() { "operationId": "replaceAllHTTPResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48021,6 +48233,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48090,6 +48303,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48199,6 +48413,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48308,6 +48523,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48386,6 +48602,7 @@ func init() { "operationId": "getAllLogTargetBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48436,6 +48653,7 @@ func init() { "operationId": "replaceAllLogTargetBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48535,6 +48753,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48604,6 +48823,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48713,6 +48933,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48822,6 +49043,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48900,6 +49122,7 @@ func init() { "operationId": "getServerSwitchingRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -48950,6 +49173,7 @@ func init() { "operationId": "replaceServerSwitchingRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49049,6 +49273,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49118,6 +49343,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49227,6 +49453,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49336,6 +49563,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49414,6 +49642,7 @@ func init() { "operationId": "getServerTemplates", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49464,6 +49693,7 @@ func init() { "operationId": "createServerTemplate", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49575,6 +49805,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49644,6 +49875,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49753,6 +49985,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49831,6 +50064,7 @@ func init() { "operationId": "getAllServerBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49881,6 +50115,7 @@ func init() { "operationId": "createServerBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -49992,6 +50227,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50061,6 +50297,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50170,6 +50407,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50248,6 +50486,7 @@ func init() { "operationId": "getStickRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50298,6 +50537,7 @@ func init() { "operationId": "replaceStickRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50397,6 +50637,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50466,6 +50707,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50575,6 +50817,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50684,6 +50927,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50762,6 +51006,7 @@ func init() { "operationId": "getAllTCPCheckBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50812,6 +51057,7 @@ func init() { "operationId": "replaceAllTCPCheckBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50911,6 +51157,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -50980,6 +51227,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51089,6 +51337,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51198,6 +51447,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51276,6 +51526,7 @@ func init() { "operationId": "getAllTCPRequestRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51326,6 +51577,7 @@ func init() { "operationId": "replaceAllTCPRequestRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51425,6 +51677,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51494,6 +51747,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51603,6 +51857,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51712,6 +51967,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51790,6 +52046,7 @@ func init() { "operationId": "getAllTCPResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51840,6 +52097,7 @@ func init() { "operationId": "replaceAllTCPResponseRuleBackend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -51939,6 +52197,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -52008,6 +52267,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -52117,6 +52377,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -52226,6 +52487,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -52676,35 +52938,35 @@ func init() { } } }, - "/services/haproxy/configuration/crt_loads": { + "/services/haproxy/configuration/crt_stores": { "get": { - "description": "Returns the list of loaded certificates from the specified crt_store", + "description": "Returns an array of all the configured crt_store sections in HAProxy", "tags": [ - "CrtLoad" + "CrtStore" ], - "summary": "Return an array of loaded certificates", - "operationId": "getCrtLoads", + "summary": "Return all the Certificate Stores", + "operationId": "getCrtStores", "parameters": [ - { - "type": "string", - "description": "Parent crt_store name", - "name": "crt_store", - "in": "query", - "required": true - }, { "type": "string", "x-nullable": false, "description": "ID of the transaction where we want to add the operation. Cannot be used when version is specified.", "name": "transaction_id", "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "Indicates if the action affects the specified child resources as well", + "name": "full_section", + "in": "query" } ], "responses": { "200": { "description": "Successful operation", "schema": { - "$ref": "#/definitions/crt_loads" + "$ref": "#/definitions/crt_stores" }, "headers": { "Configuration-Version": { @@ -52728,26 +52990,19 @@ func init() { } }, "post": { - "description": "Adds a new load entry to the specified crt_store section in the configuration", + "description": "Creates a new crt_store section", "tags": [ - "CrtLoad" + "CrtStore" ], - "summary": "Add a new certificate to load", - "operationId": "createCrtLoad", + "summary": "Add a new Certificate Store", + "operationId": "createCrtStore", "parameters": [ - { - "type": "string", - "description": "Parent crt_store section name", - "name": "crt_store", - "in": "query", - "required": true - }, { "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/crt_load" + "$ref": "#/definitions/crt_store" } }, { @@ -52770,19 +53025,26 @@ func init() { "description": "If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration.", "name": "force_reload", "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "Indicates if the action affects the specified child resources as well", + "name": "full_section", + "in": "query" } ], "responses": { "201": { - "description": "Certificate load entry created", + "description": "Certificate Store created", "schema": { - "$ref": "#/definitions/crt_load" + "$ref": "#/definitions/crt_store" } }, "202": { "description": "Configuration change accepted and reload requested", "schema": { - "$ref": "#/definitions/crt_load" + "$ref": "#/definitions/crt_store" }, "headers": { "Reload-ID": { @@ -52830,27 +53092,20 @@ func init() { } } }, - "/services/haproxy/configuration/crt_loads/{certificate}": { + "/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads": { "get": { - "description": "Returns one load entry by its certificate name in the specified crt_store", + "description": "Returns the list of loaded certificates from the specified crt_store", "tags": [ "CrtLoad" ], - "summary": "Return one certificate load entry", - "operationId": "getCrtLoad", + "summary": "Return an array of loaded certificates", + "operationId": "getCrtLoads", "parameters": [ - { - "type": "string", - "description": "Certificate filename", - "name": "certificate", - "in": "path", - "required": true - }, { "type": "string", "description": "Parent crt_store name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -52865,19 +53120,7 @@ func init() { "200": { "description": "Successful operation", "schema": { - "$ref": "#/definitions/crt_load" - }, - "headers": { - "Configuration-Version": { - "type": "string", - "description": "Configuration file version" - } - } - }, - "404": { - "description": "The specified resource was not found", - "schema": { - "$ref": "#/definitions/error" + "$ref": "#/definitions/crt_loads" }, "headers": { "Configuration-Version": { @@ -52900,26 +53143,19 @@ func init() { } } }, - "put": { - "description": "Replaces a load entry by its certificate name in the specified crt_store section", + "post": { + "description": "Adds a new load entry to the specified crt_store section in the configuration", "tags": [ "CrtLoad" ], - "summary": "Replace a certificate load entry", - "operationId": "replaceCrtLoad", + "summary": "Add a new certificate to load", + "operationId": "createCrtLoad", "parameters": [ - { - "type": "string", - "description": "Certificate filename", - "name": "certificate", - "in": "path", - "required": true - }, { "type": "string", "description": "Parent crt_store section name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -52953,8 +53189,8 @@ func init() { } ], "responses": { - "200": { - "description": "Certificate load entry replaced", + "201": { + "description": "Certificate load entry created", "schema": { "$ref": "#/definitions/crt_load" } @@ -52983,8 +53219,8 @@ func init() { } } }, - "404": { - "description": "The specified resource was not found", + "409": { + "description": "The specified resource already exists", "schema": { "$ref": "#/definitions/error" }, @@ -53008,14 +53244,16 @@ func init() { } } } - }, - "delete": { - "description": "Deletes a load entry by its certificate name in the specified crt_store section", + } + }, + "/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}": { + "get": { + "description": "Returns one load entry by its certificate name in the specified crt_store", "tags": [ "CrtLoad" ], - "summary": "Delete a certificate load entry", - "operationId": "deleteCrtLoad", + "summary": "Return one certificate load entry", + "operationId": "getCrtLoad", "parameters": [ { "type": "string", @@ -53026,9 +53264,9 @@ func init() { }, { "type": "string", - "description": "Parent crt_store section name", + "description": "Parent crt_store name", "name": "crt_store", - "in": "query", + "in": "path", "required": true }, { @@ -53037,35 +53275,21 @@ func init() { "description": "ID of the transaction where we want to add the operation. Cannot be used when version is specified.", "name": "transaction_id", "in": "query" - }, - { - "type": "integer", - "x-nullable": false, - "description": "Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version.", - "name": "version", - "in": "query" - }, - { - "type": "boolean", - "default": false, - "description": "If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration.", - "name": "force_reload", - "in": "query" } ], "responses": { - "202": { - "description": "Configuration change accepted and reload requested", + "200": { + "description": "Successful operation", + "schema": { + "$ref": "#/definitions/crt_load" + }, "headers": { - "Reload-ID": { + "Configuration-Version": { "type": "string", - "description": "ID of the requested reload" + "description": "Configuration file version" } } }, - "204": { - "description": "Certificate load entry deleted" - }, "404": { "description": "The specified resource was not found", "schema": { @@ -53091,30 +53315,94 @@ func init() { } } } - } - }, - "/services/haproxy/configuration/crt_stores": { - "get": { - "description": "Returns an array of all the configured crt_store sections in HAProxy", + }, + "put": { + "description": "Replaces a load entry by its certificate name in the specified crt_store section", "tags": [ - "CrtStore" + "CrtLoad" ], - "summary": "Return all the Certificate Stores", - "operationId": "getCrtStores", + "summary": "Replace a certificate load entry", + "operationId": "replaceCrtLoad", "parameters": [ + { + "type": "string", + "description": "Certificate filename", + "name": "certificate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Parent crt_store section name", + "name": "crt_store", + "in": "path", + "required": true + }, + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/crt_load" + } + }, { "type": "string", "x-nullable": false, "description": "ID of the transaction where we want to add the operation. Cannot be used when version is specified.", "name": "transaction_id", "in": "query" + }, + { + "type": "integer", + "x-nullable": false, + "description": "Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version.", + "name": "version", + "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration.", + "name": "force_reload", + "in": "query" } ], "responses": { "200": { - "description": "Successful operation", + "description": "Certificate load entry replaced", "schema": { - "$ref": "#/definitions/crt_stores" + "$ref": "#/definitions/crt_load" + } + }, + "202": { + "description": "Configuration change accepted and reload requested", + "schema": { + "$ref": "#/definitions/crt_load" + }, + "headers": { + "Reload-ID": { + "type": "string", + "description": "ID of the requested reload" + } + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/error" + }, + "headers": { + "Configuration-Version": { + "type": "string", + "description": "Configuration file version" + } + } + }, + "404": { + "description": "The specified resource was not found", + "schema": { + "$ref": "#/definitions/error" }, "headers": { "Configuration-Version": { @@ -53137,21 +53425,27 @@ func init() { } } }, - "post": { - "description": "Creates a new crt_store section", + "delete": { + "description": "Deletes a load entry by its certificate name in the specified crt_store section", "tags": [ - "CrtStore" + "CrtLoad" ], - "summary": "Add a new Certificate Store", - "operationId": "createCrtStore", + "summary": "Delete a certificate load entry", + "operationId": "deleteCrtLoad", "parameters": [ { - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/crt_store" - } + "type": "string", + "description": "Certificate filename", + "name": "certificate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Parent crt_store section name", + "name": "crt_store", + "in": "path", + "required": true }, { "type": "string", @@ -53176,17 +53470,8 @@ func init() { } ], "responses": { - "201": { - "description": "Certificate Store created", - "schema": { - "$ref": "#/definitions/crt_store" - } - }, "202": { "description": "Configuration change accepted and reload requested", - "schema": { - "$ref": "#/definitions/crt_store" - }, "headers": { "Reload-ID": { "type": "string", @@ -53194,20 +53479,11 @@ func init() { } } }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/error" - }, - "headers": { - "Configuration-Version": { - "type": "string", - "description": "Configuration file version" - } - } + "204": { + "description": "Certificate load entry deleted" }, - "409": { - "description": "The specified resource already exists", + "404": { + "description": "The specified resource was not found", "schema": { "$ref": "#/definitions/error" }, @@ -53255,6 +53531,13 @@ func init() { "description": "ID of the transaction where we want to add the operation. Cannot be used when version is specified.", "name": "transaction_id", "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "Indicates if the action affects the specified child resources as well", + "name": "full_section", + "in": "query" } ], "responses": { @@ -53339,6 +53622,13 @@ func init() { "description": "If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration.", "name": "force_reload", "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "Indicates if the action affects the specified child resources as well", + "name": "full_section", + "in": "query" } ], "responses": { @@ -53433,6 +53723,13 @@ func init() { "description": "If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration.", "name": "force_reload", "in": "query" + }, + { + "type": "boolean", + "default": false, + "description": "Indicates if the action affects the specified child resources as well", + "name": "full_section", + "in": "query" } ], "responses": { @@ -54005,6 +54302,7 @@ func init() { "operationId": "getAllAclDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54061,6 +54359,7 @@ func init() { "operationId": "replaceAllAclDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54160,6 +54459,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54229,6 +54529,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54338,6 +54639,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54447,6 +54749,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54525,6 +54828,7 @@ func init() { "operationId": "getAllHTTPAfterResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54575,6 +54879,7 @@ func init() { "operationId": "replaceAllHTTPAfterResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54674,6 +54979,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54743,6 +55049,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54852,6 +55159,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -54961,6 +55269,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55039,6 +55348,7 @@ func init() { "operationId": "getAllHTTPCheckDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55089,6 +55399,7 @@ func init() { "operationId": "replaceAllHTTPCheckDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55188,6 +55499,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55257,6 +55569,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55366,6 +55679,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55475,6 +55789,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55553,6 +55868,7 @@ func init() { "operationId": "getAllHTTPErrorRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55603,6 +55919,7 @@ func init() { "operationId": "replaceAllHTTPErrorRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55702,6 +56019,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55771,6 +56089,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55880,6 +56199,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -55989,6 +56309,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56067,6 +56388,7 @@ func init() { "operationId": "getAllHTTPRequestRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56117,6 +56439,7 @@ func init() { "operationId": "replaceAllHTTPRequestRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56216,6 +56539,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56285,6 +56609,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56394,6 +56719,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56503,6 +56829,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56581,6 +56908,7 @@ func init() { "operationId": "getAllHTTPResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56631,6 +56959,7 @@ func init() { "operationId": "replaceAllHTTPResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56730,6 +57059,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56799,6 +57129,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -56908,6 +57239,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57017,6 +57349,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57095,6 +57428,7 @@ func init() { "operationId": "getAllLogTargetDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57145,6 +57479,7 @@ func init() { "operationId": "replaceAllLogTargetDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57244,6 +57579,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57313,6 +57649,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57422,6 +57759,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57531,6 +57869,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57609,6 +57948,7 @@ func init() { "operationId": "getAllQUICInitialRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57659,6 +57999,7 @@ func init() { "operationId": "replaceAllQUICInitialRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57758,6 +58099,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57827,6 +58169,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -57936,6 +58279,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58045,6 +58389,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58123,6 +58468,7 @@ func init() { "operationId": "getAllTCPCheckDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58173,6 +58519,7 @@ func init() { "operationId": "replaceAllTCPCheckDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58272,6 +58619,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58341,6 +58689,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58450,6 +58799,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58559,6 +58909,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58637,6 +58988,7 @@ func init() { "operationId": "getAllTCPRequestRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58687,6 +59039,7 @@ func init() { "operationId": "replaceAllTCPRequestRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58786,6 +59139,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58855,6 +59209,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -58964,6 +59319,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59073,6 +59429,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59151,6 +59508,7 @@ func init() { "operationId": "getAllTCPResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59201,6 +59559,7 @@ func init() { "operationId": "replaceAllTCPResponseRuleDefaults", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59300,6 +59659,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59369,6 +59729,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59478,6 +59839,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -59587,6 +59949,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60075,6 +60438,7 @@ func init() { "operationId": "getAllAclFCGIApp", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60131,6 +60495,7 @@ func init() { "operationId": "replaceAllAclFCGIApp", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60230,6 +60595,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60299,6 +60665,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60408,6 +60775,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -60517,6 +60885,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61005,6 +61374,7 @@ func init() { "operationId": "getAllAclFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61061,6 +61431,7 @@ func init() { "operationId": "replaceAllAclFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61160,6 +61531,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61229,6 +61601,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61338,6 +61711,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61447,6 +61821,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61525,6 +61900,7 @@ func init() { "operationId": "getBackendSwitchingRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61575,6 +61951,7 @@ func init() { "operationId": "replaceBackendSwitchingRules", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61674,6 +62051,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61743,6 +62121,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61852,6 +62231,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -61961,6 +62341,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62039,6 +62420,7 @@ func init() { "operationId": "getAllBindFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62089,6 +62471,7 @@ func init() { "operationId": "createBindFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62200,6 +62583,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62269,6 +62653,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62378,6 +62763,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62456,6 +62842,7 @@ func init() { "operationId": "getDeclareCaptures", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62506,6 +62893,7 @@ func init() { "operationId": "replaceDeclareCaptures", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62605,6 +62993,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62674,6 +63063,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62783,6 +63173,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62892,6 +63283,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -62970,6 +63362,7 @@ func init() { "operationId": "getAllFilterFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63020,6 +63413,7 @@ func init() { "operationId": "replaceAllFilterFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63119,6 +63513,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63188,6 +63583,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63297,6 +63693,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63406,6 +63803,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63484,6 +63882,7 @@ func init() { "operationId": "getAllHTTPAfterResponseRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63534,6 +63933,7 @@ func init() { "operationId": "replaceAllHTTPAfterResponseRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63633,6 +64033,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63702,6 +64103,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63811,6 +64213,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63920,6 +64323,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -63998,6 +64402,7 @@ func init() { "operationId": "getAllHTTPErrorRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64048,6 +64453,7 @@ func init() { "operationId": "replaceAllHTTPErrorRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64147,6 +64553,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64216,6 +64623,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64325,6 +64733,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64434,6 +64843,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64512,6 +64922,7 @@ func init() { "operationId": "getAllHTTPRequestRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64562,6 +64973,7 @@ func init() { "operationId": "replaceAllHTTPRequestRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64661,6 +65073,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64730,6 +65143,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64839,6 +65253,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -64948,6 +65363,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65026,6 +65442,7 @@ func init() { "operationId": "getAllHTTPResponseRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65076,6 +65493,7 @@ func init() { "operationId": "replaceAllHTTPResponseRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65175,6 +65593,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65244,6 +65663,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65353,6 +65773,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65462,6 +65883,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65540,6 +65962,7 @@ func init() { "operationId": "getAllLogTargetFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65590,6 +66013,7 @@ func init() { "operationId": "replaceAllLogTargetFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65689,6 +66113,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65758,6 +66183,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65867,6 +66293,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -65976,6 +66403,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66054,6 +66482,7 @@ func init() { "operationId": "getAllQUICInitialRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66104,6 +66533,7 @@ func init() { "operationId": "replaceAllQUICInitialRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66203,6 +66633,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66272,6 +66703,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66381,6 +66813,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66490,6 +66923,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66568,6 +67002,7 @@ func init() { "operationId": "getAllSSLFrontUses", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66618,6 +67053,7 @@ func init() { "operationId": "createSSLFrontUse", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66729,6 +67165,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66798,6 +67235,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66907,6 +67345,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -66985,6 +67424,7 @@ func init() { "operationId": "getAllTCPRequestRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -67035,6 +67475,7 @@ func init() { "operationId": "replaceAllTCPRequestRuleFrontend", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -67134,6 +67575,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -67203,6 +67645,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -67312,6 +67755,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -67421,6 +67865,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69317,6 +69762,7 @@ func init() { "operationId": "getAllBindLogForward", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69367,6 +69813,7 @@ func init() { "operationId": "createBindLogForward", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69478,6 +69925,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69547,6 +69995,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69656,6 +70105,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69734,6 +70184,7 @@ func init() { "operationId": "getDgramBinds", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69784,6 +70235,7 @@ func init() { "operationId": "createDgramBind", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69895,6 +70347,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -69964,6 +70417,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70073,6 +70527,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70151,6 +70606,7 @@ func init() { "operationId": "getAllLogTargetLogForward", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70201,6 +70657,7 @@ func init() { "operationId": "replaceAllLogTargetLogForward", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70300,6 +70757,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70369,6 +70827,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70478,6 +70937,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -70587,6 +71047,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73019,6 +73480,7 @@ func init() { "operationId": "getAllBindPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73069,6 +73531,7 @@ func init() { "operationId": "createBindPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73180,6 +73643,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73249,6 +73713,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73358,6 +73823,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73436,6 +73902,7 @@ func init() { "operationId": "getAllLogTargetPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73486,6 +73953,7 @@ func init() { "operationId": "replaceAllLogTargetPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73585,6 +74053,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73654,6 +74123,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73763,6 +74233,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73872,6 +74343,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -73950,6 +74422,7 @@ func init() { "operationId": "getAllServerPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74000,6 +74473,7 @@ func init() { "operationId": "createServerPeer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74111,6 +74585,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74180,6 +74655,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74289,6 +74765,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74367,6 +74844,7 @@ func init() { "operationId": "getTables", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74417,6 +74895,7 @@ func init() { "operationId": "createTable", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74528,6 +75007,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74597,6 +75077,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -74706,6 +75187,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -76189,6 +76671,7 @@ func init() { "operationId": "getAllServerRing", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -76239,6 +76722,7 @@ func init() { "operationId": "createServerRing", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -76350,6 +76834,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -76419,6 +76904,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -76528,6 +77014,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78026,6 +78513,7 @@ func init() { "summary": "Return an ACL file", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "ACL file entry ID", "name": "id", @@ -78079,6 +78567,7 @@ func init() { "summary": "Return an ACL entries", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78140,6 +78629,7 @@ func init() { "operationId": "addPayloadRuntimeACL", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78199,6 +78689,7 @@ func init() { "summary": "Add entry to an ACL file", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78272,6 +78763,7 @@ func init() { "summary": "Return an ACL entry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78279,6 +78771,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "File entry ID", "name": "id", @@ -78342,6 +78835,7 @@ func init() { "summary": "Delete an ACL entry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78349,6 +78843,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "File entry ID", "name": "id", @@ -78449,6 +78944,7 @@ func init() { "operationId": "renewAcmeCertificate", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Certificate file name", "name": "certificate", @@ -78497,6 +78993,7 @@ func init() { "operationId": "getAllRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78534,6 +79031,7 @@ func init() { "operationId": "addRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78617,6 +79115,7 @@ func init() { "operationId": "getRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -78624,6 +79123,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78673,6 +79173,7 @@ func init() { "operationId": "replaceRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -78680,6 +79181,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78749,6 +79251,7 @@ func init() { "operationId": "deleteRuntimeServer", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Server name", "name": "name", @@ -78756,6 +79259,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -78900,6 +79404,7 @@ func init() { "operationId": "getOneRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -78949,6 +79454,7 @@ func init() { "operationId": "addPayloadRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -79013,6 +79519,7 @@ func init() { "operationId": "clearRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map file name", "name": "name", @@ -79074,6 +79581,7 @@ func init() { "operationId": "showRuntimeMap", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -79123,6 +79631,7 @@ func init() { "operationId": "addMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -79201,6 +79710,7 @@ func init() { "operationId": "getRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -79208,6 +79718,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -79257,6 +79768,7 @@ func init() { "operationId": "replaceRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -79264,6 +79776,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -79349,6 +79862,7 @@ func init() { "operationId": "deleteRuntimeMapEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Map id", "name": "id", @@ -79356,6 +79870,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -79512,6 +80027,7 @@ func init() { "operationId": "getCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -79564,6 +80080,7 @@ func init() { "operationId": "setCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -79617,6 +80134,7 @@ func init() { "operationId": "deleteCaFile", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -79671,6 +80189,7 @@ func init() { "operationId": "addCaEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -79733,6 +80252,7 @@ func init() { "operationId": "getCaEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL CA file name", "name": "name", @@ -79893,6 +80413,7 @@ func init() { "operationId": "getCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -79933,6 +80454,7 @@ func init() { "operationId": "replaceCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -79986,6 +80508,7 @@ func init() { "operationId": "deleteCert", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL certificate name", "name": "name", @@ -80135,6 +80658,7 @@ func init() { "operationId": "getCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -80195,6 +80719,7 @@ func init() { "operationId": "replaceCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -80249,6 +80774,7 @@ func init() { "operationId": "deleteCrl", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "CRL file name", "name": "name", @@ -80333,6 +80859,7 @@ func init() { "operationId": "getAllCrtListEntries", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt-list filename", "name": "name", @@ -80373,6 +80900,7 @@ func init() { "operationId": "addCrtListEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt-list filename", "name": "name", @@ -80439,6 +80967,7 @@ func init() { "operationId": "deleteCrtListEntry", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL crt list name", "name": "name", @@ -80446,6 +80975,7 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "SSL cert entry name", "name": "cert_file", @@ -80544,6 +81074,7 @@ func init() { "operationId": "getStickTable", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Stick table name", "name": "name", @@ -80595,6 +81126,7 @@ func init() { "operationId": "getStickTableEntries", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -80602,12 +81134,14 @@ func init() { "required": true }, { + "pattern": "^[^\\r\\n;#]+$", "type": "string", "description": "A list of filters in format data.\u003ctype\u003e \u003coperator\u003e \u003cvalue\u003e separated by comma", "name": "filter", "in": "query" }, { + "pattern": "^[^\\r\\n;#]+$", "type": "string", "description": "Key which we want the entries for", "name": "key", @@ -80656,6 +81190,7 @@ func init() { "operationId": "setStickTableEntries", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -80677,7 +81212,8 @@ func init() { "$ref": "#/definitions/stick_table_entry" }, "key": { - "type": "string" + "type": "string", + "pattern": "^[^\\r\\n;#]+$" } } } @@ -81341,6 +81877,7 @@ func init() { "operationId": "getAllSpoeScope", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81391,6 +81928,7 @@ func init() { "operationId": "createSpoeScope", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81476,6 +82014,7 @@ func init() { "operationId": "getSpoeScope", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81545,6 +82084,7 @@ func init() { "operationId": "deleteSpoeScope", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81614,6 +82154,7 @@ func init() { "operationId": "getAllSpoeAgent", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81671,6 +82212,7 @@ func init() { "operationId": "createSpoeAgent", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81763,6 +82305,7 @@ func init() { "operationId": "getSpoeAgent", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81839,6 +82382,7 @@ func init() { "operationId": "replaceSpoeAgent", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -81936,6 +82480,7 @@ func init() { "operationId": "deleteSpoeAgent", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82012,6 +82557,7 @@ func init() { "operationId": "getAllSpoeGroup", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82069,6 +82615,7 @@ func init() { "operationId": "createSpoeGroup", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82161,6 +82708,7 @@ func init() { "operationId": "getSpoeGroup", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82237,6 +82785,7 @@ func init() { "operationId": "replaceSpoeGroup", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82334,6 +82883,7 @@ func init() { "operationId": "deleteSpoeGroup", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82410,6 +82960,7 @@ func init() { "operationId": "getAllSpoeMessage", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82467,6 +83018,7 @@ func init() { "operationId": "createSpoeMessage", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82559,6 +83111,7 @@ func init() { "operationId": "getSpoeMessage", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82635,6 +83188,7 @@ func init() { "operationId": "replaceSpoeMessage", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82732,6 +83286,7 @@ func init() { "operationId": "deleteSpoeMessage", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82811,6 +83366,7 @@ func init() { "operationId": "getAllSpoeTransaction", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82861,6 +83417,7 @@ func init() { "operationId": "startSpoeTransaction", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82925,6 +83482,7 @@ func init() { "operationId": "getSpoeTransaction", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -82981,6 +83539,7 @@ func init() { "operationId": "commitSpoeTransaction", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -83068,6 +83627,7 @@ func init() { "operationId": "deleteSpoeTransaction", "parameters": [ { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -83130,6 +83690,7 @@ func init() { "in": "query" }, { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", @@ -86314,9 +86875,8 @@ func init() { } }, "bits": { - "description": "Number of bits to generate an RSA certificate", + "description": "Number of bits used when generating an RSA certificate. Ignored when keytype is ECDSA (curves is used instead).", "type": "integer", - "minimum": 1024, "x-nullable": true, "x-omitempty": true }, @@ -86524,7 +87084,7 @@ func init() { } }, "backend": { - "description": "Backend with all it's children resources", + "description": "Backend with all its children resources", "type": "object", "allOf": [ { @@ -86971,8 +87531,8 @@ func init() { } }, "http_send_name_header": { + "description": "The header string to use to send the server name", "type": "string", - "x-display-name": "The header string to use to send the server name", "x-nullable": true }, "httpchk_params": { @@ -87356,7 +87916,7 @@ func init() { "additionalProperties": false, "example": { "cond": "if", - "cond_test": "{ req_ssl_sni -i www.example.com }", + "cond_test": "{ req.ssl_sni -i www.example.com }", "index": 0, "name": "test_backend" } @@ -88706,6 +89266,26 @@ func init() { "x-omitempty": true }, "crt_store": { + "description": "Storage mechanism to load and store certificates used in the configuration", + "title": "Certificate Store", + "allOf": [ + { + "$ref": "#/definitions/crt_store_base" + }, + { + "type": "object", + "properties": { + "crt_loads": { + "additionalProperties": { + "$ref": "#/definitions/crt_load" + } + } + } + } + ], + "x-go-name": "CrtStore" + }, + "crt_store_base": { "description": "Storage mechanism to load and store certificates used in the configuration", "type": "object", "title": "Certificate Store", @@ -88721,9 +89301,6 @@ func init() { "description": "Default directory to fetch SSL private keys from", "type": "string" }, - "loads": { - "$ref": "#/definitions/crt_loads" - }, "metadata": { "additionalProperties": { "type": "object" @@ -88800,7 +89377,7 @@ func init() { ] }, "defaults": { - "description": "Defaults with all it's children resources", + "description": "Defaults with all its children resources", "type": "object", "allOf": [ { @@ -89243,8 +89820,8 @@ func init() { ] }, "http_send_name_header": { + "description": "Add the server name to a request", "type": "string", - "x-display-name": "Add the server name to a request", "x-nullable": true }, "http_use_proxy_header": { @@ -89351,8 +89928,8 @@ func init() { "x-display-name": "Log ASAP" }, "max_keep_alive_queue": { + "description": "Maximum server queue size for maintaining keep-alive connections", "type": "integer", - "x-display-name": "Maximum server queue size for maintaining keep-alive connections", "x-nullable": true }, "maxconn": { @@ -89442,8 +90019,8 @@ func init() { "x-nullable": true }, "retry_on": { - "type": "string", - "x-display-name": "Specify when to attempt to automatically retry a failed request" + "description": "Specify when to attempt to automatically retry a failed request", + "type": "string" }, "server_fin_timeout": { "type": "integer", @@ -89771,8 +90348,8 @@ func init() { "x-omitempty": true }, "resetenv": { - "type": "string", - "x-display-name": "Remove all environment variables except the ones specified" + "description": "Remove all environment variables except the ones specified", + "type": "string" }, "setenv": { "type": "array", @@ -89784,8 +90361,8 @@ func init() { "x-omitempty": true }, "unsetenv": { - "type": "string", - "x-display-name": "Removes environment variables specified in arguments" + "description": "Removes environment variables specified in arguments", + "type": "string" } } }, @@ -89921,7 +90498,7 @@ func init() { } }, "fcgi_app": { - "description": "App with all it's children resources", + "description": "App with all its children resources", "type": "object", "allOf": [ { @@ -90419,7 +90996,7 @@ func init() { "x-display-name": "ForwardFor" }, "frontend": { - "description": "Frontend with all it's children resources", + "description": "Frontend with all its children resources", "type": "object", "allOf": [ { @@ -90849,7 +91426,7 @@ func init() { }, "log_tag": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$" + "pattern": "^[A-Za-z0-9-_.:${}\"]+$" }, "logasap": { "type": "string", @@ -91032,7 +91609,7 @@ func init() { } }, "global": { - "description": "Frontend with all it's children resources", + "description": "Frontend with all its children resources", "type": "object", "allOf": [ { @@ -91143,8 +91720,8 @@ func init() { "x-go-name": "GlobalDefaultPath" }, "description": { - "type": "string", - "x-display-name": "Text that describes the instance" + "description": "Text that describes the instance", + "type": "string" }, "device_atlas_options": { "$ref": "#/definitions/device_atlas_options" @@ -91171,10 +91748,10 @@ func init() { "$ref": "#/definitions/fifty_one_degrees_options" }, "force_cfg_parser_pause": { + "description": "Pause the configuration parser to simulate long reloads", "type": "integer", "minimum": 0, "x-default-unit": "ms", - "x-display-name": "Pause the configuration parser to simulate long reloads", "x-duration": true, "x-nullable": true }, @@ -91183,10 +91760,10 @@ func init() { "x-display-name": "GID" }, "grace": { + "description": "Defines a delay between SIGUSR1 and real soft-stop", "type": "integer", "minimum": 0, "x-default-unit": "ms", - "x-display-name": "Defines a delay between SIGUSR1 and real soft-stop", "x-duration": true, "x-nullable": true }, @@ -91253,19 +91830,19 @@ func init() { "$ref": "#/definitions/http_client_options" }, "http_err_codes": { + "description": "Replace, reduce or extend the list of status codes that define an error", "type": "array", "items": { "$ref": "#/definitions/http_codes" }, - "x-display-name": "Replace, reduce or extend the list of status codes that define an error", "x-omitempty": true }, "http_fail_codes": { + "description": "Replace, reduce or extend the list of status codes that define a failure", "type": "array", "items": { "$ref": "#/definitions/http_codes" }, - "x-display-name": "Replace, reduce or extend the list of status codes that define a failure", "x-omitempty": true }, "insecure_fork_wanted": { @@ -91316,9 +91893,9 @@ func init() { } }, "mworker_max_reloads": { + "description": "The number of times a worker can survive a reload", "type": "integer", "minimum": 0, - "x-display-name": "The number of times a worker can survive a reload", "x-nullable": true }, "nbthread": { @@ -91326,8 +91903,9 @@ func init() { "x-display-name": "Number of Threads" }, "no_quic": { + "description": "Disable the use of the QUIC protocol", "type": "boolean", - "x-display-name": "Disable the use of the QUIC protocol" + "x-display-name": "Disable QUIC" }, "node": { "type": "string" @@ -91393,14 +91971,14 @@ func init() { "x-omitempty": true }, "shm_stats_file": { + "description": "Shared Memory Statistics File (EXPERIMENTAL)", "type": "string", - "pattern": "^[^\\s]+$", - "x-display-name": "Shared Memory Statistics File (EXPERIMENTAL)" + "pattern": "^[^\\s]+$" }, "shm_stats_file_max_objects": { + "description": "Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)", "type": "integer", "minimum": 0, - "x-display-name": "Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)", "x-nullable": true }, "ssl_options": { @@ -91471,10 +92049,10 @@ func init() { "x-display-name": "User" }, "warn_blocked_traffic_after": { + "description": "Delay after which a stuck task triggers a warning", "type": "integer", "minimum": 1, "x-default-unit": "ms", - "x-display-name": "Delay after which a stuck task triggers a warning", "x-duration": true, "x-nullable": true }, @@ -91499,7 +92077,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "users": { @@ -94413,7 +94991,7 @@ func init() { } }, "log_forward": { - "description": "LogForward with all it's children resources", + "description": "LogForward with all its children resources", "type": "object", "allOf": [ { @@ -94826,7 +95404,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_]+$", + "pattern": "^[A-Za-z0-9-_${}\"]+$", "x-nullable": false }, "port": { @@ -94838,7 +95416,7 @@ func init() { } }, "mailers_section": { - "description": "MailersSection with all it's children resources", + "description": "MailersSection with all its children resources", "type": "object", "allOf": [ { @@ -94876,10 +95454,10 @@ func init() { "x-nullable": false }, "timeout": { + "description": "Timeout to send an email in milliseconds", "type": "integer", "minimum": 0, "x-default-unit": "ms", - "x-display-name": "Timeout to send an email in milliseconds", "x-duration": true, "x-nullable": true } @@ -95015,7 +95593,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "port": { @@ -95851,7 +96429,7 @@ func init() { }, "name": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false }, "port": { @@ -95866,7 +96444,7 @@ func init() { } }, "peer_section": { - "description": "Peer Section with all it's children resources", + "description": "Peer Section with all its children resources", "type": "object", "allOf": [ { @@ -95955,6 +96533,10 @@ func init() { "busy_polling": { "type": "boolean" }, + "fd_hard_limit": { + "type": "integer", + "x-nullable": true + }, "max_spread_checks": { "type": "integer", "minimum": 0, @@ -95967,77 +96549,77 @@ func init() { "x-display-name": "Maximum HAProxy CPU usage" }, "maxcomprate": { - "type": "integer", - "x-display-name": "Maximum per-process input compression rate" + "description": "Maximum per-process input compression rate", + "type": "integer" }, "maxconn": { "type": "integer", "x-display-name": "Max Connections" }, "maxconnrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of concurrent connections" + "description": "Maximum per-process number of concurrent connections", + "type": "integer" }, "maxpipes": { "type": "integer", "x-display-name": "Maximum per-process number of pipes" }, "maxsessrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of sessions per second" + "description": "Maximum per-process number of sessions per second", + "type": "integer" }, "maxzlibmem": { - "type": "integer", - "x-display-name": "Maximum amount of RAM in megabytes per process usable by the zlib" + "description": "Maximum amount of RAM in megabytes per process usable by the zlib", + "type": "integer" }, "noepoll": { - "type": "boolean", - "x-display-name": "Disable the use of the \"epoll\" event polling system on Linux" + "description": "Disable the use of the \"epoll\" event polling system on Linux", + "type": "boolean" }, "noevports": { - "type": "boolean", - "x-display-name": "Disable the use of the event ports event polling system on SunOS system derived from Solaris 10 and later" + "description": "Disable the use of the event ports event polling system on SunOS system derived from Solaris 10 and later", + "type": "boolean" }, "nogetaddrinfo": { - "type": "boolean", - "x-display-name": "Disable the use of getaddrinfo for name resolving" + "description": "Disable the use of getaddrinfo for name resolving", + "type": "boolean" }, "nokqueue": { - "type": "boolean", - "x-display-name": "Disable the use of the \"kqueue\" event polling system on BSD" + "description": "Disable the use of the \"kqueue\" event polling system on BSD", + "type": "boolean" }, "noktls": { - "type": "boolean", - "x-display-name": "Disables the use of ktls. It is equivalent to the command line argument \"-dT\"" + "description": "Disables the use of ktls. It is equivalent to the command line argument \"-dT\"", + "type": "boolean" }, "nopoll": { - "type": "boolean", - "x-display-name": "Disable the use of the \"poll\" event polling system" + "description": "Disable the use of the \"poll\" event polling system", + "type": "boolean" }, "noreuseport": { "type": "boolean", "x-display-name": "Disable the use of SO_REUSEPORT" }, "nosplice": { - "type": "boolean", - "x-display-name": "Disable the use of kernel tcp splicing between sockets on Linux" + "description": "Disable the use of kernel tcp splicing between sockets on Linux", + "type": "boolean" }, "profiling_memory": { + "description": "Enable or disables per-function memory profiling", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enable or disables per-function memory profiling" + ] }, "profiling_tasks": { + "description": "Enable or disables per-task CPU profiling", "type": "string", "enum": [ "auto", "enabled", "disabled" - ], - "x-display-name": "Enable or disables per-task CPU profiling" + ] }, "server_state_base": { "type": "string", @@ -96050,8 +96632,8 @@ func init() { "x-display-name": "Server State File" }, "spread_checks": { - "type": "integer", - "x-display-name": "Add some randomness in the check interval" + "description": "Add some randomness in the check interval", + "type": "integer" }, "thread_hard_limit": { "type": "integer", @@ -96533,7 +97115,7 @@ func init() { } }, "resolver": { - "description": "Resolver with all it's children resources", + "description": "Resolver with all its children resources", "type": "object", "allOf": [ { @@ -96665,7 +97247,7 @@ func init() { "x-go-name": "ReturnHeader" }, "ring": { - "description": "Ring with all it's children resources", + "description": "Ring with all its children resources", "type": "object", "allOf": [ { @@ -96693,10 +97275,11 @@ func init() { ], "properties": { "description": { - "type": "string", - "x-display-name": "The description is an optional description string of the ring" + "description": "The description is an optional description string of the ring", + "type": "string" }, "format": { + "description": "Format used to store events into the ring buffer", "type": "string", "enum": [ "iso", @@ -96707,12 +97290,11 @@ func init() { "short", "priority", "timed" - ], - "x-display-name": "Format used to store events into the ring buffer" + ] }, "maxlen": { + "description": "The maximum length of an event message stored into the ring", "type": "integer", - "x-display-name": "The maximum length of an event message stored into the ring", "x-nullable": true }, "metadata": { @@ -96726,9 +97308,9 @@ func init() { "x-nullable": false }, "size": { + "description": "Optional size in bytes for the ring-buffer", "type": "integer", "minimum": 0, - "x-display-name": "Optional size in bytes for the ring-buffer", "x-nullable": true, "x-size": true }, @@ -97272,8 +97854,7 @@ func init() { "address": { "type": "string", "pattern": "^[^\\s]+$", - "x-nullable": false, - "readOnly": true + "x-nullable": false }, "admin_state": { "type": "string", @@ -97283,10 +97864,90 @@ func init() { "drain" ] }, + "agent_addr": { + "type": "string", + "readOnly": true + }, + "agent_port": { + "type": "integer", + "maximum": 65535, + "minimum": 0, + "x-nullable": true, + "readOnly": true + }, + "agent_state": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_forced_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "backend_name": { + "type": "string", + "readOnly": true + }, + "check_addr": { + "type": "string", + "readOnly": true + }, + "check_health": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_port": { + "type": "integer", + "maximum": 65535, + "minimum": 0, + "x-nullable": true, + "readOnly": true + }, + "check_result": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_state": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "check_status": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "forced_id": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "fqdn": { + "type": "string", + "readOnly": true + }, "id": { "type": "string", "readOnly": true }, + "iweight": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, + "last_time_change": { + "type": "integer", + "x-nullable": true, + "readOnly": true + }, "name": { "type": "string", "readOnly": true @@ -97303,8 +97964,24 @@ func init() { "type": "integer", "maximum": 65535, "minimum": 1, + "x-nullable": true + }, + "srvrecord": { + "type": "string", + "readOnly": true + }, + "use_ssl": { + "type": "boolean", + "readOnly": true + }, + "uweight": { + "type": "integer", "x-nullable": true, "readOnly": true + }, + "weight": { + "type": "integer", + "x-nullable": true } }, "example": { @@ -98165,7 +98842,7 @@ func init() { "additionalProperties": false, "example": { "cond": "if", - "cond_test": "{ req_ssl_sni -i www.example.com }", + "cond_test": "{ req.ssl_sni -i www.example.com }", "target_server": "www" } }, @@ -98728,21 +99405,26 @@ func init() { "title": "SSL File", "properties": { "algorithm": { - "type": "string" + "type": "string", + "readOnly": true }, "authority_key_id": { - "type": "string" + "type": "string", + "readOnly": true }, "chain_issuer": { "type": "string", - "x-omitempty": true + "x-omitempty": true, + "readOnly": true }, "chain_subject": { "type": "string", - "x-omitempty": true + "x-omitempty": true, + "readOnly": true }, "description": { - "type": "string" + "type": "string", + "readOnly": true }, "domains": { "type": "string", @@ -98750,7 +99432,8 @@ func init() { "readOnly": true }, "file": { - "type": "string" + "type": "string", + "readOnly": true }, "ip_addresses": { "type": "string", @@ -98780,10 +99463,12 @@ func init() { "type": "string" }, "sha1_finger_print": { - "type": "string" + "type": "string", + "readOnly": true }, "sha256_finger_print": { - "type": "string" + "type": "string", + "readOnly": true }, "size": { "description": "File size in bytes.", @@ -98798,16 +99483,20 @@ func init() { "readOnly": true }, "storage_name": { - "type": "string" + "type": "string", + "readOnly": true }, "subject": { - "type": "string" + "type": "string", + "readOnly": true }, "subject_alternative_names": { - "type": "string" + "type": "string", + "readOnly": true }, "subject_key_id": { - "type": "string" + "type": "string", + "readOnly": true } } }, @@ -99278,12 +99967,12 @@ func init() { "x-display-name": "SSL Load Extra Files" }, "maxsslconn": { - "type": "integer", - "x-display-name": "Maximum per-process number of concurrent SSL connections" + "description": "Maximum per-process number of concurrent SSL connections", + "type": "integer" }, "maxsslrate": { - "type": "integer", - "x-display-name": "Maximum per-process number of SSL sessions per second" + "description": "Maximum per-process number of SSL sessions per second", + "type": "integer" }, "mode_async": { "type": "string", @@ -101377,9 +102066,9 @@ func init() { "x-size": true }, "bufsize_small": { + "description": "Size of small buffers (for memory-restrained situations)", "type": "integer", "minimum": 1, - "x-display-name": "Size of small buffers (for memory-restrained situations)", "x-nullable": true, "x-size": true }, @@ -101517,12 +102206,12 @@ func init() { "type": "object", "properties": { "applet_zero_copy_forwarding": { + "description": "Enables of disabled the zero-copy forwarding of data for the applets", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enables of disabled the zero-copy forwarding of data for the applets" + ] }, "comp_maxlevel": { "type": "integer", @@ -101573,61 +102262,61 @@ func init() { "x-nullable": true }, "h1_zero_copy_fwd_recv": { + "description": "enable or disable the zero-copy receives of data for the HTTP/1 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy receives of data for the HTTP/1 multiplexer" + ] }, "h1_zero_copy_fwd_send": { + "description": "enable or disable the zero-copy sends of data for the HTTP/1 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy sends of data for the HTTP/1 multiplexer" + ] }, "h2_be_glitches_threshold": { + "description": "Automatically kill a backend connection past a number of glitches", "type": "integer", - "x-display-name": "Automatically kill a backend connection past a number of glitches", "x-nullable": true }, "h2_be_initial_window_size": { - "type": "integer", - "x-display-name": "Initial window size for outgoing connections" + "description": "Initial window size for outgoing connections", + "type": "integer" }, "h2_be_max_concurrent_streams": { - "type": "integer", - "x-display-name": "Maximum number of concurrent streams per outgoing connection" + "description": "Maximum number of concurrent streams per outgoing connection", + "type": "integer" }, "h2_be_rxbuf": { + "description": "HTTP/2 receive buffer size for outgoing connections", "type": "integer", - "x-display-name": "HTTP/2 receive buffer size for outgoing connections", "x-nullable": true, "x-size": true }, "h2_fe_glitches_threshold": { + "description": "Automatically kill a frontend connection past a number of glitches", "type": "integer", - "x-display-name": "Automatically kill a frontend connection past a number of glitches", "x-nullable": true }, "h2_fe_initial_window_size": { - "type": "integer", - "x-display-name": "Initial window size for incoming connections" + "description": "Initial window size for incoming connections", + "type": "integer" }, "h2_fe_max_concurrent_streams": { - "type": "integer", - "x-display-name": "Maximum number of concurrent streams per incoming connection" + "description": "Maximum number of concurrent streams per incoming connection", + "type": "integer" }, "h2_fe_max_total_streams": { + "description": "Maximum number of total streams processed per incoming HTTP/2 connection", "type": "integer", - "x-display-name": "Maximum number of total streams processed per incoming HTTP/2 connection", "x-nullable": true }, "h2_fe_rxbuf": { + "description": "HTTP/2 receive buffer size for incoming connections", "type": "integer", - "x-display-name": "HTTP/2 receive buffer size for incoming connections", "x-nullable": true, "x-size": true }, @@ -101650,12 +102339,12 @@ func init() { "x-display-name": "HTTP/2 Maximum Frame Size" }, "h2_zero_copy_fwd_send": { + "description": "enable or disable the zero-copy sends of data for the HTTP/2 multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy sends of data for the HTTP/2 multiplexer" + ] }, "http_cookielen": { "type": "integer", @@ -101751,8 +102440,8 @@ func init() { "x-nullable": true }, "peers_max_updates_at_once": { - "type": "integer", - "x-display-name": "Maximum number of stick-table updates at once" + "description": "Maximum number of stick-table updates at once", + "type": "integer" }, "pool_high_fd_ratio": { "type": "integer", @@ -101763,30 +102452,30 @@ func init() { "x-display-name": "Max Used Low FD Ratio" }, "pt_zero_copy_forwarding": { + "description": "enable or disable the zero-copy forwarding of data for the pass-through multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "enable or disable the zero-copy forwarding of data for the pass-through multiplexer" + ] }, "renice_runtime": { + "description": "Scheduling priority applied after the configuration parsing", "type": "integer", "maximum": 19, "minimum": -20, - "x-display-name": "Scheduling priority applied after the configuration parsing", "x-nullable": true }, "renice_startup": { + "description": "Scheduling priority applied before the rest of the configuration", "type": "integer", "maximum": 19, "minimum": -20, - "x-display-name": "Scheduling priority applied before the rest of the configuration", "x-nullable": true }, "ring_queues": { + "description": "Number of write queues in front of ring buffers", "type": "integer", - "x-display-name": "Number of write queues in front of ring buffers", "x-nullable": true }, "runqueue_depth": { @@ -101850,10 +102539,10 @@ func init() { "x-nullable": true }, "reorder_ratio": { + "description": "Ratio applied to the packet reordering threshold", "type": "integer", "maximum": 100, "minimum": 0, - "x-display-name": "Ratio applied to the packet reordering threshold", "x-nullable": true }, "retry_threshold": { @@ -101870,12 +102559,12 @@ func init() { "x-display-name": "QUIC Socket Owner" }, "zero_copy_fwd_send": { + "description": "Enables or disables the zero-copy sends for the QUIC multiplexer", "type": "string", "enum": [ "enabled", "disabled" - ], - "x-display-name": "Enables or disables the zero-copy sends for the QUIC multiplexer" + ] } } }, @@ -101927,13 +102616,13 @@ func init() { "x-size": false }, "ocsp_update_max_delay": { + "description": "SSL Maximum Interval Between Two Automatic Updates of the same OCSP Response", "type": "integer", - "x-display-name": "SSL Maximum Interval Between Two Automatic Updates of the same OCSP Response", "x-nullable": true }, "ocsp_update_min_delay": { + "description": "SSL Minimum Interval Between Two Automatic Updates of the same OCSP Response", "type": "integer", - "x-display-name": "SSL Minimum Interval Between Two Automatic Updates of the same OCSP Response", "x-nullable": true } } @@ -102018,13 +102707,13 @@ func init() { }, "username": { "type": "string", - "pattern": "^[A-Za-z0-9-_.:]+$", + "pattern": "^[A-Za-z0-9-_.:${}\"]+$", "x-nullable": false } } }, "userlist": { - "description": "Userlist with all it's children resources", + "description": "Userlist with all its children resources", "type": "object", "allOf": [ { @@ -102088,24 +102777,24 @@ func init() { "type": "object", "properties": { "cache_size": { - "type": "integer", - "x-display-name": "Sets the WURFL Useragent cache size" + "description": "Sets the WURFL Useragent cache size", + "type": "integer" }, "data_file": { - "type": "string", - "x-display-name": "The path of the WURFL data file" + "description": "The path of the WURFL data file", + "type": "string" }, "information_list": { - "type": "string", - "x-display-name": "A space-delimited list of WURFL capabilities" + "description": "A space-delimited list of WURFL capabilities", + "type": "string" }, "information_list_separator": { - "type": "string", - "x-display-name": "A char that will be used to separate values in a response header containing WURFL results" + "description": "A char that will be used to separate values in a response header containing WURFL results", + "type": "string" }, "patch_file": { - "type": "string", - "x-display-name": "A list of WURFL patch file paths" + "description": "A list of WURFL patch file paths", + "type": "string" } } } @@ -102126,6 +102815,7 @@ func init() { "in": "query" }, "parent_name": { + "pattern": "^[^\\r\\n\u003c\u003e*;$#\u0026{}\"]+$", "type": "string", "description": "Parent name", "name": "parent_name", diff --git a/generate/go-generate.go b/generate/go-generate.go deleted file mode 100644 index 6f78aa48..00000000 --- a/generate/go-generate.go +++ /dev/null @@ -1,479 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package main - -import ( - "errors" - "fmt" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "strconv" - "strings" - "text/template" - "unicode" -) - -var serverGroups = map[string]string{ - "EnabledListeners": "dataplaneapi", - "CleanupTimeout": "dataplaneapi", - "GracefulTimeout": "dataplaneapi", - "MaxHeaderSize": "dataplaneapi", - "SocketPath": "dataplaneapi", - "DebugSocketPath": "dataplaneapi", - "Host": "dataplaneapi", - "Port": "dataplaneapi", - "ListenLimit": "dataplaneapi", - "KeepAlive": "dataplaneapi", - "ReadTimeout": "dataplaneapi", - "WriteTimeout": "dataplaneapi", - "TLSHost": "tls", - "TLSPort": "tls", - "TLSCertificate": "tls", - "TLSCertificateKey": "tls", - "TLSCACertificate": "tls", - "TLSListenLimit": "tls", - "TLSKeepAlive": "tls", - "TLSReadTimeout": "tls", - "TLSWriteTimeout": "tls", -} - -var groupParents = map[string]string{ - "advertised": "dataplaneapi", - "userlist": "dataplaneapi", - "resources": "dataplaneapi", - "transaction": "dataplaneapi", - "tls": "dataplaneapi", - "user": "dataplaneapi", - "reload": "haproxy", - "syslog": "log", - "log_targets": "log", -} - -var itemDefaults = map[string]any{ - "port": 80, - "listen_limit": 1024, - "tls_host": "null", - "tls_port": 6443, - "tls_certificate": "null", - "tls_key": "null", - "tls_ca": "null", - "tls_listen_limit": 10, - "tls_keep_alive": "1m", - "tls_read_timeout": "10s", - "tls_write_timeout": "10s", - "userlist_file": "null", - "backups_dir": "/tmp/backups", - "scheme": "http", -} - -type Attribute struct { - Default string - Group string - Type string - Long string - FileName string - Short string - AttName string - ENV string - Name string - StructName string - SpecName string - Example string - Deprecated bool - Save bool -} - -type ParseGroup struct { - OriginalGroup string - Name string - AttName string - Parent string - Elements []string - Attributes []Attribute - MaxSize int - MaxTypeSize int - HasACLKey bool - IsList bool -} - -type ParseData struct { - Groups []ParseGroup -} - -func readServerData(filePath string, pd *ParseData, structName string, attName string, groupName string, isList bool) { - typeStruct := fmt.Sprintf("type %s struct {", structName) - dat, err := os.ReadFile(filePath) - if err != nil { - log.Panic(err) - } - lines := strings.Split(string(dat), "\n") - inside := false - for _, line := range lines { - if strings.HasPrefix(line, typeStruct) { - inside = true - continue - } - if strings.HasPrefix(line, "}") { - inside = false - continue - } - if inside && strings.Contains(line, "`") { - res, err := processLine(line) - if err != nil { - continue - } - if structName == "Server" { - group, ok := serverGroups[res.Name] - if !ok { - log.Panicf("group not defined for %s in serverGroups", res.Name) - } - res.Group = group - } - res.AttName = attName - res.StructName = structName - found := false - if groupName == "" { - groupName = res.Group - } - for i, g := range pd.Groups { - if g.Name == res.Group { - found = true - g.Attributes = append(g.Attributes, res) - if g.MaxSize < len(res.Name) { - g.MaxSize = len(res.Name) - } - if g.MaxTypeSize < len(res.Type) { - g.MaxSize = len(res.Type) - } - pd.Groups[i] = g - break - } - } - if !found { - pd.Groups = append(pd.Groups, ParseGroup{ - OriginalGroup: structName, - Name: res.Group, - AttName: attName, - Parent: groupParents[res.Group], - MaxSize: len(res.Name), - MaxTypeSize: len(res.Type), - Attributes: []Attribute{res}, - IsList: isList, - }) - } - } - } -} - -func capitalize(str string) string { - if len(str) == 0 { - return "" - } - var res strings.Builder - parts := strings.FieldsFunc(str, split) - for _, part := range parts { - res.WriteString(capitalizeChunk(part)) - } - return res.String() -} - -func split(r rune) bool { - return r == '_' || r == '-' -} - -func capitalizeChunk(str string) string { - if len(str) == 0 { - return "" - } - result := []rune(str) - result[0] = unicode.ToUpper(result[0]) - return string(result) -} - -func stripAtomic(str string) string { - if len(str) == 0 { - return "" - } - if after, ok := strings.CutPrefix(str, "Atomic"); ok { - return strings.ToLower(after) - } - return str -} - -func isListItem(att Attribute) string { - return " " -} - -func getExample(att Attribute) string { - if att.Example != "" { - if att.Type == "int" { - i, _ := strconv.ParseInt(att.Example, 10, 64) - return strconv.FormatInt(i, 10) - } - return att.Example - } - if att.Default != "" { - switch att.Type { - case "int", "int64": - return att.Default - default: - return fmt.Sprintf(`"%s"`, att.Default) - } - } - if att.Type == "bool" { - return `false` - } - if strings.HasPrefix(att.Type, "[]*models.") { - return `[]` - } - if v, ok := itemDefaults[att.FileName]; ok { - switch t := v.(type) { - case int: - return strconv.Itoa(v.(int)) - default: - return t.(string) - } - } - return "null" -} - -func getQuotedExample(att Attribute) string { - if att.Type == "int" || att.Type == "int64" { - switch { - case len(att.Example) > 0: - return att.Example - case len(att.Default) > 0: - return att.Default - } - } - if att.Type == "bool" || att.Type == "AtomicBool" { - if len(att.Example) == 0 { - return `false` - } - return att.Example - } - if strings.HasPrefix(att.Type, "[]*models.") { - return `[]` - } - if att.Example != "" { - return fmt.Sprintf(`"%s"`, att.Example) - } - if att.Default != "" { - return fmt.Sprintf(`"%s"`, att.Default) - } - if v, ok := itemDefaults[att.FileName]; ok { - switch v.(type) { - case int: - return fmt.Sprintf("%d", v) - default: - return fmt.Sprintf(`"%s"`, v) - } - } - return `"null"` -} - -func main() { - dir, err := filepath.Abs(filepath.Dir(os.Args[0])) - if err != nil { - log.Fatal(err) - } - if strings.HasSuffix(dir, "generate") { - dir, err = filepath.Abs(filepath.Dir(os.Args[0]) + "/..") - if err != nil { - log.Fatal(err) - } - } - if len(os.Args) > 1 { - dir = os.Args[1] - } - - pd := &ParseData{ - Groups: []ParseGroup{}, - } - - pd.Groups = append(pd.Groups, ParseGroup{ - Name: "", - AttName: "-", - Parent: "", - MaxSize: 4, - MaxTypeSize: 12, - Attributes: []Attribute{}, - }) - // ######################################## server.go - filePath := path.Join(dir, "server.go") - readServerData(filePath, pd, "Server", "", "", false) - // ######################################## configuration.go - filePath = path.Join(dir, "configuration", "configuration.go") - readServerData(filePath, pd, "Configuration", "-", "", false) - readServerData(filePath, pd, "User", "Users", "", true) - readServerData(filePath, pd, "HAProxyConfiguration", "HAProxy", "", false) - readServerData(filePath, pd, "APIConfiguration", "APIOptions", "", false) - readServerData(filePath, pd, "ServiceDiscovery", "ServiceDiscovery", "", false) - readServerData(filePath, pd, "ClusterConfiguration", "Cluster", "cluster", false) - readServerData(filePath, pd, "SyslogOptions", "Syslog", "", false) - readServerData(filePath, pd, "LoggingOptions", "Logging", "", false) - // readServerData(filePath, pd, "User", "User", "") - // ######################################## - - // prepare template function - funcMap := template.FuncMap{ - "Capitalize": capitalize, - "StripAtomic": stripAtomic, - "Example": getExample, - "QuotedExample": getQuotedExample, - "IsListItem": isListItem, - } - // create configuration_generated - templatePath := path.Join(dir, "generate", "configuration.tmpl") - tmpl, err := template.New("configuration.tmpl").Funcs(funcMap).ParseFiles(templatePath) - if err != nil { - log.Panic(err) - } - tmpl = tmpl.Funcs(funcMap) - filePath = path.Join(dir, "configuration", "configuration_generated.go") - f, err := os.Create(filePath) - if err != nil { - log.Panic(err) - } - defer f.Close() - err = tmpl.Execute(f, pd) - if err != nil { - log.Panic(err) - } - fmtFile(filePath) - // create dataplaneapi_generated - templatePath = path.Join(dir, "generate", "dataplaneapi.tmpl") - tmpl, err = template.New("dataplaneapi.tmpl").Funcs(funcMap).ParseFiles(templatePath) - if err != nil { - log.Panic(err) - } - tmpl = tmpl.Funcs(funcMap) - filePath = path.Join(dir, "dataplaneapi_generated.go") - f, err = os.Create(filePath) - if err != nil { - log.Panic(err) - } - defer f.Close() - err = tmpl.Execute(f, pd) - if err != nil { - log.Panic(err) - } - fmtFile(filePath) - // create configuration example yaml - templatePath = path.Join(dir, "generate", "configuration-example-yaml.tmpl") - tmpl, err = template.New("configuration-example-yaml.tmpl").Funcs(funcMap).ParseFiles(templatePath) - if err != nil { - log.Panic(err) - } - tmpl = tmpl.Funcs(funcMap) - filePath = path.Join(dir, "configuration/examples/example-full.yaml") - f, err = os.Create(filePath) - if err != nil { - log.Panic(err) - } - defer f.Close() - err = tmpl.Execute(f, pd) - if err != nil { - log.Panic(err) - } -} - -func splitBy(c rune) bool { - return c == ' ' || c == '\t' -} - -func processLine(line string) (Attribute, error) { - parts := strings.FieldsFunc(line, splitBy) - var longName string - var envName string - var shortName string - var defaultName string - var group string - var specName string - var save bool - var deprecated bool - var example string - for _, part := range parts[2:] { - if strings.Contains(part, "long:") { - p := strings.Split(part, `"`) - longName = p[1] - } - if strings.Contains(part, "env:") { - p := strings.Split(part, `"`) - envName = p[1] - } - if strings.Contains(part, "short:") { - p := strings.Split(part, `"`) - shortName = p[1] - } - if strings.Contains(part, "default:") { - p := strings.Split(part, `"`) - defaultName = p[1] - } - if strings.Contains(part, "example:") { - p := strings.Split(part, `"`) - example = p[1] - } - if strings.Contains(part, "group:") { - p := strings.Split(part, `"`) - group = p[1] - } - if strings.Contains(part, `save:"true"`) { - save = true - } - if strings.Contains(part, `deprecated:"true"`) { - deprecated = true - } - if strings.Contains(part, `yaml:"-"`) { - return Attribute{}, errors.New("ignore this attribute") - } else if strings.Contains(part, `yaml:"`) { - p := strings.Split(part, `"`) - if strings.Contains(part, `,omitempty`) { - p[1] = strings.Replace(p[1], ",omitempty", "", 1) - } - specName = p[1] - } - } - fileName := longName - if longName == "" { - fileName = specName - } - - // fmt.Println(parts[0], parts[1]) - return Attribute{ - Name: parts[0], - Type: parts[1], - Long: longName, - FileName: strings.ReplaceAll(fileName, "-", "_"), - ENV: envName, - Short: shortName, - Default: defaultName, - Group: group, - SpecName: specName, - Save: save, - Deprecated: deprecated, - Example: example, - }, nil -} - -func fmtFile(filename string) { - cmd := exec.Command("gofmt", "-s", "-w", filename) - err := cmd.Run() - if err != nil { - log.Fatalf("cmd.Run() failed with %s\n", err) - } -} diff --git a/generate/parents/main.go b/generate/parents/main.go deleted file mode 100644 index 789b9282..00000000 --- a/generate/parents/main.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package main - -import ( - "bytes" - "fmt" - "os" - "strings" - "text/template" - - "github.com/go-openapi/swag/mangling" - cnparents "github.com/haproxytech/client-native/v6/configuration/parents" -) - -// To generate parent aliases parent__generated.go in handler/ -// Usage: go run generate/parents/*.go -// To generate for a new childType, update 2 files: -// - operations.go for the list of operations to generate (Create/Get/...) - -func main() { - fmt.Println("Generating parent aliases") - children := []string{ - cnparents.ServerChildType, - cnparents.HTTPAfterResponseRuleChildType, - cnparents.HTTPCheckChildType, - cnparents.HTTPErrorRuleChildType, - cnparents.HTTPRequestRuleChildType, - cnparents.HTTPResponseRuleChildType, - cnparents.TCPCheckChildType, - cnparents.TCPRequestRuleChildType, - cnparents.TCPResponseRuleChildType, - cnparents.QUICInitialRuleType, - cnparents.ACLChildType, - cnparents.BindChildType, - cnparents.FilterChildType, - cnparents.LogTargetChildType, - } - for _, childType := range children { - res := generateAlias(childType) - - // Create or open a file - fileName := fmt.Sprintf("handlers/parent_%s_generated.go", strings.ToLower(childType)) - fmt.Printf("Generated %s\n", fileName) - file, err := os.Create(fileName) - if err != nil { - fmt.Println("Error creating file:", err) - return - } - defer file.Close() - - // Write the buffer's content to the file - _, err = res.WriteTo(file) - if err != nil { - fmt.Println("Error writing to file:", err) - return - } - } -} - -type TmplData struct { - GoChildType string - ChildType string - Operations []string - OperationPackage string -} - -func generateAlias(childType string) bytes.Buffer { - funcMap := template.FuncMap{ - "parents": cnparents.Parents, - } - parents := cnparents.Parents(childType) - fmt.Printf("Generating for child %s / parents: %v\n", childType, parents) - mangler := mangling.NewNameMangler(mangling.WithAdditionalInitialisms("QUIC")) - tmplData := TmplData{ - ChildType: childType, - GoChildType: mangler.ToGoName(childType), - Operations: operations(childType), - OperationPackage: childType, - } - templateName := "parent_generated.tmpl" - tmpl := template.Must(template.New(templateName).Funcs(funcMap).ParseFiles("generate/parents/" + templateName)) - var result bytes.Buffer - err := tmpl.ExecuteTemplate(&result, templateName, tmplData) - if err != nil { - exitError(err.Error()) - } - return result -} - -func exitError(msg string) { - fmt.Fprintf(os.Stderr, "ERROR: %v\n", msg) - os.Exit(1) -} diff --git a/generate/parents/operations.go b/generate/parents/operations.go deleted file mode 100644 index 8b0efe30..00000000 --- a/generate/parents/operations.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package main - -import ( - cnparents "github.com/haproxytech/client-native/v6/configuration/parents" -) - -func operations(childType string) []string { - switch childType { - case cnparents.ServerChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - } - case cnparents.HTTPAfterResponseRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.HTTPCheckChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.HTTPErrorRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.HTTPRequestRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.HTTPResponseRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.TCPCheckChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.TCPRequestRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.TCPResponseRuleChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.QUICInitialRuleType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.ACLChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.BindChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - } - case cnparents.FilterChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - case cnparents.LogTargetChildType: - return []string{ - "Create", - "Get", - "GetAll", - "Delete", - "Replace", - "ReplaceAll", - } - } - return []string{} -} diff --git a/generate/parents/parent_generated.tmpl b/generate/parents/parent_generated.tmpl deleted file mode 100644 index 036b4d20..00000000 --- a/generate/parents/parent_generated.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/{{ .OperationPackage }}" -) - -{{$out := .}} - -{{ range $i, $op := $out.Operations -}} -type ( - -{{ range parents $out.ChildType -}} - {{ $op }}{{ $out.GoChildType }}{{ .ParentType }}HandlerImpl {{ $op }}{{ $out.GoChildType }}HandlerImpl -{{ end -}} -) -{{ end -}} - - - - -{{ range $i, $op := $out.Operations -}} -{{ range parents $out.ChildType -}} -func (h *{{ $op }}{{ $out.GoChildType }}{{ .ParentType }}HandlerImpl) Handle(params {{ $out.OperationPackage }}.{{ $op }}{{ $out.GoChildType }}{{ .ParentType }}Params, principal any) middleware.Responder { - g := {{ $op }}{{ $out.GoChildType }}HandlerImpl(*h) - {{ if not .IsGenericParent -}} - pg := {{ $out.OperationPackage }}.{{ $op }}{{ $out.GoChildType }}{{ .GenericParentType }}Params(params) - return g.Handle(cnconstants.{{ .ParentType }}ParentType, pg, principal) - {{ else -}} - return g.Handle(cnconstants.{{ .ParentType }}ParentType, params, principal) - {{ end -}} -} -{{ end -}} -{{ end -}} diff --git a/generate/post_swagger.sh b/generate/post_swagger.sh deleted file mode 100755 index 5c60ee9b..00000000 --- a/generate/post_swagger.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e -echo -n " ---> adding serverStartedCallback() to " -sed -i "s/wg.Wait()/serverStartedCallback()\nwg.Wait()/g" server.go -go fmt server.go diff --git a/generate/swagger/Dockerfile b/generate/swagger/Dockerfile index 683a4703..ba38abd8 100644 --- a/generate/swagger/Dockerfile +++ b/generate/swagger/Dockerfile @@ -1,6 +1,6 @@ ARG SWAGGER_VERSION -FROM golang:1.25 AS golang +FROM golang:1.26 AS golang FROM quay.io/goswagger/swagger:0.32.3 COPY --from=golang /usr/local/go /usr/local/go @@ -11,7 +11,6 @@ WORKDIR /data ARG UID ARG GID COPY script.sh /generate/swagger/script.sh -COPY templates /generate/swagger/templates VOLUME ["/data"] RUN apk add bash jq && sed -i "s/999/99/" /etc/group && \ diff --git a/generate/swagger/script.sh b/generate/swagger/script.sh index d8c752cb..e388b016 100755 --- a/generate/swagger/script.sh +++ b/generate/swagger/script.sh @@ -55,9 +55,10 @@ else fi echo "module github.com/haproxytech" > $DST_DIR/go.mod -mkdir -p $DST_DIR/dataplaneapi/operations -cp configure_data_plane.go $DST_DIR/dataplaneapi/configure_data_plane.go +# We only want the embedded specification (embedded_spec.go). Everything else +# that go-swagger emits is generated into a throwaway directory and discarded; +# the chi-based server is generated by oapi-codegen (make specification). swagger generate server -f $SPEC_DIR/haproxy_spec.yaml \ -A "Data Plane" \ -t $DST_DIR \ @@ -67,83 +68,7 @@ swagger generate server -f $SPEC_DIR/haproxy_spec.yaml \ -s dataplaneapi \ --additional-initialism=FCGI \ --additional-initialism=QUIC \ - --tags=Discovery \ - --tags=ServiceDiscovery \ - --tags=Information \ - --tags=Health \ - --tags=Specification \ - --tags=SpecificationOpenapiv3 \ - --tags=Transactions \ - --tags=Sites \ - --tags=Stats \ - --tags=Global \ - --tags=Frontend \ - --tags=Backend \ - --tags=Ring \ - --tags=DgramBind \ - --tags=LogForward \ - --tags=Bind \ - --tags=Server \ - --tags=Configuration \ - --tags=HTTPCheck \ - --tags=HTTPRequestRule \ - --tags=HTTPResponseRule \ - --tags=HTTPAfterResponseRule \ - --tags=HTTPErrorRule \ - --tags=HTTPErrors \ - --tags=BackendSwitchingRule \ - --tags=ServerSwitchingRule \ - --tags=TCPResponseRule \ - --tags=TCPRequestRule \ - --tags=TCPCheck \ - --tags=FCGIApp \ - --tags=Filter \ - --tags=StickRule \ - --tags=LogTarget \ - --tags=Reloads \ - --tags=ACL \ - --tags=Defaults \ - --tags=StickTable \ - --tags=Maps \ - --tags=Nameserver \ - --tags=Cluster \ - --tags=Peer \ - --tags=PeerEntry \ - --tags=ProcessManager \ - --tags=Resolver \ - --tags=Spoe \ - --tags=SpoeTransactions \ - --tags=Storage \ - --tags="ACL Runtime" \ - --tags=ServerTemplate \ - --tags=Cache \ - --tags=DeclareCapture \ - --tags=Userlist \ - --tags=User \ - --tags=Group \ - --tags=MailerEntry \ - --tags=Mailers \ - --tags=Table \ - --tags=CrtStore \ - --tags=CrtLoad \ - --tags=QUICInitialRule \ - --tags=Traces \ - --tags=LogProfile \ - --tags=SSLFrontUse \ - --tags=SSLRuntime \ - --tags=Acme \ - --tags=AcmeRuntime \ - -r $SPEC_DIR/copyright.txt \ - --template-dir generate/swagger/templates + -r $SPEC_DIR/copyright.txt -echo " ---> removing doc.go" -rm doc.go || echo "doc.go does not exists" -echo " ---> removing embedded_spec.go" -rm embedded_spec.go || echo "embedded_spec.go does not exists" -echo " ---> removing server.go" -rm server.go || echo "server.go does not exists" -echo " ---> removing operations/*" -rm -rf operations/* || echo "operations/ does not exists" - -echo " ---> copy generated files to destination" -cp -a $DST_DIR/dataplaneapi/. . +echo " ---> copy embedded_spec.go to destination" +cp $DST_DIR/dataplaneapi/embedded_spec.go embedded_spec.go diff --git a/generate/swagger/templates/server/parameter.gotmpl b/generate/swagger/templates/server/parameter.gotmpl deleted file mode 100644 index 678cb494..00000000 --- a/generate/swagger/templates/server/parameter.gotmpl +++ /dev/null @@ -1,715 +0,0 @@ -{{ define "bindprimitiveparam" }}{{/* an empty test definition to test template repo dependencies resolution - DO NOT CHANGE THIS */}} -{{ end }} -{{ define "bodyvalidator" }} - {{- if .HasModelBodyParams }} - // validate body object{{/* delegate validation to model object */}} - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - } - {{- else if and .HasSimpleBodyParams .HasModelBodyItems }} - - {{- if or .Schema.HasSliceValidations .Schema.Items.HasValidations }} - - // validate array of body objects - {{- end }} - - {{- if .Schema.HasSliceValidations }} - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - {{ template "sliceparamvalidator" . }} - {{- end }} - - {{- if and .Schema.Items.HasValidations (not (or .Schema.Items.IsInterface .Schema.Items.IsStream)) }} - for {{ .IndexVar }} := range body { - {{- if .Schema.Items.IsNullable }} - if body[{{ .IndexVar }}] == nil { - {{- if .Schema.Items.Required }} - res = append(res, errors.Required({{ .Child.Path }}, {{ printf "%q" .Child.Location }}, body[{{ .IndexVar }}])) - break - {{- else }} - continue - {{- end }} - } - {{- end }} - if err := body[{{ .IndexVar }}].Validate(route.Formats); err != nil { - res = append(res, err) - break - } - } - - {{- if not .Schema.HasSliceValidations }} - - if len(res) == 0 { - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - } - {{- end }} - {{- else }} - // no validation for items in this slice - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - {{- end }} - - {{- else if and .HasSimpleBodyParams .HasModelBodyMap }} - - {{- if and .Schema.HasValidations (not (or .Schema.AdditionalProperties.IsInterface .Schema.AdditionalProperties.IsStream)) }} - // validate map of body objects - for {{ .KeyVar }} := range body { - {{- if .Schema.AdditionalProperties.Required }} - if err := validate.Required({{ if .Child.Path }}{{ .Child.Path }}{{ else }}""{{ end }}, {{ printf "%q" .Child.Location }}, {{ if not .IsAnonymous }}{{ .Schema.GoType }}({{ end }}body[{{ .KeyVar }}]{{ if not .IsAnonymous }}){{ end }}); err != nil { - return err - } - {{- end }} - {{- if and .Schema.AdditionalProperties.IsNullable (not .IsMapNullOverride) }} - if body[{{ .KeyVar }}] == nil { - {{- if .Schema.AdditionalProperties.Required }} - res = append(res, errors.Required({{ .Path }}, {{ printf "%q" .Location }}, body[{{ .KeyVar }}])) - break - {{- else }} - continue - {{- end }} - } - {{- end }} - if val , ok :=body[{{ .KeyVar }}]; ok { - {{- if and .IsNullable (not .IsMapNullOverride) }} - if val != nil { - {{- end }} - if err := val.Validate(route.Formats); err != nil { - res = append(res, err) - break - } - {{- if and .IsNullable (not .IsMapNullOverride) }} - } - {{- end }} - } - } - - if len(res) == 0 { - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - } - {{- else }} - // no validation for this map - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - {{- end }} - {{- else if .HasSimpleBodyParams }} - {{- if and (not .IsArray) (not .IsMap) .Schema.HasValidations }} - // validate inline body - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - if err := {{ .ReceiverName }}.validate{{ pascalize .ID }}Body(route.Formats); err != nil { - res = append(res, err) - } - {{- else if and (or .IsArray .IsMap) .Schema.HasValidations }} - // validate inline body {{ if .IsArray }}array{{ else }}map{{ end }} - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - if err := {{ .ReceiverName }}.validate{{ pascalize .ID }}Body(route.Formats); err != nil { - res = append(res, err) - } - {{- else }} - // no validation required on inline body - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - {{- end}} - {{- else }} - {{- if .IsInterface }} - // no validation on generic interface - {{ .ReceiverName }}.{{ pascalize .Name }} = {{ if and (not .Schema.IsBaseType) .IsNullable }}&{{ end }}body - {{- end }} - {{- end }} -{{- end }} - -{{ define "sliceparamvalidator"}} - {{- if or .MinItems .MaxItems }} - - {{ camelize .Name }}Size := int64(len({{ if and (not .IsArray) (not .HasDiscriminator) (not .IsInterface) (not .IsStream) .IsNullable }}*{{ end }}{{ if and .Child (not (hasPrefix .ValueExpression "o.")) }}{{ .Child.ValueExpression }}C{{ else }}{{ .ValueExpression }}{{ end }})) - {{- end }} - {{- if .MinItems }} - -// {{ .ItemsDepth }}minItems: {{ .MinItems }} -if err := validate.MinItems({{ .Path }}, {{ printf "%q" .Location }}, {{ camelize .Name }}Size, {{ .MinItems }}); err != nil { - return err -} - {{- end }} - {{- if .MaxItems }} - -// {{ .ItemsDepth }}maxItems: {{ .MaxItems }} -if err := validate.MaxItems({{ .Path }}, {{ printf "%q" .Location }}, {{ camelize .Name }}Size, {{.MaxItems}}); err != nil { - return err -} - {{- end }} - {{- if .UniqueItems }} - -// {{ .ItemsDepth }}uniqueItems: true -if err := validate.UniqueItems({{ .Path }}, {{ printf "%q" .Location }}, {{ if and (not .IsArray) (not .HasDiscriminator) (not .IsInterface) (not .IsStream) .IsNullable }}*{{ end }}{{ if and .Child (not ( hasPrefix .ValueExpression "o." )) }}{{ .Child.ValueExpression }}C{{ else }}{{ .ValueExpression }}{{ end }}); err != nil { - return err -} - {{- end }} - {{- if .Enum }} - -// {{ .ItemsDepth }}Enum: {{ .Enum }} -if err := validate.EnumCase( - {{- .Path }}, {{ printf "%q" .Location }}, - {{- if and (not .IsArray) (not .HasDiscriminator) (not .IsInterface) (not .IsStream) .IsNullable }}*{{ end -}} - {{- if .Child -}} - {{- if not ( hasPrefix .ValueExpression "o." ) -}} - {{- .Child.ValueExpression }}C{{- if .IsCustomFormatter }}.String(){{ end -}} - {{- else -}} - {{- .ValueExpression -}}{{- if .Child.IsCustomFormatter }}.String(){{ end -}} - {{- end -}} - {{- end -}}, - {{- printf "%#v" .Enum -}}, {{ if .IsEnumCI }}false{{ else }}true{{ end }}); err != nil { - return err - } - {{- end }} -{{- end }} - -{{- define "childvalidator" }} - {{- if .Converter }} - {{- if ne .SwaggerFormat "" }} - // {{ .ItemsDepth }}Format: {{ printf "%q" .SwaggerFormat }} - {{- end }} - {{ varname .ValueExpression }}, err := {{ .Converter }}({{ varname .ValueExpression }}V) - if err != nil { - return errors.InvalidType({{ .Path }}, {{ printf "%q" .Location }}, "{{ .GoType }}", {{ varname .ValueExpression }}) - } - {{- else if and .IsCustomFormatter (not .SkipParse) }}{{/* parsing is skipped for simple body items */}} - // {{ .ItemsDepth }}Format: {{ printf "%q" .SwaggerFormat }} - value, err := formats.Parse({{ printf "%q" .SwaggerFormat }},{{ varname .ValueExpression }}V) - if err != nil { - return errors.InvalidType({{ .Path }}, {{ printf "%q" .Location }}, "{{ .GoType }}", value) - } - {{ varname .ValueExpression }} := *(value.(*{{.GoType}})) - {{- else if and .IsComplexObject .HasValidations }}{{/* dedicated to nested body params */}} - {{ varname .ValueExpression }} := {{ varname .ValueExpression }}V - if err := {{ .ValueExpression }}.Validate(formats) ; err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName({{ .Path }}) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName({{ .Path }}) - } - return err - } - {{- else }} - {{ varname .ValueExpression }} := {{ varname .ValueExpression }}V - {{- end }} - {{ template "propertyparamvalidator" . }} -{{- end }} - -{{- define "mapparamvalidator" }} - {{- if and .Child.HasValidations (not (or .Child.IsInterface .Child.IsStream)) }} - - // validations for map - {{- else }} - - // map has no validations: copying all elements - {{- end }} - {{ varname .Child.ValueExpression }}R := make({{ .GoType }},len({{ .Child.ValueExpression }}C)) - for {{ .KeyVar }}, {{ .Child.ValueExpression }}V := range {{ .Child.ValueExpression}}C { - {{- if .Child.IsArray }} - {{ .Child.Child.ValueExpression }}C := {{ varname .Child.ValueExpression }}V - {{- if .Child.HasSliceValidations }} - {{- template "sliceparamvalidator" .Child }} - {{- end }} - {{- template "sliceparambinder" .Child }} - {{- else if .Child.IsMap }} - {{ .Child.Child.ValueExpression }}C := {{ varname .Child.ValueExpression }}V - {{ template "mapparamvalidator" .Child }} - {{- else }} - {{- if and .Child.IsNullable }} - if {{ varname .Child.ValueExpression }}V == nil { - {{- if .Child.Required }} - return errors.Required({{ .Child.Path }}, {{ printf "%q" .Child.Location }}, {{ varname .Child.ValueExpression }}V) - {{- else }} - continue - {{- end }} - } - {{- end }} - {{- template "childvalidator" .Child }} - {{- end }} - {{ varname .Child.ValueExpression }}R[{{.KeyVar}}] = {{ varname .Child.ValueExpression }}{{ if or .Child.IsArray .Child.IsMap}}IR{{end}} - } -{{- end }} - -{{- define "propertyparamvalidator" }} - {{- if .IsPrimitive }} - {{ template "validationPrimitive" . }} - {{- end }} - {{- if and .IsCustomFormatter (not .IsStream) (not .IsBase64) }} - -if err := validate.FormatOf({{.Path}}, "{{.Location}}", "{{.SwaggerFormat}}", {{ .ValueExpression}}.String(), formats); err != nil { - return err -} - {{- end }} - {{- if .IsArray }}{{/* slice validations */}} - {{ template "sliceparamvalidator" . }} - {{- else if .IsMap }} - {{ .Child.ValueExpression }}C := {{ varname .Child.ValueExpression }}V - {{ template "mapparamvalidator" . }} - {{- end }} -{{- end }} - -{{ define "sliceparambinder" }} -var {{ varname .Child.ValueExpression }}R {{ .GoType }} -for {{ if .Child.NeedsIndex }}{{ .IndexVar }}{{ else }}_{{ end }}, {{ varname .Child.ValueExpression }}V := range {{ varname .Child.ValueExpression }}C { - {{- if .Child.IsArray }}{{/* recursive resolution of arrays in params */}} - {{- if not .Child.SkipParse }} - // {{ .Child.ItemsDepth }}CollectionFormat: {{ .Child.CollectionFormat }} - {{- end }} - {{ .Child.Child.ValueExpression }}C := {{ if .Child.SkipParse }}{{ varname .Child.ValueExpression }}V{{ else }}swag.SplitByFormat({{ varname .Child.ValueExpression }}V, {{ printf "%q" .Child.CollectionFormat }}){{ end }} - {{- if .Child.HasSliceValidations }} - {{- template "sliceparamvalidator" .Child }} - {{- end }} - if len({{ varname .Child.Child.ValueExpression }}C) > 0 { - {{ template "sliceparambinder" .Child }} - {{ varname .Child.ValueExpression }}R = append({{ varname .Child.ValueExpression }}R, {{ varname .Child.ValueExpression }}{{ if or .Child.IsArray .Child.IsMap }}IR{{end}}) - } - {{- else if .Child.IsMap }}{{/* simple map in items (possible with body params)*/}} - {{ .Child.Child.ValueExpression }}C := {{ varname .Child.ValueExpression }}V - {{- template "mapparamvalidator" .Child }} - {{ varname .Child.ValueExpression }}R = append({{ varname .Child.ValueExpression }}R, {{ varname .Child.ValueExpression }}{{ if or .Child.IsArray .Child.IsMap }}IR{{end}}) - {{- else }}{{/* non-array && non-map type in items */}} - {{- if and .Child.IsNullable (not .IsMapNullOverride) }} - if {{ varname .Child.ValueExpression }}V == nil { - {{- if .Child.Required }} - return errors.Required({{ .Child.Path }}, {{ printf "%q" .Child.Location }}, {{ varname .Child.ValueExpression }}V) - {{- else }} - continue - {{- end }} - } - {{- end }} - {{- template "childvalidator" .Child }} - {{ varname .Child.ValueExpression }}R = append({{ varname .Child.ValueExpression }}R, {{ varname .Child.ValueExpression }}{{ if or .Child.IsArray .Child.IsMap }}IR{{end}}) - {{- end }} -} -{{ end }} -// Code generated by go-swagger; DO NOT EDIT. - - -{{ if .Copyright -}}// {{ comment .Copyright -}}{{ end }} - - -package {{ .Package }} - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/security" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - {{ imports .DefaultImports }} - {{ imports .Imports }} -) - -{{- if .HasFormParams }} - -// {{ pascalize .Name }}MaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var {{ pascalize .Name }}MaxParseMemory int64 = 32 << 20 -{{- end }} - -// New{{ pascalize .Name }}Params creates a new {{ pascalize .Name }}Params object -{{- if .Params.HasSomeDefaults }} -// with the default values initialized. -{{- else }} -// -// There are no default values defined in the spec. -{{- end }} -func New{{ pascalize .Name }}Params() {{ pascalize .Name }}Params { -{{ if .Params.HasSomeDefaults }} - var ( - // initialize parameters with default values - {{ range .Params }} - {{ if .HasDefault -}} - {{ if not .IsFileParam }}{{ varname .ID}}Default = - {{- if and .IsPrimitive .IsCustomFormatter (not (stringContains .Zero "(\"" )) }}{{ .Zero }}{{/* strfmt type initializer requires UnmarshalText(), e.g. Date, Datetime, Duration */}} - {{- else if and .IsPrimitive .IsCustomFormatter (stringContains .Zero "(\"" ) }}{{.GoType}}({{- printf "%#v" .Default }}){{/* strfmt type initializer takes string */}} - {{- else if and .IsPrimitive (not .IsCustomFormatter) -}}{{.GoType}}({{- printf "%#v" .Default }}){{/* regular go primitive type initializer */}} - {{- else if .IsArray -}}{{- /* Do not initialize from possible defaults in nested arrays */ -}} - {{- if and .Child.IsPrimitive .Child.IsCustomFormatter }}{{ .Zero }}{{/* initialization strategy with UnmarshalText() */}} - {{- else if .Child.IsArray -}}{{ .Zero }}{{/* initialization strategy with json.Unmarshal() */}} - {{- else if and .Child.IsPrimitive (not .Child.IsCustomFormatter) -}}{{.GoType}}{{- arrayInitializer .Default }}{{/* regular go primitive type initializer: simple slice initializer */}} - {{- else }}{{ printf "%#v" .Default }}{{/* all other cases (e.g. schema) [should not occur] */}} - {{- end }} - {{- else }}{{ printf "%#v" .Default }}{{/* case .Schema */}} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - ) - -{{ range .Params }}{{ if .HasDefault -}}{{- /* carry out UnmarshalText initialization strategy */ -}} - {{ if and .IsPrimitive .IsCustomFormatter (not (stringContains .Zero "(\"")) }}{{ varname .ID}}Default.UnmarshalText([]byte({{ printf "%q" .Default }})) - {{ else if .IsArray -}} - {{ if or ( and .Child.IsPrimitive .Child.IsCustomFormatter ) .Child.IsArray -}} - if err := json.Unmarshal([]byte(`{{printf "%s" (json .Default)}}`), &{{ varname .ID }}Default); err != nil { - // panics if specification is invalid - msg := fmt.Sprintf("invalid default value for parameter {{ varname .ID }}: %v",err) - panic(msg) - } - {{ end -}} - {{- end }} - {{ end -}} -{{- end }} -{{ end }} - return {{ pascalize .Name }}Params{ {{ range .Params }}{{ if .HasDefault }} - {{ pascalize .ID}}: {{ if and (not .IsArray) (not .HasDiscriminator) (not .IsInterface) (not .IsStream) .IsNullable }}&{{ end }}{{ varname .ID }}Default, - {{ end }}{{ end }} } -} - -// {{ pascalize .Name }}Params contains all the bound params for the {{ humanize .Name }} operation -// typically these are obtained from a http.Request -// -// swagger:parameters {{ .Name }} -type {{ pascalize .Name }}Params struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - {{ range .Params }}/*{{ if .Description }}{{ blockcomment .Description }}{{ end }}{{ if .Required }} - Required: true{{ end }}{{ if .Maximum }} - Maximum: {{ if .ExclusiveMaximum }}< {{ end }}{{ .Maximum }}{{ end }}{{ if .Minimum }} - Minimum: {{ if .ExclusiveMinimum }}> {{ end }}{{ .Minimum }}{{ end }}{{ if .MultipleOf }} - Multiple Of: {{ .MultipleOf }}{{ end }}{{ if .MaxLength }} - Max Length: {{ .MaxLength }}{{ end }}{{ if .MinLength }} - Min Length: {{ .MinLength }}{{ end }}{{ if .Pattern }} - Pattern: {{ .Pattern }}{{ end }}{{ if .MaxItems }} - Max Items: {{ .MaxItems }}{{ end }}{{ if .MinItems }} - Min Items: {{ .MinItems }}{{ end }}{{ if .UniqueItems }} - Unique: true{{ end }}{{ if .Location }} - In: {{ .Location }}{{ end }}{{ if .CollectionFormat }} - Collection Format: {{ .CollectionFormat }}{{ end }}{{ if .HasDefault }} - Default: {{ printf "%#v" .Default }}{{ end }} - */ - {{ if not .Schema }}{{ pascalize .ID }} {{ if and (not .IsArray) (not .HasDiscriminator) (not .IsInterface) (not .IsStream) .IsNullable }}*{{ end }}{{.GoType}}{{ else }}{{ pascalize .Name }} {{ if and (not .Schema.IsBaseType) .IsNullable (not .Schema.IsStream) }}*{{ end }}{{.GoType}}{{ end }} - {{ end}} -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with New{{ pascalize .Name }}Params() beforehand. -func ({{ .ReceiverName }} *{{ pascalize .Name }}Params) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - {{ .ReceiverName }}.HTTPRequest = r - -{{- if .HasQueryParams }} - - qs := runtime.Values(r.URL.Query()) -{{- end }} - -{{- if .HasFormParams }} - - if err := r.ParseMultipartForm({{ pascalize .Name }}MaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400,"%v",err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400,"%v",err) - } - } - {{- if .HasFormValueParams }} - fds := runtime.Values(r.Form) - {{- end }} -{{- end }} -{{ range .Params }} - {{- if not .IsArray }} - {{- if .IsQueryParam }} - - q{{ pascalize .Name }}, qhk{{ pascalize .Name }}, _ := qs.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(q{{ pascalize .Name }}, qhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- else if .IsPathParam }} - - r{{ pascalize .Name }}, rhk{{ pascalize .Name }}, _ := route.Params.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(r{{ pascalize .Name }}, rhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- else if .IsHeaderParam }} - - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(r.Header[http.CanonicalHeaderKey({{ .Path }})], true, route.Formats); err != nil { - res = append(res, err) - } - {{- else if .IsFormParam }} - {{- if .IsFileParam }} - - {{ camelize .Name }}, {{ camelize .Name }}Header, err := r.FormFile({{ .Path }}) - if err != nil {{ if .IsNullable }}&& err != http.ErrMissingFile{{ end }}{ - res = append(res, errors.New(400, "reading file %q failed: %v", {{ printf "%q" (camelize .Name) }}, err)) - {{- if .IsNullable }} - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - {{- end }} - } else if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}({{ camelize .Name }}, {{ camelize .Name }}Header); err != nil { - {{- if .Required }} - // Required: true - {{- end }} - res = append(res, err) - } else { - {{ .ReceiverName }}.{{ pascalize .Name }} = &runtime.File{Data: {{ camelize .Name }}, Header: {{ camelize .Name }}Header} - } - {{- else }} - - fd{{ pascalize .Name }}, fdhk{{ pascalize .Name }}, _ := fds.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(fd{{ pascalize .Name }}, fdhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- end }} - {{- end }} - {{- else if .IsArray }} - {{- if .IsQueryParam }} - - q{{ pascalize .Name }}, qhk{{ pascalize .Name }}, _ := qs.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(q{{ pascalize .Name }}, qhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- else if .IsPathParam }} - - r{{ pascalize .Name }}, rhk{{ pascalize .Name }}, _ := route.Params.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(r{{ pascalize .Name }}, rhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- else if .IsHeaderParam }} - - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(r.Header[http.CanonicalHeaderKey({{ .Path }})], true, route.Formats); err != nil { - res = append(res, err) - } - {{- else if and .IsFormParam }} - - fd{{ pascalize .Name }}, fdhk{{ pascalize .Name }}, _ := fds.GetOK({{ .Path }}) - if err := {{ .ReceiverName }}.bind{{ pascalize .ID }}(fd{{ pascalize .Name }}, fdhk{{ pascalize .Name }}, route.Formats); err != nil { - res = append(res, err) - } - {{- end }} - {{- end }} - - {{- if and .IsBodyParam .Schema }} - - if runtime.HasBody(r) { - {{- if .Schema.IsStream }} - {{ .ReceiverName }}.{{ pascalize .Name }} = r.Body - {{- else }} - defer r.Body.Close() - {{- if and .Schema.IsBaseType .Schema.IsExported }} - body, err := {{ toPackageName .ModelsPackage }}.Unmarshal{{ dropPackage .GoType }}{{ if .IsArray }}Slice{{ end }}(r.Body, route.Consumer) - if err != nil { - {{- if .Required }} - if err == io.EOF { - err = errors.Required({{ .Path }}, {{ printf "%q" .Location }}, "") - } - {{- end }} - res = append(res, err) - {{- else }} - var body {{ .GoType }} - if err := route.Consumer.Consume(r.Body, &body); err != nil { - {{- if .Required }} - if err == io.EOF { - res = append(res, errors.Required({{ printf "%q" (camelize .Name) }}, {{ printf "%q" .Location }}, "")) - } else { - {{- end }} - res = append(res, errors.NewParseError({{ printf "%q" (camelize .Name) }}, {{ printf "%q" .Location }}, "", err)) - {{- if .Required }} - } - {{- end }} - {{- end }} - } else { - {{- template "bodyvalidator" . }} - } - {{- end }} - } - {{- if .Required }} else { - res = append(res, errors.Required({{ printf "%q" (camelize .Name) }}, {{ printf "%q" .Location }}, "")) - } - {{- end }} - {{- end }} -{{- end }} - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -{{- $className := (pascalize .Name) }} -{{ range .Params }} - {{- if .IsFileParam }} -// bind{{ pascalize .ID }} binds file parameter {{ .ID }}. -// -// The only supported validations on files are MinLength and MaxLength -func ({{ .ReceiverName }} *{{ $className }}Params) bind{{ pascalize .ID }}(file multipart.File, header *multipart.FileHeader) error { - {{- if or .MinLength .MaxLength }} - size, _ := file.Seek(0, io.SeekEnd) - file.Seek(0, io.SeekStart) - {{- end }} - {{- if .MinLength}} - if size < {{.MinLength}} { - return errors.ExceedsMinimum({{ .Path }}, {{ printf "%q" .Location }}, {{ .MinLength }}, false, size) - } - {{- end }} - {{- if .MaxLength}} - if size > {{.MaxLength}} { - return errors.ExceedsMaximum({{ .Path }}, {{ printf "%q" .Location }}, {{ .MaxLength }}, false, size) - } - {{- end }} - return nil -} - {{- else if not .IsBodyParam }} - {{- if or .IsPrimitive .IsCustomFormatter }} - -// bind{{ pascalize .ID }} binds and validates parameter {{ .ID }} from {{ .Location }}. -func ({{ .ReceiverName }} *{{ $className }}Params) bind{{ pascalize .ID }}(rawData []string, hasKey bool, formats strfmt.Registry) error { - {{- if and (not .IsPathParam) .Required }} - if !hasKey { - return errors.Required({{ .Path }}, {{ printf "%q" .Location }}, rawData) - } - {{- end }} - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: {{ .Required }} - {{- if .IsQueryParam }} - // AllowEmptyValue: {{ .AllowEmptyValue }} - {{- end }} - {{- if .IsPathParam }} - // Parameter is provided by construction from the route - {{- end }} - - {{- if and (not .IsPathParam) .Required (not .AllowEmptyValue) }} - - if err := validate.RequiredString({{ .Path }}, {{ printf "%q" .Location }}, raw); err != nil { - return err - } - {{- else if and ( not .IsPathParam ) (or (not .Required) .AllowEmptyValue) }} - - if raw == "" { // empty values pass all other validations - {{- if .HasDefault }} - // Default values have been previously initialized by New{{ $className }}Params() - {{- end }} - return nil - } - {{- end }} - - {{- if .Converter }} - - value, err := {{ .Converter }}(raw) - if err != nil { - return errors.InvalidType({{ .Path }}, {{ printf "%q" .Location }}, {{ printf "%q" .GoType }}, raw) - } - {{ .ValueExpression }} = {{ if .IsNullable }}&{{ end }}value - {{- else if .IsCustomFormatter }} - - // Format: {{ .SwaggerFormat }} - value, err := formats.Parse({{ printf "%q" .SwaggerFormat }}, raw) - if err != nil { - return errors.InvalidType({{ .Path }}, {{ printf "%q" .Location }}, {{ printf "%q" .GoType }}, raw) - } - {{ .ValueExpression }} = {{ if or .IsArray .HasDiscriminator .IsFileParam .IsStream (not .IsNullable) }}*{{ end }}(value.(*{{ .GoType }})) - {{- else}} - {{ .ValueExpression }} = {{ if .IsNullable }}&{{ end }}raw - {{- end }} - - {{- if .HasValidations }} - - if err := {{ .ReceiverName }}.validate{{ pascalize .ID }}(formats); err != nil { - return err - } - {{- end }} - - return nil -} - {{- else if .IsArray }} - -// bind{{ pascalize .ID }} binds and validates array parameter {{ .ID }} from {{ .Location }}. -// -// Arrays are parsed according to CollectionFormat: "{{ .CollectionFormat }}" (defaults to "csv" when empty). -func ({{ .ReceiverName }} *{{ $className }}Params) bind{{ pascalize .ID }}(rawData []string, hasKey bool, formats strfmt.Registry) error { - {{- if .Required }} - if !hasKey { - return errors.Required({{ .Path }}, {{ printf "%q" .Location }}, rawData) - } - {{- end }} - {{- if eq .CollectionFormat "multi" }} - // CollectionFormat: {{ .CollectionFormat }} - {{ varname .Child.ValueExpression }}C := rawData - {{- else }} - var qv{{ pascalize .Name }} string - if len(rawData) > 0 { - qv{{ pascalize .Name }} = rawData[len(rawData) - 1] - } - - // CollectionFormat: {{ .CollectionFormat }} - {{ varname .Child.ValueExpression }}C := swag.SplitByFormat(qv{{ pascalize .Name }}, {{ printf "%q" .CollectionFormat }}) - {{- end }} - {{- if and .Required (not .AllowEmptyValue) }} - if len({{ varname .Child.ValueExpression }}C) == 0 { - return errors.Required({{ .Path }}, {{ printf "%q" .Location }}, {{ varname .Child.ValueExpression }}C) - } - {{- else }} - if len({{ varname .Child.ValueExpression }}C) == 0 { - {{- if .HasDefault }} - // Default values have been previously initialized by New{{ $className }}Params() - {{- end }} - return nil - } {{- end }} - {{ template "sliceparambinder" . }} - {{ .ValueExpression }} = {{ varname .Child.ValueExpression }}R - {{- if .HasSliceValidations }} - if err := {{ .ReceiverName }}.validate{{ pascalize .ID }}(formats); err != nil { - return err - } - {{- end }} - - return nil -} - {{- end }} - - {{- if or (and (not .IsArray) .HasValidations) (and .IsArray .HasSliceValidations) }} - -// validate{{ pascalize .ID }} carries on validations for parameter {{ .ID }} -func ({{ .ReceiverName }} *{{ $className }}Params) validate{{ pascalize .ID }}(formats strfmt.Registry) error { - {{ template "propertyparamvalidator" . }} - return nil -} - {{- end }} - - {{- else if .IsBodyParam }}{{/* validation method for inline body parameters with validations */}} - {{- if and .HasSimpleBodyParams (not .HasModelBodyItems) (not .HasModelBodyMap) }} - {{- if .Schema.HasValidations }} - -// validate{{ pascalize .ID }}Body validates an inline body parameter -func ({{ .ReceiverName }} *{{ $className }}Params) validate{{ pascalize .ID }}Body(formats strfmt.Registry) error { - {{- if .IsArray }} - {{- if .HasSliceValidations }} - {{- template "sliceparamvalidator" . }} - {{- end }} - {{- if .Child.HasValidations }} - {{ varname .Child.ValueExpression }}C := {{ .ValueExpression }} - {{ template "sliceparambinder" . }} - {{ .ValueExpression }} = {{ varname .Child.ValueExpression }}R - {{- end }} - {{- else if .IsMap }} - {{ varname .Child.ValueExpression }}C := {{ .ValueExpression }} - {{ template "mapparamvalidator" . }} - {{ .ValueExpression }} = {{ varname .Child.ValueExpression }}R - {{- else }} - {{ template "propertyparamvalidator" . }} - {{- end }} - return nil -} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/go.mod b/go.mod index 75cf877b..fc1256a7 100644 --- a/go.mod +++ b/go.mod @@ -1,33 +1,31 @@ module github.com/haproxytech/dataplaneapi -go 1.25 +go 1.26 require ( github.com/GehirnInc/crypt v0.0.0-20230320061759-8cc1b52080c5 github.com/KimMachineGun/automemlimit v0.7.4 github.com/Masterminds/semver v1.5.0 - github.com/aws/aws-sdk-go-v2 v1.39.2 - github.com/aws/aws-sdk-go-v2/config v1.31.12 - github.com/aws/aws-sdk-go-v2/credentials v1.18.16 - github.com/aws/aws-sdk-go-v2/service/autoscaling v1.56.0 - github.com/aws/aws-sdk-go-v2/service/ec2 v1.254.1 + github.com/Masterminds/semver/v3 v3.5.0 + github.com/aws/aws-sdk-go-v2 v1.41.7 + github.com/aws/aws-sdk-go-v2/config v1.32.17 + github.com/aws/aws-sdk-go-v2/credentials v1.19.16 + github.com/aws/aws-sdk-go-v2/service/autoscaling v1.66.2 + github.com/aws/aws-sdk-go-v2/service/ec2 v1.303.0 github.com/docker/go-units v0.5.0 github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0 github.com/fsnotify/fsnotify v1.9.0 github.com/getkin/kin-openapi v0.133.0 - github.com/go-openapi/errors v0.22.6 - github.com/go-openapi/loads v0.23.2 + github.com/go-chi/chi/v5 v5.3.0 + github.com/go-openapi/errors v0.22.7 github.com/go-openapi/runtime v0.29.0 - github.com/go-openapi/spec v0.22.3 - github.com/go-openapi/strfmt v0.25.0 - github.com/go-openapi/swag v0.25.4 - github.com/go-openapi/swag/cmdutils v0.25.4 - github.com/go-openapi/swag/mangling v0.25.4 - github.com/go-openapi/validate v0.25.1 + github.com/go-openapi/strfmt v0.26.2 + github.com/go-openapi/swag/cmdutils v0.26.0 + github.com/go-openapi/swag/netutils v0.26.0 github.com/google/go-cmp v0.7.0 github.com/google/renameio v1.0.1 github.com/google/uuid v1.6.0 - github.com/haproxytech/client-native/v6 v6.3.0 + github.com/haproxytech/client-native/v6 v6.3.8 github.com/jessevdk/go-flags v1.6.1 github.com/joho/godotenv v1.5.1 github.com/json-iterator/go v1.1.12 @@ -36,6 +34,7 @@ require ( github.com/libdns/azure v0.5.0 github.com/libdns/cloudflare v0.2.1 github.com/libdns/cloudns v1.1.0 + github.com/libdns/desec v1.0.1 github.com/libdns/digitalocean v0.0.0-20250606071607-dfa7af5c2e31 github.com/libdns/gandi v1.1.0 github.com/libdns/godaddy v1.1.0 @@ -51,42 +50,51 @@ require ( github.com/libdns/ovh v1.1.0 github.com/libdns/porkbun v1.1.0 github.com/libdns/rfc2136 v1.0.1 + github.com/libdns/route53 v1.6.0 github.com/libdns/scaleway v0.2.3 github.com/libdns/vultr/v2 v2.0.4 github.com/maruel/panicparse/v2 v2.5.0 + github.com/miekg/dns v1.1.64 github.com/nathanaelle/syslog5424/v2 v2.0.5 + github.com/oapi-codegen/runtime v1.4.1 github.com/rs/cors v1.11.1 github.com/rubyist/circuitbreaker v2.2.1+incompatible github.com/shirou/gopsutil v3.21.11+incompatible github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.11.1 go.uber.org/automaxprocs v1.6.0 - golang.org/x/net v0.49.0 - golang.org/x/sys v0.40.0 + golang.org/x/mod v0.36.0 + golang.org/x/net v0.55.0 + golang.org/x/sys v0.45.0 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( cloud.google.com/go/auth v0.16.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.6.0 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 // indirect - github.com/aws/smithy-go v1.23.0 // indirect + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 // indirect + github.com/aws/aws-sdk-go-v2/service/route53 v1.62.7 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect + github.com/aws/smithy-go v1.25.1 // indirect github.com/boombuler/barcode v1.0.1 // indirect github.com/cenk/backoff v2.2.1+incompatible // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/digitalocean/godo v1.148.0 // indirect github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect @@ -94,18 +102,22 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/analysis v0.24.2 // indirect - github.com/go-openapi/jsonpointer v0.22.4 // indirect - github.com/go-openapi/jsonreference v0.21.4 // indirect - github.com/go-openapi/swag/conv v0.25.4 // indirect - github.com/go-openapi/swag/fileutils v0.25.4 // indirect - github.com/go-openapi/swag/jsonname v0.25.4 // indirect - github.com/go-openapi/swag/jsonutils v0.25.4 // indirect - github.com/go-openapi/swag/loading v0.25.4 // indirect - github.com/go-openapi/swag/netutils v0.25.4 // indirect - github.com/go-openapi/swag/stringutils v0.25.4 // indirect - github.com/go-openapi/swag/typeutils v0.25.4 // indirect - github.com/go-openapi/swag/yamlutils v0.25.4 // indirect + github.com/go-openapi/analysis v0.25.0 // indirect + github.com/go-openapi/jsonpointer v0.23.1 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/loads v0.23.3 // indirect + github.com/go-openapi/spec v0.22.4 // indirect + github.com/go-openapi/swag v0.26.0 // indirect + github.com/go-openapi/swag/conv v0.26.0 // indirect + github.com/go-openapi/swag/fileutils v0.26.0 // indirect + github.com/go-openapi/swag/jsonname v0.26.0 // indirect + github.com/go-openapi/swag/jsonutils v0.26.0 // indirect + github.com/go-openapi/swag/loading v0.26.0 // indirect + github.com/go-openapi/swag/mangling v0.26.0 // indirect + github.com/go-openapi/swag/stringutils v0.26.0 // indirect + github.com/go-openapi/swag/typeutils v0.26.0 // indirect + github.com/go-openapi/swag/yamlutils v0.26.0 // indirect + github.com/go-openapi/validate v0.25.2 // indirect github.com/go-resty/resty/v2 v2.16.5 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/gofrs/flock v0.13.0 // indirect @@ -114,8 +126,10 @@ require ( github.com/google/s2a-go v0.1.9 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect github.com/googleapis/gax-go/v2 v2.14.1 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/haproxytech/client-native/v5 v5.1.15 // indirect github.com/haproxytech/go-logger v1.1.0 // indirect - github.com/haproxytech/go-method-gen v0.1.1 // indirect + github.com/haproxytech/go-method-gen v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -125,14 +139,13 @@ require ( github.com/lestrrat-go/strftime v1.1.1 // indirect github.com/linode/linodego v1.56.0 // indirect github.com/mailru/easyjson v0.9.1 // indirect - github.com/miekg/dns v1.1.64 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect - github.com/oklog/ulid v1.3.1 // indirect + github.com/oklog/ulid/v2 v2.1.1 // indirect github.com/ovh/go-ovh v1.7.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect @@ -148,25 +161,22 @@ require ( github.com/vultr/govultr/v3 v3.20.0 // indirect github.com/woodsbury/decimal128 v1.4.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.mongodb.org/mongo-driver v1.17.7 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect - go.opentelemetry.io/otel v1.38.0 // indirect - go.opentelemetry.io/otel/metric v1.38.0 // indirect - go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/otel v1.39.0 // indirect + go.opentelemetry.io/otel/metric v1.39.0 // indirect + go.opentelemetry.io/otel/trace v1.39.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.47.0 // indirect - golang.org/x/mod v0.32.0 // indirect - golang.org/x/oauth2 v0.30.0 // indirect - golang.org/x/sync v0.19.0 // indirect - golang.org/x/text v0.33.0 // indirect - golang.org/x/time v0.11.0 // indirect - golang.org/x/tools v0.41.0 // indirect + golang.org/x/crypto v0.52.0 // indirect + golang.org/x/oauth2 v0.36.0 // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/text v0.37.0 // indirect + golang.org/x/time v0.15.0 // indirect + golang.org/x/tools v0.45.0 // indirect google.golang.org/api v0.233.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 // indirect - google.golang.org/grpc v1.72.0 // indirect - google.golang.org/protobuf v1.36.6 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/grpc v1.79.3 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - mvdan.cc/gofumpt v0.9.2 // indirect + mvdan.cc/gofumpt v0.10.0 // indirect ) diff --git a/go.sum b/go.sum index e2f97c0e..ff14709b 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ cloud.google.com/go/auth v0.16.1 h1:XrXauHMd30LhQYVRHLGvJiYeczweKQXZxsTbV9TiguU= cloud.google.com/go/auth v0.16.1/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 h1:Gt0j3wceWMwPmiazCa8MzMA0MfhmPIz0Qp0FJ6qcM0U= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0/go.mod h1:Ot/6aikWnKWi4l9QB7qVSwa8iMphQNqkWALMoNT3rzM= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 h1:OVoM452qUFBrX+URdH3VpR299ma4kfom0yB0URYky9g= @@ -26,36 +26,46 @@ github.com/KimMachineGun/automemlimit v0.7.4 h1:UY7QYOIfrr3wjjOAqahFmC3IaQCLWvur github.com/KimMachineGun/automemlimit v0.7.4/go.mod h1:QZxpHaGOQoYvFhv/r4u3U0JTC2ZcOwbSr11UZF46UBM= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/aws/aws-sdk-go-v2 v1.39.2 h1:EJLg8IdbzgeD7xgvZ+I8M1e0fL0ptn/M47lianzth0I= -github.com/aws/aws-sdk-go-v2 v1.39.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY= -github.com/aws/aws-sdk-go-v2/config v1.31.12 h1:pYM1Qgy0dKZLHX2cXslNacbcEFMkDMl+Bcj5ROuS6p8= -github.com/aws/aws-sdk-go-v2/config v1.31.12/go.mod h1:/MM0dyD7KSDPR+39p9ZNVKaHDLb9qnfDurvVS2KAhN8= -github.com/aws/aws-sdk-go-v2/credentials v1.18.16 h1:4JHirI4zp958zC026Sm+V4pSDwW4pwLefKrc0bF2lwI= -github.com/aws/aws-sdk-go-v2/credentials v1.18.16/go.mod h1:qQMtGx9OSw7ty1yLclzLxXCRbrkjWAM7JnObZjmCB7I= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 h1:Mv4Bc0mWmv6oDuSWTKnk+wgeqPL5DRFu5bQL9BGPQ8Y= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9/go.mod h1:IKlKfRppK2a1y0gy1yH6zD+yX5uplJ6UuPlgd48dJiQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 h1:se2vOWGD3dWQUtfn4wEjRQJb1HK1XsNIt825gskZ970= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9/go.mod h1:hijCGH2VfbZQxqCDN7bwz/4dzxV+hkyhjawAtdPWKZA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 h1:6RBnKZLkJM4hQ+kN6E7yWFveOTg8NLPHAkqrs4ZPlTU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9/go.mod h1:V9rQKRmK7AWuEsOMnHzKj8WyrIir1yUJbZxDuZLFvXI= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo= -github.com/aws/aws-sdk-go-v2/service/autoscaling v1.56.0 h1:YO7rat493hVtpBExbcDPKdGzk9eYTtaUrwaFJSWAqLo= -github.com/aws/aws-sdk-go-v2/service/autoscaling v1.56.0/go.mod h1:6vrMqNnS2fpOfZ9tZmIGDWYGTio7+SJ18fql3IwoSBg= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.254.1 h1:7p9bJCZ/b3EJXXARW7JMEs2IhsnI4YFHpfXQfgMh0eg= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.254.1/go.mod h1:M8WWWIfXmxA4RgTXcI/5cSByxRqjgne32Sh0VIbrn0A= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 h1:oegbebPEMA/1Jny7kvwejowCaHz1FWZAQ94WXFNCyTM= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1/go.mod h1:kemo5Myr9ac0U9JfSjMo9yHLtw+pECEHsFtJ9tqCEI8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 h1:5r34CgVOD4WZudeEKZ9/iKpiT6cM1JyEROpXjOcdWv8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9/go.mod h1:dB12CEbNWPbzO2uC6QSWHteqOg4JfBVJOojbAoAUb5I= -github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 h1:A1oRkiSQOWstGh61y4Wc/yQ04sqrQZr1Si/oAXj20/s= -github.com/aws/aws-sdk-go-v2/service/sso v1.29.6/go.mod h1:5PfYspyCU5Vw1wNPsxi15LZovOnULudOQuVxphSflQA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 h1:5fm5RTONng73/QA73LhCNR7UT9RpFH3hR6HWL6bIgVY= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1/go.mod h1:xBEjWD13h+6nq+z4AkqSfSvqRKFgDIQeaMguAJndOWo= -github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 h1:p3jIvqYwUZgu/XYeI48bJxOhvm47hZb5HUQ0tn6Q9kA= -github.com/aws/aws-sdk-go-v2/service/sts v1.38.6/go.mod h1:WtKK+ppze5yKPkZ0XwqIVWD4beCwv056ZbPQNoeHqM8= -github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE= -github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI= +github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE= +github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8= +github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc= +github.com/aws/aws-sdk-go-v2/config v1.32.17 h1:FpL4/758/diKwqbytU0prpuiu60fgXKUWCpDJtApclU= +github.com/aws/aws-sdk-go-v2/config v1.32.17/go.mod h1:OXqUMzgXytfoF9JaKkhrOYsyh72t9G+MJH8mMRaexOE= +github.com/aws/aws-sdk-go-v2/credentials v1.19.16 h1:r3RJBuU7X9ibt8RHbMjWE6y60QbKBiII6wSrXnapxSU= +github.com/aws/aws-sdk-go-v2/credentials v1.19.16/go.mod h1:6cx7zqDENJDbBIIWX6P8s0h6hqHC8Avbjh9Dseo27ug= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 h1:UuSfcORqNSz/ey3VPRS8TcVH2Ikf0/sC+Hdj400QI6U= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23/go.mod h1:+G/OSGiOFnSOkYloKj/9M35s74LgVAdJBSD5lsFfqKg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 h1:GpT/TrnBYuE5gan2cZbTtvP+JlHsutdmlV2YfEyNde0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23/go.mod h1:xYWD6BS9ywC5bS3sz9Xh04whO/hzK2plt2Zkyrp4JuA= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 h1:bpd8vxhlQi2r1hiueOw02f/duEPTMK59Q4QMAoTTtTo= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23/go.mod h1:15DfR2nw+CRHIk0tqNyifu3G1YdAOy68RftkhMDDwYk= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 h1:OQqn11BtaYv1WLUowvcA30MpzIu8Ti4pcLPIIyoKZrA= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24/go.mod h1:X5ZJyfwVrWA96GzPmUCWFQaEARPR7gCrpq2E92PJwAE= +github.com/aws/aws-sdk-go-v2/service/autoscaling v1.66.2 h1:pPd+/Ujqf2+DmPOdB47EN7ox1iC21lu2zlOccUlfHeo= +github.com/aws/aws-sdk-go-v2/service/autoscaling v1.66.2/go.mod h1:b3XHAIEe5I9cmeZ9MLvUqj5DRWcBuh1/hpKDPb7T6KE= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.303.0 h1:qkTLlFVQDSk0tbOqn49pxZjIVY2jy3n0FBXh+PphNkk= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.303.0/go.mod h1:Y95W0Hm6FYLPa6o0hbnJ+sWgmdc4ifcLFjGkdobWVhY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 h1:FLudkZLt5ci0ozzgkVo8BJGwvqNaZbTWb3UcucAateA= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9/go.mod h1:w7wZ/s9qK7c8g4al+UyoF1Sp/Z45UwMGcqIzLWVQHWk= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 h1:pbrxO/kuIwgEsOPLkaHu0O+m4fNgLU8B3vxQ+72jTPw= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23/go.mod h1:/CMNUqoj46HpS3MNRDEDIwcgEnrtZlKRaHNaHxIFpNA= +github.com/aws/aws-sdk-go-v2/service/route53 v1.62.7 h1:twRRMmtSITnt/rrp+D7UDLzE5pKMZe759aalkUdN+OY= +github.com/aws/aws-sdk-go-v2/service/route53 v1.62.7/go.mod h1:ztM1lr+sRoCAI8336ZUvlRPbToue0d3gE/wd6jomSJ8= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 h1:TdJ+HdzOBhU8+iVAOGUTU63VXopcumCOF1paFulHWZc= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.11/go.mod h1:R82ZRExE/nheo0N+T8zHPcLRTcH8MGsnR3BiVGX0TwI= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 h1:7byT8HUWrgoRp6sXjxtZwgOKfhss5fW6SkLBtqzgRoE= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.17/go.mod h1:xNWknVi4Ezm1vg1QsB/5EWpAJURq22uqd38U8qKvOJc= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 h1:+1Kl1zx6bWi4X7cKi3VYh29h8BvsCoHQEQ6ST9X8w7w= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21/go.mod h1:4vIRDq+CJB2xFAXZ+YgGUTiEft7oAQlhIs71xcSeuVg= +github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 h1:F/M5Y9I3nwr2IEpshZgh1GeHpOItExNM9L1euNuh/fk= +github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio= +github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI= +github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= @@ -85,6 +95,8 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ= github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE= +github.com/go-chi/chi/v5 v5.3.0 h1:halUjDxhshgXHMrao5bB8eNBXo/rnzwr8m5m36glehM= +github.com/go-chi/chi/v5 v5.3.0/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto= github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E= github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -95,56 +107,56 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/analysis v0.24.2 h1:6p7WXEuKy1llDgOH8FooVeO+Uq2za9qoAOq4ZN08B50= -github.com/go-openapi/analysis v0.24.2/go.mod h1:x27OOHKANE0lutg2ml4kzYLoHGMKgRm1Cj2ijVOjJuE= -github.com/go-openapi/errors v0.22.6 h1:eDxcf89O8odEnohIXwEjY1IB4ph5vmbUsBMsFNwXWPo= -github.com/go-openapi/errors v0.22.6/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk= -github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4= -github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80= -github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8= -github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4= -github.com/go-openapi/loads v0.23.2 h1:rJXAcP7g1+lWyBHC7iTY+WAF0rprtM+pm8Jxv1uQJp4= -github.com/go-openapi/loads v0.23.2/go.mod h1:IEVw1GfRt/P2Pplkelxzj9BYFajiWOtY2nHZNj4UnWY= +github.com/go-openapi/analysis v0.25.0 h1:EnjAq1yO8wEO9HbPmY8vLPEIkdZuuFhCAKBPvCB7bCs= +github.com/go-openapi/analysis v0.25.0/go.mod h1:5WFTRE43WLkPG9r9OtlMfqkkvUTYLVVCIxLlEpyF8kE= +github.com/go-openapi/errors v0.22.7 h1:JLFBGC0Apwdzw3484MmBqspjPbwa2SHvpDm0u5aGhUA= +github.com/go-openapi/errors v0.22.7/go.mod h1://QW6SD9OsWtH6gHllUCddOXDL0tk0ZGNYHwsw4sW3w= +github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= +github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= +github.com/go-openapi/loads v0.23.3 h1:g5Xap1JfwKkUnZdn+S0L3SzBDpcTIYzZ5Qaag0YDkKQ= +github.com/go-openapi/loads v0.23.3/go.mod h1:NOH07zLajXo8y55hom0omlHWDVVvCwBM/S+csCK8LqA= github.com/go-openapi/runtime v0.29.0 h1:Y7iDTFarS9XaFQ+fA+lBLngMwH6nYfqig1G+pHxMRO0= github.com/go-openapi/runtime v0.29.0/go.mod h1:52HOkEmLL/fE4Pg3Kf9nxc9fYQn0UsIWyGjGIJE9dkg= -github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc= -github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs= -github.com/go-openapi/strfmt v0.25.0 h1:7R0RX7mbKLa9EYCTHRcCuIPcaqlyQiWNPTXwClK0saQ= -github.com/go-openapi/strfmt v0.25.0/go.mod h1:nNXct7OzbwrMY9+5tLX4I21pzcmE6ccMGXl3jFdPfn8= -github.com/go-openapi/swag v0.25.4 h1:OyUPUFYDPDBMkqyxOTkqDYFnrhuhi9NR6QVUvIochMU= -github.com/go-openapi/swag v0.25.4/go.mod h1:zNfJ9WZABGHCFg2RnY0S4IOkAcVTzJ6z2Bi+Q4i6qFQ= -github.com/go-openapi/swag/cmdutils v0.25.4 h1:8rYhB5n6WawR192/BfUu2iVlxqVR9aRgGJP6WaBoW+4= -github.com/go-openapi/swag/cmdutils v0.25.4/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0= -github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4= -github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU= -github.com/go-openapi/swag/fileutils v0.25.4 h1:2oI0XNW5y6UWZTC7vAxC8hmsK/tOkWXHJQH4lKjqw+Y= -github.com/go-openapi/swag/fileutils v0.25.4/go.mod h1:cdOT/PKbwcysVQ9Tpr0q20lQKH7MGhOEb6EwmHOirUk= -github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI= -github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag= -github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA= -github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4 h1:IACsSvBhiNJwlDix7wq39SS2Fh7lUOCJRmx/4SN4sVo= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4/go.mod h1:Mt0Ost9l3cUzVv4OEZG+WSeoHwjWLnarzMePNDAOBiM= -github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s= -github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE= -github.com/go-openapi/swag/mangling v0.25.4 h1:2b9kBJk9JvPgxr36V23FxJLdwBrpijI26Bx5JH4Hp48= -github.com/go-openapi/swag/mangling v0.25.4/go.mod h1:6dxwu6QyORHpIIApsdZgb6wBk/DPU15MdyYj/ikn0Hg= -github.com/go-openapi/swag/netutils v0.25.4 h1:Gqe6K71bGRb3ZQLusdI8p/y1KLgV4M/k+/HzVSqT8H0= -github.com/go-openapi/swag/netutils v0.25.4/go.mod h1:m2W8dtdaoX7oj9rEttLyTeEFFEBvnAx9qHd5nJEBzYg= -github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8= -github.com/go-openapi/swag/stringutils v0.25.4/go.mod h1:GTsRvhJW5xM5gkgiFe0fV3PUlFm0dr8vki6/VSRaZK0= -github.com/go-openapi/swag/typeutils v0.25.4 h1:1/fbZOUN472NTc39zpa+YGHn3jzHWhv42wAJSN91wRw= -github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE= -github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw= -github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc= -github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4= -github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg= -github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls= -github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= -github.com/go-openapi/validate v0.25.1 h1:sSACUI6Jcnbo5IWqbYHgjibrhhmt3vR6lCzKZnmAgBw= -github.com/go-openapi/validate v0.25.1/go.mod h1:RMVyVFYte0gbSTaZ0N4KmTn6u/kClvAFp+mAVfS/DQc= -github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= -github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= +github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= +github.com/go-openapi/spec v0.22.4/go.mod h1:WQ6Ai0VPWMZgMT4XySjlRIE6GP1bGQOtEThn3gcWLtQ= +github.com/go-openapi/strfmt v0.26.2 h1:ysjheCh4i1rmFEo2LanhELDNucNzfWTZhUDKgWWPaFM= +github.com/go-openapi/strfmt v0.26.2/go.mod h1:fXh1e449cyUn2NYuz+wb3wARBUdMl7qPEZwX00nqivY= +github.com/go-openapi/swag v0.26.0 h1:GVDXCmfvhfu1BxiHo8/FA+BbKmhecHnG3varjON5/RI= +github.com/go-openapi/swag v0.26.0/go.mod h1:82g3193sZJRbocs7bNCqGfIgq8pkuwVwCfhKIRlEQF0= +github.com/go-openapi/swag/cmdutils v0.26.0 h1:iowihOcvq7y4egO8cOq0dmfohz6wfeQ63U1EnuhO2TU= +github.com/go-openapi/swag/cmdutils v0.26.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= +github.com/go-openapi/swag/conv v0.26.0 h1:5yGGsPYI1ZCva93U0AoKi/iZrNhaJEjr324YVsiD89I= +github.com/go-openapi/swag/conv v0.26.0/go.mod h1:tpAmIL7X58VPnHHiSO4uE3jBeRamGsFsfdDeDtb5ECE= +github.com/go-openapi/swag/fileutils v0.26.0 h1:WJoPRvsA7QRiiWluowkLJa9jaYR7FCuxmDvnCgaRRxU= +github.com/go-openapi/swag/fileutils v0.26.0/go.mod h1:0WDJ7lp67eNjPMO50wAWYlKvhOb6CQ37rzR7wrgI8Tc= +github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w= +github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M= +github.com/go-openapi/swag/jsonutils v0.26.0 h1:FawFML2iAXsPqmERscuMPIHmFsoP1tOqWkxBaKNMsnA= +github.com/go-openapi/swag/jsonutils v0.26.0/go.mod h1:2VmA0CJlyFqgawOaPI9psnjFDqzyivIqLYN34t9p91E= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0 h1:apqeINu/ICHouqiRZbyFvuDge5jCmmLTqGQ9V95EaOM= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0/go.mod h1:AyM6QT8uz5IdKxk5akv0y6u4QvcL9GWERt0Jx/F/R8Y= +github.com/go-openapi/swag/loading v0.26.0 h1:Apg6zaKhCJurpJer0DCxq99qwmhFddBhaMX7kilDcko= +github.com/go-openapi/swag/loading v0.26.0/go.mod h1:dBxQ/6V2uBaAQdevN18VELE6xSpJWZxLX4txe12JwDg= +github.com/go-openapi/swag/mangling v0.26.0 h1:Du2YC4YLA/Y5m/YKQd7AnY5qq0wRKSFZTTt8ktFaXcQ= +github.com/go-openapi/swag/mangling v0.26.0/go.mod h1:jifS7W9vbg+pw63bT+GI53otluMQL3CeemuyCHKwVx0= +github.com/go-openapi/swag/netutils v0.26.0 h1:CmZp+ZT7HrmFwrC3GdGsXBq2+42T1bjKBapcqVpIs3c= +github.com/go-openapi/swag/netutils v0.26.0/go.mod h1:5iK+Ok3ZohWWex1C50BFTPexi03UaPwjW4Oj8kgrpwo= +github.com/go-openapi/swag/stringutils v0.26.0 h1:qZQngLxs5s7SLijc3N2ZO+fUq2o8LjuWAASSrJuh+xg= +github.com/go-openapi/swag/stringutils v0.26.0/go.mod h1:sWn5uY+QIIspwPhvgnqJsH8xqFT2ZbYcvbcFanRyhFE= +github.com/go-openapi/swag/typeutils v0.26.0 h1:2kdEwdiNWy+JJdOvu5MA2IIg2SylWAFuuyQIKYybfq4= +github.com/go-openapi/swag/typeutils v0.26.0/go.mod h1:oovDuIUvTrEHVMqWilQzKzV4YlSKgyZmFh7AlfABNVE= +github.com/go-openapi/swag/yamlutils v0.26.0 h1:H7O8l/8NJJQ/oiReEN+oMpnGMyt8G0hl460nRZxhLMQ= +github.com/go-openapi/swag/yamlutils v0.26.0/go.mod h1:1evKEGAtP37Pkwcc7EWMF0hedX0/x3Rkvei2wtG/TbU= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.2 h1:5zRca5jw7lzVREKCZVNBpysDNBjj74rBh0N2BGQbSR0= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.2/go.mod h1:XVevPw5hUXuV+5AkI1u1PeAm27EQVrhXTTCPAF85LmE= +github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4= +github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-openapi/validate v0.25.2 h1:12NsfLAwGegqbGWr2CnvT65X/Q2USJipmJ9b7xDJZz0= +github.com/go-openapi/validate v0.25.2/go.mod h1:Pgl1LpPPGFnZ+ys4/hTlDiRYQdI1ocKypgE+8Q8BLfY= +github.com/go-quicktest/qt v1.102.0 h1:HSQxCeh5YZH3EL3W39ixjtyaEhcWSXQHtHnMBzSs474= +github.com/go-quicktest/qt v1.102.0/go.mod h1:p4lGIVX+8Wa6ZPNDvqcxq36XpUDLh42FLetFU7odllI= github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM= github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= @@ -175,12 +187,16 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q= github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA= -github.com/haproxytech/client-native/v6 v6.3.0 h1:bKiQHCW6gKusA2XixfUPy+L/XdEa4LNR6jFMuQ+C908= -github.com/haproxytech/client-native/v6 v6.3.0/go.mod h1:2ybXlzwzdrIOlFl468y/VeGLD5uVS4P7L0TxN9Os+as= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/haproxytech/client-native/v5 v5.1.15 h1:oMqyDlh+vL3yRKiaapc6SESetCIir/Of3F75vtpG1Nk= +github.com/haproxytech/client-native/v5 v5.1.15/go.mod h1:6eT7/KOsczPHFE/op1TDwfo0jQAsMffl7PuXkKJ+Mt0= +github.com/haproxytech/client-native/v6 v6.3.8 h1:h4YfyJUqblc28QYLQi7jayV9yqO9Yy+85wANUGbgzAQ= +github.com/haproxytech/client-native/v6 v6.3.8/go.mod h1:ZjJjq20OvO0kWvhSiG1LDcUnsJLxaOZ30AZyxymLDGc= github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE= github.com/haproxytech/go-logger v1.1.0/go.mod h1:OekUd8HCb7ubxMplzHUPBTHNxZmddOWfOjWclZsqIeM= -github.com/haproxytech/go-method-gen v0.1.1 h1:anoX6RjASOqtwxYCeX5JlsF3ETrAU9fQkxA3vi6tRmA= -github.com/haproxytech/go-method-gen v0.1.1/go.mod h1:3lORMBgT21FSJwyEjIF5rlcwJ1Yj2tFx8bMs8Rzf/d8= +github.com/haproxytech/go-method-gen v0.1.2 h1:yURATvz3j2cze7p18QBY+v0gqnU4RXOxmtoyrrNRZo4= +github.com/haproxytech/go-method-gen v0.1.2/go.mod h1:3lORMBgT21FSJwyEjIF5rlcwJ1Yj2tFx8bMs8Rzf/d8= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= @@ -197,6 +213,7 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU= @@ -220,6 +237,8 @@ github.com/libdns/cloudflare v0.2.1 h1:E8aoP5o79AU47t1XyzCgSecST3GvWv/nC3ycibg0t github.com/libdns/cloudflare v0.2.1/go.mod h1:Aq4IXdjalB6mD0ELvKqJiIGim8zSC6mlIshRPMOAb5w= github.com/libdns/cloudns v1.1.0 h1:W+1MadtxKySn3b5RITFTsXgTIvr5VoO5x97cewjlDcs= github.com/libdns/cloudns v1.1.0/go.mod h1:/22V6tYYDALDpM4pw/RGGJ+X2F1Luibty9kKpKvkqBM= +github.com/libdns/desec v1.0.1 h1:q8U+/dE4W7V3N9wsAC6aOceP4vOMKaa02D15N3Gg0dc= +github.com/libdns/desec v1.0.1/go.mod h1:kyNfDM37feCTHJO4ha0SCRafQQS+dQ/kBRWwZYDfrJo= github.com/libdns/digitalocean v0.0.0-20250606071607-dfa7af5c2e31 h1:raIuvxYVJtZ60hREOOL3MS2AS3xA0W2G3grPQ4rGTeo= github.com/libdns/digitalocean v0.0.0-20250606071607-dfa7af5c2e31/go.mod h1:hde/tjNiPFe1lLaf2TtaCAYgJ9j/SGLhaQMpgZlF6e0= github.com/libdns/gandi v1.1.0 h1:gBBbx23xejvOpbUX7HRqCYsROYag5+OUMGhQXzAkol4= @@ -250,6 +269,8 @@ github.com/libdns/porkbun v1.1.0 h1:X763NqXjW26VEl7GvBtF/3CGeuGt9JqoQ35mwIlx40E= github.com/libdns/porkbun v1.1.0/go.mod h1:JL6NfXkkSlLr24AI5Fv0t3/Oa6PXOSOerVsOmr8+URs= github.com/libdns/rfc2136 v1.0.1 h1:aiztZgzI2cd9FAtBNPILz01mQcZs1jMqJ467KKI4UQ0= github.com/libdns/rfc2136 v1.0.1/go.mod h1:Uf4niCfXVgiMgwUrkPdIa5/sqLFdjVhkZj1ZfFAuSq4= +github.com/libdns/route53 v1.6.0 h1:1fZcoCIxagfftw9GBhIqZ2rumEiB0K58n11X7ko2DOg= +github.com/libdns/route53 v1.6.0/go.mod h1:7QGcw/2J0VxcVwHsPYpuo1I6IJLHy77bbOvi1BVK3eE= github.com/libdns/scaleway v0.2.3 h1:krZpbQyl4cyuB6sVLHLfEQ63K1Z+PDiQcFcJBU3Kyp4= github.com/libdns/scaleway v0.2.3/go.mod h1:N9nY2+aeFQu5y439nKT25GHLOhBlRf93WvOqgeX+ztI= github.com/libdns/vultr/v2 v2.0.4 h1:4V1OSiUnYvFfpFBicdM27JEnAF0D694cmmQ3AyNqobA= @@ -279,16 +300,21 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/nathanaelle/syslog5424/v2 v2.0.5 h1:oLVYQmKnv3nlnmvlbBWM+iWl9AONcU+tuxIL0fjko5A= github.com/nathanaelle/syslog5424/v2 v2.0.5/go.mod h1:f9MvsGkLOtYh2VzLT4Pjuwx3+Xv2EogxJNda+HLPDus= +github.com/oapi-codegen/nullable v1.1.0 h1:eAh8JVc5430VtYVnq00Hrbpag9PFRGWLjxR1/3KntMs= +github.com/oapi-codegen/nullable v1.1.0/go.mod h1:KUZ3vUzkmEKY90ksAmit2+5juDIhIZhfDl+0PwOQlFY= +github.com/oapi-codegen/runtime v1.4.1 h1:9nwLoI+KrWxzbBcp0jO/R8uXqbik/HUyCvPeU68Y/qo= +github.com/oapi-codegen/runtime v1.4.1/go.mod h1:GwV7hC2hviaMzj+ITfHVRESK5J2W/GefVwIND/bMGvU= github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY= github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s= +github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= github.com/ovh/go-ovh v1.7.0 h1:V14nF7FwDjQrZt9g7jzcvAAQ3HN6DNShRFRMC3jLoPw= github.com/ovh/go-ovh v1.7.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea h1:sKwxy1H95npauwu8vtF95vG/syrL0p8fSZo/XlDg5gk= @@ -320,6 +346,7 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -329,67 +356,67 @@ github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8O github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ= -github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/vultr/govultr/v3 v3.20.0 h1:O+Om6gXpN6ehwAIIKq5DyGuekpyHaoRlwrxTb44bDzA= github.com/vultr/govultr/v3 v3.20.0/go.mod h1:q34Wd76upKmf+vxFMgaNMH3A8BbsPBmSYZUGC8oZa5w= github.com/woodsbury/decimal128 v1.4.0 h1:xJATj7lLu4f2oObouMt2tgGiElE5gO6mSWUjQsBgUlc= github.com/woodsbury/decimal128 v1.4.0/go.mod h1:BP46FUrVjVhdTbKT+XuQh2xfQaGki9LMIRJSFuh6THU= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.mongodb.org/mongo-driver v1.17.7 h1:a9w+U3Vt67eYzcfq3k/OAv284/uUUkL0uP75VE5rCOU= -go.mongodb.org/mongo-driver v1.17.7/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ= -go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= -go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= -go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= -go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= -go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= -go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= -go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= -go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= -go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= -go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= +go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= +go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= +go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= +go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= +go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= +go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= +go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= +go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= +go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= -golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= -golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= -golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= -golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= -golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= +golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= -golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= -golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= -golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= -golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= -golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= -golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/api v0.233.0 h1:iGZfjXAJiUFSSaekVB7LzXl6tRfEKhUN7FkZN++07tI= google.golang.org/api v0.233.0/go.mod h1:TCIVLLlcwunlMpZIhIp7Ltk77W+vUSdUKAAIlbxY44c= google.golang.org/genproto v0.0.0-20250512202823-5a2f75b736a9 h1:0DnDgelxbooHLt0nyiPeCP0zrH/RL+UG558i1oNU1xE= -google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 h1:vPV0tzlsK6EzEDHNNH5sa7Hs9bd7iXR7B1tSiPepkV0= -google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:pKLAc5OolXC3ViWGI62vvC0n10CpwAtRcTNCFwTKBEw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= -google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -400,5 +427,5 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -mvdan.cc/gofumpt v0.9.2 h1:zsEMWL8SVKGHNztrx6uZrXdp7AX8r421Vvp23sz7ik4= -mvdan.cc/gofumpt v0.9.2/go.mod h1:iB7Hn+ai8lPvofHd9ZFGVg2GOr8sBUw1QUWjNbmIL/s= +mvdan.cc/gofumpt v0.10.0 h1:yGGpRS2pBN2OQIi7b21IXknJna7faPkFaVfHLrN6Euo= +mvdan.cc/gofumpt v0.10.0/go.mod h1:sU2ElXHzOEmvoPqfutYG7uunlueR4K2T1JFml40SzP4= diff --git a/handlers/acl.go b/handlers/acl.go deleted file mode 100644 index e20ef218..00000000 --- a/handlers/acl.go +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/acl" -) - -// CreateACLHandlerImpl implementation of the CreateACLHandler interface using client-native client -type CreateACLHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteACLHandlerImpl implementation of the DeleteACLHandler interface using client-native client -type DeleteACLHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetACLHandlerImpl implementation of the GetACLHandler interface using client-native client -type GetACLHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllACLHandlerImpl implementation of the GetAclsHandler interface using client-native client -type GetAllACLHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceACLHandlerImpl implementation of the ReplaceACLHandler interface using client-native client -type ReplaceACLHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllACLHandlerImpl implementation of the ReplaceAclsHandler interface using client-native client -type ReplaceAllACLHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.CreateACLBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acl.NewCreateACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewCreateACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateACL(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return acl.NewCreateACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acl.NewCreateACLBackendDefault(int(*e.Code)).WithPayload(e) - } - return acl.NewCreateACLBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return acl.NewCreateACLBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return acl.NewCreateACLBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.DeleteACLBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acl.NewDeleteACLBackendDefault(int(*e.Code)).WithPayload(e) - } - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewDeleteACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteACL(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return acl.NewDeleteACLBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acl.NewDeleteACLBackendDefault(int(*e.Code)).WithPayload(e) - } - return acl.NewDeleteACLBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return acl.NewDeleteACLBackendAccepted().WithReloadID(rID) - } - return acl.NewDeleteACLBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.GetACLBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewGetACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetACL(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return acl.NewGetACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - return acl.NewGetACLBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.GetAllACLBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - var aclName []string - if params.ACLName != nil { - aclName = []string{*params.ACLName} - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewGetACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetACLs(string(parentType), params.ParentName, t, aclName...) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return acl.NewGetAllACLBackendOK().WithPayload(rules) - } - return acl.NewGetAllACLBackendDefault(int(*e.Code)).WithPayload(e) - } - return acl.NewGetAllACLBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.ReplaceACLBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acl.NewReplaceACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceACLBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.EditACL(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceACLBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceACLBackendDefault(int(*e.Code)).WithPayload(e) - } - return acl.NewReplaceACLBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return acl.NewReplaceACLBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return acl.NewReplaceACLBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllACLHandlerImpl) Handle(parentType cnconstants.CnParentType, params acl.ReplaceAllACLBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acl.NewReplaceAllACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceAllACLBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceAcls(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceAllACLBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acl.NewReplaceAllACLBackendDefault(int(*e.Code)).WithPayload(e) - } - return acl.NewReplaceAllACLBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return acl.NewReplaceAllACLBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return acl.NewReplaceAllACLBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/acl_runtime.go b/handlers/acl_runtime.go deleted file mode 100644 index 4aba05c2..00000000 --- a/handlers/acl_runtime.go +++ /dev/null @@ -1,152 +0,0 @@ -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/acl_runtime" -) - -type GetACLSHandlerRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h GetACLSHandlerRuntimeImpl) Handle(params acl_runtime.GetServicesHaproxyRuntimeAclsParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsDefault(int(*e.Code)).WithPayload(e) - } - - files, err := runtime.GetACLFiles() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewGetServicesHaproxyRuntimeAclsOK().WithPayload(files) -} - -type GetACLHandlerRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h GetACLHandlerRuntimeImpl) Handle(params acl_runtime.GetServicesHaproxyRuntimeAclsIDParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsIDDefault(int(*e.Code)).WithPayload(e) - } - - aclFile, err := runtime.GetACLFile(params.ID) - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsIDDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewGetServicesHaproxyRuntimeAclsIDOK().WithPayload(aclFile) -} - -type GetACLFileEntriesHandlerRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h GetACLFileEntriesHandlerRuntimeImpl) Handle(params acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesDefault(int(*e.Code)).WithPayload(e) - } - files, err := runtime.GetACLFilesEntries(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesOK().WithPayload(files) -} - -type PostACLFileEntryHandlerRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h PostACLFileEntryHandlerRuntimeImpl) Handle(params acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntriesParams, i any) middleware.Responder { - var err error - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewPostServicesHaproxyRuntimeAclsParentNameEntriesDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.AddACLFileEntry(params.ParentName, params.Data.Value); err != nil { - e := misc.HandleError(err) - return acl_runtime.NewPostServicesHaproxyRuntimeAclsParentNameEntriesDefault(int(*e.Code)).WithPayload(e) - } - - var fileEntry *models.ACLFileEntry - fileEntry, err = runtime.GetACLFileEntry(params.ParentName, params.Data.Value) - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewPostServicesHaproxyRuntimeAclsParentNameEntriesDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewPostServicesHaproxyRuntimeAclsParentNameEntriesCreated().WithPayload(fileEntry) -} - -type GetACLFileEntryRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h GetACLFileEntryRuntimeImpl) Handle(params acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(int(*e.Code)).WithPayload(e) - } - - fileEntry, err := runtime.GetACLFileEntry(params.ParentName, params.ID) - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDOK().WithPayload(fileEntry) -} - -type DeleteACLFileEntryHandlerRuntimeImpl struct { - Client client_native.HAProxyClient -} - -func (h DeleteACLFileEntryHandlerRuntimeImpl) Handle(params acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(int(*e.Code)).WithPayload(e) - } - if err := runtime.DeleteACLFileEntry(params.ParentName, "#"+params.ID); err != nil { - e := misc.HandleError(err) - return acl_runtime.NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(int(*e.Code)).WithPayload(e) - } - - return acl_runtime.NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent() -} - -type ACLRuntimeAddPayloadRuntimeACLHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h ACLRuntimeAddPayloadRuntimeACLHandlerImpl) Handle(params acl_runtime.AddPayloadRuntimeACLParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acl_runtime.NewAddPayloadRuntimeACLDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.AddACLAtomic(params.ParentName, params.Data) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return acl_runtime.NewAddPayloadRuntimeACLDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - return acl_runtime.NewAddPayloadRuntimeACLCreated().WithPayload(params.Data) -} diff --git a/handlers/acme_provider.go b/handlers/acme_provider.go deleted file mode 100644 index 9a9eb99b..00000000 --- a/handlers/acme_provider.go +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/acme" -) - -type GetAcmeProvidersHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetAcmeProvidersHandlerImpl) Handle(params acme.GetAcmeProvidersParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acme.NewGetAcmeProvidersDefault(int(*e.Code)).WithPayload(e) - } - - _, providers, err := configuration.GetAcmeProviders(t) - if err != nil { - e := misc.HandleError(err) - return acme.NewGetAcmeProvidersDefault(int(*e.Code)).WithPayload(e) - } - - return acme.NewGetAcmeProvidersOK().WithPayload(providers) -} - -type GetAcmeProviderHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetAcmeProviderHandlerImpl) Handle(params acme.GetAcmeProviderParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acme.NewGetAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - _, provider, err := configuration.GetAcmeProvider(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return acme.NewGetAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - return acme.NewGetAcmeProviderOK().WithPayload(provider) -} - -type CreateAcmeProviderHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateAcmeProviderHandlerImpl) Handle(params acme.CreateAcmeProviderParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acme.NewCreateAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acme.NewCreateAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateAcmeProvider(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return acme.NewCreateAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acme.NewCreateAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - return acme.NewCreateAcmeProviderCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return acme.NewCreateAcmeProviderAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return acme.NewCreateAcmeProviderAccepted().WithPayload(params.Data) -} - -type EditAcmeProviderHandler struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *EditAcmeProviderHandler) Handle(params acme.EditAcmeProviderParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acme.NewEditAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acme.NewEditAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditAcmeProvider(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return acme.NewEditAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - return acme.NewEditAcmeProviderOK().WithPayload(params.Data) -} - -type DeleteAcmeProviderHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteAcmeProviderHandlerImpl) Handle(params acme.DeleteAcmeProviderParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return acme.NewDeleteAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return acme.NewDeleteAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteAcmeProvider(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return acme.NewDeleteAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return acme.NewDeleteAcmeProviderDefault(int(*e.Code)).WithPayload(e) - } - return acme.NewDeleteAcmeProviderNoContent() - } - rID := h.ReloadAgent.Reload() - return acme.NewDeleteAcmeProviderAccepted().WithReloadID(rID) - } - - return acme.NewDeleteAcmeProviderAccepted() -} diff --git a/handlers/acme_runtime.go b/handlers/acme_runtime.go deleted file mode 100644 index 0fafaea7..00000000 --- a/handlers/acme_runtime.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/acme_runtime" -) - -type GetAcmeStatusHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetAcmeStatusHandlerImpl) Handle(params acme_runtime.GetAcmeStatusParams, principal any) middleware.Responder { - rt, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acme_runtime.NewGetAcmeStatusDefault(int(*e.Code)).WithPayload(e) - } - - status, err := rt.AcmeStatus() - if err != nil { - e := misc.HandleError(err) - return acme_runtime.NewGetAcmeStatusDefault(int(*e.Code)).WithPayload(e) - } - - return acme_runtime.NewGetAcmeStatusOK().WithPayload(status) -} - -type RenewAcmeCertificateHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *RenewAcmeCertificateHandlerImpl) Handle(params acme_runtime.RenewAcmeCertificateParams, principal any) middleware.Responder { - rt, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return acme_runtime.NewRenewAcmeCertificateDefault(int(*e.Code)).WithPayload(e) - } - - if err := rt.AcmeRenew(params.Certificate); err != nil { - e := misc.HandleError(err) - return acme_runtime.NewRenewAcmeCertificateDefault(int(*e.Code)).WithPayload(e) - } - - return acme_runtime.NewRenewAcmeCertificateOK() -} diff --git a/handlers/aws.go b/handlers/aws.go deleted file mode 100644 index 3b12b567..00000000 --- a/handlers/aws.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "errors" - - "github.com/go-openapi/runtime/middleware" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/misc" - - sc "github.com/haproxytech/dataplaneapi/discovery" - "github.com/haproxytech/dataplaneapi/operations/service_discovery" -) - -// CreateConsulHandlerImpl implementation of the CreateConsulHandler interface using client-native client -type CreateAWSHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.AwsRegion) error - UseValidation bool -} - -func (c CreateAWSHandlerImpl) Handle(params service_discovery.CreateAWSRegionParams, i any) middleware.Responder { - var err error - handleError := func(err error) *service_discovery.CreateAWSRegionDefault { - e := misc.HandleError(err) - return service_discovery.NewCreateAWSRegionDefault(int(*e.Code)).WithPayload(e) - } - - params.Data.ID = sc.NewServiceDiscoveryUUID() - if err = sc.ValidateAWSData(params.Data, c.UseValidation); err != nil { - return handleError(err) - } - if err = c.Discovery.AddNode("aws", *params.Data.ID, params.Data); err != nil { - return handleError(err) - } - var regions models.AwsRegions - if regions, err = getAWSRegions(c.Discovery); err != nil { - return handleError(err) - } - if err = c.PersistCallback(regions); err != nil { - return handleError(err) - } - return service_discovery.NewCreateAWSRegionCreated().WithPayload(params.Data) -} - -func getAWSRegions(discovery sc.ServiceDiscoveries) (models.AwsRegions, error) { - nodes, err := discovery.GetNodes("aws") - if err != nil { - return nil, err - } - instances, ok := nodes.(models.AwsRegions) - if !ok { - return nil, errors.New("expected *models.AwsRegion") - } - return instances, nil -} - -type GetAWSRegionHandlerImpl struct { - Discovery sc.ServiceDiscoveries -} - -func (g GetAWSRegionHandlerImpl) Handle(params service_discovery.GetAWSRegionParams, i any) middleware.Responder { - handleError := func(err error) *service_discovery.GetAWSRegionDefault { - e := misc.HandleError(err) - return service_discovery.NewGetAWSRegionDefault(int(*e.Code)).WithPayload(e) - } - - nodes, err := g.Discovery.GetNode("aws", params.ID) - if err != nil { - return handleError(err) - } - region, ok := nodes.(*models.AwsRegion) - if !ok { - return handleError(err) - } - return service_discovery.NewGetAWSRegionOK().WithPayload(region) -} - -type GetAWSRegionsHandlerImpl struct { - Discovery sc.ServiceDiscoveries -} - -func (g GetAWSRegionsHandlerImpl) Handle(params service_discovery.GetAWSRegionsParams, i any) middleware.Responder { - regions, err := getAWSRegions(g.Discovery) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewGetAWSRegionsDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewGetAWSRegionsOK().WithPayload(regions) -} - -type ReplaceAWSRegionHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.AwsRegion) error - UseValidation bool -} - -func (r ReplaceAWSRegionHandlerImpl) Handle(params service_discovery.ReplaceAWSRegionParams, i any) middleware.Responder { - handleError := func(err error) *service_discovery.ReplaceAWSRegionDefault { - e := misc.HandleError(err) - return service_discovery.NewReplaceAWSRegionDefault(int(*e.Code)).WithPayload(e) - } - var err error - if err = sc.ValidateAWSData(params.Data, r.UseValidation); err != nil { - return handleError(err) - } - if err = r.Discovery.UpdateNode("aws", *params.Data.ID, params.Data); err != nil { - return handleError(err) - } - var regions models.AwsRegions - regions, err = getAWSRegions(r.Discovery) - if err != nil { - return handleError(err) - } - if err = r.PersistCallback(regions); err != nil { - return handleError(err) - } - return service_discovery.NewReplaceAWSRegionOK().WithPayload(params.Data) -} - -type DeleteAWSRegionHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.AwsRegion) error -} - -func (d DeleteAWSRegionHandlerImpl) Handle(params service_discovery.DeleteAWSRegionParams, i any) middleware.Responder { - handleError := func(err error) *service_discovery.DeleteAWSRegionDefault { - e := misc.HandleError(err) - return service_discovery.NewDeleteAWSRegionDefault(int(*e.Code)).WithPayload(e) - } - var err error - if err = d.Discovery.RemoveNode("aws", params.ID); err != nil { - return handleError(err) - } - var regions models.AwsRegions - if regions, err = getAWSRegions(d.Discovery); err != nil { - return handleError(err) - } - if err = d.PersistCallback(regions); err != nil { - return handleError(err) - } - return service_discovery.NewDeleteAWSRegionNoContent() -} diff --git a/handlers/backend.go b/handlers/backend.go deleted file mode 100644 index 358cc113..00000000 --- a/handlers/backend.go +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "net/http" - "slices" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/backend" -) - -// CreateBackendHandlerImpl implementation of the CreateBackendHandler interface using client-native client -type CreateBackendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteBackendHandlerImpl implementation of the DeleteBackendHandler interface using client-native client -type DeleteBackendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetBackendHandlerImpl implementation of the GetBackendHandler interface using client-native client -type GetBackendHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetBackendsHandlerImpl implementation of the GetBackendsHandler interface using client-native client -type GetBackendsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceBackendHandlerImpl implementation of the ReplaceBackendHandler interface using client-native client -type ReplaceBackendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// handleDeprecatedBackendFields adds backward compatibility support for the fields -// force_persist and ignore_persist that are deprecated in favour of force_persist_list -// and ignore_persist_list. -func handleDeprecatedBackendFields(method string, payload *models.Backend, onDisk *models.Backend) { - // A fair amount of code duplication in this function is tolerated because this code is expected to be - // short-lived - it should be removed at the end of the sunset period for the deprecated fields. - - if method == http.MethodGet { - // Populate force_persist with the first element of force_persist_list if it is present. - if len(payload.ForcePersistList) > 0 { - payload.ForcePersist = &models.BackendForcePersist{ - Cond: payload.ForcePersistList[0].Cond, - CondTest: payload.ForcePersistList[0].CondTest, - } - } - // Populate ignore_persist with the first element of ignore_persist_list if it is present. - if len(payload.IgnorePersistList) > 0 { - payload.IgnorePersist = &models.BackendIgnorePersist{ - Cond: payload.IgnorePersistList[0].Cond, - CondTest: payload.IgnorePersistList[0].CondTest, - } - } - return - } - - if payload.ForcePersist != nil && len(payload.ForcePersistList) == 0 { - if method == http.MethodPost || (method == http.MethodPut && (onDisk == nil || len(onDisk.ForcePersistList) == 0)) { - // Deprecated force_persist is present in a POST payload, or in a PUT payload when force_persist_list does not yet exist in the backend. - // Transform it into force_persist_list with the only element. - payload.ForcePersistList = []*models.ForcePersist{{ - Cond: payload.ForcePersist.Cond, - CondTest: payload.ForcePersist.CondTest, - }} - } else { - // Deprecated force_persist is present in a PUT payload, and force_persist_list already exists in the backend. - // Preserve the existing force_persist_list, and add or reposition the submitted force_persist to be its first element. - found := -1 - for i, item := range onDisk.ForcePersistList { - if *item.Cond == *payload.ForcePersist.Cond && *item.CondTest == *payload.ForcePersist.CondTest { - found = i - break - } - } - switch found { - case -1: - // force_persist value is not part of existing force_persist_list - insert it in the first position. - payload.ForcePersistList = slices.Insert(onDisk.ForcePersistList, 0, &models.ForcePersist{ - Cond: payload.ForcePersist.Cond, - CondTest: payload.ForcePersist.CondTest, - }) - case 0: - // force_persist value matches the first element of force_persist_list - preserve it without modification. - payload.ForcePersistList = onDisk.ForcePersistList - default: - // force_persist value matches another element of force_persist_list - move it to the first position. - payload.ForcePersistList = slices.Concat(onDisk.ForcePersistList[found:found+1], onDisk.ForcePersistList[:found], onDisk.ForcePersistList[found+1:]) - } - } - } - - if payload.IgnorePersist != nil && len(payload.IgnorePersistList) == 0 { - if method == http.MethodPost || (method == http.MethodPut && (onDisk == nil || len(onDisk.IgnorePersistList) == 0)) { - // Deprecated ignore_persist is present in a POST payload, or in a PUT payload when ignore_persist_list does not yet exist in the backend. - // Transform it into ignore_persist_list with the only element. - payload.IgnorePersistList = []*models.IgnorePersist{{ - Cond: payload.IgnorePersist.Cond, - CondTest: payload.IgnorePersist.CondTest, - }} - } else { - // Deprecated ignore_persist is present in a PUT payload, and ignore_persist_list already exists in the backend. - // Preserve the existing ignore_persist_list, and add or reposition the submitted ignore_persist to be its first element. - found := -1 - for i, item := range onDisk.IgnorePersistList { - if *item.Cond == *payload.IgnorePersist.Cond && *item.CondTest == *payload.IgnorePersist.CondTest { - found = i - break - } - } - switch found { - case -1: - // ignore_persist value is not part of existing ignore_persist_list - insert it in the first position. - payload.IgnorePersistList = slices.Insert(onDisk.IgnorePersistList, 0, &models.IgnorePersist{ - Cond: payload.IgnorePersist.Cond, - CondTest: payload.IgnorePersist.CondTest, - }) - case 0: - // ignore_persist value matches the first element of ignore_persist_list - preserve it without modification. - payload.IgnorePersistList = onDisk.IgnorePersistList - default: - // ignore_persist value matches another element of ignore_persist_list - move it to the first position. - payload.IgnorePersistList = slices.Concat(onDisk.IgnorePersistList[found:found+1], onDisk.IgnorePersistList[:found], onDisk.IgnorePersistList[found+1:]) - } - } - } - - // Remove force_persist and ignore_persist from the payload - at this point, they were either processed, - // or not present in the payload, or will be ignored because non-deprecated variants were submitted at the same time. - payload.ForcePersist = nil - payload.IgnorePersist = nil -} - -// Handle executing the request and returning a response -func (h *CreateBackendHandlerImpl) Handle(params backend.CreateBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend.NewCreateBackendDefault(int(*e.Code)).WithPayload(e) - } - - // Populate force_persist_list and ignore_persist_list if the corresponding - // deprecated fields force_persist or ignore_persist are present in the request payload. - handleDeprecatedBackendFields(http.MethodPost, params.Data, nil) - - err := h.createBackend(params, t, v) - if err != nil { - e := misc.HandleError(err) - return backend.NewCreateBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend.NewCreateBackendDefault(int(*e.Code)).WithPayload(e) - } - return backend.NewCreateBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return backend.NewCreateBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return backend.NewCreateBackendAccepted().WithPayload(params.Data) -} - -func (h *CreateBackendHandlerImpl) createBackend(params backend.CreateBackendParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredBackend(params.Data, t, v) - } - return configuration.CreateBackend(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteBackendHandlerImpl) Handle(params backend.DeleteBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend.NewDeleteBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend.NewDeleteBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteBackend(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return backend.NewDeleteBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend.NewDeleteBackendDefault(int(*e.Code)).WithPayload(e) - } - return backend.NewDeleteBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return backend.NewDeleteBackendAccepted().WithReloadID(rID) - } - return backend.NewDeleteBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetBackendHandlerImpl) Handle(params backend.GetBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bck, err := h.getBackend(params, t) - if err != nil { - e := misc.HandleError(err) - return backend.NewGetBackendDefault(int(*e.Code)).WithPayload(e) - } - - // Populate deprecated force_persist and ignore_persist fields in returned response. - handleDeprecatedBackendFields(http.MethodGet, bck, nil) - - return backend.NewGetBackendOK().WithPayload(bck) -} - -func (h *GetBackendHandlerImpl) getBackend(params backend.GetBackendParams, t string) (int64, *models.Backend, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredBackend(params.Name, t) - } - return configuration.GetBackend(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetBackendsHandlerImpl) Handle(params backend.GetBackendsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bcks, err := h.getBackends(params, t) - if err != nil { - e := misc.HandleError(err) - return backend.NewGetBackendsDefault(int(*e.Code)).WithPayload(e) - } - - // Populate deprecated force_persist and ignore_persist fields in returned response. - for _, bck := range bcks { - handleDeprecatedBackendFields(http.MethodGet, bck, nil) - } - - return backend.NewGetBackendsOK().WithPayload(bcks) -} - -func (h *GetBackendsHandlerImpl) getBackends(params backend.GetBackendsParams, t string) (int64, models.Backends, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredBackends(t) - } - return configuration.GetBackends(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceBackendHandlerImpl) Handle(params backend.ReplaceBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend.NewReplaceBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend.NewReplaceBackendDefault(int(*e.Code)).WithPayload(e) - } - - // Populate or modify force_persist_list and ignore_persist_list if the corresponding - // deprecated fields force_persist or ignore_persist are present in the request payload. - if params.Data.ForcePersist != nil || params.Data.IgnorePersist != nil { - _, onDisk, confErr := configuration.GetBackend(params.Data.Name, t) - if confErr != nil { - e := misc.HandleError(confErr) - return backend.NewReplaceBackendDefault(int(*e.Code)).WithPayload(e) - } - handleDeprecatedBackendFields(http.MethodPut, params.Data, onDisk) - } - - err = h.editBackend(params, t, v) - if err != nil { - e := misc.HandleError(err) - return backend.NewReplaceBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend.NewReplaceBackendDefault(int(*e.Code)).WithPayload(e) - } - return backend.NewReplaceBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return backend.NewReplaceBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return backend.NewReplaceBackendAccepted().WithPayload(params.Data) -} - -func (h *ReplaceBackendHandlerImpl) editBackend(params backend.ReplaceBackendParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredBackend(params.Name, params.Data, t, v) - } - return configuration.EditBackend(params.Name, params.Data, t, v) -} diff --git a/handlers/backend_switching_rule.go b/handlers/backend_switching_rule.go deleted file mode 100644 index ee691d7f..00000000 --- a/handlers/backend_switching_rule.go +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/backend_switching_rule" -) - -// CreateBackendSwitchingRuleHandlerImpl implementation of the CreateBackendSwitchingRuleHandler interface using client-native client -type CreateBackendSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteBackendSwitchingRuleHandlerImpl implementation of the DeleteBackendSwitchingRuleHandler interface using client-native client -type DeleteBackendSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetBackendSwitchingRuleHandlerImpl implementation of the GetBackendSwitchingRuleHandler interface using client-native client -type GetBackendSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetBackendSwitchingRulesHandlerImpl implementation of the GetBackendSwitchingRulesHandler interface using client-native client -type GetBackendSwitchingRulesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceBackendSwitchingRuleHandlerImpl implementation of the ReplaceBackendSwitchingRuleHandler interface using client-native client -type ReplaceBackendSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceBackendSwitchingRulesHandlerImpl implementation of the ReplaceBackendSwitchingRulesHandler interface using client-native client -type ReplaceBackendSwitchingRulesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateBackendSwitchingRuleHandlerImpl) Handle(params backend_switching_rule.CreateBackendSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend_switching_rule.NewCreateBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewCreateBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.CreateBackendSwitchingRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewCreateBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewCreateBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewCreateBackendSwitchingRuleCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return backend_switching_rule.NewCreateBackendSwitchingRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return backend_switching_rule.NewCreateBackendSwitchingRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteBackendSwitchingRuleHandlerImpl) Handle(params backend_switching_rule.DeleteBackendSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend_switching_rule.NewDeleteBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewDeleteBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteBackendSwitchingRule(params.Index, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewDeleteBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewDeleteBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewDeleteBackendSwitchingRuleNoContent() - } - rID := h.ReloadAgent.Reload() - return backend_switching_rule.NewDeleteBackendSwitchingRuleAccepted().WithReloadID(rID) - } - return backend_switching_rule.NewDeleteBackendSwitchingRuleAccepted() -} - -// Handle executing the request and returning a response -func (h *GetBackendSwitchingRuleHandlerImpl) Handle(params backend_switching_rule.GetBackendSwitchingRuleParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewCreateBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - _, bckRule, err := configuration.GetBackendSwitchingRule(params.Index, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewGetBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewGetBackendSwitchingRuleOK().WithPayload(bckRule) -} - -// Handle executing the request and returning a response -func (h *GetBackendSwitchingRulesHandlerImpl) Handle(params backend_switching_rule.GetBackendSwitchingRulesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewGetBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - _, bckRules, err := configuration.GetBackendSwitchingRules(params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return backend_switching_rule.NewGetBackendSwitchingRulesOK().WithPayload(models.BackendSwitchingRules{}) - } - return backend_switching_rule.NewGetBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewGetBackendSwitchingRulesOK().WithPayload(bckRules) -} - -// Handle executing the request and returning a response -func (h *ReplaceBackendSwitchingRuleHandlerImpl) Handle(params backend_switching_rule.ReplaceBackendSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend_switching_rule.NewReplaceBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditBackendSwitchingRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewReplaceBackendSwitchingRuleOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return backend_switching_rule.NewReplaceBackendSwitchingRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return backend_switching_rule.NewReplaceBackendSwitchingRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceBackendSwitchingRulesHandlerImpl) Handle(params backend_switching_rule.ReplaceBackendSwitchingRulesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return backend_switching_rule.NewReplaceBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceBackendSwitchingRules(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return backend_switching_rule.NewReplaceBackendSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - return backend_switching_rule.NewReplaceBackendSwitchingRulesOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return backend_switching_rule.NewReplaceBackendSwitchingRulesAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return backend_switching_rule.NewReplaceBackendSwitchingRulesAccepted().WithPayload(params.Data) -} diff --git a/handlers/bind.go b/handlers/bind.go deleted file mode 100644 index 9fd15de3..00000000 --- a/handlers/bind.go +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "errors" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/bind" -) - -// CreateBindHandlerImpl implementation of the CreateBindHandler interface using client-native client -type CreateBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteBindHandlerImpl implementation of the DeleteBindHandler interface using client-native client -type DeleteBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetBindHandlerImpl implementation of the GetBindHandler interface using client-native client -type GetBindHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllBindHandlerImpl implementation of the GetBindsHandler interface using client-native client -type GetAllBindHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceBindHandlerImpl implementation of the ReplaceBindHandler interface using client-native client -type ReplaceBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func bindTypeParams(frontend *string, parentType *string, parentName *string) (pType string, pName string, err error) { - if frontend != nil && *frontend != "" { - return "frontend", *frontend, nil - } - if parentType == nil || *parentType == "" { - return "", "", errors.New("parentType empty") - } - if parentName == nil || *parentName == "" { - return "", "", errors.New("parentName empty") - } - return *parentType, *parentName, nil -} - -// Handle executing the request and returning a response -func (h *CreateBindHandlerImpl) Handle(parentType cnconstants.CnParentType, params bind.CreateBindFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return bind.NewCreateBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return bind.NewCreateBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := bindTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return bind.NewCreateBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.CreateBind(pType, pName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return bind.NewCreateBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return bind.NewCreateBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - return bind.NewCreateBindFrontendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return bind.NewCreateBindFrontendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return bind.NewCreateBindFrontendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteBindHandlerImpl) Handle(parentType cnconstants.CnParentType, params bind.DeleteBindFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return bind.NewDeleteBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return bind.NewDeleteBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := bindTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return bind.NewDeleteBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.DeleteBind(params.Name, pType, pName, t, v) - if err != nil { - e := misc.HandleError(err) - return bind.NewDeleteBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return bind.NewDeleteBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - return bind.NewDeleteBindFrontendNoContent() - } - rID := h.ReloadAgent.Reload() - return bind.NewDeleteBindFrontendAccepted().WithReloadID(rID) - } - return bind.NewDeleteBindFrontendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetBindHandlerImpl) Handle(parentType cnconstants.CnParentType, params bind.GetBindFrontendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return bind.NewGetBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := bindTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return bind.NewGetBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - _, b, err := configuration.GetBind(params.Name, pType, pName, t) - if err != nil { - e := misc.HandleError(err) - return bind.NewGetBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - return bind.NewGetBindFrontendOK().WithPayload(b) -} - -// Handle executing the request and returning a response -func (h *GetAllBindHandlerImpl) Handle(parentType cnconstants.CnParentType, params bind.GetAllBindFrontendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return bind.NewGetAllBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := bindTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return bind.NewGetAllBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - _, bs, err := configuration.GetBinds(pType, pName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return bind.NewGetAllBindFrontendOK().WithPayload(models.Binds{}) - } - return bind.NewGetAllBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - return bind.NewGetAllBindFrontendOK().WithPayload(bs) -} - -// Handle executing the request and returning a response -func (h *ReplaceBindHandlerImpl) Handle(parentType cnconstants.CnParentType, params bind.ReplaceBindFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return bind.NewReplaceBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return bind.NewReplaceBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := bindTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return bind.NewReplaceBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.EditBind(params.Name, pType, pName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return bind.NewReplaceBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return bind.NewReplaceBindFrontendDefault(int(*e.Code)).WithPayload(e) - } - return bind.NewReplaceBindFrontendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return bind.NewReplaceBindFrontendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return bind.NewReplaceBindFrontendAccepted().WithPayload(params.Data) -} diff --git a/handlers/cache.go b/handlers/cache.go deleted file mode 100644 index d5aa1afe..00000000 --- a/handlers/cache.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/cache" -) - -// CreateCacheHandlerImpl implementation of the CreateCacheHandler interface using client-native client -type CreateCacheHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteCacheHandlerImpl implementation of the DeleteCacheHandler interface using client-native client -type DeleteCacheHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetCacheHandlerImpl implementation of the GetCacheHandler interface using client-native client -type GetCacheHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetCachesHandlerImpl implementation of the GetCachesHandler interface using client-native client -type GetCachesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceCacheHandlerImpl implementation of the ReplaceCacheHandler interface using client-native client -type ReplaceCacheHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateCacheHandlerImpl) Handle(params cache.CreateCacheParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return cache.NewCreateCacheDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return cache.NewCreateCacheDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateCache(params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return cache.NewCreateCacheDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return cache.NewCreateCacheDefault(int(*e.Code)).WithPayload(e) - } - return cache.NewCreateCacheCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return cache.NewCreateCacheAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return cache.NewCreateCacheAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteCacheHandlerImpl) Handle(params cache.DeleteCacheParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return cache.NewDeleteCacheDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return cache.NewDeleteCacheDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteCache(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return cache.NewDeleteCacheDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return cache.NewDeleteCacheDefault(int(*e.Code)).WithPayload(e) - } - return cache.NewDeleteCacheNoContent() - } - rID := h.ReloadAgent.Reload() - return cache.NewDeleteCacheAccepted().WithReloadID(rID) - } - return cache.NewDeleteCacheAccepted() -} - -// Handle executing the request and returning a response -func (h *GetCacheHandlerImpl) Handle(params cache.GetCacheParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return cache.NewGetCacheDefault(int(*e.Code)).WithPayload(e) - } - - _, r, err := configuration.GetCache(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return cache.NewGetCacheDefault(int(*e.Code)).WithPayload(e) - } - return cache.NewGetCacheOK().WithPayload(r) -} - -// Handle executing the request and returning a response -func (h *GetCachesHandlerImpl) Handle(params cache.GetCachesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return cache.NewGetCachesDefault(int(*e.Code)).WithPayload(e) - } - - _, rs, err := configuration.GetCaches(t) - if err != nil { - e := misc.HandleError(err) - return cache.NewGetCachesDefault(int(*e.Code)).WithPayload(e) - } - return cache.NewGetCachesOK().WithPayload(rs) -} - -// Handle executing the request and returning a response -func (h *ReplaceCacheHandlerImpl) Handle(params cache.ReplaceCacheParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return cache.NewReplaceCacheDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return cache.NewReplaceCacheDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditCache(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return cache.NewReplaceCacheDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return cache.NewReplaceCacheDefault(int(*e.Code)).WithPayload(e) - } - return cache.NewReplaceCacheOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return cache.NewReplaceCacheAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return cache.NewReplaceCacheAccepted().WithPayload(params.Data) -} diff --git a/handlers/capture.go b/handlers/capture.go deleted file mode 100644 index d2f20f9f..00000000 --- a/handlers/capture.go +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - capture "github.com/haproxytech/dataplaneapi/operations/declare_capture" -) - -type CreateDeclareCaptureHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type DeleteDeclareCaptureHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type GetDeclareCaptureHandlerImpl struct { - Client client_native.HAProxyClient -} - -type GetDeclareCapturesHandlerImpl struct { - Client client_native.HAProxyClient -} - -type ReplaceDeclareCaptureHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type ReplaceDeclareCapturesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateDeclareCaptureHandlerImpl) Handle(params capture.CreateDeclareCaptureParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return capture.NewCreateDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewGetDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - _, frontend, err := configuration.GetFrontend(params.ParentName, t) - if frontend == nil { - return capture.NewGetDeclareCaptureNotFound() - } - if err != nil { - return capture.NewGetDeclareCaptureNotFound() - } - err = configuration.CreateDeclareCapture(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return capture.NewCreateDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return capture.NewCreateDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewCreateDeclareCaptureCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return capture.NewCreateDeclareCaptureAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return capture.NewCreateDeclareCaptureAccepted().WithPayload(params.Data) -} - -func (h *DeleteDeclareCaptureHandlerImpl) Handle(params capture.DeleteDeclareCaptureParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return capture.NewCreateDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewDeleteDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.DeleteDeclareCapture(params.Index, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return capture.NewDeleteDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return capture.NewDeleteDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewDeleteDeclareCaptureNoContent() - } - rID := h.ReloadAgent.Reload() - return capture.NewCreateDeclareCaptureAccepted().WithReloadID(rID) - } - return capture.NewDeleteDeclareCaptureAccepted() -} - -func (h *GetDeclareCaptureHandlerImpl) Handle(params capture.GetDeclareCaptureParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewGetDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - - _, frontend, err := configuration.GetFrontend(params.ParentName, t) - if frontend == nil { - return capture.NewGetDeclareCaptureNotFound() - } - if err != nil { - return capture.NewGetDeclareCaptureNotFound() - } - _, data, err := configuration.GetDeclareCapture(params.Index, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return capture.NewGetDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewGetDeclareCaptureOK().WithPayload(data) -} - -func (h *GetDeclareCapturesHandlerImpl) Handle(params capture.GetDeclareCapturesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewGetDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - - _, frontend, err := configuration.GetFrontend(params.ParentName, t) - if frontend == nil { - return capture.NewGetDeclareCaptureNotFound() - } - if err != nil { - return capture.NewGetDeclareCaptureNotFound() - } - _, data, err := configuration.GetDeclareCaptures(params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return capture.NewGetDeclareCapturesOK().WithPayload(data) - } - return capture.NewGetDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewGetDeclareCapturesOK().WithPayload(data) -} - -func (h *ReplaceDeclareCaptureHandlerImpl) Handle(params capture.ReplaceDeclareCaptureParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return capture.NewReplaceDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - - _, frontend, err := configuration.GetFrontend(params.ParentName, t) - if frontend == nil { - return capture.NewGetDeclareCaptureNotFound() - } - if err != nil { - return capture.NewGetDeclareCaptureNotFound() - } - err = configuration.EditDeclareCapture(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCaptureDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewReplaceDeclareCaptureOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return capture.NewReplaceDeclareCaptureAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return capture.NewReplaceDeclareCaptureAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceDeclareCapturesHandlerImpl) Handle(params capture.ReplaceDeclareCapturesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return capture.NewReplaceDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceDeclareCaptures(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return capture.NewReplaceDeclareCapturesDefault(int(*e.Code)).WithPayload(e) - } - return capture.NewReplaceDeclareCapturesOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return capture.NewReplaceDeclareCapturesAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return capture.NewReplaceDeclareCapturesAccepted().WithPayload(params.Data) -} diff --git a/handlers/cluster.go b/handlers/cluster.go deleted file mode 100644 index 28e8e2cb..00000000 --- a/handlers/cluster.go +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "errors" - "fmt" - "reflect" - "strings" - "time" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/configuration" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/operations/cluster" - "github.com/haproxytech/dataplaneapi/storagetype" -) - -// CreateClusterHandlerImpl implementation of the CreateClusterHandler interface -type CreateClusterHandlerImpl struct { - Client client_native.HAProxyClient - Config *configuration.Configuration - ReloadAgent haproxy.IReloadAgent -} - -// GetClusterHandlerImpl implementation of the GetClusterHandler interface -type GetClusterHandlerImpl struct { - Config *configuration.Configuration -} - -// ClusterInitiateCertificateRefreshHandlerImpl implementation of the ClusterInitiateCertificateRefreshHandler interface -type ClusterInitiateCertificateRefreshHandlerImpl struct { - Config *configuration.Configuration -} - -type DeleteClusterHandlerImpl struct { - Client client_native.HAProxyClient - Config *configuration.Configuration - Users *configuration.Users - ReloadAgent haproxy.IReloadAgent -} - -type EditClusterHandlerImpl struct { - Config *configuration.Configuration -} - -// Handle executing the request and returning a response -func (h *ClusterInitiateCertificateRefreshHandlerImpl) Handle(params cluster.InitiateCertificateRefreshParams, principal any) middleware.Responder { - if h.Config.Mode.Load() != configuration.ModeCluster { - return cluster.NewInitiateCertificateRefreshForbidden() - } - h.Config.Notify.CertificateRefresh.Notify() - return cluster.NewInitiateCertificateRefreshOK() -} - -func (h *CreateClusterHandlerImpl) err500(err error, transaction *models.Transaction) middleware.Responder { - if transaction != nil { - configuration, confErr := h.Client.Configuration() - if confErr == nil { - _ = configuration.DeleteTransaction(transaction.ID) - } - } - msg := err.Error() - code := int64(500) - return cluster.NewPostClusterDefault(500).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func (h *CreateClusterHandlerImpl) err406(err error, transaction *models.Transaction) middleware.Responder { - // 406 Not Acceptable - if transaction != nil { - configuration, confErr := h.Client.Configuration() - if confErr == nil { - _ = configuration.DeleteTransaction(transaction.ID) - } - } - msg := err.Error() - code := int64(406) - return cluster.NewPostClusterDefault(406).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func (h *CreateClusterHandlerImpl) err409(err error, transaction *models.Transaction) middleware.Responder { - // 409 Conflict - if transaction != nil { - configuration, confErr := h.Client.Configuration() - if confErr == nil { - _ = configuration.DeleteTransaction(transaction.ID) - } - } - msg := err.Error() - code := int64(409) - return cluster.NewPostClusterDefault(409).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func (h *CreateClusterHandlerImpl) Handle(params cluster.PostClusterParams, principal any) middleware.Responder { - key := h.Config.Cluster.BootstrapKey.Load() - if params.Data.BootstrapKey != "" && key != params.Data.BootstrapKey { - // before we switch to cluster mode, check if folder for storage is compatible with dataplane - key, err := configuration.DecodeBootstrapKey(params.Data.BootstrapKey) - if err != nil { - return h.err406(err, nil) - } - log.Warningf("received instructions from %s to join cluster %s at %s", params.HTTPRequest.RemoteAddr, key["name"], key["address"]) - errStorageDir := configuration.CheckIfStorageDirIsOK(key["storage-dir"], h.Config) - if errStorageDir != nil { - log.Warningf("configured storage dir incompatible with cluster configuration: %s", errStorageDir) - return h.err409(errStorageDir, nil) - } - // Init NOTICE file to inform user that the cluster storage folder is programmatically managed by Fusion API - if errStorageInit := configuration.InitStorageNoticeFile(key["storage-dir"]); errStorageInit != nil { - log.Warningf("unable to create notice file, %s: skipping it", errStorageInit.Error()) - } - // enforcing API advertising options - if a := params.AdvertisedAddress; a != nil { - h.Config.APIOptions.APIAddress = *a - } - if p := params.AdvertisedPort; p != nil { - h.Config.APIOptions.APIPort = *p - } - h.Config.Mode.Store(configuration.ModeCluster) - h.Config.Cluster.BootstrapKey.Store(params.Data.BootstrapKey) - h.Config.Cluster.Clear() - // ensuring configuration file saving occurs before notifying the monitor about the bootstrap key change - defer func() { - h.Config.Notify.BootstrapKeyChanged.Notify() - }() - } - err := h.Config.SaveClusterModeData() - if err != nil { - return h.err500(err, nil) - } - return cluster.NewPostClusterOK().WithPayload(getClusterSettings(h.Config)) -} - -// Handle executing the request and returning a response -func (h *GetClusterHandlerImpl) Handle(params cluster.GetClusterParams, principal any) middleware.Responder { - return cluster.NewGetClusterOK().WithPayload(getClusterSettings(h.Config)) -} - -func (h *DeleteClusterHandlerImpl) Handle(params cluster.DeleteClusterParams, principal any) middleware.Responder { - log.Warningf("received instructions from %s to switch to standalone mode", params.HTTPRequest.RemoteAddr) - // Only do when dataplane is in cluster mode, if not, do nothing and return 204 - if h.Config.Mode.Load() == configuration.ModeCluster { - log.Warning("clearing cluster users") - for _, u := range h.Users.GetUsers() { - // remove all users for cluster communication - if strings.HasPrefix(u.Name, storagetype.DapiClusterUserPrefix) { - errRU := h.Users.RemoveUser(u) - if errRU != nil { - log.Error(errRU.Error()) - } - } - } - // If we don't want to keep the haproxy configuration, set it to dummy config - if params.Configuration == nil || *params.Configuration != "keep" { - log.Warning("clearing configuration as requested") - - conf, err := h.Client.Configuration() - if err != nil { - return h.err500(err, nil) - } - version, errVersion := conf.GetVersion("") - if errVersion != nil || version < 1 { - // silently fallback to 1 - version = 1 - } - - config := fmt.Sprintf(DummyConfig, time.Now().Format("01-02-2006 15:04:05 MST"), h.Config.Name.Load()) - if err = conf.PostRawConfiguration(&config, version, true); err != nil { - return h.err500(err, nil) - } - - // we need to restart haproxy - err = h.ReloadAgent.Restart() - if err != nil { - return h.err500(err, nil) - } - // Deleting the storage directory used by Fusion: - // avoiding at all entering any nil pointer dereference. - if storageData := h.Config.GetStorageData(); storageData != nil && storageData.DeprecatedCluster != nil && storageData.DeprecatedCluster.StorageDir != nil { - if storageErr := configuration.RemoveStorageFolder(*storageData.DeprecatedCluster.StorageDir); storageErr != nil { - log.Warningf("failed to clean-up the cluster storage directory: %s", storageErr.Error()) - } - } - } - h.Config.Cluster.BootstrapKey.Store("") - h.Config.Status.Store("active") - h.Config.HAProxy.ClusterTLSCertDir = "" - h.Config.Cluster.Clear() - defer func() { - log.Warning("reloading to apply configuration changes") - h.Config.Notify.Reload.Notify() - }() - } - err := h.Config.SaveClusterModeData() - if err != nil { - return h.err500(err, nil) - } - return cluster.NewDeleteClusterNoContent() -} - -func (h *DeleteClusterHandlerImpl) err500(err error, transaction *models.Transaction) middleware.Responder { - if transaction != nil { - configuration, confErr := h.Client.Configuration() - if confErr == nil { - _ = configuration.DeleteTransaction(transaction.ID) - } - } - msg := err.Error() - code := int64(500) - return cluster.NewDeleteClusterDefault(500).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func (h *EditClusterHandlerImpl) Handle(params cluster.EditClusterParams, principal any) middleware.Responder { - // Only do when dataplane is in cluster mode, if not, do nothing and return 204 - if h.Config.Mode.Load() == configuration.ModeCluster { - // for now change only cluster log targets in PUT method - if params.Data != nil && params.Data.Cluster != nil { - if clusterLogTargetsChanged(h.Config.Cluster.ClusterLogTargets, params.Data.Cluster.ClusterLogTargets) { - h.Config.Cluster.ClusterLogTargets = params.Data.Cluster.ClusterLogTargets - h.Config.Cluster.ClusterID.Store(params.Data.Cluster.ClusterID) - err := h.Config.Save() - if err != nil { - return h.err500(err) - } - defer h.Config.Notify.Reload.Notify() - } - } - return cluster.NewEditClusterOK().WithPayload(getClusterSettings(h.Config)) - } - return h.err406(errors.New("dataplaneapi in single mode")) -} - -func (h *EditClusterHandlerImpl) err406(err error) middleware.Responder { - // 406 Not Acceptable - msg := err.Error() - code := int64(406) - return cluster.NewEditClusterDefault(406).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func (h *EditClusterHandlerImpl) err500(err error) middleware.Responder { - msg := err.Error() - code := int64(500) - return cluster.NewEditClusterDefault(500).WithPayload(&models.Error{ - Code: &code, - Message: &msg, - }) -} - -func getClusterSettings(cfg *configuration.Configuration) *models.ClusterSettings { - portStr := cfg.Cluster.Port.Load() - port := int64(portStr) - var clusterSettings *models.ClusterSettingsCluster - if cfg.Mode.Load() == configuration.ModeCluster { - clusterSettings = &models.ClusterSettingsCluster{ - Address: cfg.Cluster.URL.Load(), - Port: &port, - APIBasePath: cfg.Cluster.APIBasePath.Load(), - Name: cfg.Cluster.Name.Load(), - Description: cfg.Cluster.Description.Load(), - ClusterLogTargets: cfg.Cluster.ClusterLogTargets, - } - } - settings := &models.ClusterSettings{ - BootstrapKey: cfg.Cluster.BootstrapKey.Load(), - Cluster: clusterSettings, - Mode: cfg.Mode.Load(), - Status: cfg.Status.Load(), - } - return settings -} - -func clusterLogTargetsChanged(oldCLT []*models.ClusterLogTarget, newCLT []*models.ClusterLogTarget) bool { - if len(oldCLT) == len(newCLT) { - eqCtr := 0 - for _, oldT := range oldCLT { - for _, newT := range newCLT { - if reflect.DeepEqual(oldT, newT) { - eqCtr++ - } - } - } - return eqCtr != len(oldCLT) - } - return true -} - -const DummyConfig = `# NOTE: This configuration file was managed by the Fusion Control Plane. -# Fusion released the control at %s - -defaults - mode http - timeout connect 5000 - timeout client 30000 - timeout server 10000 - -frontend disabled - bind /tmp/dataplaneapi-%s.sock name tmp - -` diff --git a/handlers/configuration/acl/acl.gen.go b/handlers/configuration/acl/acl.gen.go new file mode 100644 index 00000000..94a25ee0 --- /dev/null +++ b/handlers/configuration/acl/acl.gen.go @@ -0,0 +1,2486 @@ +// Package acl provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package acl + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Acl defines model for acl. +type Acl = models.ACL + +// Acls defines model for acls. +type Acls = models.Acls + +// GetAllAclBackendParams defines parameters for GetAllAclBackend. +type GetAllAclBackendParams struct { + // AclName ACL name + AclName string `form:"acl_name,omitempty" json:"acl_name,omitempty,omitzero"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllAclBackendParams defines parameters for ReplaceAllAclBackend. +type ReplaceAllAclBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteAclBackendParams defines parameters for DeleteAclBackend. +type DeleteAclBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAclBackendParams defines parameters for GetAclBackend. +type GetAclBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateAclBackendParams defines parameters for CreateAclBackend. +type CreateAclBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAclBackendParams defines parameters for ReplaceAclBackend. +type ReplaceAclBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllAclDefaultsParams defines parameters for GetAllAclDefaults. +type GetAllAclDefaultsParams struct { + // AclName ACL name + AclName string `form:"acl_name,omitempty" json:"acl_name,omitempty,omitzero"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllAclDefaultsParams defines parameters for ReplaceAllAclDefaults. +type ReplaceAllAclDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteAclDefaultsParams defines parameters for DeleteAclDefaults. +type DeleteAclDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAclDefaultsParams defines parameters for GetAclDefaults. +type GetAclDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateAclDefaultsParams defines parameters for CreateAclDefaults. +type CreateAclDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAclDefaultsParams defines parameters for ReplaceAclDefaults. +type ReplaceAclDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllAclFCGIAppParams defines parameters for GetAllAclFCGIApp. +type GetAllAclFCGIAppParams struct { + // AclName ACL name + AclName string `form:"acl_name,omitempty" json:"acl_name,omitempty,omitzero"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllAclFCGIAppParams defines parameters for ReplaceAllAclFCGIApp. +type ReplaceAllAclFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteAclFCGIAppParams defines parameters for DeleteAclFCGIApp. +type DeleteAclFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAclFCGIAppParams defines parameters for GetAclFCGIApp. +type GetAclFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateAclFCGIAppParams defines parameters for CreateAclFCGIApp. +type CreateAclFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAclFCGIAppParams defines parameters for ReplaceAclFCGIApp. +type ReplaceAclFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllAclFrontendParams defines parameters for GetAllAclFrontend. +type GetAllAclFrontendParams struct { + // AclName ACL name + AclName string `form:"acl_name,omitempty" json:"acl_name,omitempty,omitzero"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllAclFrontendParams defines parameters for ReplaceAllAclFrontend. +type ReplaceAllAclFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteAclFrontendParams defines parameters for DeleteAclFrontend. +type DeleteAclFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAclFrontendParams defines parameters for GetAclFrontend. +type GetAclFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateAclFrontendParams defines parameters for CreateAclFrontend. +type CreateAclFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAclFrontendParams defines parameters for ReplaceAclFrontend. +type ReplaceAclFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllAclBackendJSONRequestBody defines body for ReplaceAllAclBackend for application/json ContentType. +type ReplaceAllAclBackendJSONRequestBody = Acls + +// CreateAclBackendJSONRequestBody defines body for CreateAclBackend for application/json ContentType. +type CreateAclBackendJSONRequestBody = Acl + +// ReplaceAclBackendJSONRequestBody defines body for ReplaceAclBackend for application/json ContentType. +type ReplaceAclBackendJSONRequestBody = Acl + +// ReplaceAllAclDefaultsJSONRequestBody defines body for ReplaceAllAclDefaults for application/json ContentType. +type ReplaceAllAclDefaultsJSONRequestBody = Acls + +// CreateAclDefaultsJSONRequestBody defines body for CreateAclDefaults for application/json ContentType. +type CreateAclDefaultsJSONRequestBody = Acl + +// ReplaceAclDefaultsJSONRequestBody defines body for ReplaceAclDefaults for application/json ContentType. +type ReplaceAclDefaultsJSONRequestBody = Acl + +// ReplaceAllAclFCGIAppJSONRequestBody defines body for ReplaceAllAclFCGIApp for application/json ContentType. +type ReplaceAllAclFCGIAppJSONRequestBody = Acls + +// CreateAclFCGIAppJSONRequestBody defines body for CreateAclFCGIApp for application/json ContentType. +type CreateAclFCGIAppJSONRequestBody = Acl + +// ReplaceAclFCGIAppJSONRequestBody defines body for ReplaceAclFCGIApp for application/json ContentType. +type ReplaceAclFCGIAppJSONRequestBody = Acl + +// ReplaceAllAclFrontendJSONRequestBody defines body for ReplaceAllAclFrontend for application/json ContentType. +type ReplaceAllAclFrontendJSONRequestBody = Acls + +// CreateAclFrontendJSONRequestBody defines body for CreateAclFrontend for application/json ContentType. +type CreateAclFrontendJSONRequestBody = Acl + +// ReplaceAclFrontendJSONRequestBody defines body for ReplaceAclFrontend for application/json ContentType. +type ReplaceAclFrontendJSONRequestBody = Acl + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all ACL lines + // (GET /services/haproxy/configuration/backends/{parent_name}/acls) + GetAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclBackendParams) + // Replace an ACL list + // (PUT /services/haproxy/configuration/backends/{parent_name}/acls) + ReplaceAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclBackendParams) + // Delete a ACL line + // (DELETE /services/haproxy/configuration/backends/{parent_name}/acls/{index}) + DeleteAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclBackendParams) + // Return one ACL line + // (GET /services/haproxy/configuration/backends/{parent_name}/acls/{index}) + GetAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclBackendParams) + // Add a new ACL line + // (POST /services/haproxy/configuration/backends/{parent_name}/acls/{index}) + CreateAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclBackendParams) + // Replace a ACL line + // (PUT /services/haproxy/configuration/backends/{parent_name}/acls/{index}) + ReplaceAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclBackendParams) + // Return an array of all ACL lines + // (GET /services/haproxy/configuration/defaults/{parent_name}/acls) + GetAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclDefaultsParams) + // Replace an ACL list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/acls) + ReplaceAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclDefaultsParams) + // Delete a ACL line + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) + DeleteAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclDefaultsParams) + // Return one ACL line + // (GET /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) + GetAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclDefaultsParams) + // Add a new ACL line + // (POST /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) + CreateAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclDefaultsParams) + // Replace a ACL line + // (PUT /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) + ReplaceAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclDefaultsParams) + // Return an array of all ACL lines + // (GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls) + GetAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFCGIAppParams) + // Replace an ACL list + // (PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls) + ReplaceAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFCGIAppParams) + // Delete a ACL line + // (DELETE /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) + DeleteAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFCGIAppParams) + // Return one ACL line + // (GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) + GetAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFCGIAppParams) + // Add a new ACL line + // (POST /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) + CreateAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFCGIAppParams) + // Replace a ACL line + // (PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) + ReplaceAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFCGIAppParams) + // Return an array of all ACL lines + // (GET /services/haproxy/configuration/frontends/{parent_name}/acls) + GetAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFrontendParams) + // Replace an ACL list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/acls) + ReplaceAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFrontendParams) + // Delete a ACL line + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) + DeleteAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFrontendParams) + // Return one ACL line + // (GET /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) + GetAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFrontendParams) + // Add a new ACL line + // (POST /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) + CreateAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFrontendParams) + // Replace a ACL line + // (PUT /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) + ReplaceAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all ACL lines +// (GET /services/haproxy/configuration/backends/{parent_name}/acls) +func (_ Unimplemented) GetAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an ACL list +// (PUT /services/haproxy/configuration/backends/{parent_name}/acls) +func (_ Unimplemented) ReplaceAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a ACL line +// (DELETE /services/haproxy/configuration/backends/{parent_name}/acls/{index}) +func (_ Unimplemented) DeleteAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one ACL line +// (GET /services/haproxy/configuration/backends/{parent_name}/acls/{index}) +func (_ Unimplemented) GetAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new ACL line +// (POST /services/haproxy/configuration/backends/{parent_name}/acls/{index}) +func (_ Unimplemented) CreateAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a ACL line +// (PUT /services/haproxy/configuration/backends/{parent_name}/acls/{index}) +func (_ Unimplemented) ReplaceAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all ACL lines +// (GET /services/haproxy/configuration/defaults/{parent_name}/acls) +func (_ Unimplemented) GetAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an ACL list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/acls) +func (_ Unimplemented) ReplaceAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a ACL line +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) +func (_ Unimplemented) DeleteAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one ACL line +// (GET /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) +func (_ Unimplemented) GetAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new ACL line +// (POST /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) +func (_ Unimplemented) CreateAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a ACL line +// (PUT /services/haproxy/configuration/defaults/{parent_name}/acls/{index}) +func (_ Unimplemented) ReplaceAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all ACL lines +// (GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls) +func (_ Unimplemented) GetAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an ACL list +// (PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls) +func (_ Unimplemented) ReplaceAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a ACL line +// (DELETE /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) +func (_ Unimplemented) DeleteAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one ACL line +// (GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) +func (_ Unimplemented) GetAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new ACL line +// (POST /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) +func (_ Unimplemented) CreateAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a ACL line +// (PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}) +func (_ Unimplemented) ReplaceAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all ACL lines +// (GET /services/haproxy/configuration/frontends/{parent_name}/acls) +func (_ Unimplemented) GetAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an ACL list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/acls) +func (_ Unimplemented) ReplaceAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a ACL line +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) +func (_ Unimplemented) DeleteAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one ACL line +// (GET /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) +func (_ Unimplemented) GetAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new ACL line +// (POST /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) +func (_ Unimplemented) CreateAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a ACL line +// (PUT /services/haproxy/configuration/frontends/{parent_name}/acls/{index}) +func (_ Unimplemented) ReplaceAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllAclBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllAclBackendParams + + // ------------- Optional query parameter "acl_name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "acl_name", r.URL.Query(), ¶ms.AclName, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "acl_name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "acl_name", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllAclBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllAclBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllAclBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllAclBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAclBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteAclBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAclBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAclBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAclBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAclBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAclBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateAclBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAclBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAclBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAclBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAclBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAclBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllAclDefaultsParams + + // ------------- Optional query parameter "acl_name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "acl_name", r.URL.Query(), ¶ms.AclName, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "acl_name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "acl_name", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllAclDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllAclDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllAclDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteAclDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAclDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAclDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAclDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateAclDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAclDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAclDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAclDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAclDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAclDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) GetAllAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllAclFCGIAppParams + + // ------------- Optional query parameter "acl_name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "acl_name", r.URL.Query(), ¶ms.AclName, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "acl_name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "acl_name", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllAclFCGIApp(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllAclFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllAclFCGIApp(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) DeleteAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteAclFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAclFCGIApp(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) GetAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAclFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAclFCGIApp(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) CreateAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateAclFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAclFCGIApp(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAclFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAclFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAclFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAclFCGIApp(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllAclFrontendParams + + // ------------- Optional query parameter "acl_name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "acl_name", r.URL.Query(), ¶ms.AclName, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "acl_name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "acl_name", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllAclFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllAclFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllAclFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteAclFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAclFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAclFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAclFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateAclFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAclFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAclFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAclFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAclFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAclFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls", wrapper.GetAllAclBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls", wrapper.ReplaceAllAclBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls/{index}", wrapper.DeleteAclBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls/{index}", wrapper.GetAclBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls/{index}", wrapper.CreateAclBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/acls/{index}", wrapper.ReplaceAclBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls", wrapper.GetAllAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls", wrapper.ReplaceAllAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls/{index}", wrapper.DeleteAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls/{index}", wrapper.GetAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls/{index}", wrapper.CreateAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/acls/{index}", wrapper.ReplaceAclDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls", wrapper.GetAllAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls", wrapper.ReplaceAllAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}", wrapper.DeleteAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}", wrapper.GetAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}", wrapper.CreateAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}", wrapper.ReplaceAclFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls", wrapper.GetAllAclFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls", wrapper.ReplaceAllAclFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls/{index}", wrapper.DeleteAclFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls/{index}", wrapper.GetAclFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls/{index}", wrapper.CreateAclFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/acls/{index}", wrapper.ReplaceAclFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7F3fTxs5EP5XLLdPdxs2pajS5Z5CaHtI6IR6p3spFBl7knW7sbe2lxCh/O8ne38kS35CIZBoXqqQdezx", + "eOb7Zsef1DvK9TDTCpSztHNHDdhMKwvhD5sBl33JmZNaXQ21gNRecT0canVVD6y+76YGmBh/vJW2mIpr", + "5UA5/5FlWVpOE3+3WoXJeQJD5j+9NdCnHfomnpoSF09t/CATwBht6GQyiagAy43M/K9oh/6bAClnAkEM", + "WJ0bDoQVJhMobI5oAkyACdb3tOrLQW7Cwq3/wFhZ2N2cuTGM9GUK5KYcG81s0Y0zoB1qnZFq4C2cRA/z", + "7jETX+BnDta9MtceM+/QwrLX7MAT6LM8dR/DPl6XCz+DAsNSUtj2mp34t3afdK7EbqT3iFmitCP9YPJW", + "/TqpHofVGE9nhunr78B9sty2BrpVflls8aDbO5t90JLDTJvg44y5hHboQLokvz7gehgnLDP6duyAJzFP", + "JSjXUszJG4hvPsTFfNQbwngarJAOhnbdgXhTJ1FlKjOGjZdY6md9alMfEQ6b+bVKrac01xssVV/Ph01X", + "ke75KelrQ4ZMsYFUA/JX99zPSbq9M5JKBfaARtRJl3orq4cnzDFynjIFYYIWKeKhirkO9WejM1Ask7RD", + "3x+0D97RKOwgnGxswdxIDrbaQsxnIzi+ZvwHKGHju4wZUO5KsSFM4ipCBuDmN/MFXG6UJSxNp8YTlzBH", + "mAFSLQCCSDWThcfFUn6XOoNi/VMR0M5107TL03JEsN+wIbiQm1/vr38eLCXeUuodTjvFiUU0fOX/qrdC", + "I+q5SBoQtONMDrNZmjHnwPjff/v67eLCXFyoi7zdfs/Dv/Dbn2/f+E+HH+4mF/Ty97c0mkvsaO6ke2cN", + "y37mYMZT0xhPK7uWo8XcpKcnRPeJS4A4w5RlPKDPKAEDZORhTTniNGFChEG1ew9IjykPeNdAcgvC/0RV", + "gEWknZ7OwRJ7Z9a7kmKl1ZdRs1Y8bLefjBVCPC7A+X9yzsHafp5ON71tvhRFHbFsC7VP4sdXJwEJ8+GQ", + "mXGdf4QpEtDYh0YjFX2YsoHPHB+N9HIS0SxfmMdZyjhYwsgo0SmQVFrnZ+v2ziwZSZeEaArfDuQNKJ/P", + "dWYGMHMNnl2a4eVK+5PlO5GQc1aX0V+s7I+PJ8B/eC5qkEJlz2JjZzc8a3DUeJIwS6SzRI+m0y3Z0Yo8", + "k8rBAMzCE+gTCy4iQhPm98KBGEg1E+Erb/WISVcH6QwpFcNaAlI2fugWmSU8YWoA1ufC7DjPfH6igHEg", + "iJAGuEvHPgwa3l3mhrCHq8K4hi9qfOmz1EIdnNdap8BUBbzhfetYi/EzYG4ztyYvgPPdRqlhCjgRvvY5", + "bB8+++pNcigCgDDOIXMgCFNVTFWvvXDv3eJLEXGnJ/MYPAWS+rdkQQws4p2jwu9PyDkzLYWX4bVwrJ7Y", + "irMODYQGlfl6nWsBA1Ct0mGtay3GrTKJBHMszPoLdW98J5WA20lxWCk4mD+2k/C9Z84qKu9B6PU4wF+Y", + "ifSNHm5KlcXMm9Nkvf6pX2oxU8ry0XKOXI+3SMdIx0jHG9Nxgx8P171vvBZKOWwfLehdVAhTgGFg3aNi", + "4BPyQt1IfAnmKUB3Bs0XvEKtbIVoBRsxgY/SzXjgMzgkgf0jgWdukrzWHsme4UXZgZnN+kVNF20XQEZX", + "CF83KhhNEaOM2ykseB8+ACx6BhgWjVg0YtGIPZzFlLCuhfPuuVloWh0FrHqO3g22bqrWzVH7jyeev6nl", + "eQnO7QpxjzYf1xxafxnytIV8dfeB5IzkjOSM5PwIcm5vjZyf8WYF2XnKznv2Mlxe2/wiMW9wa1PubRtq", + "pXLDdoVcqRqCeiVsxaFeaQf1SstzvCFY2os8x4IaC2pULKFiCRVLO6pYWlH7bkWxtJwsa8nSpkSJHS4k", + "ZCRk1CyhZmknNUurWyNIA6haQtUSqpY2gItatoSIgYUjFo7YyUHdEuqWULe0Vd3S+jsQpGekZ6RnpGdU", + "LiE/o3Lpkbc3fT6QVyzLtiFd+tT7fNrNshXKpXIECpewG4fCpR0ULi3N8IZuaR+yHKtprKZRtoSyJZQt", + "7ahsaVXhuxXd0lKurGVLG/IkdreQj5GPUbWEqqWdVC2t7IogCaBmCTVLqFlaCxa1ZAnxAotGLBqxiYOK", + "JVQsoWJpm4qltZcfSM5IzkjOSM6oV0J2Rr3SI69tTAjGrfzHcJ/KtVYJlsohqFjCXhwqlnZRsbQ0x5uS", + "pX3Ic6yosaJGzRJqllCztKuapRXF73Y0S0vZcipa2pApsceFjIyMjKolVC3tpmppZW8EaQB1S6hbQt3S", + "BnAxFS4hYmDhiIUjtnJQuYTKJVQubVW5tPYSBOkZ6RnpGekZtUvIz6hdWnh942cFc1OxYm5S2qHxzXs6", + "uZz8HwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/acl/acl.go b/handlers/configuration/acl/acl.go new file mode 100644 index 00000000..7d182a18 --- /dev/null +++ b/handlers/configuration/acl/acl.go @@ -0,0 +1,324 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acl + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all ACL routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy ACL configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclBackendParams) { + h.getAllAcl(w, r, "backend", parentName, params.AclName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllAclBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclBackendParams) { + h.replaceAllAcl(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclBackendParams) { + h.deleteAcl(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclBackendParams) { + h.getAcl(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclBackendParams) { + h.createAcl(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceAclBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclBackendParams) { + h.replaceAcl(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclDefaultsParams) { + h.getAllAcl(w, r, "defaults", parentName, params.AclName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclDefaultsParams) { + h.replaceAllAcl(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclDefaultsParams) { + h.deleteAcl(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclDefaultsParams) { + h.getAcl(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclDefaultsParams) { + h.createAcl(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceAclDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclDefaultsParams) { + h.replaceAcl(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- FCGIApp --- + +func (h *HandlerImpl) GetAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFCGIAppParams) { + h.getAllAcl(w, r, "fcgi-app", parentName, params.AclName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFCGIAppParams) { + h.replaceAllAcl(w, r, "fcgi-app", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFCGIAppParams) { + h.deleteAcl(w, r, "fcgi-app", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFCGIAppParams) { + h.getAcl(w, r, "fcgi-app", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFCGIAppParams) { + h.createAcl(w, r, "fcgi-app", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceAclFCGIApp(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFCGIAppParams) { + h.replaceAcl(w, r, "fcgi-app", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllAclFrontendParams) { + h.getAllAcl(w, r, "frontend", parentName, params.AclName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllAclFrontendParams) { + h.replaceAllAcl(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteAclFrontendParams) { + h.deleteAcl(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetAclFrontendParams) { + h.getAcl(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateAclFrontendParams) { + h.createAcl(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceAclFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceAclFrontendParams) { + h.replaceAcl(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllAcl(w http.ResponseWriter, r *http.Request, parentType, parentName, aclName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var aclNamePtr *string + if aclName != "" { + aclNamePtr = &aclName + } + var acls Acls + if aclNamePtr != nil { + _, acls, err = cfg.GetACLs(parentType, parentName, txID, *aclNamePtr) + } else { + _, acls, err = cfg.GetACLs(parentType, parentName, txID) + } + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, Acls{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, acls) +} + +func (h *HandlerImpl) getAcl(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, data, err := cfg.GetACL(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) +} + +func (h *HandlerImpl) createAcl(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Acl + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateACL(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteAcl(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteACL(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceAcl(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Acl + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditACL(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllAcl(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Acls + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceAcls(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/acme/acme.gen.go b/handlers/configuration/acme/acme.gen.go new file mode 100644 index 00000000..959b910d --- /dev/null +++ b/handlers/configuration/acme/acme.gen.go @@ -0,0 +1,663 @@ +// Package acme provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package acme + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// AcmeProvider defines model for acme_provider. +type AcmeProvider = models.AcmeProvider + +// AcmeProviders defines model for acme_providers. +type AcmeProviders = models.AcmeProviders + +// GetAcmeProvidersParams defines parameters for GetAcmeProviders. +type GetAcmeProvidersParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateAcmeProviderParams defines parameters for CreateAcmeProvider. +type CreateAcmeProviderParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteAcmeProviderParams defines parameters for DeleteAcmeProvider. +type DeleteAcmeProviderParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAcmeProviderParams defines parameters for GetAcmeProvider. +type GetAcmeProviderParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// EditAcmeProviderParams defines parameters for EditAcmeProvider. +type EditAcmeProviderParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateAcmeProviderJSONRequestBody defines body for CreateAcmeProvider for application/json ContentType. +type CreateAcmeProviderJSONRequestBody = AcmeProvider + +// EditAcmeProviderJSONRequestBody defines body for EditAcmeProvider for application/json ContentType. +type EditAcmeProviderJSONRequestBody = AcmeProvider + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of ACME providers + // (GET /services/haproxy/configuration/acme) + GetAcmeProviders(w http.ResponseWriter, r *http.Request, params GetAcmeProvidersParams) + // Add an ACME provider + // (POST /services/haproxy/configuration/acme) + CreateAcmeProvider(w http.ResponseWriter, r *http.Request, params CreateAcmeProviderParams) + // Delete an ACME provider + // (DELETE /services/haproxy/configuration/acme/{name}) + DeleteAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params DeleteAcmeProviderParams) + // Return an ACME provider + // (GET /services/haproxy/configuration/acme/{name}) + GetAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params GetAcmeProviderParams) + // Replace an ACME provider + // (PUT /services/haproxy/configuration/acme/{name}) + EditAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params EditAcmeProviderParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of ACME providers +// (GET /services/haproxy/configuration/acme) +func (_ Unimplemented) GetAcmeProviders(w http.ResponseWriter, r *http.Request, params GetAcmeProvidersParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add an ACME provider +// (POST /services/haproxy/configuration/acme) +func (_ Unimplemented) CreateAcmeProvider(w http.ResponseWriter, r *http.Request, params CreateAcmeProviderParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete an ACME provider +// (DELETE /services/haproxy/configuration/acme/{name}) +func (_ Unimplemented) DeleteAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params DeleteAcmeProviderParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an ACME provider +// (GET /services/haproxy/configuration/acme/{name}) +func (_ Unimplemented) GetAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params GetAcmeProviderParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an ACME provider +// (PUT /services/haproxy/configuration/acme/{name}) +func (_ Unimplemented) EditAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params EditAcmeProviderParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAcmeProviders operation middleware +func (siw *ServerInterfaceWrapper) GetAcmeProviders(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetAcmeProvidersParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAcmeProviders(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAcmeProvider operation middleware +func (siw *ServerInterfaceWrapper) CreateAcmeProvider(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateAcmeProviderParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAcmeProvider(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAcmeProvider operation middleware +func (siw *ServerInterfaceWrapper) DeleteAcmeProvider(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteAcmeProviderParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAcmeProvider(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAcmeProvider operation middleware +func (siw *ServerInterfaceWrapper) GetAcmeProvider(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAcmeProviderParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAcmeProvider(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// EditAcmeProvider operation middleware +func (siw *ServerInterfaceWrapper) EditAcmeProvider(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params EditAcmeProviderParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.EditAcmeProvider(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/acme", wrapper.GetAcmeProviders) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/acme", wrapper.CreateAcmeProvider) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/acme/{name}", wrapper.DeleteAcmeProvider) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/acme/{name}", wrapper.GetAcmeProvider) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/acme/{name}", wrapper.EditAcmeProvider) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNb+M2EP0rBNujbHmzQYH65ny0zaFFkBa9FIExJkcStxKpJSk7RqD/viBp2abtJOuFN3EWvtkSOfNm", + "9ObNkI+UqapWEqU1dPhINZpaSYP+j6mRiUwwsELJcaU4lmbMVFUpOV4u7J6PSo3A59cPwgRTTEmL0rqf", + "UNflwkz6ySjpjbMCK3C/ftaY0SH9KV1BScNbk+4FAbVWmrZtm1COhmlRu110SP8pkCwsIScajWo0QwIB", + "MsGAOaEFAkft0V8qmYm80d5x71/URgTcseVoGclEiWS6WJushWjnNdIhNVYLmTuEbbJfdi+A3+HnBo09", + "stRegEtoQHbMCbzCDJrSXvs4jiuFv6NEDSUJ2I45iX8p+5tqJH8f5T0DQ6SyJPOQXzWvbffaewNW4bjW", + "aio46rUNavIJmSubh16ueouHIdj+iFV4221ZW9ETVa20T3sNtqBDmgtbNJM+U1VaQK3Vw9wiK1JWCpS2", + "J8GKKabTX9JgmDpsESAPUViszEtfK46jTbo4QGuYvxyGOXgc30Cfr8t+V4qHhOsAC5mpbZqNJBnd3pBM", + "aVKBhFzInPwxunU2yejyz2vS5ZywdUKaPk2oFbZ0wLv1V2CB3JYg0dvsBQNrTOoIPKTuC6oaJdSCDunH", + "/qD/gSY+PM+E1KCeCoamiy+NvHs2uHU52u2Q7tA2WhoCknh2EJURKMtlAMjjyHwsqsZg+4Z7WbSb7KlB", + "Q4XWc/a/TZc3V86JLZBYDdIA80U7K1AjmTk1kJZYRYBzv2jprE8uQTqdmCBpDHK3RXZ1ToRZSYvDKJyr", + "zw1qR3gJLgV0zd9Y8Gel4T6JR6yzweBgYrpR1TuE8u+GMTQma8pV+K/dcHhoxE8Fs8xO+u3t3UtDU1Wg", + "50sqRkyMqeeqCHJHKeoIR+/bhNbK7GD1iHNDgEicbdSlVZ5TbCst27S+1AgWN+T9/RM72US94E7w7KSN", + "Fcj+d9IWZ2mBZzfY9YDXASfRmwIMEdYQNVuZeyKiZ1gqpMUc9a5YbjJi0CaEKwIuFoZEY6mA+0cO9QyE", + "9VGu08API25Zj2MJ831DBENYATJHQ0S8DjR6r14rkBMuNDJbzh0Nouw+lQYfwziAi3KxrM4MSoPLDj9R", + "qkSQnYD5cf9C8fn30a4gXc6N0Mjp0OoG2y3h/PA9nW/UfdyEfQVz1z7PBmevhyIW3UANAoxhbZETkB3b", + "uvMYbgy9d4GLN1fbwraSmOVesoMdu/T8PHSwA2r52lnX2//1wPbjm4q3aEkj7r5X3EO2upCbPpnimKPs", + "Lb5Kb6L4vLeoYQ4WvN2vGdTSR7erDV++RIvbHLjyz80WMJJpVe1ob5O5F11nd7vLBWP7dLnYp49xoV1+", + "4F5K1+JNrA57daZTPz310+Pqp1FfO3tp3D4W5T8bnO8YkaMyDlrDg46fH1hgl7dRbyHhQeBeVvE2ef6A", + "rNxB/ekz/vMqu3FEPknscZ7Fj/Uo/oOV5Oqg/2JJ1s3OkqxLYLsmoD1K8pqLU02exp7T2PNerhEGb3WN", + "oIPcnO4RXuse4Qdrdp49B7tGcMZRT7sm1eiSDmk6/Ujb+/ZLAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/acme/acme.go b/handlers/configuration/acme/acme.go new file mode 100644 index 00000000..87babd71 --- /dev/null +++ b/handlers/configuration/acme/acme.go @@ -0,0 +1,170 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all ACME provider routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy ACME provider configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAcmeProviders(w http.ResponseWriter, r *http.Request, params GetAcmeProvidersParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, providers, err := cfg.GetAcmeProviders(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, providers) +} + +func (h *HandlerImpl) CreateAcmeProvider(w http.ResponseWriter, r *http.Request, params CreateAcmeProviderParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data AcmeProvider + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateAcmeProvider(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params DeleteAcmeProviderParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteAcmeProvider(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params GetAcmeProviderParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, provider, err := cfg.GetAcmeProvider(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, provider) +} + +func (h *HandlerImpl) EditAcmeProvider(w http.ResponseWriter, r *http.Request, name string, params EditAcmeProviderParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data AcmeProvider + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditAcmeProvider(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/backend/backend.gen.go b/handlers/configuration/backend/backend.gen.go new file mode 100644 index 00000000..59c37d24 --- /dev/null +++ b/handlers/configuration/backend/backend.gen.go @@ -0,0 +1,728 @@ +// Package backend provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package backend + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Backend defines model for backend. +type Backend = models.Backend + +// Backends defines model for backends. +type Backends = models.Backends + +// GetBackendsParams defines parameters for GetBackends. +type GetBackendsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateBackendParams defines parameters for CreateBackend. +type CreateBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteBackendParams defines parameters for DeleteBackend. +type DeleteBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetBackendParams defines parameters for GetBackend. +type GetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceBackendParams defines parameters for ReplaceBackend. +type ReplaceBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateBackendJSONRequestBody defines body for CreateBackend for application/json ContentType. +type CreateBackendJSONRequestBody = Backend + +// ReplaceBackendJSONRequestBody defines body for ReplaceBackend for application/json ContentType. +type ReplaceBackendJSONRequestBody = Backend + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of backends + // (GET /services/haproxy/configuration/backends) + GetBackends(w http.ResponseWriter, r *http.Request, params GetBackendsParams) + // Add a backend + // (POST /services/haproxy/configuration/backends) + CreateBackend(w http.ResponseWriter, r *http.Request, params CreateBackendParams) + // Delete a backend + // (DELETE /services/haproxy/configuration/backends/{name}) + DeleteBackend(w http.ResponseWriter, r *http.Request, name string, params DeleteBackendParams) + // Return a backend + // (GET /services/haproxy/configuration/backends/{name}) + GetBackend(w http.ResponseWriter, r *http.Request, name string, params GetBackendParams) + // Replace a backend + // (PUT /services/haproxy/configuration/backends/{name}) + ReplaceBackend(w http.ResponseWriter, r *http.Request, name string, params ReplaceBackendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of backends +// (GET /services/haproxy/configuration/backends) +func (_ Unimplemented) GetBackends(w http.ResponseWriter, r *http.Request, params GetBackendsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a backend +// (POST /services/haproxy/configuration/backends) +func (_ Unimplemented) CreateBackend(w http.ResponseWriter, r *http.Request, params CreateBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a backend +// (DELETE /services/haproxy/configuration/backends/{name}) +func (_ Unimplemented) DeleteBackend(w http.ResponseWriter, r *http.Request, name string, params DeleteBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a backend +// (GET /services/haproxy/configuration/backends/{name}) +func (_ Unimplemented) GetBackend(w http.ResponseWriter, r *http.Request, name string, params GetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a backend +// (PUT /services/haproxy/configuration/backends/{name}) +func (_ Unimplemented) ReplaceBackend(w http.ResponseWriter, r *http.Request, name string, params ReplaceBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetBackends operation middleware +func (siw *ServerInterfaceWrapper) GetBackends(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetBackendsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBackends(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateBackend(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteBackend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetBackend operation middleware +func (siw *ServerInterfaceWrapper) GetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBackend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBackend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends", wrapper.GetBackends) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends", wrapper.CreateBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{name}", wrapper.DeleteBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{name}", wrapper.GetBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{name}", wrapper.ReplaceBackend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNj9s2EP0rBNujbDmboEB982bTdi9FkBa9FIExJkcWE4pUSMqOEei/FyT1Ya293nXqbJyFb7ZEzbwZ", + "vXkzmi+U6aLUCpWzdPqFGrSlVhbDH1siE5lg4IRW80JzlHbOdFFoNe8Ottdn0iDwzZvPwkZTTCuHyvmf", + "UJayMZN+sFoF4yzHAvyvnw1mdEp/Snsoabxr06MgoDHa0LquE8rRMiNK/xSd0r9zJI0l5MSg1ZVhSCBC", + "JhgxJzRH4GgC+tdaZWJZmeB49A8aKyLuoeXBMZIJiWTVnE22QnSbEumUWmeEWnqEdXJcdq+Bv8NPFVp3", + "Zqm9Bp/QiOycE3iDGVTSvQlxnFcKf0eFBiSJ2M45iX9q95uuFP8xynsNlijtSBYgP2le6/Z28LYA9hFj", + "1pqjevEBmS+Yz6OlHjUXY5jj6+b01s2RKEptQq5LcDmd0qVwebUYM12kOZRGf944ZHnKpEDlRgqcWGG6", + "+iWNNqkH1KAIiITDwj70clrYddLCBmNgcxC1PTnsr6DI4/Lcltsp4XrAQmV6l0ozRWZvb0mmDSlAwVKo", + "Jflj9tbbJE2iCdummx3ThDrhpIfcnrwBB+StBIXB2oj0ZGmJOaX+hekSFZSCTunL8WT8giYhpPDKU4tm", + "JRjaNqZ04Dfd5skS3W4o79BVRlkCigRCEJ0RkLKDj7yNKMSgS4yWb3kQO7dFlRIMFOhCVf5718/tjbfs", + "ciTOgLLAQhWuczRI1r68lSNOE+A8HOr8jMlrUL7wF0gqi9w/otrCJcL2WuHhCe/qU4XGE1tB4dO95W8u", + "+MFaT3ZQK+7JipaICL7BDVmGzNlwqRcrlgvZS5YlYMkapbwHV1ZJObcYDA5Q8djd6DQDabGr14XWEkHR", + "un6fDEe7q8nkZCLeEWaPNP9VMYbWZpXs389Tt7guOfvD6PKSfv1AEYSqKgowm65ABvWx6DnvYOnZTtvS", + "fV8ntNR2T6HNOLcEiMJ1JxFOBwKxnWzsVtprg+CwF4hnWGsNW6JnL60sR/bRS+swQQ2e/WC3A94GnAzu", + "5GCJcJbodW/unogO8FIoh0s0e3UjIxZdQrgm4GNhSAxKDTxc8qjXIFyIcpsBYeDxx0YcJWyODREsYTmo", + "pZer4TkwGLwGXUBOuDDInNx4Ggyye18aQgzzCO44sfqRNDV8+Vxrvjm1nEY19Q6EQU6nzlRY76j4i2/j", + "9u43XjOfBEUJA+HV5OopPA9VPzKVAGNYOuQEVEv+9hMU78z572Jp3N7simuveN2zZA9Z9zWUV7F5nrCZ", + "bH3eB/u/ntj+cDnzPXrijHMCbRvb1wX9IM40xyWqUfNGRgvNN6OmTjk4CDYfO7+mX/yTdXzzEh3ucuAm", + "XLc9MJIZXezpsItNEH9vcLfRRiuPbLRtLYWoGkUKXxudIDV3hpV/3Ah6aeaXZn4uzXz3y+Pqoen+XHT+", + "avJq115bwFFTeNTrVycW0m7R9j2kOurZYbWuk8O7Aa1w/1rjsJT224GLjl4WECcYIM9h//DM5KHdbjwg", + "D2W1Vx5KCWwwcR2hDs3TF4W4TFqXSeuyNvkfa5PJU65NTJSty97k2+9NnlmjDbw5ydrEG0azajtlZSSd", + "0nT1ktbv6/8CAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/backend/backend.go b/handlers/configuration/backend/backend.go new file mode 100644 index 00000000..b7c9675f --- /dev/null +++ b/handlers/configuration/backend/backend.go @@ -0,0 +1,288 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package backend + +import ( + "net/http" + "slices" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all backend routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy backend configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetBackends(w http.ResponseWriter, r *http.Request, params GetBackendsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var bcks models.Backends + if params.FullSection { + _, bcks, err = cfg.GetStructuredBackends(params.TransactionId) + } else { + _, bcks, err = cfg.GetBackends(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + for _, bck := range bcks { + handleDeprecatedBackendFields(http.MethodGet, bck, nil) + } + respond.JSON(w, http.StatusOK, bcks) +} + +func (h *HandlerImpl) CreateBackend(w http.ResponseWriter, r *http.Request, params CreateBackendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Backend + if !respond.DecodeBody(r, w, &data) { + return + } + handleDeprecatedBackendFields(http.MethodPost, &data, nil) + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredBackend(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateBackend(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteBackend(w http.ResponseWriter, r *http.Request, name string, params DeleteBackendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteBackend(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetBackend(w http.ResponseWriter, r *http.Request, name string, params GetBackendParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var bck *models.Backend + if params.FullSection { + _, bck, err = cfg.GetStructuredBackend(name, params.TransactionId) + } else { + _, bck, err = cfg.GetBackend(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + handleDeprecatedBackendFields(http.MethodGet, bck, nil) + respond.JSON(w, http.StatusOK, bck) +} + +func (h *HandlerImpl) ReplaceBackend(w http.ResponseWriter, r *http.Request, name string, params ReplaceBackendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Backend + if !respond.DecodeBody(r, w, &data) { + return + } + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if data.ForcePersist != nil || data.IgnorePersist != nil { + _, onDisk, confErr := cfg.GetBackend(name, params.TransactionId) + if confErr != nil { + respond.Error(w, confErr) + return + } + handleDeprecatedBackendFields(http.MethodPut, &data, onDisk) + } + + if params.FullSection { + err = cfg.EditStructuredBackend(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditBackend(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// handleDeprecatedBackendFields adds backward compatibility support for the fields +// force_persist and ignore_persist that are deprecated in favour of force_persist_list +// and ignore_persist_list. +func handleDeprecatedBackendFields(method string, payload *models.Backend, onDisk *models.Backend) { + if method == http.MethodGet { + if len(payload.ForcePersistList) > 0 { + payload.ForcePersist = &models.BackendForcePersist{ + Cond: payload.ForcePersistList[0].Cond, + CondTest: payload.ForcePersistList[0].CondTest, + } + } + if len(payload.IgnorePersistList) > 0 { + payload.IgnorePersist = &models.BackendIgnorePersist{ + Cond: payload.IgnorePersistList[0].Cond, + CondTest: payload.IgnorePersistList[0].CondTest, + } + } + return + } + + if payload.ForcePersist != nil && len(payload.ForcePersistList) == 0 { + if method == http.MethodPost || (method == http.MethodPut && (onDisk == nil || len(onDisk.ForcePersistList) == 0)) { + payload.ForcePersistList = []*models.ForcePersist{{ + Cond: payload.ForcePersist.Cond, + CondTest: payload.ForcePersist.CondTest, + }} + } else { + found := -1 + for i, item := range onDisk.ForcePersistList { + if *item.Cond == *payload.ForcePersist.Cond && *item.CondTest == *payload.ForcePersist.CondTest { + found = i + break + } + } + switch found { + case -1: + payload.ForcePersistList = slices.Insert(onDisk.ForcePersistList, 0, &models.ForcePersist{ + Cond: payload.ForcePersist.Cond, + CondTest: payload.ForcePersist.CondTest, + }) + case 0: + payload.ForcePersistList = onDisk.ForcePersistList + default: + payload.ForcePersistList = slices.Concat(onDisk.ForcePersistList[found:found+1], onDisk.ForcePersistList[:found], onDisk.ForcePersistList[found+1:]) + } + } + } + + if payload.IgnorePersist != nil && len(payload.IgnorePersistList) == 0 { + if method == http.MethodPost || (method == http.MethodPut && (onDisk == nil || len(onDisk.IgnorePersistList) == 0)) { + payload.IgnorePersistList = []*models.IgnorePersist{{ + Cond: payload.IgnorePersist.Cond, + CondTest: payload.IgnorePersist.CondTest, + }} + } else { + found := -1 + for i, item := range onDisk.IgnorePersistList { + if *item.Cond == *payload.IgnorePersist.Cond && *item.CondTest == *payload.IgnorePersist.CondTest { + found = i + break + } + } + switch found { + case -1: + payload.IgnorePersistList = slices.Insert(onDisk.IgnorePersistList, 0, &models.IgnorePersist{ + Cond: payload.IgnorePersist.Cond, + CondTest: payload.IgnorePersist.CondTest, + }) + case 0: + payload.IgnorePersistList = onDisk.IgnorePersistList + default: + payload.IgnorePersistList = slices.Concat(onDisk.IgnorePersistList[found:found+1], onDisk.IgnorePersistList[:found], onDisk.IgnorePersistList[found+1:]) + } + } + } + + payload.ForcePersist = nil + payload.IgnorePersist = nil +} diff --git a/handlers/configuration/backend_switching_rule/backend_switching_rule.gen.go b/handlers/configuration/backend_switching_rule/backend_switching_rule.gen.go new file mode 100644 index 00000000..b78a44d3 --- /dev/null +++ b/handlers/configuration/backend_switching_rule/backend_switching_rule.gen.go @@ -0,0 +1,816 @@ +// Package backend_switching_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package backend_switching_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// BackendSwitchingRule defines model for backend_switching_rule. +type BackendSwitchingRule = models.BackendSwitchingRule + +// BackendSwitchingRules defines model for backend_switching_rules. +type BackendSwitchingRules = models.BackendSwitchingRules + +// GetBackendSwitchingRulesParams defines parameters for GetBackendSwitchingRules. +type GetBackendSwitchingRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceBackendSwitchingRulesParams defines parameters for ReplaceBackendSwitchingRules. +type ReplaceBackendSwitchingRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteBackendSwitchingRuleParams defines parameters for DeleteBackendSwitchingRule. +type DeleteBackendSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetBackendSwitchingRuleParams defines parameters for GetBackendSwitchingRule. +type GetBackendSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateBackendSwitchingRuleParams defines parameters for CreateBackendSwitchingRule. +type CreateBackendSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceBackendSwitchingRuleParams defines parameters for ReplaceBackendSwitchingRule. +type ReplaceBackendSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceBackendSwitchingRulesJSONRequestBody defines body for ReplaceBackendSwitchingRules for application/json ContentType. +type ReplaceBackendSwitchingRulesJSONRequestBody = BackendSwitchingRules + +// CreateBackendSwitchingRuleJSONRequestBody defines body for CreateBackendSwitchingRule for application/json ContentType. +type CreateBackendSwitchingRuleJSONRequestBody = BackendSwitchingRule + +// ReplaceBackendSwitchingRuleJSONRequestBody defines body for ReplaceBackendSwitchingRule for application/json ContentType. +type ReplaceBackendSwitchingRuleJSONRequestBody = BackendSwitchingRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Backend Switching Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules) + GetBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetBackendSwitchingRulesParams) + // Replace a Backend Switching Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules) + ReplaceBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceBackendSwitchingRulesParams) + // Delete a Backend Switching Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) + DeleteBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteBackendSwitchingRuleParams) + // Return one Backend Switching Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) + GetBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetBackendSwitchingRuleParams) + // Add a new Backend Switching Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) + CreateBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateBackendSwitchingRuleParams) + // Replace a Backend Switching Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) + ReplaceBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceBackendSwitchingRuleParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Backend Switching Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules) +func (_ Unimplemented) GetBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetBackendSwitchingRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Backend Switching Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules) +func (_ Unimplemented) ReplaceBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceBackendSwitchingRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Backend Switching Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) +func (_ Unimplemented) DeleteBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteBackendSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Backend Switching Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) +func (_ Unimplemented) GetBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetBackendSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Backend Switching Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) +func (_ Unimplemented) CreateBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateBackendSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Backend Switching Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}) +func (_ Unimplemented) ReplaceBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceBackendSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetBackendSwitchingRules operation middleware +func (siw *ServerInterfaceWrapper) GetBackendSwitchingRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBackendSwitchingRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBackendSwitchingRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBackendSwitchingRules operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBackendSwitchingRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBackendSwitchingRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBackendSwitchingRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteBackendSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) DeleteBackendSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteBackendSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteBackendSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetBackendSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) GetBackendSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBackendSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBackendSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateBackendSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) CreateBackendSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateBackendSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateBackendSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBackendSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBackendSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBackendSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBackendSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules", wrapper.GetBackendSwitchingRules) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules", wrapper.ReplaceBackendSwitchingRules) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}", wrapper.DeleteBackendSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}", wrapper.GetBackendSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}", wrapper.CreateBackendSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}", wrapper.ReplaceBackendSwitchingRule) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Frfb9s2EP5XCLZPm2y5aVBg3pPTdFtehiAd9tKkxpk8SWwlUiUpO0ag/30gZclWbTk/4CZeoZfCkfjj", + "u+Pd9x1PvaNMZbmSKK2h4zuq0eRKGvR/mByZiAQDK5ScZopjaqZMZZmS02Zg/XySagS+/HArTLUUU9Ki", + "tO4n5Hm6Wib8YpT0i7MEM3C/XmuM6Ji+CtdQwuqtCR8FAbVWmpZlGVCOhmmRu1l0TP9JkKxWQk40GlVo", + "hgQqyAQrzAFNEDhqj/69kpGIC+03HvyL2ogKd3vl1jASiRTJfDU22DDRLnOkY2qsFjJ2CMvgcd49A36F", + "3wo09shcewbOoRWyY3bgOUZQpPaDt+O4XPgnStSQkgrbMTvxb2X/UIXk/4/0XoAhUlkSecjP6teyfu13", + "mwH7ipJPzUJYlggZT3WR4sZMNfuCzOXP7SBWg9XDyurhWTX5Yz33yk3dGDkQWa60P4ccbELHNBY2KWZD", + "prIwgVyr26VFloQsFSjtQIIVcwzn78JqA+rA7kbowQuLmbnvHDssLIPaQtAalg830BzcwidE2sPOp87a", + "Q8J1gIWM1HZETiSZXF6QSGmSgYRYyJj8Nbl0a5KVI0njSeJcSVBaLdAMaUCtsC7uaD3jHCyQyxQk+lUH", + "HUvQgNZhP6buUFWOEnJBx/TtcDR8QwNvqY+S0KCeC4amNjVkm0kURtrzBjfhXQ4apZ1KyLAM90RgjHbb", + "EVdoCy0NgTTtQG2ITcAS0EhqCMiJkBtUUYNxvlE5VhAvuOdk2xWXOWjI0Hom+fQ9rEtvU7MwccZRd5h0", + "XEVDQP0j91djPQ2ok1ChkdOx1QVukksO1qJ28z9/+nx9ra+v5XUxGr1l/l/85ffXr9yvk3d35TW9+fU1", + "Dbb4KPge5cU5URGxCRKrQRpgnt8WCWokC0ec0hKrCHDuBzWuGZL3IB2lzpAUBrmbImtKJMKsXTusjf5W", + "oF6urd7Ybyr4Xha9CdrV6MlodDDd6Yq2HeLysWAMjYmKdO2H5xZpXhUvXVY1bgqfXhJ5jiyyDPSyyS4C", + "knjidtGyJ9FcyEHs0oHuVKubMqB5sTOJ8xQYGgJkkagUSSqMdZt1ZfRC2MSHpB8YizlKl9FNSnpitK1y", + "oDvHV7v3ef6yeb6FepVB1c7uQFmC7KsLgpaU1Hh2g900eBNw0HqTgCHCGqIW6+U6LNqTq0JajFHvPIGI", + "GLQB4YqAs4Uh0Zgq4P6RQ70AYZuw3RCqatiAYwrLx5oIhrAEZIzGZcfmOKeGbiFPncgJFxqZTZcuDFre", + "7XKDt2FagWv5ouGoCFKDTXDOlEoRZM3n/qJ4pvjyeai8nW7lcSjKZE/JoitO4q7KOhmdvAS8tk5VcUSA", + "McwtcgKyDs362o/f3a2uqsC9ON/m+zUfNXPJjlDaJYGn1VkdUP42WiovI7H+pAl01e1O4u5VVnfvYIpj", + "jHKw8ulgpvhysEpXDhb8xgeuy8M7ITneltUZp2hx+7TP/XPTbWGbzmdLT8V+XSes2YOFvNqo46K8V8Y7", + "gF04DLvlXKxedQv5/aLQFw998dAXD48vHlrSfXLfDetYlOtkdLq9XgfxVFTq1f+0mnZAMWq6ty8hdxVH", + "d2rBQ66Qe/tASuITZMYF+ANFpqMj1CtM34Y6cFV+rF2on4yRVj2ubuJ4UFtLmR2kNOHclb0SF12c9Aji", + "ea8R+uq2r2776rZvjR1OXu7rjL15AZHrqt88AT5TS6zviNUdsdPRbwdev/1fxF5C8yec79XlA/Xb7v/c", + "9UOvKns+bPUlQ18y9CVDXzL8iJJhdDwlw/N+RutrhnXN8JO1CPZ/ozvU5zm3Kep5LcmFTumYhvO3tLwp", + "/wsAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/backend_switching_rule/backend_switching_rule.go b/handlers/configuration/backend_switching_rule/backend_switching_rule.go new file mode 100644 index 00000000..b9b3fe6a --- /dev/null +++ b/handlers/configuration/backend_switching_rule/backend_switching_rule.go @@ -0,0 +1,210 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package backend_switching_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all backend switching rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy backend switching rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetBackendSwitchingRulesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetBackendSwitchingRules(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.BackendSwitchingRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) ReplaceBackendSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceBackendSwitchingRulesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data BackendSwitchingRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceBackendSwitchingRules(parentName, data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) DeleteBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteBackendSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteBackendSwitchingRule(int64(index), parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetBackendSwitchingRuleParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetBackendSwitchingRule(int64(index), parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) CreateBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateBackendSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data BackendSwitchingRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateBackendSwitchingRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceBackendSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceBackendSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data BackendSwitchingRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditBackendSwitchingRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/bind/bind.gen.go b/handlers/configuration/bind/bind.gen.go new file mode 100644 index 00000000..c04f4cb4 --- /dev/null +++ b/handlers/configuration/bind/bind.gen.go @@ -0,0 +1,1572 @@ +// Package bind provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package bind + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Bind defines model for bind. +type Bind = models.Bind + +// Binds defines model for binds. +type Binds = models.Binds + +// GetAllBindFrontendParams defines parameters for GetAllBindFrontend. +type GetAllBindFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateBindFrontendParams defines parameters for CreateBindFrontend. +type CreateBindFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteBindFrontendParams defines parameters for DeleteBindFrontend. +type DeleteBindFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetBindFrontendParams defines parameters for GetBindFrontend. +type GetBindFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceBindFrontendParams defines parameters for ReplaceBindFrontend. +type ReplaceBindFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllBindLogForwardParams defines parameters for GetAllBindLogForward. +type GetAllBindLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateBindLogForwardParams defines parameters for CreateBindLogForward. +type CreateBindLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteBindLogForwardParams defines parameters for DeleteBindLogForward. +type DeleteBindLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetBindLogForwardParams defines parameters for GetBindLogForward. +type GetBindLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceBindLogForwardParams defines parameters for ReplaceBindLogForward. +type ReplaceBindLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllBindPeerParams defines parameters for GetAllBindPeer. +type GetAllBindPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateBindPeerParams defines parameters for CreateBindPeer. +type CreateBindPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteBindPeerParams defines parameters for DeleteBindPeer. +type DeleteBindPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetBindPeerParams defines parameters for GetBindPeer. +type GetBindPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceBindPeerParams defines parameters for ReplaceBindPeer. +type ReplaceBindPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateBindFrontendJSONRequestBody defines body for CreateBindFrontend for application/json ContentType. +type CreateBindFrontendJSONRequestBody = Bind + +// ReplaceBindFrontendJSONRequestBody defines body for ReplaceBindFrontend for application/json ContentType. +type ReplaceBindFrontendJSONRequestBody = Bind + +// CreateBindLogForwardJSONRequestBody defines body for CreateBindLogForward for application/json ContentType. +type CreateBindLogForwardJSONRequestBody = Bind + +// ReplaceBindLogForwardJSONRequestBody defines body for ReplaceBindLogForward for application/json ContentType. +type ReplaceBindLogForwardJSONRequestBody = Bind + +// CreateBindPeerJSONRequestBody defines body for CreateBindPeer for application/json ContentType. +type CreateBindPeerJSONRequestBody = Bind + +// ReplaceBindPeerJSONRequestBody defines body for ReplaceBindPeer for application/json ContentType. +type ReplaceBindPeerJSONRequestBody = Bind + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of binds + // (GET /services/haproxy/configuration/frontends/{parent_name}/binds) + GetAllBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindFrontendParams) + // Add a new bind + // (POST /services/haproxy/configuration/frontends/{parent_name}/binds) + CreateBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindFrontendParams) + // Delete a bind + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) + DeleteBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindFrontendParams) + // Return one bind + // (GET /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) + GetBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindFrontendParams) + // Replace a bind + // (PUT /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) + ReplaceBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindFrontendParams) + // Return an array of binds + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/binds) + GetAllBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindLogForwardParams) + // Add a new bind + // (POST /services/haproxy/configuration/log_forwards/{parent_name}/binds) + CreateBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindLogForwardParams) + // Delete a bind + // (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) + DeleteBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindLogForwardParams) + // Return one bind + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) + GetBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindLogForwardParams) + // Replace a bind + // (PUT /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) + ReplaceBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindLogForwardParams) + // Return an array of binds + // (GET /services/haproxy/configuration/peers/{parent_name}/binds) + GetAllBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindPeerParams) + // Add a new bind + // (POST /services/haproxy/configuration/peers/{parent_name}/binds) + CreateBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindPeerParams) + // Delete a bind + // (DELETE /services/haproxy/configuration/peers/{parent_name}/binds/{name}) + DeleteBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindPeerParams) + // Return one bind + // (GET /services/haproxy/configuration/peers/{parent_name}/binds/{name}) + GetBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindPeerParams) + // Replace a bind + // (PUT /services/haproxy/configuration/peers/{parent_name}/binds/{name}) + ReplaceBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindPeerParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of binds +// (GET /services/haproxy/configuration/frontends/{parent_name}/binds) +func (_ Unimplemented) GetAllBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new bind +// (POST /services/haproxy/configuration/frontends/{parent_name}/binds) +func (_ Unimplemented) CreateBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a bind +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) +func (_ Unimplemented) DeleteBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one bind +// (GET /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) +func (_ Unimplemented) GetBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a bind +// (PUT /services/haproxy/configuration/frontends/{parent_name}/binds/{name}) +func (_ Unimplemented) ReplaceBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of binds +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/binds) +func (_ Unimplemented) GetAllBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new bind +// (POST /services/haproxy/configuration/log_forwards/{parent_name}/binds) +func (_ Unimplemented) CreateBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a bind +// (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) +func (_ Unimplemented) DeleteBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one bind +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) +func (_ Unimplemented) GetBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a bind +// (PUT /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}) +func (_ Unimplemented) ReplaceBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of binds +// (GET /services/haproxy/configuration/peers/{parent_name}/binds) +func (_ Unimplemented) GetAllBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new bind +// (POST /services/haproxy/configuration/peers/{parent_name}/binds) +func (_ Unimplemented) CreateBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a bind +// (DELETE /services/haproxy/configuration/peers/{parent_name}/binds/{name}) +func (_ Unimplemented) DeleteBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one bind +// (GET /services/haproxy/configuration/peers/{parent_name}/binds/{name}) +func (_ Unimplemented) GetBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a bind +// (PUT /services/haproxy/configuration/peers/{parent_name}/binds/{name}) +func (_ Unimplemented) ReplaceBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllBindFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllBindFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllBindFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllBindFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateBindFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateBindFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateBindFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateBindFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteBindFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteBindFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteBindFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteBindFrontend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetBindFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetBindFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBindFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBindFrontend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBindFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBindFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBindFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBindFrontend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllBindLogForward operation middleware +func (siw *ServerInterfaceWrapper) GetAllBindLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllBindLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllBindLogForward(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateBindLogForward operation middleware +func (siw *ServerInterfaceWrapper) CreateBindLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateBindLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateBindLogForward(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteBindLogForward operation middleware +func (siw *ServerInterfaceWrapper) DeleteBindLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteBindLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteBindLogForward(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetBindLogForward operation middleware +func (siw *ServerInterfaceWrapper) GetBindLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBindLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBindLogForward(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBindLogForward operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBindLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBindLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBindLogForward(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllBindPeer operation middleware +func (siw *ServerInterfaceWrapper) GetAllBindPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllBindPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllBindPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateBindPeer operation middleware +func (siw *ServerInterfaceWrapper) CreateBindPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateBindPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateBindPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteBindPeer operation middleware +func (siw *ServerInterfaceWrapper) DeleteBindPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteBindPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteBindPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetBindPeer operation middleware +func (siw *ServerInterfaceWrapper) GetBindPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetBindPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetBindPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceBindPeer operation middleware +func (siw *ServerInterfaceWrapper) ReplaceBindPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceBindPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceBindPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/binds", wrapper.GetAllBindFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/binds", wrapper.CreateBindFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/binds/{name}", wrapper.DeleteBindFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/binds/{name}", wrapper.GetBindFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/binds/{name}", wrapper.ReplaceBindFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/binds", wrapper.GetAllBindLogForward) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/binds", wrapper.CreateBindLogForward) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}", wrapper.DeleteBindLogForward) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}", wrapper.GetBindLogForward) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}", wrapper.ReplaceBindLogForward) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/binds", wrapper.GetAllBindPeer) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/binds", wrapper.CreateBindPeer) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/binds/{name}", wrapper.DeleteBindPeer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/binds/{name}", wrapper.GetBindPeer) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/binds/{name}", wrapper.ReplaceBindPeer) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fnfb9s2EP5XCLZPmxy5aVFg3pPTtF2AYQi6YS9NatDkyWYnkSpJxTUC/+8DSck/4t+tnXrZvQSxRJF3", + "p7vvO913T7kuSq1AOUs799SALbWyEH7YErjMJGdOatUrtIDc9rguCq1604XN9W5ugInx26/Sxq24Vg6U", + "8/+ysszrbdLPVquwOR9Cwfx/zw1ktEOfpTNT0njXpnuZAMZoQyeTSUIFWG5k6Z+iHfrXEEi9EwhiwOrK", + "cCAsmkwg2pzQITABJlj/RqtMDioTDm79DcbKaPfizgvLSCZzIHf12mTORTcugXaodUaqgbdwkuwX3Qsm", + "PsCXCqw7sdBeMB/QaNkpB/ASMlbl7m3w47RC+B4UGJaTaNspB/EP7d7pSon/RnmPmCVKO5IFkx81rpPm", + "djitL2PI6nW6/xm4r5avrYFu1Rejj2cXMpg6vdOSRalNiHLJ3JB26EC6YdU/47pIh6w0+uvYAR+mPJeg", + "XEsxJ+8gvXudxg2pN8WfHwyRDgq77Z0EaydJYy0zho3XG2sPbu035MRusW3q65DmeoOlyvRy7nQV6V5f", + "kUwbUjDFBlINyG/da78n8YEjuVRgz2hCnXS5N7O5e8kcI9c5UxB2aJE6KZrU61D/enQJipWSdujLs/bZ", + "C5oEH8LbTS2YO8nBNk6kfD6R08yE2hU2vS+ZAeV6ihUwSad5MgC37NAHcJVRlrA8J2ElcUPmCDNAmu1B", + "EKnmSvFdfZD3UpcQj78SAfNcN8+9Y82a4IBhBbhQox8fHn8dLCXeUupjTjvxpSU0XPK/pq7QhHpOkgYE", + "7ThTwXy1lsw5MP75Tx8/3dyYmxt1U7XbL3n4Cz/9+vyZ/+/89f3kht7+/JwmSwWePDTu6pLojLghEGeY", + "sowHwBgNwQAZeSRSjjhNmBBh0TQWZ+QNUx6j+kAqC8I/ohqMIdLOYnnWOP2lAjOeeT13Xk+KjbB0myy2", + "d+ft9sGAPKbOCmz+s+IcrM2qfOb1Y3OciNy/zodpUNJv7ygCcFVFwcx4WiqEKRLQ0+dGv8ZKxwY+u2mo", + "6dtJQkttVxRbVwhLGFEwCk/6snILLLe+tN4YYA6wtB6ztJasrtM4nuw5gA+B/+M5YAGKG3tWGzvv8LzB", + "ycKdIbNEOkv0aLbdGo82FIxUDgZgVr6BjFhwCRGaMO8LB2Ig10yES97qEZMueOnfwBwZxGUtATkb7+si", + "s4QPmRqADck/t84zjt8ooBUIIqQB7vKxT4OF6K4LQ/ChF41biMUUKDKWW5gmZ1/rHJhqIDR87FxoMT4o", + "ekbwXKytyRJivzjCmQ8+6Dzc8IAhoQ08b58f/cxFbI+vnTDOoXQgCFNNJjVfmvCgnf8Q8+zqchlIZ/Ax", + "fZasePOraONV5McDUsbcV3zY/5cD7784g/kRzNcVYo62lvjON99cCxiAatXvo9XXYtyqK1Mwx8KO39XC", + "pvfhR0yGHBwsp8VluO4pNtDrIij3xwFQ/SYkM7rYmXrjrvtQb6i29cS7lXG3EhFyO3I7cvvO3L5Atufb", + "vkJOhanO26+W9wvQEvFPRLp5dWAemI4DfwTTRKytAXzVh9XGIYZWsA359/jkeg8OQR9nJd/ZBZ/CqOSJ", + "gUQ9iGmqfeX8pVoJE2XO+C794R4oUW+KSIHtIbaHOPrZd/TTfpzRj4kohbOfI89+nhjPhqRZ140fbOyT", + "60Ev02bEzPHFy9/14F08apN8OVuFKgsKmChg7ixgbiqvmYSJ5YWdLHayKGKiiIki5pMTMbd1s0fWMTcx", + "8EzJ3J2BcViFFI8Uj1omapmnr2VuGW4g8OPoBPVM1DO3IMWcoologW0itok4CUJNEzVN1DT3mQKVAObo", + "YuY1gNkkY/r7qLCggIkC5s4C5uqSmkmXWFLYqmKriqIlipYoWj4h0XJtu3pktXI13c50yl3oFkdPyOfI", + "56hQokJ5+grl2okFgj3OQ1CV/J+rkqvRYU6PRITAdhDbQRzvoBKJSiQqkSzmhgVz11BhZXLaoendSzq5", + "nfwbAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/bind/bind.go b/handlers/configuration/bind/bind.go new file mode 100644 index 00000000..8b7b0f5e --- /dev/null +++ b/handlers/configuration/bind/bind.go @@ -0,0 +1,244 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bind + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all bind routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy bind configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// Frontend parent variants + +func (h *HandlerImpl) GetAllBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindFrontendParams) { + h.getAllBind(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindFrontendParams) { + h.createBind(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindFrontendParams) { + h.deleteBind(w, r, "frontend", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindFrontendParams) { + h.getBind(w, r, "frontend", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceBindFrontend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindFrontendParams) { + h.replaceBind(w, r, "frontend", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// LogForward parent variants + +func (h *HandlerImpl) GetAllBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindLogForwardParams) { + h.getAllBind(w, r, "log_forward", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindLogForwardParams) { + h.createBind(w, r, "log_forward", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindLogForwardParams) { + h.deleteBind(w, r, "log_forward", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindLogForwardParams) { + h.getBind(w, r, "log_forward", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceBindLogForward(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindLogForwardParams) { + h.replaceBind(w, r, "log_forward", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// Peer parent variants + +func (h *HandlerImpl) GetAllBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllBindPeerParams) { + h.getAllBind(w, r, "peers", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateBindPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateBindPeerParams) { + h.createBind(w, r, "peers", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteBindPeerParams) { + h.deleteBind(w, r, "peers", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetBindPeerParams) { + h.getBind(w, r, "peers", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceBindPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceBindPeerParams) { + h.replaceBind(w, r, "peers", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// Shared internal methods + +func (h *HandlerImpl) getAllBind(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, bs, err := cfg.GetBinds(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, Binds{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, bs) +} + +func (h *HandlerImpl) createBind(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Bind + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateBind(parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteBind(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteBind(name, parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getBind(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, b, err := cfg.GetBind(name, parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, b) +} + +func (h *HandlerImpl) replaceBind(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Bind + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditBind(name, parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/cache/cache.gen.go b/handlers/configuration/cache/cache.gen.go new file mode 100644 index 00000000..31816b1b --- /dev/null +++ b/handlers/configuration/cache/cache.gen.go @@ -0,0 +1,663 @@ +// Package cache provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package cache + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Cache defines model for cache. +type Cache = models.Cache + +// Caches defines model for caches. +type Caches = models.Caches + +// GetCachesParams defines parameters for GetCaches. +type GetCachesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateCacheParams defines parameters for CreateCache. +type CreateCacheParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteCacheParams defines parameters for DeleteCache. +type DeleteCacheParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetCacheParams defines parameters for GetCache. +type GetCacheParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceCacheParams defines parameters for ReplaceCache. +type ReplaceCacheParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateCacheJSONRequestBody defines body for CreateCache for application/json ContentType. +type CreateCacheJSONRequestBody = Cache + +// ReplaceCacheJSONRequestBody defines body for ReplaceCache for application/json ContentType. +type ReplaceCacheJSONRequestBody = Cache + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of caches + // (GET /services/haproxy/configuration/caches) + GetCaches(w http.ResponseWriter, r *http.Request, params GetCachesParams) + // Add a cache + // (POST /services/haproxy/configuration/caches) + CreateCache(w http.ResponseWriter, r *http.Request, params CreateCacheParams) + // Delete a cache + // (DELETE /services/haproxy/configuration/caches/{name}) + DeleteCache(w http.ResponseWriter, r *http.Request, name string, params DeleteCacheParams) + // Return a cache + // (GET /services/haproxy/configuration/caches/{name}) + GetCache(w http.ResponseWriter, r *http.Request, name string, params GetCacheParams) + // Replace a cache + // (PUT /services/haproxy/configuration/caches/{name}) + ReplaceCache(w http.ResponseWriter, r *http.Request, name string, params ReplaceCacheParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of caches +// (GET /services/haproxy/configuration/caches) +func (_ Unimplemented) GetCaches(w http.ResponseWriter, r *http.Request, params GetCachesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a cache +// (POST /services/haproxy/configuration/caches) +func (_ Unimplemented) CreateCache(w http.ResponseWriter, r *http.Request, params CreateCacheParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a cache +// (DELETE /services/haproxy/configuration/caches/{name}) +func (_ Unimplemented) DeleteCache(w http.ResponseWriter, r *http.Request, name string, params DeleteCacheParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a cache +// (GET /services/haproxy/configuration/caches/{name}) +func (_ Unimplemented) GetCache(w http.ResponseWriter, r *http.Request, name string, params GetCacheParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a cache +// (PUT /services/haproxy/configuration/caches/{name}) +func (_ Unimplemented) ReplaceCache(w http.ResponseWriter, r *http.Request, name string, params ReplaceCacheParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetCaches operation middleware +func (siw *ServerInterfaceWrapper) GetCaches(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetCachesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCaches(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCache operation middleware +func (siw *ServerInterfaceWrapper) CreateCache(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateCacheParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCache(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCache operation middleware +func (siw *ServerInterfaceWrapper) DeleteCache(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteCacheParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCache(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCache operation middleware +func (siw *ServerInterfaceWrapper) GetCache(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetCacheParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCache(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceCache operation middleware +func (siw *ServerInterfaceWrapper) ReplaceCache(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceCacheParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceCache(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/caches", wrapper.GetCaches) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/caches", wrapper.CreateCache) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/caches/{name}", wrapper.DeleteCache) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/caches/{name}", wrapper.GetCache) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/caches/{name}", wrapper.ReplaceCache) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhBb+M2E/0rA37fUba82aBAfXOSbZtLEaRFL0UQjMmRxa1EaknKjhHovxckJduKnWy89Wa9C98SiRq+", + "Gb73huNHxnVZaUXKWTZ+ZIZspZWl8I+tiMtMcnRSq/tSCyrsPddlqdX9amH3fFIYQrH88CBtDMW1cqSc", + "/xOrqmjDpB+tViE4z6lE/9f/DWVszP6XrqGk8a1N94JAxmjDmqZJmCDLjaz8V2zM/swJ2kgkwJDVteEE", + "GCEDRcwJywkFmYD+UqtMzmoTNh78RcbKiLsfubcMMlkQzNu1yUaKblkRGzPrjFQzj7BJ9qvuBYpb+lST", + "dUdW2gv0BY3IjrmAV5RhXbgPIY/jKuGvpMhgARHbMRfxd+1+0bUS34e8F2hBaQdZgPymdW2619EJkee0", + "sVBPPxL3cnkYzPSgfRiTHF6GtRuvBrKstAl1rtDlbMxm0uX1dMh1meZYGf2wdMTzlBeSlBsodHJO6fyn", + "NEZkHkxAELBIR6X93LFEwE3SAUZjcPkCXntwwF9AjNfVtxPZIeF6wFJleptAEwWTm2vItIESFc6kmsFv", + "kxsfE0KRgW9SzA5Zwpx0hQfcrbtCh3BToKIQawAdRToqjpk/Kl2RwkqyMXs/HA3fsSSkE446tWTmkpPt", + "8kl7u6ZrdszIbSdxS642ygIqCEQAnQEWxQo6iZhLQK8rilGvRbA2tyJIhQZLckGBfz/d4/rKR3U5gTOo", + "LPKguEVOhmDhpawcOA0oRFi02mUIl6i8yKcEtSXhP1GdSEHatS94cNJv9akm48mssPRl3tjvXooXdX2X", + "9O9HZ6PRwZywPYMd7vZHzTlZm9XFOu237hIids/nklhVJf3ynhxUX5clmuWKcz3K8Y5IDmeeQizq4K5J", + "WKXtDt5OhLCAoGjRas1SpJXTgUR8qx7bBL40hI46xX3/FE6eom7ZEnf2PsVz4v94n+qXp8WzG+xmwpuA", + "k96bHC1IZ0Ev1uGeyegFXkrlaEZmVy7XGVhyCQgN6HPhBIYKjSI88qgXKF3IcvP8w53BLxsIKnC5b4po", + "geeoZmRB9tehobBrcAUSIKQh7oqlp0Gvus+VIeRwH8H1arHSY4aFpVWfnmpdEKrOqsKt/EKL5WFdKpqU", + "Dy8NCTZ2pqZmyxrffY1Nnxha7KBBosL3wLPR2Rvs2tNFPHpAzqlyJABVx6ZuLKInd8/byLXrq23HWlvI", + "6lvYcfq7HPo89qIDuvPGyBni/3zg+P0fDL5Fk5kIARh7w3Zb8VdErgXNSA3a0xhMtVgOWm0KdBjive52", + "lT7675p45gU52j79q/DcdpAgM7rc0aimy+CiPtx2v4oxXtWvonpCNq37hPvvynzaN32d79VbTh3x1BGP", + "qyP2OtTZ567Ix+LtZ6PzHVCDfKOXiOjQ5we2ztXPPd/CnKOTPe/PTfLytKoVPbn272Gj3dx68tDjGIyP", + "dS7+wTTXTd0vaK6qd2quKpBvXF32kFr77UlupyvL6cpybEP86K2GeBNd4DTFf+0p/gfrV4E1/3mI90HJ", + "zLumU5uCjVk6f8+au+bfAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/cache/cache.go b/handlers/configuration/cache/cache.go new file mode 100644 index 00000000..5d81b4c6 --- /dev/null +++ b/handlers/configuration/cache/cache.go @@ -0,0 +1,170 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all cache routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy cache configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetCaches(w http.ResponseWriter, r *http.Request, params GetCachesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, caches, err := cfg.GetCaches(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, caches) +} + +func (h *HandlerImpl) CreateCache(w http.ResponseWriter, r *http.Request, params CreateCacheParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Cache + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateCache(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteCache(w http.ResponseWriter, r *http.Request, name string, params DeleteCacheParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteCache(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetCache(w http.ResponseWriter, r *http.Request, name string, params GetCacheParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, cache, err := cfg.GetCache(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, cache) +} + +func (h *HandlerImpl) ReplaceCache(w http.ResponseWriter, r *http.Request, name string, params ReplaceCacheParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Cache + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditCache(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/capture/capture.gen.go b/handlers/configuration/capture/capture.gen.go new file mode 100644 index 00000000..11b51f86 --- /dev/null +++ b/handlers/configuration/capture/capture.gen.go @@ -0,0 +1,815 @@ +// Package capture provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package capture + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Capture defines model for capture. +type Capture = models.Capture + +// Captures defines model for captures. +type Captures = models.Captures + +// GetDeclareCapturesParams defines parameters for GetDeclareCaptures. +type GetDeclareCapturesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceDeclareCapturesParams defines parameters for ReplaceDeclareCaptures. +type ReplaceDeclareCapturesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteDeclareCaptureParams defines parameters for DeleteDeclareCapture. +type DeleteDeclareCaptureParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetDeclareCaptureParams defines parameters for GetDeclareCapture. +type GetDeclareCaptureParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateDeclareCaptureParams defines parameters for CreateDeclareCapture. +type CreateDeclareCaptureParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceDeclareCaptureParams defines parameters for ReplaceDeclareCapture. +type ReplaceDeclareCaptureParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceDeclareCapturesJSONRequestBody defines body for ReplaceDeclareCaptures for application/json ContentType. +type ReplaceDeclareCapturesJSONRequestBody = Captures + +// CreateDeclareCaptureJSONRequestBody defines body for CreateDeclareCapture for application/json ContentType. +type CreateDeclareCaptureJSONRequestBody = Capture + +// ReplaceDeclareCaptureJSONRequestBody defines body for ReplaceDeclareCapture for application/json ContentType. +type ReplaceDeclareCaptureJSONRequestBody = Capture + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Declare Captures + // (GET /services/haproxy/configuration/frontends/{parent_name}/captures) + GetDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params GetDeclareCapturesParams) + // Replace a Declare Capture list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/captures) + ReplaceDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceDeclareCapturesParams) + // Delete a Declare Capture + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) + DeleteDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteDeclareCaptureParams) + // Return one Declare Capture + // (GET /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) + GetDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetDeclareCaptureParams) + // Add a new Declare Capture + // (POST /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) + CreateDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateDeclareCaptureParams) + // Replace a Declare Capture + // (PUT /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) + ReplaceDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceDeclareCaptureParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Declare Captures +// (GET /services/haproxy/configuration/frontends/{parent_name}/captures) +func (_ Unimplemented) GetDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params GetDeclareCapturesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Declare Capture list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/captures) +func (_ Unimplemented) ReplaceDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceDeclareCapturesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Declare Capture +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) +func (_ Unimplemented) DeleteDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteDeclareCaptureParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Declare Capture +// (GET /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) +func (_ Unimplemented) GetDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetDeclareCaptureParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Declare Capture +// (POST /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) +func (_ Unimplemented) CreateDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateDeclareCaptureParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Declare Capture +// (PUT /services/haproxy/configuration/frontends/{parent_name}/captures/{index}) +func (_ Unimplemented) ReplaceDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceDeclareCaptureParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetDeclareCaptures operation middleware +func (siw *ServerInterfaceWrapper) GetDeclareCaptures(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetDeclareCapturesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDeclareCaptures(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceDeclareCaptures operation middleware +func (siw *ServerInterfaceWrapper) ReplaceDeclareCaptures(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceDeclareCapturesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceDeclareCaptures(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteDeclareCapture operation middleware +func (siw *ServerInterfaceWrapper) DeleteDeclareCapture(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteDeclareCaptureParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteDeclareCapture(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetDeclareCapture operation middleware +func (siw *ServerInterfaceWrapper) GetDeclareCapture(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetDeclareCaptureParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDeclareCapture(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateDeclareCapture operation middleware +func (siw *ServerInterfaceWrapper) CreateDeclareCapture(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateDeclareCaptureParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateDeclareCapture(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceDeclareCapture operation middleware +func (siw *ServerInterfaceWrapper) ReplaceDeclareCapture(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceDeclareCaptureParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceDeclareCapture(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures", wrapper.GetDeclareCaptures) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures", wrapper.ReplaceDeclareCaptures) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures/{index}", wrapper.DeleteDeclareCapture) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures/{index}", wrapper.GetDeclareCapture) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures/{index}", wrapper.CreateDeclareCapture) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/captures/{index}", wrapper.ReplaceDeclareCapture) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Frfb9s2EP5XCLZPm2y5aVBg3pObdFtehqAb9tKkwYU8W+wkUiUpO0ag/30gKclSrMRxm18r9FI4EnX8", + "7nj3fadTrylTWa4kSmvo9JpqNLmSBv0fJkcm5oKBFUpeZIpjai6YyjIlL5qF9fVZqhH4+sOVMMEUU9Ki", + "tO4n5HlamYm/GCW9cZZgBu7Xa41zOqWv4g2UONw18V4QUGulaVmWEeVomBa5e4pO6d8JksoScqLRqEIz", + "JBAgEwyYI5ogcNQe/ZGSc7EotN949A9qIwLuruXOMjIXKZJltTZquWjXOdIpNVYLuXAIy2i/6L4H/hG/", + "FmjsCwvte3ABDchecgCPcQ5Faj94P15WCH9HiRpSErC95CD+qexvqpD8/1HeKzBEKkvmHvKTxrWsbwcm", + "hNwWGltL1eUXZK5grkYLNaouBjfHR9Xq1s2RyHKlfaxzsAmd0oWwSXE5ZiqLE8i1ulpbZEnMUoHSjiRY", + "scR4+S4ONqkDVKHwiITFzOw6nBp2GdWwQWtY34naPDjsb0iR+8W5LreHhOsACzlX26k0k2R2ekLmSpMM", + "JCyEXJA/ZqfOJjlGloJGUsWQoLRaoBnTiFphU4e5WQoWyGkKEr25EdlkS52ZU+pOTOUoIRd0St+OJ+M3", + "NPI++TOPDeqlYGhqp2LWzvN4rn1pcxNf56BR2gsJGZZxO4EWaLd9/Ii20NIQSNObPhliE7DEXak3Q06E", + "bNVtva1zW+UYwJxwT5C2MtfKshw0ZGh9QX+6ieTU425MEucAdUdDp+FsI+ovub8aD2lEnZIJjZxOrS6w", + "XeM5WIvaPf/50+ezM312Js+KyeQt8//iT7++fuV+Hby7Ls/o+c+vabRFC9FNlCfHRM2JTZBYDdIA8zSz", + "SlAjWTn+kpZYRYBzv6gJypgcgXTMdomkMMjdI7JmJiLMJqjj2umvBer1xuvWfheC30lm51G3KTyYTB6M", + "/puM6iH1vwrG0Jh5kW4cf2px5KFpuM2NJi7xt7cinuKKLAO9biqIgCSeal169BWTSy5YuMSn3cKg52VE", + "86K3NvMUGBoCZJWoFEkqjHX2twp1JWzi882vWIglSleoTb15DrMdyb29dKtth/J9rvLdQl3VSdjZHSVL", + "kP3r5KijAjWefrBth9uAo86dBAwR1hC12pi7xaM7KlJIiwvUvScwJwZtRLgi4HxhSDSmCri/5FCvQNgm", + "YVvKE5aNOKaw3tdFMIQlIBdoXF2017k6coY8IyInXGhkNl27NOhE97YweB8uArhOLBommkNqsEnOS6VS", + "BFnTtH8Ne6/4+pEYultf5TMpw6yvvdCBaLjrfQ4mB08CpKssIScIMIa5RU5A1mlWvyDjjbeQjyEJT463", + "6XrDLc2zpCct+kTrMBzDAwpWa/jwPKLoj5bAVqPsFOoOLXS9PVMcFyhHVRhHl4qvR1W1cbDg9/rejji+", + "FpLjVRnOMUWL2yd67K+bHi+6vHu59pzpDToFzO6ttWGHG0HYobQ1hhO3Xb/EiurW7eK6m6gHQR8EfRD0", + "/QW9o64Hu95tXooCHUwO+/ivy3qBJ71eH4b1D6gmzaDyOfQq8PA20d/91nbnREVJ3Ec2XBbfUzS2ZiuD", + "YgwTnL3b45c6wPnBmKUaD/WwwY6JkDI95DLj3LWjEldb3LIHgRxphKHrHLrOoescxkj3k4ldU6Q3T6FO", + "W92Up7HHGh8N06N6enQ4+eWB7Xf/49FzyPKM834d/e7Z1O6POY/zVtD72WZQ9UHVB1UfVP3bVH3yHKr+", + "yF+FBlnfyPoP9qJ9yyen7//a5PZBvawltNApndJ4+ZaW5+V/AQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/capture/capture.go b/handlers/configuration/capture/capture.go new file mode 100644 index 00000000..c9ccf0b7 --- /dev/null +++ b/handlers/configuration/capture/capture.go @@ -0,0 +1,236 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package capture + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +func notFound(w http.ResponseWriter) { + code := misc.ErrHTTPNotFound + msg := "not found" + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) +} + +// RegisterRouter registers all declare capture routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy declare capture configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params GetDeclareCapturesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, frontend, err := cfg.GetFrontend(parentName, params.TransactionId) + if frontend == nil || err != nil { + notFound(w) + return + } + _, data, err := cfg.GetDeclareCaptures(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.Captures{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, data) +} + +func (h *HandlerImpl) ReplaceDeclareCaptures(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceDeclareCapturesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Captures + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceDeclareCaptures(parentName, data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) DeleteDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteDeclareCaptureParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteDeclareCapture(int64(index), parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetDeclareCaptureParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, frontend, err := cfg.GetFrontend(parentName, params.TransactionId) + if frontend == nil || err != nil { + notFound(w) + return + } + _, data, err := cfg.GetDeclareCapture(int64(index), parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) +} + +func (h *HandlerImpl) CreateDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateDeclareCaptureParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Capture + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, frontend, err := cfg.GetFrontend(parentName, params.TransactionId) + if frontend == nil || err != nil { + notFound(w) + return + } + if err = cfg.CreateDeclareCapture(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceDeclareCapture(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceDeclareCaptureParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Capture + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, frontend, err := cfg.GetFrontend(parentName, params.TransactionId) + if frontend == nil || err != nil { + notFound(w) + return + } + if err = cfg.EditDeclareCapture(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/crt_store/crt_store.gen.go b/handlers/configuration/crt_store/crt_store.gen.go new file mode 100644 index 00000000..1003ed7d --- /dev/null +++ b/handlers/configuration/crt_store/crt_store.gen.go @@ -0,0 +1,1184 @@ +// Package crt_store provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package crt_store + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// CrtLoad defines model for crt_load. +type CrtLoad = models.CrtLoad + +// CrtLoads defines model for crt_loads. +type CrtLoads = models.CrtLoads + +// CrtStore defines model for crt_store. +type CrtStore = models.CrtStore + +// CrtStores defines model for crt_stores. +type CrtStores = models.CrtStores + +// GetCrtStoresParams defines parameters for GetCrtStores. +type GetCrtStoresParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateCrtStoreParams defines parameters for CreateCrtStore. +type CreateCrtStoreParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// GetCrtLoadsParams defines parameters for GetCrtLoads. +type GetCrtLoadsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateCrtLoadParams defines parameters for CreateCrtLoad. +type CreateCrtLoadParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteCrtLoadParams defines parameters for DeleteCrtLoad. +type DeleteCrtLoadParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetCrtLoadParams defines parameters for GetCrtLoad. +type GetCrtLoadParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceCrtLoadParams defines parameters for ReplaceCrtLoad. +type ReplaceCrtLoadParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteCrtStoreParams defines parameters for DeleteCrtStore. +type DeleteCrtStoreParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// GetCrtStoreParams defines parameters for GetCrtStore. +type GetCrtStoreParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// EditCrtStoreParams defines parameters for EditCrtStore. +type EditCrtStoreParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateCrtStoreJSONRequestBody defines body for CreateCrtStore for application/json ContentType. +type CreateCrtStoreJSONRequestBody = CrtStore + +// CreateCrtLoadJSONRequestBody defines body for CreateCrtLoad for application/json ContentType. +type CreateCrtLoadJSONRequestBody = CrtLoad + +// ReplaceCrtLoadJSONRequestBody defines body for ReplaceCrtLoad for application/json ContentType. +type ReplaceCrtLoadJSONRequestBody = CrtLoad + +// EditCrtStoreJSONRequestBody defines body for EditCrtStore for application/json ContentType. +type EditCrtStoreJSONRequestBody = CrtStore + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of crt stores + // (GET /services/haproxy/configuration/crt_stores) + GetCrtStores(w http.ResponseWriter, r *http.Request, params GetCrtStoresParams) + // Add a new crt store + // (POST /services/haproxy/configuration/crt_stores) + CreateCrtStore(w http.ResponseWriter, r *http.Request, params CreateCrtStoreParams) + // Return an array of crt loads + // (GET /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads) + GetCrtLoads(w http.ResponseWriter, r *http.Request, crtStore string, params GetCrtLoadsParams) + // Add a crt load + // (POST /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads) + CreateCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, params CreateCrtLoadParams) + // Delete a crt load + // (DELETE /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) + DeleteCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params DeleteCrtLoadParams) + // Return one crt load + // (GET /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) + GetCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params GetCrtLoadParams) + // Replace a crt load + // (PUT /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) + ReplaceCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params ReplaceCrtLoadParams) + // Delete a crt store + // (DELETE /services/haproxy/configuration/crt_stores/{name}) + DeleteCrtStore(w http.ResponseWriter, r *http.Request, name string, params DeleteCrtStoreParams) + // Return one crt store + // (GET /services/haproxy/configuration/crt_stores/{name}) + GetCrtStore(w http.ResponseWriter, r *http.Request, name string, params GetCrtStoreParams) + // Replace a crt store + // (PUT /services/haproxy/configuration/crt_stores/{name}) + EditCrtStore(w http.ResponseWriter, r *http.Request, name string, params EditCrtStoreParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of crt stores +// (GET /services/haproxy/configuration/crt_stores) +func (_ Unimplemented) GetCrtStores(w http.ResponseWriter, r *http.Request, params GetCrtStoresParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new crt store +// (POST /services/haproxy/configuration/crt_stores) +func (_ Unimplemented) CreateCrtStore(w http.ResponseWriter, r *http.Request, params CreateCrtStoreParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of crt loads +// (GET /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads) +func (_ Unimplemented) GetCrtLoads(w http.ResponseWriter, r *http.Request, crtStore string, params GetCrtLoadsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a crt load +// (POST /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads) +func (_ Unimplemented) CreateCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, params CreateCrtLoadParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a crt load +// (DELETE /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) +func (_ Unimplemented) DeleteCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params DeleteCrtLoadParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one crt load +// (GET /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) +func (_ Unimplemented) GetCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params GetCrtLoadParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a crt load +// (PUT /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}) +func (_ Unimplemented) ReplaceCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params ReplaceCrtLoadParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a crt store +// (DELETE /services/haproxy/configuration/crt_stores/{name}) +func (_ Unimplemented) DeleteCrtStore(w http.ResponseWriter, r *http.Request, name string, params DeleteCrtStoreParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one crt store +// (GET /services/haproxy/configuration/crt_stores/{name}) +func (_ Unimplemented) GetCrtStore(w http.ResponseWriter, r *http.Request, name string, params GetCrtStoreParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a crt store +// (PUT /services/haproxy/configuration/crt_stores/{name}) +func (_ Unimplemented) EditCrtStore(w http.ResponseWriter, r *http.Request, name string, params EditCrtStoreParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetCrtStores operation middleware +func (siw *ServerInterfaceWrapper) GetCrtStores(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetCrtStoresParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCrtStores(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCrtStore operation middleware +func (siw *ServerInterfaceWrapper) CreateCrtStore(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateCrtStoreParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCrtStore(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCrtLoads operation middleware +func (siw *ServerInterfaceWrapper) GetCrtLoads(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "crt_store" ------------- + var crtStore string + + err = runtime.BindStyledParameterWithOptions("simple", "crt_store", chi.URLParam(r, "crt_store"), &crtStore, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "crt_store", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetCrtLoadsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCrtLoads(w, r, crtStore, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCrtLoad operation middleware +func (siw *ServerInterfaceWrapper) CreateCrtLoad(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "crt_store" ------------- + var crtStore string + + err = runtime.BindStyledParameterWithOptions("simple", "crt_store", chi.URLParam(r, "crt_store"), &crtStore, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "crt_store", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateCrtLoadParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCrtLoad(w, r, crtStore, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCrtLoad operation middleware +func (siw *ServerInterfaceWrapper) DeleteCrtLoad(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "crt_store" ------------- + var crtStore string + + err = runtime.BindStyledParameterWithOptions("simple", "crt_store", chi.URLParam(r, "crt_store"), &crtStore, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "crt_store", Err: err}) + return + } + + // ------------- Path parameter "certificate" ------------- + var certificate string + + err = runtime.BindStyledParameterWithOptions("simple", "certificate", chi.URLParam(r, "certificate"), &certificate, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "certificate", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteCrtLoadParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCrtLoad(w, r, crtStore, certificate, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCrtLoad operation middleware +func (siw *ServerInterfaceWrapper) GetCrtLoad(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "crt_store" ------------- + var crtStore string + + err = runtime.BindStyledParameterWithOptions("simple", "crt_store", chi.URLParam(r, "crt_store"), &crtStore, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "crt_store", Err: err}) + return + } + + // ------------- Path parameter "certificate" ------------- + var certificate string + + err = runtime.BindStyledParameterWithOptions("simple", "certificate", chi.URLParam(r, "certificate"), &certificate, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "certificate", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetCrtLoadParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCrtLoad(w, r, crtStore, certificate, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceCrtLoad operation middleware +func (siw *ServerInterfaceWrapper) ReplaceCrtLoad(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "crt_store" ------------- + var crtStore string + + err = runtime.BindStyledParameterWithOptions("simple", "crt_store", chi.URLParam(r, "crt_store"), &crtStore, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "crt_store", Err: err}) + return + } + + // ------------- Path parameter "certificate" ------------- + var certificate string + + err = runtime.BindStyledParameterWithOptions("simple", "certificate", chi.URLParam(r, "certificate"), &certificate, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "certificate", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceCrtLoadParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceCrtLoad(w, r, crtStore, certificate, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCrtStore operation middleware +func (siw *ServerInterfaceWrapper) DeleteCrtStore(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteCrtStoreParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCrtStore(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCrtStore operation middleware +func (siw *ServerInterfaceWrapper) GetCrtStore(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetCrtStoreParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCrtStore(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// EditCrtStore operation middleware +func (siw *ServerInterfaceWrapper) EditCrtStore(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params EditCrtStoreParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.EditCrtStore(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/crt_stores", wrapper.GetCrtStores) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/crt_stores", wrapper.CreateCrtStore) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads", wrapper.GetCrtLoads) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads", wrapper.CreateCrtLoad) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}", wrapper.DeleteCrtLoad) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}", wrapper.GetCrtLoad) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}", wrapper.ReplaceCrtLoad) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/crt_stores/{name}", wrapper.DeleteCrtStore) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/crt_stores/{name}", wrapper.GetCrtStore) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/crt_stores/{name}", wrapper.EditCrtStore) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FrRbtu4Ev0Vgvc+ylGaFhe4fkuT7m6AxSJoF/uyKIIJObLYlUiVpJIagf59QVKSpVh27dR2nFRvtkQN", + "z4xmzhwN+ECZygslUVpDpw9UoymUNOj/mAKZSAQDK5S8yRXHzNwwledK3rQLm+vnmUbg8w/fhAmmmJIW", + "pXU/oSiy2kz8xSjpjbMUc3C//qsxoVP6n3gBJQ53TbwVBNRaaVpVVUQ5GqZF4Z6iU/pniqS2hJxoNKrU", + "DAkEyAQD5oimCBy1R3+hZCJmpfYbT/5CbUTA3bfcW0YSkSG5q9dGHRftvEA6pcZqIWcOYRVtF933wD/i", + "1xKNPbLQvgcX0IDsmAN4iQmUmf3g/TiuEP6KEjVkJGA75iD+oewvqpT8ZZT3PRgilSWJh3zQuFbN7cCE", + "2t5kCnhnrbr9gsxVzLfJTE3qi8HPkwttf3erOzcnIi+U9sEuwKZ0SmfCpuXtCVN5nEKh1be5RZbGLBMo", + "7USCFXcY3/0vDjapQ9TA8JiExdx87/W0wKuoAQ5aw3wtbrMX4MYqjZsH8JNfvjcg24UwYN80hp/CBrvG", + "/oRS2yzaDW3tEq4DLGSilkvyXJLz6yuSKE1ykDATckZ+O792NsmFtsRHj4Dk/p/LR4LSaoHmhEbUCps5", + "6M0Tl2CBXGcg0VudLEzQiDalPqXu3akCJRSCTunbk9OTNzTyzvn3HxvUd4KhabyLWZc44n7azNAuu/UR", + "bamlIZBlhGlLwnJiU7AENJLGIHLnhiowmL7ivn/YbtoUoCFH65nu78f7XF0SlRCbIrEapAHmme0+RY3k", + "3lGmtMQqApz7Re1GJ+QCpCPTWySlQe4ekQ0ZEmEW/OvwCbfV1xK1y3IJuQt5Z78bwdfyZ7SEWnKXuGiI", + "COBr3JAkyKzxlxYNgKUiW7QBQ8CQe8yyFbiSMstuDHqDPVQ8KAY6TSAz2BbvrVIZgqRV9Tnqy+Wz09Od", + "NcZOygw0vE8lY2hMUmaLN3Ro4dCGZ9iRNjLx02Wap60yz0HP2xIhIInnT5fHi0pxtQ0zl/G0Zf/PVUQL", + "ZQaq7ZxzQ4BIvF+YcGnv8qhXusvFdqERLHY6zCsstzpdws6OaVmK7B/HtL3gNHiGwXYd7gKOendSMERY", + "Q9T9wtwKj9YkppAWZ6gHqSMhBm1EuCLgfGFINDpN4y851PcgrPey+/a9jnTLJhwzmG/rIhjCUpAzx1j9", + "dY7MnSFPDcgJFxqZzeYuDZZSb5CvnA83Adx2fPWSaNV/UL5XfL57Rg2E6rYQGjmdWl1itUTlb/a18SMC", + "biUL88TipfbZ6dmBdu+Vc8hYAoxhYZF7ERXyrPnCx0efUR9DiVxdLlPsgvnaZ8lA0g51lnehj+6wq3Sm", + "J97+/3dsvz/7eo7meM7544Y22BKdTGeK4wzlpH4xk1vF55O6bDlY8KY317TxQ/u7invfmBspXb96SOh6", + "5uwzUOPaKg3cfH6u7cnXoFFa0oIm3vWaxfwHS0tii+J5TBjbydeXoAL2rWZDVoxidq2YzeoE7hSuHwVt", + "LGU9W9dKdqPCafVsPXIaS2cU0KOAPrgyDVPWwwvTxb7LutQPz/YoS1fuParSV6VKm7401NcOpkfjB4ba", + "BqewCpmRocXlHLn0100H+CPWvp17xu3Y82LDISaJVvnmzTdsdbTN92LAwxUbLlaO/X7s96+p3/ea79n3", + "vjqOpVudnb4bgNo09UB9PLSddzvuB+0hgefoOIFRv9N0qmj9aEJJfAr3P21eMdL+OCFZr4ePYUDyymii", + "Hr90C33V1KUcJIoiA/ZUjbgNT9Q7jVwxSsRRIo4joeGR0OlhR0I6cNI4EzrATOiVdV2fOM8xEnLPbjH1", + "Cd1zsKU7S2smORsdC7pot1jdL+s7Y6McG+V4+OgZz3S+/JFPOF/0k8x8Vh992XTqszX3d85fj8Q/HvLe", + "0dm8ceqz76nPWqrYZO6zNVN84GKkilEjjhpxPKD+wwfUTw99QH2fY5/xhPrPM/f54cPpzjbqu6Ztljqj", + "UxrfvaXV5+rfAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/crt_store/crt_store.go b/handlers/configuration/crt_store/crt_store.go new file mode 100644 index 00000000..807f6768 --- /dev/null +++ b/handlers/configuration/crt_store/crt_store.go @@ -0,0 +1,297 @@ +// Copyright 2024 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package crt_store + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all crt_store routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy crt_store configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- CrtStore handlers --- + +func (h *HandlerImpl) GetCrtStores(w http.ResponseWriter, r *http.Request, params GetCrtStoresParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, stores, err := cfg.GetCrtStores(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, stores) +} + +func (h *HandlerImpl) CreateCrtStore(w http.ResponseWriter, r *http.Request, params CreateCrtStoreParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data CrtStore + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateCrtStore(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteCrtStore(w http.ResponseWriter, r *http.Request, name string, params DeleteCrtStoreParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteCrtStore(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetCrtStore(w http.ResponseWriter, r *http.Request, name string, params GetCrtStoreParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, store, err := cfg.GetCrtStore(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, store) +} + +func (h *HandlerImpl) EditCrtStore(w http.ResponseWriter, r *http.Request, name string, params EditCrtStoreParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data CrtStore + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditCrtStore(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// --- CrtLoad handlers --- + +func (h *HandlerImpl) GetCrtLoads(w http.ResponseWriter, r *http.Request, crtStore string, params GetCrtLoadsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, loads, err := cfg.GetCrtLoads(crtStore, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, loads) +} + +func (h *HandlerImpl) CreateCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, params CreateCrtLoadParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data CrtLoad + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateCrtLoad(crtStore, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params DeleteCrtLoadParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteCrtLoad(certificate, crtStore, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params GetCrtLoadParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, load, err := cfg.GetCrtLoad(certificate, crtStore, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, load) +} + +func (h *HandlerImpl) ReplaceCrtLoad(w http.ResponseWriter, r *http.Request, crtStore string, certificate string, params ReplaceCrtLoadParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data CrtLoad + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditCrtLoad(certificate, crtStore, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/defaults/defaults.gen.go b/handlers/configuration/defaults/defaults.gen.go new file mode 100644 index 00000000..67aeba0f --- /dev/null +++ b/handlers/configuration/defaults/defaults.gen.go @@ -0,0 +1,847 @@ +// Package defaults provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package defaults + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Defaults defines model for defaults. +type Defaults = models.Defaults + +// DefaultsSections defines model for defaults_sections. +type DefaultsSections = models.DefaultsSections + +// GetDefaultsSectionsParams defines parameters for GetDefaultsSections. +type GetDefaultsSectionsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// AddDefaultsSectionParams defines parameters for AddDefaultsSection. +type AddDefaultsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateDefaultsSectionParams defines parameters for CreateDefaultsSection. +type CreateDefaultsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteDefaultsSectionParams defines parameters for DeleteDefaultsSection. +type DeleteDefaultsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// GetDefaultsSectionParams defines parameters for GetDefaultsSection. +type GetDefaultsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceDefaultsSectionParams defines parameters for ReplaceDefaultsSection. +type ReplaceDefaultsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// AddDefaultsSectionJSONRequestBody defines body for AddDefaultsSection for application/json ContentType. +type AddDefaultsSectionJSONRequestBody = Defaults + +// CreateDefaultsSectionJSONRequestBody defines body for CreateDefaultsSection for application/json ContentType. +type CreateDefaultsSectionJSONRequestBody = Defaults + +// ReplaceDefaultsSectionJSONRequestBody defines body for ReplaceDefaultsSection for application/json ContentType. +type ReplaceDefaultsSectionJSONRequestBody = Defaults + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of defaults sections + // (GET /services/haproxy/configuration/defaults) + GetDefaultsSections(w http.ResponseWriter, r *http.Request, params GetDefaultsSectionsParams) + // Add a defaults section + // (POST /services/haproxy/configuration/defaults) + AddDefaultsSection(w http.ResponseWriter, r *http.Request, params AddDefaultsSectionParams) + // Add a defaults section + // (PUT /services/haproxy/configuration/defaults) + CreateDefaultsSection(w http.ResponseWriter, r *http.Request, params CreateDefaultsSectionParams) + // Delete a defaults section + // (DELETE /services/haproxy/configuration/defaults/{name}) + DeleteDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteDefaultsSectionParams) + // Return a defaults section + // (GET /services/haproxy/configuration/defaults/{name}) + GetDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params GetDefaultsSectionParams) + // Replace a defaults section + // (PUT /services/haproxy/configuration/defaults/{name}) + ReplaceDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceDefaultsSectionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of defaults sections +// (GET /services/haproxy/configuration/defaults) +func (_ Unimplemented) GetDefaultsSections(w http.ResponseWriter, r *http.Request, params GetDefaultsSectionsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a defaults section +// (POST /services/haproxy/configuration/defaults) +func (_ Unimplemented) AddDefaultsSection(w http.ResponseWriter, r *http.Request, params AddDefaultsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a defaults section +// (PUT /services/haproxy/configuration/defaults) +func (_ Unimplemented) CreateDefaultsSection(w http.ResponseWriter, r *http.Request, params CreateDefaultsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a defaults section +// (DELETE /services/haproxy/configuration/defaults/{name}) +func (_ Unimplemented) DeleteDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteDefaultsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a defaults section +// (GET /services/haproxy/configuration/defaults/{name}) +func (_ Unimplemented) GetDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params GetDefaultsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a defaults section +// (PUT /services/haproxy/configuration/defaults/{name}) +func (_ Unimplemented) ReplaceDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceDefaultsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetDefaultsSections operation middleware +func (siw *ServerInterfaceWrapper) GetDefaultsSections(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetDefaultsSectionsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDefaultsSections(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddDefaultsSection operation middleware +func (siw *ServerInterfaceWrapper) AddDefaultsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params AddDefaultsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddDefaultsSection(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateDefaultsSection operation middleware +func (siw *ServerInterfaceWrapper) CreateDefaultsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateDefaultsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateDefaultsSection(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteDefaultsSection operation middleware +func (siw *ServerInterfaceWrapper) DeleteDefaultsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteDefaultsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteDefaultsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetDefaultsSection operation middleware +func (siw *ServerInterfaceWrapper) GetDefaultsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetDefaultsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDefaultsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceDefaultsSection operation middleware +func (siw *ServerInterfaceWrapper) ReplaceDefaultsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceDefaultsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceDefaultsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults", wrapper.GetDefaultsSections) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults", wrapper.AddDefaultsSection) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults", wrapper.CreateDefaultsSection) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{name}", wrapper.DeleteDefaultsSection) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{name}", wrapper.GetDefaultsSection) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{name}", wrapper.ReplaceDefaultsSection) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FlRb9s2EP4rBLdHOUrTYsD85tbdlpehaIe9DEVwJk8WO4pUScquUei/DyQl2YrUNO7cxA30lkjU3XfH", + "u++jj58p00WpFSpn6fwzNWhLrSyGf2yJTGSCgRNa3RSao7Q3TBeFVjfdwvb5QhoEvnv9SdhoimnlUDn/", + "J5SlbMykH6xWwTjLsQD/188GMzqnP6V7KGl8a9OjIKAx2tC6rhPK0TIjSv8VndO/ciSNJeTEoNWVYUgg", + "QiYYMSc0R+BoAvpXWmViXZngePY3Gisi7r7l3jKSCYlk06xNDkJ0uxLpnFpnhFp7hHVyXHZfAn+LHyu0", + "7sxS+xJ8QiOyc07gEjOopHsd4jivFP6OCg1IErGdcxL/1O43XSn+Y7T3FixR2pEsQH7QvNbtaxuNhtqz", + "B2v16gMy3zGfZms9ax7GOC+W7fKDtzNRlNqEbJfgcjqna+HyanXBdJHmUBr9aeeQ5SmTApWbKXBig+nm", + "lzQapTFr0fCNReYjCoCEw8J+bZ+6COqkjQCMgd3dAbxr3Zw6kG8om/ulvm3BU8L1gIXK9LC8Foos3lyT", + "TBtSgIK1UGvyx+KNt0najJNmrwg7rEV7QRPqhJMee/vJEhyQNxIUBrMzclBIbdnOqd9CXaKCUtA5fX5x", + "efGMJiG4UAWpRbMRDG0bXdpznB7W8hrdMKi36CqjLAFFQokQnRGQssOPfBBbiEaXGF1c88CJbqSKSjBQ", + "oAtN/M9tx9dL78rlSJwBZSGmbZujQbL1bKAccZoA52FR5++CvALleWKFpLLI/Seq7XMi7J5aPEzhXX2s", + "0PjaV1D4DTjwdyP4ndSQDFAr7usYLRERfIMbsgyZs+HRnttYLuSe4SwBS7Yo5RdwZZWUba/3UDUbQOcZ", + "SItdS6+0lgiK1vX7pH8SvLq8PBnnD1lohNLfVYyhtVkl9xv10NLYZWk8ni5B6bcfRAKZVUUBZte1Tq9z", + "Bq3i+x7Wvv5p197v64SW2o4044JzS4Ao3A4JxelQXGyQoGE3Lji/1Y1PsxmbKoqePS2zHNm/npb7WWrw", + "jIM9DPgQcNJ7k4Mlwlmit3tzX4jojnoVyuEazSixZMSiSwjXBHwsDIlBqYGHRx71FoQLUR6WQThA+WUz", + "jhJ2x4YIlrAc1NrzWX8dGAxeA3F4ERAGmZM7Xwa97H4pDSGGmwjuODb7kUg3/JJ6qfnu5HwbadZ7EAY5", + "nTtTYT3g+WffyW9/A5aD041BcMj94eTq8upBMPSVIVYtAcawdMgJqLYR2p+3eOs3xNvYJtfLIe3u2a/7", + "lowU7pjovIhKe0LBORgdBPu/nth+f/DzGLq54JzAQOBGldIf7ZnmuEY1a/ZmttJ8N2u6l4MDH0NZNWpa", + "GmShMkO/JN9HX1+F6p8kdpLYSWIniZ0kdpLYJy+xdXLvUVP62X9ZxxqQ6HBYDcvw3I5AJJnRxYgQr3ZB", + "G7zloR5Hc0fq8aDhQrwNg4XhYUdgzZs+URw3NprEfxL/Sfz/51Dz6mvzwnORrKvLF2Okd4twIjvyqEEv", + "TiwO3d3fY8hPJOT7KlCd3H01oRV+5X7lbnkYXk5M2jBdhJz05HwO9x9PjEPa25V7c0g3A+pzSCmBjR81", + "j6CQxsxEI9MRczpiTvOlk86XLh9nvmQipU0DpgcYMD0xYQ6Fc+L5kneBZtMKaWUkndN085zW7+v/AgAA", + "//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/defaults/defaults.go b/handlers/configuration/defaults/defaults.go new file mode 100644 index 00000000..33b484f6 --- /dev/null +++ b/handlers/configuration/defaults/defaults.go @@ -0,0 +1,199 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package defaults + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all defaults routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy defaults section configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetDefaultsSections(w http.ResponseWriter, r *http.Request, params GetDefaultsSectionsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var sections DefaultsSections + if params.FullSection { + _, sections, err = cfg.GetStructuredDefaultsSections(params.TransactionId) + } else { + _, sections, err = cfg.GetDefaultsSections(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, sections) +} + +func (h *HandlerImpl) AddDefaultsSection(w http.ResponseWriter, r *http.Request, params AddDefaultsSectionParams) { + h.createDefaultsSection(w, r, params.TransactionId, params.Version, params.ForceReload, params.FullSection) +} + +// CreateDefaultsSection handles the deprecated PUT alias of AddDefaultsSection. +func (h *HandlerImpl) CreateDefaultsSection(w http.ResponseWriter, r *http.Request, params CreateDefaultsSectionParams) { + h.createDefaultsSection(w, r, params.TransactionId, params.Version, params.ForceReload, params.FullSection) +} + +func (h *HandlerImpl) createDefaultsSection(w http.ResponseWriter, r *http.Request, transactionID string, version int, forceReload, fullSection bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Defaults + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if fullSection { + err = cfg.CreateStructuredDefaultsSection(&data, transactionID, int64(version)) + } else { + err = cfg.CreateDefaultsSection(&data, transactionID, int64(version)) + } + if err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteDefaultsSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteDefaultsSection(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params GetDefaultsSectionParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var section *Defaults + if params.FullSection { + _, section, err = cfg.GetStructuredDefaultsSection(name, params.TransactionId) + } else { + _, section, err = cfg.GetDefaultsSection(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, section) +} + +func (h *HandlerImpl) ReplaceDefaultsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceDefaultsSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Defaults + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredDefaultsSection(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditDefaultsSection(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/dgram_bind/dgram_bind.gen.go b/handlers/configuration/dgram_bind/dgram_bind.gen.go new file mode 100644 index 00000000..1765ef8e --- /dev/null +++ b/handlers/configuration/dgram_bind/dgram_bind.gen.go @@ -0,0 +1,710 @@ +// Package dgram_bind provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package dgram_bind + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// DgramBind defines model for dgram_bind. +type DgramBind = models.DgramBind + +// DgramBinds defines model for dgram_binds. +type DgramBinds = models.DgramBinds + +// GetDgramBindsParams defines parameters for GetDgramBinds. +type GetDgramBindsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateDgramBindParams defines parameters for CreateDgramBind. +type CreateDgramBindParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteDgramBindParams defines parameters for DeleteDgramBind. +type DeleteDgramBindParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetDgramBindParams defines parameters for GetDgramBind. +type GetDgramBindParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceDgramBindParams defines parameters for ReplaceDgramBind. +type ReplaceDgramBindParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateDgramBindJSONRequestBody defines body for CreateDgramBind for application/json ContentType. +type CreateDgramBindJSONRequestBody = DgramBind + +// ReplaceDgramBindJSONRequestBody defines body for ReplaceDgramBind for application/json ContentType. +type ReplaceDgramBindJSONRequestBody = DgramBind + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of dgram binds + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds) + GetDgramBinds(w http.ResponseWriter, r *http.Request, parentName string, params GetDgramBindsParams) + // Add a new dgram bind + // (POST /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds) + CreateDgramBind(w http.ResponseWriter, r *http.Request, parentName string, params CreateDgramBindParams) + // Delete a dgram bind + // (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) + DeleteDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteDgramBindParams) + // Return one dgram bind + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) + GetDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetDgramBindParams) + // Replace a dgram bind + // (PUT /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) + ReplaceDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceDgramBindParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of dgram binds +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds) +func (_ Unimplemented) GetDgramBinds(w http.ResponseWriter, r *http.Request, parentName string, params GetDgramBindsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new dgram bind +// (POST /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds) +func (_ Unimplemented) CreateDgramBind(w http.ResponseWriter, r *http.Request, parentName string, params CreateDgramBindParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a dgram bind +// (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) +func (_ Unimplemented) DeleteDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteDgramBindParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one dgram bind +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) +func (_ Unimplemented) GetDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetDgramBindParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a dgram bind +// (PUT /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}) +func (_ Unimplemented) ReplaceDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceDgramBindParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetDgramBinds operation middleware +func (siw *ServerInterfaceWrapper) GetDgramBinds(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetDgramBindsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDgramBinds(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateDgramBind operation middleware +func (siw *ServerInterfaceWrapper) CreateDgramBind(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateDgramBindParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateDgramBind(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteDgramBind operation middleware +func (siw *ServerInterfaceWrapper) DeleteDgramBind(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteDgramBindParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteDgramBind(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetDgramBind operation middleware +func (siw *ServerInterfaceWrapper) GetDgramBind(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetDgramBindParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetDgramBind(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceDgramBind operation middleware +func (siw *ServerInterfaceWrapper) ReplaceDgramBind(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceDgramBindParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceDgramBind(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds", wrapper.GetDgramBinds) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds", wrapper.CreateDgramBind) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}", wrapper.DeleteDgramBind) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}", wrapper.GetDgramBind) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}", wrapper.ReplaceDgramBind) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XDmyfNtly06LAvKek6ba8DEE37KVJjTN5kthJpEpScY3A//tA0rKl2PkJN/UKvwSORB2/", + "O9593/GuGddVrRUpZ9n4mhmytVaWwj+2Ji4zydFJrSaVFlTaCddVpdVktbB9flwaQjF//1XaaIpr5Ug5", + "/xPrulyaST9brYJxXlCF/tdLQxkbsxfpGkoa39r0URDIGG3YYrFImCDLjaz9V2zM/i4IlpZIgCGrG8MJ", + "MEIGipgTVhAKMgH9O60ymTcmbDz4h4yVEXffcm8ZZLIkuFquTTouunlNbMysM1LlHuEieVx0T1B8oC8N", + "WbdnoT1BH9CIbJ8DeEoZNqV7H/zYrxD+TooMlhCx7XMQ/9TuN90o8f8o7xlaUNpBFiA/a1wX7euwm8gN", + "VpOpjIFbrtbTz8R9zXwd5HqwfBg9HZ76D05kQL16PZBVrU0IeI2uYGOWS1c00yHXVVpgbfTXuSNepLyU", + "pNxAoZNXlF69TaNVFgK3ghKQSUeVve+QOvAXSQsfjcH5PejtzuE/IV8eFvG29nYJ1wOWKtObeXWs4Pj8", + "DDJtoEKFuVQ5/HF87m1CiB748AEpZyTZIUuYk670cFer0CGcl6goWBp0PmMJa5N0zPyJ6ZoU1pKN2evh", + "aPiKJcGjcOypJXMlOdnWpZR3Uz4tdT7JtJmhETa9rtGQchOFFS3SG5mUk9v08wO5xigLWJYQ1kNYD65A", + "B2gI2t1IgFSdGi51Dst9vfe6pgjoTAS+dL0Uq9FgRS6U9sebEM4D5q5B8PiZPxo2jmebsPDI/7dykCXM", + "y5o0JNjYmYa6BV+jc2T8958+frq4MBcX6qIZjV7z8Jd++vXlC//r6O314oJd/vySJRsckdwEenYKOgNX", + "EDiDyiIPnDMryBDMPJkpB04DChEWrUIyhHeoPM1NCRpLwn+iWpoCaddRHbZOf2nIzNded/abSHEns10m", + "/Q7xaDTamRZ0E2oLyf/VcE7WZk259v25xVLEJuI2T1ahSZ/emgSWa6oKzXxVQIAKAt/6DOnUkU8rzH3W", + "s7ViXC4SVmu7pRqPhbCAoGjWMeLrzvX0887ae2cIHXX16VB9z1Z9G6iXOR539mrCC+L/ejXp0XiLZzvY", + "rsNdwEnvTYEWpLOgZ2tzt3h0RzVJ5Sgns/UEMrDkEhAa0PvCCQyVGkV45FHPULrgpT+BjnLEZQNBJc4f", + "6yJa4AWqnGwohM46L0/eUCA0EiCkIe7KuU+DXnRvC0PwYRLB9WKxYpEMS0ur5JxqXRKqlmXDlepEi/k3", + "INjIr/0KW2xQ+6tvtnP/5DsdDw/0EvrMo9HRM+3fF4SYDoCcU+1IAKo2w9p7Lt24THyI+Xd2ukm5a1pZ", + "fQtbMmKb1ryJ0rpDnenMEIL9X3Zsvz8B+h5yeSzEhsBtF0nf6XMtKCc1WB7NYKrFfLAsXoEOg/HddMjp", + "dXgUE6QkR5upchqee4HuiHOfxqfzQMHeFGRGV48R7mj+wcLdqcnbBftepb5XwA79waE/OPQHT+oPelJ9", + "dN81Z19U7Wj0Zgv1rckmsqOIAvVmx8qxGl9+D22KBNyj91vvb3cOU7Sih0nE42523anKQR0Os5sdNtj7", + "MLr5wdhkORjqc8Ht86BmK5/UJfKHd5yPo5Ol9QOlHBrOQ8N5GEjtZCA1ev6BlIk0dphIPctE6geT6JA6", + "D+j4HziM8tbJXLX62ZiSjVl69ZotLhf/BQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/dgram_bind/dgram_bind.go b/handlers/configuration/dgram_bind/dgram_bind.go new file mode 100644 index 00000000..5b1eda37 --- /dev/null +++ b/handlers/configuration/dgram_bind/dgram_bind.go @@ -0,0 +1,177 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dgram_bind + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all dgram bind routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy dgram bind configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetDgramBinds(w http.ResponseWriter, r *http.Request, parentName string, params GetDgramBindsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, binds, err := cfg.GetDgramBinds(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.DgramBinds{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, binds) +} + +func (h *HandlerImpl) CreateDgramBind(w http.ResponseWriter, r *http.Request, parentName string, params CreateDgramBindParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data DgramBind + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateDgramBind(parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteDgramBindParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteDgramBind(name, parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetDgramBindParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, bind, err := cfg.GetDgramBind(name, parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, bind) +} + +func (h *HandlerImpl) ReplaceDgramBind(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceDgramBindParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data DgramBind + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditDgramBind(name, parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/fcgi_app/fcgi_app.gen.go b/handlers/configuration/fcgi_app/fcgi_app.gen.go new file mode 100644 index 00000000..3498a3de --- /dev/null +++ b/handlers/configuration/fcgi_app/fcgi_app.gen.go @@ -0,0 +1,728 @@ +// Package fcgi_app provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package fcgi_app + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// FcgiApp defines model for fcgi_app. +type FcgiApp = models.FCGIApp + +// FcgiApps defines model for fcgi_apps. +type FcgiApps = models.FCGIApps + +// GetFCGIAppsParams defines parameters for GetFCGIApps. +type GetFCGIAppsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateFCGIAppParams defines parameters for CreateFCGIApp. +type CreateFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteFCGIAppParams defines parameters for DeleteFCGIApp. +type DeleteFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetFCGIAppParams defines parameters for GetFCGIApp. +type GetFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceFCGIAppParams defines parameters for ReplaceFCGIApp. +type ReplaceFCGIAppParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateFCGIAppJSONRequestBody defines body for CreateFCGIApp for application/json ContentType. +type CreateFCGIAppJSONRequestBody = FcgiApp + +// ReplaceFCGIAppJSONRequestBody defines body for ReplaceFCGIApp for application/json ContentType. +type ReplaceFCGIAppJSONRequestBody = FcgiApp + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of FCGI apps + // (GET /services/haproxy/configuration/fcgi_apps) + GetFCGIApps(w http.ResponseWriter, r *http.Request, params GetFCGIAppsParams) + // Add an FCGI app + // (POST /services/haproxy/configuration/fcgi_apps) + CreateFCGIApp(w http.ResponseWriter, r *http.Request, params CreateFCGIAppParams) + // Delete an FCGI app + // (DELETE /services/haproxy/configuration/fcgi_apps/{name}) + DeleteFCGIApp(w http.ResponseWriter, r *http.Request, name string, params DeleteFCGIAppParams) + // Return a FCGI app + // (GET /services/haproxy/configuration/fcgi_apps/{name}) + GetFCGIApp(w http.ResponseWriter, r *http.Request, name string, params GetFCGIAppParams) + // Replace a FCGI app + // (PUT /services/haproxy/configuration/fcgi_apps/{name}) + ReplaceFCGIApp(w http.ResponseWriter, r *http.Request, name string, params ReplaceFCGIAppParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of FCGI apps +// (GET /services/haproxy/configuration/fcgi_apps) +func (_ Unimplemented) GetFCGIApps(w http.ResponseWriter, r *http.Request, params GetFCGIAppsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add an FCGI app +// (POST /services/haproxy/configuration/fcgi_apps) +func (_ Unimplemented) CreateFCGIApp(w http.ResponseWriter, r *http.Request, params CreateFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete an FCGI app +// (DELETE /services/haproxy/configuration/fcgi_apps/{name}) +func (_ Unimplemented) DeleteFCGIApp(w http.ResponseWriter, r *http.Request, name string, params DeleteFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a FCGI app +// (GET /services/haproxy/configuration/fcgi_apps/{name}) +func (_ Unimplemented) GetFCGIApp(w http.ResponseWriter, r *http.Request, name string, params GetFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a FCGI app +// (PUT /services/haproxy/configuration/fcgi_apps/{name}) +func (_ Unimplemented) ReplaceFCGIApp(w http.ResponseWriter, r *http.Request, name string, params ReplaceFCGIAppParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetFCGIApps operation middleware +func (siw *ServerInterfaceWrapper) GetFCGIApps(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetFCGIAppsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFCGIApps(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) CreateFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateFCGIApp(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) DeleteFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteFCGIApp(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) GetFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFCGIApp(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceFCGIApp operation middleware +func (siw *ServerInterfaceWrapper) ReplaceFCGIApp(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceFCGIAppParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceFCGIApp(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/fcgi_apps", wrapper.GetFCGIApps) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/fcgi_apps", wrapper.CreateFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{name}", wrapper.DeleteFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{name}", wrapper.GetFCGIApp) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/fcgi_apps/{name}", wrapper.ReplaceFCGIApp) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNj9s2EP0rBNujvHI2QYH65uwm6V6KIC16KQJjTI4kphSpkJQdI9B/L0hKshU563XqbpyFb7Y+Zt4M", + "Z94bzWfKdFlphcpZOvtMDdpKK4vhj62QiUwwcEKrRak5Srtguiy1WvQPdtfn0iDwzatPwkZTTCuHyvmf", + "UFWyNZN+sFoF46zAEvyvnw1mdEZ/SrdQ0njXpkdBQGO0oU3TJJSjZUZU/i06o38WSFpLyIlBq2vDkECE", + "TDBiTmiBwNEE9DdaZSKvTXA8+QuNFRH30PLgMZIJiWTVPpvshOg2FdIZtc4IlXuETXJcdl8Cf4cfa7Tu", + "zFL7EnxCI7JzTuAtZlBL9yrEcV4pfIMKDUgSsZ1zEn/X7rWuFf8x2nsNlijtSBYgP2pem+528JaxXCyg", + "qnae1csPyHzHfJrketJejHFevb55czevqt2bE1FW2oRkV+AKOqO5cEW9vGK6TAuojP60cciKlEmByk0U", + "OLHCdPVLGm1Sj6iDETAJh6U9dDw98CbpgIMxsLkXtz058G+okodluuu4U8L1gIXK9Lia5orM396RTBtS", + "goJcqJz8Nn/rbRKfO7LTR4Ttlp69ogl1wkmPvXvlFhyQtxIUBrOTaCMWTlelM+qPTleooBJ0Rp9fTa+e", + "0SQEF04/tWhWgqHtoksHjtNBzeToxlG9Q1cbZQkoEmqD6IyAlH0AyEfBhXB0hdHHHQ8c6HbKpwIDJbrQ", + "rH9/6fDu1rtwBRJnQFlgIV/rAg2Ste965YjTBDgPD/V+rsgNKM8HSyS1Re5fUV0/E2G3FOLhCe/qY43G", + "F7uC0md+x99C8HspIBmhVtxHj5aICL7FDVmGzNlwacthrBByy2SWgCVrlPIruLJayoXFYHCAikfRo7MM", + "pMW+h5daSwRFm+Z9Mpz4rqfTk3H7tnT2UPYfNWNobVbL7QE9tvT12dkfR5+Y9NsHjcBedVmC2fStMuiU", + "rjV81TvIfb3Tjv/fNwmttN3Tc3POLQGicD0mDqdDLbFRXsZNd2MQHG7l5gm2XVs30bNnXlYg+8cz7zBB", + "LZ79YHcD3gWcDO4UYIlwluj11txXIrqnQoVymKPZSyEZsegSwjUBHwtDYlBq4OGSR70G4UKUuxUQRiL/", + "2ISjhM2xIYIlrACVe+YaPgcGg9dQfcgJFwaZkxtfBoPsfi0NIYZFBHccb/1I9Bq+jV5qvjk5s0Zi9R6E", + "QU5nztTYjBj92f/kd3gAHQ8RFkiF+7njenr9KL6HGhCrlQBjWDnkBFTXAN2HKn7xNfAutsfd7Zhpt6zX", + "v0v2FOw+eXkRtfSE0rKzBAj2fz2x/eEK53so5Jz78+pFbZ8o+mmdaY45qkl7JpOl5ptJ260cHASrDx5t", + "08/+1SYevkSH4zK4Dde95o70NjO63KO4y00QA295LLzR3AOFt++sEGBLUeHrpGeo9s6QCY4bTy/qflH3", + "c1H38VfJ9aHB/1xI/3r6Ymyv7+BILzyy94sT02q/nPsexB0Z7RB3N8n9OwSt8MAm5H5e3W4RLqR62VSc", + "ZLY8h0XFE+OKbg1yiCqqei9VVBLY/lHsCKZozVzY4jKCXUawy4LlPy1Ypo+7YDGRui4blkfYsDwx3Q2F", + "c0B4H7hf8ZbRrDq9rI2kM5quntPmffNvAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/fcgi_app/fcgi_app.go b/handlers/configuration/fcgi_app/fcgi_app.go new file mode 100644 index 00000000..30d5efe4 --- /dev/null +++ b/handlers/configuration/fcgi_app/fcgi_app.go @@ -0,0 +1,192 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fcgi_app + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all fcgi_app routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy FCGI app configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetFCGIApps(w http.ResponseWriter, r *http.Request, params GetFCGIAppsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var apps FcgiApps + if params.FullSection { + _, apps, err = cfg.GetStructuredFCGIApplications(params.TransactionId) + } else { + _, apps, err = cfg.GetFCGIApplications(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, apps) +} + +func (h *HandlerImpl) CreateFCGIApp(w http.ResponseWriter, r *http.Request, params CreateFCGIAppParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data FcgiApp + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredFCGIApplication(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateFCGIApplication(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteFCGIApp(w http.ResponseWriter, r *http.Request, name string, params DeleteFCGIAppParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteFCGIApplication(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetFCGIApp(w http.ResponseWriter, r *http.Request, name string, params GetFCGIAppParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var app *FcgiApp + if params.FullSection { + _, app, err = cfg.GetStructuredFCGIApplication(name, params.TransactionId) + } else { + _, app, err = cfg.GetFCGIApplication(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, app) +} + +func (h *HandlerImpl) ReplaceFCGIApp(w http.ResponseWriter, r *http.Request, name string, params ReplaceFCGIAppParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data FcgiApp + if !respond.DecodeBody(r, w, &data) { + return + } + data.Name = name + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredFCGIApplication(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditFCGIApplication(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/filter/filter.gen.go b/handlers/configuration/filter/filter.gen.go new file mode 100644 index 00000000..e9532e34 --- /dev/null +++ b/handlers/configuration/filter/filter.gen.go @@ -0,0 +1,1351 @@ +// Package filter provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package filter + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Filter defines model for filter. +type Filter = models.Filter + +// Filters defines model for filters. +type Filters = models.Filters + +// GetAllFilterBackendParams defines parameters for GetAllFilterBackend. +type GetAllFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllFilterBackendParams defines parameters for ReplaceAllFilterBackend. +type ReplaceAllFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteFilterBackendParams defines parameters for DeleteFilterBackend. +type DeleteFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetFilterBackendParams defines parameters for GetFilterBackend. +type GetFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateFilterBackendParams defines parameters for CreateFilterBackend. +type CreateFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceFilterBackendParams defines parameters for ReplaceFilterBackend. +type ReplaceFilterBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllFilterFrontendParams defines parameters for GetAllFilterFrontend. +type GetAllFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllFilterFrontendParams defines parameters for ReplaceAllFilterFrontend. +type ReplaceAllFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteFilterFrontendParams defines parameters for DeleteFilterFrontend. +type DeleteFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetFilterFrontendParams defines parameters for GetFilterFrontend. +type GetFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateFilterFrontendParams defines parameters for CreateFilterFrontend. +type CreateFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceFilterFrontendParams defines parameters for ReplaceFilterFrontend. +type ReplaceFilterFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllFilterBackendJSONRequestBody defines body for ReplaceAllFilterBackend for application/json ContentType. +type ReplaceAllFilterBackendJSONRequestBody = Filters + +// CreateFilterBackendJSONRequestBody defines body for CreateFilterBackend for application/json ContentType. +type CreateFilterBackendJSONRequestBody = Filter + +// ReplaceFilterBackendJSONRequestBody defines body for ReplaceFilterBackend for application/json ContentType. +type ReplaceFilterBackendJSONRequestBody = Filter + +// ReplaceAllFilterFrontendJSONRequestBody defines body for ReplaceAllFilterFrontend for application/json ContentType. +type ReplaceAllFilterFrontendJSONRequestBody = Filters + +// CreateFilterFrontendJSONRequestBody defines body for CreateFilterFrontend for application/json ContentType. +type CreateFilterFrontendJSONRequestBody = Filter + +// ReplaceFilterFrontendJSONRequestBody defines body for ReplaceFilterFrontend for application/json ContentType. +type ReplaceFilterFrontendJSONRequestBody = Filter + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Filters + // (GET /services/haproxy/configuration/backends/{parent_name}/filters) + GetAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterBackendParams) + // Replace a Filter list + // (PUT /services/haproxy/configuration/backends/{parent_name}/filters) + ReplaceAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterBackendParams) + // Delete a Filter + // (DELETE /services/haproxy/configuration/backends/{parent_name}/filters/{index}) + DeleteFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterBackendParams) + // Return one Filter + // (GET /services/haproxy/configuration/backends/{parent_name}/filters/{index}) + GetFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterBackendParams) + // Add a new Filter + // (POST /services/haproxy/configuration/backends/{parent_name}/filters/{index}) + CreateFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterBackendParams) + // Replace a Filter + // (PUT /services/haproxy/configuration/backends/{parent_name}/filters/{index}) + ReplaceFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterBackendParams) + // Return an array of all Filters + // (GET /services/haproxy/configuration/frontends/{parent_name}/filters) + GetAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterFrontendParams) + // Replace a Filter list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/filters) + ReplaceAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterFrontendParams) + // Delete a Filter + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) + DeleteFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterFrontendParams) + // Return one Filter + // (GET /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) + GetFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterFrontendParams) + // Add a new Filter + // (POST /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) + CreateFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterFrontendParams) + // Replace a Filter + // (PUT /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) + ReplaceFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Filters +// (GET /services/haproxy/configuration/backends/{parent_name}/filters) +func (_ Unimplemented) GetAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Filter list +// (PUT /services/haproxy/configuration/backends/{parent_name}/filters) +func (_ Unimplemented) ReplaceAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Filter +// (DELETE /services/haproxy/configuration/backends/{parent_name}/filters/{index}) +func (_ Unimplemented) DeleteFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Filter +// (GET /services/haproxy/configuration/backends/{parent_name}/filters/{index}) +func (_ Unimplemented) GetFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Filter +// (POST /services/haproxy/configuration/backends/{parent_name}/filters/{index}) +func (_ Unimplemented) CreateFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Filter +// (PUT /services/haproxy/configuration/backends/{parent_name}/filters/{index}) +func (_ Unimplemented) ReplaceFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all Filters +// (GET /services/haproxy/configuration/frontends/{parent_name}/filters) +func (_ Unimplemented) GetAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Filter list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/filters) +func (_ Unimplemented) ReplaceAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Filter +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) +func (_ Unimplemented) DeleteFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Filter +// (GET /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) +func (_ Unimplemented) GetFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Filter +// (POST /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) +func (_ Unimplemented) CreateFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Filter +// (PUT /services/haproxy/configuration/frontends/{parent_name}/filters/{index}) +func (_ Unimplemented) ReplaceFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllFilterBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllFilterBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteFilterBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) GetFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFilterBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateFilterBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceFilterBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceFilterBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceFilterBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceFilterBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllFilterFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllFilterFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteFilterFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFilterFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateFilterFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceFilterFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceFilterFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceFilterFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceFilterFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters", wrapper.GetAllFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters", wrapper.ReplaceAllFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters/{index}", wrapper.DeleteFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters/{index}", wrapper.GetFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters/{index}", wrapper.CreateFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/filters/{index}", wrapper.ReplaceFilterBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters", wrapper.GetAllFilterFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters", wrapper.ReplaceAllFilterFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters/{index}", wrapper.DeleteFilterFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters/{index}", wrapper.GetFilterFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters/{index}", wrapper.CreateFilterFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/filters/{index}", wrapper.ReplaceFilterFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FrBbts4E34Vgu3p/2XLTYMC6z05TdvNZRF0F3tp0oAmRxZbiVRJyo4R+N0XJCVZiu3YyTqOW/ASOBI1", + "nBnOfN9oNHeYyryQAoTReHiHFehCCg3uH10A5QmnxHApbnLJINM3VOa5FDfNwvr6KFNA2PzDLddeFJXC", + "gDD2JymKrBITf9NSOOE0hZzYX68VJHiIX8VLVWJ/V8ePUgGUkgovFosIM9BU8cI+hYf47xRQJQkYUqBl", + "qSgg4lVG4HWOcAqEgXLav5ci4ZNSuY17/4DS3OvdldxZhhKeAZpWa6OWiWZeAB5ibRQXE6vhInqcd88I", + "+ww/StDmyFx7RqxDvWbH7MBzSEiZmQ/OjuNy4ScQoEiGvG7H7MQ/pfkoS8F+jvSeEY2ENChxKh/Ur4v6", + "ttst4ZkB1Vopx9+A2ny57U1kr7rorex/9Itb93o8L6Ryni6ISfEQT7hJy3GfyjxOSaHk7dwATWOacRCm", + "J4jhU4in72IvElt1vA5OHW4g19tOptJ5EdU6E6XI/CGV9d51fkJ07ObjOtP2qa5VmItErkbRSKDR5QVK", + "pEI5EWTCxQT9Mbq0MpF3Hcq4AN3HETbcZFbR+v45MQRdZkSAk9FDTXjUgTjE9pBkAYIUHA/x2/6g/wZH", + "zg53yrEGNeUUdG1ITNthHY8J/Q6C6fiuIAqEuREkh0XcCpgJmFWrPoMpldCIZFmllEYmJQYRBajeARji", + "opWbZ34va6kswCtwwRwGmlGWeTnVImeDIjl4Nb7cV+DSaYustti6Hg/92UXYXbL/NebgCFuS4goYHhpV", + "Qjt9C2IMKPv81y9fr67U1ZW4KgeDt9T9hf/9/vqV/XXy7m5xha///xpHKxkf3Vfu4hzJBJkUkFFEaEId", + "gsxSUIBmFpqEQUYiwphb1Dijj94TYUFrDKjUwOwjogYdxPXSl/3a6B8lqPnS6tZ+N5w9iFPXUbfeOxkM", + "9obsdfisgeu/SkpB66TMlnYfmvaYLwc2WdG4JX56keEQrMxzouZNuiAikANSGx2tzLEhRSY2ynGV4NeL", + "CBfl2rwrMkJBI4JmqcwAZVwbK65Owhk3qQsqd2PCpyBsEja55IDIdChzY1pWm4XUPHRqrmhdJYHf2Z4g", + "TYF+t1TSQfNan/XKtg1uKxx17qREI240krOluA0WPZBuXBiYgFp7AgnSYCLEJCLWFgpIQSYJc5es1jPC", + "TROnLTLxy3oMMjJ/rIlEI5oSMQFt06G9zjKWFeTQDhhiXAE12dyGQce7m9zgbLjxynV80cBMQjINTXCO", + "pcyAiBqC3dvTmWTz50HfbnotXgb0R60yQXlUYbZwORmcHGL7LlX4OECEUigMMEREHVr1uyzce2H47APv", + "4nwVkJd40jyL1oTCOhY69b7fIwO1+gQvw3LuZBFZFrauL3Cf3GzpTSWDCYhe5bXeWLJ5r0ooRgxxov9b", + "8RrfccHgduEPLQMDq8d37q7rpcpdPB3PHRY6OShRMt+VOr3cR9FmpcCF3Ws9b/Lq1mbG3I6+gZwDOQdy", + "3pmcO1R5su0l5FiY5WRwuiqvwhePhI59T/2yPZJD0yJ8CfrxmNtA+fq3qge7GVLADjxgQ3Q3FvgEJlBA", + "aJ08oYw91s7JLwYZVV9mmfcbWjFSr0GNEWO2cBQwq0GjitwlMlgXPgIv3isgoWoMVWOoGkNLZzMrbOvo", + "vDkAF9VVkgOsZ2rlhE5O3ck5Hfy2Z/ndeZ2XoN4RYx3yfHKfaPuXkn2W9JXYwNGBowNHB45+KkcPDsfR", + "z/u9JZD0kqR/sVfj7sec5/yOkygXkIeZQvpYbfbwGFK9Kgw7hDmkMId0kDmkzYl5fxApJGcoiUNJHCaR", + "wiRSmEQ6jkmkLRXsAUaRNrNnexZpV+YMLavAz4GfwzBSGEb62YaRHmxvBBIIHZQwjhTGkXZEjPY8UgCN", + "UDmGyjF0dsJAUmjohIGkgw8kbf04Elg6sHRg6cDSYSQp0HQYSdryQceKBTWtubFUGR7iePoWL64X/wYA", + "AP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/filter/filter.go b/handlers/configuration/filter/filter.go new file mode 100644 index 00000000..e2fd02db --- /dev/null +++ b/handlers/configuration/filter/filter.go @@ -0,0 +1,263 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package filter + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all filter routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy filter configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// Backend parent variants + +func (h *HandlerImpl) GetAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterBackendParams) { + h.getAllFilter(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterBackendParams) { + h.replaceAllFilter(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterBackendParams) { + h.deleteFilter(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterBackendParams) { + h.getFilter(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterBackendParams) { + h.createFilter(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceFilterBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterBackendParams) { + h.replaceFilter(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// Frontend parent variants + +func (h *HandlerImpl) GetAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllFilterFrontendParams) { + h.getAllFilter(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllFilterFrontendParams) { + h.replaceAllFilter(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteFilterFrontendParams) { + h.deleteFilter(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetFilterFrontendParams) { + h.getFilter(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateFilterFrontendParams) { + h.createFilter(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceFilterFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceFilterFrontendParams) { + h.replaceFilter(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// Shared internal methods + +func (h *HandlerImpl) getAllFilter(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, fs, err := cfg.GetFilters(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, Filters{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, fs) +} + +func (h *HandlerImpl) replaceAllFilter(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Filters + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceFilters(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteFilter(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteFilter(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getFilter(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, f, err := cfg.GetFilter(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, f) +} + +func (h *HandlerImpl) createFilter(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Filter + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateFilter(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceFilter(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Filter + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditFilter(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/frontend/frontend.gen.go b/handlers/configuration/frontend/frontend.gen.go new file mode 100644 index 00000000..32cfd3d2 --- /dev/null +++ b/handlers/configuration/frontend/frontend.gen.go @@ -0,0 +1,728 @@ +// Package frontend provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package frontend + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Frontend defines model for frontend. +type Frontend = models.Frontend + +// Frontends defines model for frontends. +type Frontends = models.Frontends + +// GetFrontendsParams defines parameters for GetFrontends. +type GetFrontendsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateFrontendParams defines parameters for CreateFrontend. +type CreateFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteFrontendParams defines parameters for DeleteFrontend. +type DeleteFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetFrontendParams defines parameters for GetFrontend. +type GetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceFrontendParams defines parameters for ReplaceFrontend. +type ReplaceFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateFrontendJSONRequestBody defines body for CreateFrontend for application/json ContentType. +type CreateFrontendJSONRequestBody = Frontend + +// ReplaceFrontendJSONRequestBody defines body for ReplaceFrontend for application/json ContentType. +type ReplaceFrontendJSONRequestBody = Frontend + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of frontends + // (GET /services/haproxy/configuration/frontends) + GetFrontends(w http.ResponseWriter, r *http.Request, params GetFrontendsParams) + // Add a frontend + // (POST /services/haproxy/configuration/frontends) + CreateFrontend(w http.ResponseWriter, r *http.Request, params CreateFrontendParams) + // Delete a frontend + // (DELETE /services/haproxy/configuration/frontends/{name}) + DeleteFrontend(w http.ResponseWriter, r *http.Request, name string, params DeleteFrontendParams) + // Return a frontend + // (GET /services/haproxy/configuration/frontends/{name}) + GetFrontend(w http.ResponseWriter, r *http.Request, name string, params GetFrontendParams) + // Replace a frontend + // (PUT /services/haproxy/configuration/frontends/{name}) + ReplaceFrontend(w http.ResponseWriter, r *http.Request, name string, params ReplaceFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of frontends +// (GET /services/haproxy/configuration/frontends) +func (_ Unimplemented) GetFrontends(w http.ResponseWriter, r *http.Request, params GetFrontendsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a frontend +// (POST /services/haproxy/configuration/frontends) +func (_ Unimplemented) CreateFrontend(w http.ResponseWriter, r *http.Request, params CreateFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a frontend +// (DELETE /services/haproxy/configuration/frontends/{name}) +func (_ Unimplemented) DeleteFrontend(w http.ResponseWriter, r *http.Request, name string, params DeleteFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a frontend +// (GET /services/haproxy/configuration/frontends/{name}) +func (_ Unimplemented) GetFrontend(w http.ResponseWriter, r *http.Request, name string, params GetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a frontend +// (PUT /services/haproxy/configuration/frontends/{name}) +func (_ Unimplemented) ReplaceFrontend(w http.ResponseWriter, r *http.Request, name string, params ReplaceFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetFrontends operation middleware +func (siw *ServerInterfaceWrapper) GetFrontends(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetFrontendsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFrontends(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateFrontend(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteFrontend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetFrontend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceFrontend(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends", wrapper.GetFrontends) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends", wrapper.CreateFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{name}", wrapper.DeleteFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{name}", wrapper.GetFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{name}", wrapper.ReplaceFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhPj9u2E/0qBH+/o2w5m6BAfXOySbuXIkiLXorAGJMjiylFKiRlx1jouxckJVmKvH+cuhtn4ZstUTNv", + "Rm/ejOaWMl2UWqFyls5vqUFbamUx/LElMpEJBk5otSw0R2mXTBeFVsvuYHt9IQ0C3739Imw0xbRyqJz/", + "CWUpGzPpJ6tVMM5yLMD/+r/BjM7p/9I9lDTetelRENAYbWhd1wnlaJkRpX+KzukfOZLGEnJi0OrKMCQQ", + "IROMmBOaI3A0Af0brTKxrkxwPPkTjRUR99Dy4BjJhESyac4mvRDdrkQ6p9YZodYeYZ0cl93XwD/g5wqt", + "O7PUvgaf0IjsnBN4jRlU0r0NcZxXCn9BhQYkidjOOYm/afdOV4r/GOW9BUuUdiQLkJ80r3V7O3jLTMgV", + "753Vq0/IfMV8maz1pLkY45y+a4/37k5EUWoTsl2Cy+mcroXLq9WU6SLNoTT6y84hy1MmBSo3UeDEBtPN", + "T2k0Sj2kFkcAJRwW9qH30yGvkxY5GAO7+4HbkyP/Bp48LtdtzZ0SrgcsVKbHfFoosnh/QzJtSAEK1kKt", + "ya+L994maVNNWJ90dkoT6oSTHnN79BockPcSFAZzE9JjTMvPOfXvTJeooBR0Tl9OZ9MXNAlBhdeeWjQb", + "wdC2UaUDx+mALGt042g+oKuMsgQUCaQgOiMgZRcA8i6oEIYuMdq+4UH1XJ8vJRgo0IX6/OtrTzfX3rbL", + "kTgDygIL9bjN0SDZ+kJXjjhNgPNwqHM0JW9AeQlYIakscv+IakuYCLtXDY9PeFefKzSe3goKn/Kev6Xg", + "91Z9MkKtuGcsWiIi+AY3ZBkyZ8OlvWyxXMi9eFkClmxRyjtwZZWUS4vB4AAVj32OzjOQFruqXWktERSt", + "64/JcMi7ms1OJud7zhxQ6d8rxtDarJL7F/TU3a7LzuE4usSk3z5bBLmqigLMrquRQYlkPdY7WHu+066A", + "P9YJLbU9UG0Lzi0BonC7lwqnA4nYKCHjcntjEBz2hOIZFlzDmOjZiyzLkf3tRXaYoQbPYbD9gPuAk8Gd", + "HCwRzhK93Zu7I6J7uCmUwzWag+KREYsuIVwT8LEwJAalBh4uedRbEC5E2adAmH/8sQlHCbtjQwRLWA5q", + "7TVreA4MBq9BHJATLgwyJ3eeBoPs3pWGEMMygjtOsX4kYQ0fQq81351cU6Okeg/CIKdzZyqsR1r+4j/y", + "O3wB77pZJahKGA+vZldP4nuo/pGtBBjD0iEnoNoCaL9K8avR/0Msj5vrscTuVa97lhwg7KHG8ip20RM2", + "ld4Xf7D/84ntD/c136M3Ljj32rZvSeNu6AdzpjmuUU2adzJZab6bNNXKwUGw+uhpNr31j9bx5Ut0OKbB", + "dbhue9j8j+JAq13tQhPwFscdN5p5bMftSipE1mhT+ALppKm5M5SA4ybSS1u/tPVzaevjD5Grh2b9c1H7", + "q9mrsb2ugqOu8Cjbr06sp90K7nsodpS0h0S7Tu7fF2iFd2w77hfU3sbgoqaXrcRJpslzWEo8M5FoVx4P", + "ikRZHRSJUgIbTl9HaETz+EUnLlPXZeq6LFP+3TJl9rTLFBO167JNeYJtyjPruIE4J1qmeNNoNm3DrIyk", + "c5puXtL6Y/1PAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/frontend/frontend.go b/handlers/configuration/frontend/frontend.go new file mode 100644 index 00000000..e2416546 --- /dev/null +++ b/handlers/configuration/frontend/frontend.go @@ -0,0 +1,310 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package frontend + +import ( + "net/http" + "reflect" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all frontend routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy frontend configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetFrontends(w http.ResponseWriter, r *http.Request, params GetFrontendsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var frontends Frontends + if params.FullSection { + _, frontends, err = cfg.GetStructuredFrontends(params.TransactionId) + } else { + _, frontends, err = cfg.GetFrontends(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, frontends) +} + +func (h *HandlerImpl) CreateFrontend(w http.ResponseWriter, r *http.Request, params CreateFrontendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Frontend + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredFrontend(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateFrontend(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteFrontend(w http.ResponseWriter, r *http.Request, name string, params DeleteFrontendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteFrontend(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetFrontend(w http.ResponseWriter, r *http.Request, name string, params GetFrontendParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var fe *Frontend + if params.FullSection { + _, fe, err = cfg.GetStructuredFrontend(name, params.TransactionId) + } else { + _, fe, err = cfg.GetFrontend(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, fe) +} + +func (h *HandlerImpl) ReplaceFrontend(w http.ResponseWriter, r *http.Request, name string, params ReplaceFrontendParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Frontend + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ondisk, err := cfg.GetFrontend(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredFrontend(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditFrontend(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + needsReload := frontendChangeThroughRuntimeAPI(data, *ondisk, h.Client) + if needsReload { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// runtimeSupportedFrontendFields lists Frontend fields that can be changed without a reload. +var runtimeSupportedFrontendFields = []string{"Maxconn"} + +// frontendChangeThroughRuntimeAPI attempts to apply frontend field changes via the HAProxy runtime API. +// Returns true when a reload is still required (unsupported fields changed or runtime call failed). +func frontendChangeThroughRuntimeAPI(data, ondisk Frontend, client client_native.HAProxyClient) (reload bool) { + defer func() { + if r := recover(); r != nil { + log.Warning("frontendChangeThroughRuntimeAPI panic:", r) + reload = true + } + }() + + rt, err := client.Runtime() + if err != nil { + return true + } + + diff := frontendCompareObjects(data, ondisk) + if len(diff) == 0 { + return false + } + if !frontendCompareChanged(diff, runtimeSupportedFrontendFields) { + return true + } + + for _, field := range diff { + fieldValue := reflect.ValueOf(data).FieldByName(field) + if !fieldValue.IsValid() { + continue + } + switch field { + case "Maxconn": + maxConn := int(fieldValue.Elem().Int()) + if err = rt.SetFrontendMaxConn(data.Name, maxConn); err != nil { + return true + } + } + } + return false +} + +func frontendCompareObjects(data, ondisk any) []string { + diff := []string{} + dataVal := reflect.ValueOf(data) + ondiskVal := reflect.ValueOf(ondisk) + for i := range dataVal.NumField() { + fName := dataVal.Type().Field(i).Name + dField := dataVal.FieldByName(fName) + oField := ondiskVal.FieldByName(fName) + dKind := dField.Kind() + oKind := oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + if dKind == reflect.Ptr { + dField = dField.Elem() + oField = oField.Elem() + dKind = dField.Kind() + oKind = oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + } + switch dKind { + case reflect.Float32, reflect.Float64: + if dField.Float() != oField.Float() { + diff = append(diff, fName) + } + case reflect.Bool: + if dField.Bool() != oField.Bool() { + diff = append(diff, fName) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if dField.Int() != oField.Int() { + diff = append(diff, fName) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if dField.Uint() != oField.Uint() { + diff = append(diff, fName) + } + case reflect.String: + if dField.String() != oField.String() { + diff = append(diff, fName) + } + case reflect.Struct: + diff = append(diff, frontendCompareObjects(dField.Interface(), oField.Interface())...) + } + } + return diff +} + +func frontendCompareChanged(changed, changeable []string) bool { + if len(changed) > len(changeable) { + return false + } + set := make(map[string]bool, len(changed)) + for _, f := range changed { + set[f] = true + } + for _, f := range changeable { + delete(set, f) + } + return len(set) == 0 +} diff --git a/handlers/configuration/global/global.gen.go b/handlers/configuration/global/global.gen.go new file mode 100644 index 00000000..c44153ac --- /dev/null +++ b/handlers/configuration/global/global.gen.go @@ -0,0 +1,441 @@ +// Package global provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package global + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Global defines model for global. +type Global = models.Global + +// GetGlobalParams defines parameters for GetGlobal. +type GetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceGlobalParams defines parameters for ReplaceGlobal. +type ReplaceGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceGlobalJSONRequestBody defines body for ReplaceGlobal for application/json ContentType. +type ReplaceGlobalJSONRequestBody = Global + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return a global part of configuration + // (GET /services/haproxy/configuration/global) + GetGlobal(w http.ResponseWriter, r *http.Request, params GetGlobalParams) + // Replace global + // (PUT /services/haproxy/configuration/global) + ReplaceGlobal(w http.ResponseWriter, r *http.Request, params ReplaceGlobalParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return a global part of configuration +// (GET /services/haproxy/configuration/global) +func (_ Unimplemented) GetGlobal(w http.ResponseWriter, r *http.Request, params GetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace global +// (PUT /services/haproxy/configuration/global) +func (_ Unimplemented) ReplaceGlobal(w http.ResponseWriter, r *http.Request, params ReplaceGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetGlobal operation middleware +func (siw *ServerInterfaceWrapper) GetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetGlobal(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceGlobal operation middleware +func (siw *ServerInterfaceWrapper) ReplaceGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceGlobal(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/global", wrapper.GetGlobal) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/global", wrapper.ReplaceGlobal) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3FdNb+M2EP0rA7ZHyUqzRQ+6JZtim1uQAr0UgTEmRxK3FKklKXuNhf57QVKyrVob1EWatHuzpeHMe/Px", + "hvrCuGk7o0l7x8ovzJLrjHYU/7iOuKwkRy+NXrdGkHJrbtrW6PXBcHp+i+KRPvXkfDjKjfak40/sOjX6", + "KD46o6Nn3lCL4df3lipWsu+KI44ivXXFRfHJWmPZMAwZE+S4lV04xUp2iwLsiCxjDaEgG+m9N7qSdW+j", + "+/w3sk4mdPPzMzOopCLYjrbZCRG/74iVzHkrdR1wDNllCbyjCnvlf448/lsp/ECaLCpI2F41icP0Okar", + "ldmgOrE0m4/EQ10/57XJx4eJzupDMj55l8u2MzamtEPfsJLV0jf9ZsVNWzTYWfN574k3BVeStM81erml", + "YvtTkVyyi4tKUzX/Bt4puy8JNwCWujLnFbnRcPNwD5Wx0KLGWuoafrl5CD4hpRn4adFWLGNeehUAT3Z3", + "6BEeFGqKvnI4pHwqbsnYkDHTkcZOspK9W12tfmBZ5BMrWjiyW8nJTYSKWdTiWPGa/DmLR/K91W5C3KH1", + "YKpz5Kaj9OdexH72B6QdWmzJx3b+/a/u7++CN98QeIvaIY/tu2vIEuwIdqg9eAMoRDQ6RFnBe9TaeNgQ", + "9I5EOKKnjgfpYGwiEgGcDKE+9WT3LGMa25Dik3hrKZ4dkuwMtRahPcmBTOBH3FhVxL2Ljw4AgDdSBYV0", + "precHKCDHSn1FVxVr9TaUXQ4QyWSfLGyQuUom1BujFGEmg3DUzbfLtdXVy8mc2OXLEjXrz3n5FzVq2N1", + "XnsNHFKzTOKQleKf74soTH3bot0fpgLw2bEI84x16Ho2DsPTkLGuX5yyTiGnZXfn4zWaf8sjNrZJihw0", + "lDfE/wgaOsvxhGcZ7CnhU8DZ7E2DDqR3YHZHd19h9ExDSu2pJrsoFxU48hkIAxi4cAJLyqCIjwLqHUof", + "WYYKTARJjGa5IIX7SymiA96groNKze3QUowa5YAECGmJe7UPbXAm7IsaFTisE7jLNOr/JKXxRntrxP5f", + "UdHgX1oSrPS2p+FNtDsJCNgkJyLcJK6vrl8h8FzrU5sCck6dJwGop86fvitIzFfKY5qL+7tzKT3K3eEs", + "LHTq0hr5MSX9BVfIyTfb26yp07WysI/CXZgbQTXpfExXvjFin48TJNBjql+4RU77pbeKlazYvmPD0/Bn", + "AAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/global/global.go b/handlers/configuration/global/global.go new file mode 100644 index 00000000..185388ed --- /dev/null +++ b/handlers/configuration/global/global.go @@ -0,0 +1,128 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + client_conf "github.com/haproxytech/client-native/v6/configuration" + + cn "github.com/haproxytech/dataplaneapi/client-native" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all global routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy global configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetGlobal(w http.ResponseWriter, r *http.Request, params GetGlobalParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var data *Global + if params.FullSection { + _, data, err = cfg.GetStructuredGlobalConfiguration(params.TransactionId) + } else { + _, data, err = cfg.GetGlobalConfiguration(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) +} + +func (h *HandlerImpl) ReplaceGlobal(w http.ResponseWriter, r *http.Request, params ReplaceGlobalParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Global + if !respond.DecodeBody(r, w, &data) { + return + } + if err := client_conf.ValidateGlobalSection(&data); err != nil { + respond.BadRequest(w, err.Error()) + return + } + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.PushStructuredGlobalConfiguration(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.PushGlobalConfiguration(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + + if params.TransactionId == "" { + callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) + if err != nil { + respond.Error(w, err) + return + } + if params.ForceReload { + if callbackNeeded { + err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) + } else { + err = h.ReloadAgent.ForceReload() + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + var rID string + if callbackNeeded { + rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) + } else { + rID = h.ReloadAgent.Reload() + } + respond.Accepted(w, rID, &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/groups/groups.gen.go b/handlers/configuration/groups/groups.gen.go new file mode 100644 index 00000000..89153b84 --- /dev/null +++ b/handlers/configuration/groups/groups.gen.go @@ -0,0 +1,743 @@ +// Package groups provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package groups + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Group defines model for group. +type Group = models.Group + +// Groups defines model for groups. +type Groups = models.Groups + +// GetGroupsParams defines parameters for GetGroups. +type GetGroupsParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateGroupParams defines parameters for CreateGroup. +type CreateGroupParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteGroupParams defines parameters for DeleteGroup. +type DeleteGroupParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetGroupParams defines parameters for GetGroup. +type GetGroupParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceGroupParams defines parameters for ReplaceGroup. +type ReplaceGroupParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateGroupJSONRequestBody defines body for CreateGroup for application/json ContentType. +type CreateGroupJSONRequestBody = Group + +// ReplaceGroupJSONRequestBody defines body for ReplaceGroup for application/json ContentType. +type ReplaceGroupJSONRequestBody = Group + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of groups + // (GET /services/haproxy/configuration/groups) + GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams) + // Add a group + // (POST /services/haproxy/configuration/groups) + CreateGroup(w http.ResponseWriter, r *http.Request, params CreateGroupParams) + // Delete a group + // (DELETE /services/haproxy/configuration/groups/{name}) + DeleteGroup(w http.ResponseWriter, r *http.Request, name string, params DeleteGroupParams) + // Return a group + // (GET /services/haproxy/configuration/groups/{name}) + GetGroup(w http.ResponseWriter, r *http.Request, name string, params GetGroupParams) + // Replace a group + // (PUT /services/haproxy/configuration/groups/{name}) + ReplaceGroup(w http.ResponseWriter, r *http.Request, name string, params ReplaceGroupParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of groups +// (GET /services/haproxy/configuration/groups) +func (_ Unimplemented) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a group +// (POST /services/haproxy/configuration/groups) +func (_ Unimplemented) CreateGroup(w http.ResponseWriter, r *http.Request, params CreateGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a group +// (DELETE /services/haproxy/configuration/groups/{name}) +func (_ Unimplemented) DeleteGroup(w http.ResponseWriter, r *http.Request, name string, params DeleteGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a group +// (GET /services/haproxy/configuration/groups/{name}) +func (_ Unimplemented) GetGroup(w http.ResponseWriter, r *http.Request, name string, params GetGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a group +// (PUT /services/haproxy/configuration/groups/{name}) +func (_ Unimplemented) ReplaceGroup(w http.ResponseWriter, r *http.Request, name string, params ReplaceGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetGroups operation middleware +func (siw *ServerInterfaceWrapper) GetGroups(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetGroupsParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetGroups(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateGroup operation middleware +func (siw *ServerInterfaceWrapper) CreateGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateGroupParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateGroup(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteGroup operation middleware +func (siw *ServerInterfaceWrapper) DeleteGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteGroupParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteGroup(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetGroup operation middleware +func (siw *ServerInterfaceWrapper) GetGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetGroupParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetGroup(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceGroup operation middleware +func (siw *ServerInterfaceWrapper) ReplaceGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceGroupParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceGroup(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/groups", wrapper.GetGroups) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/groups", wrapper.CreateGroup) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/groups/{name}", wrapper.DeleteGroup) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/groups/{name}", wrapper.GetGroup) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/groups/{name}", wrapper.ReplaceGroup) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNb+M2EP0rBNujbHmziwL1zUm221yKIC16KYJgTI5kbilSS1J2jED/vSBpyVb8sfHGybob3xKJGr43", + "nHlvzAfKdFFqhcpZOnygBm2plcXwjy2RiUwwcEKru0JzlPaO6aLQ6q5d2DwfSYPA5x/vhY2hmFYOlfN/", + "QlnKRZj0s9UqBGcTLMD/9bPBjA7pT+kSShrf2nQvCGiMNrSu64RytMyI0n9Fh/SvCZJFJOTEoNWVYUgg", + "QiYYMSd0gsDRBPQXWmUir0zYuPc3Gisi7m7kzjKSCYlkulibrFB08xLpkFpnhMo9wjrZL7vnwG/wS4XW", + "HVlqz8EnNCI75gReYgaVdB8Dj+NK4SdUaECSiO2Yk/iHdr/pSvH/R3vPwBKlHckC5FfNa928DrvlRlfl", + "ykI9/ozMt8t9L9e9xcNIsv8prF151RNFqU3IcwluQoc0F25SjftMF+kESqPv5w7ZJGVSoHI9BU5MMZ3+", + "ksaI1IMJCAIW4bCwXzuWCLhOGsBgDMx34LUHB/wNhfG0/DZNdki4HrBQmV4voJEio+srkmlDClCQC5WT", + "30fXPiapLBoprCMh24St1prt04Q64aRH3nxwCQ7ItQSFIWiPtLlvinJI/aHpEhWUgg7p+/6g/44mgVg4", + "9NSimQqGtmGWdrZNl3WSo1unc4OuMsoSUCSUBNEZASkjA0vGKLUKHJ0mrtOUDVnPS5cYt7viQf1cy6ME", + "AwW60KT/PN78Ggwqt0ybggKpTzwd0i8VGl+g4dmQNmtoQr03CYOcDp2pcFfXJo83vLr0/DwPZ0BZYEEF", + "ZhM0SGZeXpTzRIHzsKil1ScXoLzwjNGj5f4T1QgHEXaZlv4W/Cv73Qm+U2tuk+7MdjYYHEydF9WwQXH/", + "rBhDa7NKLmm/tnPx6OjbSLRZSb99TghKVBUFmHlb/Z3iz5vKdZD7mqVRvm/rhJbabuigEeeWAFE4W7T9", + "Hp1yYRAcNgZx6pW9e2UN9aIs485epNkE2b9ewDqy2ODZDHaV8CrgpPNmApYIZ4meLcNtYbSjAYRymKPZ", + "eAIZsegSwjUBz4UhMSg18PDIo56BcIGlP4GGYBiY/LIeRwnzfSmCJWwCKkdLRHcdGAy7BvlBTrgwyJyc", + "+zLoZHdbGgKHuwiuk4u28TOQFtshZay1RFCNJoafJOeazw8rh1ENu51Sr2nwu5fY9NGvhjg1BE3g3vbP", + "Bmcvv2tXr+PRE2AMS4ecgGqqqflNiI8G75tYa1eX69K4lJD2W7Lh9DdZwYdoege0gZXf2yH+rweO370t", + "+R5uNuKcQDShdf/y8zHTHHNUvcVp9Maaz3uL3uTgIMR72kCZPvjv6njmEh2un/5leG4bSCQzutjijGQ8", + "D4a27pAxyJMcMrbPqi+G6b9Vn8WbZ1jiyYNPHvzGPbjjiWdfm/6PxU3OBh/W40W9iOrFoyd8OLBYt7dr", + "38MOonRud4Q62X0loBU+R7mbW4CTbL/Ra4ZjvWX4wdq8ucPY0eZltbHNSwlsZT7zTrNnjy9inPr8NJ6d", + "xrM3f0UyeK0rEhNl53RH8tJ3JD+YUYaqefYViQ+KZtq4XGUkHdJ0+p7Wt/V/AQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/groups/groups.go b/handlers/configuration/groups/groups.go new file mode 100644 index 00000000..908c23c6 --- /dev/null +++ b/handlers/configuration/groups/groups.go @@ -0,0 +1,204 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package groups + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +func notFound(w http.ResponseWriter) { + code := misc.ErrHTTPNotFound + msg := "not found" + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) +} + +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, userlist, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if userlist == nil || err != nil { + notFound(w) + return + } + _, groups, err := cfg.GetGroups(params.Userlist, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.Groups{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, groups) +} + +func (h *HandlerImpl) CreateGroup(w http.ResponseWriter, r *http.Request, params CreateGroupParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var data Group + if !respond.DecodeBody(r, w, &data) { + return + } + if err = cfg.CreateGroup(params.Userlist, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteGroup(w http.ResponseWriter, r *http.Request, name string, params DeleteGroupParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, userlist, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if userlist == nil || err != nil { + notFound(w) + return + } + if err = cfg.DeleteGroup(name, params.Userlist, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetGroup(w http.ResponseWriter, r *http.Request, name string, params GetGroupParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, g, err := cfg.GetGroup(name, params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if g == nil { + notFound(w) + return + } + respond.JSON(w, http.StatusOK, g) +} + +func (h *HandlerImpl) ReplaceGroup(w http.ResponseWriter, r *http.Request, name string, params ReplaceGroupParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, userlist, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if userlist == nil || err != nil { + notFound(w) + return + } + _, g, err := cfg.GetGroup(name, params.Userlist, params.TransactionId) + if g == nil || err != nil { + notFound(w) + return + } + var data Group + if !respond.DecodeBody(r, w, &data) { + return + } + if err = cfg.EditGroup(name, params.Userlist, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/http/http_after_response_rule/http_after_response_rule.gen.go b/handlers/configuration/http/http_after_response_rule/http_after_response_rule.gen.go new file mode 100644 index 00000000..2d275bbe --- /dev/null +++ b/handlers/configuration/http/http_after_response_rule/http_after_response_rule.gen.go @@ -0,0 +1,1887 @@ +// Package http_after_response_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_after_response_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpAfterResponseRule defines model for http_after_response_rule. +type HttpAfterResponseRule = models.HTTPAfterResponseRule + +// HttpAfterResponseRules defines model for http_after_response_rules. +type HttpAfterResponseRules = models.HTTPAfterResponseRules + +// GetAllHTTPAfterResponseRuleBackendParams defines parameters for GetAllHTTPAfterResponseRuleBackend. +type GetAllHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPAfterResponseRuleBackendParams defines parameters for ReplaceAllHTTPAfterResponseRuleBackend. +type ReplaceAllHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPAfterResponseRuleBackendParams defines parameters for DeleteHTTPAfterResponseRuleBackend. +type DeleteHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPAfterResponseRuleBackendParams defines parameters for GetHTTPAfterResponseRuleBackend. +type GetHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPAfterResponseRuleBackendParams defines parameters for CreateHTTPAfterResponseRuleBackend. +type CreateHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPAfterResponseRuleBackendParams defines parameters for ReplaceHTTPAfterResponseRuleBackend. +type ReplaceHTTPAfterResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPAfterResponseRuleDefaultsParams defines parameters for GetAllHTTPAfterResponseRuleDefaults. +type GetAllHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPAfterResponseRuleDefaultsParams defines parameters for ReplaceAllHTTPAfterResponseRuleDefaults. +type ReplaceAllHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPAfterResponseRuleDefaultsParams defines parameters for DeleteHTTPAfterResponseRuleDefaults. +type DeleteHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPAfterResponseRuleDefaultsParams defines parameters for GetHTTPAfterResponseRuleDefaults. +type GetHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPAfterResponseRuleDefaultsParams defines parameters for CreateHTTPAfterResponseRuleDefaults. +type CreateHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPAfterResponseRuleDefaultsParams defines parameters for ReplaceHTTPAfterResponseRuleDefaults. +type ReplaceHTTPAfterResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPAfterResponseRuleFrontendParams defines parameters for GetAllHTTPAfterResponseRuleFrontend. +type GetAllHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPAfterResponseRuleFrontendParams defines parameters for ReplaceAllHTTPAfterResponseRuleFrontend. +type ReplaceAllHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPAfterResponseRuleFrontendParams defines parameters for DeleteHTTPAfterResponseRuleFrontend. +type DeleteHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPAfterResponseRuleFrontendParams defines parameters for GetHTTPAfterResponseRuleFrontend. +type GetHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPAfterResponseRuleFrontendParams defines parameters for CreateHTTPAfterResponseRuleFrontend. +type CreateHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPAfterResponseRuleFrontendParams defines parameters for ReplaceHTTPAfterResponseRuleFrontend. +type ReplaceHTTPAfterResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllHTTPAfterResponseRuleBackendJSONRequestBody defines body for ReplaceAllHTTPAfterResponseRuleBackend for application/json ContentType. +type ReplaceAllHTTPAfterResponseRuleBackendJSONRequestBody = HttpAfterResponseRules + +// CreateHTTPAfterResponseRuleBackendJSONRequestBody defines body for CreateHTTPAfterResponseRuleBackend for application/json ContentType. +type CreateHTTPAfterResponseRuleBackendJSONRequestBody = HttpAfterResponseRule + +// ReplaceHTTPAfterResponseRuleBackendJSONRequestBody defines body for ReplaceHTTPAfterResponseRuleBackend for application/json ContentType. +type ReplaceHTTPAfterResponseRuleBackendJSONRequestBody = HttpAfterResponseRule + +// ReplaceAllHTTPAfterResponseRuleDefaultsJSONRequestBody defines body for ReplaceAllHTTPAfterResponseRuleDefaults for application/json ContentType. +type ReplaceAllHTTPAfterResponseRuleDefaultsJSONRequestBody = HttpAfterResponseRules + +// CreateHTTPAfterResponseRuleDefaultsJSONRequestBody defines body for CreateHTTPAfterResponseRuleDefaults for application/json ContentType. +type CreateHTTPAfterResponseRuleDefaultsJSONRequestBody = HttpAfterResponseRule + +// ReplaceHTTPAfterResponseRuleDefaultsJSONRequestBody defines body for ReplaceHTTPAfterResponseRuleDefaults for application/json ContentType. +type ReplaceHTTPAfterResponseRuleDefaultsJSONRequestBody = HttpAfterResponseRule + +// ReplaceAllHTTPAfterResponseRuleFrontendJSONRequestBody defines body for ReplaceAllHTTPAfterResponseRuleFrontend for application/json ContentType. +type ReplaceAllHTTPAfterResponseRuleFrontendJSONRequestBody = HttpAfterResponseRules + +// CreateHTTPAfterResponseRuleFrontendJSONRequestBody defines body for CreateHTTPAfterResponseRuleFrontend for application/json ContentType. +type CreateHTTPAfterResponseRuleFrontendJSONRequestBody = HttpAfterResponseRule + +// ReplaceHTTPAfterResponseRuleFrontendJSONRequestBody defines body for ReplaceHTTPAfterResponseRuleFrontend for application/json ContentType. +type ReplaceHTTPAfterResponseRuleFrontendJSONRequestBody = HttpAfterResponseRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all HTTP After Response Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules) + GetAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleBackendParams) + // Replace an HTTP After Response Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules) + ReplaceAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleBackendParams) + // Delete a HTTP After Response Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) + DeleteHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleBackendParams) + // Return one HTTP After Response Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) + GetHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleBackendParams) + // Add a new HTTP After Response Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) + CreateHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleBackendParams) + // Replace a HTTP After Response Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) + ReplaceHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleBackendParams) + // Return an array of all HTTP After Response Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules) + GetAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleDefaultsParams) + // Replace an HTTP After Response Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules) + ReplaceAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleDefaultsParams) + // Delete a HTTP After Response Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) + DeleteHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleDefaultsParams) + // Return one HTTP After Response Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) + GetHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleDefaultsParams) + // Add a new HTTP After Response Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) + CreateHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleDefaultsParams) + // Replace a HTTP After Response Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) + ReplaceHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleDefaultsParams) + // Return an array of all HTTP After Response Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules) + GetAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleFrontendParams) + // Replace an HTTP After Response Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules) + ReplaceAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleFrontendParams) + // Delete a HTTP After Response Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) + DeleteHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleFrontendParams) + // Return one HTTP After Response Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) + GetHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleFrontendParams) + // Add a new HTTP After Response Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) + CreateHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleFrontendParams) + // Replace a HTTP After Response Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) + ReplaceHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all HTTP After Response Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules) +func (_ Unimplemented) GetAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP After Response Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules) +func (_ Unimplemented) ReplaceAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP After Response Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP After Response Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) GetHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP After Response Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) CreateHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP After Response Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP After Response Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules) +func (_ Unimplemented) GetAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP After Response Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules) +func (_ Unimplemented) ReplaceAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP After Response Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP After Response Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) GetHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP After Response Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) CreateHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP After Response Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP After Response Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules) +func (_ Unimplemented) GetAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP After Response Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules) +func (_ Unimplemented) ReplaceAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP After Response Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP After Response Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) GetHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP After Response Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) CreateHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP After Response Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPAfterResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPAfterResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPAfterResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPAfterResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPAfterResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPAfterResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPAfterResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPAfterResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPAfterResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPAfterResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPAfterResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPAfterResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPAfterResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPAfterResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPAfterResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPAfterResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPAfterResponseRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPAfterResponseRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPAfterResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPAfterResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPAfterResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPAfterResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPAfterResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPAfterResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules", wrapper.GetAllHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules", wrapper.ReplaceAllHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}", wrapper.DeleteHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}", wrapper.GetHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}", wrapper.CreateHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}", wrapper.ReplaceHTTPAfterResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules", wrapper.GetAllHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules", wrapper.ReplaceAllHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}", wrapper.DeleteHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}", wrapper.GetHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}", wrapper.CreateHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}", wrapper.ReplaceHTTPAfterResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules", wrapper.GetAllHTTPAfterResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules", wrapper.ReplaceAllHTTPAfterResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}", wrapper.DeleteHTTPAfterResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}", wrapper.GetHTTPAfterResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}", wrapper.CreateHTTPAfterResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}", wrapper.ReplaceHTTPAfterResponseRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fxbb9s4E/0rBNun75MjNw0KrPfJaXrJyyLIFvvSpAZDjiy2EqmSVBwj8H9fkJJ8aSxfum7sNPNSOLZI", + "zYxm5hyODnpPuc4LrUA5S3v31IAttLIQ/rAFcJlIzpzUapBrAZkdcJ3nWg2mFzbf9zMDTIzf3UlbbcW1", + "cqCc/8iKIqu3ib9arcLmPIWc+U8vDSS0R1/EM1Pi6lcbb2UCGKMNnUwmERVguZGFX0V79FMKpN4JBDFg", + "dWk4EFaZTKCyOaIpMAEmWP9Wq0QOSxNu3PkHjJWV3Ys7L1xGEpkBua2vjeZcdOMCaI9aZ6Qaegsn0XbR", + "PWXiEr6XYN2BhfaU+YBWlh1yAM8gYWXm3gU/DiuEH0CBYRmpbDvkIP6l3XtdKvE0ynvELFHakSSY/Khx", + "nTQ/h7ulzhUDljgwU6cGpsxgbq2++QrcV9BdZ6g79ZeV30cfP3266PvVl/XiS7927tKOzAttwqMomEtp", + "jw6lS8ubI67zOGWF0XdjBzyNeSZBuY5iTt5CfPsmru5Avb1tRgYPpIPcrnuYrW5OosZNZgwbb+Gl3bmb", + "P5Fxmz2lpnp3aa43WKpEP8zMviL9i3OSaENypthQqiH52L/wexIfSRJCSZpYkhDMIxpRJ51PPNpcfMYc", + "IxcZUxA27LSuphFtcr9H/SPVBShWSNqjr4+6R69oFNwMWRJbMLeSg238jPl8JcU3jH8DJWx8XzADyg0U", + "y2ESr0zBIbiHYbgEVxplCcuydreJS5kjzABprABBpJprGaeVPT4+uoDKyHMRWrPrZ9nS1KzXBLcNy8GF", + "1vL5RwsvgoPEO0j9w6S9KhsiGr7yf00jQCPqoVQaELTnTAnzTaZgzoHx6798/nJ1Za6u1FXZ7b7m4V/4", + "358vX/hPx2/uJ1f0+v8vafSgL0U/Gnd+RnRCXArEGaYs46HPjVIwQEa+gSpHnCZMiHDRNDZH5C1TvrXe", + "ACktCL9ENa2RSDsL7VHj9PcSzHjm9dz9BlKs7KbX0SIrPe52d4Y/7Rm3BGb+LjkHa5Mym0XiseFaVDSm", + "za9poOKfJ0ehS5Z5zsx4WmGEKRJ6t8+XlcXm044NfSXQ5bh1PYloUS6t5SJjHCxhZJTqDEgmrfP3ay/s", + "kXRpyMxw6VDegvKFPS3I0B/dAjtoLfX69ljuey73B1bXZVTd2T9QngL/5gFvAVQae5YbO+/wvMHRwi8p", + "s0Q6S/Rotl2LRysKVioHQzBLn0BCLLiICE2Y94UDMZBpJsJX3uoRk26atnN4VV3WEZCx8bYuMkt4ytQQ", + "rK+O+es8KPqNQgcFQYQ0wF029mmwEN22MAQfBpVxC7GYNqqEZRamyXmjdQZMNW09nBtPtRg/VkdfLLjJ", + "oUBLfyV/MVVrEp51HXeP92PiImhV+UQY51A4EISpJkWbaQD8cOS6rBL4/Oxh55/1pelasiSlluHhSfXE", + "doiFc5OW/eBteNYecNsSIqDdepz1RxGuBQxBdeq4dm60GHfq0hXMsXDzXbP1+F4qAXeT6kFn4ODhIz8L", + "33usb/VysbvfjENnDjuTxOh8U1yv7vRfML3VwnNvzHKYl/VP7QC/HiyQSyCXQC6xMZdYwPHjdaeuQwGw", + "4+7Jw/1aO07VTgMROKkW7hCVptPdfeBe1aZX4MFGB8uVQyKt4KfQxuf5ZljzARwCDc6oHucgcagjqt+s", + "MdUDsFXNY7OZl7ZLelNfCE+CFYzaW1Od/rP+46O+RVd6a4AhA0YGjAwYp2k7xZ51w7RXe8HAdooX+uCj", + "TdFwiNYM0U66f+x4/0Wx2T5oQV+INbi9qwnd+tdlv/ZQU98I+QPyB+QPyB8ekT90D4s/PPZrOCQQMwLx", + "m40U6nd8v5w7bPB2r/b+YLR4ddzsVmK8ZhHKc1CNh2q8p6PGay/2NXI8LHg8AeAJAPV4qMdDPd5z0+Nt", + "y9j3osdrR/YVgrxNUR3nicgmkE2gIg8VeajIWz80QqjBSRVq8lCTtwdNXntfWiHKw9aELBhZMM7UUJWH", + "L9VRlfe8VXlrX5Ahg0AGgQwCGQTq8pBCoC7vN9LlJSbk8OH8J3nva4O2EuY1i1Cng8I8FOY9HWFee7Gv", + "EeZhweMRAI8AKMxDYR4K856bMG9ryr4XZV47tK9Q5m0K6zhRRDqBdAKVeajMQ2Xe+qkRQg2OqlCZh8q8", + "PSjz2vvSCmUetiZkwciCcaiGyjx8rY7KvOetzFv7hgwZBDIIZBDIIFCZhxQClXlPRpnn7wvmtoHl0mS0", + "R+Pb13RyPfk3AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http/http_after_response_rule/http_after_response_rule.go b/handlers/configuration/http/http_after_response_rule/http_after_response_rule.go new file mode 100644 index 00000000..f79d4e3b --- /dev/null +++ b/handlers/configuration/http/http_after_response_rule/http_after_response_rule.go @@ -0,0 +1,289 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_after_response_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all HTTP After Response Rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy HTTP After Response Rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleBackendParams) { + h.getAllHTTPAfterResponseRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleBackendParams) { + h.replaceAllHTTPAfterResponseRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleBackendParams) { + h.deleteHTTPAfterResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleBackendParams) { + h.getHTTPAfterResponseRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleBackendParams) { + h.createHTTPAfterResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPAfterResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleBackendParams) { + h.replaceHTTPAfterResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleDefaultsParams) { + h.getAllHTTPAfterResponseRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleDefaultsParams) { + h.replaceAllHTTPAfterResponseRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleDefaultsParams) { + h.deleteHTTPAfterResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleDefaultsParams) { + h.getHTTPAfterResponseRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleDefaultsParams) { + h.createHTTPAfterResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPAfterResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleDefaultsParams) { + h.replaceHTTPAfterResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPAfterResponseRuleFrontendParams) { + h.getAllHTTPAfterResponseRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPAfterResponseRuleFrontendParams) { + h.replaceAllHTTPAfterResponseRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPAfterResponseRuleFrontendParams) { + h.deleteHTTPAfterResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPAfterResponseRuleFrontendParams) { + h.getHTTPAfterResponseRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPAfterResponseRuleFrontendParams) { + h.createHTTPAfterResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPAfterResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPAfterResponseRuleFrontendParams) { + h.replaceHTTPAfterResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetHTTPAfterResponseRules(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, HttpAfterResponseRules{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) getHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetHTTPAfterResponseRule(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpAfterResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPAfterResponseRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPAfterResponseRule(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpAfterResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPAfterResponseRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllHTTPAfterResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpAfterResponseRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceHTTPAfterResponseRules(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/http/http_check/http_check.gen.go b/handlers/configuration/http/http_check/http_check.gen.go new file mode 100644 index 00000000..6ed12ba1 --- /dev/null +++ b/handlers/configuration/http/http_check/http_check.gen.go @@ -0,0 +1,1351 @@ +// Package http_check provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_check + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpCheck defines model for http_check. +type HttpCheck = models.HTTPCheck + +// HttpChecks defines model for http_checks. +type HttpChecks = models.HTTPChecks + +// GetAllHTTPCheckBackendParams defines parameters for GetAllHTTPCheckBackend. +type GetAllHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPCheckBackendParams defines parameters for ReplaceAllHTTPCheckBackend. +type ReplaceAllHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPCheckBackendParams defines parameters for DeleteHTTPCheckBackend. +type DeleteHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPCheckBackendParams defines parameters for GetHTTPCheckBackend. +type GetHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPCheckBackendParams defines parameters for CreateHTTPCheckBackend. +type CreateHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPCheckBackendParams defines parameters for ReplaceHTTPCheckBackend. +type ReplaceHTTPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPCheckDefaultsParams defines parameters for GetAllHTTPCheckDefaults. +type GetAllHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPCheckDefaultsParams defines parameters for ReplaceAllHTTPCheckDefaults. +type ReplaceAllHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPCheckDefaultsParams defines parameters for DeleteHTTPCheckDefaults. +type DeleteHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPCheckDefaultsParams defines parameters for GetHTTPCheckDefaults. +type GetHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPCheckDefaultsParams defines parameters for CreateHTTPCheckDefaults. +type CreateHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPCheckDefaultsParams defines parameters for ReplaceHTTPCheckDefaults. +type ReplaceHTTPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllHTTPCheckBackendJSONRequestBody defines body for ReplaceAllHTTPCheckBackend for application/json ContentType. +type ReplaceAllHTTPCheckBackendJSONRequestBody = HttpChecks + +// CreateHTTPCheckBackendJSONRequestBody defines body for CreateHTTPCheckBackend for application/json ContentType. +type CreateHTTPCheckBackendJSONRequestBody = HttpCheck + +// ReplaceHTTPCheckBackendJSONRequestBody defines body for ReplaceHTTPCheckBackend for application/json ContentType. +type ReplaceHTTPCheckBackendJSONRequestBody = HttpCheck + +// ReplaceAllHTTPCheckDefaultsJSONRequestBody defines body for ReplaceAllHTTPCheckDefaults for application/json ContentType. +type ReplaceAllHTTPCheckDefaultsJSONRequestBody = HttpChecks + +// CreateHTTPCheckDefaultsJSONRequestBody defines body for CreateHTTPCheckDefaults for application/json ContentType. +type CreateHTTPCheckDefaultsJSONRequestBody = HttpCheck + +// ReplaceHTTPCheckDefaultsJSONRequestBody defines body for ReplaceHTTPCheckDefaults for application/json ContentType. +type ReplaceHTTPCheckDefaultsJSONRequestBody = HttpCheck + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all HTTP Checks + // (GET /services/haproxy/configuration/backends/{parent_name}/http_checks) + GetAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckBackendParams) + // Replace an HTTP Check list + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_checks) + ReplaceAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckBackendParams) + // Delete a HTTP Check + // (DELETE /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) + DeleteHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckBackendParams) + // Return one HTTP Check + // (GET /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) + GetHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckBackendParams) + // Add a new HTTP Check + // (POST /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) + CreateHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckBackendParams) + // Replace a HTTP Check + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) + ReplaceHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckBackendParams) + // Return an array of all HTTP Checks + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_checks) + GetAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckDefaultsParams) + // Replace an HTTP Check list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks) + ReplaceAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckDefaultsParams) + // Delete a HTTP Check + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) + DeleteHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckDefaultsParams) + // Return one HTTP Check + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) + GetHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckDefaultsParams) + // Add a new HTTP Check + // (POST /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) + CreateHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckDefaultsParams) + // Replace a HTTP Check + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) + ReplaceHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckDefaultsParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all HTTP Checks +// (GET /services/haproxy/configuration/backends/{parent_name}/http_checks) +func (_ Unimplemented) GetAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Check list +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_checks) +func (_ Unimplemented) ReplaceAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Check +// (DELETE /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) +func (_ Unimplemented) DeleteHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Check +// (GET /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) +func (_ Unimplemented) GetHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Check +// (POST /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) +func (_ Unimplemented) CreateHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Check +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}) +func (_ Unimplemented) ReplaceHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Checks +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_checks) +func (_ Unimplemented) GetAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Check list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks) +func (_ Unimplemented) ReplaceAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Check +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) +func (_ Unimplemented) DeleteHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Check +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) +func (_ Unimplemented) GetHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Check +// (POST /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) +func (_ Unimplemented) CreateHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Check +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}) +func (_ Unimplemented) ReplaceHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPCheckBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPCheckBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPCheckDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPCheckDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks", wrapper.GetAllHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks", wrapper.ReplaceAllHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}", wrapper.DeleteHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}", wrapper.GetHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}", wrapper.CreateHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}", wrapper.ReplaceHTTPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks", wrapper.GetAllHTTPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks", wrapper.ReplaceAllHTTPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}", wrapper.DeleteHTTPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}", wrapper.GetHTTPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}", wrapper.CreateHTTPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}", wrapper.ReplaceHTTPCheckDefaults) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fpdb9u4Ev0rBNune+XITYMC1/fJSbptXhZBt9iXJg3G5NhiK5EqSdkxAv/3BSnJlvwRO43reAu+BI5E", + "kWeGM+eMqHmgTGW5kiitob0HqtHkShr0/5gcmRgKBlYoeZcpjqm5YyrLlLybD6yv91ONwKfv74Upp2JK", + "WpTW/YQ8T6tp4m9GST85SzAD9+u1xiHt0VfxAkpc3jXxkyCg1krT2WwWUY6GaZG7p2iPfk6QVDMhJxqN", + "KjRDAiVkgiXmiCYIHLVHf6HkUIwK7Rfu/I3aiBJ3e+bWMDIUKZJxNTZqmGinOdIeNVYLOXIIZ9HTvHsO", + "/BP+KNDYI3PtOTiHlsiO2YGXOIQite+9Hcflwg8oUUNKSmzH7MQ/lf1DFZL/O9J7AoZIZcnQQz6oX2f1", + "bb9aYm1+xxJk3xuj1eAbMpcz952R6lQXS0tPPn7+fH3hxzdud0SWK+0dnoNNaI+OhE2KwQlTWZxArtX9", + "1CJLYpYKlLYjwYoxxuN3cTkrdagWUDwyYTEz2zapAX8W1fBBa5huQW/2Dv8n4mU3j9e5t0+4DrCQQ7Ua", + "V31J+tdXZKg0yUDCSMgR+di/dnMS5z1Suu+ERtQKmzqc9e1LsECuU5Dop+g0xtOI1tHZo26rVI4SckF7", + "9O1J9+QNjbwpfr9jg3osGJralpg1Yz0eAPuOkpv4IQeN0t5JyHAWL4XPCO2qcZ/QFloaAmnaNIbYBCwB", + "jaReCTkRspG45+WazmqVYwnkinuCtP00nYdVNc6boyFD65P6yzKOaw+cOODUbQTtlTsZUX/J/Te3jEbU", + "iZjQyGnP6gKb6Z2Dtajd81+/fL250Tc38qbodt8y/xf/8//Xr9yv03cPsxt6+9/XNFphhGgZ3NUlUUNi", + "EyRWgzTAPMNMEtRIJo66pCVWEeDcD5r744RcgHSkNkBSGOTuEVmTEhFm4c6T2ugfBerpwurGeneCP8pj", + "t1G7HjztdvfG/M1IWkPpfxWMoTHDIl3Yfmhp5GXJsMmSuWviny9EPKcVWQZ6Os8cApJ4dnURspRELrRg", + "5KKdLjTidhbRvFibiXkKDA0BMklUiiQVxrpZm2k5ETbxMeZvjsQYpUvLeWp5lrIthd2YqNWCIVlfIFlX", + "UFcpUa7sNtFnm5OaFtXXeNaDbRrcBBy17iRgiLCGqMliug0WPZJ8QlocoV67A0Ni0EaEKwLOFoZEY6qA", + "+0sO9QSEnYdqQ2HKYR2OKUyfaiIYwhKQIzQuI5rjnIy5iTz/ISdcaGQ2nbowaHl3kxu8DXcluJYv5qQz", + "hNTgPDgHSqUIsiZl/751rvj01/FxO8VmLycF/aU6Qpckw12Fc9o9PRSMtpCUcUGAMcwtcgKyDrX6bRiX", + "Xjk+lYF4dbnK0wt+mT9L1oTGOo06K/dhj/rUOGl4GQ30u+tEcLHpXpvWa58r2ZniOELZqbzXGSg+7VSJ", + "xsGCX+L5FW/8ICTH+1m5gSlaXN3KS3/dKW4DfZtvB1PPlX4uMtQq21Vdy7mfqqwNHFduyfXyKqpbm4V1", + "O0kHDQ8aHjR8Zw1vqenptjeXYxGc0+7Z6nwNjimJ0YvzWTl0j7oxP398CWUq6bfF7Btfxx49GFESd1QH", + "F7G7acMHtEEYwknM8+reYz2I+c2IpDrmadPA5pMdZdZwSZ9zV2RKnDSppArkBV84bz6BRS40QqgwQ4UZ", + "KsxwSrSTVmw7JHpzIJVqllOew37h6VA4HKoPh866/9vz/O0mopcQ5z7nK7r6nJOn7Z9m9v0qUE0dVDyo", + "eFDxoOJ7UPHu4VX813/kCTK+kPHf7PW6+oK0JwXf4dtRZeNBu6UqD5it7VL1wNCCEfqlQr/US/RLbU7V", + "NQ1TIV1DFR2q6NAxFTqmQsfUcXdMba96D9QxtVlfl1qmdtXWcBYWVDyoeOiZCj1Tv0HP1KMHJUEawnlM", + "6JoKXVM7dE1t5pGltqlAJaHKDFVmOCsKfVPhg2vomzq2vqmtH2OCjgcdDzoedDx0TgUhD51Tz/qG5GZH", + "Pa5ls9Ap7dF4/JbObmf/BAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http/http_check/http_check.go b/handlers/configuration/http/http_check/http_check.go new file mode 100644 index 00000000..fa70d828 --- /dev/null +++ b/handlers/configuration/http/http_check/http_check.go @@ -0,0 +1,263 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_check + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all HTTP Check routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy HTTP Check configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckBackendParams) { + h.getAllHTTPCheck(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckBackendParams) { + h.replaceAllHTTPCheck(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckBackendParams) { + h.deleteHTTPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckBackendParams) { + h.getHTTPCheck(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckBackendParams) { + h.createHTTPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckBackendParams) { + h.replaceHTTPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPCheckDefaultsParams) { + h.getAllHTTPCheck(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPCheckDefaultsParams) { + h.replaceAllHTTPCheck(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPCheckDefaultsParams) { + h.deleteHTTPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPCheckDefaultsParams) { + h.getHTTPCheck(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPCheckDefaultsParams) { + h.createHTTPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPCheckDefaultsParams) { + h.replaceHTTPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, checks, err := cfg.GetHTTPChecks(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, HttpChecks{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, checks) +} + +func (h *HandlerImpl) getHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, check, err := cfg.GetHTTPCheck(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, check) +} + +func (h *HandlerImpl) createHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpCheck + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPCheck(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPCheck(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpCheck + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPCheck(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllHTTPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpChecks + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceHTTPChecks(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/http/http_error_rule/http_error_rule.gen.go b/handlers/configuration/http/http_error_rule/http_error_rule.gen.go new file mode 100644 index 00000000..12184ce8 --- /dev/null +++ b/handlers/configuration/http/http_error_rule/http_error_rule.gen.go @@ -0,0 +1,1886 @@ +// Package http_error_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_error_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpErrorRule defines model for http_error_rule. +type HttpErrorRule = models.HTTPErrorRule + +// HttpErrorRules defines model for http_error_rules. +type HttpErrorRules = models.HTTPErrorRules + +// GetAllHTTPErrorRuleBackendParams defines parameters for GetAllHTTPErrorRuleBackend. +type GetAllHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPErrorRuleBackendParams defines parameters for ReplaceAllHTTPErrorRuleBackend. +type ReplaceAllHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPErrorRuleBackendParams defines parameters for DeleteHTTPErrorRuleBackend. +type DeleteHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPErrorRuleBackendParams defines parameters for GetHTTPErrorRuleBackend. +type GetHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPErrorRuleBackendParams defines parameters for CreateHTTPErrorRuleBackend. +type CreateHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPErrorRuleBackendParams defines parameters for ReplaceHTTPErrorRuleBackend. +type ReplaceHTTPErrorRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPErrorRuleDefaultsParams defines parameters for GetAllHTTPErrorRuleDefaults. +type GetAllHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPErrorRuleDefaultsParams defines parameters for ReplaceAllHTTPErrorRuleDefaults. +type ReplaceAllHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPErrorRuleDefaultsParams defines parameters for DeleteHTTPErrorRuleDefaults. +type DeleteHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPErrorRuleDefaultsParams defines parameters for GetHTTPErrorRuleDefaults. +type GetHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPErrorRuleDefaultsParams defines parameters for CreateHTTPErrorRuleDefaults. +type CreateHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPErrorRuleDefaultsParams defines parameters for ReplaceHTTPErrorRuleDefaults. +type ReplaceHTTPErrorRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPErrorRuleFrontendParams defines parameters for GetAllHTTPErrorRuleFrontend. +type GetAllHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPErrorRuleFrontendParams defines parameters for ReplaceAllHTTPErrorRuleFrontend. +type ReplaceAllHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPErrorRuleFrontendParams defines parameters for DeleteHTTPErrorRuleFrontend. +type DeleteHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPErrorRuleFrontendParams defines parameters for GetHTTPErrorRuleFrontend. +type GetHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPErrorRuleFrontendParams defines parameters for CreateHTTPErrorRuleFrontend. +type CreateHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPErrorRuleFrontendParams defines parameters for ReplaceHTTPErrorRuleFrontend. +type ReplaceHTTPErrorRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllHTTPErrorRuleBackendJSONRequestBody defines body for ReplaceAllHTTPErrorRuleBackend for application/json ContentType. +type ReplaceAllHTTPErrorRuleBackendJSONRequestBody = HttpErrorRules + +// CreateHTTPErrorRuleBackendJSONRequestBody defines body for CreateHTTPErrorRuleBackend for application/json ContentType. +type CreateHTTPErrorRuleBackendJSONRequestBody = HttpErrorRule + +// ReplaceHTTPErrorRuleBackendJSONRequestBody defines body for ReplaceHTTPErrorRuleBackend for application/json ContentType. +type ReplaceHTTPErrorRuleBackendJSONRequestBody = HttpErrorRule + +// ReplaceAllHTTPErrorRuleDefaultsJSONRequestBody defines body for ReplaceAllHTTPErrorRuleDefaults for application/json ContentType. +type ReplaceAllHTTPErrorRuleDefaultsJSONRequestBody = HttpErrorRules + +// CreateHTTPErrorRuleDefaultsJSONRequestBody defines body for CreateHTTPErrorRuleDefaults for application/json ContentType. +type CreateHTTPErrorRuleDefaultsJSONRequestBody = HttpErrorRule + +// ReplaceHTTPErrorRuleDefaultsJSONRequestBody defines body for ReplaceHTTPErrorRuleDefaults for application/json ContentType. +type ReplaceHTTPErrorRuleDefaultsJSONRequestBody = HttpErrorRule + +// ReplaceAllHTTPErrorRuleFrontendJSONRequestBody defines body for ReplaceAllHTTPErrorRuleFrontend for application/json ContentType. +type ReplaceAllHTTPErrorRuleFrontendJSONRequestBody = HttpErrorRules + +// CreateHTTPErrorRuleFrontendJSONRequestBody defines body for CreateHTTPErrorRuleFrontend for application/json ContentType. +type CreateHTTPErrorRuleFrontendJSONRequestBody = HttpErrorRule + +// ReplaceHTTPErrorRuleFrontendJSONRequestBody defines body for ReplaceHTTPErrorRuleFrontend for application/json ContentType. +type ReplaceHTTPErrorRuleFrontendJSONRequestBody = HttpErrorRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all HTTP Error Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules) + GetAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleBackendParams) + // Replace an HTTP Error Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules) + ReplaceAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleBackendParams) + // Delete a HTTP Error Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) + DeleteHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleBackendParams) + // Return one HTTP Error Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) + GetHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleBackendParams) + // Add a new HTTP Error Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) + CreateHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleBackendParams) + // Replace a HTTP Error Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) + ReplaceHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleBackendParams) + // Return an array of all HTTP Error Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules) + GetAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleDefaultsParams) + // Replace an HTTP Error Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules) + ReplaceAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleDefaultsParams) + // Delete a HTTP Error Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) + DeleteHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleDefaultsParams) + // Return one HTTP Error Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) + GetHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleDefaultsParams) + // Add a new HTTP Error Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) + CreateHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleDefaultsParams) + // Replace a HTTP Error Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) + ReplaceHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleDefaultsParams) + // Return an array of all HTTP Error Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules) + GetAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleFrontendParams) + // Replace an HTTP Error Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules) + ReplaceAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleFrontendParams) + // Delete a HTTP Error Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) + DeleteHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleFrontendParams) + // Return one HTTP Error Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) + GetHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleFrontendParams) + // Add a new HTTP Error Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) + CreateHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleFrontendParams) + // Replace a HTTP Error Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) + ReplaceHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all HTTP Error Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules) +func (_ Unimplemented) GetAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Error Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules) +func (_ Unimplemented) ReplaceAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Error Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) DeleteHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Error Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) GetHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Error Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) CreateHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Error Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) ReplaceHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Error Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules) +func (_ Unimplemented) GetAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Error Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules) +func (_ Unimplemented) ReplaceAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Error Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) DeleteHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Error Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) GetHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Error Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) CreateHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Error Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) ReplaceHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Error Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules) +func (_ Unimplemented) GetAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Error Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules) +func (_ Unimplemented) ReplaceAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Error Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) DeleteHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Error Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) GetHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Error Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) CreateHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Error Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}) +func (_ Unimplemented) ReplaceHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPErrorRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPErrorRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPErrorRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPErrorRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPErrorRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPErrorRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPErrorRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPErrorRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPErrorRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPErrorRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPErrorRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPErrorRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPErrorRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPErrorRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPErrorRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPErrorRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPErrorRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPErrorRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPErrorRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPErrorRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPErrorRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPErrorRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPErrorRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPErrorRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules", wrapper.GetAllHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules", wrapper.ReplaceAllHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}", wrapper.DeleteHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}", wrapper.GetHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}", wrapper.CreateHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}", wrapper.ReplaceHTTPErrorRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules", wrapper.GetAllHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules", wrapper.ReplaceAllHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}", wrapper.DeleteHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}", wrapper.GetHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}", wrapper.CreateHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}", wrapper.ReplaceHTTPErrorRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules", wrapper.GetAllHTTPErrorRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules", wrapper.ReplaceAllHTTPErrorRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}", wrapper.DeleteHTTPErrorRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}", wrapper.GetHTTPErrorRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}", wrapper.CreateHTTPErrorRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}", wrapper.ReplaceHTTPErrorRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FxNb9s4EP0rBNvTrhy5aVBgvSen6UcuiyBb7KVJA4YcW2xlUiWpOEbg/74gJdmWLSVO6tpOMJfCsSlq", + "Zjjz3mj00DvK9SjTCpSztHdHDdhMKwvhD5sBlwPJmZNaXY20gNRecT0aaXU1W1h9308NMDH5cCttsRXX", + "yoFy/iPLsrTcJv5utQqb8wRGzH96bWBAe/RVPDclLn618aNMAGO0odPpNKICLDcy81fRHv2SACl3AkEM", + "WJ0bDoQVJhMobI5oAkyACda/12ogh7kJN+78B8bKwu76zrVlZCBTIDfl2mjBRTfJgPaodUaqobdwGj0u", + "usdMnMPPHKzbs9AeMx/QwrJ9DuAJDFieug/Bj/0K4SdQYFhKCtv2OYj/aPdR50o8j/IeM0uUdmQQTN5q", + "XKfVz+FuiXNZYf2VyVNYuERffwfuC+e2M9Sd8svC3YPPX76chZQ499csLOnIUaZNiHzGXEJ7dChdkl8f", + "cD2KE5YZfTtxwJOYpxKU6yjm5A3EN+/iYmfqzVuyKdgpHYzsQ0e27Mw0qpxhxrDJGr7YjTvzhDRa7wyq", + "ktykud5gqQZ6Nd36ivTPTslAGzJiig2lGpLP/TO/J/ERLBCChBge0Ig66Xw20WrNCXOMnKVMQdins3wR", + "jWiVvj3qD05noFgmaY++PegevKFRcCqkQGzB3EgOtvIq5ovFEF8z/gOUsPFdxgwod6XYCKZxU1oNwa36", + "eg4uN8oSlqYrvhGXMEeYAVLdEwSRaqHGj4u7+yDoDAqTTkXAUtdP01q6lWuDc4aNwAUM+Lps0Flwg3g3", + "qD8g2itOOKLhK//XzE8aUc950oCgPWdyWESDjDkHxl//7eu3iwtzcaEu8m73LQ//wh9/v37lPx2+u5te", + "0Ms/X9NoBUCiZeNOT4geEJcAcYYpy3gApHECBsjYI51yxGnChAiLZjE5IO+Z8hh4DSS3IPwlqsIwIu08", + "pAeV0z9zMJO51wv3u5LiXti7jOrt42G3uzGiWMmrBhr4N+ccrB3k6TwA26ZTUbQZbe7M4hM/vXkJgJeP", + "RsxMZnVEmCIBfn2aNJWUTzI29HlP67xyOY1oljcWaJYyDpYwMk50CiSV1vntV6p1LF0S0i6sGMobUL5a", + "Z9UWAM3VOLq1fsu7Yg3vqIZXrC6LpLizP0ieAP/hmanGB5U9zcYuOrxocFT7JWGWSGeJHs+3a/HonnKU", + "ysEQTOMJDIgFFxGhCfO+cCAGUs1E+MpbPWbSzdJ1gXyKZR0BKZs81kVmCU+YGoL1VbG4zjOc3yjAIggi", + "pAHu0olPg1p028IQfLgqjKvFYgZDA5ZamCXntdYpMFVhdXhqO9Zi8pthul5n0x3TRL+p4zAF7gjfFR12", + "D7dqUJ1uilwhjHPIHAjCVJV+1XM2LD3MnBfJeXqyCuJzzJldSxrSpYnJjopj2SCLLcwwdsOU4Yg9VS4d", + "fyCudob07T/XAoagOmUYO9daTDplFQrmWLjXhnrm+E4qAbfT4jhTcLB6sCfhe0/Oy77UYfl6EiA1bEgG", + "Ro/WJeLiBk8h4WWDTv29m+lYlj+1E/HDoI6cj5yPnL8259eI9/ChZ599IaPD7tHqfstAU2BloPCjYv0G", + "iWU2+twFdRVgvAr29z7V3Tt20Qoewxw+idfjjU/gkDRw2LPJpnlfZz0vDGTKSVIDMtw/PNK2AWf6Qvjm", + "VMF4BWbK3J5jiY/tIxDmvQGGnSl2ptiZ4jTqCTzy0DDqzTZpbKUFC9j2u6dQOISqhlBH3b82vH9dBrUL", + "Hu8L0cy8vzrhevhF0W95oij3R8JHwkfCR8LfOOF3d0n4W3rvhIw/Z/wX9tBevtTaNNmv8TqrdHZHErAy", + "KHYtDVi1GAUkKAJDEdieiMDaK7hFBYZVjH049uEoA0MZGMrAnrEMbM2+eZsysHYqbtCBrUvDOH1D1kfW", + "RyEYCsFesBDs3jEM0gaOfFAKhlKwX5SCtWNMgxYMYQa7U+xOcSaFYjB8NYxisGcqBnvw1RBSPlI+Uj5S", + "PsrBkPNRDrYXcrCBCZm6q/8S7GN5+7X0YNViVJKgHgz1YHuiB2uv4BY9GFYxNuLYiKMeDPVgqAd7xnqw", + "dRvnbQrC2rm4QRC2Lg/j/A1pH2kfBWEoCHvBgrB75zBIGzjzQUEYCsJ+URDWjjENgjCEGexOsTvFoRQK", + "wvDlMArCnqkg7MF3Q0j5SPlI+Uj5KAhDzkdB2BYEYf42YG4qYs1NSns0vnlLp5fT/wMAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http/http_error_rule/http_error_rule.go b/handlers/configuration/http/http_error_rule/http_error_rule.go new file mode 100644 index 00000000..eb89a404 --- /dev/null +++ b/handlers/configuration/http/http_error_rule/http_error_rule.go @@ -0,0 +1,289 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_error_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all HTTP Error Rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy HTTP Error Rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleBackendParams) { + h.getAllHTTPErrorRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleBackendParams) { + h.replaceAllHTTPErrorRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleBackendParams) { + h.deleteHTTPErrorRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleBackendParams) { + h.getHTTPErrorRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleBackendParams) { + h.createHTTPErrorRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPErrorRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleBackendParams) { + h.replaceHTTPErrorRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleDefaultsParams) { + h.getAllHTTPErrorRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleDefaultsParams) { + h.replaceAllHTTPErrorRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleDefaultsParams) { + h.deleteHTTPErrorRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleDefaultsParams) { + h.getHTTPErrorRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleDefaultsParams) { + h.createHTTPErrorRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPErrorRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleDefaultsParams) { + h.replaceHTTPErrorRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPErrorRuleFrontendParams) { + h.getAllHTTPErrorRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPErrorRuleFrontendParams) { + h.replaceAllHTTPErrorRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPErrorRuleFrontendParams) { + h.deleteHTTPErrorRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPErrorRuleFrontendParams) { + h.getHTTPErrorRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPErrorRuleFrontendParams) { + h.createHTTPErrorRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPErrorRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPErrorRuleFrontendParams) { + h.replaceHTTPErrorRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetHTTPErrorRules(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, HttpErrorRules{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) getHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetHTTPErrorRule(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpErrorRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPErrorRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPErrorRule(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpErrorRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPErrorRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllHTTPErrorRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpErrorRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceHTTPErrorRules(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/http/http_request_rule/http_request_rule.gen.go b/handlers/configuration/http/http_request_rule/http_request_rule.gen.go new file mode 100644 index 00000000..16264e45 --- /dev/null +++ b/handlers/configuration/http/http_request_rule/http_request_rule.gen.go @@ -0,0 +1,1887 @@ +// Package http_request_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_request_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpRequestRule defines model for http_request_rule. +type HttpRequestRule = models.HTTPRequestRule + +// HttpRequestRules defines model for http_request_rules. +type HttpRequestRules = models.HTTPRequestRules + +// GetAllHTTPRequestRuleBackendParams defines parameters for GetAllHTTPRequestRuleBackend. +type GetAllHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPRequestRuleBackendParams defines parameters for ReplaceAllHTTPRequestRuleBackend. +type ReplaceAllHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPRequestRuleBackendParams defines parameters for DeleteHTTPRequestRuleBackend. +type DeleteHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPRequestRuleBackendParams defines parameters for GetHTTPRequestRuleBackend. +type GetHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPRequestRuleBackendParams defines parameters for CreateHTTPRequestRuleBackend. +type CreateHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPRequestRuleBackendParams defines parameters for ReplaceHTTPRequestRuleBackend. +type ReplaceHTTPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPRequestRuleDefaultsParams defines parameters for GetAllHTTPRequestRuleDefaults. +type GetAllHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPRequestRuleDefaultsParams defines parameters for ReplaceAllHTTPRequestRuleDefaults. +type ReplaceAllHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPRequestRuleDefaultsParams defines parameters for DeleteHTTPRequestRuleDefaults. +type DeleteHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPRequestRuleDefaultsParams defines parameters for GetHTTPRequestRuleDefaults. +type GetHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPRequestRuleDefaultsParams defines parameters for CreateHTTPRequestRuleDefaults. +type CreateHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPRequestRuleDefaultsParams defines parameters for ReplaceHTTPRequestRuleDefaults. +type ReplaceHTTPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPRequestRuleFrontendParams defines parameters for GetAllHTTPRequestRuleFrontend. +type GetAllHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPRequestRuleFrontendParams defines parameters for ReplaceAllHTTPRequestRuleFrontend. +type ReplaceAllHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPRequestRuleFrontendParams defines parameters for DeleteHTTPRequestRuleFrontend. +type DeleteHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPRequestRuleFrontendParams defines parameters for GetHTTPRequestRuleFrontend. +type GetHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPRequestRuleFrontendParams defines parameters for CreateHTTPRequestRuleFrontend. +type CreateHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPRequestRuleFrontendParams defines parameters for ReplaceHTTPRequestRuleFrontend. +type ReplaceHTTPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllHTTPRequestRuleBackendJSONRequestBody defines body for ReplaceAllHTTPRequestRuleBackend for application/json ContentType. +type ReplaceAllHTTPRequestRuleBackendJSONRequestBody = HttpRequestRules + +// CreateHTTPRequestRuleBackendJSONRequestBody defines body for CreateHTTPRequestRuleBackend for application/json ContentType. +type CreateHTTPRequestRuleBackendJSONRequestBody = HttpRequestRule + +// ReplaceHTTPRequestRuleBackendJSONRequestBody defines body for ReplaceHTTPRequestRuleBackend for application/json ContentType. +type ReplaceHTTPRequestRuleBackendJSONRequestBody = HttpRequestRule + +// ReplaceAllHTTPRequestRuleDefaultsJSONRequestBody defines body for ReplaceAllHTTPRequestRuleDefaults for application/json ContentType. +type ReplaceAllHTTPRequestRuleDefaultsJSONRequestBody = HttpRequestRules + +// CreateHTTPRequestRuleDefaultsJSONRequestBody defines body for CreateHTTPRequestRuleDefaults for application/json ContentType. +type CreateHTTPRequestRuleDefaultsJSONRequestBody = HttpRequestRule + +// ReplaceHTTPRequestRuleDefaultsJSONRequestBody defines body for ReplaceHTTPRequestRuleDefaults for application/json ContentType. +type ReplaceHTTPRequestRuleDefaultsJSONRequestBody = HttpRequestRule + +// ReplaceAllHTTPRequestRuleFrontendJSONRequestBody defines body for ReplaceAllHTTPRequestRuleFrontend for application/json ContentType. +type ReplaceAllHTTPRequestRuleFrontendJSONRequestBody = HttpRequestRules + +// CreateHTTPRequestRuleFrontendJSONRequestBody defines body for CreateHTTPRequestRuleFrontend for application/json ContentType. +type CreateHTTPRequestRuleFrontendJSONRequestBody = HttpRequestRule + +// ReplaceHTTPRequestRuleFrontendJSONRequestBody defines body for ReplaceHTTPRequestRuleFrontend for application/json ContentType. +type ReplaceHTTPRequestRuleFrontendJSONRequestBody = HttpRequestRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all HTTP Request Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules) + GetAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleBackendParams) + // Replace an HTTP Request Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules) + ReplaceAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleBackendParams) + // Delete a HTTP Request Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) + DeleteHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleBackendParams) + // Return one HTTP Request Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) + GetHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleBackendParams) + // Add a new HTTP Request Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) + CreateHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleBackendParams) + // Replace a HTTP Request Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) + ReplaceHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleBackendParams) + // Return an array of all HTTP Request Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules) + GetAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleDefaultsParams) + // Replace an HTTP Request Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules) + ReplaceAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleDefaultsParams) + // Delete a HTTP Request Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) + DeleteHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleDefaultsParams) + // Return one HTTP Request Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) + GetHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleDefaultsParams) + // Add a new HTTP Request Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) + CreateHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleDefaultsParams) + // Replace a HTTP Request Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) + ReplaceHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleDefaultsParams) + // Return an array of all HTTP Request Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules) + GetAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleFrontendParams) + // Replace an HTTP Request Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules) + ReplaceAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleFrontendParams) + // Delete a HTTP Request Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) + DeleteHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleFrontendParams) + // Return one HTTP Request Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) + GetHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleFrontendParams) + // Add a new HTTP Request Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) + CreateHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleFrontendParams) + // Replace a HTTP Request Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) + ReplaceHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all HTTP Request Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules) +func (_ Unimplemented) GetAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Request Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules) +func (_ Unimplemented) ReplaceAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Request Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) DeleteHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Request Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) GetHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Request Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) CreateHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Request Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) ReplaceHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Request Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules) +func (_ Unimplemented) GetAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Request Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules) +func (_ Unimplemented) ReplaceAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Request Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) DeleteHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Request Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) GetHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Request Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) CreateHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Request Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) ReplaceHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Request Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules) +func (_ Unimplemented) GetAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Request Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules) +func (_ Unimplemented) ReplaceAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Request Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) DeleteHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Request Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) GetHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Request Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) CreateHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Request Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}) +func (_ Unimplemented) ReplaceHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPRequestRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPRequestRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPRequestRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPRequestRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPRequestRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPRequestRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules", wrapper.GetAllHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules", wrapper.ReplaceAllHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}", wrapper.DeleteHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}", wrapper.GetHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}", wrapper.CreateHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}", wrapper.ReplaceHTTPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules", wrapper.GetAllHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules", wrapper.ReplaceAllHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}", wrapper.DeleteHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}", wrapper.GetHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}", wrapper.CreateHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}", wrapper.ReplaceHTTPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules", wrapper.GetAllHTTPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules", wrapper.ReplaceAllHTTPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}", wrapper.DeleteHTTPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}", wrapper.GetHTTPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}", wrapper.CreateHTTPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}", wrapper.ReplaceHTTPRequestRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FxNb9s4EP0rBNvTrhy5aVBgvSen6UcuiyBb7KVJDYYcW2xlUiWpOEbg/74gJfkjkmIn68TedC6FY1Pk", + "zGhm3tPoobeU63GmFShnae+WGrCZVhbCHzYDLoeSMye1Goy1gNQOuB6PtRrMF1bf91MDTEw/3EhbbMW1", + "cqCc/8iyLC23ib9brcLmPIEx859eGxjSHn0VL0yJi19t/CATwBht6Gw2i6gAy43M/FW0R78kQMqdQBAD", + "VueGA2GFyQQKmyOaABNggvXvtRrKUW7CwZ1/wFhZ2L2688oyMpQpkOtybbTkoptmQHvUOiPVyFs4ix4W", + "3WMmzuFnDtbtWWiPmQ9oYdk+B/AEhixP3Yfgx36F8BMoMCwlhW37HMS/tPuocyX+H+U9YZYo7cgwmPys", + "cZ1VP4fTEueyQVkkA5OnsHSRvvoO3JfOTWekO+WXhcMHn798OSur/txftbSoI8eZNiH6GXMJ7dGRdEl+", + "dcD1OE5YZvTN1AFPYp5KUK6jmJPXEF+/i4u9qTexZlewVjoY23U3ru7SLKpcYsaw6UYe2a279IiE2uxe", + "VMW5TXO9wVINdT3x+or0z07JUBsyZoqNpBqRz/0zvyfxMSRlEEmI4gGNqJPO5xWtVp0wx8hZyhSEnTr1", + "y2hEq2TuUX/7dAaKZZL26NuD7sEbGgXHQirEFsy15GArz2K+XBrxFeM/QAkb32bMgHIDxcYwi5sTbASu", + "7vE5uNwoS1iaNnhIXMIcYQZIdS4IItVS1R8XFvhQ6AwKs05F6K6un6Z3Eq9cHVw0bAwu9IWvd406C84Q", + "7wz1t4r2insd0fCV/2vuLY2o91QaELTnTA7LHSJjzoHx13/7+u3iwlxcqIu8233Lw7/w25+vX/lPh+9u", + "Zxf08vfXNKo1leiucacnRA+JS4A4w5RlPDSpSQIGyMR3P+WI04QJERbNo3JA3jPl++IVkNyC8Jeoqq8R", + "aRdBPaic/pmDmS68XjpvIMW9rfAyWqWUh93u1sCjIbsawOHvnHOwdpinixA8N8iKgny0OTSPUPx4ShOa", + "Xz4eMzOdVxNhioRm7BOlubB8orGRz316F20uZxHN8sZSzVLGwRJGJolOgaTSOn9EQ91OpEtC+oU1I3kN", + "ytftvOpCi3Mr+N1ayeW5WM07q+aa1WWxFCf7W8kT4D88Wq3gQ2VPs7HLDi8bHK38kjBLpLNETxbbtXh0", + "T1lK5WAEpvEODIkFFxGhCfO+cCAGUs1E+MpbPWHSzRN2CYiKZR0BKZs+1EVmCU+YGoH1dbG8zqOd3yg0", + "SBBESAPcpVOfBivRbQtD8GFQGLcSi3k7GrLUwjw5r7ROgamqa4fyOtZi+uQNe7XSZjuHjH4zBzFF/xGe", + "Kx12D5/ZqFX4KXKGMM4hcyAIU1UaVk/jcOeR57xI0tOTekNf9J75taQhbZqQ7ai4OVtEtaVJx26QM9xk", + "D521FAggdh9i+scDrgWMQHXKUHautJh2yooUzLFw3tb4dHwrlYCbWXFTU3BQv70n4XsP13WPVtv01TS0", + "2LAlGRo93hSaiyMeB8t1o079+c0QLcuf2sF5faNHHoA8AHnAxjxgBYoP1z0X7QswHXaP6vvVW03RMwOk", + "HxVXbBFm5uPSXQBZ0ZKbmv6aZ757xzNawcNQxCfzZhjyCRwCCI6Ftk+n93Uq9MIaTjlzauwQ68ZM2jb0", + "nL4QnrQqmDS0nDLHF33FR/gB3ea9AYaMFRkrMlacXD0aU9YNrt48L6g1ELPQ5Z5+YoUDq2pgddT9Y8v7", + "rwqrdoHsfSHacPi/T8PWv2R6oueN8gSkAEgBkAIgBXgiCtDdNQV4trdWyAEWHOCFPdiXr8SeAv43eBlW", + "OrxDcVkZHLuhuqxajoIUlJehvGzP5GXttdyqL8N6Ro6OHB0FZigwQ4HZCxGYbcypn1dg1g7OjQqzTYEZ", + "p3XIBJAJoMQMJWa/hMTs3nENQggOh1BkhiKzLYrM2vtNo8oMWw6yVmStOL9CmRm+YkaZ2QuRma19rYQk", + "AEkAkgAkASg0QxaAQrO9FJoNTcjXXf43Zh9LEzZUmlXLUZmCSjNUmu2Z0qy9lluVZljPSNKRpKPSDJVm", + "qDR7IUqzzUn180rN2tG5UWq2KTLjvA6pAFIBlJqh1OyXkJrdO69BCMHpEErNUGq2RalZe79plJphy0HW", + "iqwVB1goNcOXzCg1eyFSs7XvlZAEIAlAEoAkAKVmyAJQarYDqZk/Csx1BbO5SWmPxtdv6exy9m8AAAD/", + "/w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http/http_request_rule/http_request_rule.go b/handlers/configuration/http/http_request_rule/http_request_rule.go new file mode 100644 index 00000000..be40e7e3 --- /dev/null +++ b/handlers/configuration/http/http_request_rule/http_request_rule.go @@ -0,0 +1,289 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_request_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all HTTP Request Rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy HTTP Request Rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleBackendParams) { + h.getAllHTTPRequestRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleBackendParams) { + h.replaceAllHTTPRequestRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleBackendParams) { + h.deleteHTTPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleBackendParams) { + h.getHTTPRequestRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleBackendParams) { + h.createHTTPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleBackendParams) { + h.replaceHTTPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleDefaultsParams) { + h.getAllHTTPRequestRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleDefaultsParams) { + h.replaceAllHTTPRequestRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleDefaultsParams) { + h.deleteHTTPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleDefaultsParams) { + h.getHTTPRequestRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleDefaultsParams) { + h.createHTTPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleDefaultsParams) { + h.replaceHTTPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPRequestRuleFrontendParams) { + h.getAllHTTPRequestRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPRequestRuleFrontendParams) { + h.replaceAllHTTPRequestRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPRequestRuleFrontendParams) { + h.deleteHTTPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPRequestRuleFrontendParams) { + h.getHTTPRequestRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPRequestRuleFrontendParams) { + h.createHTTPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPRequestRuleFrontendParams) { + h.replaceHTTPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetHTTPRequestRules(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, HttpRequestRules{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) getHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetHTTPRequestRule(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpRequestRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPRequestRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPRequestRule(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpRequestRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPRequestRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllHTTPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpRequestRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceHTTPRequestRules(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/http/http_response_rule/http_response_rule.gen.go b/handlers/configuration/http/http_response_rule/http_response_rule.gen.go new file mode 100644 index 00000000..f9681cd4 --- /dev/null +++ b/handlers/configuration/http/http_response_rule/http_response_rule.gen.go @@ -0,0 +1,1887 @@ +// Package http_response_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_response_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpResponseRule defines model for http_response_rule. +type HttpResponseRule = models.HTTPResponseRule + +// HttpResponseRules defines model for http_response_rules. +type HttpResponseRules = models.HTTPResponseRules + +// GetAllHTTPResponseRuleBackendParams defines parameters for GetAllHTTPResponseRuleBackend. +type GetAllHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPResponseRuleBackendParams defines parameters for ReplaceAllHTTPResponseRuleBackend. +type ReplaceAllHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPResponseRuleBackendParams defines parameters for DeleteHTTPResponseRuleBackend. +type DeleteHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPResponseRuleBackendParams defines parameters for GetHTTPResponseRuleBackend. +type GetHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPResponseRuleBackendParams defines parameters for CreateHTTPResponseRuleBackend. +type CreateHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPResponseRuleBackendParams defines parameters for ReplaceHTTPResponseRuleBackend. +type ReplaceHTTPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPResponseRuleDefaultsParams defines parameters for GetAllHTTPResponseRuleDefaults. +type GetAllHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPResponseRuleDefaultsParams defines parameters for ReplaceAllHTTPResponseRuleDefaults. +type ReplaceAllHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPResponseRuleDefaultsParams defines parameters for DeleteHTTPResponseRuleDefaults. +type DeleteHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPResponseRuleDefaultsParams defines parameters for GetHTTPResponseRuleDefaults. +type GetHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPResponseRuleDefaultsParams defines parameters for CreateHTTPResponseRuleDefaults. +type CreateHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPResponseRuleDefaultsParams defines parameters for ReplaceHTTPResponseRuleDefaults. +type ReplaceHTTPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllHTTPResponseRuleFrontendParams defines parameters for GetAllHTTPResponseRuleFrontend. +type GetAllHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllHTTPResponseRuleFrontendParams defines parameters for ReplaceAllHTTPResponseRuleFrontend. +type ReplaceAllHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPResponseRuleFrontendParams defines parameters for DeleteHTTPResponseRuleFrontend. +type DeleteHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPResponseRuleFrontendParams defines parameters for GetHTTPResponseRuleFrontend. +type GetHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPResponseRuleFrontendParams defines parameters for CreateHTTPResponseRuleFrontend. +type CreateHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceHTTPResponseRuleFrontendParams defines parameters for ReplaceHTTPResponseRuleFrontend. +type ReplaceHTTPResponseRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllHTTPResponseRuleBackendJSONRequestBody defines body for ReplaceAllHTTPResponseRuleBackend for application/json ContentType. +type ReplaceAllHTTPResponseRuleBackendJSONRequestBody = HttpResponseRules + +// CreateHTTPResponseRuleBackendJSONRequestBody defines body for CreateHTTPResponseRuleBackend for application/json ContentType. +type CreateHTTPResponseRuleBackendJSONRequestBody = HttpResponseRule + +// ReplaceHTTPResponseRuleBackendJSONRequestBody defines body for ReplaceHTTPResponseRuleBackend for application/json ContentType. +type ReplaceHTTPResponseRuleBackendJSONRequestBody = HttpResponseRule + +// ReplaceAllHTTPResponseRuleDefaultsJSONRequestBody defines body for ReplaceAllHTTPResponseRuleDefaults for application/json ContentType. +type ReplaceAllHTTPResponseRuleDefaultsJSONRequestBody = HttpResponseRules + +// CreateHTTPResponseRuleDefaultsJSONRequestBody defines body for CreateHTTPResponseRuleDefaults for application/json ContentType. +type CreateHTTPResponseRuleDefaultsJSONRequestBody = HttpResponseRule + +// ReplaceHTTPResponseRuleDefaultsJSONRequestBody defines body for ReplaceHTTPResponseRuleDefaults for application/json ContentType. +type ReplaceHTTPResponseRuleDefaultsJSONRequestBody = HttpResponseRule + +// ReplaceAllHTTPResponseRuleFrontendJSONRequestBody defines body for ReplaceAllHTTPResponseRuleFrontend for application/json ContentType. +type ReplaceAllHTTPResponseRuleFrontendJSONRequestBody = HttpResponseRules + +// CreateHTTPResponseRuleFrontendJSONRequestBody defines body for CreateHTTPResponseRuleFrontend for application/json ContentType. +type CreateHTTPResponseRuleFrontendJSONRequestBody = HttpResponseRule + +// ReplaceHTTPResponseRuleFrontendJSONRequestBody defines body for ReplaceHTTPResponseRuleFrontend for application/json ContentType. +type ReplaceHTTPResponseRuleFrontendJSONRequestBody = HttpResponseRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all HTTP Response Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules) + GetAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleBackendParams) + // Replace an HTTP Response Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules) + ReplaceAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleBackendParams) + // Delete a HTTP Response Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) + DeleteHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleBackendParams) + // Return one HTTP Response Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) + GetHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleBackendParams) + // Add a new HTTP Response Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) + CreateHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleBackendParams) + // Replace a HTTP Response Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) + ReplaceHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleBackendParams) + // Return an array of all HTTP Response Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules) + GetAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleDefaultsParams) + // Replace an HTTP Response Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules) + ReplaceAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleDefaultsParams) + // Delete a HTTP Response Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) + DeleteHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleDefaultsParams) + // Return one HTTP Response Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) + GetHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleDefaultsParams) + // Add a new HTTP Response Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) + CreateHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleDefaultsParams) + // Replace a HTTP Response Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) + ReplaceHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleDefaultsParams) + // Return an array of all HTTP Response Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules) + GetAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleFrontendParams) + // Replace an HTTP Response Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules) + ReplaceAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleFrontendParams) + // Delete a HTTP Response Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) + DeleteHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleFrontendParams) + // Return one HTTP Response Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) + GetHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleFrontendParams) + // Add a new HTTP Response Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) + CreateHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleFrontendParams) + // Replace a HTTP Response Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) + ReplaceHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all HTTP Response Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules) +func (_ Unimplemented) GetAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Response Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules) +func (_ Unimplemented) ReplaceAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Response Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Response Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) GetHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Response Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) CreateHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Response Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Response Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules) +func (_ Unimplemented) GetAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Response Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules) +func (_ Unimplemented) ReplaceAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Response Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Response Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) GetHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Response Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) CreateHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Response Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all HTTP Response Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules) +func (_ Unimplemented) GetAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an HTTP Response Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules) +func (_ Unimplemented) ReplaceAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP Response Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) DeleteHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HTTP Response Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) GetHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new HTTP Response Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) CreateHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP Response Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}) +func (_ Unimplemented) ReplaceHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllHTTPResponseRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllHTTPResponseRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPResponseRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPResponseRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPResponseRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules", wrapper.GetAllHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules", wrapper.ReplaceAllHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}", wrapper.DeleteHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}", wrapper.GetHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}", wrapper.CreateHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}", wrapper.ReplaceHTTPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules", wrapper.GetAllHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules", wrapper.ReplaceAllHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}", wrapper.DeleteHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}", wrapper.GetHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}", wrapper.CreateHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}", wrapper.ReplaceHTTPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules", wrapper.GetAllHTTPResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules", wrapper.ReplaceAllHTTPResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}", wrapper.DeleteHTTPResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}", wrapper.GetHTTPResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}", wrapper.CreateHTTPResponseRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}", wrapper.ReplaceHTTPResponseRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fxdb9u4Ev0rBNune+XITYMC1/fJafqRl0WQLfalSQOGHFtsJVIlKTtG4P++ICX5I5Zip+vY3nReCsem", + "qJnhzJyj0UHvKddZrhUoZ2nvnhqwuVYWwh82By4HkjMntbrJtIDU3nCdZVrdzBbW3/dTA0xMPtxJW27F", + "tXKgnP/I8jyttom/W63C5jyBjPlPrw0MaI++iuemxOWvNn6SCWCMNnQ6nUZUgOVG5v4q2qNfEiDVTiCI", + "AasLw4Gw0mQCpc0RTYAJMMH691oN5LAw4cadv8BYWdq9vPPSMjKQKZBRtTZacNFNcqA9ap2RaugtnEZP", + "i+4pE5fwswDrDiy0p8wHtLTskAN4BgNWpO5D8OOwQvgJFBiWktK2Qw7iH9p91IUS/47yHjNLlHZkEEze", + "aVyn9c/hbolz+cydG1OksHCVvv0O3NfOXWeoO9WXpcdHn798ubisrrv0ly2s6sgs1ybEP2cuoT06lC4p", + "bo+4zuKE5UbfTRzwJOapBOU6ijk5gnj0Li43p97IVcuCwdJBZtedXYNX06j2ihnDJps5Zbfu1S9k1Wbn", + "UVfoNs31Bks10KvZ11ekf3FOBtqQjCk2lGpIPvcv/J7EB5HUUSQhjEc0ok46n1y0XnbGHCMXKVMQtuo0", + "XEcjWud0j/oT1Dkolkvao2+PukdvaBRcC+kQWzAjycHWvsV8sULiW8Z/gBI2vs+ZAeVuFMtgGrdk2RDc", + "qtOX4AqjLGFp2uQkcQlzhBkg9Z1BEKkWyv+0tMFHQ+dQGnYuQpt1/TR9mH3V8uClYRm40CG+PjTrIvhD", + "vD/UnxftlQce0fCV/2vmMI2oR0RpQNCeMwUs9oqcOQfGX//t67erK3N1pa6KbvctD//Cf/7/+pX/dPzu", + "fnpFr//7mkYr7SV6aNz5GdED4hIgzjBlGQ/tapyAATL2fVA54jRhQoRFs7AckfdM+Q55C6SwIPwlqu5w", + "RNp5VI9qp38WYCZzrxfudyPFo03xOloml8fd7tZgpCnBGnDiz4JzsHZQpPMY7BpvRclD2jyahSj+dXYT", + "WmCRZcxMZgVFmCKhJ/tMaaktn2ps6LOfrgDP9TSiedFYr3nKOFjCyDjRKZBUWudv0lS8Y+mSkIJh0VCO", + "QPninVVe6HVuCc1by7m6MZb0/kp6xeqqYMo7+7PkCfAfHreWcKK2p9nYRYcXDY6WfkmYJdJZosfz7Vo8", + "eqQ0pXIwBNN4AgNiwUVEaMK8LxyIgVQzEb7yVo+ZdLOMXYCjcllHQMomT3WRWcITpoZgfWEsrvOY5zcK", + "XRIEEdIAd+nEp8FSdNvCEHy4KY1bisWsJQ1YamGWnLdap8BU3brDI96pFpPn79rLpTbdP3D0W8iIKXuQ", + "8LTpuHu8a7OWYajMG8I4h9yBIEzVqVg/oMODp6DLMlHPz1bb+rz/zK4lDanThHAn5flsEd0Whh/7QdBw", + "yh5CV5MgQNmjyOkfF7gWMATVqYLZudVi0qnqUjDHwh23x67je6kE3E3Lc03BweoJn4XvPW43OLXcrm8n", + "odWGPcnA6GxTjC7v8Yv43GDWubegGaxl9VM7TK9v+cgIkBEgI9iYESxh8vG6p6RDgafj7snqfg29puyb", + "AdpPyku2iDazQeo+8Kzsyo2Nf90j4KMjG63giVjiE3ozJPkEDmEEZ0XPwq0PdVT0wtpONYhq7hJrZ0/a", + "NnSevhCewCoYNzWeKs/n3cUH+Qk9570BhuwV2SuyV5xn/RNkWTfOerNjbGviaKHV7WCOhWOseox10v3f", + "lvdfVmDtA+L7QrTC8RZmZOtfQT3X40d1C+QCyAWQCyAXeD4u0N0/F9jdSy0kA3My8MIe9as3Zs/DAzZ4", + "V1a5vFclWhUgu6kUrV6PwhXUoqEW7QC1aO0F3S5Gw6JGxo6MHdVoqEZDNdqLUqNtzrB3rEZrR+lmOdqm", + "CI1TPOQEyAlQj4Z6tN9Hj/boCAeBBCdGqEhDRdrWFWntXadZkoaNBxksMlicaqEmDV9DoybthWnS1r50", + "QjaAbADZALIBVKUhHUBV2kGr0gYmpOx+/4O0j5URm8rS6vWoYEFZGsrSDlCW1l7Q7bI0LGqk7EjZUZaG", + "sjSUpb0oWdoTKPaOdWntMN2sS9sUonGOh6QASQHq0lCX9vvo0h6d4SCQ4MgIdWmoS9u6Lq296zTr0rDx", + "IINFBotjLdSl4Yto1KW9MF3a2rdOyAaQDSAbQDaAujSkA6hL26Muzd8MzKhG28KktEfj0Vs6vZ7+HQAA", + "//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http/http_response_rule/http_response_rule.go b/handlers/configuration/http/http_response_rule/http_response_rule.go new file mode 100644 index 00000000..d396cb6c --- /dev/null +++ b/handlers/configuration/http/http_response_rule/http_response_rule.go @@ -0,0 +1,289 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_response_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all HTTP Response Rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy HTTP Response Rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleBackendParams) { + h.getAllHTTPResponseRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleBackendParams) { + h.replaceAllHTTPResponseRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleBackendParams) { + h.deleteHTTPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleBackendParams) { + h.getHTTPResponseRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleBackendParams) { + h.createHTTPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleBackendParams) { + h.replaceHTTPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleDefaultsParams) { + h.getAllHTTPResponseRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleDefaultsParams) { + h.replaceAllHTTPResponseRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleDefaultsParams) { + h.deleteHTTPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleDefaultsParams) { + h.getHTTPResponseRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleDefaultsParams) { + h.createHTTPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleDefaultsParams) { + h.replaceHTTPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllHTTPResponseRuleFrontendParams) { + h.getAllHTTPResponseRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllHTTPResponseRuleFrontendParams) { + h.replaceAllHTTPResponseRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteHTTPResponseRuleFrontendParams) { + h.deleteHTTPResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetHTTPResponseRuleFrontendParams) { + h.getHTTPResponseRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateHTTPResponseRuleFrontendParams) { + h.createHTTPResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceHTTPResponseRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceHTTPResponseRuleFrontendParams) { + h.replaceHTTPResponseRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetHTTPResponseRules(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, HttpResponseRules{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) getHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetHTTPResponseRule(int64(index), parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPResponseRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPResponseRule(int64(index), parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPResponseRule(int64(index), parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceAllHTTPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpResponseRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceHTTPResponseRules(parentType, parentName, data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} diff --git a/handlers/configuration/http_errors_section/http_errors_section.gen.go b/handlers/configuration/http_errors_section/http_errors_section.gen.go new file mode 100644 index 00000000..56bc8155 --- /dev/null +++ b/handlers/configuration/http_errors_section/http_errors_section.gen.go @@ -0,0 +1,663 @@ +// Package http_errors_section provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package http_errors_section + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// HttpErrorsSection defines model for http_errors_section. +type HttpErrorsSection = models.HTTPErrorsSection + +// HttpErrorsSections defines model for http_errors_sections. +type HttpErrorsSections = models.HTTPErrorsSections + +// GetHTTPErrorsSectionsParams defines parameters for GetHTTPErrorsSections. +type GetHTTPErrorsSectionsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateHTTPErrorsSectionParams defines parameters for CreateHTTPErrorsSection. +type CreateHTTPErrorsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteHTTPErrorsSectionParams defines parameters for DeleteHTTPErrorsSection. +type DeleteHTTPErrorsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetHTTPErrorsSectionParams defines parameters for GetHTTPErrorsSection. +type GetHTTPErrorsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceHTTPErrorsSectionParams defines parameters for ReplaceHTTPErrorsSection. +type ReplaceHTTPErrorsSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateHTTPErrorsSectionJSONRequestBody defines body for CreateHTTPErrorsSection for application/json ContentType. +type CreateHTTPErrorsSectionJSONRequestBody = HttpErrorsSection + +// ReplaceHTTPErrorsSectionJSONRequestBody defines body for ReplaceHTTPErrorsSection for application/json ContentType. +type ReplaceHTTPErrorsSectionJSONRequestBody = HttpErrorsSection + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of HTTP errors sections + // (GET /services/haproxy/configuration/http_errors_sections) + GetHTTPErrorsSections(w http.ResponseWriter, r *http.Request, params GetHTTPErrorsSectionsParams) + // Add a HTTP errors section + // (POST /services/haproxy/configuration/http_errors_sections) + CreateHTTPErrorsSection(w http.ResponseWriter, r *http.Request, params CreateHTTPErrorsSectionParams) + // Delete a HTTP errors section + // (DELETE /services/haproxy/configuration/http_errors_sections/{name}) + DeleteHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteHTTPErrorsSectionParams) + // Return a HTTP errors section + // (GET /services/haproxy/configuration/http_errors_sections/{name}) + GetHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params GetHTTPErrorsSectionParams) + // Replace a HTTP errors section + // (PUT /services/haproxy/configuration/http_errors_sections/{name}) + ReplaceHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceHTTPErrorsSectionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of HTTP errors sections +// (GET /services/haproxy/configuration/http_errors_sections) +func (_ Unimplemented) GetHTTPErrorsSections(w http.ResponseWriter, r *http.Request, params GetHTTPErrorsSectionsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a HTTP errors section +// (POST /services/haproxy/configuration/http_errors_sections) +func (_ Unimplemented) CreateHTTPErrorsSection(w http.ResponseWriter, r *http.Request, params CreateHTTPErrorsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a HTTP errors section +// (DELETE /services/haproxy/configuration/http_errors_sections/{name}) +func (_ Unimplemented) DeleteHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteHTTPErrorsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a HTTP errors section +// (GET /services/haproxy/configuration/http_errors_sections/{name}) +func (_ Unimplemented) GetHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params GetHTTPErrorsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a HTTP errors section +// (PUT /services/haproxy/configuration/http_errors_sections/{name}) +func (_ Unimplemented) ReplaceHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceHTTPErrorsSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetHTTPErrorsSections operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPErrorsSections(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPErrorsSectionsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPErrorsSections(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateHTTPErrorsSection operation middleware +func (siw *ServerInterfaceWrapper) CreateHTTPErrorsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateHTTPErrorsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateHTTPErrorsSection(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteHTTPErrorsSection operation middleware +func (siw *ServerInterfaceWrapper) DeleteHTTPErrorsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteHTTPErrorsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteHTTPErrorsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHTTPErrorsSection operation middleware +func (siw *ServerInterfaceWrapper) GetHTTPErrorsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetHTTPErrorsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHTTPErrorsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceHTTPErrorsSection operation middleware +func (siw *ServerInterfaceWrapper) ReplaceHTTPErrorsSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceHTTPErrorsSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceHTTPErrorsSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/http_errors_sections", wrapper.GetHTTPErrorsSections) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/http_errors_sections", wrapper.CreateHTTPErrorsSection) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/http_errors_sections/{name}", wrapper.DeleteHTTPErrorsSection) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/http_errors_sections/{name}", wrapper.GetHTTPErrorsSection) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/http_errors_sections/{name}", wrapper.ReplaceHTTPErrorsSection) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhBb9s4E/0rBL/vKFtuWiywvjlJd5vLIkiDvSwCY0yOJHYlUiUpO0ag/74gKdlWLCd14KRO4ZstkTNv", + "hm/ejPhAmSpKJVFaQ8cPVKMplTTo/5gSmUgEAyuUnBaKY26mTBWFktPVwvb5JNcIfPn5XphgiilpUVr3", + "E8oyb8zE34yS3jjLsAD36/8aEzqm/4vXUOLw1sR7QUCtlaZ1XUeUo2FalG4XHdPbDEljCTnRaFSlGRII", + "kAkGzBHNEDhqj/5CyUSklfaOB3+jNiLg7lruLCOJyJHMm7XRRoh2WSIdU2O1kKlDWEf7Zfcc+A1+r9DY", + "I0vtObiEBmTHnMBLTKDK7Wcfx3Gl8E+UqCEnAdsxJ/EvZf9QleTvo7wXYIhUliQe8pvmtW5fe2+ZtWVA", + "b6YGmW18NdvU7BsyVzz3g1QNmoch5OGX29trTwvztdm3sWwgilJpfwIl2IyOaSpsVs2GTBVxBqVW90uL", + "LItZLlDagQQr5hjPf4uDdepg9mDzmIXFwjx3fH2B1VEbGGgNyx+Myxw8sBdQ68fOpC3TQ8J1gIVM1DYF", + "J5JMrq9IojQpQEIqZEq+TK6dTeKySEL6SZN+wjYpa4Y0olbY3MFvd12CBXKdg0RveRDMhNMgG8fRMn1M", + "3ZmqEiWUgo7px+Fo+IFGPlbPkNignguGpg027oCId1EsRbsd7w3aSktDQBLPH6ISAnm+igt5X9g+UFVi", + "8HjFvaraXpaVoKFA64Xgn8fery6dP5shsRqkgZDTRYYaycIpirTEKgKc+0Urj0NyAdJpzQxJZZC7LbLV", + "CiLMWp4cUOFcfa9Qu+qQULjT2fA3FfxJebmLumPa2Wh0MEHuPaseyf1aMYbGJFW+TsJbty4eWvqukFY5", + "il8+KHghqYoC9HLFzQ41+7joag5SRy+6ZiC9qyNaKtND+QnnhgCRuOitaKs819hWorY5f6ERLPY1jffP", + "+ugx6oZSwbPTR5Yh+9fpYzdVDZ5+sJsBbwKOOm8yMERYQ9RibW5HRE+QV0iLKeq+WK4SYtBGhCsCLhaG", + "RGOugPtHDvUChPVRbnLBTztu2YBjDst9QwRDWAYyRUNEdx1o9F69kCAnXGhkNl86GnSyuysNPoZpANfJ", + "xapoE8gNrmaFmVI5gmzVzX9PnCu+fE1hC7rmnAmNnI6trrDe0tYPrw+hy4Xeru4Lm7tGfDY6e2tEXY0O", + "lCHAGJYWOQHZsrD9EMRH0/ZN4OjV5bb2raVntZf0sKZP/j+FtndA6d/4yPb2fz+w/e4Vyc/oYBPOCfR1", + "mR09y025THFMUQ6aAxrMFF8OmjLnYMG7eMkMGD84K3UgRY4Wt+lx6Z+bfswk0aro6Y2zpRdrZ3y7RQaL", + "e7fIPvc+B438+cF/pX7Nm6607NXcTi351JKPqyV3muLZc4P8sTSJs9GnbXt9xRwUiAfh/3RgRV7dm/0M", + "zQ+Kt5fs19HTH+dK4vOXD0/rcN/n+UmEj/824FgvA36xom2vGvYr2rLqLdoyB7ZziNqjZhtLp7o9DU+n", + "4em93meMjuE+QwclOV1ovO2Fxi/WIj2HXuM+w/lBPW+7WaVzOqbx/COt7+r/AgAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/http_errors_section/http_errors_section.go b/handlers/configuration/http_errors_section/http_errors_section.go new file mode 100644 index 00000000..28fe6dbd --- /dev/null +++ b/handlers/configuration/http_errors_section/http_errors_section.go @@ -0,0 +1,167 @@ +// Copyright 2022 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http_errors_section + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetHTTPErrorsSections(w http.ResponseWriter, r *http.Request, params GetHTTPErrorsSectionsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, sections, err := cfg.GetHTTPErrorsSections(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, sections) +} + +func (h *HandlerImpl) CreateHTTPErrorsSection(w http.ResponseWriter, r *http.Request, params CreateHTTPErrorsSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpErrorsSection + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateHTTPErrorsSection(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params DeleteHTTPErrorsSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteHTTPErrorsSection(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params GetHTTPErrorsSectionParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, section, err := cfg.GetHTTPErrorsSection(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, section) +} + +func (h *HandlerImpl) ReplaceHTTPErrorsSection(w http.ResponseWriter, r *http.Request, name string, params ReplaceHTTPErrorsSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data HttpErrorsSection + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditHTTPErrorsSection(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/log_forward/log_forward.gen.go b/handlers/configuration/log_forward/log_forward.gen.go new file mode 100644 index 00000000..445ddda5 --- /dev/null +++ b/handlers/configuration/log_forward/log_forward.gen.go @@ -0,0 +1,728 @@ +// Package log_forward provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package log_forward + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// LogForward defines model for log_forward. +type LogForward = models.LogForward + +// LogForwards defines model for log_forwards. +type LogForwards = models.LogForwards + +// GetLogForwardsParams defines parameters for GetLogForwards. +type GetLogForwardsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateLogForwardParams defines parameters for CreateLogForward. +type CreateLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteLogForwardParams defines parameters for DeleteLogForward. +type DeleteLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogForwardParams defines parameters for GetLogForward. +type GetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceLogForwardParams defines parameters for ReplaceLogForward. +type ReplaceLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateLogForwardJSONRequestBody defines body for CreateLogForward for application/json ContentType. +type CreateLogForwardJSONRequestBody = LogForward + +// ReplaceLogForwardJSONRequestBody defines body for ReplaceLogForward for application/json ContentType. +type ReplaceLogForwardJSONRequestBody = LogForward + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of log forwards + // (GET /services/haproxy/configuration/log_forwards) + GetLogForwards(w http.ResponseWriter, r *http.Request, params GetLogForwardsParams) + // Add a log forward + // (POST /services/haproxy/configuration/log_forwards) + CreateLogForward(w http.ResponseWriter, r *http.Request, params CreateLogForwardParams) + // Delete a log forward + // (DELETE /services/haproxy/configuration/log_forwards/{name}) + DeleteLogForward(w http.ResponseWriter, r *http.Request, name string, params DeleteLogForwardParams) + // Return a log forward + // (GET /services/haproxy/configuration/log_forwards/{name}) + GetLogForward(w http.ResponseWriter, r *http.Request, name string, params GetLogForwardParams) + // Replace a log forward + // (PUT /services/haproxy/configuration/log_forwards/{name}) + ReplaceLogForward(w http.ResponseWriter, r *http.Request, name string, params ReplaceLogForwardParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of log forwards +// (GET /services/haproxy/configuration/log_forwards) +func (_ Unimplemented) GetLogForwards(w http.ResponseWriter, r *http.Request, params GetLogForwardsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a log forward +// (POST /services/haproxy/configuration/log_forwards) +func (_ Unimplemented) CreateLogForward(w http.ResponseWriter, r *http.Request, params CreateLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a log forward +// (DELETE /services/haproxy/configuration/log_forwards/{name}) +func (_ Unimplemented) DeleteLogForward(w http.ResponseWriter, r *http.Request, name string, params DeleteLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a log forward +// (GET /services/haproxy/configuration/log_forwards/{name}) +func (_ Unimplemented) GetLogForward(w http.ResponseWriter, r *http.Request, name string, params GetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a log forward +// (PUT /services/haproxy/configuration/log_forwards/{name}) +func (_ Unimplemented) ReplaceLogForward(w http.ResponseWriter, r *http.Request, name string, params ReplaceLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetLogForwards operation middleware +func (siw *ServerInterfaceWrapper) GetLogForwards(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogForwardsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogForwards(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogForward operation middleware +func (siw *ServerInterfaceWrapper) CreateLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogForward(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogForward operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogForward(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogForward operation middleware +func (siw *ServerInterfaceWrapper) GetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogForward(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogForward operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogForward(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards", wrapper.GetLogForwards) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/log_forwards", wrapper.CreateLogForward) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/log_forwards/{name}", wrapper.DeleteLogForward) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{name}", wrapper.GetLogForward) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_forwards/{name}", wrapper.ReplaceLogForward) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FjRb9u2E/5XDvz9HuUoTYsB81vatFuAYii6YS9DYVzIk8SOIlWSimsU+t8HkrItVU4aF27qFn6zJeru", + "u9N3353uE+Ombowm7R2bf2KWXGO0o/jHNcRlITl6afSiNoKUW3BT10YvNgfX1y+VJRSrlx+lS6a40Z60", + "Dz+xaVRvJn/vjI7GeUU1hl//t1SwOftfvoWSp7su3wsCWWss67ouY4Ict7IJT7E5+6si6C2RAEvOtJYT", + "YIIMlDBnrCIUZCP6F0YXsmxtdDz7m6yTCffY8ugYFFIR3PZns0GIftUQmzPnrdRlQNhl+2X3OYq39KEl", + "548stc8xJDQhO+YEXlGBrfIvYxzHlcLfSJNFBQnbMSfxD+NfmVaLH6O8l+hAGw9FhPyoee3Wt6M3ZcpF", + "YewSrRgcNzfviYei+Tgrzay/mEI9e23KV/0Dg/szWTfGxpQ36Cs2Z6X0VXtzxk2dV9hY83HliVc5V5K0", + "n2n08pby21/yZJYFXAMwEZz0VLsvvadhBF22jgCtxdWXAnAHj+ArSPOwrK8L8JBwA2CpCzMl16WGyzfX", + "UBgLNWospS7h98s3wSYoU0Kfb+BDErozljEvvQqw16ev0CO8UagpWpzBa1PClj9rys5ZeHemIY2NZHP2", + "9Oz87AnLYmiRAbkjeys5uXVs+ch3/jl1SvLTsN6Sb612gBoiP8AUgEptwiAxjC7GYxpKHq5FlEM/Zk+D", + "FmvysXT/+dzd9VVw4CsCb1E75LFUlxVZgmXQAO3BG0Ah4qGNqzN4gTqoww1B60iER/S6ukG6raAEhDK4", + "+tCSDXTXWIfsD/wtpLhXELIJai0Cf8mBTOB73FgUxL2Ll7aKxiuptrrmAB0sSak7cBWtUgtH0eAIlUgt", + "kM0LVI42VXxjjCLUrOveZeP57+L8/GBKP+LODg3/s+WcnCtatX1Hj90LNwnaHcomN/nXTx5Rv9q6Rrva", + "1MqoVIa1EUody8B6NmgI77qMNcbtKL1LIRwgaFqOBMSbyCc+Scy09l5YQk+j7vMTVl/PneQ56C+viP8b", + "9Hecox7PbrDDgIeAs9GdCh1I78Ast+buiOgelkrtqSS7U0kKcOQzEAYwxMIJLCmDIl4KqJcofYxySII4", + "J4VjM0EKV/uGiA54hboMAjY+h5ai16gUJEBIS9yrVaDBKLt3pSHGsEjg9pOvH0ll4wfTcyNW30Jgk74G", + "J9KSYHNvW+om2v7k27kev4bXw2EmCkwcIi/OLx4LwbgnJOYCck6NJwGo18Ww/pKlzz4X3qZSub6aau5W", + "ATfPwg7y7mo3z1J7PWCrGWwJov1fD2x/vOP5Hh3zUgjAYXe7o0eGIZ4bQSXpWf9iZjdGrGZ9+Qr0GE3v", + "M/Pmn8LTXSKBIk9TOlzF626MEQpr6h09+GYVe0MwOm3FydLDW/GwymKQvW7FD5eNbPV3xtqw3+h6avmn", + "ln8sLX/6xXLxpS+CY1H/i/NnU3vDIk4SI5KSPzuwxG42ed9DxJO0PUjHu+z+LYPRdPey5H6BHe0ZTup6", + "WmcccOA8hm3GTyYa613Jw0SjaXeKRqOQT6azPTSjt3DSjdNUdprKTouYwyxizr/HIsYmJTttYh5nE/OT", + "teLInUMuYoJ9srfrJtpaxeYsv33KunfdfwEAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/log_forward/log_forward.go b/handlers/configuration/log_forward/log_forward.go new file mode 100644 index 00000000..5255245b --- /dev/null +++ b/handlers/configuration/log_forward/log_forward.go @@ -0,0 +1,190 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_forward + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all log_forward routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy log_forward configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetLogForwards(w http.ResponseWriter, r *http.Request, params GetLogForwardsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var logForwards LogForwards + if params.FullSection { + _, logForwards, err = cfg.GetStructuredLogForwards(params.TransactionId) + } else { + _, logForwards, err = cfg.GetLogForwards(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, logForwards) +} + +func (h *HandlerImpl) CreateLogForward(w http.ResponseWriter, r *http.Request, params CreateLogForwardParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogForward + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredLogForward(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateLogForward(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteLogForward(w http.ResponseWriter, r *http.Request, name string, params DeleteLogForwardParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteLogForward(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetLogForward(w http.ResponseWriter, r *http.Request, name string, params GetLogForwardParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var logForward *LogForward + if params.FullSection { + _, logForward, err = cfg.GetStructuredLogForward(name, params.TransactionId) + } else { + _, logForward, err = cfg.GetLogForward(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, logForward) +} + +func (h *HandlerImpl) ReplaceLogForward(w http.ResponseWriter, r *http.Request, name string, params ReplaceLogForwardParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogForward + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredLogForward(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditLogForward(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/log_profile/log_profile.gen.go b/handlers/configuration/log_profile/log_profile.gen.go new file mode 100644 index 00000000..a69e610c --- /dev/null +++ b/handlers/configuration/log_profile/log_profile.gen.go @@ -0,0 +1,663 @@ +// Package log_profile provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package log_profile + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// LogProfile defines model for log_profile. +type LogProfile = models.LogProfile + +// LogProfiles defines model for log_profiles. +type LogProfiles = models.LogProfiles + +// GetLogProfilesParams defines parameters for GetLogProfiles. +type GetLogProfilesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogProfileParams defines parameters for CreateLogProfile. +type CreateLogProfileParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogProfileParams defines parameters for DeleteLogProfile. +type DeleteLogProfileParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogProfileParams defines parameters for GetLogProfile. +type GetLogProfileParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// EditLogProfileParams defines parameters for EditLogProfile. +type EditLogProfileParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateLogProfileJSONRequestBody defines body for CreateLogProfile for application/json ContentType. +type CreateLogProfileJSONRequestBody = LogProfile + +// EditLogProfileJSONRequestBody defines body for EditLogProfile for application/json ContentType. +type EditLogProfileJSONRequestBody = LogProfile + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of log profiles + // (GET /services/haproxy/configuration/log_profiles) + GetLogProfiles(w http.ResponseWriter, r *http.Request, params GetLogProfilesParams) + // Add a log profile + // (POST /services/haproxy/configuration/log_profiles) + CreateLogProfile(w http.ResponseWriter, r *http.Request, params CreateLogProfileParams) + // Delete a log profile + // (DELETE /services/haproxy/configuration/log_profiles/{name}) + DeleteLogProfile(w http.ResponseWriter, r *http.Request, name string, params DeleteLogProfileParams) + // Return a log profile + // (GET /services/haproxy/configuration/log_profiles/{name}) + GetLogProfile(w http.ResponseWriter, r *http.Request, name string, params GetLogProfileParams) + // Replace a log profile + // (PUT /services/haproxy/configuration/log_profiles/{name}) + EditLogProfile(w http.ResponseWriter, r *http.Request, name string, params EditLogProfileParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of log profiles +// (GET /services/haproxy/configuration/log_profiles) +func (_ Unimplemented) GetLogProfiles(w http.ResponseWriter, r *http.Request, params GetLogProfilesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a log profile +// (POST /services/haproxy/configuration/log_profiles) +func (_ Unimplemented) CreateLogProfile(w http.ResponseWriter, r *http.Request, params CreateLogProfileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a log profile +// (DELETE /services/haproxy/configuration/log_profiles/{name}) +func (_ Unimplemented) DeleteLogProfile(w http.ResponseWriter, r *http.Request, name string, params DeleteLogProfileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a log profile +// (GET /services/haproxy/configuration/log_profiles/{name}) +func (_ Unimplemented) GetLogProfile(w http.ResponseWriter, r *http.Request, name string, params GetLogProfileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a log profile +// (PUT /services/haproxy/configuration/log_profiles/{name}) +func (_ Unimplemented) EditLogProfile(w http.ResponseWriter, r *http.Request, name string, params EditLogProfileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetLogProfiles operation middleware +func (siw *ServerInterfaceWrapper) GetLogProfiles(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogProfilesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogProfiles(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogProfile operation middleware +func (siw *ServerInterfaceWrapper) CreateLogProfile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogProfileParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogProfile(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogProfile operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogProfile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogProfileParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogProfile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogProfile operation middleware +func (siw *ServerInterfaceWrapper) GetLogProfile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogProfileParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogProfile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// EditLogProfile operation middleware +func (siw *ServerInterfaceWrapper) EditLogProfile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params EditLogProfileParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.EditLogProfile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_profiles", wrapper.GetLogProfiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/log_profiles", wrapper.CreateLogProfile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/log_profiles/{name}", wrapper.DeleteLogProfile) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_profiles/{name}", wrapper.GetLogProfile) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_profiles/{name}", wrapper.EditLogProfile) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XDtweZctNiwHzm9t0W4BiCLphL0NhnMmTxE4iVZKyYwT63wdSki3Fzg8XbuIWfrMl8u67", + "03ffHXnLuC5KrUg5y6a3zJAttbIU/tiSuEwkRye1mhdaUG7nXBeFVvPNwu75LDeEYv3+RtrGFNfKkXL+", + "J5Zl3pqJP1utgnGeUYH+18+GEjZlP8VbKHHz1sYHQSBjtGF1XUdMkOVGln4Xm7K/M4LWEgkwZHVlOAE2", + "kIEazBHLCAWZgP6dVolMKxMcj/4hY2WDe2h5sAwSmRMs27VRL0S3LolNmXVGqtQjrKPDsvsWxUf6UpF1", + "J5bat+gT2iA75QReUoJV7t6HOE4rhb+TIoM5NNhOOYl/avebrpT4Psp7hRaUdpAEyM+a17p7HbzlOp2X", + "Rvv9veV68Zm4L5qbUapH7cMm1PEHnV63G3rvR7IotQkpL9FlbMpS6bJqMea6iDMsjb5ZO+JZzHNJyo0U", + "OrmkePlL3JhlHlcPTAAnHRX2se/Uj6COugjQGFw/FoA9egRfQZqnZb0rwGPC9YClSvQuuWYKZtdXkGgD", + "BSpMpUrhj9m1twm5TqHNN/A+Ce2YRcxJ55nEutWX6BCuc1QULI7gg05hy5+OslPmv50uSWEp2ZS9Hk/G", + "r1gUQgsMiC2ZpeRku9jige/4LnVScrthfSRXGWUBFQR+gE4A83wTBol+dCEeXVLj4UoEOXRD9pRosCAX", + "Svffu+6uLr0DlxE4g8oiD6W6ysgQrLwGKAdOAwoRFm1cjeEdKq8OC4LKkvBbVFfdIO1WUDxC6V19qch4", + "uissfPZ7/uZSPCgIn6LhYHUxmRxNQgcfZY84/lVxTtYmVb4N/rmbjGia732hbHITf31LD8JQFQWa9YaE", + "Aw72SedrCFNPJ9ZT2k91xEpt93B6JoQFBEWrQWU6HTjFdxKzS+p3htDRQNa/f1pHd1G33Gk8e2HjGfH/", + "vLANc9Ti2Q+2H3AfcDR4k6EF6Szo1dbcPRE9wFKpHKVk9sVylYAlF4HQgD4WTmAo1yjCI496hdKFKPsk", + "CAOIXzYSlOP60BDRAs9QpWRBDtehoeA1KAUJENIQd/na02CQ3fvSEGKYN+AGudhUZ4K5pU13X2idE6pO", + "vsKI/1aL9bdQrka4vBNpSLCpMxXVO6L56tu5Hn77D/32GypX+NZ5Mbl4LgRDsW0oAcg5lY4EoOpY1p29", + "6M6A+7Hh4NXlrphtpWWzF/awYp+Ov2n61hE1vHeuDfZ/PbL94a3ES7SimRCA/bZxT/PxYyfXglJSo/bD", + "jBZarEdt+Qp0GEwfMqXFt3533ZAgJ0e7dLgMz+0QIyRGF3ua22IdRNcb3e1xjaWn97h+lYUgW90Ko/ZG", + "tto3Q204qCude+m5l55WLx10tYvHRu1TUf+LyZtde/0ibiRGNEr+5sgSu7l7egkRb6TtSTpeRw+fi7Wi", + "+4/3Dwvs4GR8VtfTO4Cf6vn7B6vG7nT/tGosq73VWObId8aeA4rxvZDnajzPOudZ5/TvDSYvcW9gGoU5", + "Xxw8z8XBD9bgAneOeW/g7ZNZdt2pMjmbsnj5mtWf6v8DAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/log_profile/log_profile.go b/handlers/configuration/log_profile/log_profile.go new file mode 100644 index 00000000..5127723a --- /dev/null +++ b/handlers/configuration/log_profile/log_profile.go @@ -0,0 +1,170 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_profile + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all log profile routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy log profile configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetLogProfiles(w http.ResponseWriter, r *http.Request, params GetLogProfilesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, profiles, err := cfg.GetLogProfiles(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, profiles) +} + +func (h *HandlerImpl) CreateLogProfile(w http.ResponseWriter, r *http.Request, params CreateLogProfileParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogProfile + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateLogProfile(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteLogProfile(w http.ResponseWriter, r *http.Request, name string, params DeleteLogProfileParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteLogProfile(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetLogProfile(w http.ResponseWriter, r *http.Request, name string, params GetLogProfileParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, profile, err := cfg.GetLogProfile(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, profile) +} + +func (h *HandlerImpl) EditLogProfile(w http.ResponseWriter, r *http.Request, name string, params EditLogProfileParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogProfile + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditLogProfile(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/log_target/log_target.gen.go b/handlers/configuration/log_target/log_target.gen.go new file mode 100644 index 00000000..1ced809e --- /dev/null +++ b/handlers/configuration/log_target/log_target.gen.go @@ -0,0 +1,2957 @@ +// Package log_target provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package log_target + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// LogTarget defines model for log_target. +type LogTarget = models.LogTarget + +// LogTargets defines model for log_targets. +type LogTargets = models.LogTargets + +// GetAllLogTargetBackendParams defines parameters for GetAllLogTargetBackend. +type GetAllLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetBackendParams defines parameters for ReplaceAllLogTargetBackend. +type ReplaceAllLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetBackendParams defines parameters for DeleteLogTargetBackend. +type DeleteLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetBackendParams defines parameters for GetLogTargetBackend. +type GetLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetBackendParams defines parameters for CreateLogTargetBackend. +type CreateLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetBackendParams defines parameters for ReplaceLogTargetBackend. +type ReplaceLogTargetBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllLogTargetDefaultsParams defines parameters for GetAllLogTargetDefaults. +type GetAllLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetDefaultsParams defines parameters for ReplaceAllLogTargetDefaults. +type ReplaceAllLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetDefaultsParams defines parameters for DeleteLogTargetDefaults. +type DeleteLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetDefaultsParams defines parameters for GetLogTargetDefaults. +type GetLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetDefaultsParams defines parameters for CreateLogTargetDefaults. +type CreateLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetDefaultsParams defines parameters for ReplaceLogTargetDefaults. +type ReplaceLogTargetDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllLogTargetFrontendParams defines parameters for GetAllLogTargetFrontend. +type GetAllLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetFrontendParams defines parameters for ReplaceAllLogTargetFrontend. +type ReplaceAllLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetFrontendParams defines parameters for DeleteLogTargetFrontend. +type DeleteLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetFrontendParams defines parameters for GetLogTargetFrontend. +type GetLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetFrontendParams defines parameters for CreateLogTargetFrontend. +type CreateLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetFrontendParams defines parameters for ReplaceLogTargetFrontend. +type ReplaceLogTargetFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllLogTargetLogForwardParams defines parameters for GetAllLogTargetLogForward. +type GetAllLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetLogForwardParams defines parameters for ReplaceAllLogTargetLogForward. +type ReplaceAllLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetLogForwardParams defines parameters for DeleteLogTargetLogForward. +type DeleteLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetLogForwardParams defines parameters for GetLogTargetLogForward. +type GetLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetLogForwardParams defines parameters for CreateLogTargetLogForward. +type CreateLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetLogForwardParams defines parameters for ReplaceLogTargetLogForward. +type ReplaceLogTargetLogForwardParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllLogTargetPeerParams defines parameters for GetAllLogTargetPeer. +type GetAllLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetPeerParams defines parameters for ReplaceAllLogTargetPeer. +type ReplaceAllLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetPeerParams defines parameters for DeleteLogTargetPeer. +type DeleteLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetPeerParams defines parameters for GetLogTargetPeer. +type GetLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetPeerParams defines parameters for CreateLogTargetPeer. +type CreateLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetPeerParams defines parameters for ReplaceLogTargetPeer. +type ReplaceLogTargetPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllLogTargetBackendJSONRequestBody defines body for ReplaceAllLogTargetBackend for application/json ContentType. +type ReplaceAllLogTargetBackendJSONRequestBody = LogTargets + +// CreateLogTargetBackendJSONRequestBody defines body for CreateLogTargetBackend for application/json ContentType. +type CreateLogTargetBackendJSONRequestBody = LogTarget + +// ReplaceLogTargetBackendJSONRequestBody defines body for ReplaceLogTargetBackend for application/json ContentType. +type ReplaceLogTargetBackendJSONRequestBody = LogTarget + +// ReplaceAllLogTargetDefaultsJSONRequestBody defines body for ReplaceAllLogTargetDefaults for application/json ContentType. +type ReplaceAllLogTargetDefaultsJSONRequestBody = LogTargets + +// CreateLogTargetDefaultsJSONRequestBody defines body for CreateLogTargetDefaults for application/json ContentType. +type CreateLogTargetDefaultsJSONRequestBody = LogTarget + +// ReplaceLogTargetDefaultsJSONRequestBody defines body for ReplaceLogTargetDefaults for application/json ContentType. +type ReplaceLogTargetDefaultsJSONRequestBody = LogTarget + +// ReplaceAllLogTargetFrontendJSONRequestBody defines body for ReplaceAllLogTargetFrontend for application/json ContentType. +type ReplaceAllLogTargetFrontendJSONRequestBody = LogTargets + +// CreateLogTargetFrontendJSONRequestBody defines body for CreateLogTargetFrontend for application/json ContentType. +type CreateLogTargetFrontendJSONRequestBody = LogTarget + +// ReplaceLogTargetFrontendJSONRequestBody defines body for ReplaceLogTargetFrontend for application/json ContentType. +type ReplaceLogTargetFrontendJSONRequestBody = LogTarget + +// ReplaceAllLogTargetLogForwardJSONRequestBody defines body for ReplaceAllLogTargetLogForward for application/json ContentType. +type ReplaceAllLogTargetLogForwardJSONRequestBody = LogTargets + +// CreateLogTargetLogForwardJSONRequestBody defines body for CreateLogTargetLogForward for application/json ContentType. +type CreateLogTargetLogForwardJSONRequestBody = LogTarget + +// ReplaceLogTargetLogForwardJSONRequestBody defines body for ReplaceLogTargetLogForward for application/json ContentType. +type ReplaceLogTargetLogForwardJSONRequestBody = LogTarget + +// ReplaceAllLogTargetPeerJSONRequestBody defines body for ReplaceAllLogTargetPeer for application/json ContentType. +type ReplaceAllLogTargetPeerJSONRequestBody = LogTargets + +// CreateLogTargetPeerJSONRequestBody defines body for CreateLogTargetPeer for application/json ContentType. +type CreateLogTargetPeerJSONRequestBody = LogTarget + +// ReplaceLogTargetPeerJSONRequestBody defines body for ReplaceLogTargetPeer for application/json ContentType. +type ReplaceLogTargetPeerJSONRequestBody = LogTarget + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Log Targets + // (GET /services/haproxy/configuration/backends/{parent_name}/log_targets) + GetAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetBackendParams) + // Replace a Log Target list + // (PUT /services/haproxy/configuration/backends/{parent_name}/log_targets) + ReplaceAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetBackendParams) + // Delete a Log Target + // (DELETE /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) + DeleteLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetBackendParams) + // Return one Log Target + // (GET /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) + GetLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetBackendParams) + // Add a new Log Target + // (POST /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) + CreateLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetBackendParams) + // Replace a Log Target + // (PUT /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) + ReplaceLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetBackendParams) + // Return an array of all Log Targets + // (GET /services/haproxy/configuration/defaults/{parent_name}/log_targets) + GetAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetDefaultsParams) + // Replace a Log Target list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets) + ReplaceAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetDefaultsParams) + // Delete a Log Target + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) + DeleteLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetDefaultsParams) + // Return one Log Target + // (GET /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) + GetLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetDefaultsParams) + // Add a new Log Target + // (POST /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) + CreateLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetDefaultsParams) + // Replace a Log Target + // (PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) + ReplaceLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetDefaultsParams) + // Return an array of all Log Targets + // (GET /services/haproxy/configuration/frontends/{parent_name}/log_targets) + GetAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetFrontendParams) + // Replace a Log Target list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets) + ReplaceAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetFrontendParams) + // Delete a Log Target + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) + DeleteLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetFrontendParams) + // Return one Log Target + // (GET /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) + GetLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetFrontendParams) + // Add a new Log Target + // (POST /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) + CreateLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetFrontendParams) + // Replace a Log Target + // (PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) + ReplaceLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetFrontendParams) + // Return an array of all Log Targets + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets) + GetAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetLogForwardParams) + // Replace a Log Target list + // (PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets) + ReplaceAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetLogForwardParams) + // Delete a Log Target + // (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) + DeleteLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetLogForwardParams) + // Return one Log Target + // (GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) + GetLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetLogForwardParams) + // Add a new Log Target + // (POST /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) + CreateLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetLogForwardParams) + // Replace a Log Target + // (PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) + ReplaceLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetLogForwardParams) + // Return an array of all Log Targets + // (GET /services/haproxy/configuration/peers/{parent_name}/log_targets) + GetAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetPeerParams) + // Replace a Log Target list + // (PUT /services/haproxy/configuration/peers/{parent_name}/log_targets) + ReplaceAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetPeerParams) + // Delete a Log Target + // (DELETE /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) + DeleteLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetPeerParams) + // Return one Log Target + // (GET /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) + GetLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetPeerParams) + // Add a new Log Target + // (POST /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) + CreateLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetPeerParams) + // Replace a Log Target + // (PUT /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) + ReplaceLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetPeerParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Log Targets +// (GET /services/haproxy/configuration/backends/{parent_name}/log_targets) +func (_ Unimplemented) GetAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target list +// (PUT /services/haproxy/configuration/backends/{parent_name}/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Log Target +// (DELETE /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Log Target +// (GET /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) GetLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Log Target +// (POST /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target +// (PUT /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all Log Targets +// (GET /services/haproxy/configuration/defaults/{parent_name}/log_targets) +func (_ Unimplemented) GetAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Log Target +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Log Target +// (GET /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) +func (_ Unimplemented) GetLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Log Target +// (POST /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target +// (PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all Log Targets +// (GET /services/haproxy/configuration/frontends/{parent_name}/log_targets) +func (_ Unimplemented) GetAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Log Target +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Log Target +// (GET /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) GetLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Log Target +// (POST /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target +// (PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all Log Targets +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets) +func (_ Unimplemented) GetAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target list +// (PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Log Target +// (DELETE /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Log Target +// (GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) +func (_ Unimplemented) GetLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Log Target +// (POST /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target +// (PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetLogForwardParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all Log Targets +// (GET /services/haproxy/configuration/peers/{parent_name}/log_targets) +func (_ Unimplemented) GetAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target list +// (PUT /services/haproxy/configuration/peers/{parent_name}/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Log Target +// (DELETE /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Log Target +// (GET /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) +func (_ Unimplemented) GetLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Log Target +// (POST /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Log Target +// (PUT /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetLogForward(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetLogForward(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetLogForward(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetLogForward(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetLogForward(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetLogForward operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetLogForward(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetLogForwardParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetLogForward(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetPeer(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetPeer(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetPeer(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetPeer operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetPeer(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets", wrapper.GetAllLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets", wrapper.ReplaceAllLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}", wrapper.DeleteLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}", wrapper.GetLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}", wrapper.CreateLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}", wrapper.ReplaceLogTargetBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets", wrapper.GetAllLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets", wrapper.ReplaceAllLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}", wrapper.DeleteLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}", wrapper.GetLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}", wrapper.CreateLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}", wrapper.ReplaceLogTargetDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets", wrapper.GetAllLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets", wrapper.ReplaceAllLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}", wrapper.DeleteLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}", wrapper.GetLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}", wrapper.CreateLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}", wrapper.ReplaceLogTargetFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets", wrapper.GetAllLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets", wrapper.ReplaceAllLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}", wrapper.DeleteLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}", wrapper.GetLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}", wrapper.CreateLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}", wrapper.ReplaceLogTargetLogForward) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets", wrapper.GetAllLogTargetPeer) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets", wrapper.ReplaceAllLogTargetPeer) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}", wrapper.DeleteLogTargetPeer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}", wrapper.GetLogTargetPeer) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}", wrapper.CreateLogTargetPeer) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}", wrapper.ReplaceLogTargetPeer) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7JxRb9s4Ese/CsHt050de9NigfM9pc12L0BxCHqLe9l0A0Yc29yVSS1JxzUCf/cDKcmWHNlS2sT2Bf+X", + "wrFoakjNzH80/KEPPDGzzGjS3vHRA7fkMqMdxT9cRokaq0R4ZfTtzEhK3W1iZjOjb9cDy+8vUktCLn/+", + "qlw+VWK0J+3DR5FlaTHN4A9ndJw8mdJMhE9vLI35iP8w2JgyyK+6wZNMIGuN5avVqsclucSqLPyKj/iv", + "U2LFTCSZJWfmNiEmcpMZ5Tb3+JSEJBut/2D0WE3mNt64/1+yTuV212euDWNjlRK7L8b2Kkv0y4z4iDtv", + "lZ4EC1e9p+3ueyE/019zcv7Etva9CBuaW3bKG3hJYzFP/c9xHae1hb+QJitSltt2ypv4b+M/mrmW/x/h", + "vRCOaePZOJp80H1dlZfj3VIzufXCTshXRpu7PygJMfO1PzH94st8pWefzOTXfHzlcl/NMmPjFJnwUz7i", + "E+Wn87uzxMwGU5FZ83XpKZkOklSR9n0tvLqnwf1Pg3xWHqzamBItU55mru0hVcxf9UrzhbVi2WK9e3bz", + "v8Ffuu14GXvPaW4wWOmxeexXF5pdXF+xsbFsJrSYKD1h/7q4DnOyT2bC8u1jqdLkzniPe+XTYGw55lJ4", + "wa5ToSnO06/8iPd46aIjHp6XyUiLTPERf3s2PPuR9+J64kMfOLL3KiFXLmiQVB1+cCeSP0lLN3jIhCXt", + "b7WY0Wqw5UOFW9dX+Jn83GrHRJpWjHPMT4VnwhIr70SSKV2J3vf5PcOqTUa5IVcyZkl/kaZr3yrGxeVY", + "MSMfI/u3bTuuo+EsGM7D0+Cj/HH2ePwq/LVeGe/xoGTKkuQjb+dUjfFMeE82/P73336/ubE3N/pmPhy+", + "TeK/9Ld/vvkhfDr/6WF1w7/8/Q3vPUoLvW3jri6ZGTM/Jeat0E4kMc0spmSJLUL+0p55w4SUcdB6P87Y", + "B6FDZrsjNnckw090mZmYcpvtPCsX/dec7HKz6sr9bpXcm8y+9OpF4flw+Gzpv+pJDXn9P/MkIefG83Sz", + "9kPro8zrhl0rWW/N4NurkZjY5rOZsMt15DChWUyxwUO2gii4lpgEb+cbofiy6vFs3hiJWSoSckywxdSk", + "xFLlfJi1GpYL5afRx+LFibonHcJyHVoxVfmazO4M1OKGCNYjBOsjq4uQyO8cHmIypeTPoDe1VF/a02xs", + "dcFVg3u1K1PhmPKOmcVmuh0r2hN8SnuakG18AmPmyPeYNEyEtSTELKVGyPhVsHohlF+7akVh8mF9SalY", + "PnWJwrFkKvSEXIiI6rggY2GimP9IMqksJT5dBjeo7e6ubYhruM2Nq+3FOumMRepo7Zx3xqQkdJmU40vX", + "eyOXL5eP6yG2Op4UXGzVETZPMjJUOOfD80OZUReS3C+YSBLKPEkmdOlq5Ssxbb13fM4d8erycZ7e5Jf1", + "b1mDazRp1Lv8OTyjPlXaDcfRwPh0mahXw7HF0CB9oWxPjKQJ6X6xef07I5f9Is6k8CLe4fsL3sGD0pK+", + "rvLnl5Knx0/yMn7v6tbX0+3dMqbKOBcbWzPrKq753E8V1oodV+GWzeqqiku7dbU9R0PCIeGQ8M4SXhPT", + "87YXl1PRm/Phu8fzVXJMnhijNr/Lhz6jbKx7kMcQpjz91jL7zrexvX0Ro6mjOgSP7aYNv5CHMKAR831l", + "76n2YV5ZIim6PPU0sLuxY1xDLrmQMhSZmhbVVFI48iZfhN18Qhb5YEmgwkSFiQoTTaJOWtHWI/rxQCpV", + "LadiDnvB5hB6Q2Vv6N3wH888fx0kOoY4X0j5SFe/p/PUfjLz3K8CxdRQcag4VBwq/gwqPjy8ir/8GQ9k", + "fCPjr+z1+vEB0gufHRVrPCgsVeyAa6WlyoEgMIBLAZc6Bi61O1QbeCmEK6poVNEApgBMAZg6aWCqveg9", + "EDC1W163iKmu0opWGEQcIg5kCsjUK0Cm9vZJIA1oxwCaAjTVAZranUe2qCmkElSZqDLRKgI2hfNWYFOn", + "hk21nsVAx6Hj0HHoOMApCDnAqRc+Qxrb6JuH/W+mPhY3bSWnyoFAMUBOgZw6Bjm1O1QbyCmEK8polNEg", + "p0BOgZw6aXKqQ9V7IHRqt75uoVNdtRXNMKg4VBzoFNCpV4BO7W2UQBrQjwE6BXSqAzq1O49soVNIJagy", + "UWWiVwR0CieuQKdODZ1qPYyBjkPHoePQcaBTEHKgUy98iBS8amzsQtjD0lOfzORjfttWfmozFEgGCCoQ", + "VMcgqPaFawNDhZBFRY2KGhQVKCpQVCdOUXUrgA8EUu2T2S2UqrvEoj0GMYeYA6YCTPUKYKqWvgnkAe0Z", + "AFUAqjoBVftyyRZShXSCahPVJlpHgKpwFguo6vSgqg7nM9ByaDm0HFoOsApiDrDqxcGqjMgelKi6JrKt", + "LFUYBCQDFBUoqmNQVM0h2sBPIUxRMqNkBjkFcgrk1MmSUy0V7oGQqWZN3YKluugpml1Qbig3MClgUq8A", + "k9rZDIEkoOcCNApoVAsa1Zw/tqAopBBUlagq0Q8CDoUTVOBQp4RD7T1ogX5Dv6Hf0G8gUBBwIFDffEAU", + "Zid7X8rm3KZ8xAf3b/nqy+p/AQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/log_target/log_target.go b/handlers/configuration/log_target/log_target.go new file mode 100644 index 00000000..fbda3a02 --- /dev/null +++ b/handlers/configuration/log_target/log_target.go @@ -0,0 +1,342 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_target + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all log_target routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy log_target configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetBackendParams) { + h.getAllLogTargets(w, r, parentName, "backend", params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetBackendParams) { + h.replaceAllLogTargets(w, r, parentName, "backend", params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) DeleteLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetBackendParams) { + h.deleteLogTarget(w, r, parentName, "backend", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) GetLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetBackendParams) { + h.getLogTarget(w, r, parentName, "backend", index, params.TransactionId) +} + +func (h *HandlerImpl) CreateLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetBackendParams) { + h.createLogTarget(w, r, parentName, "backend", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) ReplaceLogTargetBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetBackendParams) { + h.replaceLogTarget(w, r, parentName, "backend", index, params.TransactionId, params.Version, params.ForceReload) +} + +// --- Defaults --- + +func (h *HandlerImpl) GetAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetDefaultsParams) { + h.getAllLogTargets(w, r, parentName, "defaults", params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetDefaultsParams) { + h.replaceAllLogTargets(w, r, parentName, "defaults", params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) DeleteLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetDefaultsParams) { + h.deleteLogTarget(w, r, parentName, "defaults", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) GetLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetDefaultsParams) { + h.getLogTarget(w, r, parentName, "defaults", index, params.TransactionId) +} + +func (h *HandlerImpl) CreateLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetDefaultsParams) { + h.createLogTarget(w, r, parentName, "defaults", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) ReplaceLogTargetDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetDefaultsParams) { + h.replaceLogTarget(w, r, parentName, "defaults", index, params.TransactionId, params.Version, params.ForceReload) +} + +// --- Frontend --- + +func (h *HandlerImpl) GetAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetFrontendParams) { + h.getAllLogTargets(w, r, parentName, "frontend", params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetFrontendParams) { + h.replaceAllLogTargets(w, r, parentName, "frontend", params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) DeleteLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetFrontendParams) { + h.deleteLogTarget(w, r, parentName, "frontend", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) GetLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetFrontendParams) { + h.getLogTarget(w, r, parentName, "frontend", index, params.TransactionId) +} + +func (h *HandlerImpl) CreateLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetFrontendParams) { + h.createLogTarget(w, r, parentName, "frontend", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) ReplaceLogTargetFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetFrontendParams) { + h.replaceLogTarget(w, r, parentName, "frontend", index, params.TransactionId, params.Version, params.ForceReload) +} + +// --- LogForward --- + +func (h *HandlerImpl) GetAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetLogForwardParams) { + h.getAllLogTargets(w, r, parentName, "log_forward", params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetLogForwardParams) { + h.replaceAllLogTargets(w, r, parentName, "log_forward", params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) DeleteLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetLogForwardParams) { + h.deleteLogTarget(w, r, parentName, "log_forward", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) GetLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetLogForwardParams) { + h.getLogTarget(w, r, parentName, "log_forward", index, params.TransactionId) +} + +func (h *HandlerImpl) CreateLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetLogForwardParams) { + h.createLogTarget(w, r, parentName, "log_forward", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) ReplaceLogTargetLogForward(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetLogForwardParams) { + h.replaceLogTarget(w, r, parentName, "log_forward", index, params.TransactionId, params.Version, params.ForceReload) +} + +// --- Peer --- + +func (h *HandlerImpl) GetAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllLogTargetPeerParams) { + h.getAllLogTargets(w, r, parentName, "peers", params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllLogTargetPeerParams) { + h.replaceAllLogTargets(w, r, parentName, "peers", params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) DeleteLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteLogTargetPeerParams) { + h.deleteLogTarget(w, r, parentName, "peers", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) GetLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetLogTargetPeerParams) { + h.getLogTarget(w, r, parentName, "peers", index, params.TransactionId) +} + +func (h *HandlerImpl) CreateLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateLogTargetPeerParams) { + h.createLogTarget(w, r, parentName, "peers", index, params.TransactionId, params.Version, params.ForceReload) +} + +func (h *HandlerImpl) ReplaceLogTargetPeer(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceLogTargetPeerParams) { + h.replaceLogTarget(w, r, parentName, "peers", index, params.TransactionId, params.Version, params.ForceReload) +} + +// --- Shared internal implementations --- + +func (h *HandlerImpl) getAllLogTargets(w http.ResponseWriter, r *http.Request, parentName, parentType, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, logTargets, err := cfg.GetLogTargets(parentType, parentName, transactionID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.LogTargets{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, logTargets) +} + +func (h *HandlerImpl) replaceAllLogTargets(w http.ResponseWriter, r *http.Request, parentName, parentType, transactionID string, version int, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTargets + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceLogTargets(parentType, parentName, data, transactionID, int64(version)); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteLogTarget(w http.ResponseWriter, r *http.Request, parentName, parentType string, index int, transactionID string, version int, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteLogTarget(int64(index), parentType, parentName, transactionID, int64(version)); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getLogTarget(w http.ResponseWriter, r *http.Request, parentName, parentType string, index int, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, logTarget, err := cfg.GetLogTarget(int64(index), parentType, parentName, transactionID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, logTarget) +} + +func (h *HandlerImpl) createLogTarget(w http.ResponseWriter, r *http.Request, parentName, parentType string, index int, transactionID string, version int, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTarget + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateLogTarget(int64(index), parentType, parentName, &data, transactionID, int64(version)); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceLogTarget(w http.ResponseWriter, r *http.Request, parentName, parentType string, index int, transactionID string, version int, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTarget + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditLogTarget(int64(index), parentType, parentName, &data, transactionID, int64(version)); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/log_targets_global/log_targets_global.gen.go b/handlers/configuration/log_targets_global/log_targets_global.gen.go new file mode 100644 index 00000000..79550a06 --- /dev/null +++ b/handlers/configuration/log_targets_global/log_targets_global.gen.go @@ -0,0 +1,760 @@ +// Package log_targets_global provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package log_targets_global + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// LogTarget defines model for log_target. +type LogTarget = models.LogTarget + +// LogTargets defines model for log_targets. +type LogTargets = models.LogTargets + +// GetAllLogTargetGlobalParams defines parameters for GetAllLogTargetGlobal. +type GetAllLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllLogTargetGlobalParams defines parameters for ReplaceAllLogTargetGlobal. +type ReplaceAllLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteLogTargetGlobalParams defines parameters for DeleteLogTargetGlobal. +type DeleteLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetLogTargetGlobalParams defines parameters for GetLogTargetGlobal. +type GetLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateLogTargetGlobalParams defines parameters for CreateLogTargetGlobal. +type CreateLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceLogTargetGlobalParams defines parameters for ReplaceLogTargetGlobal. +type ReplaceLogTargetGlobalParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllLogTargetGlobalJSONRequestBody defines body for ReplaceAllLogTargetGlobal for application/json ContentType. +type ReplaceAllLogTargetGlobalJSONRequestBody = LogTargets + +// CreateLogTargetGlobalJSONRequestBody defines body for CreateLogTargetGlobal for application/json ContentType. +type CreateLogTargetGlobalJSONRequestBody = LogTarget + +// ReplaceLogTargetGlobalJSONRequestBody defines body for ReplaceLogTargetGlobal for application/json ContentType. +type ReplaceLogTargetGlobalJSONRequestBody = LogTarget + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all global Log Targets + // (GET /services/haproxy/configuration/global/log_targets) + GetAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params GetAllLogTargetGlobalParams) + // Replace a global Log Target list + // (PUT /services/haproxy/configuration/global/log_targets) + ReplaceAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params ReplaceAllLogTargetGlobalParams) + // Delete a global Log Target + // (DELETE /services/haproxy/configuration/global/log_targets/{index}) + DeleteLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params DeleteLogTargetGlobalParams) + // Return one global Log Target + // (GET /services/haproxy/configuration/global/log_targets/{index}) + GetLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params GetLogTargetGlobalParams) + // Add a new global Log Target + // (POST /services/haproxy/configuration/global/log_targets/{index}) + CreateLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params CreateLogTargetGlobalParams) + // Replace a global Log Target + // (PUT /services/haproxy/configuration/global/log_targets/{index}) + ReplaceLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params ReplaceLogTargetGlobalParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all global Log Targets +// (GET /services/haproxy/configuration/global/log_targets) +func (_ Unimplemented) GetAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params GetAllLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a global Log Target list +// (PUT /services/haproxy/configuration/global/log_targets) +func (_ Unimplemented) ReplaceAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params ReplaceAllLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a global Log Target +// (DELETE /services/haproxy/configuration/global/log_targets/{index}) +func (_ Unimplemented) DeleteLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params DeleteLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one global Log Target +// (GET /services/haproxy/configuration/global/log_targets/{index}) +func (_ Unimplemented) GetLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params GetLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new global Log Target +// (POST /services/haproxy/configuration/global/log_targets/{index}) +func (_ Unimplemented) CreateLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params CreateLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a global Log Target +// (PUT /services/haproxy/configuration/global/log_targets/{index}) +func (_ Unimplemented) ReplaceLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params ReplaceLogTargetGlobalParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) GetAllLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllLogTargetGlobal(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllLogTargetGlobal(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) DeleteLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteLogTargetGlobal(w, r, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) GetLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetLogTargetGlobal(w, r, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) CreateLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateLogTargetGlobal(w, r, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceLogTargetGlobal operation middleware +func (siw *ServerInterfaceWrapper) ReplaceLogTargetGlobal(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceLogTargetGlobalParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceLogTargetGlobal(w, r, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/global/log_targets", wrapper.GetAllLogTargetGlobal) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/global/log_targets", wrapper.ReplaceAllLogTargetGlobal) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/global/log_targets/{index}", wrapper.DeleteLogTargetGlobal) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/global/log_targets/{index}", wrapper.GetLogTargetGlobal) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/global/log_targets/{index}", wrapper.CreateLogTargetGlobal) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/global/log_targets/{index}", wrapper.ReplaceLogTargetGlobal) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FpRb9s2EP4rB26PduSmwYD5zW26LEAxFF2xl6EIzuRZYkeRKknZMQr/94GkZUux3DRNmriB3xyJ+vjd", + "8e674yFfGDdlZTRp79j4C7PkKqMdxT9cRVzOJEcvjb4qjSDlrrgpS6OvNgub5xNlCcXyzbV0CYob7Un7", + "8BOrSq1hsk/O6AjOCyox/PrV0oyN2S/ZlkqW3rrsThTIWmPZarUaMEGOW1mFr9iYfSgI1kgkwJIzteUE", + "mCgDJc4DVhAKspH9a6NnMq9t3Hj4D1knE+8ucmcZzKQimK/XDlom+mVFbMyct1LngeFqcDfvvkLxnj7X", + "5PyBufYVBocmZofswHOaYa38m2jHYbnwgjRZVJC4HbIT/zL+D1Nr8XOk9wIdaONhFik/ql9Xzeu4mzL5", + "lUebk2+tNtNPxEPOXA9zM1w/TJaevDX5h7S+9Xooy8rYCFGhL9iY5dIX9fSEmzIrsLLmeumJFxlXkrQf", + "avRyTtn8tyyhssBqSyUyk55Kd9shteivBg19tBaXt7B3D07/O+Ll2zze5N5D0g2EpZ6Z3biaaJi8u4SZ", + "sVCixlzqHP6cvAuYkCszRQVvTQ7Ji0DaW0nuhA2Yl14F1s3ic/QI7xRqioDD9mcXEYgNWBOyYxbOz1Sk", + "sZJszF6ejE5esEG0LwZB5sjOJSfXGJjxdgJkiVp2I4bWYd218D352moHqNqmOPAFekBL0CCTAKnBF9QY", + "7ogHjGCtqSjtfCmiTPqJUpvg2phXocWSfMzsf2/yuDwHM4vw3qJ2GLFhUZAlWASJ0B68ARQiLtrseAKv", + "UQfxmBLUjkT4RDfJD9Jt9SYQlWGrzzXZkBEay3BErf2upPiqXnwcdPuu09HowRS2fVg90vl3zTk5N6vV", + "1vbHLkEileZ9lmxck31/wY/aUZcl2uUmOAE1RBULERLidCfzgn55zENcsa0kf1wNWFX3xnylkJMDhEVh", + "FIGSzgfwXWBYSF/EiItrcjknHfJgE8u74b9Gf6YpMLjJeh1oaecglLwg/l8Qyo4mNXz6ybYNbhMedN4U", + "6EB6B2axhdtj0VdCWmpPOdk+Wy5n4MgPQBjAYAsnsKQMivgosF6g9NHKcAItaUzLhoIULu9qIjrgBeqc", + "XFTY1rqgvwEoqgoJENIS92oZwqDj3X1uiDZcJXIdX2xSeYbK0aZZmBqjCHUjdfG28MqI5Y9TubCJtCTY", + "2NuaVk8nsJNeYQGbslmEinw6On0sNl2VTuEByDlVngSgbiKuudLRjb75fYrHy/Nd9dvKzOZb6ImQvgJw", + "lo7jAcW/dV1+mgITTxewp5sLgt9fV0L3yY2gnPRw7cPh1IjlcJ11Aj3Gje7ep2VfpBZ0vUrHpsjT7gGe", + "x+eul3RXc6fLqJcRcrdQJZw7FqnWXpcBthGe2HtvdEeuX3Wz+45ifCyHx3J4UOWwU5hOb2utD0W0T0dn", + "u3gXO8qR1CbWubP0xQNK8GYe9RQin3SuTy73Xhu+elU2mu6pvBfkj7J7+BfxQ72HP7P8XN/ye9Nq/8Xe", + "uJ4UnQgR+iJNi12o3TR8bQmPDdCxATo2QAcwD/i2ccCLR5L53f6IR7H4gXOA4xigGQOcjX5/YPzu/zw8", + "RZGbCLGvMN1nyHD7hPt+neoa6FgjjzXyWCN/kho5erIa+eOH5cciuS2Sz+wSuHcSf68hfNiE7LypU7VV", + "bMyy+Uu2+rj6PwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/log_targets_global/log_targets_global.go b/handlers/configuration/log_targets_global/log_targets_global.go new file mode 100644 index 00000000..8755fab5 --- /dev/null +++ b/handlers/configuration/log_targets_global/log_targets_global.go @@ -0,0 +1,210 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_targets_global + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all global log_target routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy global log_target configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params GetAllLogTargetGlobalParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, logTargets, err := cfg.GetLogTargets("global", "", params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.LogTargets{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, logTargets) +} + +func (h *HandlerImpl) ReplaceAllLogTargetGlobal(w http.ResponseWriter, r *http.Request, params ReplaceAllLogTargetGlobalParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTargets + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceLogTargets("global", "", data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) DeleteLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params DeleteLogTargetGlobalParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteLogTarget(int64(index), "global", "", params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params GetLogTargetGlobalParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, logTarget, err := cfg.GetLogTarget(int64(index), "global", "", params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, logTarget) +} + +func (h *HandlerImpl) CreateLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params CreateLogTargetGlobalParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTarget + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateLogTarget(int64(index), "global", "", &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceLogTargetGlobal(w http.ResponseWriter, r *http.Request, index int, params ReplaceLogTargetGlobalParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data LogTarget + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditLogTarget(int64(index), "global", "", &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/mailers/mailers.gen.go b/handlers/configuration/mailers/mailers.gen.go new file mode 100644 index 00000000..89efa416 --- /dev/null +++ b/handlers/configuration/mailers/mailers.gen.go @@ -0,0 +1,1203 @@ +// Package mailers provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package mailers + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// MailerEntries defines model for mailer_entries. +type MailerEntries = models.MailerEntries + +// MailerEntry defines model for mailer_entry. +type MailerEntry = models.MailerEntry + +// MailersSection defines model for mailers_section. +type MailersSection = models.MailersSection + +// MailersSections defines model for mailers_sections. +type MailersSections = models.MailersSections + +// GetMailerEntriesParams defines parameters for GetMailerEntries. +type GetMailerEntriesParams struct { + // MailersSection Parent mailers section name + MailersSection string `form:"mailers_section" json:"mailers_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateMailerEntryParams defines parameters for CreateMailerEntry. +type CreateMailerEntryParams struct { + // MailersSection Parent mailers section name + MailersSection string `form:"mailers_section" json:"mailers_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteMailerEntryParams defines parameters for DeleteMailerEntry. +type DeleteMailerEntryParams struct { + // MailersSection Parent mailers section name + MailersSection string `form:"mailers_section" json:"mailers_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetMailerEntryParams defines parameters for GetMailerEntry. +type GetMailerEntryParams struct { + // MailersSection Parent mailers section name + MailersSection string `form:"mailers_section" json:"mailers_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceMailerEntryParams defines parameters for ReplaceMailerEntry. +type ReplaceMailerEntryParams struct { + // MailersSection Parent mailers section name + MailersSection string `form:"mailers_section" json:"mailers_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetMailersSectionsParams defines parameters for GetMailersSections. +type GetMailersSectionsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateMailersSectionParams defines parameters for CreateMailersSection. +type CreateMailersSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteMailersSectionParams defines parameters for DeleteMailersSection. +type DeleteMailersSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetMailersSectionParams defines parameters for GetMailersSection. +type GetMailersSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// EditMailersSectionParams defines parameters for EditMailersSection. +type EditMailersSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateMailerEntryJSONRequestBody defines body for CreateMailerEntry for application/json ContentType. +type CreateMailerEntryJSONRequestBody = MailerEntry + +// ReplaceMailerEntryJSONRequestBody defines body for ReplaceMailerEntry for application/json ContentType. +type ReplaceMailerEntryJSONRequestBody = MailerEntry + +// CreateMailersSectionJSONRequestBody defines body for CreateMailersSection for application/json ContentType. +type CreateMailersSectionJSONRequestBody = MailersSection + +// EditMailersSectionJSONRequestBody defines body for EditMailersSection for application/json ContentType. +type EditMailersSectionJSONRequestBody = MailersSection + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of mailer entries + // (GET /services/haproxy/configuration/mailer_entries) + GetMailerEntries(w http.ResponseWriter, r *http.Request, params GetMailerEntriesParams) + // Add a mailer entry + // (POST /services/haproxy/configuration/mailer_entries) + CreateMailerEntry(w http.ResponseWriter, r *http.Request, params CreateMailerEntryParams) + // Delete a mailer entry + // (DELETE /services/haproxy/configuration/mailer_entries/{name}) + DeleteMailerEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteMailerEntryParams) + // Return a mailer entry + // (GET /services/haproxy/configuration/mailer_entries/{name}) + GetMailerEntry(w http.ResponseWriter, r *http.Request, name string, params GetMailerEntryParams) + // Replace a mailer entry + // (PUT /services/haproxy/configuration/mailer_entries/{name}) + ReplaceMailerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplaceMailerEntryParams) + // Return an array of mailers sections + // (GET /services/haproxy/configuration/mailers_section) + GetMailersSections(w http.ResponseWriter, r *http.Request, params GetMailersSectionsParams) + // Add a mailers section + // (POST /services/haproxy/configuration/mailers_section) + CreateMailersSection(w http.ResponseWriter, r *http.Request, params CreateMailersSectionParams) + // Delete a mailers section + // (DELETE /services/haproxy/configuration/mailers_section/{name}) + DeleteMailersSection(w http.ResponseWriter, r *http.Request, name string, params DeleteMailersSectionParams) + // Return a mailers section + // (GET /services/haproxy/configuration/mailers_section/{name}) + GetMailersSection(w http.ResponseWriter, r *http.Request, name string, params GetMailersSectionParams) + // Replace a mailers section + // (PUT /services/haproxy/configuration/mailers_section/{name}) + EditMailersSection(w http.ResponseWriter, r *http.Request, name string, params EditMailersSectionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of mailer entries +// (GET /services/haproxy/configuration/mailer_entries) +func (_ Unimplemented) GetMailerEntries(w http.ResponseWriter, r *http.Request, params GetMailerEntriesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a mailer entry +// (POST /services/haproxy/configuration/mailer_entries) +func (_ Unimplemented) CreateMailerEntry(w http.ResponseWriter, r *http.Request, params CreateMailerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a mailer entry +// (DELETE /services/haproxy/configuration/mailer_entries/{name}) +func (_ Unimplemented) DeleteMailerEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteMailerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a mailer entry +// (GET /services/haproxy/configuration/mailer_entries/{name}) +func (_ Unimplemented) GetMailerEntry(w http.ResponseWriter, r *http.Request, name string, params GetMailerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a mailer entry +// (PUT /services/haproxy/configuration/mailer_entries/{name}) +func (_ Unimplemented) ReplaceMailerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplaceMailerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of mailers sections +// (GET /services/haproxy/configuration/mailers_section) +func (_ Unimplemented) GetMailersSections(w http.ResponseWriter, r *http.Request, params GetMailersSectionsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a mailers section +// (POST /services/haproxy/configuration/mailers_section) +func (_ Unimplemented) CreateMailersSection(w http.ResponseWriter, r *http.Request, params CreateMailersSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a mailers section +// (DELETE /services/haproxy/configuration/mailers_section/{name}) +func (_ Unimplemented) DeleteMailersSection(w http.ResponseWriter, r *http.Request, name string, params DeleteMailersSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a mailers section +// (GET /services/haproxy/configuration/mailers_section/{name}) +func (_ Unimplemented) GetMailersSection(w http.ResponseWriter, r *http.Request, name string, params GetMailersSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a mailers section +// (PUT /services/haproxy/configuration/mailers_section/{name}) +func (_ Unimplemented) EditMailersSection(w http.ResponseWriter, r *http.Request, name string, params EditMailersSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetMailerEntries operation middleware +func (siw *ServerInterfaceWrapper) GetMailerEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetMailerEntriesParams + + // ------------- Required query parameter "mailers_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "mailers_section", r.URL.Query(), ¶ms.MailersSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "mailers_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "mailers_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetMailerEntries(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateMailerEntry operation middleware +func (siw *ServerInterfaceWrapper) CreateMailerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateMailerEntryParams + + // ------------- Required query parameter "mailers_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "mailers_section", r.URL.Query(), ¶ms.MailersSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "mailers_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "mailers_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateMailerEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteMailerEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteMailerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteMailerEntryParams + + // ------------- Required query parameter "mailers_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "mailers_section", r.URL.Query(), ¶ms.MailersSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "mailers_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "mailers_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteMailerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetMailerEntry operation middleware +func (siw *ServerInterfaceWrapper) GetMailerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetMailerEntryParams + + // ------------- Required query parameter "mailers_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "mailers_section", r.URL.Query(), ¶ms.MailersSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "mailers_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "mailers_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetMailerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceMailerEntry operation middleware +func (siw *ServerInterfaceWrapper) ReplaceMailerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceMailerEntryParams + + // ------------- Required query parameter "mailers_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "mailers_section", r.URL.Query(), ¶ms.MailersSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "mailers_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "mailers_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceMailerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetMailersSections operation middleware +func (siw *ServerInterfaceWrapper) GetMailersSections(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetMailersSectionsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetMailersSections(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateMailersSection operation middleware +func (siw *ServerInterfaceWrapper) CreateMailersSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateMailersSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateMailersSection(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteMailersSection operation middleware +func (siw *ServerInterfaceWrapper) DeleteMailersSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteMailersSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteMailersSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetMailersSection operation middleware +func (siw *ServerInterfaceWrapper) GetMailersSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetMailersSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetMailersSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// EditMailersSection operation middleware +func (siw *ServerInterfaceWrapper) EditMailersSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params EditMailersSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.EditMailersSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/mailer_entries", wrapper.GetMailerEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/mailer_entries", wrapper.CreateMailerEntry) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/mailer_entries/{name}", wrapper.DeleteMailerEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/mailer_entries/{name}", wrapper.GetMailerEntry) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/mailer_entries/{name}", wrapper.ReplaceMailerEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/mailers_section", wrapper.GetMailersSections) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/mailers_section", wrapper.CreateMailersSection) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/mailers_section/{name}", wrapper.DeleteMailersSection) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/mailers_section/{name}", wrapper.GetMailersSection) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/mailers_section/{name}", wrapper.EditMailersSection) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fpbb9s4E/0rBL/vUbbctFhg/ZY22d08dBG0i31ZFMaYHNnsSqRKUnGNwv99QVKyJN+d2LlVb4kskXPh", + "nHM0ox+UqSxXEqU1dPiDajS5kgb9PyZHJhLBwAolR5nimJoRU1mm5Gh5Y3X9MtUIfH79XZiwFFPSorTu", + "T8jztFwm/mqU9IuzKWbg/vq/xoQO6f/i2pQ4/Grio0xArZWmi8UiohwN0yJ3T9Eh/WuKpFwJOdFoVKEZ", + "EggmEww2R3SKwFF76z8omYhJof3Gvb9RGxHsbq/cuo0kIkVyV94bNVy08xzpkBqrhZw4CxfRcdF9D/wT", + "fivQ2GcW2vfgAhose84BvMIEitReez+eVwh/R4kaUhJse85B/FPZ31Qh+cso7xkYIpUliTf5UeO6qH72", + "u2UgUtQjlFaLgKzCYmb2Bafx2Jwuomob0BrmNKLfexPVK6+FCPU/+ieuy30at/RElivtk5WDndIhnQg7", + "LcZ9prJ4CrlW3+cW2TRmqUBpexKsuMP47pc4rEydRy17arfV+Csyu8+g+ZnMMSODzJbZO9gi87l86MxG", + "HZvs2psj8l05c/qM36M8D8tCBXWnNNcZLGSi1sv4UpLL2xuSKE0ykDARckL+uLx1a5Iy7qSMOwHJy2vE", + "H3TCmhhg+jSiVtjU+VItcQUWyG0KEv02PVKmhUa0QoshdQlVOUrIBR3St/1B/w2NvK/+aMQG9Z1gaCpn", + "49a+8TqETNAGT3ONDCxyOrS6wFVs/IS20NIQkMQfJKISAmna9FGgIWNMlfSBsYrYFp6uRMhFQOUY7Lrh", + "nr/sKvDkoCFD69H2n9V03IJGadciLyFD6lJIh/RbgR4x/LXhWqlH1EkOoWunt4NxtLr9zZWLgfPRapAG", + "wu6zKWokM8ca0rogAOf+pqWvffIBpOOTMZLCIHePyIoPiDB1yPpb3GjsNxJ8J4V8idpS/GIwOBnprpyl", + "DYT6uWAMjUmKtHb/sYUJD4JtmzPL6MT3l4Ee4oosA8dnZaW0CqVdJK70YeJONG3y2pdFRHNlDqrGS84N", + "ASJx1gaZ44vug0aw2ObXruoeWHVrVpcHO+zs+INNkf3rYLIFz5U9m41tOtw0OGr9MgVDhDVEzerltni0", + "o4SEtDhBvTEDCTFoI8IVAecLQ6IxVcD9JWf1DIT1XroMVA56Re1u63FMYX6si2AIm4KcoCGifR9o9Lt6", + "IENOuNDIbOqLoRXdbWHwPoyCca1YLKEjgdTgUkiNlUoRZIWu/p31veLzcwDrPMBqu2AWa6D+5ox7t7P/", + "saVpPHhwp0kuBhePZkObDcKxIMAY5ha5V14hmVVDAVfe2j6Fc3hztU40NbwsnyUbTsYmonkXqPWEJNNo", + "1vj1fz3x+u1W21Nw5SXnBFoUto0cncZniuMEZa9MTW+s+LxXFjEHC37x4xRw/MM9vwgHIUWLh7Dvlb/T", + "rFhOEq2y3fRLxnNPlOs0HJY8goZbddgkX//as8S28pcHEG7H9x3fd3zf4PsW8V7se1d5Lux0MXi3vl4L", + "RAL+8UA1707MAcuO71OwTADXA4lmER3bElEST0cErSZIxwJdr+UwSfwcOi2vDDWqPs6hqJEXB6JGngJb", + "V4+O5e4HGeWKHWx04rETj12zaG+zaPA0zSIdYKrrFj1St+iVkbE/PE/TLGp9G/DAeWkD4VZY0ex4GWiO", + "5ncy+8tkvBvJ3RFxcB2Mr9A6SZBZsyKM2FSk9ec5xqH9DNN0G2AXadpQEw962z81cja+7+imp3ump3Wd", + "rFW9edjstNal5fiUrcVr99y08RXQKyzOTo6+Sjn6kkD4XKq58ZncU0xZV7bfpJ1rbDrrrHWnJd249TWO", + "W5cnaxOdnktAn2TcWtfEstHeZqLx3LPI/knrocT9cUf/6tQts04kdCKhG3iedeBZF/JPM/PcifYPGXk2", + "BMrhGLzW1+gAuGuhnEG5dlPRc09F9+HKfYei94KVay46XOmEXSfsuu7PGbo/g6fs/px3eNq1f362+ekp", + "uj9uA9R3FbMWOqVDGt+9pYsvi/8CAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/mailers/mailers.go b/handlers/configuration/mailers/mailers.go new file mode 100644 index 00000000..840e52e5 --- /dev/null +++ b/handlers/configuration/mailers/mailers.go @@ -0,0 +1,317 @@ +// Copyright 2024 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mailers + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all mailers routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy mailers configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Mailer Entry handlers --- + +func (h *HandlerImpl) GetMailerEntries(w http.ResponseWriter, r *http.Request, params GetMailerEntriesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, entries, err := cfg.GetMailerEntries(params.MailersSection, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, entries) +} + +func (h *HandlerImpl) CreateMailerEntry(w http.ResponseWriter, r *http.Request, params CreateMailerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data MailerEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateMailerEntry(params.MailersSection, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteMailerEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteMailerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteMailerEntry(name, params.MailersSection, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetMailerEntry(w http.ResponseWriter, r *http.Request, name string, params GetMailerEntryParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, entry, err := cfg.GetMailerEntry(name, params.MailersSection, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, entry) +} + +func (h *HandlerImpl) ReplaceMailerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplaceMailerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data MailerEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditMailerEntry(name, params.MailersSection, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// --- Mailers Section handlers --- + +func (h *HandlerImpl) GetMailersSections(w http.ResponseWriter, r *http.Request, params GetMailersSectionsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var sections MailersSections + if params.FullSection { + _, sections, err = cfg.GetStructuredMailersSections(params.TransactionId) + } else { + _, sections, err = cfg.GetMailersSections(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, sections) +} + +func (h *HandlerImpl) CreateMailersSection(w http.ResponseWriter, r *http.Request, params CreateMailersSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data MailersSection + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredMailersSection(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateMailersSection(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteMailersSection(w http.ResponseWriter, r *http.Request, name string, params DeleteMailersSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteMailersSection(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetMailersSection(w http.ResponseWriter, r *http.Request, name string, params GetMailersSectionParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var section *MailersSection + if params.FullSection { + _, section, err = cfg.GetStructuredMailersSection(name, params.TransactionId) + } else { + _, section, err = cfg.GetMailersSection(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, section) +} + +func (h *HandlerImpl) EditMailersSection(w http.ResponseWriter, r *http.Request, name string, params EditMailersSectionParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data MailersSection + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredMailersSection(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditMailersSection(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/peers/peers.gen.go b/handlers/configuration/peers/peers.gen.go new file mode 100644 index 00000000..ce2bb71e --- /dev/null +++ b/handlers/configuration/peers/peers.gen.go @@ -0,0 +1,1091 @@ +// Package peers provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package peers + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// PeerEntries defines model for peer_entries. +type PeerEntries = models.PeerEntries + +// PeerEntry defines model for peer_entry. +type PeerEntry = models.PeerEntry + +// PeerSection defines model for peer_section. +type PeerSection = models.PeerSection + +// PeerSections defines model for peer_sections. +type PeerSections = models.PeerSections + +// GetPeerEntriesParams defines parameters for GetPeerEntries. +type GetPeerEntriesParams struct { + // PeerSection Parent peer section name + PeerSection string `form:"peer_section" json:"peer_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreatePeerEntryParams defines parameters for CreatePeerEntry. +type CreatePeerEntryParams struct { + // PeerSection Parent peer section name + PeerSection string `form:"peer_section" json:"peer_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeletePeerEntryParams defines parameters for DeletePeerEntry. +type DeletePeerEntryParams struct { + // PeerSection Parent peer section name + PeerSection string `form:"peer_section" json:"peer_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetPeerEntryParams defines parameters for GetPeerEntry. +type GetPeerEntryParams struct { + // PeerSection Parent peer section name + PeerSection string `form:"peer_section" json:"peer_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplacePeerEntryParams defines parameters for ReplacePeerEntry. +type ReplacePeerEntryParams struct { + // PeerSection Parent peer section name + PeerSection string `form:"peer_section" json:"peer_section"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetPeerSectionsParams defines parameters for GetPeerSections. +type GetPeerSectionsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreatePeerParams defines parameters for CreatePeer. +type CreatePeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeletePeerParams defines parameters for DeletePeer. +type DeletePeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetPeerSectionParams defines parameters for GetPeerSection. +type GetPeerSectionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreatePeerEntryJSONRequestBody defines body for CreatePeerEntry for application/json ContentType. +type CreatePeerEntryJSONRequestBody = PeerEntry + +// ReplacePeerEntryJSONRequestBody defines body for ReplacePeerEntry for application/json ContentType. +type ReplacePeerEntryJSONRequestBody = PeerEntry + +// CreatePeerJSONRequestBody defines body for CreatePeer for application/json ContentType. +type CreatePeerJSONRequestBody = PeerSection + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of peer entries + // (GET /services/haproxy/configuration/peer_entries) + GetPeerEntries(w http.ResponseWriter, r *http.Request, params GetPeerEntriesParams) + // Add a peer entry + // (POST /services/haproxy/configuration/peer_entries) + CreatePeerEntry(w http.ResponseWriter, r *http.Request, params CreatePeerEntryParams) + // Delete a peer entry + // (DELETE /services/haproxy/configuration/peer_entries/{name}) + DeletePeerEntry(w http.ResponseWriter, r *http.Request, name string, params DeletePeerEntryParams) + // Return a peer entry + // (GET /services/haproxy/configuration/peer_entries/{name}) + GetPeerEntry(w http.ResponseWriter, r *http.Request, name string, params GetPeerEntryParams) + // Replace a peer entry + // (PUT /services/haproxy/configuration/peer_entries/{name}) + ReplacePeerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplacePeerEntryParams) + // Return an array of peer sections + // (GET /services/haproxy/configuration/peer_section) + GetPeerSections(w http.ResponseWriter, r *http.Request, params GetPeerSectionsParams) + // Add a peer section + // (POST /services/haproxy/configuration/peer_section) + CreatePeer(w http.ResponseWriter, r *http.Request, params CreatePeerParams) + // Delete a peer section + // (DELETE /services/haproxy/configuration/peer_section/{name}) + DeletePeer(w http.ResponseWriter, r *http.Request, name string, params DeletePeerParams) + // Return a peer section + // (GET /services/haproxy/configuration/peer_section/{name}) + GetPeerSection(w http.ResponseWriter, r *http.Request, name string, params GetPeerSectionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of peer entries +// (GET /services/haproxy/configuration/peer_entries) +func (_ Unimplemented) GetPeerEntries(w http.ResponseWriter, r *http.Request, params GetPeerEntriesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a peer entry +// (POST /services/haproxy/configuration/peer_entries) +func (_ Unimplemented) CreatePeerEntry(w http.ResponseWriter, r *http.Request, params CreatePeerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a peer entry +// (DELETE /services/haproxy/configuration/peer_entries/{name}) +func (_ Unimplemented) DeletePeerEntry(w http.ResponseWriter, r *http.Request, name string, params DeletePeerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a peer entry +// (GET /services/haproxy/configuration/peer_entries/{name}) +func (_ Unimplemented) GetPeerEntry(w http.ResponseWriter, r *http.Request, name string, params GetPeerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a peer entry +// (PUT /services/haproxy/configuration/peer_entries/{name}) +func (_ Unimplemented) ReplacePeerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplacePeerEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of peer sections +// (GET /services/haproxy/configuration/peer_section) +func (_ Unimplemented) GetPeerSections(w http.ResponseWriter, r *http.Request, params GetPeerSectionsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a peer section +// (POST /services/haproxy/configuration/peer_section) +func (_ Unimplemented) CreatePeer(w http.ResponseWriter, r *http.Request, params CreatePeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a peer section +// (DELETE /services/haproxy/configuration/peer_section/{name}) +func (_ Unimplemented) DeletePeer(w http.ResponseWriter, r *http.Request, name string, params DeletePeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a peer section +// (GET /services/haproxy/configuration/peer_section/{name}) +func (_ Unimplemented) GetPeerSection(w http.ResponseWriter, r *http.Request, name string, params GetPeerSectionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetPeerEntries operation middleware +func (siw *ServerInterfaceWrapper) GetPeerEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetPeerEntriesParams + + // ------------- Required query parameter "peer_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "peer_section", r.URL.Query(), ¶ms.PeerSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "peer_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "peer_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPeerEntries(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreatePeerEntry operation middleware +func (siw *ServerInterfaceWrapper) CreatePeerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreatePeerEntryParams + + // ------------- Required query parameter "peer_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "peer_section", r.URL.Query(), ¶ms.PeerSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "peer_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "peer_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreatePeerEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeletePeerEntry operation middleware +func (siw *ServerInterfaceWrapper) DeletePeerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeletePeerEntryParams + + // ------------- Required query parameter "peer_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "peer_section", r.URL.Query(), ¶ms.PeerSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "peer_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "peer_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeletePeerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetPeerEntry operation middleware +func (siw *ServerInterfaceWrapper) GetPeerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetPeerEntryParams + + // ------------- Required query parameter "peer_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "peer_section", r.URL.Query(), ¶ms.PeerSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "peer_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "peer_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPeerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplacePeerEntry operation middleware +func (siw *ServerInterfaceWrapper) ReplacePeerEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplacePeerEntryParams + + // ------------- Required query parameter "peer_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "peer_section", r.URL.Query(), ¶ms.PeerSection, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "peer_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "peer_section", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplacePeerEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetPeerSections operation middleware +func (siw *ServerInterfaceWrapper) GetPeerSections(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetPeerSectionsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPeerSections(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreatePeer operation middleware +func (siw *ServerInterfaceWrapper) CreatePeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreatePeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreatePeer(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeletePeer operation middleware +func (siw *ServerInterfaceWrapper) DeletePeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeletePeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeletePeer(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetPeerSection operation middleware +func (siw *ServerInterfaceWrapper) GetPeerSection(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetPeerSectionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPeerSection(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peer_entries", wrapper.GetPeerEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peer_entries", wrapper.CreatePeerEntry) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peer_entries/{name}", wrapper.DeletePeerEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peer_entries/{name}", wrapper.GetPeerEntry) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peer_entries/{name}", wrapper.ReplacePeerEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peer_section", wrapper.GetPeerSections) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peer_section", wrapper.CreatePeer) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peer_section/{name}", wrapper.DeletePeer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peer_section/{name}", wrapper.GetPeerSection) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FpLbxs3EP4rBNvjSus4QYHq5sRp60thJEUvRWCMyFmJKZfckFwrQqD/XpDcp16RHMlx3L3Zu0vOgzPf", + "N5zRF8p0XmiFylk6+UIN2kIri+EfWyATmWDghFZ3ueYo7R3Tea7VXfNh/fxKGgS+fPtZ2LgV08qhcv5P", + "KApZbZN+tFqFzdkcc/B//WwwoxP6U9qqksa3Nj1KBTRGG7parRLK0TIjCr+KTuhfcyTVTsiJQatLw5BA", + "VJlg1DmhcwSOJmj/RqtMzEoTBI/+RmNF1Lu/c+8zkgmJ5L76NumY6JYF0gm1zgg18xqukuO8+xr4O/xU", + "onVPzLWvwTs0avaUHXiNGZTSvQ12PC0X/o4KDUgSdXvKTvxTu990qfiPkd4LsERpR7Kg8qP6dVW/DtIK", + "RHOHyhkRcVU4zO3XXNMsWtJVUosAY2BJE/p5NNOj6ln0zvgW0bytZHQ+GIm80CYcUwFuTid0Jty8nI6Z", + "ztM5FEZ/Xjpk85RJgcqNFDhxj+n9L2ncl3pbOrq05urpR2RuvzLL86hikbnqwA5U5n214pzqHHm2tREH", + "n+77WsypjXhAFh7m+RrRTqmuV1ioTG9m65UiV7c3JNOG5KBgJtSM/HF16/ck3uOk8jgBxeODENKEdbPc", + "jmlCnXDSm1GvvgYH5FaCwiBhRPxx+HOo0WBC/THqAhUUgk7oy/HF+AVNgpEhGlKL5l4wtLWVaU9qug4R", + "M3SbBr5DVxplCSgSQoXojICUrS0CLZmi1CrY7jRxPWTsOsGbqQuM4m94oCHXx5ACDOToAmT+s67LLRhU", + "ru9XBTlSfzp0Qj+VGLI/PJv00zahvmIQBjmdOFPiPixN1gXfXHuzvWHOgLIQRS/maJAsPOgr5y0HzsNH", + "jY1j8gaUp4MpktIi90tUDedE2NZP4x02dOTdCb6XAT4k/Ur68uLiZJzZC5UtbPi+ZAytzUrZGv/YVQWP", + "1dYuUxrfpA+v4QJwlXkOnpSq1OhlRjcrfE7DzMcxbanpg8dvbbck2hXnlgBRuOjixJH59MYgOOwy4ZBQ", + "D06oDa2rqI2SPeSzObJ/Pez1gLXWZ7uyXYO7Cie9N3OwRDhL9KLdbodFe/JDKIczNFtPICMWXUK4JuBt", + "YUgMSg08PPJaL0C4YKU/gdrAUOv6z0YcJSyPNREsYXNQM7RE9L8Dg0FqwCjkhAuDzMmQAT3v7nJDsOEu", + "KtfzRYMLGUiLTeEz1VoiqBo4w23ytebL02PmMiJmP11WG2j94myS15K+U4UEuOC+jri8uHwk+X2Ij+FA", + "gDEsHPJQJ8VDrK/4uHaPehfj7+Z6E0NbWGnWki0RsY09XkW2PCFzdNonYf9fT7x/v/n1PQjwinMCHbba", + "zni+FGea4wzVqDqW0VTz5ahKXA4OwsbH1KvpF796FUNAosPNYLgOz21PQ5IZne9hVDJdBgLcZNa42+HM", + "2orsEmq4gDSQVb35Bh4dCHwg8IHAN28+l1+7WTwV2rm8eLW5Xwc8IrjxyCCvTgztTWv1e5BHBNQD+GOV", + "7O9MaIUnQfhOL2KA96Hhsa+EfQrtjmcGB3Uz5RA4KMqtcFBIYOv1niepB2BBtdmAB0O5N5R7Q79ma7/m", + "4vH7NSbC0tCweZSGzTPj1xA6j96v6YzNj5ovdgCsS3d2Z93emVTvpeofk8puFPcx4HE4Kl/DcJYhc3at", + "yGFzIdsfpVgP4wuUchcSl1J2yoRvunifGBSbXzkMM8f9M0fbRn83pY+YN9b1ZDVxZBtO2TdtfJ5JN9SP", + "z7J+/JHA9UxlbvM7sO8wmOzJ3lLq1kB0zuHkHh2G8eQzHE+2Cdhnx7PUusfPJuuQb3rXfX6ZLgM3fG0w", + "eVCTalvb6NRtqoHtB7YfhoPnHA7WWfx/GQ/uwu+DZ4NNUXE4sPb7CgO4Dv2Lk9aZwwzxzDPEnZgRFqG5", + "rxO5NJJOaHr/kq4+rP4LAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/peers/peers.go b/handlers/configuration/peers/peers.go new file mode 100644 index 00000000..0a2e8a6a --- /dev/null +++ b/handlers/configuration/peers/peers.go @@ -0,0 +1,279 @@ +// Copyright 2024 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package peers + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all peers routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy peers configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Peer Entry handlers --- + +func (h *HandlerImpl) GetPeerEntries(w http.ResponseWriter, r *http.Request, params GetPeerEntriesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, entries, err := cfg.GetPeerEntries(params.PeerSection, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, entries) +} + +func (h *HandlerImpl) CreatePeerEntry(w http.ResponseWriter, r *http.Request, params CreatePeerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data PeerEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreatePeerEntry(params.PeerSection, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeletePeerEntry(w http.ResponseWriter, r *http.Request, name string, params DeletePeerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeletePeerEntry(name, params.PeerSection, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetPeerEntry(w http.ResponseWriter, r *http.Request, name string, params GetPeerEntryParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, entry, err := cfg.GetPeerEntry(name, params.PeerSection, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, entry) +} + +func (h *HandlerImpl) ReplacePeerEntry(w http.ResponseWriter, r *http.Request, name string, params ReplacePeerEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data PeerEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditPeerEntry(name, params.PeerSection, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// --- Peer Section handlers --- + +func (h *HandlerImpl) GetPeerSections(w http.ResponseWriter, r *http.Request, params GetPeerSectionsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var sections PeerSections + if params.FullSection { + _, sections, err = cfg.GetStructuredPeerSections(params.TransactionId) + } else { + _, sections, err = cfg.GetPeerSections(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, sections) +} + +func (h *HandlerImpl) CreatePeer(w http.ResponseWriter, r *http.Request, params CreatePeerParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data PeerSection + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredPeerSection(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreatePeerSection(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeletePeer(w http.ResponseWriter, r *http.Request, name string, params DeletePeerParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeletePeerSection(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetPeerSection(w http.ResponseWriter, r *http.Request, name string, params GetPeerSectionParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var section *PeerSection + if params.FullSection { + _, section, err = cfg.GetStructuredPeerSection(name, params.TransactionId) + } else { + _, section, err = cfg.GetPeerSection(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, section) +} diff --git a/handlers/configuration/program/program.gen.go b/handlers/configuration/program/program.gen.go new file mode 100644 index 00000000..3dfb47cf --- /dev/null +++ b/handlers/configuration/program/program.gen.go @@ -0,0 +1,663 @@ +// Package program provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package program + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Program defines model for program. +type Program = models.Program + +// Programs defines model for programs. +type Programs = models.Programs + +// GetProgramsParams defines parameters for GetPrograms. +type GetProgramsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateProgramParams defines parameters for CreateProgram. +type CreateProgramParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteProgramParams defines parameters for DeleteProgram. +type DeleteProgramParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetProgramParams defines parameters for GetProgram. +type GetProgramParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceProgramParams defines parameters for ReplaceProgram. +type ReplaceProgramParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateProgramJSONRequestBody defines body for CreateProgram for application/json ContentType. +type CreateProgramJSONRequestBody = Program + +// ReplaceProgramJSONRequestBody defines body for ReplaceProgram for application/json ContentType. +type ReplaceProgramJSONRequestBody = Program + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of programs + // (GET /services/haproxy/configuration/programs) + GetPrograms(w http.ResponseWriter, r *http.Request, params GetProgramsParams) + // Add a program + // (POST /services/haproxy/configuration/programs) + CreateProgram(w http.ResponseWriter, r *http.Request, params CreateProgramParams) + // Delete a program + // (DELETE /services/haproxy/configuration/programs/{name}) + DeleteProgram(w http.ResponseWriter, r *http.Request, name string, params DeleteProgramParams) + // Return a program + // (GET /services/haproxy/configuration/programs/{name}) + GetProgram(w http.ResponseWriter, r *http.Request, name string, params GetProgramParams) + // Replace a program + // (PUT /services/haproxy/configuration/programs/{name}) + ReplaceProgram(w http.ResponseWriter, r *http.Request, name string, params ReplaceProgramParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of programs +// (GET /services/haproxy/configuration/programs) +func (_ Unimplemented) GetPrograms(w http.ResponseWriter, r *http.Request, params GetProgramsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a program +// (POST /services/haproxy/configuration/programs) +func (_ Unimplemented) CreateProgram(w http.ResponseWriter, r *http.Request, params CreateProgramParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a program +// (DELETE /services/haproxy/configuration/programs/{name}) +func (_ Unimplemented) DeleteProgram(w http.ResponseWriter, r *http.Request, name string, params DeleteProgramParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a program +// (GET /services/haproxy/configuration/programs/{name}) +func (_ Unimplemented) GetProgram(w http.ResponseWriter, r *http.Request, name string, params GetProgramParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a program +// (PUT /services/haproxy/configuration/programs/{name}) +func (_ Unimplemented) ReplaceProgram(w http.ResponseWriter, r *http.Request, name string, params ReplaceProgramParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetPrograms operation middleware +func (siw *ServerInterfaceWrapper) GetPrograms(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetProgramsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPrograms(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateProgram operation middleware +func (siw *ServerInterfaceWrapper) CreateProgram(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateProgramParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateProgram(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteProgram operation middleware +func (siw *ServerInterfaceWrapper) DeleteProgram(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteProgramParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteProgram(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetProgram operation middleware +func (siw *ServerInterfaceWrapper) GetProgram(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetProgramParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetProgram(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceProgram operation middleware +func (siw *ServerInterfaceWrapper) ReplaceProgram(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceProgramParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceProgram(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/programs", wrapper.GetPrograms) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/programs", wrapper.CreateProgram) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/programs/{name}", wrapper.DeleteProgram) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/programs/{name}", wrapper.GetProgram) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/programs/{name}", wrapper.ReplaceProgram) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNj9s2EP0rA7ZH2XI2QYH65mTTdg8tjLTopQgWY3JkMZVIhaTsGIH/e0FSkqX9cO2Fs3EC32yJmnkz", + "fPNmyM+M67LSipSzbPqZGbKVVpbCH1sRl5nk6KRWt6UWVNhbrstSq9tuYft8VhhCsXn7SdpoimvlSDn/", + "E6uqaMykH6xWwTjPqUT/60dDGZuyH9IdlDS+telREMgYbdh2u02YIMuNrPxXbMr+ygkaSyTAkNW14QQY", + "IQNFzAnLCQWZgP6NVplc1iY4Hv1NxsqIe2h5sAwyWRCsmrVJL0S3qYhNmXVGqqVHuE2Oy+5rFO/oY03W", + "nVlqX6NPaER2zgm8pgzrwr0NcZxXCn8lRQYLiNjOOYl/aPeLrpX4Nsp7jRaUdpAFyM+a1237OnirjF4a", + "LHtL9eIDcV8wn0ZLPWoexjDH82Z17+VIlpU2IdcVupxN2VK6vF6MuS7THCujP20c8TzlhSTlRgqdXFG6", + "+imNNpkH1KAIiKSj+GPf5rSwt0kLG43BzV7U9uSwn0CRw/Lcltsp4XrAUmX6PpVmCmbzG8i0gRIVLqVa", + "wm+zubcJTaKB9+lmxyxhTrrCQ25XXqNDmBeoKFgbwY4sLTGnzG+YrkhhJdmUvRxPxi9YEkIKW55aMivJ", + "ybYxpQO/aZ8nS3IxlMoQR0eCTZ2p6W4BviNXG2UBFQSKgM4Ai6ILiEQbowWpwOXk/3OydhSSQWYYeyg1", + "H7+uKD65EUEoXY9mFRosyYWK/uduum+uPQbvyBlUFnkwu87JEKy9NCgHTgMKERZ1fsbwBpUXjQVBbUn4", + "T1Rb9CDtTmc8POldfazJ+KJQWPqt6vm7lWKvTrxPhvPW1WRyMmXtdvEBvfyz5j73WV3sAn/uviNiP34s", + "jC4v6dO7fFCPuizRbDqODiha7cjkcOlpxOaRlr9HVrL3Xje1PagIZkJYQFC07gra6Sdz/Y0hdLQr72+f", + "7cld1A2tomcvjDwn/q8XxmGCGjwPg+0H3AecDN7kaEE6C3q9M/dIRHsILJUjz4oHYrnJwJJLQGhAHwsn", + "MFRoFOGRR71G6UKUfgd6whiXjQQVuDk2RLTAc1RLirLaW4eGgtcgICRASEPcFRtPg0F2H0tDiOE2ghvk", + "oivcDAtL3Wiw0LogVK2qhQPBay02pxa0qGfegTRtJW7v6eiLL+N2uOfztm2HUhW+7V5Nrp7D81B3IwUA", + "OafKkQBULavakxndGX/fRc7dXN+X9J2UdN/CAyx4SNJfxfZ1QjnvnXqD/Z9PbH94Z/E1utJMCMC2X+zp", + "Q35M5VrQktSo2ZjRQovNqClXgQ6D6UOnu/Sz/3IbCVCQo0Na3HVYaXeIITO6PLDHwWITNNj7vd/voukD", + "+11beSH4Rr/CyN7JV/NmqBNHdadLT7301PPqqYMOd/V/0/i5dIWryav79toCjtIjorq/OrHsdrdVX0PY", + "o54dpO3b5NhztlbUKXBPVY9R432n64v8ns8B/lzP799Zuba3A4eVa1UfWK5Vgfwp89LeUakxeynWy6x0", + "mZXO8/5h8pz3DybqweUC4stfQHxnPS/w5pT3D94+mVXbiWpTsClLVy/Z9v32vwAAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/program/program.go b/handlers/configuration/program/program.go new file mode 100644 index 00000000..1e5d1953 --- /dev/null +++ b/handlers/configuration/program/program.go @@ -0,0 +1,171 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package program + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all program routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy program configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetPrograms(w http.ResponseWriter, r *http.Request, params GetProgramsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, programs, err := cfg.GetPrograms(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, programs) +} + +func (h *HandlerImpl) CreateProgram(w http.ResponseWriter, r *http.Request, params CreateProgramParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Program + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateProgram(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteProgram(w http.ResponseWriter, r *http.Request, name string, params DeleteProgramParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteProgram(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetProgram(w http.ResponseWriter, r *http.Request, name string, params GetProgramParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, program, err := cfg.GetProgram(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, program) +} + +func (h *HandlerImpl) ReplaceProgram(w http.ResponseWriter, r *http.Request, name string, params ReplaceProgramParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Program + if !respond.DecodeBody(r, w, &data) { + return + } + data.Name = name + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditProgram(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.gen.go b/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.gen.go new file mode 100644 index 00000000..dd564ef8 --- /dev/null +++ b/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.gen.go @@ -0,0 +1,1351 @@ +// Package quic_initial_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package quic_initial_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// QuicInitialRule defines model for quic_initial_rule. +type QuicInitialRule = models.QUICInitialRule + +// QuicInitialRules defines model for quic_initial_rules. +type QuicInitialRules = models.QUICInitialRules + +// GetAllQUICInitialRuleDefaultsParams defines parameters for GetAllQUICInitialRuleDefaults. +type GetAllQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllQUICInitialRuleDefaultsParams defines parameters for ReplaceAllQUICInitialRuleDefaults. +type ReplaceAllQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteQUICInitialRuleDefaultsParams defines parameters for DeleteQUICInitialRuleDefaults. +type DeleteQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetQUICInitialRuleDefaultsParams defines parameters for GetQUICInitialRuleDefaults. +type GetQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateQUICInitialRuleDefaultsParams defines parameters for CreateQUICInitialRuleDefaults. +type CreateQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceQUICInitialRuleDefaultsParams defines parameters for ReplaceQUICInitialRuleDefaults. +type ReplaceQUICInitialRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllQUICInitialRuleFrontendParams defines parameters for GetAllQUICInitialRuleFrontend. +type GetAllQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllQUICInitialRuleFrontendParams defines parameters for ReplaceAllQUICInitialRuleFrontend. +type ReplaceAllQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteQUICInitialRuleFrontendParams defines parameters for DeleteQUICInitialRuleFrontend. +type DeleteQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetQUICInitialRuleFrontendParams defines parameters for GetQUICInitialRuleFrontend. +type GetQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateQUICInitialRuleFrontendParams defines parameters for CreateQUICInitialRuleFrontend. +type CreateQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceQUICInitialRuleFrontendParams defines parameters for ReplaceQUICInitialRuleFrontend. +type ReplaceQUICInitialRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllQUICInitialRuleDefaultsJSONRequestBody defines body for ReplaceAllQUICInitialRuleDefaults for application/json ContentType. +type ReplaceAllQUICInitialRuleDefaultsJSONRequestBody = QuicInitialRules + +// CreateQUICInitialRuleDefaultsJSONRequestBody defines body for CreateQUICInitialRuleDefaults for application/json ContentType. +type CreateQUICInitialRuleDefaultsJSONRequestBody = QuicInitialRule + +// ReplaceQUICInitialRuleDefaultsJSONRequestBody defines body for ReplaceQUICInitialRuleDefaults for application/json ContentType. +type ReplaceQUICInitialRuleDefaultsJSONRequestBody = QuicInitialRule + +// ReplaceAllQUICInitialRuleFrontendJSONRequestBody defines body for ReplaceAllQUICInitialRuleFrontend for application/json ContentType. +type ReplaceAllQUICInitialRuleFrontendJSONRequestBody = QuicInitialRules + +// CreateQUICInitialRuleFrontendJSONRequestBody defines body for CreateQUICInitialRuleFrontend for application/json ContentType. +type CreateQUICInitialRuleFrontendJSONRequestBody = QuicInitialRule + +// ReplaceQUICInitialRuleFrontendJSONRequestBody defines body for ReplaceQUICInitialRuleFrontend for application/json ContentType. +type ReplaceQUICInitialRuleFrontendJSONRequestBody = QuicInitialRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all QUIC Initial Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules) + GetAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleDefaultsParams) + // Replace a QUIC Initial Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules) + ReplaceAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleDefaultsParams) + // Delete a QUIC Initial Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) + DeleteQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleDefaultsParams) + // Return one QUIC Initial Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) + GetQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleDefaultsParams) + // Add a new QUIC Initial Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) + CreateQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleDefaultsParams) + // Replace a QUIC Initial Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) + ReplaceQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleDefaultsParams) + // Return an array of all QUIC Initial Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules) + GetAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleFrontendParams) + // Replace a QUIC Initial Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules) + ReplaceAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleFrontendParams) + // Delete a QUIC Initial Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) + DeleteQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleFrontendParams) + // Return one QUIC Initial Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) + GetQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleFrontendParams) + // Add a new QUIC Initial Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) + CreateQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleFrontendParams) + // Replace a QUIC Initial Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) + ReplaceQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all QUIC Initial Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules) +func (_ Unimplemented) GetAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a QUIC Initial Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules) +func (_ Unimplemented) ReplaceAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a QUIC Initial Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) DeleteQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one QUIC Initial Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) GetQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new QUIC Initial Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) CreateQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a QUIC Initial Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) ReplaceQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all QUIC Initial Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules) +func (_ Unimplemented) GetAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a QUIC Initial Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules) +func (_ Unimplemented) ReplaceAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a QUIC Initial Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) DeleteQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one QUIC Initial Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) GetQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new QUIC Initial Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) CreateQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a QUIC Initial Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}) +func (_ Unimplemented) ReplaceQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllQUICInitialRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllQUICInitialRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteQUICInitialRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetQUICInitialRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateQUICInitialRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceQUICInitialRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceQUICInitialRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceQUICInitialRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllQUICInitialRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllQUICInitialRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteQUICInitialRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetQUICInitialRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateQUICInitialRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceQUICInitialRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceQUICInitialRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceQUICInitialRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules", wrapper.GetAllQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules", wrapper.ReplaceAllQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}", wrapper.DeleteQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}", wrapper.GetQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}", wrapper.CreateQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}", wrapper.ReplaceQUICInitialRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules", wrapper.GetAllQUICInitialRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules", wrapper.ReplaceAllQUICInitialRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}", wrapper.DeleteQUICInitialRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}", wrapper.GetQUICInitialRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}", wrapper.CreateQUICInitialRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}", wrapper.ReplaceQUICInitialRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fpbb9u4Ev4rBNunc+TITYMCx+fJTdpuXhbZ7OWlSY0JObLYlUiVpOIYgf/7gpTkSyzHTtaxvVm+BI7N", + "y8xw5vs+UXNPmcoLJVFaQ3v3VKMplDTo/zEFMpEIBlYoOcgVx8wMmMpzJQfTgc33/Uwj8PGnO2GqpZiS", + "FqV1H6EosnqZ+LtR0i/OUszBfXqrMaE9+iaemRJXv5r4SSag1krTyWQSUY6GaVG4WbRHf0uR1CshJxqN", + "KjVDApXJBCubI5oicNTe+lMlEzEstd+48wdqIyq7F1deGEYSkSG5rcdGcy7acYG0R43VQg6dhZPoadH9", + "CPwSf5Ro7IGF9iO4gFaWHXIAzzCBMrOfvB+HFcIvKFFDRirbDjmIPyv7WZWS/zPKewSGSGVJ4k3eaVwn", + "zc9+tx+lYAMhhRWQDXSZ4dwkdfMdmSudu85QdeovK4ePfvn9/PS8mnbpZs0N6oi8UNpHvwCb0h4dCpuW", + "N0dM5XEKhVZ3Y4ssjVkmUNqOBCtuMb79EFdrU2fikl3eWmExN+sObtmlSdS4BFrDeCOPzNZdekZCbXYW", + "TXFu01xnsJCJWk68viT9i3OSKE1ykDAUckh+6l+4NYmLIamDSHwUj2hErbAur2gz6gwskIsMJPqVOsvT", + "aESbZO5Rd3yqQAmFoD36/qh79I5G3jGfCrFBfSsYmsazmM2XRswrdDXxfQEapR1IyHEStyfYEO2yx5do", + "Sy0NgSxr8ZDYFCwBjaTZFzkRcq7qa3z3sVAFVnadcw+vtp9lDzKvGe6d1JCj9cjw9aFZF94d4tyh7rBo", + "rzrtiPqv3H9Tf2lEHRMKjZz2rC5xHiMKsBa1m//t67erK311Ja/Kbvc983/xP/9/+8Z9Ov5wP7mi1/99", + "S6MlWIkeGnd+RlRCbIrEapAGmIepUYoaycjhn7TEKgKc+0HTsByRU5AOGW+QlAa5myIbZCPCzMJ61Dj9", + "o0Q9nnk9t99A8EfB8DpaFJXH3e7W6KMlv1ro4deSMTQmKbNZCHZNs3WBrHJoGqH4+aLGw1+Z56DH03oi", + "IImHY5co7aXlEg2GLvfpQ765nkS0KFuLtciAoSFARqnKkGTCWLdFS+WOhE19+vkxQ3GL0lXutOo8yNkF", + "Bl9dy/XGoZ73V89LVtflUu3sDpOlyP50jLXAEY097cbOOzxvcLTwSwqGCGuIGs2WW+HRI4UppMUh6tYT", + "SIhBGxGuCDhfGBKNmQLuv3JWj0DYacrOkVE1rMMxg/FTXQRDWApyiMZVxvw4x3huIQ+RyAkXGpnNxi4N", + "FqK7Kgzeh0Fl3EIspoCUQGZwmpw3SmUIssFt/1z3UfHxi0P2YqVN9k4a/XYdoisA4k4vHXePd2zUIgFV", + "OUOAMSwscgKyScPmiRwfPPZcVkl6frYM6TPsmc4lLWnTxm0n1eFskdfmbjv2w53+kAksZ4Bnscco0z0h", + "MMVxiLJTR7Jzo/i4UxckBwt+u61J6vheSI53k+pMM7S4fLpn/nvT6tEiSt+MPcL6JUmiVb4xN1d7PJOX", + "l806dxa0c7Sof1rNzuuRPgiBIASCENhYCCxw8fG6R6NDYabj7snyestQU6Gm5/STasYWeWZ6Z7oPJqsw", + "uQ321zz2PXpHoyQ+jUdcMm/IIl/QBgoJd0MvoKgP9WrolUFOffHUihHr7pqUaUGdPudOuEoctYBOneMz", + "ZHERfgrenGqEoFqDag2qNVxfPZ9V1t1evdstrbWIMw9zL39tFW6tmlurk+7/trz+YofVPri9z/kqJv77", + "d2Lr3zW91DNHvUUQAUEEBBEQRMBLiYDuvkXAzl5eBRUwUwGv7OF+5ZuxnbwUS7TPV77HRrPPtQkbNpo1", + "w0NjSmg0C41mB9ZotrqWVzaahXoOIj2I9NBoFhrNQqPZ62g021xT77bTbDU5t3aabUrM4bouKIGgBEKn", + "Weg0+1d0mj16XRMoJFwOhU6z0Gm2xU6z1XjT2mkWICeo1qBaw/1V6DQL75hDp9kr6TRb+1opiIAgAoII", + "CCIgdJoFFRA6zfbQaea2Qn3b0GypM9qj8e17Orme/BUAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.go b/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.go new file mode 100644 index 00000000..bd7258a4 --- /dev/null +++ b/handlers/configuration/quic/quic_initial_rule/quic_initial_rule.go @@ -0,0 +1,263 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package quic_initial_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all QUIC initial rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy QUIC initial rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Defaults parent --- + +func (h *HandlerImpl) GetAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleDefaultsParams) { + h.getAllQUICInitialRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleDefaultsParams) { + h.replaceAllQUICInitialRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleDefaultsParams) { + h.deleteQUICInitialRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleDefaultsParams) { + h.getQUICInitialRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleDefaultsParams) { + h.createQUICInitialRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceQUICInitialRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleDefaultsParams) { + h.replaceQUICInitialRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend parent --- + +func (h *HandlerImpl) GetAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllQUICInitialRuleFrontendParams) { + h.getAllQUICInitialRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllQUICInitialRuleFrontendParams) { + h.replaceAllQUICInitialRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteQUICInitialRuleFrontendParams) { + h.deleteQUICInitialRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetQUICInitialRuleFrontendParams) { + h.getQUICInitialRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateQUICInitialRuleFrontendParams) { + h.createQUICInitialRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceQUICInitialRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceQUICInitialRuleFrontendParams) { + h.replaceQUICInitialRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared internal methods --- + +func (h *HandlerImpl) getAllQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetQUICInitialRules(parentType, parentName, transactionID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, QuicInitialRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) replaceAllQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data QuicInitialRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceQUICInitialRules(parentType, parentName, data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteQUICInitialRule(int64(index), parentType, parentName, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetQUICInitialRule(int64(index), parentType, parentName, transactionID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data QuicInitialRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateQUICInitialRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceQUICInitialRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data QuicInitialRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditQUICInitialRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/raw/raw.gen.go b/handlers/configuration/raw/raw.gen.go new file mode 100644 index 00000000..1cfaf08b --- /dev/null +++ b/handlers/configuration/raw/raw.gen.go @@ -0,0 +1,482 @@ +// Package raw provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package raw + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/oapi-codegen/runtime" +) + +// GetHAProxyConfigurationParams defines parameters for GetHAProxyConfiguration. +type GetHAProxyConfigurationParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// PostHAProxyConfigurationTextBody defines parameters for PostHAProxyConfiguration. +type PostHAProxyConfigurationTextBody = string + +// PostHAProxyConfigurationParams defines parameters for PostHAProxyConfiguration. +type PostHAProxyConfigurationParams struct { + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // SkipVersion If set, no version check will be done and the pushed configuration will be applied directly. + SkipVersion bool `form:"skip_version,omitempty" json:"skip_version,omitempty,omitzero"` + + // SkipReload If set, HAProxy will not be reloaded after the configuration is pushed. + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // OnlyValidate If set, the configuration will only be validated and not applied. + OnlyValidate bool `form:"only_validate,omitempty" json:"only_validate,omitempty,omitzero"` + + // XRuntimeActions List of runtime actions to execute after the configuration is applied. + XRuntimeActions string `json:"X-Runtime-Actions,omitempty,omitzero"` +} + +// PostHAProxyConfigurationTextRequestBody defines body for PostHAProxyConfiguration for text/plain ContentType. +type PostHAProxyConfigurationTextRequestBody = PostHAProxyConfigurationTextBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return HAProxy configuration as a plain text + // (GET /services/haproxy/configuration/raw) + GetHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params GetHAProxyConfigurationParams) + // Push new haproxy configuration + // (POST /services/haproxy/configuration/raw) + PostHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params PostHAProxyConfigurationParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return HAProxy configuration as a plain text +// (GET /services/haproxy/configuration/raw) +func (_ Unimplemented) GetHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params GetHAProxyConfigurationParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Push new haproxy configuration +// (POST /services/haproxy/configuration/raw) +func (_ Unimplemented) PostHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params PostHAProxyConfigurationParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetHAProxyConfiguration operation middleware +func (siw *ServerInterfaceWrapper) GetHAProxyConfiguration(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetHAProxyConfigurationParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHAProxyConfiguration(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// PostHAProxyConfiguration operation middleware +func (siw *ServerInterfaceWrapper) PostHAProxyConfiguration(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params PostHAProxyConfigurationParams + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "skip_version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_version", r.URL.Query(), ¶ms.SkipVersion, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_version", Err: err}) + } + return + } + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "only_validate" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "only_validate", r.URL.Query(), ¶ms.OnlyValidate, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "only_validate"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "only_validate", Err: err}) + } + return + } + + headers := r.Header + + // ------------- Optional header parameter "X-Runtime-Actions" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("X-Runtime-Actions")]; found { + var XRuntimeActions string + n := len(valueList) + if n != 1 { + siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "X-Runtime-Actions", Count: n}) + return + } + + err = runtime.BindStyledParameterWithOptions("simple", "X-Runtime-Actions", valueList[0], &XRuntimeActions, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "X-Runtime-Actions", Err: err}) + return + } + + params.XRuntimeActions = XRuntimeActions + + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.PostHAProxyConfiguration(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/raw", wrapper.GetHAProxyConfiguration) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/raw", wrapper.PostHAProxyConfiguration) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FdNb+M2EP0rA7ZHycpm2x58yyZFG6AoghQoChSBMSFHEncpUktSVoyF/3tBUrItf6FOgxYF9mZLw+F7", + "b4ZvqC+Mm6Y1mrR3bP6FWXKt0Y7iH9cSl6Xk6KXRi8YIUm7BTdMYvdgEjs/vqMRO+R+tNTYs5kZ70j78", + "xLZVQ5biozM65uY1NRh+fWupZHP2TbFFUqS3rrgIAcWt1+t1xgQ5bmUbVrE5+4k0WVSQsGWsJhRkI8Vb", + "o0tZdTZukP9O1smEb5phEgalVATLITbboeJXLbE5c95KXQUkAcvA5WJBaVRyyGqePxL3LGMveWXy4WGK", + "nY3MNq9y2bTGRvVb9DWbs0r6unuecdMUNbbWvKw88brgSpL2uUYvl1QsfyhSRpawS12aQzVuNNw83ENp", + "LDSosZK6gp9vHkJOsNgD31VrxjLmpVcB7Rh0hx7hQaGmmCiHR+xhojHL2CjwnLF1xkxLGlvJ5uz97Gr2", + "jmWRV1S1cGSXkpMbiRUTAIXFPoRV5A+pPJLvrHYb+Pyw0FJDq1Bq8PTiA+kGfSBlWkph9yL2mB9y7PNo", + "0WJDPjbcn/v739+BKcHXBN6idsjjvn1NlqAn6FF78AZQiBi02XMGt6i18fBM0DkSYYkeexKkg6HVSASo", + "Mmz1uSO7YhnT2IRa7Oy3kOJsG2f7qIdzknYObcBr4p9CG0z1G/AcB7tLeBdwNnlTowPpHZh+m+4EozMn", + "UmpPFQVzeMqmHnd9dbXnVqHMRaz41KcODve+zfzWcU7OlZ3a1mnPbVTnPNkzPpMCjst4vkZ7VnYbKuK6", + "5m95WSO+TyUMCy7Z5e0NM4gaB8mp0bCpXvH68RRtuWsatKuNB5ywAHSAO+c/mBlW4SRPKbKndcZa445Y", + "zEPnakDQ1MPgT693mQfjXmUz/+MDe2A+9yU48hkIAxi4cAJLyqCIjwLqHmWUMFrmSJDEEJYLUri6lCI6", + "4DXqilwo1W4cWoq7xlsOCRDSEvdqFXz7YBIekyFyWCRwEy02J6FE5SgbtXk2RhHqc9pos5kFsdLQS6UC", + "VWE0Aeo0TdrO1ST2WmCM3KdzCr37JNvFsUq+Hv14EiOUoUZJHhKAZTDI3criWK7E5yzQN1X5EEREbLRa", + "BchLVFKgD5i12G2RUwjDwsW46h9i/EU6H64WttNeNgSpWV1oSnoh3nk6p+Q+0DTDtkj/yB9T3vwm5T3r", + "6nHmfu7I+Q9GrF4/bkMSaUmwubcdrQ8m+bu3muS/Un9iHKQW+zrVL57q11fXb1WdKYrkyoCcUzuetXTK", + "YWi6r/W6sF4Ze0yT8v7uMOf2i2UjLxxx1WM98N3b3bU/bMv7737Q/wf303iBPHl9PH0jzdhLzo2ginQ+", + "aJU/G7HKBxMX6DFpGz6gx4tjZxWbs2L5nq2f1n8FAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/raw/raw.go b/handlers/configuration/raw/raw.go new file mode 100644 index 00000000..e24be3b8 --- /dev/null +++ b/handlers/configuration/raw/raw.go @@ -0,0 +1,257 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package raw + +import ( + "fmt" + "io" + "net/http" + "strconv" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + cn "github.com/haproxytech/dataplaneapi/client-native" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all raw configuration routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy raw configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params GetHAProxyConfigurationParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, clusterVersion, md5Hash, data, err := cfg.GetRawConfigurationWithClusterData(params.TransactionId, int64(params.Version)) + if err != nil { + respond.Error(w, err) + return + } + writePlainText(w, http.StatusOK, clusterVersion, md5Hash, data) +} + +func (h *HandlerImpl) PostHAProxyConfiguration(w http.ResponseWriter, r *http.Request, params PostHAProxyConfigurationParams) { + body, err := io.ReadAll(r.Body) + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + data := string(body) + + if len(data) > 0 && !strings.ContainsRune(data, '\n') { + respond.BadRequest(w, "invalid configuration: no newline character found") + return + } + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.PostRawConfiguration(&data, int64(params.Version), params.SkipVersion, params.OnlyValidate); err != nil { + respond.Error(w, err) + return + } + + _, clusterVersion, md5Hash, result, err := cfg.GetRawConfigurationWithClusterData("", 0) + if err != nil { + respond.Error(w, err) + return + } + + if params.OnlyValidate { + writePlainText(w, http.StatusAccepted, clusterVersion, md5Hash, result) + return + } + + if params.SkipReload { + if params.XRuntimeActions != "" { + if err = executeRuntimeActions(params.XRuntimeActions, h.Client); err != nil { + respond.Error(w, err) + return + } + } + writePlainText(w, http.StatusCreated, clusterVersion, md5Hash, result) + return + } + + callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) + if err != nil { + respond.Error(w, err) + return + } + + if params.ForceReload { + if callbackNeeded { + err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) + } else { + err = h.ReloadAgent.ForceReload() + } + if err != nil { + respond.Error(w, err) + return + } + writePlainText(w, http.StatusCreated, clusterVersion, md5Hash, result) + return + } + + var rID string + if callbackNeeded { + rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) + } else { + rID = h.ReloadAgent.Reload() + } + w.Header().Set(respond.ReloadIDHeader, rID) + writePlainText(w, http.StatusAccepted, clusterVersion, md5Hash, result) +} + +func writePlainText(w http.ResponseWriter, status int, clusterVersion int64, md5Hash, data string) { + w.Header().Set("Content-Type", "text/plain") + if clusterVersion != 0 { + w.Header().Set("Cluster-Version", strconv.FormatInt(clusterVersion, 10)) + } + if md5Hash != "" { + w.Header().Set("Configuration-Checksum", md5Hash) + } + w.WriteHeader(status) + respond.Write(w, []byte(data)) +} + +func executeRuntimeActions(actionsStr string, client client_native.HAProxyClient) error { + rt, err := client.Runtime() + if err != nil { + return err + } + for a := range strings.SplitSeq(actionsStr, ";") { + params := strings.Split(a, " ") + if len(params) == 0 { + continue + } + action := params[0] + if action == "" { + continue + } + switch action { + case "SetFrontendMaxConn": + if len(params) > 2 { + maxConn, err := strconv.ParseInt(params[2], 10, 64) + if err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + if err = rt.SetFrontendMaxConn(params[1], int(maxConn)); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerWeight": + if len(params) > 3 { + if err = rt.SetServerWeight(params[1], params[2], params[3]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerCheckPort": + if len(params) > 3 { + port, err := strconv.ParseInt(params[3], 10, 64) + if err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + if err = rt.SetServerCheckPort(params[1], params[2], int(port)); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerAddr": + if len(params) > 4 { + port, err := strconv.ParseInt(params[4], 10, 64) + if err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + if err = rt.SetServerAddr(params[1], params[2], params[3], int(port)); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerState": + if len(params) > 3 { + if err = rt.SetServerState(params[1], params[2], params[3]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "EnableAgentCheck": + if len(params) > 2 { + if err = rt.EnableAgentCheck(params[1], params[2]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "DisableAgentCheck": + if len(params) > 2 { + if err = rt.DisableAgentCheck(params[1], params[2]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerAgentAddr": + if len(params) > 3 { + if err = rt.SetServerAgentAddr(params[1], params[2], params[3]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + case "SetServerAgentSend": + if len(params) > 3 { + if err = rt.SetServerAgentSend(params[1], params[2], params[3]); err != nil { + return fmt.Errorf("cannot execute %s: %s", action, err.Error()) + } + } else { + return fmt.Errorf("cannot execute %s: not enough parameters", action) + } + } + } + return nil +} diff --git a/handlers/configuration/resolver/resolver.gen.go b/handlers/configuration/resolver/resolver.gen.go new file mode 100644 index 00000000..ea3b4cd1 --- /dev/null +++ b/handlers/configuration/resolver/resolver.gen.go @@ -0,0 +1,1202 @@ +// Package resolver provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package resolver + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Nameserver defines model for nameserver. +type Nameserver = models.Nameserver + +// Nameservers defines model for nameservers. +type Nameservers = models.Nameservers + +// Resolver defines model for resolver. +type Resolver = models.Resolver + +// Resolvers defines model for resolvers. +type Resolvers = models.Resolvers + +// GetNameserversParams defines parameters for GetNameservers. +type GetNameserversParams struct { + // Resolver Parent resolver name + Resolver string `form:"resolver" json:"resolver"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateNameserverParams defines parameters for CreateNameserver. +type CreateNameserverParams struct { + // Resolver Parent resolver name + Resolver string `form:"resolver" json:"resolver"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteNameserverParams defines parameters for DeleteNameserver. +type DeleteNameserverParams struct { + // Resolver Parent resolver name + Resolver string `form:"resolver" json:"resolver"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetNameserverParams defines parameters for GetNameserver. +type GetNameserverParams struct { + // Resolver Parent resolver name + Resolver string `form:"resolver" json:"resolver"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceNameserverParams defines parameters for ReplaceNameserver. +type ReplaceNameserverParams struct { + // Resolver Parent resolver name + Resolver string `form:"resolver" json:"resolver"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetResolversParams defines parameters for GetResolvers. +type GetResolversParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateResolverParams defines parameters for CreateResolver. +type CreateResolverParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteResolverParams defines parameters for DeleteResolver. +type DeleteResolverParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetResolverParams defines parameters for GetResolver. +type GetResolverParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceResolverParams defines parameters for ReplaceResolver. +type ReplaceResolverParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateNameserverJSONRequestBody defines body for CreateNameserver for application/json ContentType. +type CreateNameserverJSONRequestBody = Nameserver + +// ReplaceNameserverJSONRequestBody defines body for ReplaceNameserver for application/json ContentType. +type ReplaceNameserverJSONRequestBody = Nameserver + +// CreateResolverJSONRequestBody defines body for CreateResolver for application/json ContentType. +type CreateResolverJSONRequestBody = Resolver + +// ReplaceResolverJSONRequestBody defines body for ReplaceResolver for application/json ContentType. +type ReplaceResolverJSONRequestBody = Resolver + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of nameservers + // (GET /services/haproxy/configuration/nameservers) + GetNameservers(w http.ResponseWriter, r *http.Request, params GetNameserversParams) + // Add a nameserver + // (POST /services/haproxy/configuration/nameservers) + CreateNameserver(w http.ResponseWriter, r *http.Request, params CreateNameserverParams) + // Delete a nameserver + // (DELETE /services/haproxy/configuration/nameservers/{name}) + DeleteNameserver(w http.ResponseWriter, r *http.Request, name string, params DeleteNameserverParams) + // Return a nameserver + // (GET /services/haproxy/configuration/nameservers/{name}) + GetNameserver(w http.ResponseWriter, r *http.Request, name string, params GetNameserverParams) + // Replace a nameserver + // (PUT /services/haproxy/configuration/nameservers/{name}) + ReplaceNameserver(w http.ResponseWriter, r *http.Request, name string, params ReplaceNameserverParams) + // Return an array of resolvers + // (GET /services/haproxy/configuration/resolvers) + GetResolvers(w http.ResponseWriter, r *http.Request, params GetResolversParams) + // Add a resolver + // (POST /services/haproxy/configuration/resolvers) + CreateResolver(w http.ResponseWriter, r *http.Request, params CreateResolverParams) + // Delete a resolver + // (DELETE /services/haproxy/configuration/resolvers/{name}) + DeleteResolver(w http.ResponseWriter, r *http.Request, name string, params DeleteResolverParams) + // Return a resolver + // (GET /services/haproxy/configuration/resolvers/{name}) + GetResolver(w http.ResponseWriter, r *http.Request, name string, params GetResolverParams) + // Replace a resolver + // (PUT /services/haproxy/configuration/resolvers/{name}) + ReplaceResolver(w http.ResponseWriter, r *http.Request, name string, params ReplaceResolverParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of nameservers +// (GET /services/haproxy/configuration/nameservers) +func (_ Unimplemented) GetNameservers(w http.ResponseWriter, r *http.Request, params GetNameserversParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a nameserver +// (POST /services/haproxy/configuration/nameservers) +func (_ Unimplemented) CreateNameserver(w http.ResponseWriter, r *http.Request, params CreateNameserverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a nameserver +// (DELETE /services/haproxy/configuration/nameservers/{name}) +func (_ Unimplemented) DeleteNameserver(w http.ResponseWriter, r *http.Request, name string, params DeleteNameserverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a nameserver +// (GET /services/haproxy/configuration/nameservers/{name}) +func (_ Unimplemented) GetNameserver(w http.ResponseWriter, r *http.Request, name string, params GetNameserverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a nameserver +// (PUT /services/haproxy/configuration/nameservers/{name}) +func (_ Unimplemented) ReplaceNameserver(w http.ResponseWriter, r *http.Request, name string, params ReplaceNameserverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of resolvers +// (GET /services/haproxy/configuration/resolvers) +func (_ Unimplemented) GetResolvers(w http.ResponseWriter, r *http.Request, params GetResolversParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a resolver +// (POST /services/haproxy/configuration/resolvers) +func (_ Unimplemented) CreateResolver(w http.ResponseWriter, r *http.Request, params CreateResolverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a resolver +// (DELETE /services/haproxy/configuration/resolvers/{name}) +func (_ Unimplemented) DeleteResolver(w http.ResponseWriter, r *http.Request, name string, params DeleteResolverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a resolver +// (GET /services/haproxy/configuration/resolvers/{name}) +func (_ Unimplemented) GetResolver(w http.ResponseWriter, r *http.Request, name string, params GetResolverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a resolver +// (PUT /services/haproxy/configuration/resolvers/{name}) +func (_ Unimplemented) ReplaceResolver(w http.ResponseWriter, r *http.Request, name string, params ReplaceResolverParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetNameservers operation middleware +func (siw *ServerInterfaceWrapper) GetNameservers(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetNameserversParams + + // ------------- Required query parameter "resolver" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "resolver", r.URL.Query(), ¶ms.Resolver, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "resolver"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "resolver", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetNameservers(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateNameserver operation middleware +func (siw *ServerInterfaceWrapper) CreateNameserver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateNameserverParams + + // ------------- Required query parameter "resolver" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "resolver", r.URL.Query(), ¶ms.Resolver, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "resolver"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "resolver", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateNameserver(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteNameserver operation middleware +func (siw *ServerInterfaceWrapper) DeleteNameserver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteNameserverParams + + // ------------- Required query parameter "resolver" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "resolver", r.URL.Query(), ¶ms.Resolver, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "resolver"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "resolver", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteNameserver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetNameserver operation middleware +func (siw *ServerInterfaceWrapper) GetNameserver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetNameserverParams + + // ------------- Required query parameter "resolver" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "resolver", r.URL.Query(), ¶ms.Resolver, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "resolver"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "resolver", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetNameserver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceNameserver operation middleware +func (siw *ServerInterfaceWrapper) ReplaceNameserver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceNameserverParams + + // ------------- Required query parameter "resolver" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "resolver", r.URL.Query(), ¶ms.Resolver, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "resolver"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "resolver", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceNameserver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetResolvers operation middleware +func (siw *ServerInterfaceWrapper) GetResolvers(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetResolversParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetResolvers(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateResolver operation middleware +func (siw *ServerInterfaceWrapper) CreateResolver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateResolverParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateResolver(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteResolver operation middleware +func (siw *ServerInterfaceWrapper) DeleteResolver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteResolverParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteResolver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetResolver operation middleware +func (siw *ServerInterfaceWrapper) GetResolver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetResolverParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetResolver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceResolver operation middleware +func (siw *ServerInterfaceWrapper) ReplaceResolver(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceResolverParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceResolver(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/nameservers", wrapper.GetNameservers) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/nameservers", wrapper.CreateNameserver) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/nameservers/{name}", wrapper.DeleteNameserver) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/nameservers/{name}", wrapper.GetNameserver) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/nameservers/{name}", wrapper.ReplaceNameserver) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/resolvers", wrapper.GetResolvers) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/resolvers", wrapper.CreateResolver) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/resolvers/{name}", wrapper.DeleteResolver) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/resolvers/{name}", wrapper.GetResolver) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/resolvers/{name}", wrapper.ReplaceResolver) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fvdb9s2EP9XCG6PtpWmxYD5LW26LS9FkA17KYrgTJ5sdhSpklRcI/D/PpD69lfsVHbzobdYoo53x7vf", + "73Sn3FOmk1QrVM7S8T01aFOtLIYfNkUmYsHACa1uE81R2lumk0Sr22phef1CGgS++Phd2FwU08qhcv5P", + "SFNZiIm+Wq2CcDbDBPxfvxqM6Zj+EtWqRPldGx2kAhqjDV0ulwPK0TIjUv8UHdN/ZkgKSciJQaszw5BA", + "rjLBXOcBnSFwNEH7D1rFYpqZsPHwXzRW5Hq3JbeWkVhIJHfF2kHDRLdIkY6pdUaoqddwOTjMu++B3+C3", + "DK17Yq59D96huWZP2YGXGEMm3cdgx9Ny4Z+o0IAkuW5P2YmftPtDZ4o/j/SegyVKOxIHlU/q12V5O+ym", + "IEGL5g5NY7WefEXmc+b7cKqHxcXc0tGn+oHG/aFIUm2Cx1NwMzqmU+Fm2WTEdBLNIDX6+8Ihm0VMClRu", + "qMCJO4zufotysdSrVesSVBMOE/vQKTX0Xw5K/cEYWDykvu1cf3+6cn9P3pTLj6XH/l6sNN/LhzeV/K41", + "f0TO7efrEr+6VNcrLFSs13PzQpGL6ysSa0MSUDAVakr+urj2MknpagKKkzp6CWvmsx3RAXXCSW9C+eQl", + "OCDXEhQG6UPSCKAy9cfUH6FOUUEq6Ji+HZ2N3tBBsDFEQeS3EwxtaWTU2jhaycEpunXzbtBlRlkCioQo", + "ITomIGXDGksmKLUKhjtN3BoIerW9jTrFfOMrHtjGtfMzBQMJuqDM51U1rsGgcrVD/fbUHwkd028ZGh+9", + "4dq4zkyfHN8yYZDTsTMZ7oLKweqGV5feUm+MM6AssAC98xkaJHOP6cp5a4HzsKiybUQ+gPJoP0GSWeT+", + "EVWiNRG29s1oi/6N/W4F3wnwXwbtQvn87KwzSmwGxwau+ztjDK2NM1nbfuqagee11DZLKtdEj6/QAlBl", + "SQJmUSVDKxdUK4YdTH300gZxflkOaKrthtS64NwSIArnTWw4IIU+GASHLZLuk+jgJFrTugjVfGeP62yG", + "7D8Pby34LPXZrGzT4KbCg9adGVginCV6XovbYtGOpBDK4RTNxhOIiUU3IFwT8LYwJAalBh4uea3nIFyw", + "0p9AaWAIO79syFHC4lATwRI2AzVFS0R7HRgMuwZcQk64MMicXPgwaHl3mxuCDbe5ci1fVGAQg7RYlTYT", + "rSWCKsEyvCC+13xxBJzMYbKdLss1hH5ztJ3bJ/+pUW4EnOC+Wjg/Oz/R/m1cz8OBAGOYOuShIMoPsXxr", + "x5VXo5s8/q4u14GzhpXqWbIhIjZRxrucITuki0ZHJMj/vWP57X7Wz2C9C849TTVpZhPP+YKbaY5TVMPi", + "XIYTzRfDInM5OAiSDyhLo3v/Y5mHgESH68FwGa7bloYkNjrZQqNksggr1+k0l7Q/nTYyrMmk4RWjwqvi", + "zg+QaM/aPWu/ctZuEej5Q+8QT4Vrzs/erctrgEaOaDynjXcd43nVIv0ZjJEj6T6ksRzsbjtohT+M661O", + "Qw/qr76f8VTbGS8MBMpmyV4gkGYbQSCVwFZrO89NByJAIahHgb6060u7viHzcyimgSkmx6O+I3OSjswL", + "Y9UQOidtyLRmzAdNCVvwVQjZWKA3x8w7mfl5MtiV4v7oPfzmypfoG8fInF0paNhMyPr7EevRe45SbgPg", + "TMpbi8ytktEj3q27w8I6Zvrh4dbhoWlEfZnB1aB/r8FhVToWY0O25pBtY8PGBwUvMOH6kvFFlozPCVi7", + "r2zrL7dOO2hs77vK/AUAHWnIuGvvfsT4skaMjR7HOht2X80eNFysiLZqQbeJZLIIJLBrsrgv495sagd1", + "3Xrqab2n9X7Id6QhX5XBr2DEtxO09xnvVch6AKA2OgY9mvZdiU6qyX4EeLwR4EMg8dD47zEYUTze40Rf", + "dfVVV99M+bFmytlpmynHGhD23ZRXMx7sopniRZf/H/j5nmZG0jGN7t7S5Zfl/wEAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/resolver/resolver.go b/handlers/configuration/resolver/resolver.go new file mode 100644 index 00000000..87cbff3c --- /dev/null +++ b/handlers/configuration/resolver/resolver.go @@ -0,0 +1,315 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resolver + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all resolver and nameserver routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy resolver and nameserver configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetNameservers(w http.ResponseWriter, r *http.Request, params GetNameserversParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var nss models.Nameservers + _, nss, err = cfg.GetNameservers(params.Resolver, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, nss) +} + +func (h *HandlerImpl) CreateNameserver(w http.ResponseWriter, r *http.Request, params CreateNameserverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Nameserver + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateNameserver(params.Resolver, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteNameserver(w http.ResponseWriter, r *http.Request, name string, params DeleteNameserverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteNameserver(name, params.Resolver, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetNameserver(w http.ResponseWriter, r *http.Request, name string, params GetNameserverParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ns, err := cfg.GetNameserver(name, params.Resolver, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ns) +} + +func (h *HandlerImpl) ReplaceNameserver(w http.ResponseWriter, r *http.Request, name string, params ReplaceNameserverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Nameserver + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditNameserver(name, params.Resolver, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) GetResolvers(w http.ResponseWriter, r *http.Request, params GetResolversParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var rs models.Resolvers + if params.FullSection { + _, rs, err = cfg.GetStructuredResolvers(params.TransactionId) + } else { + _, rs, err = cfg.GetResolvers(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rs) +} + +func (h *HandlerImpl) CreateResolver(w http.ResponseWriter, r *http.Request, params CreateResolverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Resolver + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredResolver(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateResolver(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteResolver(w http.ResponseWriter, r *http.Request, name string, params DeleteResolverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteResolver(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetResolver(w http.ResponseWriter, r *http.Request, name string, params GetResolverParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var res *models.Resolver + if params.FullSection { + _, res, err = cfg.GetStructuredResolver(name, params.TransactionId) + } else { + _, res, err = cfg.GetResolver(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, res) +} + +func (h *HandlerImpl) ReplaceResolver(w http.ResponseWriter, r *http.Request, name string, params ReplaceResolverParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Resolver + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredResolver(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditResolver(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/ring/ring.gen.go b/handlers/configuration/ring/ring.gen.go new file mode 100644 index 00000000..8ecd23c2 --- /dev/null +++ b/handlers/configuration/ring/ring.gen.go @@ -0,0 +1,728 @@ +// Package ring provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ring + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Ring defines model for ring. +type Ring = models.Ring + +// Rings defines model for rings. +type Rings = models.Rings + +// GetRingsParams defines parameters for GetRings. +type GetRingsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateRingParams defines parameters for CreateRing. +type CreateRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteRingParams defines parameters for DeleteRing. +type DeleteRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetRingParams defines parameters for GetRing. +type GetRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// ReplaceRingParams defines parameters for ReplaceRing. +type ReplaceRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateRingJSONRequestBody defines body for CreateRing for application/json ContentType. +type CreateRingJSONRequestBody = Ring + +// ReplaceRingJSONRequestBody defines body for ReplaceRing for application/json ContentType. +type ReplaceRingJSONRequestBody = Ring + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of rings + // (GET /services/haproxy/configuration/rings) + GetRings(w http.ResponseWriter, r *http.Request, params GetRingsParams) + // Add a ring + // (POST /services/haproxy/configuration/rings) + CreateRing(w http.ResponseWriter, r *http.Request, params CreateRingParams) + // Delete a ring + // (DELETE /services/haproxy/configuration/rings/{name}) + DeleteRing(w http.ResponseWriter, r *http.Request, name string, params DeleteRingParams) + // Return a ring + // (GET /services/haproxy/configuration/rings/{name}) + GetRing(w http.ResponseWriter, r *http.Request, name string, params GetRingParams) + // Replace a ring + // (PUT /services/haproxy/configuration/rings/{name}) + ReplaceRing(w http.ResponseWriter, r *http.Request, name string, params ReplaceRingParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of rings +// (GET /services/haproxy/configuration/rings) +func (_ Unimplemented) GetRings(w http.ResponseWriter, r *http.Request, params GetRingsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a ring +// (POST /services/haproxy/configuration/rings) +func (_ Unimplemented) CreateRing(w http.ResponseWriter, r *http.Request, params CreateRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a ring +// (DELETE /services/haproxy/configuration/rings/{name}) +func (_ Unimplemented) DeleteRing(w http.ResponseWriter, r *http.Request, name string, params DeleteRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a ring +// (GET /services/haproxy/configuration/rings/{name}) +func (_ Unimplemented) GetRing(w http.ResponseWriter, r *http.Request, name string, params GetRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a ring +// (PUT /services/haproxy/configuration/rings/{name}) +func (_ Unimplemented) ReplaceRing(w http.ResponseWriter, r *http.Request, name string, params ReplaceRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetRings operation middleware +func (siw *ServerInterfaceWrapper) GetRings(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetRingsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRings(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateRing operation middleware +func (siw *ServerInterfaceWrapper) CreateRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateRing(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteRing operation middleware +func (siw *ServerInterfaceWrapper) DeleteRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteRing(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRing operation middleware +func (siw *ServerInterfaceWrapper) GetRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRing(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceRing operation middleware +func (siw *ServerInterfaceWrapper) ReplaceRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceRing(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/rings", wrapper.GetRings) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/rings", wrapper.CreateRing) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/rings/{name}", wrapper.DeleteRing) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/rings/{name}", wrapper.GetRing) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/rings/{name}", wrapper.ReplaceRing) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhBb9s4E/0rBL/vKFtuWiywvrlNdzeXRZBd7KUIjDE5stilSJWk7BiB/vuCpGRbkZ3GrZO6gW+2RA3f", + "DOe9Gc49ZbootULlLB3fU4O21Mpi+GNLZCITDJzQalpojtJOmS4Krabrhe3ziTQIfPXxTthoimnlUDn/", + "E8pSNmbSz1arYJzlWID/9X+DGR3T/6UbKGl8a9ODIKAx2tC6rhPK0TIjSv8VHdO/cySNJeTEoNWVYUgg", + "QiYYMSc0R+BoAvoPWmViXpmw8eAfNFZE3F3LnWUkExLJolmbbLnoViXSMbXOCDX3COvksOi+B36DXyq0", + "7sRC+x58QCOyUw7gJWZQSfcx+HFaIfwdFRqQJGI75SD+qd1vulL856D3EixR2pEsQH7RuNbt6yiq/vFm", + "nZ59RubZcjeY60HzMPo4vPFLt94MRFFqE6JcgsvpmM6Fy6vZkOkizaE0+m7lkOUpkwKVGyhwYoHp4pc0", + "GqQeit8/ABEOC/u1M4lOJC1aMAZW+8Hao6P9hpx4Wmxbfh0TrgcsVKb7uTNRZHJ9RTJtSAEK5kLNyR+T", + "a2+T+BATtp1cdkgT6oSTHm+77BIckGsJCoOpAWmyo83BMfXnpEtUUAo6pm+Ho+EbmgRnwjGnFs1CMLSt", + "N2ln03SdGHN0fQ9u0FVGWQKKhCQgOiMg5Rq455o34KHrEqPNKx4UzbW5UYKBAl3g3aeHO1xdepsuR+IM", + "KAss8GyZo0Gy9ARWjjhNgPOwaL3JkHwA5ak9Q1JZ5P4T1VKTCLtRA49N+K2+VGh8GisofIi39psK/iib", + "kx5qxX12oiUigm9wQ5YhczY82sgRy4XciJIlYMkSpdyDK6uknFoMBjuoeKxfdJyBtLhm50xriaBoXd8m", + "3ebtYjQ6mkzHPNmhvH9VjKG1WSU3h/PSFWwdmd0+rIOSfnu/EGSpKgowqzUvOrQwTbY78Hz6RANRb+uE", + "ltruYNaEc0uAKFxGKXA6JA3rBaFPrQ8GwWEjBK+QXE2GxJ29eLIc2b89vWzx7Aa77fA24KTzJgdLhLNE", + "Lzfm9nj0SC4K5XCOZqdQZMSiSwjXBLwvDIlBqYGHRx71EoQLXm4ff+hh/LIBRwmrQ10ES1gOau71qbsO", + "DIZdgxAgJ1wYZE6ufBp0orsvDMGHaQR3mDr9TCIaLjPvNV8dVT+jfHrrwiCnY2cqrHua/eYZ9nxQ1QOX", + "gopw3z5cjC6efc+uusfsJMAYlg45AdUmfHuTxAft+k2kw9VlX0o3Krf+luxI0F2F412skEcsGlu39GD/", + "1yPb785YfkTtm3BOIBStXrXzjTXTHOeoBs1ZDGaarwYNKzk4CNae1JWm9/6zOh64RIf9o78Mz22Dh2RG", + "FzvK6GwVRN5b61fTaOIp1TTQJnjSaE64Mawlp3nTpfdhXeW5XJ/L9amU6/5l4uJrPfupqPrF6N2Oq6zP", + "yKgjPErzuyNr5no09iNUOcrYPmGuk8fv91rhjonE48LZ3PDPqnmeIHxXZ3gKA4RXJgbteGKvGJTVTjEo", + "JbBNN3WAFjSfnvXg3EWdu6jz0OPwocfoZYYeJurUeerxzFOPV1ZNQ9J859DDm0SzaItiZSQd03Txlta3", + "9X8BAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/ring/ring.go b/handlers/configuration/ring/ring.go new file mode 100644 index 00000000..89fe2aa8 --- /dev/null +++ b/handlers/configuration/ring/ring.go @@ -0,0 +1,190 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ring + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all ring routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy ring configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetRings(w http.ResponseWriter, r *http.Request, params GetRingsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var rings Rings + if params.FullSection { + _, rings, err = cfg.GetStructuredRings(params.TransactionId) + } else { + _, rings, err = cfg.GetRings(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rings) +} + +func (h *HandlerImpl) CreateRing(w http.ResponseWriter, r *http.Request, params CreateRingParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Ring + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredRing(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateRing(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteRing(w http.ResponseWriter, r *http.Request, name string, params DeleteRingParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteRing(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetRing(w http.ResponseWriter, r *http.Request, name string, params GetRingParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var ring *Ring + if params.FullSection { + _, ring, err = cfg.GetStructuredRing(name, params.TransactionId) + } else { + _, ring, err = cfg.GetRing(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ring) +} + +func (h *HandlerImpl) ReplaceRing(w http.ResponseWriter, r *http.Request, name string, params ReplaceRingParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Ring + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.EditStructuredRing(name, &data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditRing(name, &data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/server/server.gen.go b/handlers/configuration/server/server.gen.go new file mode 100644 index 00000000..296f6856 --- /dev/null +++ b/handlers/configuration/server/server.gen.go @@ -0,0 +1,1572 @@ +// Package server provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package server + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Server defines model for server. +type Server = models.Server + +// Servers defines model for servers. +type Servers = models.Servers + +// GetAllServerBackendParams defines parameters for GetAllServerBackend. +type GetAllServerBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateServerBackendParams defines parameters for CreateServerBackend. +type CreateServerBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteServerBackendParams defines parameters for DeleteServerBackend. +type DeleteServerBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetServerBackendParams defines parameters for GetServerBackend. +type GetServerBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceServerBackendParams defines parameters for ReplaceServerBackend. +type ReplaceServerBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllServerPeerParams defines parameters for GetAllServerPeer. +type GetAllServerPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateServerPeerParams defines parameters for CreateServerPeer. +type CreateServerPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteServerPeerParams defines parameters for DeleteServerPeer. +type DeleteServerPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetServerPeerParams defines parameters for GetServerPeer. +type GetServerPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceServerPeerParams defines parameters for ReplaceServerPeer. +type ReplaceServerPeerParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllServerRingParams defines parameters for GetAllServerRing. +type GetAllServerRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateServerRingParams defines parameters for CreateServerRing. +type CreateServerRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteServerRingParams defines parameters for DeleteServerRing. +type DeleteServerRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetServerRingParams defines parameters for GetServerRing. +type GetServerRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceServerRingParams defines parameters for ReplaceServerRing. +type ReplaceServerRingParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateServerBackendJSONRequestBody defines body for CreateServerBackend for application/json ContentType. +type CreateServerBackendJSONRequestBody = Server + +// ReplaceServerBackendJSONRequestBody defines body for ReplaceServerBackend for application/json ContentType. +type ReplaceServerBackendJSONRequestBody = Server + +// CreateServerPeerJSONRequestBody defines body for CreateServerPeer for application/json ContentType. +type CreateServerPeerJSONRequestBody = Server + +// ReplaceServerPeerJSONRequestBody defines body for ReplaceServerPeer for application/json ContentType. +type ReplaceServerPeerJSONRequestBody = Server + +// CreateServerRingJSONRequestBody defines body for CreateServerRing for application/json ContentType. +type CreateServerRingJSONRequestBody = Server + +// ReplaceServerRingJSONRequestBody defines body for ReplaceServerRing for application/json ContentType. +type ReplaceServerRingJSONRequestBody = Server + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of servers + // (GET /services/haproxy/configuration/backends/{parent_name}/servers) + GetAllServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerBackendParams) + // Add a new server + // (POST /services/haproxy/configuration/backends/{parent_name}/servers) + CreateServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerBackendParams) + // Delete a server + // (DELETE /services/haproxy/configuration/backends/{parent_name}/servers/{name}) + DeleteServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerBackendParams) + // Return one server + // (GET /services/haproxy/configuration/backends/{parent_name}/servers/{name}) + GetServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerBackendParams) + // Replace a server + // (PUT /services/haproxy/configuration/backends/{parent_name}/servers/{name}) + ReplaceServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerBackendParams) + // Return an array of servers + // (GET /services/haproxy/configuration/peers/{parent_name}/servers) + GetAllServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerPeerParams) + // Add a new server + // (POST /services/haproxy/configuration/peers/{parent_name}/servers) + CreateServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerPeerParams) + // Delete a server + // (DELETE /services/haproxy/configuration/peers/{parent_name}/servers/{name}) + DeleteServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerPeerParams) + // Return one server + // (GET /services/haproxy/configuration/peers/{parent_name}/servers/{name}) + GetServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerPeerParams) + // Replace a server + // (PUT /services/haproxy/configuration/peers/{parent_name}/servers/{name}) + ReplaceServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerPeerParams) + // Return an array of servers + // (GET /services/haproxy/configuration/rings/{parent_name}/servers) + GetAllServerRing(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerRingParams) + // Add a new server + // (POST /services/haproxy/configuration/rings/{parent_name}/servers) + CreateServerRing(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerRingParams) + // Delete a server + // (DELETE /services/haproxy/configuration/rings/{parent_name}/servers/{name}) + DeleteServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerRingParams) + // Return one server + // (GET /services/haproxy/configuration/rings/{parent_name}/servers/{name}) + GetServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerRingParams) + // Replace a server + // (PUT /services/haproxy/configuration/rings/{parent_name}/servers/{name}) + ReplaceServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerRingParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of servers +// (GET /services/haproxy/configuration/backends/{parent_name}/servers) +func (_ Unimplemented) GetAllServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new server +// (POST /services/haproxy/configuration/backends/{parent_name}/servers) +func (_ Unimplemented) CreateServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a server +// (DELETE /services/haproxy/configuration/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) DeleteServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one server +// (GET /services/haproxy/configuration/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) GetServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a server +// (PUT /services/haproxy/configuration/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) ReplaceServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of servers +// (GET /services/haproxy/configuration/peers/{parent_name}/servers) +func (_ Unimplemented) GetAllServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new server +// (POST /services/haproxy/configuration/peers/{parent_name}/servers) +func (_ Unimplemented) CreateServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a server +// (DELETE /services/haproxy/configuration/peers/{parent_name}/servers/{name}) +func (_ Unimplemented) DeleteServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one server +// (GET /services/haproxy/configuration/peers/{parent_name}/servers/{name}) +func (_ Unimplemented) GetServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a server +// (PUT /services/haproxy/configuration/peers/{parent_name}/servers/{name}) +func (_ Unimplemented) ReplaceServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerPeerParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of servers +// (GET /services/haproxy/configuration/rings/{parent_name}/servers) +func (_ Unimplemented) GetAllServerRing(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new server +// (POST /services/haproxy/configuration/rings/{parent_name}/servers) +func (_ Unimplemented) CreateServerRing(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a server +// (DELETE /services/haproxy/configuration/rings/{parent_name}/servers/{name}) +func (_ Unimplemented) DeleteServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one server +// (GET /services/haproxy/configuration/rings/{parent_name}/servers/{name}) +func (_ Unimplemented) GetServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a server +// (PUT /services/haproxy/configuration/rings/{parent_name}/servers/{name}) +func (_ Unimplemented) ReplaceServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerRingParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllServerBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllServerBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllServerBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllServerBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateServerBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateServerBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateServerBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateServerBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteServerBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteServerBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteServerBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteServerBackend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServerBackend operation middleware +func (siw *ServerInterfaceWrapper) GetServerBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerBackend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerBackend(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllServerPeer operation middleware +func (siw *ServerInterfaceWrapper) GetAllServerPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllServerPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllServerPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateServerPeer operation middleware +func (siw *ServerInterfaceWrapper) CreateServerPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateServerPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateServerPeer(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteServerPeer operation middleware +func (siw *ServerInterfaceWrapper) DeleteServerPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteServerPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteServerPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServerPeer operation middleware +func (siw *ServerInterfaceWrapper) GetServerPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerPeer operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerPeer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerPeerParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerPeer(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllServerRing operation middleware +func (siw *ServerInterfaceWrapper) GetAllServerRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllServerRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllServerRing(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateServerRing operation middleware +func (siw *ServerInterfaceWrapper) CreateServerRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateServerRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateServerRing(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteServerRing operation middleware +func (siw *ServerInterfaceWrapper) DeleteServerRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteServerRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteServerRing(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServerRing operation middleware +func (siw *ServerInterfaceWrapper) GetServerRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerRing(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerRing operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerRing(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerRingParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerRing(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/servers", wrapper.GetAllServerBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/servers", wrapper.CreateServerBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/servers/{name}", wrapper.DeleteServerBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/servers/{name}", wrapper.GetServerBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/servers/{name}", wrapper.ReplaceServerBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/servers", wrapper.GetAllServerPeer) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/servers", wrapper.CreateServerPeer) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/servers/{name}", wrapper.DeleteServerPeer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/servers/{name}", wrapper.GetServerPeer) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/servers/{name}", wrapper.ReplaceServerPeer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/rings/{parent_name}/servers", wrapper.GetAllServerRing) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/rings/{parent_name}/servers", wrapper.CreateServerRing) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/rings/{parent_name}/servers/{name}", wrapper.DeleteServerRing) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/rings/{parent_name}/servers/{name}", wrapper.GetServerRing) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/rings/{parent_name}/servers/{name}", wrapper.ReplaceServerRing) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FxPb9u4E/0qBNvT7ydHbloUWO/JabrdXBZButhLkwY0ObbZSqRKUkmNwN99QVKypVj+13XSNJhLYMvU", + "aIaceW80D8gd5TovtALlLB3cUQO20MpC+GIL4HIsOXNSq+tcC8jsNdd5rtX1YmF9fZgZYGL2/ru00RTX", + "yoFy/iMriqwyk36xWgXjfAo5859eGhjTAX2RLl1J46823csFMEYbOp/PEyrAciMLfxcd0L+nQCpLIIgB", + "q0vDgbDoMoHoc0KnwASY4P07rcZyUprw4N4/YKyMfrctt5aRscyA3FRrk0aIblYAHVDrjFQT7+E82W93", + "T5i4gG8lWPfEtvaE+Q2Nnj3lDTyFMSsz9z7E8bS28AMoMCwj0benvIl/afeHLpX4Ncr7llmitCPj4PKj", + "7uu8/jniKJgbMI2VevQFuK+X772J7lUXY5RHH+Pixm89mRfahJ0umJvSAZ1INy1HR1zn6ZQVRn+fOeDT", + "lGcSlOsp5uQNpDdv02iSBneC2eCOdJDbrScT3Zgntc/MGDbb5LI9vM/7Z8due1xX2iHd9Q5LNdarWTRU", + "ZHh+RsbakJwpNpFqQv4cnnubJG4dAeWMBHtEE+qky7yr9YpT5hg5z5iCYKVHFglSp+KA+mPSBShWSDqg", + "r4/6R69oEiIJ5xwOU3KwdSgpbyZ2OmL8Kyhh07uCGVDuWrEc5mkjZSbgVuO6AFcaZQnLMlKtJW7KHGEG", + "SP0EEESqRnWexGf5SHUB0YEzEVDQDbMsBlctCjEYloMLbny678B58JZ4b6nffDqIp5fQcMl/W4RDE+pp", + "ShoQdOBMCc0CLphzYPz9nz99vrw0l5fqsuz3X/PwF/73+8sX/tPx27v5Jb36/0uarNR8ct+5s1Oix8RN", + "gTjDlGU8YMjtFAyQWw9OyhGnCRMiLFpsxhF5x5SHrRGQ0oLwt6gadoi0y708qoP+VoKZLaNuPO9aio1I", + "dZW0O77jfv9w2F6lTwdgfyw5B2vHZbaM+7GJT8SGYF0Ui21Jf7zNCBhW5jkzs0W5EKZIgFKfHXYBnI5N", + "fIbTqriv5gkttO0ouqEQljCi4La625eXaxHg2hJ7Z4A5wBJ71BJb8bpK5vhkTwp8CvyrJ4UWKtf+dDvb", + "DLjpcNL6Zcoskc4Sfbs0tyaiDWUjlYMJmM4T8DnsEiI0YT4WDsRAppkIl7zXt0y6EKU/gQYpxGU9ARmb", + "7Rsis4RPmZqADcnfWOeZxxsKqAWCCGmAu2zm06C1u+u2IcRwHZ1r7cUCLsYss7BIzpHWGTBVQ2l4DzrR", + "YnZgFI0g2q6u+Qp2v3qQp96D7gg6PECJ8I3Hcf/4EZ7bRvp4/IRxDoUDQZiqM6p+GYV7Hf9FzLez01VI", + "XcLI4l7SkQFdJPIm8uUBCaTxoh/s/3Zg++0xzc/gwaEQLQLrYD/fmXMtYAKqV51Jb6TFrFdVqWCOBav/", + "rbNN78LXmBEZOFjNjdNw3TNuxbZtjB7NAr56M2RsdL4rE0ezezFxVXjrmXgrBW9lJiR7JHsk+53JvsW9", + "x9teTp4KZR3336zaq8AloqCIzPPmwJSwGB7+DNKJgLuA8e43ro1TDq1gOwfs/i72ARzCP45TDtKSP4Fp", + "yjODi2pWs6z5NSOashMwiozx3XrG3fGisoqYgS0jtow4H/qh+VD/8eZDJsIVDogefED0zHg3pM2mPv1g", + "s6ECwgjo4SXPcwCzWe/0K1CJQbETxc69xc7u4moqnVhc2MZiG4syJ8qcKHM+U5lzQyv74BpnNwE3Bc5d", + "CBhHVcjxyPGobqK6+Supm2snGwj8ODlBXRN1zS1I0RI1ES2wTcQ2EUdBqGiioomK5o+MgfwpPYqieSHV", + "ZLOi6Veg6IKKJiqaeyua3cXVVDSxuLCNxTYWFU1UNFHRfKaK5oZW9sEVzW4CbiqauxAwjqqQ45HjUdFE", + "RfNXUjTXTjYQ+HFygoomKppbkKKlaCJaYJuIbSKOglDRREUTFc3VMVDz3xJ/uqOlyeiApjev6fxq/m8A", + "AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/server/server.go b/handlers/configuration/server/server.go new file mode 100644 index 00000000..45897f12 --- /dev/null +++ b/handlers/configuration/server/server.go @@ -0,0 +1,451 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server + +import ( + "net/http" + "reflect" + "strconv" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + cn_runtime "github.com/haproxytech/client-native/v6/runtime" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + runtime_servers "github.com/haproxytech/dataplaneapi/handlers/runtime/servers" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all server routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy server configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend --- + +func (h *HandlerImpl) GetAllServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerBackendParams) { + h.getAllServer(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateServerBackend(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerBackendParams) { + h.createServer(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerBackendParams) { + h.deleteServer(w, r, "backend", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerBackendParams) { + h.getServer(w, r, "backend", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceServerBackend(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerBackendParams) { + h.replaceServer(w, r, "backend", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Peer --- + +func (h *HandlerImpl) GetAllServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerPeerParams) { + h.getAllServer(w, r, "peers", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateServerPeer(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerPeerParams) { + h.createServer(w, r, "peers", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerPeerParams) { + h.deleteServer(w, r, "peers", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerPeerParams) { + h.getServer(w, r, "peers", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceServerPeer(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerPeerParams) { + h.replaceServer(w, r, "peers", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Ring --- + +func (h *HandlerImpl) GetAllServerRing(w http.ResponseWriter, r *http.Request, parentName string, params GetAllServerRingParams) { + h.getAllServer(w, r, "ring", parentName, params.TransactionId) +} + +func (h *HandlerImpl) CreateServerRing(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerRingParams) { + h.createServer(w, r, "ring", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteServerRingParams) { + h.deleteServer(w, r, "ring", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetServerRingParams) { + h.getServer(w, r, "ring", parentName, name, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceServerRing(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceServerRingParams) { + h.replaceServer(w, r, "ring", parentName, name, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared implementations --- + +func (h *HandlerImpl) getAllServer(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, srvs, err := cfg.GetServers(parentType, parentName, txID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, Servers{}) + return + } + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, srvs) +} + +func (h *HandlerImpl) getServer(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, srv, err := cfg.GetServer(name, parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, srv) +} + +func (h *HandlerImpl) createServer(w http.ResponseWriter, r *http.Request, parentType, parentName, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Server + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateServer(parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + + // Try to add the server dynamically via the runtime API (backend only, no default_server). + // On success we skip the reload entirely. + useRuntime := false + var ras models.RuntimeAddServer + var runtimeClient cn_runtime.Runtime + if parentType == "backend" && txID == "" { + _, defaults, errRT := cfg.GetDefaultsConfiguration(txID) + if errRT != nil { + respond.Error(w, errRT) + return + } + _, backend, errRT := cfg.GetBackend(parentName, txID) + if errRT != nil { + respond.Error(w, errRT) + return + } + runtimeClient, errRT = h.Client.Runtime() + if errRT == nil && defaults.DefaultServer == nil && backend.DefaultServer == nil { + useRuntime = misc.ConvertStruct(data, &ras) == nil + } + } + + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + if useRuntime { + haversion, _ := runtimeClient.GetVersion() + if err = runtimeClient.AddServer(parentName, data.Name, runtime_servers.SerializeRuntimeAddServer(&ras, &haversion)); err == nil { + log.Debugf("backend %s: server %s added through runtime", parentName, data.Name) + respond.JSON(w, http.StatusCreated, &data) + return + } + log.Warning("failed to add server through runtime:", err) + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) deleteServer(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteServer(name, parentType, parentName, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) replaceServer(w http.ResponseWriter, r *http.Request, parentType, parentName, name, txID string, version int64, forceReload bool) { + if txID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Server + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ondisk, err := cfg.GetServer(name, parentType, parentName, txID) + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditServer(name, parentType, parentName, &data, txID, version); err != nil { + respond.Error(w, err) + return + } + if txID == "" { + needsReload := serverChangeThroughRuntimeAPI(data, *ondisk, parentName, h.Client) + if needsReload { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// runtimeSupportedServerFields lists Server fields that can be changed without a reload. +var runtimeSupportedServerFields = []string{"Weight", "Address", "Port", "Maintenance", "AgentCheck", "AgentAddr", "AgentSend", "HealthCheckPort"} + +// serverChangeThroughRuntimeAPI attempts to apply server field changes via the HAProxy runtime API. +// Returns true when a reload is still required (unsupported fields changed or runtime call failed). +func serverChangeThroughRuntimeAPI(data, ondisk models.Server, parentName string, client client_native.HAProxyClient) (reload bool) { + defer func() { + if r := recover(); r != nil { + log.Warning("serverChangeThroughRuntimeAPI panic:", r) + reload = true + } + }() + + rt, err := client.Runtime() + if err != nil { + return true + } + + diff := serverCompareObjects(data, ondisk) + if len(diff) == 0 { + return false + } + if !serverCompareChanged(diff, runtimeSupportedServerFields) { + return true + } + + addrPortChanged := false + for _, field := range diff { + fieldValue := reflect.ValueOf(data).FieldByName(field) + if !fieldValue.IsValid() { + continue + } + switch field { + case "Weight": + weight := strconv.FormatInt(fieldValue.Elem().Int(), 10) + if err = rt.SetServerWeight(parentName, data.Name, weight); err != nil { + return true + } + case "HealthCheckPort": + port := int(fieldValue.Elem().Int()) + if err = rt.SetServerCheckPort(parentName, data.Name, port); err != nil { + return true + } + case "Address": + if !addrPortChanged { + portVal := int(reflect.ValueOf(data).FieldByName("Port").Elem().Int()) + if err = rt.SetServerAddr(parentName, data.Name, fieldValue.String(), portVal); err != nil { + return true + } + addrPortChanged = true + } + case "Port": + if !addrPortChanged { + port := int(fieldValue.Elem().Int()) + addr := reflect.ValueOf(data).FieldByName("Address").String() + if err = rt.SetServerAddr(parentName, data.Name, addr, port); err != nil { + return true + } + addrPortChanged = true + } + case "Maintenance": + state := "ready" + if fieldValue.String() == "enabled" { + state = "maint" + } + if err = rt.SetServerState(parentName, data.Name, state); err != nil { + return true + } + case "AgentCheck": + switch fieldValue.String() { + case "enabled": + if err = rt.EnableAgentCheck(parentName, data.Name); err != nil { + return true + } + case "disabled": + if err = rt.DisableAgentCheck(parentName, data.Name); err != nil { + return true + } + } + case "AgentAddr": + if err = rt.SetServerAgentAddr(parentName, data.Name, fieldValue.String()); err != nil { + return true + } + case "AgentSend": + if err = rt.SetServerAgentSend(parentName, data.Name, fieldValue.String()); err != nil { + return true + } + } + } + return false +} + +func serverCompareObjects(data, ondisk any) []string { + diff := []string{} + dataVal := reflect.ValueOf(data) + ondiskVal := reflect.ValueOf(ondisk) + for i := range dataVal.NumField() { + fName := dataVal.Type().Field(i).Name + dField := dataVal.FieldByName(fName) + oField := ondiskVal.FieldByName(fName) + + dKind := dField.Kind() + oKind := oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + if dKind == reflect.Ptr { + dField = dField.Elem() + oField = oField.Elem() + dKind = dField.Kind() + oKind = oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + } + switch dKind { + case reflect.Float32, reflect.Float64: + if dField.Float() != oField.Float() { + diff = append(diff, fName) + } + case reflect.Bool: + if dField.Bool() != oField.Bool() { + diff = append(diff, fName) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if dField.Int() != oField.Int() { + diff = append(diff, fName) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if dField.Uint() != oField.Uint() { + diff = append(diff, fName) + } + case reflect.String: + if dField.String() != oField.String() { + diff = append(diff, fName) + } + case reflect.Struct: + diff = append(diff, serverCompareObjects(dField.Interface(), oField.Interface())...) + } + } + return diff +} + +func serverCompareChanged(changed, changeable []string) bool { + if len(changed) > len(changeable) { + return false + } + set := make(map[string]bool, len(changed)) + for _, f := range changed { + set[f] = true + } + for _, f := range changeable { + delete(set, f) + } + return len(set) == 0 +} diff --git a/handlers/configuration/server_switching_rule/server_switching_rule.gen.go b/handlers/configuration/server_switching_rule/server_switching_rule.gen.go new file mode 100644 index 00000000..79bef42e --- /dev/null +++ b/handlers/configuration/server_switching_rule/server_switching_rule.gen.go @@ -0,0 +1,816 @@ +// Package server_switching_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package server_switching_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// ServerSwitchingRule defines model for server_switching_rule. +type ServerSwitchingRule = models.ServerSwitchingRule + +// ServerSwitchingRules defines model for server_switching_rules. +type ServerSwitchingRules = models.ServerSwitchingRules + +// GetServerSwitchingRulesParams defines parameters for GetServerSwitchingRules. +type GetServerSwitchingRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceServerSwitchingRulesParams defines parameters for ReplaceServerSwitchingRules. +type ReplaceServerSwitchingRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteServerSwitchingRuleParams defines parameters for DeleteServerSwitchingRule. +type DeleteServerSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetServerSwitchingRuleParams defines parameters for GetServerSwitchingRule. +type GetServerSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateServerSwitchingRuleParams defines parameters for CreateServerSwitchingRule. +type CreateServerSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceServerSwitchingRuleParams defines parameters for ReplaceServerSwitchingRule. +type ReplaceServerSwitchingRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceServerSwitchingRulesJSONRequestBody defines body for ReplaceServerSwitchingRules for application/json ContentType. +type ReplaceServerSwitchingRulesJSONRequestBody = ServerSwitchingRules + +// CreateServerSwitchingRuleJSONRequestBody defines body for CreateServerSwitchingRule for application/json ContentType. +type CreateServerSwitchingRuleJSONRequestBody = ServerSwitchingRule + +// ReplaceServerSwitchingRuleJSONRequestBody defines body for ReplaceServerSwitchingRule for application/json ContentType. +type ReplaceServerSwitchingRuleJSONRequestBody = ServerSwitchingRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Server Switching Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules) + GetServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetServerSwitchingRulesParams) + // Replace a Server Switching Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules) + ReplaceServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceServerSwitchingRulesParams) + // Delete a Server Switching Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) + DeleteServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteServerSwitchingRuleParams) + // Return one Server Switching Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) + GetServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetServerSwitchingRuleParams) + // Add a new Server Switching Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) + CreateServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateServerSwitchingRuleParams) + // Replace a Server Switching Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) + ReplaceServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceServerSwitchingRuleParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Server Switching Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules) +func (_ Unimplemented) GetServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetServerSwitchingRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Server Switching Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules) +func (_ Unimplemented) ReplaceServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceServerSwitchingRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Server Switching Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) +func (_ Unimplemented) DeleteServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteServerSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Server Switching Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) +func (_ Unimplemented) GetServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetServerSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Server Switching Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) +func (_ Unimplemented) CreateServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateServerSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Server Switching Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}) +func (_ Unimplemented) ReplaceServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceServerSwitchingRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetServerSwitchingRules operation middleware +func (siw *ServerInterfaceWrapper) GetServerSwitchingRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerSwitchingRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerSwitchingRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerSwitchingRules operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerSwitchingRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerSwitchingRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerSwitchingRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteServerSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) DeleteServerSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteServerSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteServerSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServerSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) GetServerSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateServerSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) CreateServerSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateServerSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateServerSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerSwitchingRule operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerSwitchingRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerSwitchingRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerSwitchingRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules", wrapper.GetServerSwitchingRules) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules", wrapper.ReplaceServerSwitchingRules) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}", wrapper.DeleteServerSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}", wrapper.GetServerSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}", wrapper.CreateServerSwitchingRule) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}", wrapper.ReplaceServerSwitchingRule) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Frfb9s2EP5XCLZPm2y5aVBg3pPbdFtehiAd9tKkxpk8W2wlUiWpOEag/30gaclWLCXO4CVeoZfAkfnj", + "u+Pd9x1PvqNMZbmSKK2h4zuq0eRKGvT/mByZmAsGVig5zRTH1EyZyjIlp/XA6vkk1Qh89fFWmLAUU9Ki", + "tO4j5Hm6Xib+apT0i7MEM3CfXmuc0zF9FW+gxOFbEz8JAmqtNC3LMqIcDdMid7PomP6VIFmvhJxoNKrQ", + "DAkEyAQD5ogmCBy1R/9ByblYFNpvPPgbtREBd3PlxjAyFymSm/XYaMtEu8qRjqmxWsiFQ1hGT/Pue+CX", + "+L1AY4/Mte/BOTQgO2YHnuEcitR+9HYclwt/R4kaUhKwHbMT/1T2N1VI/v9I7yUYIpUlcw/5Wf1aVl8H", + "HkV9g3pqlsKyRMjFVBcpbk1Us6/IXPrcDhZqsH4YjB5+8nM/VVMv3cytgQOR5Ur7U8jBJnRMF8ImxWzI", + "VBYnkGt1u7LIkpilAqUdSLDiBuObd3FYn3qobfg8cmExM48eYqt5ZVSZB1rDam/rzOHNe3qQ7Xc2VcIe", + "Eq4DLORc7QbjRJLJxTmZK00ykLAQckH+mFy4NUnwI6kdSZwnCUqrBZohjagV1oUcrSacgQVykYJEv+ig", + "fQUa0Srex9SdqMpRQi7omL4djoZvaOTt9BHiw0AwNJWhMdvOnngG7BtKbuK7HDRKO5WQYRl3x94C7a4T", + "LtEWWhoCadoO2RCbgCWgkVT7IydCbhHEGolzi8oxwDvnnohtR0DmoCFD69nj831MF96ealni7KLuEOk4", + "REFE/SP3X204jahTTaGR07HVBW7zSQ7Wonbzv3z+cnWlr67kVTEavWX+L/706+tX7tPJu7vyil7//JpG", + "OxQU3Qd5fkbUnNgEidUgDTBPacsENZKl40ppiVUEOPeDascMyQeQjkVnSAqD3E2RFQsSYTZ+HVZGfy9Q", + "rzZWb+03FfxB4ryOmgXoyWh0OKlpD7QWOflUMIbGzIt044bnlmUeypUuo2ovxf++CPLUWGQZ6FWdWAQk", + "8XTtgqU7x1zAwcLlAm3Tp+syonnRmr15CgwNAbJMVIokFca6rTpSeSls4sPRj1uIG5Qulets9GRoG+rf", + "mdzrvfsEf8kE30G9zp2wsztNliD75iKgoR4Vnnaw2wZvA44a3yRgiLCGqOVmuQ6LHshSIS0uULeewJwY", + "tBHhioCzhSHRmCrg/pFDvQRh65jdkqcwbMAxhdVTTQRDWAJygcalxvY4p4FuIc+ZyAkXGplNVy4MGt7t", + "coO3YRrANXxRs9McUoN1cM6UShFkReT+Uvhe8dWzcHgz28qjUJJJd5WiAx1xV1WdjE5eAFxTnUIMEWAM", + "c4ucgKzCsrre47071GUI2vOzXZ7fcFE9l7SEUZvwnYaDOqDobbVOXkZY/UET6CjSnbQ9pqfuisEUxwXK", + "wdqjg5niq8E6UTlY8NsetAiP74TkeFuG803R4u5Jn/nnptO6JovPVp6B/bJkrlW2r3iHbdrvwg9Kdzuq", + "cwegXcLF+qtu8X5cCPp6oa8X+nrhyfVCQ65PHrtOHYtgnYxOd9drp51Aol7yT8OsA0pQ3Zt9CZEL/Nyl", + "AntcFx9s9iiJT5cXF9z7iUt726dXlr7VdMga/Fg7TT8YE637WJ2UsU/rSpkWMppw7spcicsOLtqfcD5o", + "hL6a7avZvprtu1+HkZXHml9vXkDb2gs2T33P0/Xqm15V0+t09MuB12/+2uslhH7C+UNyfJiW2uPvsf7D", + "e0n3G6u+TujrhL5O6OuEg9cJo2OpE5719VhfKGwKhR+sGfDgu7cDvXarf0EZpLjQKR3T+OYtLa/LfwIA", + "AP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/server_switching_rule/server_switching_rule.go b/handlers/configuration/server_switching_rule/server_switching_rule.go new file mode 100644 index 00000000..90501343 --- /dev/null +++ b/handlers/configuration/server_switching_rule/server_switching_rule.go @@ -0,0 +1,210 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server_switching_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all server switching rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy server switching rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params GetServerSwitchingRulesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetServerSwitchingRules(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.ServerSwitchingRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) ReplaceServerSwitchingRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceServerSwitchingRulesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data ServerSwitchingRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceServerSwitchingRules(parentName, data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) DeleteServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteServerSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteServerSwitchingRule(int64(index), parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetServerSwitchingRuleParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetServerSwitchingRule(int64(index), parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) CreateServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateServerSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data ServerSwitchingRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateServerSwitchingRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceServerSwitchingRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceServerSwitchingRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data ServerSwitchingRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditServerSwitchingRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/server_template/server_template.gen.go b/handlers/configuration/server_template/server_template.gen.go new file mode 100644 index 00000000..10b66cd4 --- /dev/null +++ b/handlers/configuration/server_template/server_template.gen.go @@ -0,0 +1,710 @@ +// Package server_template provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package server_template + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// ServerTemplate defines model for server_template. +type ServerTemplate = models.ServerTemplate + +// ServerTemplates defines model for server_templates. +type ServerTemplates = models.ServerTemplates + +// GetServerTemplatesParams defines parameters for GetServerTemplates. +type GetServerTemplatesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateServerTemplateParams defines parameters for CreateServerTemplate. +type CreateServerTemplateParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteServerTemplateParams defines parameters for DeleteServerTemplate. +type DeleteServerTemplateParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetServerTemplateParams defines parameters for GetServerTemplate. +type GetServerTemplateParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceServerTemplateParams defines parameters for ReplaceServerTemplate. +type ReplaceServerTemplateParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateServerTemplateJSONRequestBody defines body for CreateServerTemplate for application/json ContentType. +type CreateServerTemplateJSONRequestBody = ServerTemplate + +// ReplaceServerTemplateJSONRequestBody defines body for ReplaceServerTemplate for application/json ContentType. +type ReplaceServerTemplateJSONRequestBody = ServerTemplate + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of server templates + // (GET /services/haproxy/configuration/backends/{parent_name}/server_templates) + GetServerTemplates(w http.ResponseWriter, r *http.Request, parentName string, params GetServerTemplatesParams) + // Add a new server template + // (POST /services/haproxy/configuration/backends/{parent_name}/server_templates) + CreateServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerTemplateParams) + // Delete a server template + // (DELETE /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) + DeleteServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params DeleteServerTemplateParams) + // Return one server template + // (GET /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) + GetServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params GetServerTemplateParams) + // Replace a server template + // (PUT /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) + ReplaceServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params ReplaceServerTemplateParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of server templates +// (GET /services/haproxy/configuration/backends/{parent_name}/server_templates) +func (_ Unimplemented) GetServerTemplates(w http.ResponseWriter, r *http.Request, parentName string, params GetServerTemplatesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new server template +// (POST /services/haproxy/configuration/backends/{parent_name}/server_templates) +func (_ Unimplemented) CreateServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerTemplateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a server template +// (DELETE /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) +func (_ Unimplemented) DeleteServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params DeleteServerTemplateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one server template +// (GET /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) +func (_ Unimplemented) GetServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params GetServerTemplateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a server template +// (PUT /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}) +func (_ Unimplemented) ReplaceServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params ReplaceServerTemplateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetServerTemplates operation middleware +func (siw *ServerInterfaceWrapper) GetServerTemplates(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerTemplatesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerTemplates(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateServerTemplate operation middleware +func (siw *ServerInterfaceWrapper) CreateServerTemplate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateServerTemplateParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateServerTemplate(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteServerTemplate operation middleware +func (siw *ServerInterfaceWrapper) DeleteServerTemplate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "prefix" ------------- + var prefix string + + err = runtime.BindStyledParameterWithOptions("simple", "prefix", chi.URLParam(r, "prefix"), &prefix, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "prefix", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteServerTemplateParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteServerTemplate(w, r, parentName, prefix, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServerTemplate operation middleware +func (siw *ServerInterfaceWrapper) GetServerTemplate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "prefix" ------------- + var prefix string + + err = runtime.BindStyledParameterWithOptions("simple", "prefix", chi.URLParam(r, "prefix"), &prefix, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "prefix", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetServerTemplateParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServerTemplate(w, r, parentName, prefix, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceServerTemplate operation middleware +func (siw *ServerInterfaceWrapper) ReplaceServerTemplate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "prefix" ------------- + var prefix string + + err = runtime.BindStyledParameterWithOptions("simple", "prefix", chi.URLParam(r, "prefix"), &prefix, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "prefix", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceServerTemplateParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceServerTemplate(w, r, parentName, prefix, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_templates", wrapper.GetServerTemplates) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_templates", wrapper.CreateServerTemplate) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}", wrapper.DeleteServerTemplate) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}", wrapper.GetServerTemplate) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}", wrapper.ReplaceServerTemplate) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Frfb9s2EP5XDmyfNtly06LAvKe06ba8DEFb7KVJjTN5sthKpEpSSYxA//tA0nIs2fnhwfmxwi+BLJHH", + "745330cecsW4LiutSDnLxlfMkK20shR+2Iq4zCRHJ7WalFpQYSdcl6VWk+XA9v1hYQjF/MOltNEU18qR", + "cv4Rq6pYmEm/Wa2CcZ5Tif7ppaGMjdmL9BpKGr/adCsIZIw2rGmahAmy3MjKz2Jj9jknWFgiAYasrg0n", + "wAgZKGJOWE4oyAT077XK5Kw2YeHBP2SsjLi7ljvDIJMFwflibLLioptXxMbMOiPVzCNsku2i+w7FR/pR", + "k3XPLLTv0Ac0InvOATyiDOvCfQh+PK8Q/kmKDBYQsT3nIP6t3R+6VuL/Ud4XaEFpB1mA/KhxbdrPkUfJ", + "nJOZOCqrAh2tTNHTb8R94VwOZnqweBndHX4Ksz63k1bGDGRZaRNCX6HL2ZjNpMvr6ZDrMs2xMvpy7ojn", + "KS8kKTdQ6OQ5pedv02iaBXxdUAGodFTaO/es502TtN6gMTi/jzN2995sn0j324W2KHcJ1wOWKtPrCXeo", + "4PDkGDJtoESFM6lm8NfhibcJMYTQxhBIOSPJDlnCnHSFx9wOPUKHcFKgomBu0J/LEtbm8Zj5DdQVKawk", + "G7PXw9HwFUuCbyEVwn5LTrZ1LuWrVZFOkX8nJWx6VaEh5SYKS2rSTek1I7fu8kdytVEWsCggToLlJHA5", + "OkBD0K5JAqRaKfbF6j4IuqII6VgEUnXrOVehwZJcIIEvfSAnAX5rEbwbzO8TG8eNTlh45X8t/WQJ8+In", + "DQk2dqamVVqo0Dkyfv7XL19PT83pqTqtR6PXPPylX35/+cI/Hby9ak7Z2a8vWbLGJEkf5PER6AxcTuAM", + "Kos8MNNFTobgwlOecuA0oBBh0DImQ3iPypPhlKC2JPwU1ZIZSHsd0mHr9I+azPza65X1JlLcyn9nSfcc", + "eTAa7U4x+nm1QQ8+1ZyTtVldXAfgsXVVxPPGTe4s45P+91NM4L26LNHMl3UEqCDQsE+Tfjn5BMOZz33W", + "E5ezJmGVthvK81AICwiKLvrmfCG6jvLeWIzvDaGjNUHbl+OjlOMa6kW+x5W91vCc+HevNR1qb/FsBrvq", + "8CrgpPMlRwvSWdAX1+Zu8OiWypLK0YzMxh3wae4SEBrQ+8IJDBUaRXjlUV+gdMFLvwMrOhKHDQQVON/W", + "RbTAc1QzsqEKVsZ5sfKGAsORACENcVfMfRp0ontTGIIPkwiuE4slo2RYWFom51TrglC1tBtuYu+0mD8U", + "40bC7ZZZs0b4rx52+R7f905GPNCN8Aebg9HBYyLpCkZMEUDOqXIkAFWbde2VmXr3ko8xJ4+P1on4mmqW", + "c2FDlmzSojdRf3eoQyvtiGD/tx3b7zaTnkJOD4XYLHu3iKi/JXAtaEZqsNikwVSL+WBR2gIdhmV2dKZO", + "rypDmbxsYrYUFO+W3bw5Cu+9hvf1u0v203kg6mgRMqPL+6p7XGE7df/UwxKXvUHg2283a/udkrc/TexP", + "E/vTxNaniY6mH9x1QXouencwerNur39IiHwpon692bGwLBulTyFdkY/XCf/269+tzRmtaCv5uP/VcK1P", + "s1eOfVvoYW4Jz6Ar9JMxzaLntIEd7mg11Ru5piqQb31SvT/VLBbY083+oLo/qO7bXg/R9ho9ZdvLRH7b", + "970er+/1k6l5yJ+tLg73bHkt/98gSmxtCjZm6flr1pw1/wYAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/server_template/server_template.go b/handlers/configuration/server_template/server_template.go new file mode 100644 index 00000000..02248d28 --- /dev/null +++ b/handlers/configuration/server_template/server_template.go @@ -0,0 +1,261 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package server_template + +import ( + "net/http" + "reflect" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all server template routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy server template configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetServerTemplates(w http.ResponseWriter, r *http.Request, parentName string, params GetServerTemplatesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, templates, err := cfg.GetServerTemplates(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.ServerTemplates{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, templates) +} + +func (h *HandlerImpl) CreateServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, params CreateServerTemplateParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data ServerTemplate + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateServerTemplate(parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params DeleteServerTemplateParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteServerTemplate(prefix, parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params GetServerTemplateParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, tmpl, err := cfg.GetServerTemplate(prefix, parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, tmpl) +} + +func (h *HandlerImpl) ReplaceServerTemplate(w http.ResponseWriter, r *http.Request, parentName string, prefix string, params ReplaceServerTemplateParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data ServerTemplate + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ondisk, err := cfg.GetServerTemplate(prefix, parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditServerTemplate(prefix, parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if serverTemplateNeedsReload(data, *ondisk, h.Client) { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +// serverTemplateNeedsReload reports whether replacing a server template requires a +// reload. Server templates have no runtime-API-editable fields, so any change to an +// existing template requires a reload; an identical body (no diff) does not. This +// mirrors the pre-migration changeThroughRuntimeAPI behavior for the ServerTemplate type. +func serverTemplateNeedsReload(data, ondisk models.ServerTemplate, client client_native.HAProxyClient) (reload bool) { + // reflect kinds and values are loosely checked as they are bound strictly in + // schema, but in case of any panic, we log and reload to ensure changes go through. + defer func() { + if r := recover(); r != nil { + log.Warning("serverTemplateNeedsReload panic:", r) + reload = true + } + }() + if _, err := client.Runtime(); err != nil { + return true + } + return len(serverTemplateCompareObjects(data, ondisk)) != 0 +} + +// serverTemplateCompareObjects returns the names of fields that differ between data and ondisk. +func serverTemplateCompareObjects(data, ondisk any) []string { + diff := []string{} + dataVal := reflect.ValueOf(data) + ondiskVal := reflect.ValueOf(ondisk) + for i := range dataVal.NumField() { + fName := dataVal.Type().Field(i).Name + dField := dataVal.FieldByName(fName) + oField := ondiskVal.FieldByName(fName) + + dKind := dField.Kind() + oKind := oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + if dKind == reflect.Ptr { + dField = dField.Elem() + oField = oField.Elem() + dKind = dField.Kind() + oKind = oField.Kind() + if dKind != oKind { + diff = append(diff, fName) + continue + } + } + switch dKind { + case reflect.Float32, reflect.Float64: + if dField.Float() != oField.Float() { + diff = append(diff, fName) + } + case reflect.Bool: + if dField.Bool() != oField.Bool() { + diff = append(diff, fName) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if dField.Int() != oField.Int() { + diff = append(diff, fName) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if dField.Uint() != oField.Uint() { + diff = append(diff, fName) + } + case reflect.String: + if dField.String() != oField.String() { + diff = append(diff, fName) + } + case reflect.Struct: + diff = append(diff, serverTemplateCompareObjects(dField.Interface(), oField.Interface())...) + } + } + return diff +} diff --git a/handlers/configuration/ssl_front_use/ssl_front_use.gen.go b/handlers/configuration/ssl_front_use/ssl_front_use.gen.go new file mode 100644 index 00000000..1df99373 --- /dev/null +++ b/handlers/configuration/ssl_front_use/ssl_front_use.gen.go @@ -0,0 +1,710 @@ +// Package ssl_front_use provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_front_use + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SslFrontUse defines model for ssl_front_use. +type SslFrontUse = models.SSLFrontUse + +// SslFrontUses defines model for ssl_front_uses. +type SslFrontUses = models.SSLFrontUses + +// GetAllSSLFrontUsesParams defines parameters for GetAllSSLFrontUses. +type GetAllSSLFrontUsesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSSLFrontUseParams defines parameters for CreateSSLFrontUse. +type CreateSSLFrontUseParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteSSLFrontUseParams defines parameters for DeleteSSLFrontUse. +type DeleteSSLFrontUseParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetSSLFrontUseParams defines parameters for GetSSLFrontUse. +type GetSSLFrontUseParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceSSLFrontUseParams defines parameters for ReplaceSSLFrontUse. +type ReplaceSSLFrontUseParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateSSLFrontUseJSONRequestBody defines body for CreateSSLFrontUse for application/json ContentType. +type CreateSSLFrontUseJSONRequestBody = SslFrontUse + +// ReplaceSSLFrontUseJSONRequestBody defines body for ReplaceSSLFrontUse for application/json ContentType. +type ReplaceSSLFrontUseJSONRequestBody = SslFrontUse + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all SSL Front Uses + // (GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses) + GetAllSSLFrontUses(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSSLFrontUsesParams) + // Add a new SSL Front Use + // (POST /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses) + CreateSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, params CreateSSLFrontUseParams) + // Delete a SSL Front Use + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) + DeleteSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteSSLFrontUseParams) + // Return one SSL Front Use + // (GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) + GetSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetSSLFrontUseParams) + // Replace a SSL Front Use + // (PUT /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) + ReplaceSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceSSLFrontUseParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all SSL Front Uses +// (GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses) +func (_ Unimplemented) GetAllSSLFrontUses(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSSLFrontUsesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new SSL Front Use +// (POST /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses) +func (_ Unimplemented) CreateSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, params CreateSSLFrontUseParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a SSL Front Use +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) +func (_ Unimplemented) DeleteSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteSSLFrontUseParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one SSL Front Use +// (GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) +func (_ Unimplemented) GetSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetSSLFrontUseParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a SSL Front Use +// (PUT /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}) +func (_ Unimplemented) ReplaceSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceSSLFrontUseParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSSLFrontUses operation middleware +func (siw *ServerInterfaceWrapper) GetAllSSLFrontUses(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSSLFrontUsesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSSLFrontUses(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSSLFrontUse operation middleware +func (siw *ServerInterfaceWrapper) CreateSSLFrontUse(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSSLFrontUseParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSSLFrontUse(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSSLFrontUse operation middleware +func (siw *ServerInterfaceWrapper) DeleteSSLFrontUse(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSSLFrontUseParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSSLFrontUse(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSSLFrontUse operation middleware +func (siw *ServerInterfaceWrapper) GetSSLFrontUse(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSSLFrontUseParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSSLFrontUse(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceSSLFrontUse operation middleware +func (siw *ServerInterfaceWrapper) ReplaceSSLFrontUse(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceSSLFrontUseParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceSSLFrontUse(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses", wrapper.GetAllSSLFrontUses) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses", wrapper.CreateSSLFrontUse) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}", wrapper.DeleteSSLFrontUse) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}", wrapper.GetSSLFrontUse) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}", wrapper.ReplaceSSLFrontUse) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhRb9s2EP4rB7ZPm2y5aVFg3pPbtF2AYgiadS9NalzIk8VOIlWSSmIE+u8DScuxbCexByfNCr8EjkQd", + "vzvefd/xrhnXZaUVKWfZ8JoZspVWlsI/tiIuM8nRSa3GpRZU2DHXZanVeL6wfT4qDKGYvruSNpriWjlS", + "zv/EqipmZtJvVqtgnOdUov/13FDGhuxZegMljW9tuhUEMkYb1jRNwgRZbmTlv2JD9ldOMLNEAgxZXRtO", + "gBEyUMScsJxQkAno32qVyUltwsa9v8lYGXF3LXeWQSYLgovZ2mTBRTetiA2ZdUaqiUfYJNtF9w2KT/S9", + "JuueWGjfoA9oRPaUA3hIGdaFexf8eFoh/ECKDBYQsT3lIP6p3XtdK/H/KO9LtKC0gyxAftS4Nu3r7XmU", + "2gydWdXn34j72rrqTXRv9jCu7bcZM3/Vk2WlTTiUCl3OhmwiXV6f97ku0xwro6+mjnie8kKScj2FTl5Q", + "evE6jRZZQG6LcWa0cuPa0oZITk4+vveffLb0sHhCQKWj0t6bWx03mqR1A43B6b1e2B274R2RKtOrSTZS", + "MDo+gkwbKFHhRKoJ/DE69jbh5OQjBETw2RKQckaS7bOEOekKD7xdeIgO4bhARcFYr/slS1ibt0PmQ6Er", + "UlhJNmQv+4P+C5YEv0JIU0vmQnKyrWMpX6yCNISUlLDpdYWGlBsrLKlJV09pQm7V20/kaqMsYFF0MVpw", + "OTpAQ9BuSAKkWqjs97OtfQB0RRHQkQgU6kZFsXR8FRosyYWS/7KM4zhgB4+d+ZNhw3i0CQuP/H9z51jC", + "vMRJQ4INnalpsfgrdI6M//7rl6+np+b0VJ3Wg8FLHv7SL78/f+Z/Hby+bk7Z2a/PWbLCF8kyuKND0Bm4", + "nMAZVBZ54J/LnAzBpSc25cBpQCHConks+vAWlae8c4LakvCfqJayQNqbWPZbp7/XZKY3Xi/sN5biTpY7", + "S7rd4sFgsDtd6CbTGs4/qTkna7O6uHH/sbVTxJ7iNmfm0Un/e6cS+K8uSzTTefEAKggk5pNktY58guHE", + "5zxbZOWzJmGVtmtKciSEBQRFl0t8I1VIr00K8K0hdNRVgX39PWj9raCepXjc2csJz4n/4+Wkw+AtnvVg", + "Fx1eBJx03uRoQToL+vLG3C0e3VFMUjmakFl7AhlYcgkIDeh94QSGCo0iPPKoL1G64KU/gQXFiMt6ggqc", + "busiWuA5qgnZkPsL67wseUOB0kiAkIa4K6Y+DTrRvS0MwYdxBNeJxZxEMiwszZPzXOuCULU8Gy5Yb7SY", + "PgzFRobtFlmzwu8vHnLzJXrvEBEP7CJ853IwOHg8FF1tiKkByDlVjgSgarOtvQHT0jXjU8zFo8NV0r2h", + "mPm3sCY71snOqyi0O5SchelCsP/bju13Z0M/QjlHQqyTuNu00vf+XAuakOrNzqd3rsW0N6tmgQ7DDrvp", + "ltNrqQRdNTFNCnK0mjCH4bkX6qXa6OTo+TTwcjAHmdHlxgoe7W+h4F0YR37H9UouZ69u1/D79WDfLuzb", + "hX27sHG70JHtg/suPU9F2A4Gr1btdWkmsqOIMvVqx/oxH2/+CIWK/LtM73dc5u4cr2hFm+vEFve8D+T2", + "ErGf6DxEx/8EBjo/GaXMxkUrXHDXhKheSypVgXy73nMLTpmZ3/PKvvXct577SdUuJlWDHzWpMpHL9qOq", + "xxpV/WSCHbJn00vAhlMqvwWZi1ZKa1OwIUsvXrLmrPk3AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/ssl_front_use/ssl_front_use.go b/handlers/configuration/ssl_front_use/ssl_front_use.go new file mode 100644 index 00000000..4f964ad1 --- /dev/null +++ b/handlers/configuration/ssl_front_use/ssl_front_use.go @@ -0,0 +1,177 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_front_use + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all ssl_front_use routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy ssl_front_use configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllSSLFrontUses(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSSLFrontUsesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, uses, err := cfg.GetSSLFrontUses("frontend", parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.SSLFrontUses{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, uses) +} + +func (h *HandlerImpl) CreateSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, params CreateSSLFrontUseParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data SslFrontUse + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateSSLFrontUse("frontend", parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteSSLFrontUseParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteSSLFrontUse(int64(index), "frontend", parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetSSLFrontUseParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, use, err := cfg.GetSSLFrontUse(int64(index), "frontend", parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, use) +} + +func (h *HandlerImpl) ReplaceSSLFrontUse(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceSSLFrontUseParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data SslFrontUse + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditSSLFrontUse(int64(index), "frontend", parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/stick_rule/stick_rule.gen.go b/handlers/configuration/stick_rule/stick_rule.gen.go new file mode 100644 index 00000000..f9220966 --- /dev/null +++ b/handlers/configuration/stick_rule/stick_rule.gen.go @@ -0,0 +1,815 @@ +// Package stick_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package stick_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// StickRule defines model for stick_rule. +type StickRule = models.StickRule + +// StickRules defines model for stick_rules. +type StickRules = models.StickRules + +// GetStickRulesParams defines parameters for GetStickRules. +type GetStickRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceStickRulesParams defines parameters for ReplaceStickRules. +type ReplaceStickRulesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteStickRuleParams defines parameters for DeleteStickRule. +type DeleteStickRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetStickRuleParams defines parameters for GetStickRule. +type GetStickRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateStickRuleParams defines parameters for CreateStickRule. +type CreateStickRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceStickRuleParams defines parameters for ReplaceStickRule. +type ReplaceStickRuleParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceStickRulesJSONRequestBody defines body for ReplaceStickRules for application/json ContentType. +type ReplaceStickRulesJSONRequestBody = StickRules + +// CreateStickRuleJSONRequestBody defines body for CreateStickRule for application/json ContentType. +type CreateStickRuleJSONRequestBody = StickRule + +// ReplaceStickRuleJSONRequestBody defines body for ReplaceStickRule for application/json ContentType. +type ReplaceStickRuleJSONRequestBody = StickRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all Stick Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/stick_rules) + GetStickRules(w http.ResponseWriter, r *http.Request, parentName string, params GetStickRulesParams) + // Replace a Stick Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules) + ReplaceStickRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceStickRulesParams) + // Delete a Stick Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) + DeleteStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteStickRuleParams) + // Return one Stick Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) + GetStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetStickRuleParams) + // Add a new Stick Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) + CreateStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateStickRuleParams) + // Replace a Stick Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) + ReplaceStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceStickRuleParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all Stick Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/stick_rules) +func (_ Unimplemented) GetStickRules(w http.ResponseWriter, r *http.Request, parentName string, params GetStickRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Stick Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules) +func (_ Unimplemented) ReplaceStickRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceStickRulesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Stick Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) +func (_ Unimplemented) DeleteStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteStickRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Stick Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) +func (_ Unimplemented) GetStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetStickRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Stick Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) +func (_ Unimplemented) CreateStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateStickRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Stick Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}) +func (_ Unimplemented) ReplaceStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceStickRuleParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetStickRules operation middleware +func (siw *ServerInterfaceWrapper) GetStickRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetStickRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStickRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStickRules operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStickRules(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStickRulesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStickRules(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStickRule operation middleware +func (siw *ServerInterfaceWrapper) DeleteStickRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteStickRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStickRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetStickRule operation middleware +func (siw *ServerInterfaceWrapper) GetStickRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetStickRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStickRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStickRule operation middleware +func (siw *ServerInterfaceWrapper) CreateStickRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateStickRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStickRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStickRule operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStickRule(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStickRuleParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStickRule(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules", wrapper.GetStickRules) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules", wrapper.ReplaceStickRules) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}", wrapper.DeleteStickRule) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}", wrapper.GetStickRule) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}", wrapper.CreateStickRule) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}", wrapper.ReplaceStickRule) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FpLb9s4EP4rA7anXTly06DAek9u093NZRGki700qTEmxxZbiVRJyo4R6L8vSFm25EcezXMLXQpHoobf", + "DGe+bzTqFeM6y7Ui5SwbXDFDNtfKUvjD5sTlRHJ0UqtRpgWldsR1lmk1Wi2srw9TQygWHy+lrUxxrRwp", + "539inqdLM/FXq1UwzhPK0P96bWjCBuxVvIYSV3dtfCcIZIw2rCzLiAmy3MjcP8UG7J+EYGmJBBiyujCc", + "ACvIQBXmiCWEgkxA/0GriZwWJmzc+5eMlRXutuXWMpjIlGC2XBs1XHSLnNiAWWekmnqEZXS36L5HcUbf", + "C7LuhYX2PfqAVshecgCPaYJF6j4GP15WCP8kRQZTqLC95CD+rd0fulDi/1Hec7SgtINJgPykcS3r23fn", + "UaozdGlVj78S97V12Zvq3vJitfagzpjVrZ7Mcm3CoeToEjZgU+mSYnzAdRYnmBt9uXDEk5inkpTrKXRy", + "RvHsXVxZZAG5k/zbyBQp3RLGJ//AmV//eFBCIKWjzN6YU2v4ZVTDR2NwcQN6+8DwvQNSTfR2Xg0VDE9P", + "YKINZKhwKtUU/hqeepsQ4IDHA6SckWQPWMScdP44WL3qGB3CaYqKgqVe4zEWsTpJB8yHQOekMJdswN4e", + "9A/esCh4FOIYWzIzycnWLsW8mfLxGPk3UsLGVzkaUm6kMKMy3jiWKbltH8/IFUZZwDRtgLPgEnSAhqDe", + "iQRI1ajf5Z7ea51TBeREBJ50rbPK0WBGLpT0583tTwPe2hh43MwfBxtU5xmxcMn/tXKMRcxLmTQk2MCZ", + "gppFnqNzZPzzXz5/OT835+fqvOj33/LwL/3y++tX/tfhu6vynF38+ppFW7wQbYI8OQY9AZcQOIPKIg88", + "M0/IEMw9gSkHTgMKERatwnEAH1B5ahsTFJaEf0TV1ATSrqN5UDv9vSCzWHvd2G8kxbVsdhG1u8LDfv/h", + "+L+RSDuI/VPBOVk7KdK1708tkKJqHPZ5sgpN/OPtSGC6IsvQLFaFA6ggkJbPkI0a8qmFU5/1bE29F2XE", + "8mJnIeYpcrKAME90SpBK67zVZlXOpUtCjoWbUzkj5atyVWKBq1xLZ/fW6XLDrlafvla3UC8rotrZnyFP", + "iH/zetMi+hrPbrBNh5uAo9adBC1IZ0HP1+b2eHRN7UnlaEpm5wlMwJKLQGhA7wsnMJRqFOGSRz1H6VaZ", + "2tCXallPUIqLu7qIFniCakrWF0RznRcxbyjQHwkQ0hB36cKnQSu6+8IQfBhV4FqxWHHOBFNLq+Qca50S", + "qpqTw0vXey0Wj0fH7RIrn08JhhtdhKk4Rvj+5rB/+FQw2jpS5QUg55Q7EoCqTrX6lZg23jvOqkQ8Od6m", + "6TW/rJ6FHamxS6KOqnN4QHlqjBueRwLD6QI2u2GvTLuVz7ftXAuakuotg9cba7HoLetMoMOww/3b3fhK", + "KkGXZXV+KTnaPsnjcN220bfpdrwIVBlswcTo7LbaWtluvnBdq6wNACd+r92yKpe39gvqzeTcaXin4Z2G", + "31nDW2p6eNOLy0sRnMP+0ba9BtdUzBjE+aha+oC6sRpCPocyVfzbova9b2PXjkW0olvKg8/Y24lDc0DS", + "KUM3ifmxxvelDmJ+MiZZjnnaPLB/sqPtDjIZCuHbTEXzJpfcnjA+GMKum+y6ya6b7CZCt5OFmwZCb55K", + "kBqtUyCxR5wEdYOgehB01P/tge23/9fQc+jwUIgtCb3PmOnmrzAP3fZvfm/pZLyT8U7GOxm/h4z3n17G", + "H/+LTqfjax3/yV6ltz8X3etLkbdOZlbLZ2FSNmDx7C0rL8r/AgAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/stick_rule/stick_rule.go b/handlers/configuration/stick_rule/stick_rule.go new file mode 100644 index 00000000..a9125ba1 --- /dev/null +++ b/handlers/configuration/stick_rule/stick_rule.go @@ -0,0 +1,210 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stick_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all stick rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy stick rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetStickRules(w http.ResponseWriter, r *http.Request, parentName string, params GetStickRulesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetStickRules(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.StickRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) ReplaceStickRules(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceStickRulesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data StickRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceStickRules(parentName, data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) DeleteStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteStickRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteStickRule(int64(index), parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetStickRuleParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetStickRule(int64(index), parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) CreateStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateStickRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data StickRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateStickRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceStickRule(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceStickRuleParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data StickRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditStickRule(int64(index), parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/table/table.gen.go b/handlers/configuration/table/table.gen.go new file mode 100644 index 00000000..5a674b1b --- /dev/null +++ b/handlers/configuration/table/table.gen.go @@ -0,0 +1,710 @@ +// Package table provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package table + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Table defines model for table. +type Table = models.StickTable + +// Tables defines model for tables. +type Tables = models.StickTables + +// GetTablesParams defines parameters for GetTables. +type GetTablesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTableParams defines parameters for CreateTable. +type CreateTableParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTableParams defines parameters for DeleteTable. +type DeleteTableParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTableParams defines parameters for GetTable. +type GetTableParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceTableParams defines parameters for ReplaceTable. +type ReplaceTableParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateTableJSONRequestBody defines body for CreateTable for application/json ContentType. +type CreateTableJSONRequestBody = Table + +// ReplaceTableJSONRequestBody defines body for ReplaceTable for application/json ContentType. +type ReplaceTableJSONRequestBody = Table + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of tables + // (GET /services/haproxy/configuration/peers/{parent_name}/tables) + GetTables(w http.ResponseWriter, r *http.Request, parentName string, params GetTablesParams) + // Add a new table + // (POST /services/haproxy/configuration/peers/{parent_name}/tables) + CreateTable(w http.ResponseWriter, r *http.Request, parentName string, params CreateTableParams) + // Delete a table + // (DELETE /services/haproxy/configuration/peers/{parent_name}/tables/{name}) + DeleteTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteTableParams) + // Return one table + // (GET /services/haproxy/configuration/peers/{parent_name}/tables/{name}) + GetTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetTableParams) + // Replace a table + // (PUT /services/haproxy/configuration/peers/{parent_name}/tables/{name}) + ReplaceTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceTableParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of tables +// (GET /services/haproxy/configuration/peers/{parent_name}/tables) +func (_ Unimplemented) GetTables(w http.ResponseWriter, r *http.Request, parentName string, params GetTablesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new table +// (POST /services/haproxy/configuration/peers/{parent_name}/tables) +func (_ Unimplemented) CreateTable(w http.ResponseWriter, r *http.Request, parentName string, params CreateTableParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a table +// (DELETE /services/haproxy/configuration/peers/{parent_name}/tables/{name}) +func (_ Unimplemented) DeleteTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteTableParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one table +// (GET /services/haproxy/configuration/peers/{parent_name}/tables/{name}) +func (_ Unimplemented) GetTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetTableParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a table +// (PUT /services/haproxy/configuration/peers/{parent_name}/tables/{name}) +func (_ Unimplemented) ReplaceTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceTableParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetTables operation middleware +func (siw *ServerInterfaceWrapper) GetTables(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTablesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTables(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTable operation middleware +func (siw *ServerInterfaceWrapper) CreateTable(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTableParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTable(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTable operation middleware +func (siw *ServerInterfaceWrapper) DeleteTable(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTableParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTable(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTable operation middleware +func (siw *ServerInterfaceWrapper) GetTable(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTableParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTable(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTable operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTable(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTableParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTable(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/tables", wrapper.GetTables) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/tables", wrapper.CreateTable) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/tables/{name}", wrapper.DeleteTable) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/tables/{name}", wrapper.GetTable) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/peers/{parent_name}/tables/{name}", wrapper.ReplaceTable) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhBb9s4E/0rA7an75MtNy0KrPeUNt3dXBZBW+ylSYMxObLYSqRKUnaNwP99QdKSrdip48BJvYUvhiWR", + "wzfDmffIuWFcl5VWpJxlwxtmyFZaWQoPtiIuM8nRSa2uSy2osNdcl6VW1+3A5v1pYQjF7N13aaMprpUj", + "5fxfrKpiYSb9YrUKxnlOJfp/zw1lbMiepUsoafxq050gkDHasPl8njBBlhtZ+VlsyD7mBAtLJMCQ1bXh", + "BBghA0XMCcsJBZmA/q1WmRzXJizc+4eMlRF313JnGGSyIJgsxiYrLrpZRWzIrDNSjT3CebJbdN+geE/f", + "arLuwEL7Bn1AI7JDDuAZZVgX7l3w47BC+CcpMlhAxHbIQfxbuz90rcR/o7ynaEFpB1mA/KRxnTefd+dR", + "ajJ0YVWPvhD3tfW9N9a9xcs4tt9kTPupJ8tKm7ApFbqcDdlYurwe9bku0xwro7/PHPE85YUk5XoKnZxQ", + "OnmdRovMI3c4KuieCD44yb9+DBMeBUaIn3RU2m2pFFH7eREgGoOzbaDtnlF73FJlej2VThWcXpxDpg2U", + "qHAs1Rj+Or3wNiHggQAISDkjyfZZwpx0fh9YM+wMHcJFgYqCqR40cW9ycsi8/7oihZVkQ/ayP+i/YEnw", + "JsQvtWQmkpNt3En5aoanFZGx6U2FhpS7VljSPF1uw5jcul/vydVGWcCigDgUXI4O0BA0xkmAVCsVGpYB", + "S9zb8J7qiiKCcxH40LWbU6HBklwo20+3174IOLvmwKNmfhfYMG5jwsIr/9S6xRLmRUsaEmzoTE2r5Vyh", + "c2T8/M+fPl9emstLdVkPBi95+KX//f78mf938vpmfsmu/v+cJWsMkNyGen4GOgOXEziDymLEOs3JEEw9", + "VSkHTgMKEQa1AenDW1SexEYEtSXhp6iGhEDaZVT7jdPfajKzpdcr611L8UPeukq657+TwWBvTL9Iow3s", + "/aHmnKzN6mLp9lOroIing7ucaKOSPvzMETShLks0s7ZsABUEngrJ0eS8w7HPdhbL+2qesErbDaV3KoQF", + "BEXTONcXmetI4ZZCe2sIHTUsciy1Jyy1NdSLrI4re5XgOfGvXiU6FN3g2Qx21eFVwEnnS44WpLOgp0tz", + "d3j0g/qRytGYzMYdyMCSS0BoQO8LJzBUaBThlUc9RemCl34HVmQiDusJKnC2q4togeeoxmRDIayM81rk", + "DQX2IgFCGuKumPk06ET3rjAEH64juE4sWt7IsLDUJudI64JQNZQabkdvtJjtl00jmXaLa75G4S8eY9Fb", + "5+/APjywifBHkJPByeOv2qX7uPWAnFPlSACqJpua6yndugO8j7l2frbOrEsKaefCht3fpCSvombuUUVW", + "rv7B/m97tt9t3PwMMTwVYlXH1iXQH9K5FjQm1VvsSG+kxay3qE+BDoPNhx9w05vwFHOhIEfrWXEW3nvJ", + "jXLbJebRLJCqtwKZ0eVuUhxt30uKY7Xdrb1bRXerFh3F/ij2R7F/oNh3xPdk2y3lUGTrZPBq3V5kmkiH", + "IorPqz2rQttR/Bm6E0m34fONN68f9jy0oq1SsOudrGl+HFXg2F3ZwyH5EJorvxhrLFo3bfFv7tjUG3mj", + "KpDf6wS5K20sTB+p43iAPB4gj92iB3eLBk/VLTKRsI7tosduF/1i2huy5u4j+z07Rd4omUmjj7Up2JCl", + "k5dsfjX/NwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/table/table.go b/handlers/configuration/table/table.go new file mode 100644 index 00000000..e7d0637b --- /dev/null +++ b/handlers/configuration/table/table.go @@ -0,0 +1,177 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package table + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all table routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy table configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetTables(w http.ResponseWriter, r *http.Request, parentName string, params GetTablesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, tables, err := cfg.GetTables(parentName, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.Tables{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, tables) +} + +func (h *HandlerImpl) CreateTable(w http.ResponseWriter, r *http.Request, parentName string, params CreateTableParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data models.Table + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTable(parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteTableParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTable(name, parentName, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetTableParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ta, err := cfg.GetTable(name, parentName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ta) +} + +func (h *HandlerImpl) ReplaceTable(w http.ResponseWriter, r *http.Request, parentName string, name string, params ReplaceTableParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data models.Table + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditTable(name, parentName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/tcp/tcp_check/tcp_check.gen.go b/handlers/configuration/tcp/tcp_check/tcp_check.gen.go new file mode 100644 index 00000000..9c2e96d2 --- /dev/null +++ b/handlers/configuration/tcp/tcp_check/tcp_check.gen.go @@ -0,0 +1,1351 @@ +// Package tcp_check provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package tcp_check + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// TcpCheck defines model for tcp_check. +type TcpCheck = models.TCPCheck + +// TcpChecks defines model for tcp_checks. +type TcpChecks = models.TCPChecks + +// GetAllTCPCheckBackendParams defines parameters for GetAllTCPCheckBackend. +type GetAllTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPCheckBackendParams defines parameters for ReplaceAllTCPCheckBackend. +type ReplaceAllTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPCheckBackendParams defines parameters for DeleteTCPCheckBackend. +type DeleteTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPCheckBackendParams defines parameters for GetTCPCheckBackend. +type GetTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPCheckBackendParams defines parameters for CreateTCPCheckBackend. +type CreateTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPCheckBackendParams defines parameters for ReplaceTCPCheckBackend. +type ReplaceTCPCheckBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllTCPCheckDefaultsParams defines parameters for GetAllTCPCheckDefaults. +type GetAllTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPCheckDefaultsParams defines parameters for ReplaceAllTCPCheckDefaults. +type ReplaceAllTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPCheckDefaultsParams defines parameters for DeleteTCPCheckDefaults. +type DeleteTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPCheckDefaultsParams defines parameters for GetTCPCheckDefaults. +type GetTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPCheckDefaultsParams defines parameters for CreateTCPCheckDefaults. +type CreateTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPCheckDefaultsParams defines parameters for ReplaceTCPCheckDefaults. +type ReplaceTCPCheckDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllTCPCheckBackendJSONRequestBody defines body for ReplaceAllTCPCheckBackend for application/json ContentType. +type ReplaceAllTCPCheckBackendJSONRequestBody = TcpChecks + +// CreateTCPCheckBackendJSONRequestBody defines body for CreateTCPCheckBackend for application/json ContentType. +type CreateTCPCheckBackendJSONRequestBody = TcpCheck + +// ReplaceTCPCheckBackendJSONRequestBody defines body for ReplaceTCPCheckBackend for application/json ContentType. +type ReplaceTCPCheckBackendJSONRequestBody = TcpCheck + +// ReplaceAllTCPCheckDefaultsJSONRequestBody defines body for ReplaceAllTCPCheckDefaults for application/json ContentType. +type ReplaceAllTCPCheckDefaultsJSONRequestBody = TcpChecks + +// CreateTCPCheckDefaultsJSONRequestBody defines body for CreateTCPCheckDefaults for application/json ContentType. +type CreateTCPCheckDefaultsJSONRequestBody = TcpCheck + +// ReplaceTCPCheckDefaultsJSONRequestBody defines body for ReplaceTCPCheckDefaults for application/json ContentType. +type ReplaceTCPCheckDefaultsJSONRequestBody = TcpCheck + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all TCP Checks + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks) + GetAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckBackendParams) + // Replace a TCP Check list + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks) + ReplaceAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckBackendParams) + // Delete a TCP Check + // (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) + DeleteTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckBackendParams) + // Return one TCP Check + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) + GetTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckBackendParams) + // Add a new TCP Check + // (POST /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) + CreateTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckBackendParams) + // Replace a TCP Check + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) + ReplaceTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckBackendParams) + // Return an array of all TCP Checks + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks) + GetAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckDefaultsParams) + // Replace a TCP Check list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks) + ReplaceAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckDefaultsParams) + // Delete a TCP Check + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) + DeleteTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckDefaultsParams) + // Return one TCP Check + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) + GetTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckDefaultsParams) + // Add a new TCP Check + // (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) + CreateTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckDefaultsParams) + // Replace a TCP Check + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) + ReplaceTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckDefaultsParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all TCP Checks +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks) +func (_ Unimplemented) GetAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Check list +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks) +func (_ Unimplemented) ReplaceAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Check +// (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) DeleteTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Check +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) GetTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Check +// (POST /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) CreateTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Check +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) ReplaceTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all TCP Checks +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks) +func (_ Unimplemented) GetAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Check list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks) +func (_ Unimplemented) ReplaceAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Check +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) DeleteTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Check +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) GetTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Check +// (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) CreateTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Check +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}) +func (_ Unimplemented) ReplaceTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPCheckBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPCheckBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) GetTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPCheckBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPCheckBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPCheckBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPCheckBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPCheckDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPCheckDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPCheckDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPCheckDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPCheckDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPCheckDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks", wrapper.GetAllTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks", wrapper.ReplaceAllTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}", wrapper.DeleteTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}", wrapper.GetTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}", wrapper.CreateTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}", wrapper.ReplaceTCPCheckBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks", wrapper.GetAllTCPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks", wrapper.ReplaceAllTCPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}", wrapper.DeleteTCPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}", wrapper.GetTCPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}", wrapper.CreateTCPCheckDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}", wrapper.ReplaceTCPCheckDefaults) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FpRc9o4EP4rGrVPdwbTNNOZ455I0uvl5SbT69xLkzKLtGC1tuRKMoTJ8N9vJNtgBwhJkxDa0UuGYLH+", + "Vtr9vvV6byhTWa4kSmto/4ZqNLmSBv0/JkcmxoKBFUoOM8UxNUOmskzJ4XJh/f0g1Qh8/v5amNIUU9Ki", + "tO4j5HlamYm/GiW9cZZgBu7Ta41j2qev4hWUuLxq4gdBQK2VpovFIqIcDdMid7+iffopQVJZQk40GlVo", + "hgRKyARLzBFNEDhqj/5UybGYFNrfuPMfaiNK3G3LrWVkLFIk02pt1HDRznOkfWqsFnLiEC6ih+3uCfCP", + "+L1AYw9sa0/AbWiJ7JA38AzHUKT2vffjsLbwA0rUkJIS2yFv4j/K/qUKyX+O9J6BIVJZMvaQ97qvi/ry", + "w3kU6witrKrRV2Qut647E9WpvizXduuIWV7qiCxX2h9KDjahfToRNilGXaayOIFcq+u5RZbELBUobUeC", + "FVOMp+/i0iJ1yC3LhyxB9u2eKD6dXpz65c8GxO+isJiZXQG1wu5+X8IErWF+N3TzxNgdeiHHaj2kBpIM", + "Ls7JWGmSgYSJkBPy9+DC2SSfTi9ICadLI2qFTR3U+uoZWCAXKUj0Fjqr5TSidVj2qXNc5SghF7RP33Z7", + "3Tc08o74zYsN6qlgaGpPYtYM8ngE7BtKbuKbHDRKO5SQ4SJuH8UE7bpnH9EWWhoCadrwhNgELAGNpL4P", + "ciJkI19Pyjs6l1WOJYxz7nnRDtK0PqJqmfdFQ4bWp/Ln2yguPGriUFN3BrRfHmJE/Vfuv6VbNKJOuoRG", + "TvtWF9hM6hysRe1+/+Xzl8tLfXkpL4te7y3zf/G3P1+/cp+O3t0sLunV769ptMYD0W1w52dEjYlNkFgN", + "0gDzvDJLUCOZOcKSllhFgHO/aLkdXXIK0lHZCElhkLufyJqKiDCr3ezWTn8vUM9XXjfuNxT8Tva6itpV", + "4FGv92R83wijDTz+b8EYGjMu0pXr+9ZDXtYJ2xxZ7kz849WHV4ciy0DPl2lDQBLPUy5A2hnkAgsmLtbp", + "kmmvFhHNi41JmKfA0BAgs0SlSFJhrLPZyMiZsImPL39tIqYoXUYu08qTk21p6tYcre4X8nT/ebqGukqH", + "8s7uDH2mOYFpUXyNZzPYpsNNwFHrSgKGCGuImq3MbfHojsQT0uIE9cYTGBODNiJcEXC+MCQaUwXcf+VQ", + "z0DYZaQ2tKVc1uGYwvyhLoIhLAE5QeMSornOCZgz5KkPOeFCI7Pp3IVBa3e3bYP3YViCa+3FknDGkBpc", + "BudIqRRB1nzsH7BOFJ8/GxW3M2zxYiIwaJcPuiQY7sqao97RnkC0BaSMCQKMYW6RE5B1mNWPvnjr+eJj", + "GYTnZ+sMveKW5W/JhrDYpE3H5SE8oS412govo33+cAmsTtyL0kbJcxU6UxwnKDvV1nVGis87VYZxsODt", + "P7rEjW+E5Hi9KA8vRYvrx3jmvzct6G2aHc09RXpTZKxVdl9NLU0/UE9XKM7dDTdrqqgubVfT3cwchDsI", + "dxDuewt3S0OPdj2qHIrSHPWO1+2tKKYkRa/Jx+XKJ9SLZZPxJRSp5N4mq297/LqzB6Ik3k8XXLTeTxU+", + "oA2SEHouj6h0D7Xl8otRSNXQaVHA1h6OMhtYZMC5KywlzhokUgXxiincVj6AP041QqgqQ1UZqsrQDtqt", + "Eru6QW/2I0+NGsrT1/O1gUIXqO4CHff+eGL77dGgl9DkAee3BfURPabd716euPavLAfxDuIdxDuI92PF", + "u7dv8X72lzhBvVfq/Ys9TK+9IXrel0OVh3ucf6q8N7sGoOp1YbIiTECFCah9T0Btz9L1EaiQqaFuDnVz", + "mIEKM1BhBupAZ6B2lrn7mYHarqrtIaj7KmpoeQXpDtIdpqDCFNTPPQV1Z08kiELovIQ5qDAHdecc1HYG", + "aQ9CBRIJlWWoLENTKExChXepYRLqUCahdr5tCfId5DvId5DvMAsV9DvMQv3QSyJnG/W01stCp7RP4+lb", + "urha/B8AAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/tcp/tcp_check/tcp_check.go b/handlers/configuration/tcp/tcp_check/tcp_check.go new file mode 100644 index 00000000..c75c4e19 --- /dev/null +++ b/handlers/configuration/tcp/tcp_check/tcp_check.go @@ -0,0 +1,263 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tcp_check + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all TCP check routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy TCP check configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend parent --- + +func (h *HandlerImpl) GetAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckBackendParams) { + h.getAllTCPCheck(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckBackendParams) { + h.replaceAllTCPCheck(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckBackendParams) { + h.deleteTCPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckBackendParams) { + h.getTCPCheck(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckBackendParams) { + h.createTCPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPCheckBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckBackendParams) { + h.replaceTCPCheck(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults parent --- + +func (h *HandlerImpl) GetAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPCheckDefaultsParams) { + h.getAllTCPCheck(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPCheckDefaultsParams) { + h.replaceAllTCPCheck(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPCheckDefaultsParams) { + h.deleteTCPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPCheckDefaultsParams) { + h.getTCPCheck(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPCheckDefaultsParams) { + h.createTCPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPCheckDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPCheckDefaultsParams) { + h.replaceTCPCheck(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared internal methods --- + +func (h *HandlerImpl) getAllTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, checks, err := cfg.GetTCPChecks(parentType, parentName, transactionID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, TcpChecks{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, checks) +} + +func (h *HandlerImpl) replaceAllTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpChecks + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceTCPChecks(parentType, parentName, data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTCPCheck(int64(index), parentType, parentName, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, check, err := cfg.GetTCPCheck(int64(index), parentType, parentName, transactionID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, check) +} + +func (h *HandlerImpl) createTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpCheck + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTCPCheck(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceTCPCheck(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpCheck + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditTCPCheck(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.gen.go b/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.gen.go new file mode 100644 index 00000000..019c6aec --- /dev/null +++ b/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.gen.go @@ -0,0 +1,1886 @@ +// Package tcp_request_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package tcp_request_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// TcpRequestRule defines model for tcp_request_rule. +type TcpRequestRule = models.TCPRequestRule + +// TcpRequestRules defines model for tcp_request_rules. +type TcpRequestRules = models.TCPRequestRules + +// GetAllTCPRequestRuleBackendParams defines parameters for GetAllTCPRequestRuleBackend. +type GetAllTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPRequestRuleBackendParams defines parameters for ReplaceAllTCPRequestRuleBackend. +type ReplaceAllTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPRequestRuleBackendParams defines parameters for DeleteTCPRequestRuleBackend. +type DeleteTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPRequestRuleBackendParams defines parameters for GetTCPRequestRuleBackend. +type GetTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPRequestRuleBackendParams defines parameters for CreateTCPRequestRuleBackend. +type CreateTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPRequestRuleBackendParams defines parameters for ReplaceTCPRequestRuleBackend. +type ReplaceTCPRequestRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllTCPRequestRuleDefaultsParams defines parameters for GetAllTCPRequestRuleDefaults. +type GetAllTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPRequestRuleDefaultsParams defines parameters for ReplaceAllTCPRequestRuleDefaults. +type ReplaceAllTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPRequestRuleDefaultsParams defines parameters for DeleteTCPRequestRuleDefaults. +type DeleteTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPRequestRuleDefaultsParams defines parameters for GetTCPRequestRuleDefaults. +type GetTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPRequestRuleDefaultsParams defines parameters for CreateTCPRequestRuleDefaults. +type CreateTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPRequestRuleDefaultsParams defines parameters for ReplaceTCPRequestRuleDefaults. +type ReplaceTCPRequestRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllTCPRequestRuleFrontendParams defines parameters for GetAllTCPRequestRuleFrontend. +type GetAllTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPRequestRuleFrontendParams defines parameters for ReplaceAllTCPRequestRuleFrontend. +type ReplaceAllTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPRequestRuleFrontendParams defines parameters for DeleteTCPRequestRuleFrontend. +type DeleteTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPRequestRuleFrontendParams defines parameters for GetTCPRequestRuleFrontend. +type GetTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPRequestRuleFrontendParams defines parameters for CreateTCPRequestRuleFrontend. +type CreateTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPRequestRuleFrontendParams defines parameters for ReplaceTCPRequestRuleFrontend. +type ReplaceTCPRequestRuleFrontendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllTCPRequestRuleBackendJSONRequestBody defines body for ReplaceAllTCPRequestRuleBackend for application/json ContentType. +type ReplaceAllTCPRequestRuleBackendJSONRequestBody = TcpRequestRules + +// CreateTCPRequestRuleBackendJSONRequestBody defines body for CreateTCPRequestRuleBackend for application/json ContentType. +type CreateTCPRequestRuleBackendJSONRequestBody = TcpRequestRule + +// ReplaceTCPRequestRuleBackendJSONRequestBody defines body for ReplaceTCPRequestRuleBackend for application/json ContentType. +type ReplaceTCPRequestRuleBackendJSONRequestBody = TcpRequestRule + +// ReplaceAllTCPRequestRuleDefaultsJSONRequestBody defines body for ReplaceAllTCPRequestRuleDefaults for application/json ContentType. +type ReplaceAllTCPRequestRuleDefaultsJSONRequestBody = TcpRequestRules + +// CreateTCPRequestRuleDefaultsJSONRequestBody defines body for CreateTCPRequestRuleDefaults for application/json ContentType. +type CreateTCPRequestRuleDefaultsJSONRequestBody = TcpRequestRule + +// ReplaceTCPRequestRuleDefaultsJSONRequestBody defines body for ReplaceTCPRequestRuleDefaults for application/json ContentType. +type ReplaceTCPRequestRuleDefaultsJSONRequestBody = TcpRequestRule + +// ReplaceAllTCPRequestRuleFrontendJSONRequestBody defines body for ReplaceAllTCPRequestRuleFrontend for application/json ContentType. +type ReplaceAllTCPRequestRuleFrontendJSONRequestBody = TcpRequestRules + +// CreateTCPRequestRuleFrontendJSONRequestBody defines body for CreateTCPRequestRuleFrontend for application/json ContentType. +type CreateTCPRequestRuleFrontendJSONRequestBody = TcpRequestRule + +// ReplaceTCPRequestRuleFrontendJSONRequestBody defines body for ReplaceTCPRequestRuleFrontend for application/json ContentType. +type ReplaceTCPRequestRuleFrontendJSONRequestBody = TcpRequestRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all TCP Request Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules) + GetAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleBackendParams) + // Replace a TCP Request Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules) + ReplaceAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleBackendParams) + // Delete a TCP Request Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) + DeleteTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleBackendParams) + // Return one TCP Request Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) + GetTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleBackendParams) + // Add a new TCP Request Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) + CreateTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleBackendParams) + // Replace a TCP Request Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) + ReplaceTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleBackendParams) + // Return an array of all TCP Request Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules) + GetAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleDefaultsParams) + // Replace a TCP Request Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules) + ReplaceAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleDefaultsParams) + // Delete a TCP Request Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) + DeleteTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleDefaultsParams) + // Return one TCP Request Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) + GetTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleDefaultsParams) + // Add a new TCP Request Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) + CreateTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleDefaultsParams) + // Replace a TCP Request Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) + ReplaceTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleDefaultsParams) + // Return an array of all TCP Request Rules + // (GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules) + GetAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleFrontendParams) + // Replace a TCP Request Rule list + // (PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules) + ReplaceAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleFrontendParams) + // Delete a TCP Request Rule + // (DELETE /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) + DeleteTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleFrontendParams) + // Return one TCP Request Rule + // (GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) + GetTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleFrontendParams) + // Add a new TCP Request Rule + // (POST /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) + CreateTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleFrontendParams) + // Replace a TCP Request Rule + // (PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) + ReplaceTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleFrontendParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all TCP Request Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules) +func (_ Unimplemented) GetAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules) +func (_ Unimplemented) ReplaceAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Request Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) DeleteTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Request Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) GetTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Request Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) CreateTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) ReplaceTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all TCP Request Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules) +func (_ Unimplemented) GetAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules) +func (_ Unimplemented) ReplaceAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Request Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) DeleteTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Request Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) GetTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Request Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) CreateTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) ReplaceTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all TCP Request Rules +// (GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules) +func (_ Unimplemented) GetAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule list +// (PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules) +func (_ Unimplemented) ReplaceAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Request Rule +// (DELETE /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) DeleteTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Request Rule +// (GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) GetTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Request Rule +// (POST /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) CreateTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Request Rule +// (PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}) +func (_ Unimplemented) ReplaceTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleFrontendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPRequestRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPRequestRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPRequestRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPRequestRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPRequestRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPRequestRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPRequestRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPRequestRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPRequestRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPRequestRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPRequestRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPRequestRuleFrontend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) GetTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPRequestRuleFrontend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPRequestRuleFrontendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPRequestRuleFrontend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules", wrapper.GetAllTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules", wrapper.ReplaceAllTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}", wrapper.DeleteTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}", wrapper.GetTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}", wrapper.CreateTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}", wrapper.ReplaceTCPRequestRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules", wrapper.GetAllTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules", wrapper.ReplaceAllTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}", wrapper.DeleteTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}", wrapper.GetTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}", wrapper.CreateTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}", wrapper.ReplaceTCPRequestRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules", wrapper.GetAllTCPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules", wrapper.ReplaceAllTCPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}", wrapper.DeleteTCPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}", wrapper.GetTCPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}", wrapper.CreateTCPRequestRuleFrontend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}", wrapper.ReplaceTCPRequestRuleFrontend) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FxPb9s+Ev0qBNvTrhy5aVBgvScnabu5LIJssZcmNRhybLGVSZWk4hiBv/sPpCT/iaTY6c+xnWAuhSNR", + "5MyQ895o9NAHyvU40wqUs7T3QA3YTCsL4Q+bAZdDyZmTWg3GWkBqB1yPx1oN5gOr6/3UABPTz/fSFlNx", + "rRwo53+yLEvLaeKfVqswOU9gzPyv9waGtEffxQtT4uKujZ9lAhijDZ3NZhEVYLmRmX+K9ui3BEg5Ewhi", + "wOrccCCsMJlAYXNEE2ACTLD+TKuhHOUmLNz5PxgrC7tXZ14ZRoYyBXJXjo2WXHTTDGiPWmekGnkLZ9Hz", + "onvKxBX8zsG6AwvtKfMBLSw75ACew5Dlqfsc/DisEH4FBYalpLDtkIP4X+2+6FyJ15HeE2aJ0o4Mg8k7", + "jeusuv18HIXqhJaz6tufwH1u3XdGulNeLMYeVSdmfqsjx5k2YVMy5hLaoyPpkvz2iOtxnLDM6PupA57E", + "PJWgXEcxJ+8gvvsUFzNSb7nj2aBM6YHJU9jQmG9nlyVEXfmHXtqqEFnpYGzXHbKaP362wnRmDJtu4o7d", + "sj/eI6mGun7m+or0Ly/IUBsyZoqNpBqR//Qv/Zzk29klKY0iwaojGlEnnd8jWg06Z46Ry5QpCBN1ak/R", + "iFanuEd9MHQGimWS9ujHo+7RBxoFt0JcYwvmTnKwlV8xX86J+JbxX6CEjR8yZkC5gWJjmMWNmzUCV3f3", + "ClxulCUsTevuEZcwR5gBUq0Kgki1lOynxfo+DjqDwqgLEUDV9dN0dRPLwcE/w8bgAhp8f2zSZfCEeE+o", + "3yXaK7Y5ouGS/2vuKo2o91MaELTnTA7LuJAx58D45398/3F9ba6v1XXe7X7k4V/4x7/fv/O/jj89zK7p", + "zT/f06gGJdFj4y7OiR4SlwBxhinLeICmSQIGyMRjnnLEacKECIPmQTkiZ0x5NLwFklsQ/hFVoRmRdhHT", + "o8rp3zmY6cLrpfUGUjwJgDfRaiF53O1ujTLqR6uBEf6Xcw7WDvN0EYFdM6soKo42f+YBiv+8jgk8k4/H", + "zEznqUSYIgHW/DlpzCp/zNjIn3z6CLNvZhHN8sYszVLGwRJGJolOgaTSOr9APWUn0iXh6IUhI3kHyqfs", + "POMCsrkVxm5N4nJZTOR9JXLN6jJRipX9TvIE+C/PUSu8UNnTbOyyw8sGRyt3EmaJdJboyWK6Fo+eSEmp", + "HIzANO7AkFhwERGaMO8LB2Ig1UyES97qCZNufl6XKKgY1hGQsulzXWSW8ISpEVifFsvjPM/5iQI2giBC", + "GuAunfpjsBLdtjAEHwaFcSuxmEPRkKUW5ofzVusUmKoAO6TXqRbTl8bq1USb7Zss+o2lhymwR/gC6bh7", + "vFuTVmmnOC+EcQ6ZA0GYqo5g9eoNj95vrooDenFeh/IF7syfJQ1HponRToqd2SKbLbU19sOYYY8Jq+1/", + "YK8niNK/DXAtYASqU8axc6vFtFOmomCOhcW2VUDHD1IJuJ8VG5qCg/rWnofrtsmdVXS+nQZkDTOSodHj", + "TQm5WOGPyLhm0oVfvZmXZXmrnZHXozuSP5I/kv/G5L9CwMfrXoQOhZGOuyf1+WpIU+BlYPKT4oEt0su8", + "J7oPAivwuAHwn37He7IToxU8iz/8Qd6MPb6CQ+rABtCWC+hD7f+8Magpu0tN6LCmoaRtA9r0hfCFqoJJ", + "HWzK871AFB/eZ+DMmQGGVSpWqVilYovqz9hkXYfqw07ZrF6NBYB78dYUdqaqztRJ919bnn9VLrUPQu8L", + "0ULAf7vvtf4r0su8YJQLIPMj8yPzI/O/BPN398v8u/oqhdS/oP439hrf9slrF1+7Snf3JhcrA2M304tV", + "o1FngoIxFIwdkGCsPY3bFGOYyliVY1WOkjGUjKFk7LVLxjYtoncqGWun5CbN2KZ0jE05pH+kfxSNoWjs", + "rYvGnuzMIHlgGwhlYygb24psrB1pmnRjCDZYqWKlio0qFI7h12MUjr1y4dja70bI/cj9yP3I/SgdQ/JH", + "6dhBSceGJhzW/f1XY19KAzbTjlWjUXCC2jHUjh2Qdqw9jdu0Y5jKWJZjWY7aMdSOoXbstWvHNq6idyoe", + "a+fkJvHYpnyMbTnkf+R/FI+heOyti8eebM0geWAfCMVjKB7binisHWmaxGMINlipYqWKnSoUj+H3YxSP", + "vXLx2NoPR8j9yP3I/cj9KB5D8kfx2A7FY34hMHcVv+YmpT0a332ks5vZXwEAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.go b/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.go new file mode 100644 index 00000000..122963c2 --- /dev/null +++ b/handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.go @@ -0,0 +1,289 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tcp_request_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all TCP request rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy TCP request rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend parent --- + +func (h *HandlerImpl) GetAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleBackendParams) { + h.getAllTCPRequestRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleBackendParams) { + h.replaceAllTCPRequestRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleBackendParams) { + h.deleteTCPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleBackendParams) { + h.getTCPRequestRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleBackendParams) { + h.createTCPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPRequestRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleBackendParams) { + h.replaceTCPRequestRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults parent --- + +func (h *HandlerImpl) GetAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleDefaultsParams) { + h.getAllTCPRequestRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleDefaultsParams) { + h.replaceAllTCPRequestRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleDefaultsParams) { + h.deleteTCPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleDefaultsParams) { + h.getTCPRequestRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleDefaultsParams) { + h.createTCPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPRequestRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleDefaultsParams) { + h.replaceTCPRequestRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Frontend parent --- + +func (h *HandlerImpl) GetAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPRequestRuleFrontendParams) { + h.getAllTCPRequestRule(w, r, "frontend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPRequestRuleFrontendParams) { + h.replaceAllTCPRequestRule(w, r, "frontend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPRequestRuleFrontendParams) { + h.deleteTCPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPRequestRuleFrontendParams) { + h.getTCPRequestRule(w, r, "frontend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPRequestRuleFrontendParams) { + h.createTCPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPRequestRuleFrontend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPRequestRuleFrontendParams) { + h.replaceTCPRequestRule(w, r, "frontend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared internal methods --- + +func (h *HandlerImpl) getAllTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetTCPRequestRules(parentType, parentName, transactionID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, TcpRequestRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) replaceAllTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpRequestRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceTCPRequestRules(parentType, parentName, data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTCPRequestRule(int64(index), parentType, parentName, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetTCPRequestRule(int64(index), parentType, parentName, transactionID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpRequestRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTCPRequestRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceTCPRequestRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpRequestRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditTCPRequestRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.gen.go b/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.gen.go new file mode 100644 index 00000000..65d28a3c --- /dev/null +++ b/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.gen.go @@ -0,0 +1,1351 @@ +// Package tcp_response_rule provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package tcp_response_rule + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// TcpResponseRule defines model for tcp_response_rule. +type TcpResponseRule = models.TCPResponseRule + +// TcpResponseRules defines model for tcp_response_rules. +type TcpResponseRules = models.TCPResponseRules + +// GetAllTCPResponseRuleBackendParams defines parameters for GetAllTCPResponseRuleBackend. +type GetAllTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPResponseRuleBackendParams defines parameters for ReplaceAllTCPResponseRuleBackend. +type ReplaceAllTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPResponseRuleBackendParams defines parameters for DeleteTCPResponseRuleBackend. +type DeleteTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPResponseRuleBackendParams defines parameters for GetTCPResponseRuleBackend. +type GetTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPResponseRuleBackendParams defines parameters for CreateTCPResponseRuleBackend. +type CreateTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPResponseRuleBackendParams defines parameters for ReplaceTCPResponseRuleBackend. +type ReplaceTCPResponseRuleBackendParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetAllTCPResponseRuleDefaultsParams defines parameters for GetAllTCPResponseRuleDefaults. +type GetAllTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceAllTCPResponseRuleDefaultsParams defines parameters for ReplaceAllTCPResponseRuleDefaults. +type ReplaceAllTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteTCPResponseRuleDefaultsParams defines parameters for DeleteTCPResponseRuleDefaults. +type DeleteTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTCPResponseRuleDefaultsParams defines parameters for GetTCPResponseRuleDefaults. +type GetTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateTCPResponseRuleDefaultsParams defines parameters for CreateTCPResponseRuleDefaults. +type CreateTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTCPResponseRuleDefaultsParams defines parameters for ReplaceTCPResponseRuleDefaults. +type ReplaceTCPResponseRuleDefaultsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceAllTCPResponseRuleBackendJSONRequestBody defines body for ReplaceAllTCPResponseRuleBackend for application/json ContentType. +type ReplaceAllTCPResponseRuleBackendJSONRequestBody = TcpResponseRules + +// CreateTCPResponseRuleBackendJSONRequestBody defines body for CreateTCPResponseRuleBackend for application/json ContentType. +type CreateTCPResponseRuleBackendJSONRequestBody = TcpResponseRule + +// ReplaceTCPResponseRuleBackendJSONRequestBody defines body for ReplaceTCPResponseRuleBackend for application/json ContentType. +type ReplaceTCPResponseRuleBackendJSONRequestBody = TcpResponseRule + +// ReplaceAllTCPResponseRuleDefaultsJSONRequestBody defines body for ReplaceAllTCPResponseRuleDefaults for application/json ContentType. +type ReplaceAllTCPResponseRuleDefaultsJSONRequestBody = TcpResponseRules + +// CreateTCPResponseRuleDefaultsJSONRequestBody defines body for CreateTCPResponseRuleDefaults for application/json ContentType. +type CreateTCPResponseRuleDefaultsJSONRequestBody = TcpResponseRule + +// ReplaceTCPResponseRuleDefaultsJSONRequestBody defines body for ReplaceTCPResponseRuleDefaults for application/json ContentType. +type ReplaceTCPResponseRuleDefaultsJSONRequestBody = TcpResponseRule + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all TCP Response Rules + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules) + GetAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleBackendParams) + // Replace a TCP Response Rule list + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules) + ReplaceAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleBackendParams) + // Delete a TCP Response Rule + // (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) + DeleteTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleBackendParams) + // Return one TCP Response Rule + // (GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) + GetTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleBackendParams) + // Add a new TCP Response Rule + // (POST /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) + CreateTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleBackendParams) + // Replace a TCP Response Rule + // (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) + ReplaceTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleBackendParams) + // Return an array of all TCP Response Rules + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules) + GetAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleDefaultsParams) + // Replace a TCP Response Rule list + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules) + ReplaceAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleDefaultsParams) + // Delete a TCP Response Rule + // (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) + DeleteTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleDefaultsParams) + // Return one TCP Response Rule + // (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) + GetTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleDefaultsParams) + // Add a new TCP Response Rule + // (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) + CreateTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleDefaultsParams) + // Replace a TCP Response Rule + // (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) + ReplaceTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleDefaultsParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all TCP Response Rules +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules) +func (_ Unimplemented) GetAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Response Rule list +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules) +func (_ Unimplemented) ReplaceAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Response Rule +// (DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) DeleteTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Response Rule +// (GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) GetTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Response Rule +// (POST /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) CreateTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Response Rule +// (PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) ReplaceTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleBackendParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of all TCP Response Rules +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules) +func (_ Unimplemented) GetAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Response Rule list +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules) +func (_ Unimplemented) ReplaceAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a TCP Response Rule +// (DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) DeleteTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one TCP Response Rule +// (GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) GetTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new TCP Response Rule +// (POST /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) CreateTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a TCP Response Rule +// (PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}) +func (_ Unimplemented) ReplaceTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleDefaultsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPResponseRuleBackend(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) GetTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPResponseRuleBackend operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPResponseRuleBackendParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPResponseRuleBackend(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllTCPResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAllTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceAllTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAllTCPResponseRuleDefaults(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) DeleteTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTCPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) GetTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTCPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) CreateTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTCPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTCPResponseRuleDefaults operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTCPResponseRuleDefaultsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTCPResponseRuleDefaults(w, r, parentName, index, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules", wrapper.GetAllTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules", wrapper.ReplaceAllTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}", wrapper.DeleteTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}", wrapper.GetTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}", wrapper.CreateTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}", wrapper.ReplaceTCPResponseRuleBackend) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules", wrapper.GetAllTCPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules", wrapper.ReplaceAllTCPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}", wrapper.DeleteTCPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}", wrapper.GetTCPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}", wrapper.CreateTCPResponseRuleDefaults) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}", wrapper.ReplaceTCPResponseRuleDefaults) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FpPb9u4E/0qBNvT7ydHbhoUWO/JSbrdXBZBtthLkxpjcmyxlUiVpOwYgb/7gpTkP7EcO13H9mZ5CRyJ", + "ImeGM+89UfNAmcpyJVFaQzsPVKPJlTTo/zE5MjEQDKxQspcpjqnpMZVlSvZmA+vr3VQj8MnHe2HKqZiS", + "FqV1PyHP02qa+JtR0k/OEszA/XqrcUA79E08NyUu75r4WSag1krT6XQaUY6GaZG7p2iHfk6QVDMhJxqN", + "KjRDAqXJBEubI5ogcNTe+gslB2JYaL9w6y/URpR2L8+8NIwMRIpkVI2NFly0kxxphxqrhRw6C6fR86J7", + "DvwGfxRo7JGF9hxcQEvLjjmAlziAIrUfvR/HFcJPKFFDSkrbjjmIfyj7myok/3eU9xgMkcqSgTd5r3Gd", + "1refj6NYZ2g1q+p/Q+Zq6741VK3qYjn2pM6Y2a2WyHKl/abkYBPaoUNhk6J/wlQWJ5BrdT+xyJKYpQKl", + "bUmwYoTx6ENczkid5ZblM7N6ukhxS2s+X1zfVI/duKde3C4fXGExM5vybNUlN19pPWgNk608Mjt2yTkl", + "5ECtJl5Xku71FRkoTTKQMBRySH7vXrs5yeeLa1JbRbxZJzSiVli3UbQedQkWyHUKEv1MrdXHaETrZO5Q", + "Fw+Vo4Rc0A59f9I+eUcj75iPbWxQjwRDU3sWs8XSiPvAvqPkJn7IQaO0PQkZTuPmHRuiXfX4Bm2hpSGQ", + "pg0eEpuAJaCR1OsiJ0IuVP15aYELhcqxNOuKe3S13TR9tJPVaO+ihgytx4Uvj4269s4Q5wx1W0U75V5H", + "1F9y/828pRF1PCg0ctqxusBFhMjBWtTu+a9fvt7e6ttbeVu02++Z/4v/+/XtG/fr9MPD9Jbe/f8tjVZA", + "JXps3NUlUQNiEyRWgzTAPEiNE9RIxg79pCVWEeDcD5pF5YRcgHS42EdSGOTuEVnjGhFmHtST2ukfBerJ", + "3OuF9XqCPwmFd9GypDxtt3dGHg3Z1UAOfxaMoTGDIp2HYN8ky0vxsc6hWYTin5c0nnKKLAM9mVUTAUk8", + "urlEaS4sl2gwdLlPH8P33TSiedFYqnkKDA0BMk5UiiQVxrolGup2LGzi08+PGYoRSle3s6rzEGeX+Htt", + "JVfrhmo+WDWvWF0VS7my20qWIPvu2GqJH2p7mo1ddHjR4GjpTgKGCGuIGs+nW+PRE2UppMUh6sYdGBCD", + "NiJcEXC+MCQaUwXcX3JWj0HYWcIuEFE5rMUxhclzXQRDWAJyiMbVxeI4x3ZuIg+QyAkXGplNJy4NlqK7", + "Lgzeh15p3FIsZnA0gNTgLDn7SqUIskZt/053rvjkxQF7udKmB6eMbrMG0SX+cKeVTtunezZqmX7KnCHA", + "GOYWOQFZp2H9No6PXnluyiS9ulwF9Dn2zJ4lDWnTxGxn5ebskNUWTjoOw5x+kwmsZoDnsKcI070dMMVx", + "iLJVRbLVV3zSqgqSgwW/3M7kdPwgJMf7abmnKVpc3d1Lf900erSM0v2JR1g/JRlolW3LzOUSP8fKq0Zd", + "ufWbGVpUt9Zz82acDzIgyIAgA7aWAUtMfLrptehYeOm0fbY63yrUlJjpGf2sfGKHLDM7LT0Ej5WQ3AT6", + "G175njydURKfxyIumbfjkE9oA4GEU6Hdq+ljPRR6ZYBTHTk1IsSmUyZlGjCny7kTrRLHDZBT5fgcV1yE", + "n4E2FxohKNagWINiDQdXP80pm86t3u2X1BqEmUe5lz+wCudV9XnVWfuXHc+/3Fd1CGbvcr6Oh//5adjm", + "b0wv9L5RrRAkQJAAQQIECfBCEqB9aAmwt49WQQPMNcAre7Ff+0VsLx/DKocP2FtWBcds2VxWDw/9KKG7", + "LHSXHVl32fpaXtteFuo5aPSg0UN/WegvC/1lr6O/bGtJvd/+svXc3Nhgti0vh8O6IASCEAgdZqHD7D/R", + "YfbkaU2gkHA2FHrMQo/ZDnvM1uNNY5NZgJygWoNqDcdXocssfGEOXWavpMts41elIAKCCAgiIIiA0GcW", + "VEDoMztAn5lbCvWoptlCp7RD49F7Or2b/h0AAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.go b/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.go new file mode 100644 index 00000000..8563c0f2 --- /dev/null +++ b/handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.go @@ -0,0 +1,263 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tcp_response_rule + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all TCP response rule routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy TCP response rule configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +// --- Backend parent --- + +func (h *HandlerImpl) GetAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleBackendParams) { + h.getAllTCPResponseRule(w, r, "backend", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleBackendParams) { + h.replaceAllTCPResponseRule(w, r, "backend", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleBackendParams) { + h.deleteTCPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleBackendParams) { + h.getTCPResponseRule(w, r, "backend", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleBackendParams) { + h.createTCPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPResponseRuleBackend(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleBackendParams) { + h.replaceTCPResponseRule(w, r, "backend", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Defaults parent --- + +func (h *HandlerImpl) GetAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params GetAllTCPResponseRuleDefaultsParams) { + h.getAllTCPResponseRule(w, r, "defaults", parentName, params.TransactionId) +} + +func (h *HandlerImpl) ReplaceAllTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, params ReplaceAllTCPResponseRuleDefaultsParams) { + h.replaceAllTCPResponseRule(w, r, "defaults", parentName, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) DeleteTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params DeleteTCPResponseRuleDefaultsParams) { + h.deleteTCPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) GetTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params GetTCPResponseRuleDefaultsParams) { + h.getTCPResponseRule(w, r, "defaults", parentName, index, params.TransactionId) +} + +func (h *HandlerImpl) CreateTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params CreateTCPResponseRuleDefaultsParams) { + h.createTCPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +func (h *HandlerImpl) ReplaceTCPResponseRuleDefaults(w http.ResponseWriter, r *http.Request, parentName string, index int, params ReplaceTCPResponseRuleDefaultsParams) { + h.replaceTCPResponseRule(w, r, "defaults", parentName, index, params.TransactionId, int64(params.Version), params.ForceReload) +} + +// --- Shared internal methods --- + +func (h *HandlerImpl) getAllTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rules, err := cfg.GetTCPResponseRules(parentType, parentName, transactionID) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, TcpResponseRules{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rules) +} + +func (h *HandlerImpl) replaceAllTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpResponseRules + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.ReplaceTCPResponseRules(parentType, parentName, data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), data) + return + } + respond.JSON(w, http.StatusAccepted, data) +} + +func (h *HandlerImpl) deleteTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTCPResponseRule(int64(index), parentType, parentName, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) getTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, rule, err := cfg.GetTCPResponseRule(int64(index), parentType, parentName, transactionID) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, rule) +} + +func (h *HandlerImpl) createTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTCPResponseRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) replaceTCPResponseRule(w http.ResponseWriter, r *http.Request, parentType, parentName string, index int, transactionID string, version int64, forceReload bool) { + if transactionID != "" && forceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TcpResponseRule + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditTCPResponseRule(int64(index), parentType, parentName, &data, transactionID, version); err != nil { + respond.Error(w, err) + return + } + if transactionID == "" { + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/traces/traces.gen.go b/handlers/configuration/traces/traces.gen.go new file mode 100644 index 00000000..4b820594 --- /dev/null +++ b/handlers/configuration/traces/traces.gen.go @@ -0,0 +1,790 @@ +// Package traces provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package traces + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// TraceEntry defines model for trace_entry. +type TraceEntry = models.TraceEntry + +// Traces defines model for traces. +type Traces = models.Traces + +// DeleteTracesParams defines parameters for DeleteTraces. +type DeleteTracesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetTracesParams defines parameters for GetTraces. +type GetTracesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateTracesParams defines parameters for CreateTraces. +type CreateTracesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceTracesParams defines parameters for ReplaceTraces. +type ReplaceTracesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteTraceEntryParams defines parameters for DeleteTraceEntry. +type DeleteTraceEntryParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateTraceEntryParams defines parameters for CreateTraceEntry. +type CreateTraceEntryParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateTracesJSONRequestBody defines body for CreateTraces for application/json ContentType. +type CreateTracesJSONRequestBody = Traces + +// ReplaceTracesJSONRequestBody defines body for ReplaceTraces for application/json ContentType. +type ReplaceTracesJSONRequestBody = Traces + +// DeleteTraceEntryJSONRequestBody defines body for DeleteTraceEntry for application/json ContentType. +type DeleteTraceEntryJSONRequestBody = TraceEntry + +// CreateTraceEntryJSONRequestBody defines body for CreateTraceEntry for application/json ContentType. +type CreateTraceEntryJSONRequestBody = TraceEntry + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Delete the traces configuration + // (DELETE /services/haproxy/configuration/traces) + DeleteTraces(w http.ResponseWriter, r *http.Request, params DeleteTracesParams) + // Return the traces configuration + // (GET /services/haproxy/configuration/traces) + GetTraces(w http.ResponseWriter, r *http.Request, params GetTracesParams) + // Add a traces configuration + // (POST /services/haproxy/configuration/traces) + CreateTraces(w http.ResponseWriter, r *http.Request, params CreateTracesParams) + // Replace the traces configuration + // (PUT /services/haproxy/configuration/traces) + ReplaceTraces(w http.ResponseWriter, r *http.Request, params ReplaceTracesParams) + // Delete a trace entry + // (DELETE /services/haproxy/configuration/traces/entries) + DeleteTraceEntry(w http.ResponseWriter, r *http.Request, params DeleteTraceEntryParams) + // Add a new trace entry + // (POST /services/haproxy/configuration/traces/entries) + CreateTraceEntry(w http.ResponseWriter, r *http.Request, params CreateTraceEntryParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Delete the traces configuration +// (DELETE /services/haproxy/configuration/traces) +func (_ Unimplemented) DeleteTraces(w http.ResponseWriter, r *http.Request, params DeleteTracesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return the traces configuration +// (GET /services/haproxy/configuration/traces) +func (_ Unimplemented) GetTraces(w http.ResponseWriter, r *http.Request, params GetTracesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a traces configuration +// (POST /services/haproxy/configuration/traces) +func (_ Unimplemented) CreateTraces(w http.ResponseWriter, r *http.Request, params CreateTracesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace the traces configuration +// (PUT /services/haproxy/configuration/traces) +func (_ Unimplemented) ReplaceTraces(w http.ResponseWriter, r *http.Request, params ReplaceTracesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a trace entry +// (DELETE /services/haproxy/configuration/traces/entries) +func (_ Unimplemented) DeleteTraceEntry(w http.ResponseWriter, r *http.Request, params DeleteTraceEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new trace entry +// (POST /services/haproxy/configuration/traces/entries) +func (_ Unimplemented) CreateTraceEntry(w http.ResponseWriter, r *http.Request, params CreateTraceEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// DeleteTraces operation middleware +func (siw *ServerInterfaceWrapper) DeleteTraces(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTracesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTraces(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTraces operation middleware +func (siw *ServerInterfaceWrapper) GetTraces(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetTracesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTraces(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTraces operation middleware +func (siw *ServerInterfaceWrapper) CreateTraces(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTracesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTraces(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceTraces operation middleware +func (siw *ServerInterfaceWrapper) ReplaceTraces(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceTracesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceTraces(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTraceEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteTraceEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteTraceEntryParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTraceEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateTraceEntry operation middleware +func (siw *ServerInterfaceWrapper) CreateTraceEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateTraceEntryParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateTraceEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/traces", wrapper.DeleteTraces) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/traces", wrapper.GetTraces) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/traces", wrapper.CreateTraces) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/traces", wrapper.ReplaceTraces) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/traces/entries", wrapper.DeleteTraceEntry) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/traces/entries", wrapper.CreateTraceEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FlNb+M2E/4rBN/3KFtJNihQ35yPbn0pgjTopQgMhhxZ3FKklqTsGAv994KkZFuRnDpZOx+GbrZEDp8Z", + "cp5nOPqBqcpyJUFag0c/sAaTK2nA/zE5UJ5wSixXcpopBsJMqcoyJaergfXzsdBA2PL6kZtgiippQVr3", + "k+S5qMzE34yS3jhNISPu1/81JHiE/xevocThrYlfBAG0VhqXZRlhBoZqnrtZeITvUkCVJWBIg1GFpoBI", + "gIwgYI5wCoSB9ugvlUz4rNB+4cFfoA0PuJuWG8NQwgWgeTU22nDRLnPAI2ys5nLmEJbRy6J7QdgtfC/A", + "2A8W2gviAhqQfeQAXkFCCmGvvR8fK4RfQYImAgVsHzmIfyj7myok+xzpvSAGSWVR4iG/aVzL+vXLeRTq", + "E1pZVQ/fgLrcehzM1KB6GMYO6xOzejXgWa6035Sc2BSP8IzbtHgYUpXFKcm1elxaoGlMBQdpB5JYPod4", + "/kscLGKH3GpCYQrS6uWOOO7cjGs/4SBgzEtwmD1jcCi4TFT7eIwlGt9MUKI0yogkMy5n6PfxjbOJAhRE", + "N0/QEEfYcisc4nrcFbEE3QgiwdsaoJUP9UkbYVxGWOUgSc7xCH8ZngxPceT98YGJDeg5p2Bqh+LGqvE6", + "hAwEWGg7cuWfI5sCWqRKAApTkAFa41Y5BHMTtpqwgpoTTTKwPrn+fmp8coVU4m1bTaQh3iRapKABLVyW", + "SousQoQxP2i10BBdEuny9wFQYYC5KbLOP8TNOuUdPu6W+l6AP4KSZC7GG+tNOXs2ZaOnqCtOCCu7HaYp", + "0H/cDjeCW+PpBrvp8CbgqPEmJQZxa5BarM1t8egZ9uHSwgx0ly+TBBmwEWIKEecLBaRBKML8I4d6Qbj1", + "XrodqB30XOqGDRgIsnypi8QgmhI5A4N4cxzR4Ff1ugEMMa6BWrF0x6CVMF1h8D5MA7hGLFhQeTxKiDAQ", + "1bF5UEoAkbgs76NmiXt2cvZftB+cQIRSyC0wRGQdl7rwgSfqchuiNrlqm14nw2ou6vCjS6nPTs7b9rpo", + "BoU0Z442zsOkLg1exSF+XQ3gZbgK915XaJRqXkqLLCNOjDaJynZ47viVzBwJVYHB92WEZ2DbgbsFW2i5", + "aakiO1QVNqbNel/BHjPlTSRzO+TyNYCv0zVJgFrjH63LLJpysS62jEv3BQixLWMLIaZVhH82Y0/2Vn5W", + "ythRUv5ZUArGJIVY785bl+ZHlrvtjNshd3NlOpL3UgNp0sDWSiUM7SuVvlL5jJWKLxEuFFsehPKcfa6B", + "4ZHVBZQtoj19A6LtLGCoT1pPU1WBdmAUH7PiOw9St0d63mgjevu/7tl+swn8HiozZgyRXQUmwo8DqhjM", + "QA6q3Rk8KLYcVNnLiCXOi7zorCBzQSg8V0K21Kia08tRL0efTI4+023hfVXz5L1UUwdy6WXz4LJ5ZPey", + "lo7tRzfLaMfWdAzSar5Li9rU2o785wmUaJXtdA3caFjX3yl67e21t78KVt/5dlK2I2iVV7xx9B3yBk3+", + "zM2ns/82ZswxsYRFg425tKqLjdFd+4q04EK4pKyu+q6IlAAs8OLWFl7P3T1399z9Gu4+PdzS22n2kH28", + "7Qj6Zt5xNfOeyMzr7yPONuh5rRqFFniE4/kXXN6X/wYAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/traces/traces.go b/handlers/configuration/traces/traces.go new file mode 100644 index 00000000..6d73cc9c --- /dev/null +++ b/handlers/configuration/traces/traces.go @@ -0,0 +1,232 @@ +// Copyright 2024 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package traces + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all traces routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy traces configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetTraces(w http.ResponseWriter, r *http.Request, params GetTracesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var data *Traces + if params.FullSection { + _, data, err = cfg.GetStructuredTraces(params.TransactionId) + } else { + _, data, err = cfg.GetTraces(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, data) +} + +func (h *HandlerImpl) CreateTraces(w http.ResponseWriter, r *http.Request, params CreateTracesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Traces + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTraces(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) ReplaceTraces(w http.ResponseWriter, r *http.Request, params ReplaceTracesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Traces + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.PushStructuredTraces(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.EditTraces(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.JSON(w, http.StatusOK, &data) +} + +func (h *HandlerImpl) DeleteTraces(w http.ResponseWriter, r *http.Request, params DeleteTracesParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTraces(params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) CreateTraceEntry(w http.ResponseWriter, r *http.Request, params CreateTraceEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TraceEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateTraceEntry(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteTraceEntry(w http.ResponseWriter, r *http.Request, params DeleteTraceEntryParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data TraceEntry + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTraceEntry(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} diff --git a/handlers/configuration/userlist/userlist.gen.go b/handlers/configuration/userlist/userlist.gen.go new file mode 100644 index 00000000..a7d70076 --- /dev/null +++ b/handlers/configuration/userlist/userlist.gen.go @@ -0,0 +1,1090 @@ +// Package userlist provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package userlist + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// User defines model for user. +type User = models.User + +// Userlist defines model for userlist. +type Userlist = models.Userlist + +// Userlists defines model for userlists. +type Userlists = models.Userlists + +// Users defines model for users. +type Users = models.Users + +// GetUserlistsParams defines parameters for GetUserlists. +type GetUserlistsParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// CreateUserlistParams defines parameters for CreateUserlist. +type CreateUserlistParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// DeleteUserlistParams defines parameters for DeleteUserlist. +type DeleteUserlistParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetUserlistParams defines parameters for GetUserlist. +type GetUserlistParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // FullSection Indicates if the action affects the specified child resources as well + FullSection bool `form:"full_section,omitempty" json:"full_section,omitempty,omitzero"` +} + +// GetUsersParams defines parameters for GetUsers. +type GetUsersParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateUserParams defines parameters for CreateUser. +type CreateUserParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteUserParams defines parameters for DeleteUser. +type DeleteUserParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetUserParams defines parameters for GetUser. +type GetUserParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceUserParams defines parameters for ReplaceUser. +type ReplaceUserParams struct { + // Userlist Parent userlist name + Userlist string `form:"userlist" json:"userlist"` + + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateUserlistJSONRequestBody defines body for CreateUserlist for application/json ContentType. +type CreateUserlistJSONRequestBody = Userlist + +// CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType. +type CreateUserJSONRequestBody = User + +// ReplaceUserJSONRequestBody defines body for ReplaceUser for application/json ContentType. +type ReplaceUserJSONRequestBody = User + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of userlists + // (GET /services/haproxy/configuration/userlists) + GetUserlists(w http.ResponseWriter, r *http.Request, params GetUserlistsParams) + // Add a userlist + // (POST /services/haproxy/configuration/userlists) + CreateUserlist(w http.ResponseWriter, r *http.Request, params CreateUserlistParams) + // Delete a userlist + // (DELETE /services/haproxy/configuration/userlists/{name}) + DeleteUserlist(w http.ResponseWriter, r *http.Request, name string, params DeleteUserlistParams) + // Return a userlist + // (GET /services/haproxy/configuration/userlists/{name}) + GetUserlist(w http.ResponseWriter, r *http.Request, name string, params GetUserlistParams) + // Return an array of users + // (GET /services/haproxy/configuration/users) + GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams) + // Add a user + // (POST /services/haproxy/configuration/users) + CreateUser(w http.ResponseWriter, r *http.Request, params CreateUserParams) + // Delete a user + // (DELETE /services/haproxy/configuration/users/{username}) + DeleteUser(w http.ResponseWriter, r *http.Request, username string, params DeleteUserParams) + // Return a user + // (GET /services/haproxy/configuration/users/{username}) + GetUser(w http.ResponseWriter, r *http.Request, username string, params GetUserParams) + // Replace a user + // (PUT /services/haproxy/configuration/users/{username}) + ReplaceUser(w http.ResponseWriter, r *http.Request, username string, params ReplaceUserParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of userlists +// (GET /services/haproxy/configuration/userlists) +func (_ Unimplemented) GetUserlists(w http.ResponseWriter, r *http.Request, params GetUserlistsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a userlist +// (POST /services/haproxy/configuration/userlists) +func (_ Unimplemented) CreateUserlist(w http.ResponseWriter, r *http.Request, params CreateUserlistParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a userlist +// (DELETE /services/haproxy/configuration/userlists/{name}) +func (_ Unimplemented) DeleteUserlist(w http.ResponseWriter, r *http.Request, name string, params DeleteUserlistParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a userlist +// (GET /services/haproxy/configuration/userlists/{name}) +func (_ Unimplemented) GetUserlist(w http.ResponseWriter, r *http.Request, name string, params GetUserlistParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an array of users +// (GET /services/haproxy/configuration/users) +func (_ Unimplemented) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a user +// (POST /services/haproxy/configuration/users) +func (_ Unimplemented) CreateUser(w http.ResponseWriter, r *http.Request, params CreateUserParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a user +// (DELETE /services/haproxy/configuration/users/{username}) +func (_ Unimplemented) DeleteUser(w http.ResponseWriter, r *http.Request, username string, params DeleteUserParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a user +// (GET /services/haproxy/configuration/users/{username}) +func (_ Unimplemented) GetUser(w http.ResponseWriter, r *http.Request, username string, params GetUserParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a user +// (PUT /services/haproxy/configuration/users/{username}) +func (_ Unimplemented) ReplaceUser(w http.ResponseWriter, r *http.Request, username string, params ReplaceUserParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetUserlists operation middleware +func (siw *ServerInterfaceWrapper) GetUserlists(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetUserlistsParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetUserlists(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateUserlist operation middleware +func (siw *ServerInterfaceWrapper) CreateUserlist(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateUserlistParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateUserlist(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteUserlist operation middleware +func (siw *ServerInterfaceWrapper) DeleteUserlist(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteUserlistParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteUserlist(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetUserlist operation middleware +func (siw *ServerInterfaceWrapper) GetUserlist(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetUserlistParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "full_section" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "full_section", r.URL.Query(), ¶ms.FullSection, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "full_section"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "full_section", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetUserlist(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetUsers operation middleware +func (siw *ServerInterfaceWrapper) GetUsers(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetUsersParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetUsers(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateUser operation middleware +func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateUserParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateUser(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteUser operation middleware +func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "username" ------------- + var username string + + err = runtime.BindStyledParameterWithOptions("simple", "username", chi.URLParam(r, "username"), &username, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "username", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteUserParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteUser(w, r, username, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetUser operation middleware +func (siw *ServerInterfaceWrapper) GetUser(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "username" ------------- + var username string + + err = runtime.BindStyledParameterWithOptions("simple", "username", chi.URLParam(r, "username"), &username, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "username", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetUserParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetUser(w, r, username, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceUser operation middleware +func (siw *ServerInterfaceWrapper) ReplaceUser(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "username" ------------- + var username string + + err = runtime.BindStyledParameterWithOptions("simple", "username", chi.URLParam(r, "username"), &username, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "username", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceUserParams + + // ------------- Required query parameter "userlist" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "userlist", r.URL.Query(), ¶ms.Userlist, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "userlist"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userlist", Err: err}) + } + return + } + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceUser(w, r, username, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/userlists", wrapper.GetUserlists) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/userlists", wrapper.CreateUserlist) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/userlists/{name}", wrapper.DeleteUserlist) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/userlists/{name}", wrapper.GetUserlist) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/users", wrapper.GetUsers) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/configuration/users", wrapper.CreateUser) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/configuration/users/{username}", wrapper.DeleteUser) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/users/{username}", wrapper.GetUser) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/configuration/users/{username}", wrapper.ReplaceUser) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNb9s4E/4rBN/3aEdpWiywvqVNdzeXRdD9uCyKYEyObHYpUiWpuEag/74gqc9YSezWTtxUp8QSNXxm", + "OPPM8LmlTGe5VqicpbNbatDmWlkMP2yOTKSCgRNaXWeao7TXTGeZVtfNwvr5uTQIfP3+i7DRFNPKoXL+", + "X8hzWZlJPlmtgnG2xAz8f/83mNIZ/V/SQkniW5vsBAGN0YaWZTmhHC0zIvdf0Rn9c4mksoScGLS6MAwJ", + "RMgEI+YJXSJwNAH9O61SsShM2Hj6NxorIu6+5d4ykgqJ5KZaO+m46NY50hm1zgi18AjLyW7RfQv8A34u", + "0LojC+1b8AGNyI45gBeYQiHd++DHcYXwV1RoQJKI7ZiD+Lt2v+hC8e+jvFdgidKOpAHyk8a1rF/vzqNY", + "Z2hlVc8/IfO19WW60NPqYVx7UmdM82oqslybcCg5uCWd0YVwy2J+wnSWLCE3+svaIVsmTApUbqrAiRtM", + "bn5KokXqkRcWtwXwl196iP2liEy3JYaw/FA4whkKh5l9LJ0b5OWkRg7GwPph4PYgyHdDvT3ifaP1eIVK", + "9Wb1nStyfnVJUm1IBgoWQi3Ib+dX3iapI01A8fCDsG6t2hM6oU446cHX31yAA3IlQWGwOyWdzKnLekZ9", + "JHSOCnJBZ/T1yenJKzoJ3oVAJhbNjWBoa/eS3sZJL2kW6Dbd+oCuMMoSUCSEmuiUgJSNA8gb74IbOsdo", + "+5KHZuG6eZODgQxdOO5/7u50eeFtuyUSZ0BZYIHGVks0SFaeH5UjThPgPCxqNjoh70B55pyjh8L9J6pm", + "PiJsS7Yen/BbfS7Q+KRRkPmQd/a7FvxBspxsoFbcUyVaIiL4CjekKTJnw6OW7dlSyJbzLQFLVijlPbjS", + "Qspri8FgDxWP4wGdpSAtNrUw11oiKFqWHyf92fjs9HRvXbDNmYHm9kfBGFqbFrI9oKceEproDPvRBCb5", + "+pEstMwiy8CsmxrplUjRyXoHC5/vtCngj+WE5toOVNs555YAUbhqOcPpkERsIyCb5fbOIDjsEMULLLgq", + "Y+LOnm3ZEtm/nm37EarwDIPtOtwFPOm9WYIlwlmiV625ezx6IDeFcrhAM0geKbHoJoRrAt4XhsSg1MDD", + "I496BcIFL7spEMZGv2zKUcJ6VxfBErYEtfCc1V8HBsOugRyQEy4MMifXPg160b0vDMGH6whuN8b6nog1", + "3B/far7eO6dGSvU7CIOczpwpsNzg8lcH2rd/ADWNEBZYhftR4+z07En27rN/zFYCjGHukIcpKuZYfZnH", + "OzemD7E8Li82KbZlveZbMpCwQ43lTeyie2wqHaEk2P95z/b7Mtdz9MZzzgk0zWywG/oJnWmOC1TT6kym", + "c83X06paOTgIVreeZpNb/2kZD1+iw800uAjPbQcbSY3OBlrtfB2agLe42XGjmW07blNSwbOKm8JVpKGm", + "6k2fAnabSMe2Prb1Y2nrmxeRs8dm/WNh+7PTN5v2mgqOvMIjbb/ZM582yuVzMHaktMdIu5w8rBdohS2z", + "7kCoHcVgZNNRldjLNHkMosQLI4la8niEJLYc2naXH8NXZI5Sq6C0ViJJm9M1rnsZ5lE98goMKteSWJdl", + "7pREJwgvnWoOXcOjqviIqnhXUdxeTdylSFolcSyT8X4z3m+eQQ98Di3wPh3wkBrgqP/9GPrfRt/aq+5n", + "k1v/Z0fdr9X8Npuiv6fWJh8S/ra5pjaGhq+pnbff0BjHTjx24lFpfElK44+iMg5dabZSF7+evysVYCTv", + "H1ptGNXCp1cLB/WLYrDYcwmsndV8r/mKSq/MjNU+jmrjqDaKJk/TRAKTmMg8o2pyYNXkhfXKkDTfKJp4", + "k2hu6jZXGElnNLl5TcuP5X8BAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/userlist/userlist.go b/handlers/configuration/userlist/userlist.go new file mode 100644 index 00000000..00a07039 --- /dev/null +++ b/handlers/configuration/userlist/userlist.go @@ -0,0 +1,356 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package userlist + +import ( + "fmt" + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all userlist and user routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy userlist and user configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetUserlists(w http.ResponseWriter, r *http.Request, params GetUserlistsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var uls models.Userlists + if params.FullSection { + _, uls, err = cfg.GetStructuredUserLists(params.TransactionId) + } else { + _, uls, err = cfg.GetUserLists(params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, uls) +} + +func (h *HandlerImpl) CreateUserlist(w http.ResponseWriter, r *http.Request, params CreateUserlistParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Userlist + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if params.FullSection { + err = cfg.CreateStructuredUserList(&data, params.TransactionId, int64(params.Version)) + } else { + err = cfg.CreateUserList(&data, params.TransactionId, int64(params.Version)) + } + if err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteUserlist(w http.ResponseWriter, r *http.Request, name string, params DeleteUserlistParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteUserList(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetUserlist(w http.ResponseWriter, r *http.Request, name string, params GetUserlistParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + var ul *models.Userlist + if params.FullSection { + _, ul, err = cfg.GetStructuredUserList(name, params.TransactionId) + } else { + _, ul, err = cfg.GetUserList(name, params.TransactionId) + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ul) +} + +func (h *HandlerImpl) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ul, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if ul == nil || err != nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("userlist %s not found", params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + _, users, err := cfg.GetUsers(params.Userlist, params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.Users{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, users) +} + +func (h *HandlerImpl) CreateUser(w http.ResponseWriter, r *http.Request, params CreateUserParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ul, _ := cfg.GetUserList(params.Userlist, params.TransactionId) + if ul == nil { + respond.BadRequest(w, "userlist not found") + return + } + var data User + if !respond.DecodeBody(r, w, &data) { + return + } + if err = cfg.CreateUser(params.Userlist, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteUser(w http.ResponseWriter, r *http.Request, username string, params DeleteUserParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ul, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if ul == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("userlist %s not found", params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + _, u, err := cfg.GetUser(username, params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if u == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("user %s not found in userlist %s", username, params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + if err = cfg.DeleteUser(username, params.Userlist, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetUser(w http.ResponseWriter, r *http.Request, username string, params GetUserParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ul, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if ul == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("userlist %s not found", params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + _, u, err := cfg.GetUser(username, params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if u == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("user %s not found in userlist %s", username, params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + respond.JSON(w, http.StatusOK, u) +} + +func (h *HandlerImpl) ReplaceUser(w http.ResponseWriter, r *http.Request, username string, params ReplaceUserParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, ul, err := cfg.GetUserList(params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if ul == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("userlist %s not found", params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + _, u, err := cfg.GetUser(username, params.Userlist, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if u == nil { + code := misc.ErrHTTPNotFound + msg := fmt.Sprintf("user %s not found in userlist %s", username, params.Userlist) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + var data User + if !respond.DecodeBody(r, w, &data) { + return + } + if err = cfg.EditUser(username, params.Userlist, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/configuration/version/version.gen.go b/handlers/configuration/version/version.gen.go new file mode 100644 index 00000000..e4f47d48 --- /dev/null +++ b/handlers/configuration/version/version.gen.go @@ -0,0 +1,314 @@ +// Package version provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package version + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/oapi-codegen/runtime" +) + +// GetConfigurationVersionParams defines parameters for GetConfigurationVersion. +type GetConfigurationVersionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return HAProxy configuration version + // (GET /services/haproxy/configuration/version) + GetConfigurationVersion(w http.ResponseWriter, r *http.Request, params GetConfigurationVersionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return HAProxy configuration version +// (GET /services/haproxy/configuration/version) +func (_ Unimplemented) GetConfigurationVersion(w http.ResponseWriter, r *http.Request, params GetConfigurationVersionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetConfigurationVersion operation middleware +func (siw *ServerInterfaceWrapper) GetConfigurationVersion(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetConfigurationVersionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetConfigurationVersion(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration/version", wrapper.GetConfigurationVersion) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "zFVNT9w8EP4r1rzvMbvZFtRDbgj6waVCbcWlQivjTBKjxHbHk8AK5b9Xdj52UwrSVhXqLYnH83z48eQR", + "lG2cNWjYQ/YIhN5Z4zG+eIdKF1pJ1tZsG5tj7bfKNo0127lw+n6BhWxrfk9kKWxW1jAaDo/SuXrskt55", + "a2JvVWEjw9P/hAVk8F+6Z5IOqz49igFG6L7vE8jRK9Iu7IIMPqJBkrUYuCVQocyRosRzawpdthQBVtdI", + "Xg/8lh0WZaLQNYpurE0OpPDOIWTgmbQpA5M+Oc7Ez5Y/2Nbk/5iB3yoUYyfMBaG3LSkU99ILY1kUkfKr", + "+tpPy8cHFaeEjl3t7R0qhgQeVqVdjR+H2vWUmHlppRtnKR6Kk1xBBqXmqr1dK9uklXRkH3aMqkpVrdHw", + "ykjWHabdu3ToOIZCm8I+dePMiLOrS1FYEiUya1MKrlB8OrsKbYVamDX6tIYEWHMdSE+FF5KluKqlwdhv", + "JZY2X88OT15nAH0C1qGRTkMGJ+vN+g0kUWI0OPVInVboJ43pgkza7Q+4RH6q7AtyS8ZHOaolQsPPyDrM", + "QNBmHQ4rl3m8ybzQspfiJMkGOcbv+6/wlxfCFhGcSRovVYS6r5BQ3IccGxZshczzWDRjrsW5NCHhtyha", + "j3nYMjsvtN9fikBVB6gfLdIOEjCyCUdygLfV+YuhvkmW0/ftZnPUGBj7acNY4m+v8ddWKfS+aOu9xNce", + "h6eb0+dm1qw+/bOZGfXGn9BfRlj82uLoaZtG0m4O9stXNNxQWYZcLo2Dm2GOIXVTbFuqIYO0O4H+pv8Z", + "AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/configuration/version/version.go b/handlers/configuration/version/version.go new file mode 100644 index 00000000..660fbe78 --- /dev/null +++ b/handlers/configuration/version/version.go @@ -0,0 +1,59 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all configuration version routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy configuration version. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetConfigurationVersion(w http.ResponseWriter, r *http.Request, params GetConfigurationVersionParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + v, err := cfg.GetConfigurationVersion(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, v) +} diff --git a/handlers/consul.go b/handlers/consul.go deleted file mode 100644 index 7f759204..00000000 --- a/handlers/consul.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "errors" - - "github.com/go-openapi/runtime/middleware" - "github.com/haproxytech/client-native/v6/models" - - sc "github.com/haproxytech/dataplaneapi/discovery" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/service_discovery" -) - -// CreateConsulHandlerImpl implementation of the CreateConsulHandler interface using client-native client -type CreateConsulHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.Consul) error - UseValidation bool -} - -// DeleteConsulHandlerImpl implementation of the DeleteConsulHandler interface using client-native client -type DeleteConsulHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.Consul) error -} - -// GetConsulHandlerImpl implementation of the GetConsulHandler interface using client-native client -type GetConsulHandlerImpl struct { - Discovery sc.ServiceDiscoveries -} - -// GetConsulsHandlerImpl implementation of the GetConsulsHandler interface using client-native client -type GetConsulsHandlerImpl struct { - Discovery sc.ServiceDiscoveries -} - -// ReplaceConsulHandlerImpl implementation of the ReplaceConsulHandler interface using client-native client -type ReplaceConsulHandlerImpl struct { - Discovery sc.ServiceDiscoveries - PersistCallback func([]*models.Consul) error - UseValidation bool -} - -// Handle executing the request and returning a response -func (c *CreateConsulHandlerImpl) Handle(params service_discovery.CreateConsulParams, principal any) middleware.Responder { - params.Data.ID = sc.NewServiceDiscoveryUUID() - if err := sc.ValidateConsulData(params.Data, c.UseValidation); err != nil { - e := misc.HandleError(err) - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - if params.Data.HealthCheckPolicy != nil && *params.Data.HealthCheckPolicy == models.ConsulHealthCheckPolicyMin && params.Data.HealthCheckPolicyMin <= 0 { - e := &models.Error{ - Message: misc.StringP("health_check_policy_min is required for 'min' health_check_policy"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - err := c.Discovery.AddNode("consul", *params.Data.ID, params.Data) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - consuls, err := getConsuls(c.Discovery) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - err = c.PersistCallback(consuls) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewCreateConsulCreated().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (c *DeleteConsulHandlerImpl) Handle(params service_discovery.DeleteConsulParams, principal any) middleware.Responder { - err := c.Discovery.RemoveNode("consul", params.ID) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewReplaceConsulDefault(int(*e.Code)).WithPayload(e) - } - consuls, err := getConsuls(c.Discovery) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewDeleteConsulDefault(int(*e.Code)).WithPayload(e) - } - err = c.PersistCallback(consuls) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewDeleteConsulDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewDeleteConsulNoContent() -} - -// Handle executing the request and returning a response -func (c *GetConsulHandlerImpl) Handle(params service_discovery.GetConsulParams, principal any) middleware.Responder { - nodes, err := c.Discovery.GetNode("consul", params.ID) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewGetConsulsDefault(int(*e.Code)).WithPayload(e) - } - consul, ok := nodes.(*models.Consul) - if !ok { - e := misc.HandleError(errors.New("expected *models.Consul")) - return service_discovery.NewGetConsulsDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewGetConsulOK().WithPayload(consul) -} - -// Handle executing the request and returning a response -func (c *GetConsulsHandlerImpl) Handle(params service_discovery.GetConsulsParams, principal any) middleware.Responder { - consuls, err := getConsuls(c.Discovery) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewGetConsulDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewGetConsulsOK().WithPayload(consuls) -} - -// Handle executing the request and returning a response -func (c *ReplaceConsulHandlerImpl) Handle(params service_discovery.ReplaceConsulParams, principal any) middleware.Responder { - if err := sc.ValidateConsulData(params.Data, c.UseValidation); err != nil { - e := misc.HandleError(err) - return service_discovery.NewReplaceConsulDefault(int(*e.Code)).WithPayload(e) - } - if params.Data.HealthCheckPolicy != nil && *params.Data.HealthCheckPolicy == models.ConsulHealthCheckPolicyMin && params.Data.HealthCheckPolicyMin <= 0 { - e := &models.Error{ - Message: misc.StringP("health_check_policy_min is required for 'min' health_check_policy"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return service_discovery.NewCreateConsulDefault(int(*e.Code)).WithPayload(e) - } - err := c.Discovery.UpdateNode("consul", *params.Data.ID, params.Data) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewReplaceConsulDefault(int(*e.Code)).WithPayload(e) - } - consuls, err := getConsuls(c.Discovery) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewReplaceConsulDefault(int(*e.Code)).WithPayload(e) - } - err = c.PersistCallback(consuls) - if err != nil { - e := misc.HandleError(err) - return service_discovery.NewDeleteConsulDefault(int(*e.Code)).WithPayload(e) - } - return service_discovery.NewReplaceConsulOK().WithPayload(params.Data) -} - -func getConsuls(discovery sc.ServiceDiscoveries) (models.Consuls, error) { - nodes, err := discovery.GetNodes("consul") - if err != nil { - return nil, err - } - consuls, ok := nodes.(models.Consuls) - if !ok { - return nil, errors.New("expected models.Consuls") - } - return consuls, nil -} diff --git a/handlers/crt_load.go b/handlers/crt_load.go deleted file mode 100644 index f52d303c..00000000 --- a/handlers/crt_load.go +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2024 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/crt_load" -) - -type GetCrtLoadsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get all loads from crt-stores -func (h *GetCrtLoadsHandlerImpl) Handle(params crt_load.GetCrtLoadsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewGetCrtLoadsDefault(int(*e.Code)).WithPayload(e) - } - - _, stores, err := configuration.GetCrtLoads(params.CrtStore, t) - if err != nil { - e := misc.HandleError(err) - return crt_load.NewGetCrtLoadsDefault(int(*e.Code)).WithPayload(e) - } - - return crt_load.NewGetCrtLoadsOK().WithPayload(stores) -} - -type GetCrtLoadHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get one load from a crt-store -func (h *GetCrtLoadHandlerImpl) Handle(params crt_load.GetCrtLoadParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewGetCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - _, store, err := configuration.GetCrtLoad(params.Certificate, params.CrtStore, t) - if err != nil { - e := misc.HandleError(err) - return crt_load.NewGetCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - return crt_load.NewGetCrtLoadOK().WithPayload(store) -} - -type CreateCrtLoadHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateCrtLoadHandlerImpl) Handle(params crt_load.CreateCrtLoadParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_load.NewCreateCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewCreateCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateCrtLoad(params.CrtStore, params.Data, t, v); err != nil { - e := misc.HandleError(err) - return crt_load.NewCreateCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewCreateCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - return crt_load.NewCreateCrtLoadCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return crt_load.NewCreateCrtLoadAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return crt_load.NewCreateCrtLoadAccepted().WithPayload(params.Data) -} - -type ReplaceCrtLoadHandler struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *ReplaceCrtLoadHandler) Handle(params crt_load.ReplaceCrtLoadParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_load.NewReplaceCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewReplaceCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditCrtLoad(params.Certificate, params.CrtStore, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return crt_load.NewReplaceCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewReplaceCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - return crt_load.NewReplaceCrtLoadOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return crt_load.NewReplaceCrtLoadAccepted().WithReloadID(rID) - } - - return crt_load.NewReplaceCrtLoadOK().WithPayload(params.Data) -} - -type DeleteCrtLoadHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteCrtLoadHandlerImpl) Handle(params crt_load.DeleteCrtLoadParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_load.NewDeleteCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewDeleteCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteCrtLoad(params.Certificate, params.CrtStore, t, v) - if err != nil { - e := misc.HandleError(err) - return crt_load.NewDeleteCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return crt_load.NewDeleteCrtLoadDefault(int(*e.Code)).WithPayload(e) - } - return crt_load.NewDeleteCrtLoadNoContent() - } - rID := h.ReloadAgent.Reload() - return crt_load.NewDeleteCrtLoadAccepted().WithReloadID(rID) - } - - return crt_load.NewDeleteCrtLoadAccepted() -} diff --git a/handlers/crt_store.go b/handlers/crt_store.go deleted file mode 100644 index d07e05cc..00000000 --- a/handlers/crt_store.go +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2024 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/crt_store" -) - -type GetCrtStoresHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get all crt-stores -func (h *GetCrtStoresHandlerImpl) Handle(params crt_store.GetCrtStoresParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewGetCrtStoresDefault(int(*e.Code)).WithPayload(e) - } - - _, stores, err := configuration.GetCrtStores(t) - if err != nil { - e := misc.HandleError(err) - return crt_store.NewGetCrtStoresDefault(int(*e.Code)).WithPayload(e) - } - - return crt_store.NewGetCrtStoresOK().WithPayload(stores) -} - -type GetCrtStoreHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get one crt-store -func (h *GetCrtStoreHandlerImpl) Handle(params crt_store.GetCrtStoreParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewGetCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - _, store, err := configuration.GetCrtStore(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return crt_store.NewGetCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - return crt_store.NewGetCrtStoreOK().WithPayload(store) -} - -type CreateCrtStoreHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateCrtStoreHandlerImpl) Handle(params crt_store.CreateCrtStoreParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_store.NewCreateCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewCreateCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateCrtStore(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return crt_store.NewCreateCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewCreateCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - return crt_store.NewCreateCrtStoreCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return crt_store.NewCreateCrtStoreAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return crt_store.NewCreateCrtStoreAccepted().WithPayload(params.Data) -} - -type EditCrtStoreHandler struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *EditCrtStoreHandler) Handle(params crt_store.EditCrtStoreParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_store.NewEditCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewEditCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditCrtStore(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return crt_store.NewEditCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - return crt_store.NewEditCrtStoreOK().WithPayload(params.Data) -} - -type DeleteCrtStoreHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteCrtStoreHandlerImpl) Handle(params crt_store.DeleteCrtStoreParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return crt_store.NewDeleteCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewDeleteCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteCrtStore(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return crt_store.NewDeleteCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return crt_store.NewDeleteCrtStoreDefault(int(*e.Code)).WithPayload(e) - } - return crt_store.NewDeleteCrtStoreNoContent() - } - rID := h.ReloadAgent.Reload() - return crt_store.NewDeleteCrtStoreAccepted().WithReloadID(rID) - } - - return crt_store.NewDeleteCrtStoreAccepted() -} diff --git a/handlers/dataplane/cluster/cluster.gen.go b/handlers/dataplane/cluster/cluster.gen.go new file mode 100644 index 00000000..0a28bb73 --- /dev/null +++ b/handlers/dataplane/cluster/cluster.gen.go @@ -0,0 +1,583 @@ +// Package cluster provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package cluster + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Defines values for DeleteClusterParamsConfiguration. +const ( + DeleteClusterParamsConfigurationKeep DeleteClusterParamsConfiguration = "keep" +) + +// Valid indicates whether the value is a known member of the DeleteClusterParamsConfiguration enum. +func (e DeleteClusterParamsConfiguration) Valid() bool { + switch e { + case DeleteClusterParamsConfigurationKeep: + return true + default: + return false + } +} + +// Defines values for PostClusterParamsConfiguration. +const ( + PostClusterParamsConfigurationKeep PostClusterParamsConfiguration = "keep" +) + +// Valid indicates whether the value is a known member of the PostClusterParamsConfiguration enum. +func (e PostClusterParamsConfiguration) Valid() bool { + switch e { + case PostClusterParamsConfigurationKeep: + return true + default: + return false + } +} + +// ClusterSettings defines model for cluster_settings. +type ClusterSettings = models.ClusterSettings + +// DeleteClusterParams defines parameters for DeleteCluster. +type DeleteClusterParams struct { + // Configuration In case of moving to single mode do we keep or clean configuration + Configuration DeleteClusterParamsConfiguration `form:"configuration,omitempty" json:"configuration,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// DeleteClusterParamsConfiguration defines parameters for DeleteCluster. +type DeleteClusterParamsConfiguration string + +// PostClusterParams defines parameters for PostCluster. +type PostClusterParams struct { + // Configuration In case of moving to single mode do we keep or clean configuration + Configuration PostClusterParamsConfiguration `form:"configuration,omitempty" json:"configuration,omitempty,omitzero"` + + // AdvertisedAddress Force the advertised address when joining a cluster + AdvertisedAddress string `form:"advertised_address,omitempty" json:"advertised_address,omitempty,omitzero"` + + // AdvertisedPort Force the advertised port when joining a cluster + AdvertisedPort int `form:"advertised_port,omitempty" json:"advertised_port,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// PostClusterParamsConfiguration defines parameters for PostCluster. +type PostClusterParamsConfiguration string + +// EditClusterParams defines parameters for EditCluster. +type EditClusterParams struct { + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// PostClusterJSONRequestBody defines body for PostCluster for application/json ContentType. +type PostClusterJSONRequestBody = ClusterSettings + +// EditClusterJSONRequestBody defines body for EditCluster for application/json ContentType. +type EditClusterJSONRequestBody = ClusterSettings + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Delete cluster settings + // (DELETE /cluster) + DeleteCluster(w http.ResponseWriter, r *http.Request, params DeleteClusterParams) + // Return cluster data + // (GET /cluster) + GetCluster(w http.ResponseWriter, r *http.Request) + // Post cluster settings + // (POST /cluster) + PostCluster(w http.ResponseWriter, r *http.Request, params PostClusterParams) + // Edit cluster settings + // (PUT /cluster) + EditCluster(w http.ResponseWriter, r *http.Request, params EditClusterParams) + // Initiates a certificate refresh + // (POST /cluster/certificate) + InitiateCertificateRefresh(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Delete cluster settings +// (DELETE /cluster) +func (_ Unimplemented) DeleteCluster(w http.ResponseWriter, r *http.Request, params DeleteClusterParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return cluster data +// (GET /cluster) +func (_ Unimplemented) GetCluster(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Post cluster settings +// (POST /cluster) +func (_ Unimplemented) PostCluster(w http.ResponseWriter, r *http.Request, params PostClusterParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Edit cluster settings +// (PUT /cluster) +func (_ Unimplemented) EditCluster(w http.ResponseWriter, r *http.Request, params EditClusterParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Initiates a certificate refresh +// (POST /cluster/certificate) +func (_ Unimplemented) InitiateCertificateRefresh(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// DeleteCluster operation middleware +func (siw *ServerInterfaceWrapper) DeleteCluster(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteClusterParams + + // ------------- Optional query parameter "configuration" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "configuration", r.URL.Query(), ¶ms.Configuration, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "configuration"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "configuration", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCluster(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCluster operation middleware +func (siw *ServerInterfaceWrapper) GetCluster(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCluster(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// PostCluster operation middleware +func (siw *ServerInterfaceWrapper) PostCluster(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params PostClusterParams + + // ------------- Optional query parameter "configuration" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "configuration", r.URL.Query(), ¶ms.Configuration, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "configuration"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "configuration", Err: err}) + } + return + } + + // ------------- Optional query parameter "advertised_address" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "advertised_address", r.URL.Query(), ¶ms.AdvertisedAddress, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "advertised_address"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "advertised_address", Err: err}) + } + return + } + + // ------------- Optional query parameter "advertised_port" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "advertised_port", r.URL.Query(), ¶ms.AdvertisedPort, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "advertised_port"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "advertised_port", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.PostCluster(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// EditCluster operation middleware +func (siw *ServerInterfaceWrapper) EditCluster(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params EditClusterParams + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.EditCluster(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// InitiateCertificateRefresh operation middleware +func (siw *ServerInterfaceWrapper) InitiateCertificateRefresh(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.InitiateCertificateRefresh(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/cluster", wrapper.DeleteCluster) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/cluster", wrapper.GetCluster) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/cluster", wrapper.PostCluster) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/cluster", wrapper.EditCluster) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/cluster/certificate", wrapper.InitiateCertificateRefresh) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FdNb9s4EP0rg9k9ylG6aXrQrUm63dyCFNhLEBhjciwxkUiVpJwYhf77gpTkL9ndJMhuiqI3W5qPxzcz", + "b6hvKExVG83aO8y+oWVXG+04/nE1CzVXgrwyeloZyaWbClNVRk9XhsPzM5LX/LVh54OrMNqzjj+prss+", + "RnrnjI6RRcEVhV+/W55jhr+laxxp99alz8rP1hqLbdsmKNkJq+rghRmekQTbI0uwYJJs4/HOjZ6rvLEx", + "/ORvtk516Lb9t8xgrkqGRW+bbBzEL2vGDJ23SucBR5s8j8ALnlNT+k/xHD8WhZ9Zs6USOmz/K4nt8Dpm", + "E2XjPNupY++Vzt2Gj5ndsQgVfpzkZtI/7A52dN65fRm8NowmqqqNjSzX5AvMMFe+aGZHwlRpQbU1j0vP", + "okhFqVj7iSavFpwuPqRdbHx2nXko8BOAD4S/JtwAWOm5iRCUL0O6vz5eBU+4IE9wVZJm+Hh1CRPomcME", + "h3JliG2CpmZNtcIMT46Oj95hEuHEeqR9kbomKNnzuB0u4nPoLWEoJ5CWUJkFgy8YtJEMMxL34A04pfOS", + "IZwCY/qulS7lKtoaak2WKvaxQ292U19qEOQYzDxkUjrfiQ7SwAPDPXMNxoIomTSIzfbFwB9m+LVhu8QE", + "NVWBw12bdVezbirMbjDExNtk1OXJLsZ+jKBxLGEeUBQs7gPWrSTDCB3BOWltPMy4c3koWIO3pB2JaKgc", + "9D3KMtl6U5AD5R2Yh3W4Awf8zsAq7TnnoB23yfYO+eP4/R412K171ycy1j+WPTSB3K171KUokodkb5U6", + "fbn0xoFuqors8nCnYoKegv7cDIfB2zbBnP34tNfsG6vdKoYkT6Me/sx+3cA7DB6/2joY6ecesf/SCMHO", + "vQnbHVW7TO1jujZuD9VXxvl9tdrmOlj9RGrxp7GiU0ySC7ZeBQkgKS0710nBnVE6YKeBmwOg1v7T3v+7", + "2/lpSMK+ejGMuOw2MVT0qKpA0IfT05PTBCulu//vkrEY/XTCGm+xZ0Yu/2NFCJmUZYmZtw23b6xIo3Uh", + "CtI5yyBR7zssryhPGx8ybyGBhyRsJILhViiM5Jz1pO+MyczI5aTvqiieQSmbPUL5SaonCGWweqJQ/pqs", + "X5P1g0/WoZ5/4WS1yepTJxVhX0WI8WNn/+XkUiuvyLMLC3DtAJbnll0xmr7B/nxte70y3dc22+n6sBCm", + "ZkF+KOrJYcswj7VxTs3Kt7ls/ztD46tgjMB2MchSY0vMMF2cYHvb/hMAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/cluster/cluster.go b/handlers/dataplane/cluster/cluster.go new file mode 100644 index 00000000..634022cd --- /dev/null +++ b/handlers/dataplane/cluster/cluster.go @@ -0,0 +1,244 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cluster + +import ( + "errors" + "fmt" + "net/http" + "reflect" + "strings" + "time" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + dataplaneapi_config "github.com/haproxytech/dataplaneapi/configuration" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/reload_agent" + "github.com/haproxytech/dataplaneapi/storagetype" +) + +// RegisterRouter registers all cluster routes onto r. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, cfg *dataplaneapi_config.Configuration, users *dataplaneapi_config.Users, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, Config: cfg, Users: users, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for cluster management. +type HandlerImpl struct { + Client client_native.HAProxyClient + Config *dataplaneapi_config.Configuration + Users *dataplaneapi_config.Users + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetCluster(w http.ResponseWriter, r *http.Request) { + respond.JSON(w, http.StatusOK, getClusterSettings(h.Config)) +} + +func (h *HandlerImpl) PostCluster(w http.ResponseWriter, r *http.Request, params PostClusterParams) { + var data ClusterSettings + if !respond.DecodeBody(r, w, &data) { + return + } + key := h.Config.Cluster.BootstrapKey.Load() + if data.BootstrapKey != "" && key != data.BootstrapKey { + bootstrapKey, err := dataplaneapi_config.DecodeBootstrapKey(data.BootstrapKey) + if err != nil { + h.errStatus(w, http.StatusNotAcceptable, err, nil) + return + } + log.Warningf("received instructions from %s to join cluster %s at %s", r.RemoteAddr, bootstrapKey["name"], bootstrapKey["address"]) + if errStorageDir := dataplaneapi_config.CheckIfStorageDirIsOK(bootstrapKey["storage-dir"], h.Config); errStorageDir != nil { + log.Warningf("configured storage dir incompatible with cluster configuration: %s", errStorageDir) + h.errStatus(w, http.StatusConflict, errStorageDir, nil) + return + } + if errStorageInit := dataplaneapi_config.InitStorageNoticeFile(bootstrapKey["storage-dir"]); errStorageInit != nil { + log.Warningf("unable to create notice file, %s: skipping it", errStorageInit.Error()) + } + if params.AdvertisedAddress != "" { + h.Config.APIOptions.APIAddress = params.AdvertisedAddress + } + if params.AdvertisedPort != 0 { + h.Config.APIOptions.APIPort = int64(params.AdvertisedPort) + } + h.Config.Mode.Store(dataplaneapi_config.ModeCluster) + h.Config.Cluster.BootstrapKey.Store(data.BootstrapKey) + h.Config.Cluster.Clear() + defer func() { + h.Config.Notify.BootstrapKeyChanged.Notify() + }() + } + if err := h.Config.SaveClusterModeData(); err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + respond.JSON(w, http.StatusOK, getClusterSettings(h.Config)) +} + +func (h *HandlerImpl) EditCluster(w http.ResponseWriter, r *http.Request, params EditClusterParams) { + if h.Config.Mode.Load() != dataplaneapi_config.ModeCluster { + h.errStatus(w, http.StatusNotAcceptable, errors.New("dataplaneapi in single mode"), nil) + return + } + var data ClusterSettings + if !respond.DecodeBody(r, w, &data) { + return + } + if data.Cluster != nil { + if clusterLogTargetsChanged(h.Config.Cluster.ClusterLogTargets, data.Cluster.ClusterLogTargets) { + h.Config.Cluster.ClusterLogTargets = data.Cluster.ClusterLogTargets + h.Config.Cluster.ClusterID.Store(data.Cluster.ClusterID) + if err := h.Config.Save(); err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + defer h.Config.Notify.Reload.Notify() + } + } + respond.JSON(w, http.StatusOK, getClusterSettings(h.Config)) +} + +func (h *HandlerImpl) DeleteCluster(w http.ResponseWriter, r *http.Request, params DeleteClusterParams) { + log.Warningf("received instructions from %s to switch to standalone mode", r.RemoteAddr) + if h.Config.Mode.Load() == dataplaneapi_config.ModeCluster { + log.Warning("clearing cluster users") + for _, u := range h.Users.GetUsers() { + if strings.HasPrefix(u.Name, storagetype.DapiClusterUserPrefix) { + if errRU := h.Users.RemoveUser(u); errRU != nil { + log.Error(errRU.Error()) + } + } + } + if params.Configuration != "keep" { + log.Warning("clearing configuration as requested") + conf, err := h.Client.Configuration() + if err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + version, errVersion := conf.GetVersion("") + if errVersion != nil || version < 1 { + version = 1 + } + config := fmt.Sprintf(dummyConfig, time.Now().Format("01-02-2006 15:04:05 MST"), h.Config.Name.Load()) + if err = conf.PostRawConfiguration(&config, version, true); err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + if err = h.ReloadAgent.Restart(); err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + if storageData := h.Config.GetStorageData(); storageData != nil && storageData.DeprecatedCluster != nil && storageData.DeprecatedCluster.StorageDir != nil { + if storageErr := dataplaneapi_config.RemoveStorageFolder(*storageData.DeprecatedCluster.StorageDir); storageErr != nil { + log.Warningf("failed to clean-up the cluster storage directory: %s", storageErr.Error()) + } + } + } + h.Config.Cluster.BootstrapKey.Store("") + h.Config.Status.Store("active") + h.Config.HAProxy.ClusterTLSCertDir = "" + h.Config.Cluster.Clear() + defer func() { + log.Warning("reloading to apply configuration changes") + h.Config.Notify.Reload.Notify() + }() + } + if err := h.Config.SaveClusterModeData(); err != nil { + h.errStatus(w, http.StatusInternalServerError, err, nil) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) InitiateCertificateRefresh(w http.ResponseWriter, r *http.Request) { + if h.Config.Mode.Load() != dataplaneapi_config.ModeCluster { + w.WriteHeader(http.StatusForbidden) + return + } + h.Config.Notify.CertificateRefresh.Notify() + respond.JSON(w, http.StatusOK, nil) +} + +func (h *HandlerImpl) errStatus(w http.ResponseWriter, status int, err error, _ any) { + code := int64(status) + msg := err.Error() + respond.JSON(w, status, &models.Error{Code: &code, Message: &msg}) +} + +func getClusterSettings(cfg *dataplaneapi_config.Configuration) *models.ClusterSettings { + portStr := cfg.Cluster.Port.Load() + port := int64(portStr) + var clusterSettings *models.ClusterSettingsCluster + if cfg.Mode.Load() == dataplaneapi_config.ModeCluster { + clusterSettings = &models.ClusterSettingsCluster{ + Address: cfg.Cluster.URL.Load(), + Port: &port, + APIBasePath: cfg.Cluster.APIBasePath.Load(), + Name: cfg.Cluster.Name.Load(), + Description: cfg.Cluster.Description.Load(), + ClusterLogTargets: cfg.Cluster.ClusterLogTargets, + } + } + return &models.ClusterSettings{ + BootstrapKey: cfg.Cluster.BootstrapKey.Load(), + Cluster: clusterSettings, + Mode: cfg.Mode.Load(), + Status: cfg.Status.Load(), + } +} + +func clusterLogTargetsChanged(oldCLT, newCLT []*models.ClusterLogTarget) bool { + if len(oldCLT) != len(newCLT) { + return true + } + eqCtr := 0 + for _, oldT := range oldCLT { + for _, newT := range newCLT { + if reflect.DeepEqual(oldT, newT) { + eqCtr++ + } + } + } + return eqCtr != len(oldCLT) +} + +const dummyConfig = `# NOTE: This configuration file was managed by the Fusion Control Plane. +# Fusion released the control at %s + +defaults + mode http + timeout connect 5000 + timeout client 30000 + timeout server 10000 + +frontend disabled + bind /tmp/dataplaneapi-%s.sock name tmp + +` diff --git a/handlers/dataplane/discovery/discovery.gen.go b/handlers/dataplane/discovery/discovery.gen.go new file mode 100644 index 00000000..7381dedb --- /dev/null +++ b/handlers/dataplane/discovery/discovery.gen.go @@ -0,0 +1,474 @@ +// Package discovery provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package discovery + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" +) + +// Endpoints defines model for endpoints. +type Endpoints = models.Endpoints + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return list of root endpoints + // (GET /) + GetAPIEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of service endpoints + // (GET /services) + GetServicesEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy related endpoints + // (GET /services/haproxy) + GetHaproxyEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy advanced configuration endpoints + // (GET /services/haproxy/configuration) + GetConfigurationEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy advanced runtime endpoints + // (GET /services/haproxy/runtime) + GetRuntimeEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy SPOE endpoints + // (GET /services/haproxy/spoe) + GetSpoeEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy stats endpoints + // (GET /services/haproxy/stats) + GetStatsEndpoints(w http.ResponseWriter, r *http.Request) + // Return list of HAProxy storage endpoints + // (GET /services/haproxy/storage) + GetStorageEndpoints(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return list of root endpoints +// (GET /) +func (_ Unimplemented) GetAPIEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of service endpoints +// (GET /services) +func (_ Unimplemented) GetServicesEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy related endpoints +// (GET /services/haproxy) +func (_ Unimplemented) GetHaproxyEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy advanced configuration endpoints +// (GET /services/haproxy/configuration) +func (_ Unimplemented) GetConfigurationEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy advanced runtime endpoints +// (GET /services/haproxy/runtime) +func (_ Unimplemented) GetRuntimeEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy SPOE endpoints +// (GET /services/haproxy/spoe) +func (_ Unimplemented) GetSpoeEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy stats endpoints +// (GET /services/haproxy/stats) +func (_ Unimplemented) GetStatsEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return list of HAProxy storage endpoints +// (GET /services/haproxy/storage) +func (_ Unimplemented) GetStorageEndpoints(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAPIEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetAPIEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAPIEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetServicesEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetServicesEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetServicesEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetHaproxyEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetHaproxyEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHaproxyEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetConfigurationEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetConfigurationEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetConfigurationEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRuntimeEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetRuntimeEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRuntimeEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetStatsEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetStatsEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStatsEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetStorageEndpoints operation middleware +func (siw *ServerInterfaceWrapper) GetStorageEndpoints(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStorageEndpoints(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/", wrapper.GetAPIEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services", wrapper.GetServicesEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy", wrapper.GetHaproxyEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/configuration", wrapper.GetConfigurationEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime", wrapper.GetRuntimeEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe", wrapper.GetSpoeEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/stats", wrapper.GetStatsEndpoints) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage", wrapper.GetStorageEndpoints) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7JjBT+M6EMb/FWveO6YJ7yHtITe0oIXTViDtBSFknElqlNiWZxJRof7vKztpSZd0S6see0Eh9nz+/P08", + "mPYdlG2cNWiYIH8Hj+SsIYy/kEOlS60ka2ueG1tgTc/KNo01z5uJ6/fXWMq25hvvrQ/FyhpGw+FROlcP", + "KtkrWRO11QIbGZ7+9VhCDv9kH06yfpSygxxgXHq1WiVQICmvXaiCHH6gQS9r0XtLYIGyQB+3+N2aUlet", + "jwvMfqEn3fvbVtiaJkpdo+iGucloK7x0CDkQe22q4CR4GfYSxtEUzuohas3Y0KjKvryiYlgl6xfSe7mE", + "BN5mlZ0N7/qtpjcbodHwTDfO+pi4k7yAHCrNi/YlVbbJFtJ5+7ZkVItM1RoNz4xk3WHWfct6VYhuD0/8", + "0xamLQ/hn9JuMKxNaaMFzXVY7vZqHirFtWQp5rU0KK7md2ImrjUp26EPka7h5RDytg6NdBpyuEwv0v8g", + "iYYimyz8qJA/H4l75NYbElLUmljYUnhrWWwQpxCF+yNzV8RjyFfzuzG6rW77/+LiZH3zcdAm2uGhVQqJ", + "IA7Ept0lt/GXHf+nIB6qtmmkX25S2xEZJMCyIsgf4QPWUxDICH2nVR/UF3EE6o00ssJCrMv34HkYpp0Z", + "jRgN2R2Ead2/B+Ba963HWjIWe0jd9vpnUCNQOxM8AFimxjfdAfg2iwm24gVFS1iI0nohi04ahYXYUh77", + "7W+Nac5bF++Z9gTtHfkeBd+3hnWDJ8U+aApCZm0q+ir5+77uzPxvzNfhHkWbnD0J6of5z5spvNNXrLNn", + "plNMY4rHcWTJdMRNG+v2/UcU5px5TfD6I73DgFkvqyN7byE5tN7IRxSLnejCxxpiNGqZCEyrVDTSUSKI", + "aqHQcx8HUprugB2lzrgncfcx7wUexNB38fuFx3dofQ05ZN0lrJ5WvwMAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/discovery/discovery.go b/handlers/dataplane/discovery/discovery.go new file mode 100644 index 00000000..c7242237 --- /dev/null +++ b/handlers/dataplane/discovery/discovery.go @@ -0,0 +1,127 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package discovery + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/go-chi/chi/v5" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" +) + +// RegisterRouter registers all discovery routes onto r using spec-based request validation +// and a shared error handler. swaggerJSON is the raw OpenAPI v2 spec used to enumerate +// child paths for the discovery endpoints. +func RegisterRouter(r chi.Router, swaggerJSON json.RawMessage) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{swaggerJSON: swaggerJSON}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for the API discovery endpoints. +type HandlerImpl struct { + swaggerJSON json.RawMessage +} + +func (h *HandlerImpl) GetAPIEndpoints(w http.ResponseWriter, r *http.Request) { + ends, err := misc.DiscoverChildPaths("", h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetServicesEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetHaproxyEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetConfigurationEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetRuntimeEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetStatsEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetSpoeEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} + +func (h *HandlerImpl) GetStorageEndpoints(w http.ResponseWriter, r *http.Request) { + rURI := "/" + strings.SplitN(r.RequestURI[1:], "/", 2)[1] + ends, err := misc.DiscoverChildPaths(rURI, h.swaggerJSON) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, ends) +} diff --git a/handlers/dataplane/health/health.gen.go b/handlers/dataplane/health/health.gen.go new file mode 100644 index 00000000..f0f08392 --- /dev/null +++ b/handlers/dataplane/health/health.gen.go @@ -0,0 +1,288 @@ +// Package health provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package health + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" +) + +// Health defines model for health. +type Health = models.Health + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return managed services health + // (GET /health) + GetHealth(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return managed services health +// (GET /health) +func (_ Unimplemented) GetHealth(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetHealth operation middleware +func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHealth(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/health", wrapper.GetHealth) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "rJPNatwwEMdfRUx7tFfbBnrwLTSlyW1poZcQFkU7thUkjZDGJsvidy+SvZtd2kJScrM1X7/5+B9Akwvk", + "0XOC5gARUyCfsPykgNq0Ris25LeOdmjTVpNz5Lcnx+P7DbZqsPwtRoo5WJNn9Jw/VQh2ySKfEvmSW/fo", + "VP76GLGFBj7IFxI5W5N8EwGW0tM0VbDDpKMJOQoa+I4eo7JiZqugR7XDWFr8Sr413RBLgfoXxmRmvssM", + "F26iNRbFuPhWZ63wPiA0kDga32WSzLL0ku09Ksv9mSc9PqFmqOC57qheHud2Vrez85mtNi5QLCMNKueB", + "znA/PK40OdmrEOl5z6h7qa1Bz7VXbEaU4xc5p4SC8/aRvo73ON33xM3AxrdUEAzbXO72epMjxY1iJTZW", + "eRTXmztRi9PAjqtpAKYKKKBXwUADV6v16hNUhabsQ74spEP+c+0/kIfohVNedbgTCeNoNCbRHytRwPkm", + "7nblzvjEcCGkz+v1u0liqf2XM/85aI0pQTEUMf4r1wlO/r/Eyy0Nzqm4f82kWHUJmntYBvQwSwPjWIR4", + "f4AhWmhAjlcwPUy/AwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/health/health.go b/handlers/dataplane/health/health.go new file mode 100644 index 00000000..a2830cda --- /dev/null +++ b/handlers/dataplane/health/health.go @@ -0,0 +1,61 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package health + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all health routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy health checks. +type HandlerImpl struct { + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetHealth(w http.ResponseWriter, r *http.Request) { + data := models.Health{} + status, err := h.ReloadAgent.Status() + if err == nil { + if status { + data.Haproxy = models.HealthHaproxyUp + } else { + data.Haproxy = models.HealthHaproxyDown + } + } else { + data.Haproxy = models.HealthHaproxyUnknown + } + respond.JSON(w, http.StatusOK, &data) +} diff --git a/handlers/dataplane/info/info.gen.go b/handlers/dataplane/info/info.gen.go new file mode 100644 index 00000000..97ba7ef7 --- /dev/null +++ b/handlers/dataplane/info/info.gen.go @@ -0,0 +1,288 @@ +// Package info provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package info + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" +) + +// Info defines model for info. +type Info = models.Info + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return API, hardware and OS information + // (GET /info) + GetInfo(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return API, hardware and OS information +// (GET /info) +func (_ Unimplemented) GetInfo(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetInfo operation middleware +func (siw *ServerInterfaceWrapper) GetInfo(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetInfo(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/info", wrapper.GetInfo) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "rJPPjtMwEMZfxRo4JnVhJQ65rVgEPVGxEpfVqvI6k8Sr+I/Gk7BVlXdHdtLSCpAo2ltiz3zzm88zB9De", + "Bu/QcYTqAIQxeBcx/8SA2jRGKzbe7ayvsY877a31bncKPJ7fYaOGnj8ReUrJ2jtGx+lThdAvKvI5epe1", + "dYdWpa+3hA1U8Eb+IpHzbZRXEWAuPU1TATVGTSakLKjgMzok1YuZrYAOVY2UW/zoXWPagXKB8jtSNDPf", + "pcJFmGhMj2JcYouzVngfECqITMa1iSSxLL2ke+Mafxbnn55RMxTwUra+XA7nZlabFHp2UxobPGU7g+IO", + "KmgNd8PTSnsrOxXIv+wZdSd1b9Bx6RSbEeX4Qc6CkFGut/PfaI/OviZuAj4ZZrhP5b7cblOmuFOsxLZX", + "DsXtdiNKsdh1fJQKYCrAB3QqGKjgZrVevYMis+SXkEflFvn35/6GPJBL0oXoFNU/FKFQrhZf70VKJJsd", + "hFxiHopNnQeNF5CLPXq/Xr/aRmTuP8z4/aA1xgj5Im/i35ROaPL/9zsP02Ctov1VdrFqI1QPsDk7fZy3", + "BGnMO/lwgIF6qECONzA9Tj8DAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/info/info.go b/handlers/dataplane/info/info.go new file mode 100644 index 00000000..368df02e --- /dev/null +++ b/handlers/dataplane/info/info.go @@ -0,0 +1,136 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package info + +import ( + "bufio" + "bytes" + "fmt" + "net/http" + "os" + "runtime" + "strings" + "time" + + "github.com/go-chi/chi/v5" + "github.com/go-openapi/strfmt" + "github.com/haproxytech/client-native/v6/models" + "github.com/shirou/gopsutil/host" + "github.com/shirou/gopsutil/mem" + "golang.org/x/sys/unix" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all info routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, version, buildTime string, systemInfo bool) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{ + Version: version, + BuildTime: buildTime, + SystemInfo: systemInfo, + }, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for API info. +type HandlerImpl struct { + Version string + BuildTime string + SystemInfo bool +} + +func (h *HandlerImpl) GetInfo(w http.ResponseWriter, r *http.Request) { + api := &models.InfoAPI{ + Version: h.Version, + } + date, err := time.Parse("2006-01-02T15:04:05Z", h.BuildTime) + if err == nil { + api.BuildDate = strfmt.DateTime(date) + } else { + fmt.Println(err.Error()) + } + + sys := &models.InfoSystem{} + + if h.SystemInfo { + hName, err := os.Hostname() + if err == nil { + sys.Hostname = hName + } + + sys.MemInfo = &models.InfoSystemMemInfo{} + sys.CPUInfo = &models.InfoSystemCPUInfo{} + + memInfo, err := mem.VirtualMemory() + if err == nil { + sys.MemInfo.TotalMemory = int64(memInfo.Total) + sys.MemInfo.FreeMemory = int64(memInfo.Free) + } + if uptime, err := host.Uptime(); err == nil { + uptimeInt64 := int64(uptime) + sys.Uptime = &uptimeInt64 + } + + sys.CPUInfo.NumCpus = int64(runtime.NumCPU()) + + m := &runtime.MemStats{} + runtime.ReadMemStats(m) + sys.MemInfo.DataplaneapiMemory = int64(m.Sys) + + sys.CPUInfo.Model = parseCPUModel() + + uName := &unix.Utsname{} + err = unix.Uname(uName) + if err == nil { + sys.OsString = string(bytes.Trim(uName.Sysname[:], "\x00")) + " " + string(bytes.Trim(uName.Release[:], "\x00")) + " " + string(bytes.Trim(uName.Version[:], "\x00")) + } + sys.Time = time.Now().Unix() + } + + respond.JSON(w, http.StatusOK, &models.Info{API: api, System: sys}) +} + +func parseCPUModel() string { + file, err := os.Open("/proc/cpuinfo") + if err != nil { + return "" + } + defer file.Close() + + scanner := bufio.NewScanner(file) + for scanner.Scan() { + l := scanner.Text() + if strings.HasPrefix(l, "model name") { + s := strings.Split(l, ":") + return strings.TrimSpace(strings.Join(s[1:], ":")) + } + } + + if err := scanner.Err(); err != nil { + return "" + } + + return "" +} diff --git a/handlers/dataplane/reloads/reloads.gen.go b/handlers/dataplane/reloads/reloads.gen.go new file mode 100644 index 00000000..2ad3a68f --- /dev/null +++ b/handlers/dataplane/reloads/reloads.gen.go @@ -0,0 +1,333 @@ +// Package reloads provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package reloads + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Reload defines model for reload. +type Reload = models.Reload + +// Reloads defines model for reloads. +type Reloads = models.Reloads + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return list of HAProxy Reloads. + // (GET /services/haproxy/reloads) + GetReloads(w http.ResponseWriter, r *http.Request) + // Return one HAProxy reload status + // (GET /services/haproxy/reloads/{id}) + GetReload(w http.ResponseWriter, r *http.Request, id string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return list of HAProxy Reloads. +// (GET /services/haproxy/reloads) +func (_ Unimplemented) GetReloads(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HAProxy reload status +// (GET /services/haproxy/reloads/{id}) +func (_ Unimplemented) GetReload(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetReloads operation middleware +func (siw *ServerInterfaceWrapper) GetReloads(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetReloads(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetReload operation middleware +func (siw *ServerInterfaceWrapper) GetReload(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetReload(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/reloads", wrapper.GetReloads) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/reloads/{id}", wrapper.GetReload) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "zJXLbts6EIZfhZiT3ZEsNwm60C5oesmmCNKimyQNGGpkMZBIdTh0Yxh694KUZDt1Lk3gXlaSyOHw4z8/", + "R0tQtmmtQcMO8iUQutYah/HDtah0qZVkbc1VYwus3ZWyTWPN1SpwHD/GUvqa3xJZCouVNYyGw6ts23rI", + "kt04a2JuVWEjw9seYQk5/JetSbJ+1mXPIsC4ddd1CRToFOk2rIIc3qNBkrXo2RKoUBZI8YhvrCn1zFPc", + "IP2C5HTPdzfDnTBR6hrFfIhNNo7CixYhB8ekzSyQdMnzRPxo+Z31pvjHBPxcoRgyYSEInfWkUHyXThjL", + "oozIf1TXbpweXFtbWWxE2usbVAwJ3KYzmw6D/SknZ33wxlyqm9ZSVLqVXEEOM82Vv54o22SVbMneLhhV", + "lalao+HUSNZzzOavsz4lBJyeIeJoxsY9VZmBuUtGZkkkF48hu50zv8Adv6bxeNN2iRuAtSltRNBch+0+", + "HJ2GleJYshSntTQojk5PRCrWio1+yiFobVs0stWQw8FkOnkFScSJxcoc0lwrdCNPtlHSGfK2e8+QPRkn", + "pKi1Y2FLMfIMKycQd+ztfVLEVsRrtDvNdn863dmtH8HvucqfvFLoHMSJ2LEfSraiy17+H4gm800jabHS", + "a0uss7VYLGcO8nMYNboMCR4sTLbURfdkdazBn+oiHEv2j1Un+oJkgxz72fl27phHh0AdBqKpEzCyCbaM", + "44TfvCYsIGfyuNnOWsmMFJZ9vbgoloddGh77m4//9yDZanuXv90yjzim9LVYqRXsczg93LF1Vn+/v2jO", + "B91yvztDCqT56BJPNeSQzQ+gu+x+BAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/reloads/reloads.go b/handlers/dataplane/reloads/reloads.go new file mode 100644 index 00000000..bed97eb2 --- /dev/null +++ b/handlers/dataplane/reloads/reloads.go @@ -0,0 +1,67 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package reloads + +import ( + "fmt" + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all reload routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy reload operations. +type HandlerImpl struct { + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetReloads(w http.ResponseWriter, r *http.Request) { + rs := h.ReloadAgent.GetReloads() + respond.JSON(w, http.StatusOK, rs) +} + +func (h *HandlerImpl) GetReload(w http.ResponseWriter, r *http.Request, id string) { + reload := h.ReloadAgent.GetReload(id) + if reload == nil { + c := misc.ErrHTTPNotFound + msg := fmt.Sprintf("Reload with ID %s does not exist", id) + respond.JSON(w, http.StatusNotFound, &models.Error{ + Code: &c, + Message: &msg, + }) + return + } + respond.JSON(w, http.StatusOK, reload) +} diff --git a/handlers/dataplane/sites/sites.gen.go b/handlers/dataplane/sites/sites.gen.go new file mode 100644 index 00000000..5963bf67 --- /dev/null +++ b/handlers/dataplane/sites/sites.gen.go @@ -0,0 +1,662 @@ +// Package sites provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package sites + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Site defines model for site. +type Site = models.Site + +// Sites defines model for sites. +type Sites = models.Sites + +// GetSitesParams defines parameters for GetSites. +type GetSitesParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSiteParams defines parameters for CreateSite. +type CreateSiteParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteSiteParams defines parameters for DeleteSite. +type DeleteSiteParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// GetSiteParams defines parameters for GetSite. +type GetSiteParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceSiteParams defines parameters for ReplaceSite. +type ReplaceSiteParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateSiteJSONRequestBody defines body for CreateSite for application/json ContentType. +type CreateSiteJSONRequestBody = Site + +// ReplaceSiteJSONRequestBody defines body for ReplaceSite for application/json ContentType. +type ReplaceSiteJSONRequestBody = Site + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of sites + // (GET /services/haproxy/sites) + GetSites(w http.ResponseWriter, r *http.Request, params GetSitesParams) + // Add a site + // (POST /services/haproxy/sites) + CreateSite(w http.ResponseWriter, r *http.Request, params CreateSiteParams) + // Delete a site + // (DELETE /services/haproxy/sites/{name}) + DeleteSite(w http.ResponseWriter, r *http.Request, name string, params DeleteSiteParams) + // Return a site + // (GET /services/haproxy/sites/{name}) + GetSite(w http.ResponseWriter, r *http.Request, name string, params GetSiteParams) + // Replace a site + // (PUT /services/haproxy/sites/{name}) + ReplaceSite(w http.ResponseWriter, r *http.Request, name string, params ReplaceSiteParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of sites +// (GET /services/haproxy/sites) +func (_ Unimplemented) GetSites(w http.ResponseWriter, r *http.Request, params GetSitesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a site +// (POST /services/haproxy/sites) +func (_ Unimplemented) CreateSite(w http.ResponseWriter, r *http.Request, params CreateSiteParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a site +// (DELETE /services/haproxy/sites/{name}) +func (_ Unimplemented) DeleteSite(w http.ResponseWriter, r *http.Request, name string, params DeleteSiteParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a site +// (GET /services/haproxy/sites/{name}) +func (_ Unimplemented) GetSite(w http.ResponseWriter, r *http.Request, name string, params GetSiteParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a site +// (PUT /services/haproxy/sites/{name}) +func (_ Unimplemented) ReplaceSite(w http.ResponseWriter, r *http.Request, name string, params ReplaceSiteParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetSites operation middleware +func (siw *ServerInterfaceWrapper) GetSites(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetSitesParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSites(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSite operation middleware +func (siw *ServerInterfaceWrapper) CreateSite(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSiteParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSite(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSite operation middleware +func (siw *ServerInterfaceWrapper) DeleteSite(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSiteParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSite(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSite operation middleware +func (siw *ServerInterfaceWrapper) GetSite(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSiteParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSite(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceSite operation middleware +func (siw *ServerInterfaceWrapper) ReplaceSite(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceSiteParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceSite(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/sites", wrapper.GetSites) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/sites", wrapper.CreateSite) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/sites/{name}", wrapper.DeleteSite) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/sites/{name}", wrapper.GetSite) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/sites/{name}", wrapper.ReplaceSite) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhRb9s2EP4rB27AXmTLTYsB81uadFtehiAZ9jIEwZk8WewkUiUpO0ag/z6QlGwrttN6c1K38JsjUXff", + "He/77i6PjOuy0oqUs2z8yAzZSitL4Q9bEZeZ5OikVvelFlTYe67LUqv75cHu+XlhCMXiw4O00RTXypFy", + "/idWVdGaST9arYJxnlOJ/tePhjI2Zj+kKyhpfGvTvSCQMdqwpmkSJshyIyv/FRuzP3OC1hIJMGR1bTgB", + "RshAEXPCckJBJqC/0CqT09oEx4O/yFgZcfct945BJguCWXs2WQvRLSpiY2adkWrqETbJftl9j+KGPtVk", + "3ZGl9j36hEZkx5zAS8qwLtyHEMdxpfA3UmSwgIjtmJP4h3a/6lqJb4Pec7SgtIMsQH7VvDbd66ij0tHa", + "OT35SNyz5WEw1YP2YYxxeOuPrr0ZyLLSJmS5QpezMZtKl9eTIddlmmNl9MPCEc9TXkhSbqDQyRmls5/T", + "aJAFKNJFQZeOSvvZO/EQmqRDi8bgYjdYe3i0+9fEl+W249ch4XrAUmU6QJCu8O5+P7/2X8IlOoTrAhXB", + "+fUVDKDLV1dDY+bzrCtSWEk2Zm+Ho+EblgQw4ZpSS2YmOdkOTbq8yim5zXq9IVcbZQEVhGsDnQEWBfC2", + "jklAMDBkwW2s6ysRNMh16Co0WJILTPn7qYerS2/T5QTOoLLIAzPmORmCuaeccuA0oBDh0NLJEC5QeTJO", + "CGpLwn+iOjKBtCv+emzSu/pUk/GFp7D0WV3zdy/Fs/y7S/pzzNlodDjFClnaIkK3NedkbVYXq6hfW8xF", + "bHK7YlgmJf3vrTMwtC5LNItlwfXqzbZl5HDqC4jFsrprElZpu6Vmz4WwgKBoHj711eMrh29kYbNoLwyh", + "o1Yyv/2yTZ6ibkskes60AZ4T/0eq6ZPstHi2g10PeB1w0nuTowXpLOj5ytyOiJ4pRqkcTclsi+UqA0su", + "AaEBfSycwFChUYRHHvUcpQtRrl9/6Of+2EBQgYt9Q0QLPEc1JQuyfw4NBa9BCUiAkIa4Kxa+DHrZ3ZWG", + "EMN9BNfLxZKEGRaWln10onVBqDp5ChPzey0WB1WmKEzeujQk2NiZmpoNNXzzAj6fiKFnMg/0FL7HnY3O", + "XtxnXzfjtQNyTpUjAai6SurWFXoyE97EOru63NSolXwsv4UtN79Nkt/F3nNAOV5bBYP9Xw5sv7/If42u", + "ci4EYOgGm33Ej29cC5qSGrSXMZhosRi0tBToMJjbMTulj/5gE++4oDiY92/7Mjy3LQTIjC63tKTJAqT7", + "yYI3t9maoo0vaU23rQ/PDBGsdYITZtKl3rRv+tzeq52cmuCpCR5XE+x1pbPPjcLHIulno3eb9gKNo6KI", + "qMvvDiyYy3++fA1Jjnq2U5Wb5PmFVCuKYrqPhrY76UlAj2r5Pdbd9zsjXLdZ7yZcVW8lXFUgXw0v+/Ct", + "/fbEudPQchpajnNzH73O5m6iEpxW9xde3b+zjhWK5v9u7t4mmVnXd2pTsDFLZ29Zc9f8GwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/sites/sites.go b/handlers/dataplane/sites/sites.go new file mode 100644 index 00000000..0c13c1b1 --- /dev/null +++ b/handlers/dataplane/sites/sites.go @@ -0,0 +1,177 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sites + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all site routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy site configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetSites(w http.ResponseWriter, r *http.Request, params GetSitesParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, s, err := cfg.GetSites(params.TransactionId) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.Sites{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, s) +} + +func (h *HandlerImpl) CreateSite(w http.ResponseWriter, r *http.Request, params CreateSiteParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Site + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.CreateSite(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} + +func (h *HandlerImpl) DeleteSite(w http.ResponseWriter, r *http.Request, name string, params DeleteSiteParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteSite(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), nil) + return + } + respond.Accepted(w, "", nil) +} + +func (h *HandlerImpl) GetSite(w http.ResponseWriter, r *http.Request, name string, params GetSiteParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + _, site, err := cfg.GetSite(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, site) +} + +func (h *HandlerImpl) ReplaceSite(w http.ResponseWriter, r *http.Request, name string, params ReplaceSiteParams) { + if params.TransactionId != "" && params.ForceReload { + respond.BadRequest(w, "Both force_reload and transaction specified, specify only one") + return + } + var data Site + if !respond.DecodeBody(r, w, &data) { + return + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.EditSite(name, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + if params.TransactionId == "" { + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), &data) + return + } + respond.JSON(w, http.StatusAccepted, &data) +} diff --git a/handlers/dataplane/specification/dataplane_spec.gen.go b/handlers/dataplane/specification/dataplane_spec.gen.go new file mode 100644 index 00000000..d02d0c85 --- /dev/null +++ b/handlers/dataplane/specification/dataplane_spec.gen.go @@ -0,0 +1,1088 @@ +// Code generated by cmd/generate/specification; DO NOT EDIT. +package specification + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "strings" +) + +// dataplaneSpec is the full HAProxy Data Plane API OpenAPI v3 specification, +// base64-encoded and compressed with deflate. +var dataplaneSpec = []string{ + "7P0Ncxs3sigM/xXU3PNWkntImfqyY1e99VxFthM9kW1dUd7dOivfKXAGJLEaAmMAI4nJ1X9/Cg1g", + "voghZ8ihks3xObUxRQKNRgNodDf64/cg4ouUM8KUDN78HggiU84kgT/OEkFwvHz3SKX5NeJMEab0", + "R5ymCY2wopy9+JfkTH8nozlZYP3pPwSZBm+C//GigP7C/CpfECG4CJ6engZBTGQkaKqBBG+CmzlB", + "MiURnVISI0Ekz0REEDZYIGLQGARzgmMiAKFzzqZ0lgnAY/g3IiQ1qFQhV5qhKU0IurdtByWs1TIl", + "wZtAKkHZTGP4NAh+wvE1+ZoRqfZPgJ+wnrYZ7Jmn+ZZMcZaod4Da3if6M2FE4ASZ4Z55qh+5Oosi", + "kio8ScgftqsjzBhXaELQHLM4IfEfQIb3PGPxH0aBByyRJsEUsHjW2T+5n2E0HCXwTxxTDQgnV4Kn", + "RCiqueAUJ5L4ZpRJgvgU6a0kJTrnTAmeoEvNo9D3Z+eXP6BU8HsaE4kwmibkkU4SgiRPMsBWcZQS", + "MeViccss+ZF8oCqaUzZDmMVoZg5JstRtFb4jKCYR1bOTaIIliRFnyHUlj0rgSJH4lk0FXyA1J46V", + "DOwfhrEjLhBmS0TYPRWcLQhTOEFSYZXJg1tNuLQ0eyBOyPACDkqKlSJCE+D//PP/3N7KL//5H8Gg", + "Tt5BEAmqiLAr1rLPgigcY4WbFyJfRz75F4lUoBfxHicZ8S3xINCTp4LEwZt/FnMo4/ZlECiqNAcI", + "zs4v0SVlRBaY2UEGweNwxof2ywWPSSIPzs4vyz8M6SLlQtnJzoM3wYyqeTY5iPjixRyngj8uFYnm", + "L6KEEqaGDCt6T17cv3xh4AG6GkW9gVc3uUbuvf6lvjKVZr+vkpTG3q+l4gLPSL6oq6Qrk8WO3I4q", + "tvF+KBMSpsRylT6fGEEOU/QO2tQpZSihpYhPLFkGb5TIiGcPrtlNjiTewdoTx/XYD4WkZ/MIgZea", + "TYmMKbogCEcJMm0HAVVkITdx9XxjejaGRAC/IAG2fzZTQO5v9rBB6Foq2Bb6I2dkhShdaWK3pJcy", + "7ywyXWhT9OmdRB6q/HJ2pXvDfk4090OAIvo+4sLcFrHUV4+mTkwFiTRk+UMHItUpAzy2y57RePdP", + "jAUJI80cplrOIaG5+1bpM4bv9V7BSFI2S/TR//AOlfoiuGvtNjrw3J0LEkpNOJ/0AsDsr+hhTqO5", + "vfIVieHKLg104L1ni989slEJS3v3rQAgjynVGy6kHvTeOrlKzy6pzBr6LQ8aQS7DeCNO0NAMENsJ", + "amEIq+BNoL8YapL6RhCEkQectMFZE5GRR4XSBDMGsif09WKu922cJSQObatV8FcWTAxLz0WFKCXY", + "7Sai9x3xbzuQLDX2sEcUlncDRKiaE4Fug+uMMcpmt4EW5W6DscP7NvDMq3ICa5vXbvz6BebOiBVf", + "RUfZ+C2ZUkYQZgZ5B0VzEre9y1hIhDPFF1jRSMu6njMU8Yyp8I547v4rrOboYU4EAWrlFLOd0B1Z", + "IiqRFnlAwVpZg5WJ1ubycVxMQC+4HiFmcjg6RNEcJwlhM9II9x4bbWaDPFv0qg6uVQm9D+6xoFpV", + "lSjFUov9Wh0o8Mjx+14tU0NEdHZ1oecuf9BQJ1R5uNvHbDEhQsPXv2ttJtaUZG6RjBaCrsdnFT6E", + "LmZME9O0vSNLPQlN43fnb8dn6PsoE/dE6i8AImVSERz/oHcmy5LEqNwV+YsyRWZEAJ/nC321pMrK", + "aJrH5VT288/8d6TBHSAt4KG5UqkmjdaiLJWwIEhmqb4+SKyxISxbaN3Atg0GgWkJesEKp+VM4Uh5", + "NVD9AyILTJN8h5T3oJdxA5E80AzxzFpQNQdghrB6JwMcDzhzOXOfcPz5+tJtl8pp/E6ivNcBes8F", + "Io94kSbkzS3TFJFvXrzQe3goFZ5RNhvej44OcEoPEqIkYZFYpuqAi9mLHIpRHQtlz0FZp/TZ7bOK", + "9o3eVHxqZl3wjdKyXY/PgkEAtPGu2AKnHrBzghY4tZftA00SNCGG3IobLlHiuvyOMPT9HVn+ABtJ", + "zbPFJBXUv6Tb6a9OB/Ns7NJKNV3fgmSS+BnjjQDCQQuYUirovea8wBHNodQELh92xMiDFovLp4Mw", + "fWI164ypNB+/DDZo2xbdYld+qd1BV47ftlOdogUp9diDMOhI7TmRjgeXZTV50F4ELt8uT+1E3mK2", + "e5J9W8i7SVKcg8pdXZd325PBI3HXZZO6PLKBTGPXvGcaPcj3NFF2O1SFEe9Z+9UwKX3SsNR6pCJi", + "gDKtMgAVjTRYsoBihRx3jHkkD/CDPMAL/BtngGiU0BeJprZ6IciUCMIi8oJERy/MsBMy1AcYs4jI", + "g7laJP+DAyYyWGfSqKL8N/21kzENxnYKwabTrUng4H7xiY4P8prM/ArP38dIwG8oKltuNb8xt48V", + "+IiUmq2FNA7eBP+z9n+Xr36+CQYBThL+kFCpgjf/tAsTKDwblvF7E1xYSr35Bd9TNntzM6fyzQ2e", + "BU9ftLjFlqsQ3rwrLKMlSDG5JwlP4Vvd2XFGK8wAqiN9ItL7kxDHsSBSBm8Cy3cDx+uDqQCLbTyU", + "RNzTSP8iLL2CTA4Jlmp4CF8qsQz1OeOZCt4cDgJJIkFUWNDHQxzJL0HrXpGhyyT1rYs1Y+u9fPHW", + "qx+VCL7COWBrLw3P+PvY7iiZ36xuh4E0c4Ty7QvWhThuzUeKk+njpavCY7HAfWJMQQLeI9Lrzbr5", + "xst/m3CeEMwKm29tebOSCBXb5a0L434z/UaTaXW3r1CZJCRSVty6uLo/QbYpEHZsDgB6S2XE74lY", + "ojmWjpM6UXqCozvCYqRPCxGIWAOqk0+K45Vmk4RGXlmwwdJdHDzvT5Xj12hooEyLBWAqo2w4IeqB", + "ELBoYJRmSaLvAPsMI3NBPGeDwSBYUEYXei6HKwrRk/fI+w7vGJqVzrDfwAEkDGXClQwnWNp7Ad59", + "gzeHIz8CpT4zwR/UPKQsEmRhnwvbdSmkfDtaQB7NQaE4KS1nQhnBAu6D4ue2AmdO00Jora5ibbuW", + "xdLykrSRSfNLbg/Sh4Es192f1lTbgQdZdJ8qc24nahUY9T1Ze7jhikqST1O4iNdNxHYwu/dp8Lvn", + "rdLx+w2maeDGhsu36jIteLiW3UI81T3do2oosoS0gtPUuYAczUl01x4WNC96wyN8R3SKPgUcy7Q6", + "Qir3KsPaikqr9En4LFRYzIhqBaVoLsuMyT2yt0fH27MMU1/hILKvU/9bjODgwOkw3+0I0kBSNLrr", + "MN28uZFZIrcpW0PIu+QAOu+neqcSpK67aaWX4T411eXLqjeWET3AEqdVYqokiuY0iQVhuRtLo8+A", + "lfctFD9v9fzYJ2PNb/kO5nv3KugEr3WaWnxvVjl4Awc9mt8FeuxEi8qGqc+4oGq+CN4EgmcsFnxC", + "4RKacvGARTw1zma5SJt/sqwjmt+FKRbYXHELouZct/r5ndYAM0GDN8ELg8EgcJ4/b4Jfbm6uXhwe", + "HIJdjsfEolfoYFq3Dt3ls6otTbhQnEUJN8TrZAsbgLKVqpCye5zQOKywsq7g9L6IqUwTvHT7ybiu", + "oQsDHum5omsHvhg+YxJPSXhPeQIrJ0PK9oXLZxgL/S0fS0vFq4gVu+X3ivXdbJskxunQreViKb8m", + "+V/prPyXIDGV+V9y4QBImQznJEn40PytIgev1VTie71rY3QOXYy+q7dIlso+KJUk6CcL7alyRtaL", + "O6YZvINoBlzSR1q8plhpe5gxqkXuhRHgYneWiycWEt1FOJr3sSXOC2DwbrJItaxttax1cy03NS8u", + "jESqPONcVRoN+pw953eUbMYOWoF6DmBDe71u6FdrvUm99xD0ban9U2kxvOp/vGR4QaPQoOsUxjYu", + "eIZiKWExYdHS+IRqGAcWpP7GmsKAcPqWgUevECdEbLyCy0032TCMOJo7NLXScKBP7qbk0WksNcHh", + "uPBDWrW+5IBkOBV8ERYC8hbIyNbYvBd8oTnmOzPSGtwSHh2PjlqhkPAoqHQ77tTtUW8anKwy7S1Z", + "wzsLsGCx1SHCiC8W2KiDrbfsuiHQuQW4OpQRrfoa50pDM1JNRMJUCyI+o+PNnEo0pSSJEZUoJqkg", + "EZjkKENTfM/hNb4CA8TbATw/utdKQRb83vTBaJqpTOjvEoLlqodoxA013cLRqRabWOKsHxuZOWdG", + "brQcOQ6VjYPYzDyY9bl0ZhrDNdYNgm408LpxByCVR//ik7cLYrobwSODv9ekvbKrU1+uXJPIj/h/", + "V1oWdKsTbA0rKze9pFI1sLCq3L/W4FK01P0EX9TP69nwv/Dwt9Hw9TA8eNPgYTDNkkSLEi0kpqdB", + "MMtovM0o88MwwpKEOP5XpjULPstkSUDozDcry280mPz2NaqMd/V/OURngAH6SWMABnYzsTmW89BK", + "k+EUR8rQfzNFoKOWyzSoEE+nlFG1LE8KJw94qW+sBX4ESsOnrxmpvA+WaKUhOnvwWhtQ3tAqg8NJ", + "Np0SMRRFONazUVYrM2Z4N7pDKhY8dSgNlcA0sTabHW/Lt4KnTokC4OjGAXdDMz6MSYKXz06JhD8g", + "vUkEBp9gBFgUeGWSDOfqcTNa2wmmDcjm9lOjOVDOQteyom2CWm8xNWd0WPnujpB0iBN6T3agnENG", + "AwsBWP+aTOsVrKs8gFkqiCIsBgzNbPe1i4oR+ePz71UYFUGnum37T7Yigug5R0rjF85jARE6FVbi", + "GLGmGEmIMq9ecHG3YSnXdoAqW/kFwu7QRxiswCWrWojwbAbaOQye83xG7oEiEk/7OC1Sb0iNbGhi", + "Af0efOY3ZAZx78WKI90bHljtW7F9FmxYztKNtGJo3PQ0UWqdv7lvvkuN38CO6kEVyDf9oE/9wLg2", + "l+RdD7G/aQgVyq2QbI2KUGm7RkegzM1OhVIJYg/ljvLURQEVjS1UeFLEceje9xRWxJh9XCimG3SW", + "8Al4KiQ8gn8ZZ375NuEzzb0SNXcvYLvjfslnmk0nam4MDqXH0FmXGFv8WBZIjIze0pRcRegDftTX", + "JdLQEEBDBtrWntA+Uc0Y8YHoM7+T91J+LSw6bbi3p0fJQair3sd4QtlsSyWvStGPDtTTIOCCzijD", + "ieKbplNq+TQISjfLjtiUDrRjfiJLNqpslbZP9uGm0/p4esD7HJkSESZYql3U6tocASi6xFKVNGXY", + "xvt/dYBHrBSraL6JIqWW1i3NnqHNAofxfmr5znCtGyNz+Vh+OKVs/5So8l6aNAWme1A2qwZu4wQ5", + "47/zpNg73osuUmOtte4P3gMb+5lWun2a0IiEODNcYcfNPwZo6CwznMMC38Wy4oV/XRhL8iF6e33O", + "xyjemGXK097eK8YpT4u3CinuVZTe4f4VWH3HeWU1u79vzq/Qr/qiPQM1vYRLGDG13QU+thDQOVMV", + "iDROyHbPy3LtOBexTQ2xepDyoZm6T/YyNgD2D66wkqELoNjoF1VunPtV5XmE1j8gsymdheUeWlrG", + "IqXP8MitojSUCyyUs471cDxuohSNNUx0bmGagZ71iKyeDSUwkykW1j9510mWoGngGWMk2f96ZZKE", + "02hGQ5ymra7C91iq858vUCl7k99NuuT07PzbfsKS+ILAnRNZ1e1xR3eyIsWRBlb1LlvJPKHJ4Drm", + "GSh+qDqhGd3XKNslpTn4HQny9UDKJJSMoiFFDw8PB7bfQcQX6CkwquajWbs2nmH/jho+tDA+HEOD", + "9+/BVBDy3uYoMFtVz9JuwWBG1Nn5pSysRUut0LsUSk87B7tu+ebututHY9ZbnVVtDrZ9bR52Di2P", + "xjjfrddZ2zxItm/e1fbcj4Nn3SW5McmL//w1pXzxHrz2qV8aOMfTJgJ3yQ3jI/PeIhQ2E7ZjREaJ", + "xdRIIrvMfh8Tzj0Ta16xhS9vwQCnVJhUlVjO9T+xvuUSgqWyT8ECs5gv9Ic4HVonukHZFzhXhIws", + "RqOhENa3V/83MRpT80syeSw7GG5io5VJ5I8QGnn/AxKWc/TuseyX6N5lOo9W5dxFXKmmmX/w4l3G", + "DayPZcwXmLKQQ1Teivtc2ylvGPSzJOgtDAQJNcCYACsZxgI/SE/gV8uB7X7wjn0Nv6G3MMITbBnn", + "yNj56miBSbEh/djEKTqH3/MlyAQNY5Iaz7Ht5q/3tXe4z4KitwDbDpQQtqdhLglzg2g+seNWWjsU", + "5OdxO0gP+DDnCdnTYH8H2E9lttHPlmk6usU4DTgl6Mr8XMLJGTe5VLusb7uRnX8iNzaYAokFfgwf", + "MH0OFD7gR/R3Qmfz1demArAvk8CEdgoNpCwuzGsbdJTa1VbEL+eKRXB49OpgdDA6OAwG+81h2jG5", + "qrvic0x/HMHLjtFCX56eHp9Wo4o324k1yKHAbEaGNhqzAH64G/AmOXtD6JUTrlyyBKRXdyUUKZec", + "aGN8Fd1HcFVpp73pttFMbA4jSkY4ISKMaOoPorYtc5eZVS95SMcQjoRSTb+nbAdt6+zy6iO6Elzx", + "iCfSmQMSPvNGy0c4tG/lRIg2opGUiS+iIMKhpDOWP7/uCCbFUm4LxvdihKVM58LEHutB7omg02Vr", + "bCOcN13BOGpl5rk5v0LnnM2IBAXfJZ0+y/moBkXTuXVB3JZ8BkJGFdkJDJwhvRI4me0ESCQ77wih", + "etqhovAD2RZEnv1tSwAuqKiMS+GT0u4aaZWIZEpEaDhRQ6ROFM93WRXymHJJwmkM0yCsum1LAxlP", + "fSmT++Mt/aagbxdPKb+AWnEiKhAzfnuS0d1N3w2kMgOpRN4fjrYkgem8LxoA9MNdUDvcK2pHu6B2", + "tFfUjndBbQ+b2uUKKudsk62UtobNO6ukol/zLPmz4FmKLt5CMIb+3OpWNL2Y1dJnGY3DVJApfdzG", + "p8eXNd/3uMijO6IsqjROSJjqlnt7EQJ3+ymO/ImM7lRS8TMD8ZhPp+3i8pjJLssFsoxKIg3Q5mDi", + "kiAJs5UH6GKKLFsboLuby3E1iSY1CeXuiGAkcelWJaLKJtAkyIgWek9rFQ4rOknIwS2D7U4l4ixZ", + "InyPKVANcYYuKcseHcSTg8NXAApP+L3u9+4fV++uLz68+3hzdok+Xd1cfPp4AL5xeEISL6UScm9+", + "caTKJCyEeTyAYjQ4XlAoD1Eog7aRz6PORRfljQ+Pjk98WpZ701wFIv3ZgMH9O7VLXuCC09TrizZx", + "mGw+ZkXu3yJYAmDQ2mDepFSMh0652JYhMB5GuPBv3wHMn0AmaKNIrDJZjXtFbOgZuEpkqCgc2+2v", + "FwfhDyTSn0Lk2Q37P1oq2g37P1pw2g37P1q22hL71J+V0DrCWs16VdMvqUyp4MZTsIUjrLHy5BLU", + "14xGwyga4mRW8TWMsgmNIOrnQRDGg0EwmQjwhY/8iRcBEAi6Q/BF9WMKrYyEURmtuJoGgdMPG4cJ", + "oyjU+IaTTEgVSvob3GS57fJwdHQy6C6bldevShbd/ak+OJjVKYv5Q2Xwk8PXJ8ej8viHWwmHd+2w", + "0o0MAXIf23siqFqGPFNpVqEyxDFoXLREAI+wQNWK9GPbbHZCMi4lesCdbT7269XdImUSRtiZg7Z7", + "3Wlp7xuPL9H5mSmB5UZeV3LlLElcTuVK0uyYJHRBNYeZLNF3b75DWKIFYboXifUfGEVCaWkXMp5S", + "FkM9noNg0OP87AT0Dq35z4/Hl/fHwSC4uRzfHx6M8k+H+aej/NOx9wACYMr2AthId3uxqexP/lJR", + "Gi7iU0m7hOfoTlrR6JDlSfeacv9BUXNBsL8EXCHZhXdkKTe0kXtbgEK22x/4w/2CP9ov+P1t/pqf", + "7Or+yRrqB4Iu7Pvh/uT+pR/U/csGH4MnSNtHp0vPlWT8rCHYLn9CbHktrZl/kWHwyZMD0jzurfH2", + "qjxINnnPAQffxm2O1jzCaGt3MLoPX7A8J9wKLa41Lc71z64oxkpssb5o8Iw0Ohj4/Pdzoxe8ntqI", + "RbM2uUTnAWZ+KvcxKbmxWJZrAnpMMr092LexLKaCQxrve2wk4QbeXmbhXGFzZa/Isyej16frs4dv", + "cHGF1Wvn0eqa7mF3rTlq5vdubpV54sHKLNHYFm5pdZbODV79TzfVCuOqY2VC2MzrUrb1BnXZdRxD", + "LUqK59FXG3Oq21pTFrnSvnlLogQLgs7tfFruINd4L0Rtn5rPrcLT6oTsT/mGa7NT7Oi9TyvJpCIi", + "lEQpymbeygrmFyRIYupFcq1FmH6rhSgnnCupBE5dSshVDw7T1eP3WzhHbVkjAqcUEhHnSfc29nDz", + "b5BAaik0N4Ir5wFvTt9QmqgXgivq+HuzT9Y6TymP25W1u5SPqol3z+J08wl1+NrhS/A25Gw4N9S9", + "5LMbIMqGtA315k3ZKd21uHE52lCrfjc2AC1fdjnLN/hCZXTBk4QIRJlZPF99B0/uAVPsNSgOxZeG", + "6p1ZRTUyybAgIkgQHM0B/0HwgKk+qiFOU8HvTT2LDTTyzMYd+Jb81vQqdeqZQVXz+q5GCgwF+VqJ", + "lIoJU1TpvTX7jaaQwGiamMotAj8M3V9efWZ1r+WOo9UDvfNo7Rxj9OhyWL92nmlwq1cYwq+54QfB", + "hNubuwVBF5RpETO0y9YiA4g5rGhMfzPFemyotwxWrI8FbLk1bDMpD3A+nSYcN2QS1t9UF2kbigMU", + "t6F7gbQrTj7F1RNgvHIyoeYy2Z+Twh1Z2rCF7hHpv5IlujTS5vaaGU8zMWuML6hnXEFX0BqSnLhy", + "f+1MdYJE92vjJuq5NSJC70keCZFrc91WoWrTF/dWlsvvnxjCr5yitzHvGdQ77ewyWGJ0qamo9DIY", + "lNDM2cyEMmyLf9YhPQiqSGiep9oVIvNckJ4DILOkY3jyOXRyGePW1rpwFf3KgQFNRQDNDft6tFrG", + "b/Q06Cpge+RfOI2+os54kZd1dK3yEvOKF446rIhbjATB9m1CzalERV3CTYJ3t9J05aRYYcoTGi2r", + "JcGsPc9XTdwUjDMQEEDQa2VWWSInFcNdoSUvxHhM7Hz1tqAx0T+bihmuspyd58EtQ0gP/QZqvOie", + "EqpF1zvqdpgt3yBswIMPUw02neomiLMaslSi71IstWD5HcBJko1wkqQCwyBVgbKgbBMUqICfe/vk", + "vR1IKtEMll8gTbqvGU5clbrvPOsVLij7DoElFciG0IUdQqMwxxIlRMoa2u5QEfAAY2sAU1Wbhq2h", + "Ui5IbDcJZktTA9SU0PPHh/rHaRXy1LBZnRFZgwH7cc/1Fld9w6xqUpwSmxitlicN6sl2K35YcS/r", + "SaXdY9XEqMypWxRO/KvUOjSDQOqncgHWPfj7u3HKVVP3OAzkeRVkRh49ldqvySxLsEBFeHe9NKsF", + "I/W9pUF5S15CDffW6G8ysDTVlSxb1Wu7tI2ubuSW/lV0DdYjI5jxuhrWDZJP9Zm2NKnnbfueo6vd", + "UxOplBJrLH15UeztZM2qeexMj7XegqabNFnNTDj/cyFrYvo3oGsaNSJc1APyyHhKpc1PvZQZ44X/", + "V33TxAlpeAjBjwmdNvzYMYKW8fxh0+M2x6VqnkGegNvvmkQi+8LjN0VULTagBIHqJIm130LMQrty", + "t76AaYgHs8aQ6pm/5DgGN6PCLcmU8scItEBT47CoI18PW134vJ2gZL/VLTROjRXktaBGsY8VldAx", + "TXyPAetcrsoQpjQhNuf3quZi9/QqZahUWjS2DfJbxslvdW8uQyk99zLr3HwPtj1eVMrMl/j80/n4", + "Cpkf107UWyP6ylTJRndkubbzdlYXHsm0AWFnjVw7qu4fZmns96nLFF9gRSNUBWjbD7pWZ5SRSjzP", + "aXTGSIzKu+mGLohUeJEi2CLNE6hn0C5t17JgUAKtzyjCkWpdbvpcKH2C+78/LcNYcy4qjoyKG9wt", + "6yjPaaw61MTPGdVTK+nBzL5n8cF//DRmuV2sXeKJvEtTVeoKlbep5FuQq03ZWr0SeEbQgkRzzKhc", + "5MuGWWzZfWVVnUXIalneFAu+pa48EgpV+XplBVd+7W0Dl2jfzfbXK6FWl7zQOmv2LK0VWvcwLpag", + "0hAVzdF4fFkdD4pe+Xn8dtDT4h5ohr4Xp6g2+taKh5Jnz3llHliqNTxsBZDswqgMO2jLqXL4/W70", + "mEyyWTlPbU1CY5zZm7/wEDt6ffL65aujip/YqE0+mK8ZJQ1CulRaJQ7zKMp8tNddB/mNCB4+YMFs", + "2Gx9LJ+J3yU+2C0zUM1Pcf9Je57aJ7yxM1yf78ad8p+sv+hqSdp2hLHWK0eaL6sjjEtla4s3h3bQ", + "XY+maxFHSavq7ThKirpEeKqI2KIEfFPnArIx9baGVVS3LyrEdkSn6CNXSlN1g7RSJ79S6LszsDp9", + "Cv+pVlDK7lYuQIoyqihO2qOy0iuv/28WqlPx/2Kx9F+daVzvVILUlcIrvWQr9vDWveWB9omTBFEl", + "UTSnSSwI01oRJNFs9A7Ka0nbQ+y9vXy/9nR5lTnBdvmj89fM9YLXXmr391UUwV+6P6+Q4B+872L9", + "tdFL9fnN8BkU8w/v82L+IWV7IsRnGAr9LR9KC9cNVFmHVt8kWodXiV7x/WqpCVsdLhgESYzTofnd", + "FirK/4IiN/lfUOAl/8sWCgkg9m04J0nCh+ZvFTl4raYS32MWkbgoYIGTZIKjuyztoyLVWZKgnyy0", + "am647p4/P9nO1ezD67Mnm2Za/ofboH3EXAdvJgCdm4p3JNh5AQwcnKfVVHprnIfOL9+jS279oiHu", + "+1nq8tixnmOc7YtG1CgFKHvqpbgxtq+Xcm4huHopOcSe66Xk4zTXSymG7rleSjF2c72UmuPv+ifD", + "RTlxtg3nf4YNxZmCSi2+HdWySoOiLOOZRGOFFZWKRjKoPDeun7dJKl1SV22y964xY7sWOfBphi00", + "Ntf6KT9+4fwozNKZwHEfrPCtaQw36osj9NkCfiqB8doeYs6U1i0YFwuc9IGIAYg+GoDFEHoz9gP/", + "O6V5N/qoARaPpy6tuTXZtHy3JAtMkxAnRGxUM8pNN/nlGTV0SpMOYVTQx1VcW/PW9U63e09dZYZV", + "e7sZfEN4TT6aNMU5C+15C4xla5TfC77Qe/SdGWnNBBIeHY+OWqGQ8CiodDvu1O1RbxSc9Fbj7J0F", + "WIiJ1SHCiC8WeJV3dcgkXB0CnVuAq0O58LB+xrnCxpN8ysUDFvGUb2R/pZa6n+CLbaJ8p1mSuExs", + "m62g88MwwpKEOP5XJlU44bNM2vQ+PazuL4foDACjnzRgZASkxnF7K61ZH7cwI0LNDiu+h1McKbMs", + "LQilOzr3ixBPp5RRVXV/d0XJXVI++GTK0jaWD3FuGWutYnlDa1kbTrLplIhhfwoxKJcGqihUXxgr", + "Fjx1Iw2VwDSxoQq7Xk6Cp9VC8DcOeG1oo/Lua2z7nr8yeCbJcK4e+yLuZ6kFjn8U5t48u1ToKz1s", + "DEgWFXMuhpXv7ghJh1D52L+59BiufLjgEyL7moipoo2uDFA3VKms894FbBiQ8TAmCV72Na2PHL0F", + "eG6AVBBFWAwzM3Tubs6rGMefhy6C2KxCgnwNXbGgyuLnPmRaPE+IiQskYK1tQ61rO0D17JaKBZUf", + "ALKqWQzPZqCRweA5v2TE+KpKPF2zmaVeDPDZncNYHledOM4DK4jIXcIwKqITN8YkwVCZJKbyQWmo", + "vniAsSYbcrkB25fxrbW2/VubcgALa8sBj33bc9fJOVAuFTFwqpCzPm2jF3FC0LkGjD6xiiH0379e", + "/xrdo/g5lO0yQ2t9z2TCQ+O3DkQ5nqQP6uhBfjFhNuf545YeSBK9NxUp6UcdmSZAUST1RzfbcgCD", + "UsixKylbCT52lyWgYQN2WkU8F5rYJZ+NAQ+/5mWeGbskWEv4DEuc9kT+s/HZlXVNLl+/RuBcYY4f", + "jKOEY47QCkkX4LzAlClMGWUzVEgWpezMMmjjU1FKR93dxPkBP7pKvq6+8Xa+EXV5yuS0sIFKmk19", + "8QY6Maq4CDNBNzHhctMn+7aSq5BtuLinxw5pnRhPKJv1ckt9dKCeBgEXdEYZTkyU7LrplFpCKLOQ", + "tBel5MpCKoDmBYDXoVNp+2Rfuzqtj6dHkfs2wVL1p6leAVB0iWXZ2QVO5/4FRnj5S7GK5psoUmpp", + "o+zs6dvME0yokjHX1/wfUxLR6RI9zAkEB+t9v0gVfHRe1zhJlghAIIymWkWLS+KcN1SNiOd5oLJj", + "7X+cRRcJsdZa94fMxmHjk0THHWsLT4wB3FNePnUTWqaVbp8mEEyYKd4HNgANnWWG+Vjg/RlGLPyS", + "P0A+RG+SbT5GIdJKcd/Xo6ThKp5HSTfG9o+SYwvBPUrmEHt+lMzHaX6ULIbu+VGyGLv5URKOVtk5", + "du1JqDTWEigWKX0G84CK0lAusFClklo77q2bKEVjDRIZz5WgMoyTy/scxwqIdqBeDsjqyVBRe5Va", + "97YadS2j7a5olaBp4BljJNn/LskY/ZqRkMaNSqmv2Cp0Qhdv0TRPwV4AKowoHQDZTpt89HPHxJ8q", + "RRBWXLZlKJ1e0Zjws56wpGOIcu6h/ORBr1MGUNer1Klvh0gT0K8SLJud+v8l+dpKmNWl+3/Hnz4i", + "9ySrdePcR7+VNnsJrSvJacLC36FNDQnbyxbNNtIg2CJ4u703zlv7ff9nAi9yz3//Dkr4DNlXPATt", + "/X70u+bfWV+L61mqAO+evGObssC7wduQcXwTp4H1tAV9W8RMQvu91P8tduI6ZlZsv25crNjmT+sn", + "v46Bubn3z7pqTij1rLQsRtDCFI8zA2Km4GQuiJR4RuRqelrPW/vt7fg//5f+j9+SV6/iRhZEzOBR", + "w8TSR4IqY32EDJwmymgQMK5MaivKpjywYVV+e1Tx2NnZKeuD6Vu6Pny+WVsa15ZzLlVjUh+j1LWk", + "Y+3E2YBAN3MAVjqA7/QP6MwSeIU/lzaG51iUOjdlzQcAQwCwTfL8msuTB2uJznypncE/Kk45ZZ4d", + "/c7+ooUTiEbxXCC1rGiNAIqvfXZwg29jd/O7p2MmPPHsV1jNXeKkfHLr0sy+W2lUWln7mzeXTJLY", + "DBB8ioqGbdfMjerBpGG1vPzuXWngntkdu6eCswVhqllQgxddRdj9mjQu/hPrswHbIlx53peNPf4G", + "Lb33pwOzISP0FUzgHbv3vsismkwlUahEGXSPBYW6oU1wm95wyoSrJ4Ba8HsCoU7ekRB5hFgNvcM5", + "IxJJsGZSEvvtkv/OyzNuvTbjlgszXrsqGVu/KrJhSfIlgAp5Ypbp32W77J3mnXDzVdiQjDI4u7pA", + "7+xbYy0W3z5HtXg+MwLKmsZNOT/0EEX/8qVpUWohsLqmPTOw3FN3Zc9H1Xe6o9FocAL/OxycjI4H", + "J6OTwcnodHAyejU4Gf04ODkcDU4OjwcnR6eDk6PXg9PRaHA6Ohycjo4Gp6Pjweno5IuPqn4N1p+p", + "qu7SqZHP66+VXHi9c/E+WO9rVi0S3e2mCLY9MwmP/rCl3W6GVmJZf6R0o4GZhy/V1TSa0RCnaftw", + "dNejn3D0FjG7Z2m6Y7ju+/OfL86g2rOHXXh+7IVhVOnUqN++x1Kd/3yBcJomNDJZPdfbWWIeCc6V", + "N2lJnuI35hHcGkg3dRURBVlwRZBWfA7QzZwgeFwjLgukSUw0yWgSlxMfmzy1Wi51uObdJBqfX19c", + "3YTvLy7ffTz78A4yvlyd3fwS3lyffRxfnt28e3uALiAfLUYLzGIM2VRsQRZvrskZUSEM6VN/PCXW", + "zcyUoOQeQ93I4iItFXUpXEA0GngGyUgPuue9oiwmj+tpb74v/PbSVKvzkDQBYfT5+gKpOdbyRezi", + "0JFMsJyj72+DF7fBD7qTlgxX18ClXF5ZCLcOeg1yejPkSr+tpTf43Dh3l1qFX5IksjJieZs+zIma", + "m4zHjMNztwblsvo4avOUMDt5qpCEWeM8/xhUwncEHzQOBV5Qsg7aQLW6L2Uzo6lR6V7Wt1he47QV", + "E9EhJAZOetGx7a2GH0NBvspqQt11abut1bCUhzriLMqEgHOep/nVBKjQDjNkXsoOXJppH4ntEbJj", + "uTOENHsMP5z9I7x+97/HKM40ocprQKTCk4TKuT5PA73Eejx+T4SgMTHYmG14gN5nQm+YBRdk4JJq", + "l1GIOZGwlWKOFlmiaJqQR8pmABaKRxtP8ArUjSmMt7QPpY8STkUHLiSzVN8bdmVydlOayfYrcPWP", + "cXj+6ePHHdeg+4lwclR9X0KxL32UPVMJWuflTrGU9mGt44Er9Wx54vRdHoLBspF9a8a0kjBZcUQe", + "lcCRKrF3kC3gulNwkar5UIM2Kf30V5+vLw5u2c08kwN0m41GxxHkaIaPBC0yqdAc3xOkHrgrmSbf", + "QM8pFRLYqaukVrtUBvmwJvd3vSkgA7WaDm7ZxdScKJhgDJsjP2YpEVMuFmiBVTTXe8rKCZ+vL8wY", + "ecupPnzem0ea6/7i4/tP3su/wYpQ8gJqv+R5v7bFXTyGAic9lXTL9/WDOGl4g3UiXUe0tXjdKu2Z", + "FUXlfmTR0g3VyNESPpvBRpii8c3bd9fX+WODkVmaWZdGUur91ih7oJ/yp+kBcuLvO6aISAWVxPJ2", + "WR/4YN1D42rUII5oYgPa8vV13/miDAvnANfafOMTTI0vfKntz847fjUa2NbvcS1tRR7f/VS8L+dt", + "9RebC/KW51rs9Lww8YKyFdCuIlTSzxAyL+tSXSF47JTlga/1N15e4MrR2oZj/ffGIqx2ANu9dJbH", + "BqNBYzXP+nEuXyMNnp3U3sjMFoXJA3Gsc4fmvxqMeyjwHJCDW/bJnodkOUBLnsEVPeVJwh+MdKP1", + "AIbOzi+Hmv3ERV2WAaJa1qbRHEVYksYzqNWfDPJdUq3xJUsnYuWQ9MnUa3dwyz5wqWrTMIVRcCII", + "jpcI32MKlrs1szJYw5UDKbfRLUTm3Ab5xacnCqgwAmVLqCyepHKyueGBw2gc0kykXJJpliRLpNm6", + "IvHBLTs3oq4moK1iA91ug7NMzbmgvwFSt8EA3QbAXYYrP+gbas7T4WQ5nPO0MvFinI8c0lVbdlcM", + "cw4lqxWw5dsAYBVfmgKvtwGCKLBN+wFNSIQzs5jLCt0jzu6JUGD7BQK5e/bAY5A13gR5Hakp1ExM", + "NG9smZ/D7AubViQOlXU23cQW3Mh1lrBuEHRjHU87GOZqt76vemtZAi3U4cqJrOpDcEdJo1APnFyE", + "JksrpJkLwUpp+owqfEcQtg5hel0MwmYPShACDXtI+KzY3H+yA/9X2TtrAsy6bCs6VcuQMxLGZCYI", + "WeM7Bpmm1tVMr6Ns6mTr9k+DQKud7T3P3mKFcyO983QwoaLOoNrqWQ0SrVdgdHMgs6rxEm3wJDMF", + "ZLbMQ2g6y2pxOK1kmYI2zsFjYL8TJvWshCS3lack+D1YrQaXpqFfdS3XdtMMZojTtKjtprmFrYwD", + "FodMmtPTNpdGZa+7rAjVvZ4/egZueJOQfIJZ/EBjNQ8TuqCqAf33BjljXdSXFKDpCtJNlug7SdQw", + "hzUEWN/ZNPnAESFUh7BIszX71BihvAOCDobD2BXe0/T/GUweEroYUhYM7EeoAvSUV7UPu3jzdSe/", + "TSNXTvAEk/cYQo35rWR6myyVU4o0Y58Q5zBJYrC8GLGICMpjkIaINeGC4j8hpTfeKRe64dCE/Jqc", + "6XMs9GI2r4lVtcx9Yu4fd7JcMORCS1Ms1neANWbYgoUa84NgsLl429brt1Jk05HXEMRPX2fqVnTh", + "KJdXEXFXHUzUSxaBFTE0scvRSOB1VIVrtJm0gNoa0i5oklBbkK2Rwl739QrdVzZj7a4c7LYyvnKz", + "niwEyGh3ZUuYyBJLZNN2QiR6gLeMBN5TZM6MMMPJ8jcSD5zpTH+M+GJirFCaeG5tJUlIpKzAAwV3", + "EWHKpNw31UmsUJOxYuP7j1GLc2NWuAXz2APxtbL/jb/sg79saeOnLBftVtcjN2DZ54WVxSkWRFPC", + "MIfJEkpBAaXJY5Rk5l1KqwdYKpRiCDqEZV3gJSzUAicJEbCI1OolG3nYX3IRZcpJaN6+93fn60HM", + "lQ/DETajrAcRYxV8Xjq8xlZLllHl7CtFOWGpCI5rlYcRZ2Rg+SO1L02KRndD0z82TzFFRRX7Igim", + "4TVX4p+fWRrRf04e42yRNoWxrV0OqxwUwPoRKBvBazXFsgV/OY72MP2hdBFB15jFfIHeF8M8ebWk", + "PY59Zcfw1OPzLqcV54Nq3ttBof+Y0+i0vc2l++DX8hOOU1Ra+AfmbXt+Y7EKbaOnjztTfq99q3Pm", + "BqTW/vpWR3uqE6OL3/f7XBnvmSaVnJFVBb2US3VjcmHIcelifVu+LBc2/bbRaFPIbbQ5omoVzWbP", + "S3tK3+e5MJkiXWruuB59FX+xKZRD+UDNm2/7khv+rgaqi+HapiqbidEClR/esFsh417MCztUq27u", + "kO6/DM63QjbPUshGyiSEMwLJ7trAqfTotZZNC1/W9/Y47+rQ6viIn5t7fu2HnVeY0ZZ2X0eBupNr", + "yQy8ku89UJrM7s+mzKMrCUVLibyORqORy6jlUmhZYgLsnDM//QUr4fzZStH0VeVkffWPiqTrcqk5", + "SRe2gP/R6VuZkMYlX0tSFTVR9Fs5kT91OZE9Vfn4M1TtqAQUb36ALbX/axXteIaSHN+qavy3r6rx", + "3CUiZhmNt+n3hxWL+INqHvz7FR7YUnZ79goFrZH9i5UyaL0+f0zNg72VKtht3n+mmgbPXRugf0Xt", + "WYoAtEt48NcvFvAcuf3/26fcr8gu//H7023w3An4/4RZ762xTkXp2nz3U0yTtgnvoe1OufL/Ijnu", + "951S+1uK7BYpsndKugyOIGHua7Le8MOmVPPHosdfMmvzs9o2uyZd3n4UK+n8m+U1zh+8mvIau4eX", + "dY4Trkm3DKDlJ506Ou3yF5db9/uSNiOMCJzksSHVif9sfkWZJCYT8YZMiatRrf5UUU6gbQzCXIk0", + "sKV1yg6Bm6VhqbjAs8LXqjlbomeiLRx4bK/31Jri97Uwni0JLjWIT9GshnnrVI2VlfeQAmx7HVx3", + "SsTYwzbNI57beauY9k2+Krt4DTzf23oe0+0j9spvPZJ5l1d1A2FD4qho7vJGbVkZ+NwAeLIqUihT", + "QXAMssM+HywzqYgIJYkEaXfdnZsuaGy6aCBpFi5wTS+sUSfNQtl2gKvPaExcjF3kTUbgD6zTbV/c", + "zDXdDITa/enADXJ8NuS0PL/6/AGnbXJaaqQ/4FR6ATRpqhqLlCc0qhjrwFFuEJDplEYUpBl95wip", + "hhnIWENmEjnOBM8g2PpoGEWPtS/MIsnyt8f1ZsfeZif1ZieuWfnLWpuihU17gllkzGu2pk+rx86r", + "z+jKkONpUN4yDZsqd+csUw+StWqBVPB0GKVZMAg4S5b2I3xr6Qdf28+mdT4J0yP/0/zKRd7Lfobv", + "Few394v964s/McvmjILFnDZvTXtI2mzNMfH3b9qZMSaLivhTfiwlk2zWVqeqNi4Hq7k66tUkxV2r", + "q6/1uDb6uHUhr7lSW0d+Y6aa0hnEYdpvbL/2jtIbbzxbrMOVe1+bjPuGPNogliIOTM0JxC/YY+VJ", + "M+uv1bF+aTx9NCwmrRoZTvGCJssdLrW3H8c2PRqysJrTVa/Pwb3aBfyWU31VxiQVJMKKxGGRk73h", + "xdv0II8pEVSDw0mLPqZmvyn2167iT7XO/8a4+PVutU0dzatwRMJoOoPQBCLCFGe+jJhXLiFGVYxB", + "phdECtJFlmBFUMLZDAmScAy62X4Ej1lFWVpj+vz5AkzYM2HLiDSlFoM3LzQh6oEQhsYXP38eXx9C", + "9JUgOEGST9VQKp7ub0b6LtzhqPwM/c0Duj1+KV5CJWEtc4eYLcMFUXPe4MtRfXdfc206h4CGsgyt", + "yi/Yogtr+N4vh+dYEvNWv8GeX27adCHVvAoadfD5YRjzkHFVvBhRJkmUCRJCaZcpESFhEW8IIdIg", + "jsIHLu6w4BmLrf/CA5lYc65RNRo4xRyLONS7zLiv9ye3117RsIjRWPEUnU1dtM3qoygWsUmTVUsf", + "BS+eYSroPU3IjMQhZBdbbfg1o9EWz0Qq6vx04k+zXb9Df4EJXQP6Vzn2V4B8FwiF74LxCm3Jhn1d", + "SvEIYZ7cu56MPk1wRAZIkDiLCOIC6fvE5hjUqjriUyQVVplEAMPd/ZqzIcyQeylrZQGxThlxg6+T", + "52DpDlNMk31NAAqyZiAv72cG+fmecnEXPmCmmtzd8paSqIzGa9tC0CWJQ3cKPC14hJOUtA+D8r4Q", + "RjjJJbvvJNLwIP3IQfFwy+KwXE6ndaTXhoOap31qFcK1Q5jWJZ8hKLr0i5uF73Be8plulLfR089w", + "29NZbgqvrVp1G2o+XjG+r5HYPkAX9Hfogj5w4ze65TOrGTg0aYiNJOUNgy+i3hVdgBxjekJQsczE", + "Pb0nkBJPw+gmujwNAjax6mgrSetjjosxoZh64zw/ATXJy7raaiagRUsbVf2/P1+co1RwxSPuyd24", + "xmdX9zQjxv6rnWULHFpbU2pv745bnkcyDU3ai7Yby9flqWLmaAvJ10VDonHrJFZXF2+LHFbpUQjp", + "8AyHAG7kZ1SploATHoXTuN1RuLId0HuQvUXG9O4McUqrNr52dusJNYHTxt3l950LG3YqQlhjW260", + "Lz6Ld5knXZs5n11dtDGx2Nbo7OqibgEsADWJtpKoMM4WqXtmXl1ACUn7xRqZnjym7d4Y3z2W4xM6", + "FhTyJ/2FsTcXB/obFm2LA60pCPQ3LNbR8R6LcLpYq/20f9h9nz/n9kInO3IrSr1fqK7Esq/Psgne", + "GrJFeBfF9dMYneMUT2hCgcgNw8wXxhWm4Vl2bBJmfCALLpalYBfgd+j7d/+4end98eHdx5uzyx/a", + "Z0Cvjgr3saG65z7+sFIBwDY1SUEMfguDHyQUKeX5cPmTihRNNvmIVFxAKiFkrmIEZoKD1Ql1u9ml", + "TFp7tZSa5h4xjfqz+XknZzXwUEIORA5z704w1v0XBPcG/dysQQhrECaUkXVvVrlBp73phmWLkIsQ", + "Eii34xd2rwlkcjjXWYfBoQZ4Awcx0luO0yYeYt/LoL1sBnUJ1PKf7TJZ5XbCphvfFDEnoQm5aLvH", + "fV0cpA5KxEp7B6NL/3pfCK3vAqDSwUHpcOBX2jsY91jITkAqHRyU3xI66QSl0uFpEGRtTb+fjek3", + "swk7PZ30r3InBfyzNGAesGDhJOHRHYlDJfB0SqPCiFc3Oid4aevjmMRRGEmVRXdIYXmHlKCzGeSi", + "QUVN3w5FqDuwvIdMTFvvi2rjiqeQcXBo8iLLGaHfPUKvAJiBHLOqstH+Ko239uDWGMnNtuy6O93P", + "Fv82XlK2ac+uKjkDbUPpjh57s/xCKE+3na9e9XLobb5zLOehe5itiekZi9zzqFPyZTxZaA3/X5Oj", + "YBA8qJdQQjs6PoKa2Yz4XdjzJxMHZoFTkxTcvP1KKhVhqsH/PaZTWvUox/c4wSyakzZ2bJMqKfE9", + "dVsilUHDlor5A4N04XdMf2pvLK8u2S9m2N6XrCE3z5auVRBmVK40JgnkQa29UtbzeUHoIHTLAzBr", + "1bhLCU9MTnSXf72SUD34HUkRocPXRweHL388GB2MXhy+RE/BIJjHIvcBDhb4cYhn5P9/fHh6/HI0", + "Gtnfc3lXy53DG4GZ1AQejkmUiWpJFKKGRTWl1SRTeenT/WSCjkkyxFFiE//pAe/I0qrJ+x/Sl8/k", + "/Ff0K1miQsN26alaBYVt9vyw4BpSZthyTuOEKyNi5MmxCGsSTTrmvm4x/KV5inJjl8q9FEvy/f/z", + "xl57X/7z9vb72+B7+yes1A+3we3tD/83b/HDFj4y7ShlcLPVCP7dShv4cl1MBSF299m1q2W/ODu/", + "rGW+0Ocmz35R5g+/735chHlkc0xikH9hWgzKHGSgGa37w3++bFBqcbw0ulCI7DmwXYvTB8DCoVT3", + "Z2i7bQ2DaUMDGA99MAM9lRl3D4QoLcRglSolFGsL2IFerpR7wmdhXnEqf/ZYEKERN9k+tDRElYmt", + "DIxKY+bFuKLgNwb1+awHH9R3SrySzxaJf4kaJnw2NBiaClk43fe9pkdd4NSSWn/6kg+99xvOO7j3", + "XTGt3XUaPQCzTwRz/BqRgpL/ZbS2UtRkFK55fOhI0mioT9QsjfTmjIZ6CrNUjRooO47GRKHiRcPM", + "KDBINRsZdsOJsmjlj1Hlr8MK8qszcfg9PgOCDoli2PbJwJ5h7S7MeKWFAzcSMBsYa3zw5vXr12Xz", + "yWi0O7ZwNuxQhjDwORQEy8ZsVuszk68ABFt0Pdwa4kb4dNoLyzVqBwzh9XCuXE44SfhDkEublmtp", + "Cb12TzlmNmghk/R7NGp3ZPVKGZT4bYnY5o97LIpPQ81VBxXyaAm1aBdzDder799j0Rc3yxHzbv+/", + "YYGqT7HwctmXQFmhRSMCBevXg++1GtA/G9epWBnDozQqMuLpH4/LhqzoJdNFnqbpOmsbZql7g/Om", + "62u7Po+1Zo2Nscki05RafbMppr3Xn8+u9FSj+NkqxbtEdHrpLvdD+DxcYNXjpb8YF5dkxZh2kpTt", + "A7TPhHN59RFdWUcvk6ecx8vt7k5IUW4hrE0I2AUYUD+M+GJhM891VjFd33ImG/KYmg8w0JdyebOt", + "ikJUls9kRCxkIHeTX7769Ot5MAguX12Pr+Df8c1Y//vS/n1y/uljF5nCjW5nYwZ/jBK8wCaVGxZ3", + "W00nB+h3PSKRltfzcdAHPU5eTqB9RkdBVCbYugL1rXZJLSJOb5hfLCYNqYXy/DK7LXRuismfNpw4", + "I/JP81hfUFPzT76iwn76sq+qiS1WMDfhbOkcu/Ii88u7s7fBILj6fKP/+2ms//n5nf7vzfXZ+Tv9", + "5dnN+S/BIHj77vLdjf7i/NPHj+/OdZNPVzcXnz6Ot9n+BbNYUBYKEt33Ynwunyp+13Ce4RjbY/3S", + "/Hny6dddDzFnJr/XNqyzBkdm0ZrY69aQ8l36e39bU4O1V3SuJr48PT0+3eKdvfWZ1SOGFvctaFKF", + "pe/NnaGA32/+iLgbR5KM7o6PTHpABE7LMPJ6gXfbeopnynv6bj4Bp7l86T6cwIcdz95KhLFHfLDe", + "6UPOhiejkxV5wvwDyi1Zo9uW9BSf94Ogu0lOmaC9SWE9atSF3vblj9Cp/1lZhC/ftOqtcSFC0m3N", + "bPm+ojiUPLqTJ7uynDZqvgnibq3Yu+b70inbC8olPfTJN6euqrPptKeprYRj1gNXJU/05gnLyfz7", + "SKtra2hcuwHQWwfiaVAalrZLv+oHaRwNCmApFAqvPKWn9/pGoOn9yx1QvzJwYSwlqkL4Gl/LKjDT", + "0fqZRx2q7JfBjMeX6Pwsj1fSoO6JoNOKy5Nz3Sodwi+Nklv7cf9mBoI9D27nLlH53kKySwjYTK3o", + "xnq8e1w3vY5iReDryt63fKvKu/Hwt7Phf42Gr9F/3t4OBy09Xu1bS43t2ZfoDTH9mgO4yNxaUbVd", + "HMAASmu/L9O60d2Lspg8wto60e/k6LREF/NI04+XqrVDRJAbrZWQUe1Rkk4ar1U9XZu+r1TIwqYh", + "HATJdGg/5WMm06GzEjytYlka0x1Ct8Mr8Is6H9sMvIUyXno+q2HsmrZgC+2G8GZ310MiOySCrgUm", + "83iP1qnG9cn3QMu1rkUeAtj1Bq0V7ehoNBqcwP8OByej48HJ6GRwMjodnIxeDU5GPw5ODkeDk8Pj", + "gT5TJ0evB6ej0eB0dDg4HR0NTkfHg9PRyZc+HmhLm6GuV9nf2mVnGpSbl8UfqOzS8cEG+uzvoaZc", + "oXL9+0zBMNc+y/g4ZXuxscTbnxqJ11WAzEko90hDGUqSe493uJTObKrHZFnU/Qa3ecSnJcLL6oVT", + "KaL0z98DY7rQh8gVQXxBVOSmUapG9EJSRQ5fnIxGB6YQw6DofNK684nt/CXv8UAm+sfh4eo190wF", + "n7a2DW8I+2gT4u2ikkszLZ394lxI5DZJt/Mvx3m3ve9f6S1xj12eXMcTSoc979j5pBeH5mktuWS3", + "s+7ItafzXq4Su4sIauG0FkJd+z1GHfz/bqpxBv8Y/mIoMzw3uQuHb42ZsJB43boUnj9/RLiBHr7w", + "LFoXBXCZa4fPEpTQBbGqyybO1DwUBCeL/p7XNcyGt/VMzQlTNDIb8BrGhdKuLH6gsZqbIGfz323d", + "1XJgQwPG76anMIuxiHNWQyoG1jpCXR2rO+Pzk2uEoBFymYLqiKRE0K0cy3sjTYSjOdmv+deMMcxk", + "Y/RGNCe5A/m3CJtvETb/ThE2MWHL0OMPfFrxBz4ajXZ/6P0nDBa4ei3WbNLbs1XMh9buC4lLMune", + "9ibREDxt8r8Udy6tsVTFpyEIS+bPaaXPtNwnFZQLqpbDKMFy5Us+nZrM2OA+K6LiUxm8Mxp/2Ybn", + "fQuK+hYU9axBUXNasZftySMKi2Q51EM1lEqkTJV3lcZpv/d+K4z+bQPHkgyHODff7IeCSYaLwWxu", + "ui2ExRzMt2C3f7dgNyzuQt+r2vejx3+Ohq/Phu/xcPrlP/+v/uPLf/7QH5LirglLcVcEQu3iWhnu", + "n9T25gCTHY1IQclcTDscHZ2U5LSh+buXyC09op+GH2lEChqaav70t+oz+1Tg2YIwNYQs4JCYz32j", + "aZKa5HLzoeaQZCgTLOdgrIYvocUw5mrlC/sdEZGGFBMNe5gxW3I4Lv2m+DBL9R8m3c7XjIjlUHKh", + "hhM7kR74aj73IRTVfKqQI5xmSTtXvSoJHfDVmZeeadphYMKztsfhn91J/aUdknpy4f65Kdg9B/nH", + "ryUByP5U/vOrZfaAXC6z/vnQc4l/O7m1bMDOGm/dkpW0KS8PcDEpek+as2UXsw/GBwDdG3VMTdb3", + "0myPR4eD49HR4Hh0PDgevRocj3780oMjMozV6JZ/bX9F5zZptUGNN5Qw7G24T6kzM5gB6w+1CY+K", + "WmlkSh8h4HNO+uFwLZG8yR/yNYpeP5r+7saWOOU3VO4O1sf+3HQwch+x4JvnSp+eK3XrkUPbP4ee", + "fFnWDfrNu8V6t9ihbXS/Y9X7tCS6VVi3CMZ5IufVUoVKJT3lggC9fBgL3qSgXY9v0M3NZfAtc8e3", + "zB39Zu4gAsrJ9WRGDDJJhhamDQxKOQkJm1FG9qncsnioRxradJleClx9eofeGUwcYt2rf+0Jrzzv", + "8x+SgqTI8d2HtO3AlWGvSJmg9OmNrzLGIFOIcRrpyzpZRYLLP8JqpHiD1+oNl8URVAJHd6GMwjuy", + "3N9WhFGGMvIj5H5Fv5JlBSepKITjQ578Xl6gWyIy1gOf23HLGClXcKMfd46W6NzAqA3peoxzijdx", + "D3iLDEpP/p1y+Vhh0YUfJq/goW9psuEUj5OlhwUwjQeDmoWkeL/MVZ2BrSi3LmOQ12RQ/G0g11/3", + "rCi1lzxDVW66l9fYlomMSt2tVXVQGDkHTbaYjs+9xmyx4elX5eEqjuWYT2Z1GvMslUTOetalXDfJ", + "z0Y1E1P5jh8ED5iq4ZSLISQSKf09xyyWc3yXP5vX3HOqL9drEzxlgvZkDvpniTblffzFhdAO+3pa", + "roDvO6j2W5qqdkGsFTb5Z46u1acmxCpMCJaql3u2ei7NMkn6GymqEOghNffoL7iu0y7yIbgab7cx", + "yPfauvR2iwmxvfYXFVL2cN4UF1L2Yl4bGeJ3X27vMV5xu35aQ8iu8SElcu7NY7yntPWdE9Y/R6r6", + "v5bT+J/PMbyet/6bS/Y3l+xVl2yo+vaMTtk7eUmvOml7HaV7JdI3j+g/t0e0MRj06wZd9nz26s3f", + "fI6/+Rx/K8TwzZ/2mz/tN3/aP4c/7Z/Xt/Uv6H22o1PVN2+03b3RvvmE9e0T9pyuYN88wL55gH3z", + "APvmAfZHeYD9MQ5af5gH1rdyVd98xb75in3zFfvz+YqVHyG2cRMznl9eT68N1tHn9tnq1f+q5HJV", + "KS/X5BjV2R3K7wVV93vyuzh9q1r3Lb/+Nw+gfXsAbVXHb/8l/DoV72tftm/ngn3rS/XtVKRv//X5", + "ovld6ami6vAy574H4mcsXlXUcalwE/Tlf3oyoK6pqbGaab4xeb2rEgFvUytb7GfCiMAJOru6GKBP", + "Y4RZjOZYxA9YEKS7iIUzr5YcmnAKc5hkNInDGCs92tHo8PVw9OPw6PDm8NWb48M3py8PRqPRfwWl", + "aQT3hwdHB4fo5BQfH/3440FM7kHFXEpF4C09SrPQIQrrGrwJtEaafH/9Azrngnx/8+EHRF8NX52O", + "Rp/R+dVn9L/Q0cGr0c+//BZovrQIoxSSw+vdwKVyspd5vF+QRQ4+xgqnCWYEpzRckAUXy+DNycmr", + "09PT45cDeNXPvz599Xr08uTo8NVLLf8rnOS/HL58+ePh6eGr0enLp0HAZV5KKrikLHtEJweHpwej", + "4emPw5mmNI3Q/3h5Mvw8yZjK0PjDFbrJCDrLZuglOjx8c3j05uQQfb45R5qagdF4gjeHpy9fnowO", + "T49OB0GWmu9+fHV8MnpadekyK1P9srxOTTzmrSOH3goIeqDY+JTlXmj6bxCbNuzVNiPY5ii/ODdt", + "8Mo+qc6vvGtq+f/NHvKc+GKr1PH9mC0mRCA+RQmf0QgnepuV0uO6W85f7SHfcytksL+ghzkRBKk5", + "yV0fqEQiY8xLh+qmrc7Ou4VXDFhPtc3sa1Dd1L+3mmpps9fn+mncuK5uT9e7WD9GpH9FlKEFTRIq", + "SQQ3m6QsIuhdyqP5gWchilNRhzqGHYPszxsFF888S7ffRYUdtpAiLow7QL93nC3h9YAF3Fc4ST5N", + "IUH5umu91CmcYEkgKXmNSVAWy3XvqOvg687GmWkm8CLcCVYBIp+vwmJGVJhQc31vmqlpLn3L+aXu", + "+3vJZ+8NYdADVXOEkwRRJVE0p0ksCNNyF89ERGSwvopKAci/Gfy/970lzOpu5/6c8BmyYKp+z8HK", + "LSNltiBDMY1env74asjUtCnlT83RFvqh6/fnQ90RfeRseCMwkymGw/9e4IXlEhMc3WnNeLOio3cd", + "Z2qYYiHJ0PbZjMtbzr5T6Ep3QpfccFr8GHHG2o25l0z4B2+8ufBL9Y6MYbNsmj46PHl18uPxy5NX", + "g56UtLUqVp7KynLFSz5DxcZeuSVKe3ONhlPaela1aauwlNnhkxerdpnti+Mp93I+U/tAvkKCt2RK", + "mVboNBFmlM2QbaoJgjgjiAu04IIgqUgqD1YOo+F4vlv4nghBY4LkUmoC6/8pPEOSKDRZIq7mRKBb", + "3X+o8Ow2KOmLB35BZJcdXxOytCTEpyAG1eatx15QdknYTBP80IMJUKLNzrAgQ9OhzVa+yh0ZWlzw", + "l3xWtN/bngHsmzfOwxwrrfvbM4QwmtF7wmC7rO4WMGGuwLqYIltpb4CYASXn+iqcEEQWVCkSA2y9", + "XFXoXQr1PRW6RONeNfvRNLsN9N6/NZ4dw8r3BqJExqCkdw9ngJ3Dq6fdK+M1uOrxyvgOZZyj5sXB", + "v5CXdv/rXyHOokxXHEUE7OYYbPhRwk2QeFG6HgpDm41ttFxnvgmMQWQoyNfio3Qf8VQRYb/4mtFo", + "SJkJ6o2gxxBuwsqf5V+l10u/fsBgvv4Dhsb6t4YLo3psVwlGpdLMA352+hRHvLwulqkcdLlHKufN", + "5wDjKR1fdFuDqFvhK9eyO1JNVXqaGNJ+bjEjWXeUL6+IGFImFdZKnGP2fIrIvZ4smJyUwNMpjVbZ", + "FY5jYcuVb2d/N6Wf1liZAWXIYmlFx7XtNCGmOKIJVZWCl3cE3scyCZLVAlN4jsNkAdKzzfJg7uFg", + "ECSpbsXIg16lLItS8C3Pmx4Fg2Cq9JcM/ouzGI5m4YbOmW6T8AgnI/fh0H3Ifzp2H07ch1P34aX7", + "8KrNI/k+iLji4AfoaPY1jY4PX56YT6cnRyewKUz+A03EucltoCVifd1QqXVsgR+6TaQJ8RVEiy41", + "nUIfCSujtHAa2mLkfsMR9kOdLRMaU/bnmVyOSS036dp557+sboqSpL8qAIAJPRSYzVpFyGyxInYI", + "85DX/8ZcnUM9iu6ppobdmDujrUCdN9/X7bVBDTWNGt7XdIMtXtVKV6eXOB0e0XIK7eGCz3Bzme6E", + "4zhMiQjVXBAce3e3blP1N67C6BL6Uxcloe+GQsaXGb7kOG4puqUCzkFoCNaItPu5FdKrPj02y08E", + "/24UmGutmmZ5ZVC/0q3bTNZnvtcyChEhYXk5cf+ZMO2Qa9dyx5egL8t7/oOB9i6HtnnHmy5Fj343", + "fQXRFSJ8KCYPpRkxMt+Uq0y2EVhvb8f+7bIXK+J//P50GzTsT0ex3Hz48vT0+LTs2+p9FfGU4nQz", + "tTC/eBd52Y7vF2u83NMKV4vHtno0qXVsejhZPUjbvHpUD0yblwu7E20hzh1fL6rA1i3S3gqlesnd", + "tdJvYjXu8YebK2T8giXKJInRZJm/tyqOJGExInpIj0X1+YrcVvylq3O5MT/kyGJm8K0/jgZ/iNXf", + "sUG3+34yVS8abpl1lW+r90zestsrQP2MPzVi2uXO2V+R2wVOfZdNagqnrthsy808clejukH9cprT", + "DarD66GR/knvsMlSmVeAzQ9hUnGBZ00pgp8qS5FPsNWdkO6D7s0SjxUxNPvgjCCRMXBGME7FLbdh", + "6hN5UtlR4En3J+2kTaLOJ0aQXiB3CVe3ILUJU3D8iSVLf0jj0yCwYQceX2YbMNG8Oerjt9sh+xIZ", + "fGbnM1egu7QzUCd7LsTer56HLk6Uejf1P1/OqOIinGKaeNyr/g0T9dTvL4BUHv2L77KyZLAumqvC", + "+lJ+TcJoTqJmF1ND5rDkDZdrgoIMTw5BXJZKf/J6h0oi1jDSOsa6qY1+8j6xmt+MAEQZurYb9+3H", + "8YqHR9m90+kwweHoQP+/xtrSmclDJ/G/OT1+2tFevz8/il11oBaeYmt0opKkVCxDO6ZWad/vMS92", + "i1y3XTp6YJT24JNv2u0uvWr7vuetv4Rw8WbHQ/2rLHwuYIVWVYMJju4IizumOHIRiuWd63kcxqoF", + "sfOphKaDx+ZkkQwGRWTkVECYfuw3QblFGwNEL5+pD6uHKzjGhLLgzcnx0cvTVz8OggkoND/++Pr1", + "6PDo9Uiz3UUaTpYpaCjwh27vPkNr94eQrhVjoQCX5cOj0p/hAj8Gb05OX9rvFFfw549HgyCOuAEb", + "C/I1eHMCHzS8w0EQS72Ao0FA4LfTk0EwFzINDx9Nukz440j/cfjy1P55DH8e2b9O9F+nrump/ssB", + "AVcaAEO1oKT/ZYqIiKRKs4fjk5eDIMFShdH8LngTXJ58+lWz4xGoXiY8Fx7l9XbTAI6PRieDwMz+", + "pf0UJtQkMxiN7BeGEuZv8tUS6+R18ZdpcfxaT0h/B16+ekanJ69+fDkIZJQJ/efrQSBz6INAQjf7", + "2YZCB5+vIPBNU1uv6ZEnmeguUUmlIF63eyFKXTPU7c4Znul72OWG2BKtVYCaeeyCUKFm94jUFJvC", + "j70BnBOcGLN3byAFlf2uRBGl7/je54+/BoPg4uNFMAjGn85/fXd9HQzgtME/N58gmOfy5PzTR/3v", + "K/P9q/HNuH2keAWPZMY77AW3sXXXSXS3h9MCbLiN8+rEmpw2tzTSbo/HyADc/hjZ/v0eIwO0x2Nk", + "APZ6jAzIHo+RAbjzMXppvn/pvn95Pb4qH69Pv57Dv+73V+73rc9dNL+L+QPbwwGK5ndOB+6DwAkN", + "8UTs414sJKodQOdCoQ84ZfuD3Y77bAkcJMi9AM8l0u13Rw68AtEIan1CBUGtN4D8jnbQdhr3rIvR", + "6vksGLG/p8lqxrIjnmUWYDSRPexGq9m0io6RRkLvhT5kN2I3rSHZjU41HFvSpiuSc8ywux6631qF", + "utlm0Qp9tHXr406tTzq1Pu3U2urDbdrTVjnyn2oa9R4OFOjneKa2T91YXuxC2+8LWjSf7WFLa8jS", + "Gmz7Bj3Z7RJqgltPZ6bAfdqaT6zEPQgydse0jOgzsqdt99xXMJD0PoOveTmRvgHvJkc0gt3Txd1S", + "mHoqG8B6uiI6SF1PZfNaX8NXLHQ9At31yDVxR7GnLSDbnTBwWoh7kslku4305CyhrVqK+32peh4F", + "XevPbz/9XavfHz9d/hQMgg9nFx9vwD0egVrv5Xuy3e54GgRqLrhSSV9SMKRII/F2cpPa09Z7IHQ2", + "38eCPQgSU7kfwKr/++hp/XvPGpct82TmHvWqzwEmLNH3zmW9J86uLtY/g7V8fCye9tp6Qpcfu+qe", + "F+tfZvVY7o2sxydKv386j2QaZmmsr4lGt3wbbGvWCNz6ctfIhk2yLiWCAYY+nY+v0GcYObBZtWAW", + "q8OXnvvz18Dg8OhV7jXQ0gnAETAH8uNosOvz/Mb8WKVpmhRrsKsbogUW+DEmCfY4To2JkhByavFF", + "oKnc4wRNiHoghCH1wBHOFF9gRSNkllS66HeJF5biLm734GZOpU2EI11dJOPAUfh8dvfzlJto8MHi", + "/xbmWfUJdcE/C8o2ksEs0+5kQH8UHewE1tKhpoS0CX/fNKzJoezLtCTojDKcKE8OKDewBxefCEAe", + "IZy8vXuOzbe6ZdTOKiprjqOd5Q0HjkDaBKfoVi40pZvXSg6/4qt5RSqhLpvdVnSHfTlrllBcIQAg", + "Cs6PaCr4Agghkcln/N/WJ2sQyLlNi7VrCEtB33aygdsHy/3sgs6xK+Ve+834tUt+rtVjvg0q5aP8", + "5HyetoZW1jz0ZtsakDmMrUJ5YLf1E8ijQa2N4mlo0Pte3SUTWRnOhlRk9nI3+eI2ZZYrt4XKm+bv", + "woO2Te/C1zG/6r1x4KWbefXH580eBmzRc41eMCT5olblWg7AA/KBZ0mMEnoHuVViqqFNMkVslh0a", + "3Q1hh7vaQ/KWKW7AmcuIMgRZ5CFTi03So7d1U389DMHRHLrfsphECRZG3DOJdgDsbeBCLw+QRj+L", + "5ijCksgBurXz1E1SEtGpFgrUnNwylqf0BIGBsnue3DvQVPrRyaesxwraeQDXb5BN4VHljb5BzNku", + "MKpye9QEnbBgA+0Enb2FQ6VEQD4QFq1RdSeZXIYpTxKbcnT1UE3jUG+AsK153ah1oUwFwbHx65f9", + "pTqvxtPZ7IKLNEqzTOJZY3KGerlDo5O5nXB+9RmZ7gVE4U3s63qmRAxTwSMi9ZFMM4Wgj63PJEyK", + "Xy9hXC7EVliic5ORCtau6N8et+KMRpxF1ik7KgFtwDKlaYVdtiCmf1gDyACVRMptUJeGrFL/bJXU", + "Jrx/S+hkYbIZ+0fAC54xCGa9PvsAUZ9khiEuD6C7wTNjs5ksgUtqqN4RGSf67HjSyFmjj+6dyTwp", + "320A7W8Dk6YJ2YOHTA5mxBmCBNfBwHMOGSf3minI1qO5MYSSjeONM/Zp7P6OiaCag4PyM+YJFlSi", + "wxEkk0qwKgdbVBCb6Xs3Fv5k6B7kSu0hNgAyOGtZLLmvpDeuDHL3NSMZ6UBq02ENrX8av20aSyXN", + "ZJbloXTLA3ShwJjyNaP3OIGEyxwaRXyxAOJRRhAWs2yhf7wNhvHNbdAwdscNtWY/NQwgSCaJu17a", + "2y9LI48/hdfvPo/fXX26vjEwZZrQqN3i3BHBSIJUlCLopfF1xizJozui5PqDYFIBUTYrpdaux5zC", + "oFyg2C2Z5izTjJnL3vRDOaDuGRcLHBSWd7I1Cro1XDe+sXGmeDBoi4KRmMFIT3K1oHU6t1qVOhPR", + "NtawjFhVH6Bzgek1A7y3mfdWRIRaZGgcG8lXYBbzBTN3rTlXuktuCw0aHts08G6iy5NXmhSSSmXK", + "dqzITyJOQ+PK11N5nbw0ZpwOrY+gvzRlnKJz+D2vtl6PWCqB2JgjJ6/xsjL92ebwzI7xlfaSDdcX", + "z8jF9FzMKieKb/su5sZYK86X8Am1ArDxQa1cvcWi2TmP/ZUZtf909k2JmeqTXH13ggRcIWiELSMe", + "atpDix5a1Ap5psL2fipOtA4nqQzbBmNUOrUPzCj36uAf09GTueKm3EGxspI7ibssUpQtQt2xQ/N2", + "fqO2sZRJN/hCdG7fcYxY8DQlcZjwWcseU0wTEocghGa5rtzCM1PfL1rfbZ/jnsYJCdOo5ZL/i09a", + "opJQqTTvlO2V9A6J+W3rDjtcd8n1yJZGA330uo2gRcYOrbvtI9elG0paXdSyaZibJNoUPljANlpM", + "2rVnkyJlYFOlHdOi7XtuVbwooNxYKCDnx/4oa+v7WbO/u4s7dtqKIGmy1PL+Axd3hba9FYJXF2/N", + "yCmR4VSQlnQ27TNJWjqrppwnIU4SHrVeGuhi+EmHDhql9kPYyxwEvSa6GwPKdsS1IMwuKI1I1pZ2", + "kil+YCRGRePdtl4BB6TVhGBJNlTcchWwbGtvtS2fMV9kLMwNDC2eRLsxqrx5l8teMx6XGeGOLLsM", + "V+qpmUr33lAVN0w4v8tS2bXbgkpJOvRy7rFb4Jl33W6aeXdrYgzBNtK+f7fROm8AxdO0tWSdGyJa", + "NIXCZLko3q5TBpiHLeWFjAH2zo2uRYeGYmPuYJvfwU2pVQK1jZXzNtXKGwTd7/EGbXcm8GLNO5Rp", + "sC53kLUjauxSjocLqvVdNBy6nFkjNLRfDjORQMHSNy9eKCLVgUsAb0v+B4slfLK+Gpblmr6QiwIL", + "NeRsKEjCtXRRskZBGn4NIFf3V9JV5Hiu5F0sGUMVRxNIBDcwr/LTBM9MwQL7SuWt8mHx9wGGnzRY", + "kbGK2RXLAaJTFNPplJg6eHPMKkUCoevBM3rrNL0l1+ne7B3MU0MsQSJBwNkP3BncNpIIK2SgbFFJ", + "xqyxj8j6l+1orHsebHRqsxvS7aDym689QG2tKrZxz4+plrqtfajdsW9VYeTKQe8b7a8ZjULKqKI4", + "yS2YHXxH/vfni3N0YfqvY1B2OoKUuN6/ebI7aLFkeEGjIbGCttYzbE11ewPoWdoX6WBG1Nn5pSys", + "k0u96lFiLMPbF3ZYsesSu//zMkZQ8F8Q4ykHpR5NVf32Zl971srrvcEnSje1LevFvIuNvabRfvZ3", + "+wO6ejSe/HRYn0jSTw3Zihz9n3cIkkmxiuadnJo33Ar5Q0s7EaiVr7LR6Nbedfb3CqOhcV4V+3A4", + "Oh6enASlfFqUhcB3NV958mdbreSPj38/eRrqf47K//ivaIMNVO6XCi9Sf83fvExYUxRONejMmgkG", + "FcwHgcyiiJCYbMgst0KoFhfktWvb98bL61SsW8yO/uR2Yp4pX1tw7XO82h57mLnkifV0bOdG7Ho0", + "uRDXMkpu4yZbTh/Zxlf22qK0o5+sA9O0Aqu/9roE+TN4bXJrErTWX8BMLoQwxUs47S6pd+5A/+Ph", + "66OS//zp4ZH3VYAnccge9+f2BgPwieQJMRaIfQ7j8k7scQxBps4mu8dRSmUB9jjKPU7oHmfyvIqp", + "qf9sDthQHx6/k6g9gaGWQV29hzW1T4rSy7ZjnVzbk6cAbEN8+gC7wSs5555NHsmOQa29H22Trjek", + "5alPq+jIlvdi0bpvtqwywcJSsFu1cNVCeaWkZk8Sj71AA/my6VLSaPxisNBQrEm15WVN2azpou4r", + "KKbNBQ3PZrtdzk5DXt0CtV/6Wf2ccNuFq+j+G8NUKiU8Vo1WpW8QlQgza2LESeUns8XyV8oGc3BT", + "lWVjEDDp4BVHUnFBXBlWyqwnKAwwyaZTYDu5HQTKbOY1OvFDQ6VOV56zVLHTVOr0aWsL/JiQBoK4", + "aGpTYxOKbzHrO7ogUuIZMfjHVcxbWdyf2WLqLbfyyS1vpeRKXmVbdx7mq9DxfjYj1q4ZVzJ6b9e9", + "G6gIp/oDChMB92m83CibrbvYoKR4t0stL+NUDN/yMrMte2ZlRoEIcRyHTYUhxkSZUKeCRaGHOWFI", + "HwU2Qxgx8oDy0hH6K0uh76SrfbJFpeaNxWMgrfPQZfxuGapsOpmcN9vE41dMsAaYW4WVwqZuNDAy", + "7e8cVbHYLSDawJKE+StB4SThD+FIKOUXlnGSsh18qc8urz6iK8EVj7jx95zg6M48jnU07G21wq4f", + "EGCY5zDZDgSjHbal7SOTbccLdyR9herWJ1p/tQNI57xtoN1TDB5t8mSbKdJ0bsXRTWfS0tA5m7sB", + "4DhaMBlVZHdYIgn9hdS6wYn5A9szgwAf8rBTEsHqSv4CWRJNaAIAQwYYeJe2z4Fe2x7iwEbvSRJl", + "+m5CxmaMbNgEQJdqz8SZchGRUMrk/niLjWl6q0TeH4526364W/ej3bpvM3eTO9MGUHRPGlLp3s/t", + "1bLq3J531ALrTgyziGxB1VIgbfczZQNrXTjsaoxtW0fABtiFA2MdNGXtPa6dYrRxoRjf+mAyvv2p", + "dH0Pd+h7tEPfreabsl1vIj4BGb48eIKXRGg1HT68aiMTrx2BDfN4puKd0LF4E6pgZfNBILM4JmwY", + "E1MRfYHF3TBuStHL2VA3IPHQVXpw8OU8U/q7oYu13tC/Km3mvY0guh4IeDtrAbn9UYAu3eIVoEua", + "iRkJ89Rq+2Fk2zDlhjNd9fBuL1aa9o/L4f3RsJTpIde1SwGmc2c/iohQw4i5T3ck/1JSvWMjER0f", + "RQF4rpr/Do1gCJ479GtGhtR/yDamixwELeutPFnPlm11jKLz8P5oy/4h9A/vj8Lt9I4VGGHEtgGT", + "8AdwEtzfRu6mixmbs9/NYTtCgf945zjjdmzVF5I8vkTnZ0Uwsh6eCEWnNLJe3T3jYAfRfMxakByF", + "xuPL++NgENxcju8PD0b5p8P801H+6biReAvK9gM4d4rvuKLKhN527ZXIUFHIA7C77WndYkD+ZH9h", + "ZSLotMJwGGckKNlIdxzaDDDn7XwYmyCVEc3Dxh2GT52yMeu29auCB4NgrnfK/KiVk+a1vmfhmYpM", + "TCIHJJUgeIFSazapOC85r4yzOEbjDqVcbb+zOB7vp6Crs/Y2WXod4kpgJilUOTVW3ZLptqnyr03i", + "ewppEvWBhewKsG441rdl7k+Kk/y3LM2LA/84yvMyaDXuMP/LrsEDmZRSqe2asbKCYtn/1OAKKpw+", + "kAJTv8Bpago643M7W/VmLXe0jUBVlDf0Sh6bAbiAKrAHxKE/cX57MLv2b60eFpaHDs2ba+xtxrCl", + "rWKrVbTl+oiEnNzbY7fDPqgX+OsOYccdNP0as3YWnJaGnuZbYjMyUJIH2GU0x2y2JU1bb2YPeyz4", + "EvBJ0GxLsXNf9pcWV9wLEnHRjsqZJE6DaGhbeiHKdlmS9pe+5zbe4iZ+lmt43QOzRX2rOuu1y97n", + "aVyhTCeP4zJ9+n+VLuSTtd417dycrBhhM/ysujp1Fx7aloPqz22kRSmEHasfrMl2/WWzD5fbUfYK", + "d2LjmrCqkuQ4Ojg8MIqbE/UeHkpi4Y+jchGOlRNZbMo9ndbq/llNLfTNC+GbF0Lju3VT0erqiDfn", + "V+icsxmR4LR3zpkSPEFnyYwLquaL3R0aUs6TYcQZG3ZkL6Y72EkAyDeXij+PS4VkNARrxrYT/Mv5", + "ZAAbD+X/x97fNsdtY+nj8FdhabdqJzuS3XYyMzvZF79SZGeiGjnRWsrM3vfY20WR6G6u2WQPyZas", + "dfzd/4UnEiQBEiAB9tN5k1gSCYDkOee6cM4FIFr68XJAa2XErI4w1jU2S2qQYJs9ojEjn15O0l85", + "fkskI0G6TY5SMtLUIke5t4hQHHpR7oVok6HAL+jm8Qv/MaXbCeF7z8lmB09RHJNdI9A6ZXvM+95i", + "W2wzxLf6MdzsgNkK67cx6qooPmDY9ObdjfvVmHG/2t24X48Z9+vdjfvbMeOe2r6X29YyaC25/crP", + "V/NP6HmodGlPlE8xmvMdldxEvSiJqnlOs1ndmTNuo5XdWmzj+PmC5LjERBf9tVLy4TjI843S+SDJ", + "BDZdLLQKRnSP7Ly2STZukC3XSHPENwR/4V0vPGb1596n+5u70mPIspuIrtxhW4vn2w3d9D4qiHOR", + "7WoIgcLeGKTrjV9EDzF68SEhjhrlXprEz57/6Ecx3bab7T/OW/zuxas/kab8h/QR3/f2v2/fvr9+", + "9/bn+8sb75fb++tffn5xRs9tunjYLvjiFI1NO9NlxXdLQRFa+gGpBgUFKi4oJ5DL4EaK6Ew2PDsR", + "zV2+8RW6BlFodyB0pibwOxQuU1MWHgqRqUkaD4XF1LSUAwYtsqDph15XUYAU9DCloGRXaeN0/pFp", + "SI9b7YnCKNNK8d5maBF9pjsmJGiZFpF0s9/7dLnk5/DkKKCxhV9PD3gJVn4S5WtCJf3Eu7u74WWX", + "Absisk0WLhLUPOT3d9Xk6cX3Lz/+/pvfnTd/8++K3aRok5sMLeqavWjziANItHn8Y9dg5ummaE6n", + "fkdy/hfhdnMRbX6LlkmaoQtaDv5tk5Fl3uyP3/zu3ODi7mfIcqNcbWNLvcYGeuJuFMIueuUOeqAc", + "Nm+mKJ/koogfL9i+G7LN0dpKSIpKfZtxRHgU9FrZRm/KA4TPz8ZnofdPGT284FCVGYZpj2k15zHy", + "L6qWJKVO0G6Ddrv/iw5aUUYOfR10XxYFxUX7gEyhYl0Em/k6/ANmLPreiG9yueXXvovchy7vG7y2", + "b/DCvsGr+kDIvxshfwvm2YGBT1ERrKJkOWTD6XKfc6qNKtvycFt1qZT3uyDN6H6rITnnepujC3Zf", + "GGWInGb2TXMjfbKLPtl/WthH+uyLl6F/vsABM08i7yLynp6eXrD7XgTp2vuKYws9kJ/r7ogCC7a6", + "trvVdf0VW5tWVBrM9qSiuSV2bQgfm6o67640SbajtYZSlt5a3ulkK2yp93XIZhsqxLqnMRWtlovl", + "3+iKbeUB4mvPKzaR3EpetCvh7bxA603M6OYEClwu+59aaLtdz9NsnnFxvyMx/YZmfnR5XcNn2d2N", + "0bKlEhrK3DtUeL7HPyg2dLYxfPR/la6c7L6Ip7Io9MhXQgXKyGElAsDQr3S2TNMlRY7moL4/e3Xx", + "bW09F3/0szx7lDhDaWYdBn8vucaFqeuHk/IOMzl+07XUryM3iAf3wj0u3o/2axn0NtovweTZHTxz", + "VJiyuruoaJC3Fx7+HX4f5A95FCLsV37upQl1uShAtOQex97Cz9a5V55+So9X9wt+3YsPyY/kCtZa", + "dRVviG64h9GLfxDcNJvi8bPSBEjjw4tR4T2n2w8JHzzy8gj7enm6Te2p8nOScF6nGfL88NFPAlSe", + "akTOP+cv+WXttg8JSsJNGiVF/uJDYwkAeXQCHg9+zAv9fql5/v4sS7dJmKUPEWGMa3JE49mqKDa1", + "pQL8Gc8Em/1He2lqc4UBp0E8Xn33hz/+CUNT+77XsvvmCXqq3/uRroTy8a3s9ZN4zG7FXHdODIyO", + "kx0qjx+Hb7UZpclceMogTklJscwcvJ7NZvX38LVF0tlLFYom9b8Lr7rLP/lljKmb0f4ad+fvpMne", + "ywws6YC521k3pzeeONjsnE4oqEDuyc/CBS1edr1F4crSgKsXySy5CDbyMu7Q7WOrwG0aivsLXtUL", + "5U/BTf289io/ah6Kxdrr2ecaRywcBjUHOebNMbesO43cSetf8qLYJgmKz85rvksXxF7wH8mF9IXX", + "f/cJoc2FH0ePSMeneP/ciMtY0N657/7+VtANee/wnc0TlbXM5CFKQs33b0NOVRM6mThOO33TswPw", + "XVToznUjFzw0kpJPziEy/xkIRReh0ItxUYNxR9o0O3JCrtfFJlh9Ui4qDNO1H8nnxCsUx6m8btlO", + "W5bVMOWSV8nOGORv8xxx4G8PIcw0wTfPglqcCrN5tKGJKSL0WagEialy5ZxBFzrzd5k2JiuEpze7", + "uRpQmaVm75qvTir/EeEYxobbC5fqtbjnZ/kmRXOyZFISRm5/eeuRv/WdD5Q/J8GQVWBpUkTJFl3I", + "BF3tI9KqG8M0KeJ0eZGk2dofUplFyTJK0IXiTA0GvRc5Ki4efe1RkVNTc7XjiQftjJDShzGy01Kc", + "LvtiX5wu5zTzywXJF4vMX6MLLuWW6qEvnvyoiJIlvTZXXochhJ8VLb0AZVnH3+nJDLnJaSnnZxQl", + "5vjTilanonsKtie0wk5jv+DnNA9viZw/PbKdRz+7kCcNNdrYRBsURwlbCWLoUuw9RMnSjnVmaIl5", + "ZoY9kDiq/EMTSdIi85cX7HCyAUMX+IrmCTsiBSyjpCYR3KTokl1umRiUsTxXBHPSb+6lC8r+gnRD", + "TgMhfyMyFV1KVKHG18aboF3o0SP+JnI3rwI/kepN0L8Jj9sun4tPxS/Xe6gfI+v1FflkiTym4ghw", + "Mm56BnjOJnDdKD4knur4Bh2ftm/8hV3uwCAqgJa8KtKvLd+gz9y0ItqFthmVlzt4FexjK95FeeiR", + "luH4Qdz3UvyAGrGfLeX2RYS17cnGIcoGBG+p1v9xfLkgGRvcKFUYCH8pgsYf2EdkawXo7xZZmhTy", + "dso/tRpi17IjeMmvWB6p1ja9j12ll4STTSlGhApuldrB4l15gzsfUQUM1retkMGfvRk0eDfaYUO4", + "wcFLIU+peCP0DbDsbO0h6F0yh5U+wh273NX4JZ/0Mo7ph7ujF5h8Ovp0zQ9XNqT32crLHTw02ZPV", + "D+QnApLB1iVk4vW1stv8EWUkYHz/+pwdOv6nb9G33/7HHy5eh7Pg4rvFw6sL33/9p4s/fxs8PHz7", + "arF4PftW+yzyqvkvyhM6dOXmRoeKy+Dka/ODdr0jzXh1X7vJ7ZdWxa0r1WOYluGbltV8X/eypvWc", + "QbzV/osisvxyy51GHCCRG3/rwidTYRLbebL57u7m5f3NnSfI6nOS4v6EnvOztuhxm8gPc5Vv90PM", + "Ns38JZqrQbR8xXc3VOmvZ3x5fOWzy529TVlYJXq5dOGxtQmteVenhQkfqvHkbJmDkQiOvwJHFlVf", + "aeHOqgSVg87m0Xy54/wTep5r7n0brPwomUd5vkUa2yPL56a0jXxLjXJgI42jbHsHTmsf+dDuuFv2", + "bw684Vu3oMGd0dc7+PYkLeb+gm1jwg/hPQv9AtEUovY+0nUyFmzzIl1fFP6S6PWy9fcfyIXf40bz", + "wl9vqOKPbP76f2mCPpydsdE8oEWaob0YTo6yiBYG2hF25b+aL6JkibL5JouSQuuD5yv/9R/+OOA+", + "6Xm8OArVz+J9cTZk3++K5DTO+03iZy9HBT1qlRZlyUG//HCB2+sXZ+eDzK4JUP1vQDcCVNfO/RhT", + "PBJp52XqV/tu7UA3Ck2FcO8YTtjDNKgcBsHqGu/6TZt+tJpoKFP8fDWvoUk7zpEYRd4ovrrrGvyd", + "1BdRh5wnZD8anQp0XcQjPOk1UZLUn41vwdUGMuEy+j36KFXrnbZLpvWv00V68jwWQX0A+xGsrGOg", + "Q6iQ+ARODDiLh/Kgq/c3ed+p9q4o9dV7RSCoHmuOkiLjC8S1vyS771mqg5J+oSx+yzpy9H3YgCRf", + "STTaDD2mAZ0sxlFeeOSm9pncFVtsfQFyGsJ2EzJqXGMHsrl7gj4bXY9H+AmFLa9UyFirB5prdzEy", + "fr2nI6w5nZ4eLo+WiV9sM9QTqSsqYOoAZJllLncrwTl+SRBxjrfEZtTe0RsPs3hAHMziM4WjmsY9", + "PEI3/lTMsX8ooDorvBvsPSwv3BBey2NX84lZG/ocJSvY9e4eVwyGXVN//vzcfAw+vdDR85nindB2", + "TU2BvB63QbY2+G7T4K9GyzbOz+IoQUJAEtfxS2YKSTRfRDGbLnZUvSUvjgupf77+kbagiFR5PH+I", + "knBO86TyIpvQ3N3ND1ES0myk0tYV4Ubjkz67/aCd2UOyexFKgibBqSV46Lx1haLGWRcvLFKfEbNP", + "2WzTjEjd0y9oNq2iH9BdplL8fpKgRUbMYpZIgmIeu3Pvd0FWXOCfvxkUxprZzP4eDeOZwxQnewbd", + "YD/k/SgD/JDQ7uY1kEL7nG0g03gNOeZrnl/7kkRFjzy+ySuv00sSu3pHkww4hEQod3TNkdsPdNWY", + "vbLiru7JBqpjHnrPbtA4kKHz5ISO4xC+np+hIFyhjmSGJKN2dXfr0T+K76F1P0tE1G++zaJH/AI/", + "oefOmwcuRU/nDcsQbCZJ54E/b8onxQs2iUJEn28Ur4FrRDqfBd8vzOEabrIt0rVfRIFXb5Bdb7wT", + "YR4UsWwZzDJBYS1Rcl9mjUsyrnqALrs7vE2vlFv+UN2wH3fu/tMU74gh42Mjicqim/drXuM7Zz2r", + "9O5uyJ2/5qoV/fIL7Ad1s7ROhQU95Lkaft77gNNoR/N4Tpy0lHxJZyfEQd9X2rHmiuAc/fG7WhPy", + "SMCvmHfkKTZZGm4DFM79QjPtQ3ZgYYf+Gs1qZLuxsgHSa7+oumMG0s60dz1ZOxNvkPidR+HLqruX", + "jbYGpstY/itDfp4qSEX7HRWrKNfvqCclhg3rfflKdbNQMpOUZqI68ads5VcOOJLvqdj7c+FH8TZT", + "rWpppDq7UqFtg5G3w66b54U8u9r4/G23ktc9SuWT/FFk77x8W/I3Xm263NQHr9EcG3e4jeu4xnZh", + "0z0Z4/Lq3VvvrmyI8locgrRYMZONiDlY7wc/R94bshw1pcklPA8xa7K7vXLtK8mMdB571m77Db3Z", + "+yFKQu+K3axotOsQNL2WaQut5nXORevrgLTh3bE2Wl10HVzW1zS9t9mkYIzmbf6yKZeP1xod9Q4k", + "D892AxlqFWzrH4ld1BseZhn11lu2wbsYZx28E6V98G6GWQhvvmUjrNmhVsLaldgJ38tt3PsQX8SK", + "LvRWz3PpWtaugldZOco7tlXoCLvV7Up5v/K8Sa1VAw2unMdvyTNJqZvk7b1lb0DRTN4twJpTpZoS", + "JuPUD+foc5EJIketj3qT+qH3Ft9IC1VsUWuex3yHizoreUdXi3sblPFVpV5SHuATVMcEkVShsM2F", + "4liiPI8zKf3p7gi3zs+nwJd4bD27tJc0RPNBy79ldobbWWVpkm5z7/7mzrt++YtX7lhJ5eJ+nm9W", + "mZ+jebAOVbOIzT+3KHvW/k7/ha/27sg13i3fCJM29RiFKNNu6ZbfINysMKyeFrxbfBcpPAdbIt+M", + "0SOKa5sKiBsKzLQS+DQ4Dd3+tz7av5FWytO6G5Xt/FO0mecoXlAVaTgPfEn+SfYSULygibbQu7o8", + "9/xPvvf5D7M/e1maFt7VpWKzijye8xeey/n+bfnnJtuv3ag5iWzyY7H19ugKv8jn/pbaQaNzP8+f", + "5Ja8zVVSAzGikqvOeTsfld2TfYj4sjDlQjvZHg3jF82RIfvxWqcNPv/mm3KQ1/a1+urC7CGO0ycc", + "ZFCCoYFc2Ju6In9VvyXlJIZ9w3AdJZqGjG/wLskNlQ3gH+cjd0VrDEWxO5lyuaIwMK+2PrI5RO3P", + "Lns2jXWT0oG423q58kKDFF/luTpchD4Q6UGlnsXtUXw0MSN6JqTgzFGIJIuletv5KQqR9zd2nzQ0", + "mL6bWljRfkdka7H3vMeudyXsB9a9ew69vBlmet/Ie3JD/f6qFQ2uLPGE8vZO1xT6XGQoX9k6TUt1", + "WgvpK1+lT3MMjv1PV78nRkuUhLnJq71bpU/eDbuv3to6DbcxMm/tHbuv3lqCWSiflww5XbZhgGSz", + "1rKLbRbNzfdhluBLFHwasvf/G7SIEuT5Huuanu1apF6QIb9Anp9QSSY9VJB0gyc9uVfQQ1szb+2z", + "fcPLXRbxb/08T4OItICbzHCTPuNzje2bq4fOs6B6XNIu7PVvd6//8l3rn+XC0UT3+gaPop/xnJ5S", + "nBdphoTtA/jPutsCkL9WTyFWB7FlmpwOgK93cyZA6Yo6W1STYXft/k+vqL24c/ZL8mr5D2ly3riW", + "vlR9HVEVQr7K3quRFJa/3dzR6y2tsjEVI6O9J6HpOqElJNmmIuSM1a6kFrlANGOiZJtjCkr2Vip/", + "zGjNgv6cbova3/HP7AJy4ib9G/3nNuP/ZFcs46gIVuwa9gP/0yag/xV+MWP/E371iv2v+lVBryrY", + "Zq6YSrEOyh/ZteRnlGXin/GP4p8XfhSLfyc/swvY7D+im13nObuO/DPjlfz2KQqfldt4iZG3/BqM", + "4vxD9kaKs490b0WURWmo1W5zNkjaks4Gy6+4JafAfjStRxLDJHb5I3kWs+2CldLL/qxM80HI3o7k", + "nMtz4cWUmPcQJX72rNrHTOvQi1bwII9tEJX59c7ihlpVztTafNMVvqKRxtWCjcsgmlbdPZ/J30vu", + "VQpxzbhK7nOmK2+NW7L+E1WcsP5qGvoNMWZqWWs9rBrcwiOv4S363ZTx2+DqbWZwtf5Q0OeN3oUC", + "ophcrz8SHIUlp5p+lqsOynNNdSJIc4JDEE93UDOzZ3ilf6VZw+XV07yhYsKuND9GjVaY3aH/puvk", + "xPAWw244gzK7Q78ThS5ItQS5ol2a5zMzZqZ/tf7Qt7ks66jgA0ZLb2qo9+wS87oWH0jYQD6ADiiJ", + "gOH06p4PwO7LqOb7tUCCPm+irC8F9uFD+PvfrfPf8t/Wv61+C7/5f6rzf7X26B0oWFdx5iSdb7bZ", + "UjMz/nPq3ZKrSQYieJynZKcHnVvfowBFj8gje0MIZL35oj799tff1r+9+235219Ub4reKmyOgTqK", + "h02Sb8Tu8S/mMRp4NMb9M92i7imLCjSnx3D35H9NpBuTTRJUMYCnbWjS02gjs5bPl367Yz8PNnNy", + "dLlMUskXA3KDCtL1GpXJC/pl0OcN/UfOj7hKwot4wf/FbK32E/8z3fi+/Bc5Hf/8bJvwv8gM1A/D", + "bPgh49UjCccrJTRmCIuf7Deut4AKf4c5f8kaqehWj/8Y/2Fo9oQHXP0RqM6vIr3TNtlBTIroafKh", + "yJb68/b2izd/+uWvV2fnZzd/en93S/5/d3+H//9H9vN3V7/8rFP+bvfPXift/nMQ+zSnOF/72aeB", + "j1Q2KbGOt+Rv3tuqJ+8d7unr+Rl2E2ufBn9y8kwr9Hlut+XKpsoOWJO2+6AdxGTfLBvmRYsVgl2V", + "w8zKf9F/UIcqfSkr/yU41PnoeKJ6BRoG9I6Xz4bRqHWUzDHv0cqjdjtN+knhsMRPmd/+kf743S9/", + "He+laTIvj94Y3RLfwXV0W0LpzaIB2DkM2NhR6FFEA5xa3hoGQwvt4MgwJ/THRjDIk8jGmPLYymCI", + "B10E7MC5caZYpNtC6pP3v/x6T7yR/+M78o/RHvnoZ3P0eZNZMf5/lAzyozQA/s3PvLefNxnbfZ51", + "bwvi/lFjreoR3KRLj61hYyOQHf5oERT+oUOsy69R7rS++9FE/jxPg0/5d+P9pHk2Gb1WkAncX916", + "V2TWozXVvL+65Vc7mn3pK+KqCdtXyfOYpI/4U7mZVDKRwhAxEp9m46di+j0iPWhsjt6USAhHUnxT", + "lxZRyQ7VCAlan7MvXp4F3qs/v37x6o//8WL2Yvby1R+9ryRpEqLP4i5H1UqIthSpPU/2gwCRartf", + "FH6wusizR9yzvym2GTo7PwvTiwzlafyIynnaRYKKPPBjlF0EJG/Dfk1h7Pws3vpEPM+MNA8u/DC8", + "oPXvPLiIkqD1w6z20yv6E3Y6qgSofpjxWWC+SdEFP0oH//HBT8KnKCxWF3G0jgr+2+CCzHrKn4o0", + "Zz+EeXFB7Kf8kf1rUbtnId4Tp8sLuvCA/ixcl0QBYv/cZBHZYvoiiP08b/4yXSxyxPui+jH2L3E4", + "VZ+yiJRHMbboMEvJ4z9FRbC6IEe7np8VmR98usiDWuCih3rxQ3lpcxniBdkwxU+mA5o8b6eMoYL1", + "0QMNUamqIIGNRLzyW83Jt6L/HUYSZJ9eyC8KEZeMRCW8TkI/C8vDVVENi5uj7VjxNcFgf+D3e+R+", + "eryIZJQtUcl+vVQWYXgC14DdK08fZzFLGKiZlcqZ0RVt1rtByZLK3vnQc4ke9H9+9/++Z0cLfvz9", + "hw+/+3D2O/YjISrffDj78OGb38orvrEyt3b85Hf0OccfX9+wH51gMYUc9txGVNuNpNbiDKUG9P3Q", + "KQfRDui0AYoVFHLs+tgOS/84q07xMrD2nni13BTzUoFgISMoMBpnBkiKMc8ekwB6tDF60G21fLJc", + "pLpGGX4WzOtI2SQjJApl+JU/+VlCHzVJC8ogomSRksVmD9tlyUjM5t3qdKnItDqB5yuhm/OqTVf5", + "S0xqZbZmYGE3W9+jHZWgjcdenVtuDtR2R8VGQrLK2afK3EV4m33+x+ziz5cXP/oXi4+//w3/8PH3", + "39h5xyWjHvlI7/zsk/c3bu0Di/JRgKo3UCYqX81efyfkKS/ozxbYSzmFMOVZP0cBqh6WhfD5hhXr", + "6jX2x++4lHagn7I5MB+YgBmaQazjq/H6ovgY7P9ZbifqWh3v+3JswoDZ8eh7NtS/+VlEdAA87mR5", + "MS+K2Ehyrk6bCZNRxau6u/fu72/o1oTzusJvVMKuShJ8nApFr0m+hT1JEki3xRr6MDbzJNO9kDfl", + "2yh0tTiGBtZ4M8IzSscX3KHCu6b9VaGRCQ/NZ+8qFxUyZpKgzd+hfIh0lwjujiwvY3FsYrbHeOZO", + "76tGt0nRnO6qY3GEzSze+ChHd7epD5u0vdejJqdaV4Mmqbw52UdmQI1ROWwhQ2hsDuRe710aIqoB", + "otn8NUq3+v4ulU+aRIGzKMlJlpmuCmcjbQowizTfDW3F89yRrPU+zatgRZK48mOcBoFLmRS2OGEm", + "aSFhmuyVKzHJ4KmAmK8/GwIM/QzUyYPd4yY9KnS+YsMvn6pobFUxgj47GfwvbP9iJvzkcaWpt1UA", + "f93JBCIg20LZz+Z8y9MvltyIVzisvY6/+Zn3465q2mL5pV6Ct/h4dWI/daF8wkdkp4qr9i8Systi", + "IVa7as5ucrLAvllk7tBr4/GzSzsX2QsVZC8kG6xGj/or51tV76/qN2hYpxfeo6tqPduZenS5nu2y", + "r12vr7YnsF2wp+zLoFofxCnZ63mfau2j6+YmNW8x8FgrX9cTy1Clhiq11YJn91Ac1jXN+j+IcmWz", + "OtiIWopo9NGyfUAlzVYlrfszTFY60x7GHtfKup/hlItju6x62Ix9CpZnHt1IprxSngvJ8kZhY8TX", + "c1rZkMaxVo3J6uhrg9J79ePqI9NbRLt2UpUAXEJDR3Zdb/S3v7z1qr3yqwrA3g/6L+WtkFjXSKx3", + "v9F6Jr2d+ZQmO3ef4ux+qB1kMsV1Lz3hzWresSxilv13d6+VEhSSPQY5QXqXw6SgkMvqzQqyR+hP", + "C7ILh+YFxfza1473aJwZrN6mg9Rg5gcd++TF7FhhdgHdHJjck3t5mYrWe0llT8/tcxDEgUh2orti", + "aUbEe/fQI41G9dTfMF5OWmx3ek86IjMWVNAzGdZRwgTtwu7hqi1sSauiQ9UGruNK+AY3OyHRT2iY", + "BhYeIK9nflsfQjAoPZuI2ME2Az5gz46c9/RR1W/YiVMleRWY5cGpnjoXb6klyqv9+V/TTcPOXv/p", + "W/Ttt//xh4vX4Sy4+G7x8OrC91//6eLP3wYPD9++Wixez7494wuJCVOZb7J0iScr7WS5ZPv/1iZl", + "mhtCt9cZL/yIHuCTbovQL8g/xdGUhwcq9llljnPV8ab03Ei4wdmXztVhqzXw3HBrIeEJvtYCSrtB", + "DUwRx2z9hWwTNH/YLhb1c9Ea+4WSv+dVacB8I6ofaBPeDc9f8zYzRBRrtQMQXpu0+J41QNvke3rp", + "3u/d4RtaW3qxlub52o+lZ0z/H8IwS/7ssUfxfrdIM2+N1mn2jNlJkflRgkIvj4otPcvqmzPjzR9q", + "o9pEG6T/gLfRBnmdT5kFjw/bxZzteT7ww7IN0/nmajodUoMc1h87NNCku/Lo/UEdlkdbm3RJVZjD", + "OmSqSb3uUPA4R0m6Xa70jIK3+pbc492lwSdUdPeRJ6E1K7nD/9HpzYKJaPdlyT60+7NgHH19yTaH", + "JaE+3vodcT5NY7becx6kiUA1qiPjsjU5NX6ToYtvX7y6eNgupTmFhy1JQ1dpnnGn2/CUTzOEZ3nh", + "oc8o2FLEZt1JczuLNAtQOH/mW9b3v+ubre/9SO7y/n98c3hSCkuXS7ZYY+TZh+Qz4m5u0iWd2K4Q", + "/veSrbfAveVFiDLZ+cm2+mQd0NMj12g9zDBxi/yEyXcEA71fc39ZE347Ngc8BK7q7jQFptCaZjy0", + "5HDfNZ7Czz9NMZh7P//UNRJl1FAf8r3ZxKiY/x/K0nmQbp7nizR78rOQbT/V3MSf7qebLjxuscTg", + "8d0X+G6vuptc5Bc+/hW5iPaUE7vX9zmiMVhv5mv/c1nA7rdlbsdX6bqsGd3w2jLrbL7w84I/rt7+", + "s2/onR6+80J4UUKjqhep37jsZZLN6TdpHM/X2NJoRqC2v035Tkn1fkUkUFmI///xvOdMTPkJGbQP", + "/N5Zd3O/mKdJ0Cylzmaz854j3shu4H4cp4Hem/iRzGK9S3wHncldrfyEllUX4RyFSzQvsggHWRRa", + "COJvwyW6KBv08HvGBsxXIdDN+1E+/xTF8TzYbOdbEhcb7+Hc2OsbpOf2Vxpwvb9GceyxXkPvSjgx", + "+Ov52eqVaGNPYbmXYN1V6avw0ox7asNRM0oj85ab/nR/f/vylbfexkW0idFnMlhDj22NMWfkzGyM", + "+C5HA3w9f0Dz8sMWqwzlqzSWjPFyW6Rrv4gCP46fPWwBnl+eMVXJg72NnxeeLxzHzBs/0znhl44n", + "SqIi8uP5U5SE6dOcTxTrA7qmF3n0Ig9fRF5Nui2WKTssrvOEadoX9uvqaOp5XmSISVTkZ05LD7Rm", + "d5HTpiX9d3SffX7YLiSpOvxtX3PjZPPy3mc0nYWvXs8XI74+n21Y/fyLkZ8/SoJ0rfn5Fw4+v6T/", + "nu6LtPBjk57JDVWn9AB0HK/F7pkF1Uah+wGGGaXizQ8wyhXyQ5SxI4L452/uPdoPJGy8b6go0vuJ", + "tMrOhiBTTdqbwtzMgYv1xy3z79QyhZ7UxqbdOLeGn0truBLO1WcNVr0tMn9dvULjXn7Et4tP4BjN", + "Xo9Es6LYzIM0/RShjm2qVAwZ3ybsGkUai9PlNouMG/v1/XWzpbX/eUW3ly8N+dvXf/rjnzo5Y0cX", + "lQFQu85p1SRG8w3Jfax8O5zwDjfkXYcxahIw3Bme6mWdOwNbnPiRQVAb995U9T/JNDSO8gIlKJuz", + "dsnrCPP6aYsXLHKSsxQvMPj5If031QXpvJ0b1pH3hnbk3dGOxDEQk57/c4u2yML3KHt8h5v1/gs3", + "613SZSY08cF2/ZxvcAilTzUonHFLo80RdGHNsX6IrqE2GxrF+3l/TC5ReCmb6qz9z2wdjZET0pfi", + "vaVzRNoOntJUk0b9tm7xfWG9rQyRs0jMGnpPb/LuNj57OJJhmq/SYgTy3KKMGbB3uU63CVFO0NwV", + "PZemyDHgxOmTX9hISP+ckqR04d2kT97f/QJlTLrfwPJ6xxayxbods8LxPPCDFRrzYtmR1Tdp+mm7", + "8a5wcyUebhDKaGJguwn9ou4LfSSOrLa+oIt+2e2lzcuYGYnqq2i5mi/COQl32obn/YrZ4U/RcuX9", + "+MZ7T+7lLcbp09AG8SeotaebPesjCB25s42f59jSSclnFFfIEBHFsxO3JIXRYIXCLcl/8E3vSOYu", + "QqHnLwpEx1OXUmz8LKdhu8qH/FkU2L+e6ZBwNrS88LOCSmH1h/aAFmlGX2iGqIKqNc7R44uSJcUz", + "yXSl4iU00NHrvCih00VyyhkeOSs1a81Ksm1CmpmHaFOs9M303s8/ka7fbxOKlFQqv0IhMfzYL7iY", + "cSwqp0/eDW2N5qbZN2Kn3Ik7K+TDItHPjchRtkay7p9Q+oiyeVqsMOgv5+IUrFb0ShBZfoqfJKCy", + "mMU2jrWe8Z714v2Ce/HuKd4QIXRe54bK7Ps/t1GgTsHzfAIZ/bz4PLeg1vivX6+vvLKwWY3Su/9v", + "XnUshRxl/zikEyrtuJJRHxy2WEJxOysstUGyGeT8IQqjEe8H91zZ1w8R06GSbSmEOWWt6+LznFIX", + "G9+FOOtnzlhaaF7NZOM0z0c+KPncBFDo7PYmzdmOcGkWoqyCwnpcIzBXhllW4Nz4RHTAbsVhrcqh", + "nQ9PipPRFNlzPSM38Jnf45aIt9KWcDwiWol5+pSgWjmWT1nqGz7oxAbSE5Ng/EKa/Xp+ppMsKCtp", + "JRnIpekCTgBIRyOAXxma8jxWRyZCI4ezyLu7mwZ15FtSM73auKY5ueRarqtos0IZEVDTEEd6LD43", + "2LBe40KiCb+PRRQQqhol9InOqsPX5uGKLvDUb5zPmt/85N1ytXP5jojMYb7Joke/QHTsemUz3DJR", + "O3i39OZqqJ/Qc5wubaRF7m7I+Sv3N3feX9Ezm/EvECeT4+AiV3XJi/A3vCv5saZ4chqkWWjHpoSA", + "TNTZX8/P0iDfsFkPQQO6JKfNVIWWrjFdefRj7wdUPCGUePdPqVfWFbxf2RyIEdYch+Zfru6qFQxa", + "TLE2rijpHBf9QlOMSxl0Hv0sV0edZZw++DEF+sEBgm/Hk3t/Ic0RDFR81U2WBta6u6XZta7+MvTP", + "DOXWemQ72bws17x0dE0OnrbVMffKjv6Kz4m17gQZtbpLpc39Xxw9qG1ujdalvKTkL382TVL//+Po", + "gWunSrkJra+0yjmvxGzxf2i3XquuyB52m1NyI18Dgf9KEJJc1lybQBLAufQg5GELfTZ+nj+lWag4", + "YT3AXEByTXnCOX0c2QJCejLF7OLPF/MX3//rl68fzqSLJBpLhMrW2r0LgxWWEP1KX5PGogd2pV1x", + "P/9c5K3H8S+Ls+//0b1ygd8xf/BzDP1flJ9Y9RW7Wmcrh9nIBjdDjE+yjujrx+YKqF+5vT5Fxcrz", + "49iLitwLVlEcZijxMpSn2ywQD32WLknizag/XfOvVj8f/RiaC5PSheeTNTr490WWxpYW3fV6kY4D", + "lYeJC/5BGbeft9erCq8g749Jhmt0St/42h6O3iHg4tX2P3yuGYUHPHbzkfUf1/6jPm2zRd8UUqFl", + "uUMFnfX+/df3P954eHz+EiWFR24iCgtpTQDb/nwRxbIlpCQ7Uaw4b6Ut01x6JK6ormAoSujS+ShN", + "5jzWNlRAXr7xA3QRIpKRQ6HHV+nS5gN/4z9EcVREYiBS9zDPEZ4wFmkm6ytY+XjO7+OYF8feA8JW", + "QlIv7DZET0hha4PLVdRUPUKChh8lUbJko8tQvo0L6cA2fhGsFG/ysvGQ5FryEskLzs80cgwc5KPi", + "+Q6bL1uk4OdRMPe3NKVN7JqAPv511eqqKDYUI8i+UzikMYvnXvQGf9Xb2E+Qd3l7fXZ+Vi53OPv2", + "BTmuJt2gxN9E9BcvXhGMx0P//svZSwKGSPK136NimyW555cvIEvTwkNJuEmjpMhfnAnbiV2HbEOx", + "2+u3/AKaaSYfhXT1ejZju58VrABJ0mlU2vryf3O6QIP6d5/3l6Pg57/X/Imt7awfDC9rrhzfS5aK", + "eEtOdSYfbLte+9lz+SIUbwF/KH+ZY0x4E+VB+oiyZ7q/0Msg3uYFJ6ExKiTG9Yb83mNXejkqiihZ", + "5p6fhN46faSFnCQNEZFaEtuPkmWMPHZ2YP39016uWLf4I5cryDFdagrovMDPScJonT6S3GWtdS9M", + "vSfkfUJo46WZF2Ai2qojRbilf24RydoyjtG8pvqgPOeC25Tm5ppj/Bs1ZOr4CzyKFQo+MY2ZQBWY", + "wb/wrvwkSYsyVjytUG31qxflXr5BQbSIUHhe+8vKzwmlSp+q5hQPyN1LfLTWlP9jy/i/kyzTbX53", + "+gVD8v3JZ8dGEDa/uyW7VhifYNHclD5+Pe+OEbwNwsYkYaGySWcRgQ1hXj7GZIGh8fCyl7dJZXh6", + "m+aF7PXXXx++94h8mmZmyUKY8BHzI+yofhhmmOkTh/3flMK2z9+NYlDV/XN2v8wlDUeCieDgYZSb", + "W/IxdB2Y384SHlv4I+m4H9Lw2bGTt/ZR3WmQaQX1YOUnS0Qqb9/RsXRHnB/8kKUybQUqVaBphSo8", + "KQrSEC1Rwncrv3hIwzL1RkIcjmdbSTh7G0Ya4QyFkW44A/sH+7di/yrLHGj/Arl/GVRVUTLplwI9", + "XRJAJH6ecIOXoUWG8lXLRyJ2vVByfV9eKvu49e5Ys2Tr20ey+w159d+qr8Res0nzPHqIrdHL/odu", + "MyX8ZlfIj+mUuINyems/8Zco9NiK7Nxjt0nI50/8L87cgvU9GeNUPzx/peyZ6RvliYOu93l5e33u", + "rfwsfPIzROYfv9x5QsJG9mKv6UbYzl4rGfdkL1XjDfC3ey38lr5ivjFAyHMAL/2nvO+d+3FcIhkK", + "vcu/33kZWkZposit/P3uPf2zy5fuP+W8F/WrX2xjr9pK3u538BO2V2K66HhDwtdgOyWI6RfVjOsy", + "DD3fS9CT0NSLD8lVhkKUFJEf5x7++DgcclD1IjapeuMX/oZn2TCVyLYJmSBEZMxvr157UZIXfhIg", + "WqWhCWDv+vKdl6Ux8uj5gyhsf9wgQ36Byu975oY8lF9WjzW8ctVx0xdo6cqjL2EoTfhu9uf+Wy7j", + "DPnh89vPpNhhyWxlNtVpnfokQxpVXn6Jwq8aSUU/EQbUYMwPz15U/FvuRRJjpM2KxthJ0oU+rt9w", + "ykzKKCVjjsKz89auteqJulbqrDQbljKjNvBd/5f8OS1+TLdJaDmLVnvbfcGpCxRSHGD+fue9N/1u", + "IkIYfLQodPTRZtPEDxUi7cQYKgjTNwbpXPo92sR+oOHEclvI6O1G9vDevhPvHMNmE2MYlR4Ox7Cd", + "mKzE0pzhV5Am+TburznWed8VucujCwjl5Jhe4pQZB6yLvaPF9dczmBnnjMbUmlORVXqRI6bKrGRi", + "mir22tpOF7+Rw2eotU/r2Mk1eSq2utqwjKlqaYqdEFfv45oc6jgZW613vi+U1cAc+grAmLUO/Ypl", + "9Db7hAdAXNURZR9Za+sbjmGuY9yasVcjo7Ds0LvFtNl0mMY+Dnvlh8lcXcJabqCPu7y9bqfmu/Vy", + "bIT5sYvm2OvQ0s3xV8eltwZfgEsiMxRjptbz8n+i7R/7u1e+FINv8LKuANL/ImVnXpGWhflFmnl+", + "+OgnAQrbqn8+XqqeVU73qptO5QMqXtn47/nSD+iaiO6P2lGYuXr31ttk6WMUqibol8Ea3fIreoVs", + "b7hwXRRpPK1Qhrwn5D35SYHtyQ/pvstlZ3IJCFNs1OQfKnWH0N+cEIcdpTyDNZqXL1SbQZ6frdhu", + "cN9/qR8Cc/G3ag/8rrNiiLC9Q+JSPv1Xd+mNujUJVo1tSC+HUWuCb9cQtJ5UWYoTjPUobPWYtIWt", + "Z7nG/KI498LUI1tFBQhjXeqH5Fd41E8+2/NDNAMUssvoiZKmj+hzZRNZgCJex0vIfLcQup9K/IzN", + "oPZ2Va+Bbn1AB1d7F6XDsWPSmutEnaXdxXA0efm43XnD72vOLmTpXs9eTzeKehylpuHRjQuZop9+", + "UI99ILLphBCu31NbvH4j0Y+VIaa815NYhyxEH16iMqkH71b4N5/CdZCel1/wXXppysbAvEWWriW4", + "wspyuF1lcd0AXup9skXbkiwH+4t+nuMcgAyAbL+BrAYor/uo676EXGkFoO7GeyRa6Yy1Omn/Bvrq", + "x8LGpBAC4X7OPvd18rlrgU+f4/RUR5LhjoPCCDwHKARQiEOZC892NRcWy3owGT5ITd40c2F2klc+", + "pgjA25AyvR94B0eZTb1OQr4xKh08j36LBQrY5j7lAOi2XdWeXTh6PqE4VgXAbRzP8/IQp1FzKHuB", + "qDSY0ypNPFRmzD2RWbZeXYKfmGdckeC9QDECCNihELBDCpP2eSI/Zn7iakmt2/rr52fXO6qQdPQM", + "tRFLIu6HEgZa8GOdC5rURkpgG14U0UQ4bsSQxgAUhUrIAVZCuAPvzSqIjpiqU/8QDsE2qHxAtIMp", + "tz1+dfL1mB4n7lupMsCHWWoV/BhYC7AWmPuPmPvPppz7u6oIncbkf6er3Kad+2/8DCXFnKQAXvpB", + "nGtt2nB5dePFUUJO8fMLEoCEKBclgouzwct1QXF8GcSa2HpLRtoBrcKjdCKseCLI/3z4kH34kHzY", + "zmbfBuS/6N//81//Bf/r9R87jtlpay9uaiNrbh4cxHxcIFAyqT/Hp1Z5qnmXWAi+utGiuE+rNEbV", + "UtWrm5zuUocNhPx2GT2iBLto6WwlUdFwWr7j0NE4LrBpYNPHL2WK8+kVTPLQfVljD+6ES/Lej4aj", + "Wpcf3XjsSLga4ExBOF9+iZIQfdYsQHHbUWySh1uqilMagMZX6uiCWdl/104k7E+9SZ6OqAigCaAJ", + "oHmaS4hYhNmbyhkfkWQ6orFsqD9eY1vSi9ZkLRGE6mML1Y5zCFBKk+8C1+HXGjtvMOfiJ+aXzouf", + "1MCl+U4c4NVAwICAQdaiHbin3IIkli+24hzG1Z4jMahpXR/aocC6UUfhCXl3uzyXp9kBFQEVARUB", + "FQeg4mwyVHSYxAediTudyThEHJ7zX0RxwT5Fr87kR3rtaJUJbQfq1UeQz+Hmc3qyEOYMgr/S3wzQ", + "hXC/ciMNAW8DRgmM8lAYZS2gTscqO+L4pYD8rshlR/cgEpHyRfpFmjIRDkETsUYzsQgbslWpiBG4", + "sQFAUgYgFCAUtCLWtSIsvuyNUoShgXSG0isV6Y/WRkIRCNSQWRhACUEsIheLdLl2r1qEuZcdrQg4", + "NjAwYGCQxFDF7un0ImrE4FzGjWBE3S9oRixqRpSQZ0s0YpPxskQZgCOAI4AjgONQcJxNB45uU/sg", + "HXEnHRkJjMOrAKui2Mz9RYGyOR/yPNvGSE9N8tP9/a13ie/23rO7vff47tH6EtwyaZi3i5uFAvgR", + "JIXUFnd6AhSl/wiRQOoJAxQqal91o1kBDwaCCwT3QAluT5CejvMaocVlJyVxxY6NhghSGPl+KarP", + "1lTHKNBwZzTZTD6jfEqrgpoxyKscIaS0APEB8UFxY11xo4w4e6PBUY1Qa5LWK9IZgglGsh2AA0jh", + "TEPKQekjV/qMCiC9UiClj9oRB0H4ADYJbBLyRxYRYjo9kQlSqYmYG82RydhAhWRRhTQcjm3JlNxy", + "fpboBOAG4AbgBuCeELhn+wXcU1d8QCHlTiHlGrRH1oZIUDUQTV2R663IpEhTIKw4lrwas6QTFUNR", + "v2g4NfnlUMkT8zR3IifwP+C3wG8Pid+KIXZiSquO7pcNauCUvKqHAQKlDoES+TQySRJDqAmp5gDh", + "ER29damRCf4J44BMEiAtIC0IitwIimiM2S8JEQUJ1dRGTyjUG8ONpUEQviFRMZxDguSnQ/LT7fB6", + "wh7qbfakPODuwNaArUFepCeiTyzRUWKJSHocynCU/YPwxrbwpgMUrcprLDJlQVAD8AnwCfAJ8DkS", + "PmfTw6f7egLIXxzLX0ZD58jKA8JDNN0eiDyXxV2BSHuwl8gxZZJEuzpR3YvgJQ0HL+19qABGdEB3", + "KhhwS6CsQFkPjbK2Iu/ExLUn8l/KSIRTItszIFDHdKhjqo8kk8gIODY1WR2glRGexbpgxhQqmwOC", + "ZBIgMyAzKGfcKGeEQLNf8plqYJ0zJD0djV58NxbTQGiHXIgtAgrSmg5pjWYw0NPYCA5oT2gDoQBY", + "HrA8yL8YRfuJZTfdYNMiSg4FON0jARWObRWODn5alePYJtyCJgeQFpAWkBaQ1irSznaJtBOVOECw", + "41iwYw9lRxZDWMOm2h32Oi2qd1iLIBQ4ppxV3bpOVMFT85WGuwtWP1TFU3dFdzoecFDgt8BvD4/f", + "SmLwxBS3FwUu5bTCKdntHRQoejoUPeKHkml6arg2PZEdoOupPZF1ZY85eLYHBdkoQGtAa1D3uFH3", + "1ELNful7xKH1zJ/0ND66sd5Y5QNhHrImdqkpaH06tD4GgUFP71NzRHuKHwgLwP6A/UGuZkDkn1j3", + "0wc9EvrkUPvTNxpQ/9hW/+giqlUFkH06LmiAAHsBewF7AXsdYO9s19g7WYEE9ECO9UB2cXd0KUU4", + "usxIFCQcv2VLFWR8QiWg6QEkuGoGdrK6INFdWl7fPO19iDKo5o8upUHgpcB5gfMeIOdtB+LJWW8f", + "Flwq+IVj9ts3LNAHdeqDxON2pQKhyU9irX/SQRIhzRPZh2qEhp3GDuewA24DboNKaBqVkBhr9k0m", + "pD79uzWd0hUKaUb8AUohCPaQSrHMU0Es1CkWMggPunIh0Rlt6oUgOAATBCYIGZwh8X9yyVAPAsmY", + "lFPRUM94QDVkXzWkC62WdUPW2XlNOAQgDCAMIAwg7AKEZ7sH4enqJyAfci4fsgvAwystcbqcF362", + "RIWecOgmXXr39PrRgqGbdEmbAg3CEaS3REs6PYWQ4BeCP5cWPkASJHqaGykQ+B+QVyCvB0ReWyF2", + "OtbaE90vG9TAFVftGQZofKScs/oyTWmPAFATMk0zLY8weqsaHlP4E8YBWSIAWgBaEO1YF+0IMWZv", + "xDrVmJQzm151jl4MN1LlQPiGPMU4CgnyG7n8RsPhe/U2grfZ0dmAuwNbA7YGaRGNiD6doKYbS0TS", + "40ZA090/CGcsCmf6QNGWUsY2U2aZOIBPgE+AT4BPC/A5mx4+3ZcTQPLiTvJiBzqHVx7wXSib509R", + "EayiZGmwT84dudW747fqbpXz0JG4om2WTfLdRHRK76xZAMv9TC0pDO301DBytxG8X+IDAyQyCu8c", + "oJZ56KHP4LNAcIHgHijB7QrL05FdfXC4VBMPV0RYf3AgsZFyXOn3aqptpKi3G/ZrJsGRP52ZGueh", + "W40jezc9ACsf1TTpKkB1QHVA9ZPU6MjDzt7IdaTD05h69Wp4jEGgVaQwzIpA/IdMjE0+C3ofud5n", + "aMToFQHJHVQ/LNCqOUQGYIbADCHfYyP4TycN0kcgOa1yIxjSHhVohyxqhwYBrC1BkUPari6OAEAD", + "QANAA0BbB+jZvgD0pJUYUCe5Uyc5BOfRRZsCrTexX2iKlehNXnmTDZnSfTkCUDscT16ssqvT0iY1", + "PaTl5tzc9fJbjeYGZrbKPsHDgL4CfT0Y+srdfkeZpXr3UsrKI4vjbFLXSCCPZDGP1MCbDvSamp++", + "/LLJ0CLS1RM1gVOajaItDpYS6cLqXWMstFsFsvK/9aah1FgDMA4wDjAOAqIKnfdGOqSPLzp6IZMg", + "P0AqBPEdEiFuSTRIg8wiQl8l0k1AqBUhISgA6QPSB7kbu7mb2S5zN44LjSeSvNlpiXHf8jYm5cTx", + "x3zQZ4QzBo6GNZ9m1bBdLDQqEprudwleA7QSaOVh0crdVAI7SKTTuh+U+yYp90lgZyKW+PIL+dGo", + "pCfN6eBmBhzQYQSBzOLVENiLfbpJHEBZQFlA2VOs2O1ZoU4+IdGty6kjtdExHBCkIYFghbFCta3T", + "rTWLaza8ulZRA88G+gX0C5IchkmO2XRJDrcFMqiLua6L7SLBUUTBJ5NtwPH1Vvb+xg3B7sHHw2cF", + "QzrBbb4rtxCdmNv4kB29BUdzsY03uB+QTiCdB0U6mxF2QubZHdwvG8TAGQ/tHgZsyC3f1qH8Mq1d", + "uCt8mpBnGm64XY3e7i7b5bP35XOqAcCuTIC0gLRQXXNXXatizf7sol2OSTmz6d8wWyuImy19g/gN", + "iYpxJBKKb4pdsPs9vn/D68rrjPcCAs8GZgbMDHIgGsF7QoVxN2wIBMeR0rizf1Ab29ykugf/rO1H", + "bZkVN1P7gJ+An4CfgJ8j8HM2PX66Lx6AkMXhHtJWsHN4naEINnMSAfXkLPdXt94VuXz04u77q1vS", + "EixUPYIkkWBGpydmqZxC8GFu3gOkLIKTDVCy9ImzwfWAhQILPSgW2oyu07HQ7rh+WWcErpho9yBA", + "xSIlluV3aYpYKmCajluaSViqoZspWHoWhRuiXjWKaZI9AK8ArwCvJyVfqULM3qhXyiGppjK92hWt", + "6G20UBwCN6QkRrBGkK3IZSu9rt4rWqk8jZla5c/4gY13rgNHB4YGDA0SIH2xfDoVSyeICEzHjYal", + "s3eQsFiUsHRjoS0Bi2VqzPJtgJqAmoCagJpjUXM2NWo6rxeAcMWdcMUGYo4rLbB2DTZjwWNmb1B3", + "S5Z+EQtrELcH9fQjyRvVTes0FS01R6k7uWDyA+UtdS90pnIB3wTSCqT14EirJPxOS1574/+llE24", + "JLS9QwIdjJKnil9JIoepwdnkzNVcG1N7HNsSGXPIbA0J8koA0QDRoJdxopepRZq9ks2II+ueL2lp", + "aHSjvKmUBgI85EdsklGQ16jlNfohQUtrU3NCa5IbCAjA+IDxQVLGOOZPK8Ppw5w2Z3InyukbC2hz", + "LGtzNIHUplDHPv+u9DoAuQC5ALkAudYhd7ZbyJ2qAALCHrfCHqtwO7ZWQkdvLPOht9nU+dAWQUxw", + "VImsmnWdqtJH9JWmv1dWP1jrU3NFh2IfcFBgucByD4/ltmPw1Dy3DwUu5bTCLd/tGxQofjoIrPCd", + "pJIfEdam57FDRD/iE9lX/RhjZ3tQkJICsAawBt2PI92PGGr2TPgjDK1n+qQp/dGM9ebaHwjzkDSx", + "ykxB/tMl/9EPDJoCINERLSqAICwA+wP2B6ka88g/tQioB3ok9MmlDKhnNKADsq4D0kRUu0og63Rc", + "lAIB9gL2AvYC9trH3tmusXey+ggIglwLgqzirkYpJfCDlY7ep6FnEIILbUGaCruijffg7Mkne9g3", + "OC1VTMBtg9s4MRa9HA2518sRtZQireFd9YiqVAzt6RisEvgO8J2xgWfq/ILQaSNGEa92lEdQ9wq5", + "Azu5g4BF1UY8t8xUXn4hWg89QQfFiVKpIU0p4OZUig0toKBmq560987WYeoNUASih12JHqj77o3Q", + "QRFFdSQNdVZsEOz4TA0i3X5MBaHWL5k6dnhGX3GBOoaBQ7B8GjgFwD/A/77NRGdTzURdZdVPYSq6", + "00y685loVszzIs0018kGWeHRy2XrY+V0LCvuaAdHmaW8TkLsOjiw0cHzuLZYoKDIG9X9YBXF2Frz", + "dJsRQM+9JxTHqtC2jeM5I8FjZzYWQ01lMieW5i+NX3RIZt6a2X7ehDTTr0zy8z4gzw/s6lDY1SFF", + "SgckkAfJyUsS9Y4bMTUrPBJJnJUmOnuH8oQ9aWOJJFIscsAPX34p//2V/Bq/XX3WSK5WbarScH3+", + "aCo+eUN61tuooRx0R16jslrI+I31fmoVp0cMY2aTgi9iM9WnhSTyMVao5QslN7yhYQ68AcgokNHJ", + "WR4ZzA5IXtVvm+PhiOCS4in7BoZnSYDCAEEGKJNxu5dfApQV0YLM2nRlKhzJpCUqoT0C3HjEst1H", + "OlCPqVn2FfWuJE+o6LC6EoAWgBYkNfspqeFouj+qmg5o0JLWmEfoYTN0CM6QE+imi7DpB+pz5149", + "kFtv5uoh8GigW0C3IK/hWsWkk9dwpmU6jcTGbuVMU+c1TFbYlNoM88U1mgKNq7ILENkCQoEMZJ8F", + "c4eft6BKj71KXKgVC7qpC+MILUhQITyDztWSlglSF6jfoXWSF8b+jMIIHBr4FvAtkN2Olt3Oppbd", + "usxdnILudufJiwkkt2zQozYy423wJfTyPc3YU+d37CJYoXUczJV/fT6yU9PjtqxfcFhu83rC3GZL", + "Jhu0+WHYcDBYvwVEEojkQRDJEoQnVvbW+22WKhrByJHCt2sMoPC1pPBtIosUooy3pN9kKCAmwbIY", + "ToCNmh1gG2AbYBtgG2AbYJs7bDPIlxiJPVr4N3xnVUMgbFk6lCYAdQF1QQriSgrSCjh7owjRwgkd", + "YUgrmpvpQyCCQ87dJbGEDW91Pb1PMTLG0VntFZwd6BrQNUiSWE2SzHaTJHElJzmRLMlO1SS7SpII", + "B69+fekHsd4WbpdXN14cJUi5hVvl+Hz0Uqp9GceXQVw+oN6C0v08RRa/EnFkjYjmBzEfF6wX1w89", + "xCJPS65S8y8hDFxe3WiR4qdVGiMvjvICt3Z5dZN7T1GxIgZCfruMHlGCnbR0tpLA6LgtQ5kjcl3g", + "2cCzj30NdxVIpyOvquB9WWMQrlirqvejYaxWCWjCvkheNCFnCtL58kuUhOizZrWO24483UNakm0j", + "p4Y02qUBnJUjuMadyREtYn/qTQB1xEWATYBNgM1TLNOVEWZvynN8RJIpSW9FTiditzai6s4cQLA+", + "vmDtOJMAxTj5yu0Oz+5dElM6F7Ouyn3xk5o4NZX4gV8DCQMSBrkLaeieTpysQIuKx7jRIyu6BSmy", + "xaOSVGhnvLpGkX+3zHV5uh1wEXARcBFwcQguzibDRYfJfFCfuFOfjMPE4bn/VVFs5v6iQNmcj3ie", + "bWPN46d/ur+/9S7x3d57drf3Ht89XpWCmyYt84Zxu1DsPoZEkNrmTk9novQgIRBIXWGAEkXtrY7k", + "KeDDQG6B3B4que0J09NRXiO8uOykJa7YsdEQQf8i17+oPltTFKPAw51RZTPtjPIp7WppRmGvcoyQ", + "0ALMB8wHtY11tY0y4uyN+kY1Qq2JWq8+ZwgqmOl1ABAgkTMRMQeZj1zmMyqE9AqBlD5qSRgEAQQY", + "JTBKyCLZxIjp9EQmWKUmY25ERyZjAyWSRSXScEC2pVVyzPtZvhOgG6AboBuge0ronu0XdE9d+QGx", + "lDuxlGvYHlkjIkHVQEB1Ra63I5kibYHE4miya8yWTlQYRT2j4dbkl0PlT8zXHAqewAOB4wLHPSiO", + "KwbZiWmtOr5fNuiBUwKrHgaIlTrESuTTyORJDKMmpJsDREh09PZlR0YIKIwE8kmAtYC1IC5yIy6i", + "MWa/5EQUJlTTGz3RUG8UN5cJQQCHdMUIHgnynw75T7fL64l8qLdZlPWAwwNjA8YG2ZG+mD6xXEeJ", + "JiLxcSjJUfYPIhzbIpwOWLQqtbHJlgVxDQAoACgAKADoWACdTQ+g7usKIIVxLIUZDZ4jKxAID9F0", + "2yDyXDZ3CyINwg4jR5VPEi3rRDUwgp80XLw0+KFiGNEFHSpiwDGBtgJtPTja2oq9E5PXnth/KSMS", + "Tslsz4BAKdOhlKk+kkwuIyDZ1IR1gG5GeBb74hljsGwOCVJKgM2AzaCicaOiEQLNfklpqoF1zpL0", + "NDV6Ed5cWAPBHTIi1kgoyGw6ZDaa4UBPbyM4oEXRDQQDYHrA9CALYxbvJ5bgdMNNiyw5FON0jwQU", + "ObYVOToIalWaY510C/ocwFrAWsBawFq7WDvbJdZOVOoA8Y5j8Y49nB1ZFGENm+p42Ou0qeRhTYJk", + "4KgyV3X7OlE1T81bGg4vmP1QRU/dGR1qesBFgeMCxz1AjiuJwhPT3F4cuJRTC6eEt3dQoO7pUPeI", + "H0qm76kh2/RkdoDGp/ZE9lU+A+CzPSzISQFeA16D0seN0qcWavZL6yMOrWcOpaf30Y325oofCPSQ", + "O7FMT0H306H7MQgNetqfmiNaVP9AYAAGCAwQMjZDYv/EGqA+8JFQKIc6oL7RgBLIthJIF1OtqoEc", + "UHJBDwToC+gL6Avo6wJ9Z7tG38kKJaANcqwNsou8o0sqwvFmRgIh4Yguawoh83MsAU8PIM1VM7GT", + "1QiJDtPy++a58ENUQjWPdCoTAj8F3gu89xB5bzsUT858+9DgUsExHDPgvmGBVqhTKyQeyysVC01+", + "Ymv9kw6SC2me3T5YLzTw3HY4sR2QG5AbFEPTKIbEWLNvkiH1OeGtKZWuaEgz5g9RDUG4h4SKba4K", + "wqFO4ZBBgNCVDonOaFU7BOEB2CCwQcjjDEKAyeVDPRgkY1NOBUQ94wEFkX0FkS64WtYQ2WfoNRER", + "wDDAMMAwwLATGJ7tHoanq6OAlMi5lMguBA+vuMTpcl742RIVeiKim3Tp3dPrx4uHbtIlbQvUCMeQ", + "5BJt6fTUQoJnCB5dmvgAeZDoa45kQeCBQGCBwB4SgW0F2emYa098v2zQA1d8tWcYoPeR8s7qyzRl", + "PgJETcg2zXQ9wujt6nmMAVAYCeSKAGoBakHAY13AI8SYvRHuVGNSzm56lTp6UdxMoQMBHLIVI2kk", + "SHHkUhwNl+/V3gjeZklzAw4PjA0YGyRHdGL6dOKabjQRiY8bMU13/yCisSii6YNFW6oZ62yZJeQA", + "QAFAAUABQG0A6Gx6AHVfVgD5izv5ix3wHF6B+Oc2CuZREhWRHxvsnfNfv15fedf0Nltb5+A2WZOw", + "I8exZJUk9nV6Upi2twjO3jD7AboYiTM6kseAiwKNBRp7eDRWFYWno7N6OHAppxauKK7eoEBAI2Wu", + "re/U1NG0gG16Lmsmqmk/kV1tzUD0bA8Lsk4A1wDXILSxLrRph5q90du0htYzheoV3xhFezMNDgR6", + "SJ04YKegy5HrckxDQ69Ip+2IlrQ6EBiAAQIDhITN0Ng/nX5HC3wkFMqNmkdrNCDqsSjqMcJUWwof", + "V5Sc5Q8BfQF9AX0BfV2h72zX6DtZnQQUQe4UQQ6Qd3hJpQg2cxIq9WRB91e33hW5fLwc6P7qljQF", + "IoNjSGYJhnR6+p/KLQRf5vY9QPAjuJkjoQ84H1BWoKwHRFmb8XU6rtod2S/rrMAVQ+0eBCh4pEyz", + "/C5N5U4FTdPxSzOpTjV0uxIdU9yrxgE5IQBYAFjQ5FjX5FQhZm+0OOWQVNOZXvGNVvw2E91A6IbE", + "xBjmCOoaubqm19l75TSVp1mS0YCrA0sDlgZpkN5oPp1ephNGBLbjRh/T2TvoYizqYrrR0JYQxjY9", + "Zmk3wE3ATcBNwM3RuDmbGjed1w1A0eJO0WIDM8eVGFi7Bhvc4DGzN2hrf5v7q1vWIuydcUzZo7px", + "naa6peYqdTcXbH6g1KXuh+4UL+CdQFyBuB4ecZUE4GkJbC8CXEoZhUtS2zsk0MQouar4lSTSmBqg", + "Tc5ezXUytcexLpcZAJqtQUF2CUAaQBq0M060M7VIs1cSGnFk3XMmLT2Nbpw3ltVAiIcsiVVCClIb", + "tdRGPyho6W5qTmhPfgMhAVgfsD5IzZhH/WklOX2o0+ZN7gQ6fWMBnY5lnY4mlNoU7Tjg4JV2B0AX", + "QBdAF0DXPujOdgu6UxVCQOTjVuRjFXDH1kzo6I0lP/Q2q5of2iTICo4rnVWzr1NV/Yje0vT4yuwH", + "635qzuhS+AMuCkwXmO4BMt12FJ6a6/bhwKWcWrjlvH2DAvVPB4kVvpNU/iMC2/RcdogASHwiBwog", + "c/RsDwsSUwDXANegAXKkARJDzZ6JgISh9UyhNGVAmtF+gA4IAj2kTuyyU5ACdUmB9EODphhIdESb", + "aiAIDMAAgQFCwmZA7J9aENQDPhIK5VIS1DMa0ARZ1wRpYqpdVZB9Si7KggB9AX0BfQF9HaDvbNfo", + "O1mdBMRBrsVBVpFXo6SyCJbR3N9sNOQ/DXGDEF9+vPrLtSeYmTw7hq+6xD314O5hIs11EuKnx2GS", + "Dp5HycUCBUXe4CzBKoqxLefpNiMcKPeeUByrAuU2juc5CoomaAxIVNsLVpXpnJayh1u7KOZhtq2X", + "Zmq6C7ZmEbGrR1Xlk3h3R+lJwNmOkrMdUsS0Ty15sJw6n1Pvt/4BeBxylb3p6huSNnaSNkmJJjI0", + "sk8TX34hmhs9YU0L6ErxjDS/g1tWaWg0Ea80aXUSpTd7AqkQgFWQouxKilJ68L4oULojrI7ipBUG", + "DaJfNW+G0AdzcyvU69SlI36fQ/eVq8b4M0vVgk8DnQE6A1mCUVmC2bRZAldVphNJE+y0uDR1kqC2", + "PscPYr3V5ZdXN14cJTqLytnoVWvKL4NYE2L3WnSBX4g4skb88oOYj+vY8N4lOSb2eHqr0UvvEoLA", + "5dXNgIXnl1c3g5aaK522Wml+JI4LnBo49bGrpaowOh1RVYXuyxp7cMVUVb3DSnEZ6UzYF6ktDieA", + "MwnjNFsDzo3HcOm3EtFoj/poVvYPGmNATUBNKKxZL6yVEWZvlnbzEUnmI701NZ143Vop0pk0gFAN", + "q7TNuCAU1+Trsjv8ulcbWzqX5sprpUtTTRt4NRAwIGCQtpAF7ulEuAqsqDiMG/2toluQ3lpcL63C", + "OltLo+3yXJ5nB1QEVARUBFQcgIqzyVDRYRYfpCbupCbjEFEn6Z8RKwhHLVkuG5FLrssuYK3yceih", + "yw96WrqPhWDIpfCL/U4vIcNbGLBImfcDq5SBXoH++CD0x9xlp16lXOu3oT/mAcjVKuWOviFVYilV", + "sqiwoA1D9pmh0SrlEuFGrE7WhLrSlmE9D+ApqCgOcXky9+C9UVF0hlYdKUUZ/wyXJUPMg3m4TbIF", + "65L7XLmvWDTEk/mCZPBmYDDAYCAjMCojMJs2I+BsRfJppAR2WiaaPCPgfkky66trTbImysKiZFiU", + "DIuSJ1qUrHTb+qrkY3BdINZArGFZMixLhmXJbpcld7DOaZYlKzGtWpesiWegAAbcBNyEkhosTHa5", + "MLkzdQDBGpYmw9Lkw1uarHTqam0y+DWQMCBhkLyAxcmguD2Vxcm9+XbARcBFwEXARVieDLqTA16e", + "3Ej+P/jBJ5SE8/wpKoJVlCzJidp6KpQf6L3eHb+XHBCtoUlZdCWWWKtlo6RNzfr2ol8HCpi4wxyQ", + "ytpOT2Gi8B3B/2V+MECAonLSAZqURR9HBtcFOgt09mDpbGd0no7iGoDEZQcLccWEDYYHUhcp2ZV/", + "sab4RY5/uyLEZgIZxROayWUWPXIZ6QvqAVvFwKZJVAHEA8QDxJ+mnEYRePZGXCMfn850rFd7Yw4G", + "reqEccIEcACyNJYZLoh35OKd4ZGjV9uj8FKD8EDL5BAhgCkCU4RkkC0QmE4GpA9FKpblRiekPy6Q", + "DlmUDg3EWlvKIqdMvqOGAlgNWA1YDVjtAqtn+4PV01ZsQM7kTs7kFKfHFHcirQMa4tgjV47fXeeH", + "KAlhj46jSIpFp3dOA31mwWsj3fMZ8J3ma8/AW4B0Auk8FNIZTX8iQ9Vng1BG7k5iUPUJiR2LiR3y", + "kptAMw0dNDqVgeCach/jIZvemGAeMXOXWxwDqAKoAqiepD4n2qfTI6RwoKO16YnPZlvcQGiG7MBI", + "kggCGaR05r5qmz1f5qU18GegWkC1IH9hmL+YTZO/cFb+iuDMCJfFrt3kLgJ/U2wzzZX6b1AQYw++", + "YjeNXKLPmuOtwQrfo+CwpUWd3mr8pn8I7ly39QEL8Fu+52LlPXgksFBgoQfIQutBdzom2hXsL2WM", + "wRU77RoIrJ+XEs7Gt2kunG8i1mRU1GyNfPMp7C6Ob7yEHjzkYwDFNMAuwC7U2dzV2ZpRb29Kbo2B", + "dc+AeutwBsHdbLE7xHVIcIykmlCnk9fpjCJArwK4GQGMF62DpwODAwYHiROdYD6dArkDQ1qcx40e", + "uWMEIEm2KEnWh0Nby8vdkGZphQDgFOAU4BTgdBicznYBp44LEKCQcaeQsQ2lI2oViygu2NfpVc38", + "SK8dvwqcNgQrW48hicQN6PREMswdBO+lvxmgieGeNUAK039QG/gbcE/gngfEPWshdTru2RHJLwX0", + "d8U7O7oH3YuURtIv0pS7cBCaijqaqVzYmM3ELX1rxs3wjQ0BDiMFFAUUBUmLdUkLiy97o2RhgCCd", + "pvQKV/rjtdkacgjVkGAYwgtBpCIXqXQ5d68mhbkXs6/Kg/GDmu9WB64NLAxYGOQylNF7OlWKGjM4", + "n3GjRVH3C1IUi1IUJejZUp5YZb0sYQbwCPAI8AjwOBgeZ9PBo9scP0hL3ElLRkLjiHLAqig2c39R", + "oGzOx8xOAtfRlvx0f3/rXeK7vffsbnZu+Wi1CW6atMwbxu1CMfwYckNqmzs9OYrSg4RgIHWFAXoV", + "tbc6UrCADwPLBZZ7qCy3J0xPR3yN8OKyk5a4oshGQwRhjIwEJ8rP1tTKKPBwd1zZTEyjfEy78ppR", + "4KscI6S2APQB9EF/Y11/o4w4e6PIUY1Qa6bWK9kZggpmIh4ABMjkTMTMQfcj1/2MCiG9wiClj1qS", + "CkEAAUYJjBLSSDYxYjp1kQlWqcmYGwWSydhAk2RRkzQckG2JlhzzfpbwBOgG6AboBuieErpn+wXd", + "U5d+QC/lTi/lGrbHFokQHr2pjoo8sk35FGkQJBdHlWwTLetE1VKCnzT8vTT4oeIo0QUdaqLAMYEJ", + "AxM+OCbcir0TM+Ce2H8pIxJOWW/PgEDn1KFzqj6STN4kINnkjHWAmkl4GPsiJmO0bA4J0lQAzgDO", + "oFlyo1kSAs1+SZWqgXVOk/SUSXoR3lyQBMEdUiLWWCjIjjpkR5rhQE9lJDigRXERBANgesD0IA1j", + "Fu8nlhB1w02LLDkUDHWPBHRCtnVCOghqVRZknXQLaiDAWsBawFrAWrtYO9sl1k5U6wBhj2Nhjz2c", + "HVsVYS2bKnnY+7Sp5WFNgmjgqFJXdfs6UT1PzVsaHi+Y/VBNT90ZHap6wEWB5ALJPUCSK4nCE/Pc", + "Xhy4lFMLp4y3d1Cg7+nQ94gfSqbwqSHbDtjsAJVP7ZHs63wG4Gd7WJCVAsAGwAatjxutTy3U7Jfa", + "RxxazyRKT/GjG+3NNT8Q6CF5YpmfgvKnQ/ljEBr01D81R7So/4HAAAwQGCCkbIbE/olVQH3gI6FQ", + "DpVAfaMBLZBtLZAuplrVAzmg5IIiCNAX0BfQF9DXBfrOdo2+k1VKQB3kWB1kF3nH11SGHZrm4rg0", + "OGXpSPNccEbabffpaDYORpvuSDTwUyC+QHwPk/ju/Bw0gxPQpjz7DE49G6kW6jnvbBe7WI4+5Mz1", + "8WaDN7OGbawBugG6QTM0jWZof08z69o8eeARZg4PL4NwDxkV+2QVpEOd0iGDAKErHnJ0NBmEB2CD", + "wAYhkTMQASYXEOkcZDLd6WNw7tgONES64GpZReT0mDGAYYBhgGGAYUcwPNs9DE9XSAExkXMxkV0I", + "HlFyidPlvPCzJSr0ZEQ36dK7p9ePlw/dpEvaFugRjiHLJdrS6emFBM8QXLo08QECIdHXHAmDwAOB", + "wQKDPSQG2wqy01HXnvh+2aAHrghrzzBA8SMlntWXaQp9BIiakm6aKXuE4dtV9BgjoDASyBYB1gLW", + "goTHuoRHiDF7I92pxqSc3vRqdfSiuJlGBwI4pCtG8kgQ48jFOBou36u+EbzNkuoGHB4YGzA2yI7o", + "xPTp5DXdaCISHzdymu7+QUZjUUbTB4u2dDPW2TLLyAGAAoACgAKA2gDQ2fQA6r6uAAIYdwIYO+A5", + "ogTxz20UzKMkKiI/Ntg/579+vb7yrulttrbPwW2yJmFXjmNJK0ns6/TEMG1vEby9YfYDlDESZ3Qk", + "kAEXBR4LPPbweKwqCk/HZ/Vw4FJOLVxxXL1BgYRGSl1b36mppGkB2w7IrJmspv1IdtU1A+GzPSzI", + "OwFeA16D1Ma61KYdavZGcdMaWs8cqld+YxTtzVQ4EOghd+KAnoIyR67MMQ0NvTKdtiNaUutAYAAG", + "CAwQMjZDY/90Ch4t8JFQKDd6Hq3RgKzHoqzHCFNtaXxcUXKWQAT0BfQF9AX0dYW+s12j72SFEtAE", + "udMEOUDeETWVPI/n5G/zba4pDrq7u6FY7P2a2xAG3d3dkEtwayA1OOSMVsOYTk8JVHcNwbEFG9dL", + "UdVaMk9Eif2BSwEbBTa6v2y0FjWnzgNJOm9E7FogcpT/6R0F5H4s5n5qn1QFUhMzTzMlT8Morap4", + "DKCzPgzIGgFOA06Dase6aqceZvZGsaMFIzpKHe1obqbSgUAOOQwXhBgUOdqu31cQdOH5LEkO3g80", + "DmgcpFtspFtmu0q3uCr4nVK+ZafFvv1ItRTBZs4aNtgE4P7q1mNv0tYeAPdXt6xFWF98LIS5bVyn", + "V/druYrg6nWbH7D+v+2Hjpb/g3cCoQVCe3CEVhGApyO1WghwKWUUrgiu1pBg5b+Usza/UnPhfxPQ", + "pqevZsXC1vPYrRcOQ83WoCDtBCgNKA3VQ+vVw1ak2ZsCYnNk3ZOm3jKiSZw3qyRCiIc0iW1GCqVF", + "eWnRLCj06qhbTmhppT+EBGB9wPogNzMo6k8n79ZBnTZvciPy1hkL6Lwt6rwNoNTWCn9HHJylCQF0", + "AXQBdAF0nYDubLegO1UlBNQ+7tQ+1gFXo2iyjNMHP+4V9NDLvI2fEU1By7FbOa+/0HZ7sPUw4eQ6", + "CbEz4VhIB89D4WKBgiJv0JJgFcXYaPN0mxGWk3tPKI5V0XAbx/McBUUTGQYknu2FJGYlJ6DM6bR0", + "wSGZfffJceTNKRnqMXsNkLCjJGGHFB3tc0UxME7HENXhmAYQZ2xQ3TGIYSSUbsnDeRM1LNM34Tg+", + "PW12dbCcUpWN3zcDL+ZwKlV2eSDdEaHXNGfpn6LWmdmUYIHq8/KNdM7thnuFzl1q5mO0auBkkBiz", + "Gbh2ceCtUh0s8X/3p9+CMFg/vdX6QE1lsIuTbdsEyUz92x60uiSlkvgaQsl0J8gDaAFogXDWkXD2", + "L63IsTfK2VZQU1LwXtXsuPi4RAUEx/2fp4LYVC421fejXqFpqymVchT8BcgEkImdz4CnVmJ2B+M2", + "13AkwuweBsgvLcovNcHFlvRyHJFjmRYAJwAnAKcDAafZzsDJfV4WZIruZIpWgUknhZul241GXbtZ", + "aCS3eQ8oTpMljplF2tCebHOUxVFeyAWMtFe93Yt4SzXVfiNe8Gt0kAwWwqolKPS7nFbhfMmNsRSS", + "4F9oZhbwpSbGT6cOtAcwf+BxwOMm1hQSz5s4vyB02mBvJHw4Sicoe4VMgqVMwpKF8QZwWCZnL7+Q", + "rbY0S+rEoiRbZZUw8vBMkERVT9eCJmq36lWUvcsne6M6gB+AH5Trj6ZcT+LF/pTo5XFbqyQ/PL7y", + "eS8E1xOdWEOlX7omUOmMvVUV4iitrSr6PZEvCARvBKoDVOfU5/mzqeb5zhYOnsBEf7dFGcfz/FVR", + "bOYIDyHnC3DNSzJCkPjp/v7Wo+3x9YW5lI/iC8mj53e8W1hg2O1s0m91WgUTmXkJ3lEZlV4NRdIc", + "r6gErWdXVVRalgxrCoEEnToJksSqqUsfyiHUbUEWAxyVRTRHBEUSS0USyadVgIVTPmVURZGZY5nz", + "k0o3u0oqxtgk695lBgKwELAQah+Oah8yZ96bSoh+cNYpjkhRXD9ayiakECr3f/4LdQ1ZXcPItfpK", + "HSM9i2UewbuAiAAROdRJ+WwfJuWuahinNyvfaUVjB5PyOF3OF2n25GfhqOJGnC493o5q04sfeT+w", + "RfZRbJFds53TKraI5l5fC8aMXK/IIjRjXlwROoOqChA42D37EHbPFmLmLvbTqHXd3pmAxyKHW2l0", + "jACKO5aKOwKsKMDJCX80KuaI0De8iKOPgaJ5Q7IEsBaqNgdYtRGdeG+qNf3RVqdKI8ZDs+oMxECY", + "wDvhY1At0nLtvirRQM+u9hcD7waGAwwHsgkWsgmzXWQTXO59dhrphJ1WpXaWTRBO/f768iFKQr2T", + "vsiVqjO+KtevHkB1ytcPURLqwy8cYr7PAilqPqdVpKLPXLkstme9uhS+s72Eu8tjaMYYPAZYLrDc", + "gxE9YTefugpV9Vn/2jh0uKo7qfqEgpPFzdvJS26CzWTM0Kj2ROBNmYqR7SPUBX20PzPoI9Y+wfYl", + "gK2ArYCtJ1UjI6Flb4pjUlTQqYf1xGijyckSFRCeIVkwmi/CAXBI6dB9VTCb/swSyuDTQLmAckE6", + "wzydMZsmneGq8HUC+YydVrx2lsoIl5m/nuuXusj1ugUvoY4npchvcGM/sJqBTuI+1hKcAOrtkMmK", + "BnVaxS/BNQRXLm1crw5WNdImqJ3uRBPZVW/gUEAjgUYeBo2sYubUtbFmz436BQlGLutk3f1Dtcxi", + "taxCFjk6Tcw2jcpnAioaFdE6EZN2q42YgjNMkNMBYAZgBmA+2ZKaEGz2prDWByA6NTatQG428RHz", + "CBDDIVthkX9C9Q3peH1fIc6B07M8Nzg+kDcgb5BVsZJVmU2fVXFVrjuZtMpOi3b7kFHBfyr8bIkK", + "vfrdTbr07un1Nhas3aRL2hqswTkOQiza02mV7xreUV94Sn+pxXafVmmMPHKCZ7qo+dtTVKyI2ZA/", + "LqNHlGB/K72lBHsjTRp4IbBTYKcHx05bgXbajRQ6Yvxlgya43EyhYxhHw1Ltks7qy3jsBGgJTE3M", + "PF9+iZIQfdYs5glPIE0HkbaGLYkbAITCaK5xx3I0jNifenNDHTEVIBcgFyD3VDeRZDFmb6p51ZiU", + "M53eap5eJDddOAdBHLIXoykllPPk5TwNt+/VKAvexsyt8m38zEP28QGnB+YGzA2SJXpxfdojLNSI", + "IhIgdwdYqPsHgbRFgXQfNOolVfoLBA5Yc7VzM4AogCiAKICoBRCdTQ+i7ksNoIdxp4exA6CaVYlN", + "luKJ9+gjRHk7qlTULe/nGE48dJ17KT/K6Z3NuansRDB9Zj36Z3OyZgadzck7g7M5gesA1+HBaBcZ", + "g1rXbbbDndxhzqBjBJA0sHjo5aaMubKo74TxGB96yc1t1KGXmuAimjccCQUgBnqFA9UrcCfeq0Mv", + "u6Ot7qGXJfyaHnoJMXBvp5xQ71edJtnrMzqnSQ5wGRRG4DPAG4A37P/kd7aLya/LXP9pzH53fkbj", + "RJPftR/FKJujpMiiRsJ/k6GApFAYEuiVAGiDHmvQe0BxmixxNGVZ16roTq/MPXYEq5QYviPXvGWj", + "01t312i3BnmN8MIuFU6BBco4PDo0bOm06hR1uxfctjLh50apotvBhOKF0PbzAD+iqVBxHOBIwCOB", + "R+6SRwqx8nnqKkq77/rXfyeGG0d1lL4xQCHFUiFFxA4VKjlik4piSjfsVeWVGupJlqw24enhubPO", + "YoB/NQeYYE8zAFoAWgDaIyv01ILI3lR6dOBArPXoJQHSBNkL17VpP8RqyC7oMUaoSGn6dlmT6vPt", + "skpVc+3W4hltx2ZZaXBuIGJAxCDjMWHpzCjj4ap4dkIpj51Wz3aQ8ahgYHwBTQgtDTjKO7hyfseu", + "Oc4VCtdJiJ0Ox0k6eB4mFwsUkO12RUYSrKIYG3iebjPCYHLvCcWxKlJu41iA8VFTVtshqzSs0yyn", + "VabfcuR8XDGt4njGq4HqDgcrgoDaHQy1O6S46oqBVli9k7Jbo3sZD61ik9PiW+dIoP5mtf5WflIZ", + "jrkio1bqb5UxDl/iZIaY7zqSMCBZBnSGCthBVcAqR96zIlhnTB5TAxPw22gVFIRJSBo4J3ZQJtPz", + "/qFVskHOj8IIvB9IEpAkSGE4SGHMdpnCcFtNO5Ucxh4U1KZJYeDr8SXsExjtPifc27XuDDt//Igy", + "KQf/Wehfb5UMb65LLMKvAQnYKJ8XjeO0ymFJzSy5+1XGqrcJXtWKiVfQJLTQF/gF8FPgp9MSv8p1", + "py5bNXuuf/kqLLgqVnX3D3UqW7v0i/FdBjAuKJ7RdnsCekmWF5Rw07MMTB/HBNOeQHoMcAlwCTWv", + "g695CUFjb8pdvaFdZ3O/sdG3NreG0HvyM3ioTclqUzqu2renoOCprbVa/X7K8rXgq0CTgCZBVmE3", + "QCDEFFf1o5NJK+y0dDRdVmGDFNsY6lSO8M06WxaS67r2K7xFprsVik12gRp5PthJwIbr10zltOpI", + "oqELHsnN9lmvjlS28mzqIjRHXHUHPgLkD8jfbshfGQYn34Cw2XPD6ZHrzQe7+4eSkqWSUgUTcqhx", + "wv2MSkoCkEmSmjXY6Skr6UMamnJDG0BOQE6oLh1NdUkIHntTXeqL8jrFJRtxWJh9QxCGKT5sFdhV", + "Z9Jw2r4yk+CzrTKTnsey1C54LVAnoE6QdHBccdJOOriqOJ1M1mGnFadpkw6ybf8MN/kTcSZX0lrY", + "3u+4VuqL1nOSRSjJxn7Yzg0KUIM38CP9wLZ9wMVgzfshrHmvAe0uKlUdS8xvxUDksloFW/VNVK9q", + "L3KnsOSEN5oXq8ZvxqeDfreq3AdsLQMwC9WiQ6oW7d3me51RVrtYNGyHPWEmDSEQZuxWaRgUlbo9", + "W5Ma5S+/bEgBZk6o0cuHKAk1BN1x7JErvWLlFwREBKSKEsEW8XCkweEyjn+IklCLH9ESkTosCI/Q", + "GR02flGgDN//P//4nw8fsg8fkg/b2ezbgPwX/ft//uu/4H+9/uOXrx/OPv7+X8/Oofjb66nUZE4r", + "p0afuXI6bMl6uTR8Z7uCK/cSOsMFL4GZB8w8DqDYil176oxZ1Wf9a+Og4SpDpuoTMmO2NgdiONEC", + "GKtZMSn1M0qRESxTTgll2kI5ztGedHGOmPYEiiQAUgBSANKTSuGR0LI3qTspBOik7HrisubsY4kK", + "CMmQARhBCE89R8d9UZoo6NF72/FhJq4EPwZqBdQKchQmOYrZNDkKV/LvE0hS7FT4PX1+Ik6X88LP", + "lqjQK1DdpEvvnl4/rkx1ky5pO5CFP3SmKtrQaVWsGh4huG5p3lq89GmVxsiLo7zArYo+9hQVK2I2", + "5I/L6BEl2MdKbylhW5O0gucBtwRueUDcshVcp6OYPXH9skEHXJHOnmEcDfe0SyWrL0OgQw5NU1HL", + "l1+iJESfNStgwtCluRrSlmkhzAj1hBFc487k0BexP/WmbjoCKOAr4Cvg6ymWxYQYszfFsWpMyqlM", + "b51ML3rrl8sgcENKYgRnhBKavISm4eq9slvB25i5Vf6Mn9lMkguODgwNGBpkQPpi+XQ64G4UEYmO", + "G01wd/+gDLaoDO6DQ71MSX+m3yo7Zhk3AE4ATgBOAM6xwDmbHjjd1wxAruJOrmIHNAeWF9jx21qq", + "FXbtOMXKHWkEiuaHnhvihnNaUhX+1JWj3gnHsfZlelRnsXblc8BfgCkCUzwIpmhyfuorJ7024jAN", + "N47SKidxZOruUyqtM1PvXJyXqqCFRkuuGbpZW3Stj3x3kx06DuAK4ArgelIKExZc9kZdogQEHVlJ", + "b4zWV5RAeIZcwXiKChqSTofuK4TZ8meWQQafBsoFlAvyGeb5jNl0+QxX1a6TSGjstNK1m1xG4T/E", + "SK/CRS/tL3CRbvgGx1J2fE871UvZ15oDwNtPEsvM6LTqXQU3Y+6xxK71ql3kXvmJsB2+Q7PVtBvw", + "HqCLQBcPhS4Sf5+6+iV0Wv/eJIK4qn0pe4XSl8XSV8FAoIE9E5BFo7oXxTmjslcPBtI+tTCQmvlE", + "h6ADygLKAsqeaB2MRpq9KYMpwEGnCNYXsE2nLHy6D7Ea8gkWOCTUxFCHd/dVxGw7N8s2g4MDGQMy", + "BimPwSmP2VQpD1flsVPIeey0OuY83ZGly8xf1ythmwwFJEPGMEFRG2vs1iqECt4qB9ZNlmL2crH2", + "E3/ZkqZgEiI/j5cPrgdiT542ll/xtApRm8o+ytNkqaW9o4bWqEl127VQpWINY6MZar40ycws+CgM", + "GGgR0KLxMWrqWlCt28a8iXm5o3pQR89QEbJUEdqU8VUFANaZkqIM1I0tVWGIQ0tZAOoHFzFVoaoL", + "aQINN3mX6QgAMwAzKLg4KrhwB96bkkt/BBarL3ozyzRBZZyUFs3HzSchSO7PlBVqHZIprp5TlUWP", + "PqcqyyCG3KOTdrCMIrgU8A7gHfs5iZ5NOYl2VWE4jVn0TmsME06iM/+pd83NT5e3+E7ZRDhKvE3s", + "Yy9Hn0kcWfuFlOmxNmoWAknYPcOPfnqJP/NL8sXrAaPldwMoZLzNC5R1kEd6gfw1dn+jBj+9wl8k", + "3661COo6/AP9hPgGk172vG4j92qf0NLSpYUQVHdd9dqi222+YlUbFnKGBw7cw5DIARzuKDmc8t0k", + "aRneyZf2nqI4xo8apgkixINMrrb5CjXPxOdXNh9HNfr8U7SZy77k8NFzTyRDYd+Ivh7MmhY45olf", + "1uefiz5P50CtvuX2IMiI0yR+xkN+9OMo9DnTE0xENUJ845zfNXKMN+w82WybFNEas078hxwbJfqM", + "gm2But5kc6AUlqqR/vfFe9ruxSVttz9Lo5pqGCCoaU1uMDj/jJ4UcEBNDIDaGKjbM67BX2fsrAq+", + "V+9TOJ142rCBH6rPe4hSIcIJlYxQTTLtTXNRnsZ6W6irRXRlI9IZ7vuyi6Oc1l4nYRT4BeaDdPCc", + "Di4WKCjyhlw/WEUxfWHbjKS6c+8JxbGKEW7jeM508mOrifZybJXNnJaILxMMmfslN269PSV4C1yu", + "py/PK/uB1BBMSw93Wrq/sdJ+BYQ7+9Q6wnq/TTBnAciRkrCrb5ASWpISZhUWtGHIPjM02k2iRLiy", + "cm9QqafN60JdactQqgc8BYngAUoESw/eG41gZ2jV2ZyhjH8GYU+YI0PMg3m4FbIFysQ+V+7biWGI", + "JzNpEXgzMBhgMJARGJcRmE2bEXAlizyRlMBOdZETZQSiZDmuToQbkPNf0jTUh46Dl5KPeWK1IWbA", + "pfvhHvVqQpjUmNeDcPtQCwLmB8zvIJjfYO2ajT4bQE18yVH9x5FUC2o/vPZD434dZuwyPLN6Dzam", + "EbUeDRgj9goZEsBJqPEcYo0HW+T+1Hdk4VOrrtN2rN6aDsQ2mDOPJU5Qx1G5bG/9xtBjee0GvBYY", + "CTASmLkbz9xn08zcndVpjn/qvtsazRQz99phYPS8Wr2jY9m1/WfH4nFL6e5lHNPzcHUQFA5H3+cd", + "z7jhnFYJhz91+3xnnTIOvbt9PovcX2j6FfwF2Cqw1YPYzkw8XX+6Eo76TH8aOlyVcdT9QiHH4gmx", + "7DW3AWcKWmhU5mHoZnRKrBz5aF/6yMcMfYJTyQBcAVwBXE+qOMWCy96Up5SAoFOi6o3RmnOTJSog", + "PEOuYDxFhYNgOx26r4Bly59Zwhh8GigXUC7IZ5jnM2bT5TNcFbdOIqGx0/KW+1xGkWFg7M9XkDf+", + "tEpjEr8xlipPR6cN3dOGYTUFoAJMxHczEacu2LDJPZmWM5dvjU8865pGkJ5putgSC0keQzf5qshj", + "DkynJ/Fk+AUz5dZM2czD5KX4K1IJk7iYqvgOqA+oD3PBZmCarratDodSMuCo0q0eBVS6LVW6NSO7", + "3jyxO23axbBUeVHAAcABUOQfkCLfBK5mu4IrV4nMk8CrHSYyDaYilhObL1FSZJFOgjPnoOrhW54r", + "7ZVBuvMtvhNAD0APJj9+gObEkfQg5QgSrSxu7I3sSQhmYyYGfUs0xJgZJWzLrUbM9O7bMwh+EiKb", + "gmKOlSAU0uilTC1BhIUICxF2SIR95a5rdTB0mV9SjwCSTBaXU9iAEQ26vs1RFpMnGLEVatmItPD3", + "a9kF1P6OovZX2cxprandCobMHZIbt966Wt6C+RapZT/AwYCDQWr3EFK73Nmn5on1fusfgIcRVwyx", + "q2+gh5bo4bbCgjYM2WeGRmtrS4Qbvo2qLtSVtgyblwGeglD2APO3pQfvTfK2M7TqrFst45/Z9qoQ", + "82AebpVswVar3a6sSYDM02LkLu8BxWmyFA5DqSyPj0sZB3LN/bO2sljQMFzhJRx7QHDtaaeY7Wpm", + "uvSzXCZ2X2W4wPKB/gP930Geahc5KlV+ymVuCvJSjvNSLcCwmo/KX37B/zPMR8n2cysh5OHZ4012", + "JaR0JmZlQ/KJmfDX8ZuNAAQCBEIG7CgyYPuV/ZIxfq2s1/Aoy+a9EGJPen4NWSxVFks6Ce/Zb414", + "ZGtPNT1/ZMt9wCeB9gDtgZn/NKGeRBJXCw1PYOq/0/3S3M78HytU72SiJApsMwIUP13e4pYkCksx", + "WLV4aM0g/laGrcOXXI5lb61wDVytwdXkFleNnDtH7fFUlUgaKTSqjx5hQ+mi7J7dKT/ElbXq8rQ3", + "1oXaQCy/9ubzv6+evzydjI2p+12//BKFX3tfOJ7t1l+1lxd+se164b0ncNJ2iAdLCDT5vdamwR8+", + "hF+++3qB//da/J90p+CPzq1AO0rswd7W0m9qYEPbpIjWyMBfURJu0igpcowNHAEwl/XDRz8JMFug", + "bWISXETJMhetPH34XxQo1tu8p/e95R24dPfyKXbn8K33hYQH55/vTZQH6SMGz+4P+NIPYr0zBi+v", + "bgg25d42JzoPzPT4F0uDT6hQHSzIvs9lEP+I73f5efwgnpNBmriiIz1B7aUJnwb/jr0SnY+jF6b9", + "pOyLaO9Cs69U/0R98bvsiS6+vH4zNo4P3fz94wSmdChBXbCAMcZWO2xK2NREx/oaAXxkoHjLOtc1", + "xr04jmAKi8zn/LsYmeahzLGJNeOvikoDkFtztzIrae4VURqKvllSYUbbLJ8P0CjtZ9O4Pe5mdwBZ", + "7+2P0Noe4OBkJvQJilQnwI/ahVEQNOJGN/4zngG0ncIPw1v6N+4YVzfgD+r4PL1LdAKE8G09PwwH", + "e4Xd3R+EUY0z7oEUp2TZfQorDBuNjdvwKNl6l0c/3poADO3t4AGmVcr6cT9nB7JDBA+cL3EtS0WZ", + "njsIU285ocJMZtHXb8bMJMGWD2heoWZSRzKp0HKSHgDRyHkSCQrJp5K8px+svLWf+EsUepdX7956", + "AcqKaEHW7slnwsEa3fF8rMOvvkZzlvbd9xQHeW13zRQ1fk+12aCM1f7IdBQJevJjkpZLNL4CuR63", + "f1Vd1RfGhEvb4axRyAxqze4ictTH/gt/emy42S61me8RpYP1L6T86p3e+uAHn1ASKo5QN17pyO77", + "t1ahoiefdccPV9NZ6nX0WSz28ub8K+w+UV99TvZ9+XdVnPzatxyQHf3aWhDIzFE2oT5sS7E/leZG", + "4ofh3OSwy1fORyA9+HLMPNo4yu40HdW2cV+wa4unR+rFcKOtetiYJbJ9lWfWpueH55zn9s+Gnmxa", + "Ljnb/5Am5E176/ISnQUnrK2WRILM0v9NdaQ467Nrog5WfWiU6ZBURgqzHXWkPhGBRtgcx3oBU1+D", + "JxwSJdzN2ecaLqi0TlHkf2hSd6XPuWF7UbJIe+blpQ5uk6U45nn4nmzN5dctnPuJdnFLr77GHTi0", + "EzaoOXmQySSC3a+Ef6dr4bc9mZO1v+nPj/CovvY3VOTWkwd552+4ALB7fcHCI2HJ8+M89fJV+uRt", + "E55BLTvz4tQPUYjDPRu9ItcWJUG8DdG8bGN/NjQjr/lA4Lz1tQXLeoefQ8OkNKZr79E6fUQk34Z7", + "YuXZatLGu5eIdWLkZ5Wp9VnZO9bQjtHyXGn9IZtIkEGS5w+j/FPXUjs69ZAtGunaopr3F63XKIz8", + "AsXPXv6cBNW6wCLt7XqO7xjrWJJ54GXDDna9dYCuebadQ2OS13QxaTz9JUEHZ+SOY+ghzYia31hm", + "KH3yLHyvvjzrGGLhTmKT/TnM2t/sShvW6rptAfunChMMveUnFmYblJIMVbzXaoMcCKLE871l9IgS", + "jWiOqa1VJz2SEmGPre5raMcfulqT1dSuV9HdRLSuNh4/DN/5Gy2B1X5ZzslE+eddxfhnVYQ/eDV8", + "l4tMixCagmECDnyU0tkC01lGYY86+EicHQ9v/MLvI4k9fbNf/LI+oeeXVFa+H9vm5QYmPWgWLMIo", + "X0nICzxRZy0TXORAiN3zodI6Zo/ak/ayeoldg3pxkGZ0BCE7LYEIhKOQTh3W/qavTglWDiSUvYcM", + "20nB5qvEvOQYQv8keQvCS/4Ha+BjeRndc2PqSmsviaVudMhFVYNg4ILU5nk8D3y2T4bO1h93dzfe", + "1eXA3T+ufOe7ftQeaD82/hBfmVgqv7vpX79+ReZnPNkrtGS8cp2++7OuCLPexkW08bPi5SLN1hfE", + "fL7/coaSIMU2if9N1gZtNyQLV918T4NEgT4XLzexHyX0xSiCU6ONxgNfilp/PpmjxWocK6PEpwt2", + "OsOX2IUsiClm3g1TEd72oc6TlfajMMS+kCK+WP3IYiTNrQYomwGXZtzJd8RPdwgKVzrccQpXu4LV", + "bjPpm7v5SS1WPTxTOZ4RXhz+l3aCage0B1F/uOmZK/G9jfELJAso/QHwlx+oKe0XSrtH4JkyLu5L", + "MfLXTYg5idIod4GpYpVSp5pEN49BmGRgBzJ3Jz8Mr3ytpAP4kzbrZSoNvpcyZsDl0vSJuK89nBKW", + "6u79YnIiLxAnHGQV2x7488svURKiz1q7PdYmKqXpKEjVgbnuedfQyCtSpA3Zn9SDW0dJtN6uz76f", + "nbd3+HZO5g7ISaSErh6jpNyu3/RRVvRnnZrpgNwTrmPVJtaqMu9EOpruk+4s81RuEIy/VOvFjU8+", + "NZs0z0KhrNj/HNSeJKDEcRx2AqrDhKYBWRwAjLJQ4jBN93BjRt6LsGIfB5ClIptf7UuOqv6JBqap", + "yLLUItsGBTk6adg3x6zqCD74XvAb20uOpd/WMBd1h4pmQOAJCX0jYSXKAzUUSEXR4LclCaBdBj91", + "YrTfwC1DahYblI15VoMbdYYeUxpcKGUdWE/OYuesPov3pY6M38vV+xsbXJ434z1FxYoI9EpjMmb0", + "7BvsNaF/f7NbIs9f91GweOFtThhmzGrI743392fUnVhz996O728OprC8b5S9x3R0+HqatRdZDfjc", + "mLUfzLduJUHfsmUPIfrsFamXkffzwrsr/AyT1cJ79cK7XpATWzdZ+hiF5HRX4bX5GWJ3qU9Y5ClU", + "Scr01flZso1j/yFG/IEbKVQcBZbpBf7tRf4p2lykZOx+fEHOp0IZU0FOMBXJ4oNZQfYXVMjKi71e", + "0y84lrc4YAZzWAHyEFhJ+W0moSequc06DckWWXs5uZmYchTzmLAnk5W/QVZclFOZASWKrLghfTqP", + "hvzhJp7U8NDGKxQYjWrvLB9eR+LPJIohNPYAjZJl3DrBgy7YLkdmTiDJd9SusgZZ4fUd6r+zOmtV", + "4+vbwHy+qMTF043xnthTgrxku35AGTt3ujqWJcq9OA3wjOscE8XAz5GXo0eU+RUTylc+uyf316i5", + "FbzseXGPc9rjLtjRUR9cIjijXzrhcBFqGZ35195kKEdJ4UVJHoVI5vBkhb13v0JRxgh24CflIbVF", + "yqZT+NZ1TzDXPLWQhYGq+x2Hgo8TQdAQVm4LiXg+rZpGEnvQsTmFym6zQUlDaDcKTvwwHIAl+2VE", + "9vdTaNmPycYKDoPmLk8FrG+D0GvCNlaNFVHwaV5ggBtwdAa+2aM3SwPoHb7gnjbuMhSJD7GbDD95", + "Uq981PJrlS+gl/0KzyAkSDWK3uU36J+dCMPpC0JCs0dc365e+qFo9wRDs2BnrnbJMogMutRKyyB3", + "ufT9spwQL6IYPwV+ITQL5OFI/IL2gNuhvXj0F/TdpFntl2QhMftNjvCbKVDoPTx7Qbpe+6rF6qTf", + "s54H/c9/0Xygv6Jn72kVBSvvCXlPflLUeNYizRTD+ISerY3hnf+ZTwkF7l+kmMbzrDceirfxl1HC", + "90aWzm3TbVLIdlE1n8m1RvnLYpGjgr2sKAmpdNRbpU/e2k+evahA6xy/RdwuNove0aakxa7hThYZ", + "d0Xu2wHPe9vaf60W+Lor5l6aMdmH59MAdUHDCadcxLzJr6RLzw4/ZFnblAKHszlt3cyMnrFx4Phg", + "GBZqmXIaX6ox6GXLDZItNqz3DhXeWz597AftPioveZFSmM+jYgCCB2myiJZEXUcakEM2abpvl/c3", + "fOUTOVzAD4gwiGbzShRJPT8MyUVlJy+8Kz9J0qJMzzytUOI9oizH90d5dfCHKpcn9DePQlnknIZS", + "RiaLBs7PVsgP2bGFV+wrkD9d/I0+uySaiZfRGgV7T50P/dWdpClnllEaNvlZ71S9iK7UYoWixoOp", + "lEq4g6OwxBaTYF+d9ox5TbBCwacoWTbeDhuPfLDiA4sDPq/9ZeXnRC+WPlXNKZ6ow74qOiLbfClH", + "xbkXpp7vLdiJrXHqh+RXeNRPflSQpxQ/PwrZZRchiv1n00f0q62dovp1foZIr8S5UeiFUYaCIiYR", + "uvZ2X3RuBkUHtxd7kmLvmXo70qrPRnyL6mtbXs9eO++zHgrpZ/f8IEAbPFvyE25JHnv55JQQIeK+", + "p3Z2/aYdo6rwUd7rSb68LMoeXtqRhOF2AB+RXySQYHaOI7afsnZbj3biSWCqcq0OJtyxPrBJhmPy", + "Wv0bzwH6APrsFfrU4OB1H63cl1gqn7dhN/7/2Lu23rhxK/xXhHlqgYk93bQFmrfAmxoLJE0AG30p", + "AoOeoceCNdJA4kxiFPnvC15FSSRFanShZL50m2TE6zkfz/fxcvx4N1eLnVYX1siS6YB0jIUFmPOK", + "7vnK9iZ9YkDvFq0JQV29gp1nDZ4RAoAQAPhJPzfj0E/5+eDAP+fycPIQ9POYwXYVXGzYwnRH9vj4", + "zqKAv7tvXz+VKX+zJ56TVR2aHTP4iZc05HkX0dzxctHykeI5acnAQKmzfO5+j4ttdsa49V0/NeR/", + "HO4cgzOIySFcWq8xLS2eheHfpi7bP5c3nzTDKLsddpr2e8fi2/LKMdsh1sr1uGDf7/Dck+zyGXsN", + "CWUR+6HdTZ7e3+ZrAHvDyMQ0MNG1MR2zfeJab2ENa738vlANjxw0S9FMrSTJoKiVlYj+9shI7K4b", + "iJo9kVNEg1S41CqoGGaE5tj1bEY2F57BUHI6VaKPgcQJPJyKbdtZKBQVe2lamx1WVM5PFtvseOHh", + "CzyetBhTeHOHf9GHCU+aH/LNS4fYjpjN+OykQx0aKW3dPgaVT46I701hZ3CVZWqJF0mFQ8lhwqFH", + "P5NRq1kBAORf55wktuH2zlygRS9qW9idTjNQ4YiMueZMQxtxWARySaYXNltmBpCt3LGcW2/24ku3", + "684faZfi1IJRLtBPw0mBwcP9QMnbKLnGgy9Yusl/2d+BPXmi6VKeTovhQKFhIiVp/4h//ibW83Ks", + "A2RcDhnMWt+qQqDwsu5yASmMXzexExCC24ZgfLlqBXGISdQKqWaFrVJHXYhaIVBnItmiGfu4Sxm0", + "DxopI66HbiZdIwCqK6BKHhFElCWKKHRu/RJRAHNTdxFFwjxnmGCaSsCIgBG+U7Kg4uivfghjVFK1", + "lvsfUrzhjB/8KkjAkIAhgR+Oyg834/ND+brH/C49GMKsUSnhPs9Ox4vkcNITWoxlkMc08Vv8TcDo", + "EIA5ggMz2TeoiUuu1kkGl12V6eAmVy118OCqIc5ZbpxDPGISHVyqWWGrzFPnL4SbcGuCaMddAGcz", + "IRRwe8E7IGcnIkoGPBDRRQredG79Erz1QZXdsUEO1R0l74ASASV8Z1xB8tZK3m28zEbz7oogkugd", + "UCSgSCCD45HBzQRkcAGqtw9E8ACLAux7uK/NC7I+Cf6FfhBgOkRhjvggbPatngZX+lr38+CsOLcT", + "4cF9Q/iz5PCHOcUkanilboW9coddyMlwCX88OBvOwdXt2X65H0Idt1PGA5J25Kt8vANjXaI6zmfX", + "nxfupVZ1PxIusLuub1mo4wEpAlLMg5sFjdx8LNwAI62JAYwo4qCSBzQJaBKo4thUcTMNVZy3XG7E", + "zMHYoWSIhcMz+gQwq/Yul3QV3Ut/irYgxeZPk5bT5OboGcZ5VCCATsYHUKVy5g7i/ybdJ52XvJ8O", + "gcbtxT+WLYPp6YDt4gnECUkyEacPxzzb57AopPzI40VDFQsaPUtBmyHWPEk2S4N6fIdAjrh+XMns", + "QhJ9UG8geYrI6lFLII4/Xpjt3qiWtois1vH2Ga/SP7L8JdImuS/Xr9Z4wcSj/zaY6aos977qpjln", + "6L/964LHvDGKq3q7XnHs7/bS932WRQeQvuIwqeoDveU5x0PQ9Amzh124JF3/P95ZypPSZyYlckFO", + "KdtnvFO3j/x9z6kE5Hq9Ua6sLdL2lKd5UVFqV8G2JtVlWuDcx1w9FtbWGsGotJSb7HCIkVzOOoI/", + "4faEfSWRBqCZu05EONGh2Dc3x0nBwdjdxY5+chSOkDF4M12QJTw0eY2opQ2RYt6iVSHd30XZnRro", + "0zVIrEaG51ItN67hCkSV8o4ql+7KhP9XsJWQTML33ZoGa1SnT1Naw8qPywTqtlm+iYwAchHueFZH", + "8l2Z1lHtF/g3byXNZW1AnPJc4k+vU4Disz4V6S1NLcrqEcdnjFlGydy2gNBXoghE2A2wM+8h4lVk", + "efQXHF9mTyIP9jp6BNsX8n9wL2D+V50Dv5IjSgrZkZW0Wq9YUfhnpCyV+rjWNBdX02iupi0MOx1i", + "LVYJxV51XWsc925BASn00Q9isvdIO6NuCy3S1Jr16ue7HTzCdAfTLdmEIUVc8Z/R0oeNu6gpPlBs", + "MHvUP0as9o8UL3Egie7IIETMO/tx61uICjq9MnKSP2vdNsuZ3uaePPgZILw2SvBBCiNed8QIXiA8", + "/+sIXu2vogM4FuuoKJJoC3MUP+HxhcXVlcbtSVFvB3jpyHWEXvLx9R6mMAeJw1xiFnwAKdjDXcS+", + "JhPKU+UqN6Robbf054OnHmbNmln2YesRLp2U+mF7PmIgyuNGUy+XppFlo6/PUtyYx0FzFssWkG0R", + "RO8KlENw6J7B+Lbebd7aiVIY21qxyoibfaknOebTOdssx652q3KOHtIfV7HS6ey3zo9pILuLixft", + "novK14wRbcMgWMMfxk6Z3GiIH5sddvOhAVjj6siER2KDGMExe7CqSZmAeSYTb1qvK2hdQbx2mJ3F", + "at15xpWLt/FUZ70qgxFnqdqw+MFOLy1Lq/inGReLf8RJEj3CKE5jFJM1DjwhmDMBiMnMuqNAL/Gx", + "k8A/r52IEIOVyPSbal/Px30Ju9VzzscznYFrwPjtAI5FR6J7AEcbgvsFHAcnt6QXs+a08mD2wWV5", + "eSXxgSnKY9hGY9lsDUphEfyJro8JiNPugHn/LPVRojreMdYDUL7M8kW0vU5Q2TwtiJ9qbXF4aOvE", + "S0V7bfnoF9D6eJaY76n4p2iAf7yzOd59801lDQae6d2EBl7pMrN98klRgR2PLNfPyawncMchuaMU", + "vKiOjsie1Xazbd6UTJjw8qiYwued4xTTJToWoBRF8iBv4bbzsCSJwBnECXhMYHR397myA8xbe2Xm", + "Y3d3n2/kSoc8slnv4FwomtU4d2JqtcJa2Fh1rtoWlYDzHmmEfZHcmsFEKIvYzz0kuzWHV/p7rT/S", + "k1y9nsvu3JIZnMKeluLXTXJYFl9fQxwYfX2Cbem8G+rWawmRvM/3URQxd30CmUDiV7StaeTUVyW1", + "LtZFwSH31+x9tqLYeOOz38eLp2d1L9HRUMxyTb00LfOpijMB2INE4ybRbKYMSGVhZeLYmDcl3Fa0", + "FJZcRIO+pKQcPSQk3HfTkeR5Jt87CEk5+hwXaPD9fbl7MzvBbjfUHXf96+VZyEnljNnKSUG26SDb", + "1GdmBrqN7F/Ka+z1Lg0p3XRtTFBv2tSbJmqMIODwpcnpPEbDh1wEHHuca5hSCPRnpuA0ZtBLCUfX", + "yumfu9I7WlcZx8V1GzqOH64bDuE0RBxnO2l7mrtRoIOQEwA+KDnTKTnO8emgYk7n1gQ9x/pJbSfu", + "3rekw+Lma35w2iZ+Tskx61cK0jZagSaG/oRLsRLLczQ8vjY2EuIEyvXVgKm6T31BvZjUJ3EKo/R0", + "eIQ5eekQ42SO3jEOpaoef/FAvzBWf4jT+HA6rD5s1s1HqBYWrM/niKM+DpsHeKmhgLk18Zwu8T1I", + "EjLGDIuwJ9igS/kYTRVa6D0QG3B5l0jNnsVeLV+XxZ2eWcT6milmc9ZRqk7hD2aElvaiUa5dVqPe", + "DWYZUXWPRv06erpPTQuq0/IfYWxgt6vE3It9mXX6a381DzfAxQXRcccUM/x9sEGzzNxXH9o2ItTy", + "8rdMm7rFYoIlSxwtc4vDu+aLy4rSISFKl+SGNxfkNQzJVzTvatu8qT1cahUHrwlpS1rTlrinLLED", + "U9P658W0bcaCst4Std7MM0ernc0Y198J8o5Ma65DUUmnDKHrCBSM9jTHMIekVuI1cBft4hxuUfKK", + "I5HKJM8rjcjlGURGduw+N4sGTlQy7GCsZ7wV9ffNP60++EgGGzwmcJT0Kaowj2IDNa8Whh39DhCI", + "viUghdHHb39EX48wxf+tlqFMklL9QR9JO/QBdc/Ms9bpel/KRBvy3ysG9wHH9+AYn993HObz+/aR", + "/srrWNKQn9/bjbroPB5+XCDcnvIYvZIV/hEU8fYBnNDz6sP/vuM1h6ZToOv/KU9WH1bX5/erX99/", + "/RkAAP//", +} + +func decodeDataplaneSpec() ([]byte, error) { + encoded := strings.Join(dataplaneSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + return buf.Bytes(), nil +} + +var rawDataplaneSpec = decodeDataplaneSpecCached() + +func decodeDataplaneSpecCached() func() ([]byte, error) { + data, err := decodeDataplaneSpec() + return func() ([]byte, error) { + return data, err + } +} + +// GetDataplaneSpecJSON returns the raw JSON bytes of the full embedded OpenAPI v3 specification. +// The result is cached at package init time, so repeated calls are cheap. +func GetDataplaneSpecJSON() ([]byte, error) { + return rawDataplaneSpec() +} diff --git a/handlers/dataplane/specification/specification.gen.go b/handlers/dataplane/specification/specification.gen.go new file mode 100644 index 00000000..0918e084 --- /dev/null +++ b/handlers/dataplane/specification/specification.gen.go @@ -0,0 +1,310 @@ +// Package specification provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package specification + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" +) + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Data Plane API Specification + // (GET /specification) + GetSpecification(w http.ResponseWriter, r *http.Request) + // Data Plane API v3 Specification + // (GET /specification_openapiv3) + GetOpenapiv3Specification(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Data Plane API Specification +// (GET /specification) +func (_ Unimplemented) GetSpecification(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Data Plane API v3 Specification +// (GET /specification_openapiv3) +func (_ Unimplemented) GetOpenapiv3Specification(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetSpecification operation middleware +func (siw *ServerInterfaceWrapper) GetSpecification(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpecification(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOpenapiv3Specification operation middleware +func (siw *ServerInterfaceWrapper) GetOpenapiv3Specification(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOpenapiv3Specification(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/specification", wrapper.GetSpecification) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/specification_openapiv3", wrapper.GetOpenapiv3Specification) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "5FTBbtswDP0Vg9vRjrIF2EG3Yh22nhqswC5FEagKbauwRUGijQaB/32Q7GS1t2FLrz1FocjHx/coH0FT", + "68ii5QDyCB6DIxsw/QkOtSmNVmzI7lraYxN2mtqW7O6ceIpfY6m6hr94Tz4Wa7KMluNROddMKOIpkE3Y", + "usZWxdN7jyVIeCd+MRHjbRAXMcDUehiGHPYYtDcuVoGEr2jRqyYbueVQo9qjTyN+JluaqvOpQfEDfTAj", + "vznCLC0rTYNZP+XmL0bhg0OQENgbW0Umkcs0y8WC4knJCZUen1Az5PBcVFRMwTF3dZrsfFWY1pFP6jvF", + "NUioDNfd40pTK2rlPD0fGHUtdGPQcmEVmx5F/0mMiDByN7akRMFwE9t9u9rGyuxascq2jbKYXW1vsiK7", + "ezkZ5HBSRwIMOZBDq5wBCZvVevUB8kQqSTK3OEYq5N8N+I7cebvse+vQxt+w6E4OR6tu9sl+XtKbrfnH", + "9fqihZ378Yd9u+u0xhAgXaRX8bc9P/MQr39race6tlX+ABIWCi0HZ1UFkPcwjz9EjAWFybN+80pP+s2/", + "bbk99Xiz/vSb/7PorFT0KgKi79Mn7P4InW9Agug3MDwMPwMAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/specification/specification.go b/handlers/dataplane/specification/specification.go new file mode 100644 index 00000000..1845134b --- /dev/null +++ b/handlers/dataplane/specification/specification.go @@ -0,0 +1,70 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package specification + +import ( + "encoding/json" + "net/http" + + "github.com/go-chi/chi/v5" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all specification routes onto r using spec-based request validation +// and a shared error handler. swaggerJSON is the raw OpenAPI v2 spec served at the /v2 endpoint +// for backward compatibility. +func RegisterRouter(r chi.Router, swaggerJSON json.RawMessage) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{swaggerJSON: swaggerJSON}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for the API specification endpoints. +type HandlerImpl struct { + // swaggerJSON is the raw OpenAPI v2 / swagger spec served at the legacy endpoint + // for backward compatibility with existing clients. + swaggerJSON json.RawMessage +} + +func (h *HandlerImpl) GetSpecification(w http.ResponseWriter, r *http.Request) { + b, err := h.swaggerJSON.MarshalJSON() + if err != nil { + respond.Error(w, err) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + respond.Write(w, b) +} + +func (h *HandlerImpl) GetOpenapiv3Specification(w http.ResponseWriter, r *http.Request) { + b, err := GetDataplaneSpecJSON() + if err != nil { + respond.Error(w, err) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + respond.Write(w, b) +} diff --git a/handlers/dataplane/stats/stats.gen.go b/handlers/dataplane/stats/stats.gen.go new file mode 100644 index 00000000..b72525dc --- /dev/null +++ b/handlers/dataplane/stats/stats.gen.go @@ -0,0 +1,374 @@ +// Package stats provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package stats + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Defines values for GetStatsParamsType. +const ( + Backend GetStatsParamsType = "backend" + Frontend GetStatsParamsType = "frontend" + Server GetStatsParamsType = "server" +) + +// Valid indicates whether the value is a known member of the GetStatsParamsType enum. +func (e GetStatsParamsType) Valid() bool { + switch e { + case Backend: + return true + case Frontend: + return true + case Server: + return true + default: + return false + } +} + +// NativeStats defines model for native_stats. +type NativeStats = models.NativeStats + +// GetStatsParams defines parameters for GetStats. +type GetStatsParams struct { + // Type Object type to get stats for (one of frontend, backend, server) + Type GetStatsParamsType `form:"type,omitempty" json:"type,omitempty,omitzero"` + + // Name Object name to get stats for + Name string `form:"name,omitempty" json:"name,omitempty,omitzero"` + + // Parent Object parent name to get stats for, in case the object is a server + Parent string `form:"parent,omitempty" json:"parent,omitempty,omitzero"` +} + +// GetStatsParamsType defines parameters for GetStats. +type GetStatsParamsType string + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Gets stats + // (GET /services/haproxy/stats/native) + GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Gets stats +// (GET /services/haproxy/stats/native) +func (_ Unimplemented) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetStats operation middleware +func (siw *ServerInterfaceWrapper) GetStats(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetStatsParams + + // ------------- Optional query parameter "type" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "type", r.URL.Query(), ¶ms.Type, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "type"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "type", Err: err}) + } + return + } + + // ------------- Optional query parameter "name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "name", r.URL.Query(), ¶ms.Name, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + } + return + } + + // ------------- Optional query parameter "parent" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "parent", r.URL.Query(), ¶ms.Parent, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "parent"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStats(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/stats/native", wrapper.GetStats) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "vJVBb9Q8EIb/ijXfdwDJuylUcMitoqj0ApUqcalWK9c7SVzisbGdVVdV/jvyOCldylYUVZzWm4zfefx6", + "ZnIH2lnvCClFqO8gYPSOIvKf6FGbxmiVjKO1dRvs41o7ax2t7wPn56fYqKFPH0NwIW/WjhJSykvlfT+p", + "VDfREWvrDq3Kq/8DNlDDf9VPkqq8jdWzCJBTj+MoYYNRB+PzLqjhDAmD6kVhk9Ch2mDgI35w1Jh2CJxg", + "8RVDNIVvX2EvTDSmR7GdYuWDo6SdR6ghpmCozSSZZTpLfk8qmS2uY1LF7SneXd+gTiDhdtG6xfSwHGr5", + "mbdc8o4HAQtjvQvsrlepgxpak7rheqmdrTrlg7vdJdRdpXuDlBYlc7V9XxVdYLLnu/tn0LPRL4mbgQ01", + "jhFM6nO6TycXeac4VUmJi14RipOLc7EQs1/zJdUAowTnkZQ3UMPx8mj5BiTD8E1UEcPWaIwzTcWXVBWQ", + "HNFielwXZ5iSoVZwsGiCsyJ1KCauJXDOUjXnmxI/o3kVlMXEdXj1q+4XNldk60RyosU0p3BBvHKEwjU5", + "XW6xjRTXSn/jRT4FhteQrYIavg8YdiCBlM128SU9rFekwUJ9BbMSSJikchhrwUo+Kmt5ADeneYR7gIV/", + "nuqdQ0m8CkgHcklhSGgVkW+hVKgwUajJmAMsRfIpmlzKG/RIGyS9ywEssZzDivo4ruT+BH17dPRis3Bv", + "ePxmyl0OWmOMGfbdP0x7TgkDqV5csgnTkOUw/iAc0r/3qfr7zwwPscFaFXaluWKpBZCQVJsbC0q7rcok", + "ZsLSb0PooYZqewzjavwRAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/stats/stats.go b/handlers/dataplane/stats/stats.go new file mode 100644 index 00000000..f1cfbd2d --- /dev/null +++ b/handlers/dataplane/stats/stats.go @@ -0,0 +1,104 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stats + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all stats routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy stats. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams) { + if params.Name != "" { + switch params.Type { + case "": + respond.BadRequest(w, "Type required when filtering by name") + return + case Server: + if params.Parent == "" { + respond.BadRequest(w, "Parent backend required when filtering by server") + return + } + } + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + nStat := rt.GetStats() + + if nStat.Error != "" { + respond.JSON(w, http.StatusInternalServerError, &nStat) + return + } + + retVal := make([]*models.NativeStat, 0, len(nStat.Stats)) + for _, item := range nStat.Stats { + if params.Name != "" { + if item.Type == "server" { + if item.Name == params.Name && item.Type == string(params.Type) && item.BackendName == params.Parent { + retVal = append(retVal, item) + } + } else if item.Name == params.Name && item.Type == string(params.Type) { + retVal = append(retVal, item) + } + } else { + if params.Type != "" { + if params.Type == Server && params.Parent != "" { + if item.Type == string(params.Type) && item.BackendName == params.Parent { + retVal = append(retVal, item) + } + } else { + if item.Type == string(params.Type) { + retVal = append(retVal, item) + } + } + } else { + retVal = append(retVal, item) + } + } + } + nStat.Stats = retVal + + respond.JSON(w, http.StatusOK, &nStat) +} diff --git a/handlers/dataplane/transactions/transactions.gen.go b/handlers/dataplane/transactions/transactions.gen.go new file mode 100644 index 00000000..e054645e --- /dev/null +++ b/handlers/dataplane/transactions/transactions.gen.go @@ -0,0 +1,538 @@ +// Package transactions provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package transactions + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Defines values for GetTransactionsParamsStatus. +const ( + Failed GetTransactionsParamsStatus = "failed" + InProgress GetTransactionsParamsStatus = "in_progress" +) + +// Valid indicates whether the value is a known member of the GetTransactionsParamsStatus enum. +func (e GetTransactionsParamsStatus) Valid() bool { + switch e { + case Failed: + return true + case InProgress: + return true + default: + return false + } +} + +// Transaction defines model for transaction. +type Transaction = models.Transaction + +// Transactions defines model for transactions. +type Transactions = models.Transactions + +// GetTransactionsParams defines parameters for GetTransactions. +type GetTransactionsParams struct { + // Status Filter by transaction status + Status GetTransactionsParamsStatus `form:"status,omitempty" json:"status,omitempty,omitzero"` +} + +// GetTransactionsParamsStatus defines parameters for GetTransactions. +type GetTransactionsParamsStatus string + +// StartTransactionParams defines parameters for StartTransaction. +type StartTransactionParams struct { + // Version Configuration version on which to work on + Version int `form:"version" json:"version"` +} + +// CommitTransactionParams defines parameters for CommitTransaction. +type CommitTransactionParams struct { + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return list of HAProxy configuration transactions. + // (GET /services/haproxy/transactions) + GetTransactions(w http.ResponseWriter, r *http.Request, params GetTransactionsParams) + // Start a new transaction + // (POST /services/haproxy/transactions) + StartTransaction(w http.ResponseWriter, r *http.Request, params StartTransactionParams) + // Delete a transaction + // (DELETE /services/haproxy/transactions/{id}) + DeleteTransaction(w http.ResponseWriter, r *http.Request, id string) + // Return one HAProxy configuration transactions + // (GET /services/haproxy/transactions/{id}) + GetTransaction(w http.ResponseWriter, r *http.Request, id string) + // Commit transaction + // (PUT /services/haproxy/transactions/{id}) + CommitTransaction(w http.ResponseWriter, r *http.Request, id string, params CommitTransactionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return list of HAProxy configuration transactions. +// (GET /services/haproxy/transactions) +func (_ Unimplemented) GetTransactions(w http.ResponseWriter, r *http.Request, params GetTransactionsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Start a new transaction +// (POST /services/haproxy/transactions) +func (_ Unimplemented) StartTransaction(w http.ResponseWriter, r *http.Request, params StartTransactionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a transaction +// (DELETE /services/haproxy/transactions/{id}) +func (_ Unimplemented) DeleteTransaction(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one HAProxy configuration transactions +// (GET /services/haproxy/transactions/{id}) +func (_ Unimplemented) GetTransaction(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Commit transaction +// (PUT /services/haproxy/transactions/{id}) +func (_ Unimplemented) CommitTransaction(w http.ResponseWriter, r *http.Request, id string, params CommitTransactionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetTransactions operation middleware +func (siw *ServerInterfaceWrapper) GetTransactions(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetTransactionsParams + + // ------------- Optional query parameter "status" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "status", r.URL.Query(), ¶ms.Status, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "status"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "status", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTransactions(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// StartTransaction operation middleware +func (siw *ServerInterfaceWrapper) StartTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params StartTransactionParams + + // ------------- Required query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.StartTransaction(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteTransaction operation middleware +func (siw *ServerInterfaceWrapper) DeleteTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteTransaction(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetTransaction operation middleware +func (siw *ServerInterfaceWrapper) GetTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetTransaction(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CommitTransaction operation middleware +func (siw *ServerInterfaceWrapper) CommitTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CommitTransactionParams + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CommitTransaction(w, r, id, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/transactions", wrapper.GetTransactions) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/transactions", wrapper.StartTransaction) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/transactions/{id}", wrapper.DeleteTransaction) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/transactions/{id}", wrapper.GetTransaction) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/transactions/{id}", wrapper.CommitTransaction) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3FhRb9s2EP4rB27AXmTLTYMC81vbrFtehiIt9lIEwZk8SewkUiUpO0bg/z6QkhXJUpx4SOxsb7ZEnu6+", + "+76PJ90xrotSK1LOsvkdM2RLrSyFP7YkLhPJ0UmtbgotKLc3XBeFVjftwu31Dyiu6EdF1vmtXCtHKvzE", + "ssybGPF3q1WIzDMq0P/62VDC5uyn+D6PuL5r44OeT8ZowzabTcQEWW5k6XexOfuAAkyTWcQyQkEmlPdR", + "q0SmlQnhJ3+RsbLOrr+/twwSmRMsm7VRpxC3LonNmXVGqtTnsYkOA/CCEqxy91uo43VB+DspMphDndtr", + "BvFP7d5zTqXDRU6vDMWvGUETiTwlra4MJ+ColHawIMhQiZzEawf4k66U+G9gu0ILHtwkpHxUXDfb24db", + "KW0toImqF9+Je/O6naR60lys1063kmxvTWRRahOaUqLL2Jyl0mXVYsp1EWdYGn27dsSzmOeSlJsodHJJ", + "8fJdXEdkPnNnUFnkroHkCXl87ex4wWwCmNJRYR/jVbcEH6POFo3B9aMV2GcuwRchVaIDltJ5Z2J/vP/s", + "d8IFOoTPOSqC958vYQI7eWzZNme+DF2SwlKyOXs7nU3fsCjkFMCILZml5GS3ScW7uKXkhgS/IlcZZQEh", + "l9aBTmCbGe9Rvxts2kvSO5i3r0TmjgwJWKzBZSQNWIeuslMW8q7jXIpwnridKks0WJAL2vy2m+KnEDiE", + "vd/VBGceWTZnPyoyvrEKi1qIzc17iZKqCjb/xhKUtclKdVManRqyll1HAwlfR/1p6Gw2ezbT63VmxM6+", + "VJz7tMKNMBY8FLFNMf73w0bwqqoo0KxbQhzCBhYxh6nvHOu19XoTsVLbEdJ9cWic55yiVa+pqLx714yU", + "7hcLUgzYEzb3/WYvffoW3ugJtIJVJnkGTsNKm78hBBrj0r3f+zFSGhJs7kxFI/4vlaOUzCh73rwEe0bP", + "wr5IjDv+SHF+9utB1ZbGt9jJGiuuBY2BGrGCrMWUxh4b7ZxSY8BoDQWqNXgXhb4GTyC0wOOhBh5W0yZ6", + "xOTjOyk2dSNzcjRs6UW47oXX2Tb053rZARLrUk6KrY7CcdnKKFx/VEF77Pd8WE/3uXXNwrfyvF77jG1s", + "x95TEKVuR79p+zx37zmvFT3R0/ed2a+CELNjOWpzHCdVDi0oR7fU/xenmynjaWzcO2BUbgznopCuGyMC", + "uiVeeRnlnS5akOqBAQQKmw5UUAc+rRCi3WdcJmDJRSA0ICTav/gayjWKcMm//65Q+pdg4+fyFufwouyX", + "TQTluJ7Cx/ZLRGVJwCrrn5Ig7f07dgRogWeoUhpiaCg8NeiRBAhpiLt87UetXpOnD0xcoYabOrmeMFqa", + "Jphbao/8hdY5oTqtSfTGrtYwcs9rz5kTTGFns7NjFd/PsuYFYPgSR6IRle/m9kvsccGI2FVN9MuLYczL", + "C/+a44XR5gYj1Bv35NkzO2bnK/qLe/757N3zR+98fT3FsTI0/j3jtN9JZrk17srkbM7i5Vu2ud78EwAA", + "//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/dataplane/transactions/transactions.go b/handlers/dataplane/transactions/transactions.go new file mode 100644 index 00000000..1d85128f --- /dev/null +++ b/handlers/dataplane/transactions/transactions.go @@ -0,0 +1,236 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transactions + +import ( + "net/http" + "strings" + "sync" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + cn "github.com/haproxytech/dataplaneapi/client-native" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/rate" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all transaction routes onto r using spec-based request validation +// and a shared error handler. When maxOpenTransactions > 0 the StartTransaction endpoint +// is rate-limited to that threshold. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent, maxOpenTransactions int) error { + spec, err := GetSpec() + if err != nil { + return err + } + impl := &HandlerImpl{Client: client, ReloadAgent: ra, Mutex: &sync.Mutex{}} + if maxOpenTransactions > 0 { + // On any failure the count falls back to 0 ("nothing open"), which + // disables the max-open-transactions limit for that request — so log it. + actualCount := func() uint64 { + cfg, err := client.Configuration() + if err != nil { + log.Errorf("transaction limiter: cannot get configuration client: %v", err) + return 0 + } + ts, err := cfg.GetTransactions(models.TransactionStatusInProgress) + if err != nil { + log.Errorf("transaction limiter: cannot count open transactions: %v", err) + return 0 + } + if ts == nil { + return 0 + } + return uint64(len(*ts)) + } + impl.Limiter = rate.NewThresholdLimit(uint64(maxOpenTransactions), actualCount) + } + HandlerWithOptions(impl, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy transaction management. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent + Mutex *sync.Mutex + Limiter rate.Threshold +} + +func (h *HandlerImpl) GetTransactions(w http.ResponseWriter, r *http.Request, params GetTransactionsParams) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + ts, err := cfg.GetTransactions(string(params.Status)) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, *ts) +} + +func (h *HandlerImpl) StartTransaction(w http.ResponseWriter, r *http.Request, params StartTransactionParams) { + if h.Limiter != nil { + if err := h.Limiter.LimitReached(); err != nil { + respond.Error(w, err) + return + } + } + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + t, err := cfg.StartTransaction(int64(params.Version)) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, t) +} + +func (h *HandlerImpl) DeleteTransaction(w http.ResponseWriter, r *http.Request, id string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + if err = cfg.DeleteTransaction(id); err != nil { + e := misc.HandleError(err) + if strings.HasSuffix(*e.Message, "does not exist") { + e.Code = new(int64(http.StatusNotFound)) + respond.JSON(w, http.StatusNotFound, e) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetTransaction(w http.ResponseWriter, r *http.Request, id string) { + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + t, err := cfg.GetTransaction(id) + if err != nil { + e := misc.HandleError(err) + if strings.HasSuffix(*e.Message, "does not exist") { + e.Code = new(int64(http.StatusNotFound)) + respond.JSON(w, http.StatusNotFound, e) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, t) +} + +func (h *HandlerImpl) CommitTransaction(w http.ResponseWriter, r *http.Request, id string, params CommitTransactionParams) { + h.Mutex.Lock() + defer h.Mutex.Unlock() + + cfg, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + + transaction, err := cfg.GetTransaction(id) + if err != nil { + e := misc.HandleError(err) + if strings.HasSuffix(*e.Message, "does not exist") { + e.Code = new(int64(http.StatusNotFound)) + respond.JSON(w, http.StatusNotFound, e) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + + switch transaction.Status { + case models.TransactionStatusOutdated: + respond.JSON(w, http.StatusNotAcceptable, misc.OutdatedTransactionError(transaction.ID)) + return + case models.TransactionStatusFailed: + respond.JSON(w, http.StatusNotAcceptable, misc.FailedTransactionError(transaction.ID)) + return + } + + t, err := cfg.CommitTransaction(id) + if err != nil { + e := misc.HandleError(err) + if strings.HasSuffix(*e.Message, "does not exist") { + e.Code = new(int64(http.StatusNotFound)) + respond.JSON(w, http.StatusNotFound, e) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + + // Mark outdated in-progress transactions + txs, err := cfg.GetTransactions(models.TransactionStatusInProgress) + if err != nil { + respond.Error(w, err) + return + } + for _, tx := range *txs { + if tx.Version <= t.Version { + _ = cfg.MarkTransactionOutdated(tx.ID) + } + } + + callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) + if err != nil { + respond.Error(w, err) + return + } + + if params.ForceReload { + if callbackNeeded { + err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) + } else { + err = h.ReloadAgent.ForceReload() + } + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, t) + return + } + + var rID string + if callbackNeeded { + rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) + } else { + rID = h.ReloadAgent.Reload() + } + respond.Accepted(w, rID, t) +} diff --git a/handlers/defaults.go b/handlers/defaults.go deleted file mode 100644 index 5e17e6e1..00000000 --- a/handlers/defaults.go +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/defaults" -) - -// GetDefaultsHandlerImpl implementation of the GetDefaultsHandler interface -type GetDefaultsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceDefaultsHandlerImpl implementation of the ReplaceDefaultsHandler interface -type ReplaceDefaultsHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *GetDefaultsHandlerImpl) Handle(params defaults.GetDefaultsSectionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, data, err := h.getDefaultsConfiguration(params, t) - if err != nil { - e := misc.HandleError(err) - return defaults.NewGetDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewGetDefaultsSectionOK().WithPayload(data) -} - -func (h *GetDefaultsHandlerImpl) getDefaultsConfiguration(params defaults.GetDefaultsSectionParams, t string) (int64, *models.Defaults, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredDefaultsConfiguration(t) - } - return configuration.GetDefaultsConfiguration(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceDefaultsHandlerImpl) Handle(params defaults.ReplaceDefaultsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err := h.pushDefaultsConfiguration(params, t, v) - if err != nil { - e := misc.HandleError(err) - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewReplaceDefaultsSectionOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return defaults.NewReplaceDefaultsSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return defaults.NewReplaceDefaultsSectionAccepted().WithPayload(params.Data) -} - -func (h *ReplaceDefaultsHandlerImpl) pushDefaultsConfiguration(params defaults.ReplaceDefaultsSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.PushStructuredDefaultsConfiguration(params.Data, t, v) - } - return configuration.PushDefaultsConfiguration(params.Data, t, v) -} - -// GetDefaultsHandlerImpl implementation of the GetDefaultsHandler interface -type GetDefaultsSectionsHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetDefaultsSectionsHandlerImpl) Handle(params defaults.GetDefaultsSectionsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, fs, err := h.getDefaultsSections(params, t) - if err != nil { - e := misc.HandleError(err) - return defaults.NewGetDefaultsSectionsDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewGetDefaultsSectionsOK().WithPayload(fs) -} - -func (h *GetDefaultsSectionsHandlerImpl) getDefaultsSections(params defaults.GetDefaultsSectionsParams, t string) (int64, models.DefaultsSections, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredDefaultsSections(t) - } - return configuration.GetDefaultsSections(t) -} - -type GetDefaultsSectionHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetDefaultsSectionHandlerImpl) Handle(params defaults.GetDefaultsSectionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, f, err := h.getDefaultsSection(params, t) - if err != nil { - e := misc.HandleError(err) - return defaults.NewGetDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewGetDefaultsSectionOK().WithPayload(f) -} - -func (h *GetDefaultsSectionHandlerImpl) getDefaultsSection(params defaults.GetDefaultsSectionParams, t string) (int64, *models.Defaults, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredDefaultsSection(params.Name, t) - } - return configuration.GetDefaultsSection(params.Name, t) -} - -type CreateDefaultsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h CreateDefaultsSectionHandlerImpl) Handle(params defaults.CreateDefaultsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return defaults.NewCreateDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createDefaultsSection(params, t, v) - if err != nil { - e := misc.HandleError(err) - return defaults.NewCreateDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return defaults.NewCreateDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewCreateDefaultsSectionCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return defaults.NewCreateDefaultsSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return defaults.NewCreateDefaultsSectionAccepted().WithPayload(params.Data) -} - -func (h *CreateDefaultsSectionHandlerImpl) createDefaultsSection(params defaults.CreateDefaultsSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredDefaultsSection(params.Data, t, v) - } - return configuration.CreateDefaultsSection(params.Data, t, v) -} - -type AddDefaultsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h AddDefaultsSectionHandlerImpl) Handle(params defaults.AddDefaultsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return defaults.NewAddDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createDefaultsSection(params, t, v) - if err != nil { - e := misc.HandleError(err) - return defaults.NewAddDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return defaults.NewAddDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewAddDefaultsSectionCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return defaults.NewAddDefaultsSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return defaults.NewAddDefaultsSectionAccepted().WithPayload(params.Data) -} - -func (h *AddDefaultsSectionHandlerImpl) createDefaultsSection(params defaults.AddDefaultsSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredDefaultsSection(params.Data, t, v) - } - return configuration.CreateDefaultsSection(params.Data, t, v) -} - -// ReplaceDefaultsHandlerImpl implementation of the ReplaceDefaultsHandler interface -type ReplaceDefaultsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h ReplaceDefaultsSectionHandlerImpl) Handle(params defaults.ReplaceDefaultsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err := h.editDefaultsSection(params, t, v) - if err != nil { - e := misc.HandleError(err) - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return defaults.NewReplaceDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewReplaceDefaultsSectionOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return defaults.NewReplaceDefaultsSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return defaults.NewReplaceDefaultsSectionAccepted().WithPayload(params.Data) -} - -func (h *ReplaceDefaultsSectionHandlerImpl) editDefaultsSection(params defaults.ReplaceDefaultsSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredDefaultsSection(params.Name, params.Data, t, v) - } - return configuration.EditDefaultsSection(params.Name, params.Data, t, v) -} - -type DeleteDefaultsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h DeleteDefaultsSectionHandlerImpl) Handle(params defaults.DeleteDefaultsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return defaults.NewDeleteDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return defaults.NewDeleteDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteDefaultsSection(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return defaults.NewDeleteDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return defaults.NewDeleteDefaultsSectionDefault(int(*e.Code)).WithPayload(e) - } - return defaults.NewDeleteDefaultsSectionNoContent() - } - rID := h.ReloadAgent.Reload() - return defaults.NewDeleteDefaultsSectionAccepted().WithReloadID(rID) - } - return defaults.NewDeleteDefaultsSectionAccepted() -} diff --git a/handlers/dgram_bind.go b/handlers/dgram_bind.go deleted file mode 100644 index 2fbb772a..00000000 --- a/handlers/dgram_bind.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/dgram_bind" -) - -// CreateDgramBindHandlerImpl implementation of the CreateDgramBindHandler interface using client-native client -type CreateDgramBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteDgramBindHandlerImpl implementation of the DeleteDgramBindHandler interface using client-native client -type DeleteDgramBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetDgramBindHandlerImpl implementation of the GetDgramBindHandler interface using client-native client -type GetDgramBindHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetDgramBindsHandlerImpl implementation of the GetDgramBindsHandler interface using client-native client -type GetDgramBindsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceDgramBindHandlerImpl implementation of the ReplaceDgramBindHandler interface using client-native client -type ReplaceDgramBindHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateDgramBindHandlerImpl) Handle(params dgram_bind.CreateDgramBindParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return dgram_bind.NewCreateDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewCreateDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateDgramBind(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewCreateDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewCreateDgramBindDefault(int(*e.Code)).WithPayload(e) - } - return dgram_bind.NewCreateDgramBindCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return dgram_bind.NewCreateDgramBindAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return dgram_bind.NewCreateDgramBindAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteDgramBindHandlerImpl) Handle(params dgram_bind.DeleteDgramBindParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return dgram_bind.NewDeleteDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewDeleteDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteDgramBind(params.Name, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewDeleteDgramBindDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewDeleteDgramBindDefault(int(*e.Code)).WithPayload(e) - } - return dgram_bind.NewDeleteDgramBindNoContent() - } - rID := h.ReloadAgent.Reload() - return dgram_bind.NewDeleteDgramBindAccepted().WithReloadID(rID) - } - return dgram_bind.NewDeleteDgramBindAccepted() -} - -// Handle executing the request and returning a response -func (h *GetDgramBindHandlerImpl) Handle(params dgram_bind.GetDgramBindParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewGetDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - _, bck, err := configuration.GetDgramBind(params.Name, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewGetDgramBindDefault(int(*e.Code)).WithPayload(e) - } - return dgram_bind.NewGetDgramBindOK().WithPayload(bck) -} - -// Handle executing the request and returning a response -func (h *GetDgramBindsHandlerImpl) Handle(params dgram_bind.GetDgramBindsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewGetDgramBindsDefault(int(*e.Code)).WithPayload(e) - } - - _, bcks, err := configuration.GetDgramBinds(params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewGetDgramBindsDefault(int(*e.Code)).WithPayload(e) - } - return dgram_bind.NewGetDgramBindsOK().WithPayload(bcks) -} - -// Handle executing the request and returning a response -func (h *ReplaceDgramBindHandlerImpl) Handle(params dgram_bind.ReplaceDgramBindParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return dgram_bind.NewReplaceDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewReplaceDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditDgramBind(params.Name, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewReplaceDgramBindDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return dgram_bind.NewReplaceDgramBindDefault(int(*e.Code)).WithPayload(e) - } - return dgram_bind.NewReplaceDgramBindOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return dgram_bind.NewReplaceDgramBindAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return dgram_bind.NewReplaceDgramBindAccepted().WithPayload(params.Data) -} diff --git a/handlers/fcgi_app.go b/handlers/fcgi_app.go deleted file mode 100644 index 5d182cab..00000000 --- a/handlers/fcgi_app.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/fcgi_app" -) - -type CreateFCGIAppHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (c CreateFCGIAppHandlerImpl) Handle(params fcgi_app.CreateFCGIAppParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return fcgi_app.NewCreateFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - var err error - if err = c.createFCGIApplication(params, t, v); err != nil { - e := misc.HandleError(err) - return fcgi_app.NewCreateFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = c.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewCreateFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - return fcgi_app.NewCreateFCGIAppCreated().WithPayload(params.Data) - } - - return fcgi_app.NewCreateFCGIAppAccepted().WithReloadID(c.ReloadAgent.Reload()).WithPayload(params.Data) - } - return fcgi_app.NewCreateFCGIAppAccepted().WithPayload(params.Data) -} - -func (c CreateFCGIAppHandlerImpl) createFCGIApplication(params fcgi_app.CreateFCGIAppParams, t string, v int64) error { - configuration, err := c.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredFCGIApplication(params.Data, t, v) - } - return configuration.CreateFCGIApplication(params.Data, t, v) -} - -type DeleteFCGIAppHandlerImpl struct { - ReloadAgent haproxy.IReloadAgent - Client client_native.HAProxyClient -} - -func (d DeleteFCGIAppHandlerImpl) Handle(params fcgi_app.DeleteFCGIAppParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return fcgi_app.NewDeleteFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := d.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return fcgi_app.NewDeleteFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.DeleteFCGIApplication(params.Name, t, v); err != nil { - e := misc.HandleError(err) - return fcgi_app.NewDeleteFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = d.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewDeleteFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - return fcgi_app.NewDeleteFCGIAppNoContent() - } - - return fcgi_app.NewDeleteFCGIAppAccepted().WithReloadID(d.ReloadAgent.Reload()) - } - - return fcgi_app.NewDeleteFCGIAppAccepted() -} - -type GetFCGIAppHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetFCGIAppHandlerImpl) Handle(params fcgi_app.GetFCGIAppParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, r, err := g.getFCGIApplication(params, t) - if err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewGetFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - return fcgi_app.NewGetFCGIAppOK().WithPayload(r) -} - -func (g GetFCGIAppHandlerImpl) getFCGIApplication(params fcgi_app.GetFCGIAppParams, t string) (int64, *models.FCGIApp, error) { - configuration, err := g.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredFCGIApplication(params.Name, t) - } - return configuration.GetFCGIApplication(params.Name, t) -} - -type GetFCGIAppsHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetFCGIAppsHandlerImpl) Handle(params fcgi_app.GetFCGIAppsParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, r, err := g.getFCGIApplications(params, t) - if err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewGetFCGIAppsDefault(int(*e.Code)).WithPayload(e) - } - - return fcgi_app.NewGetFCGIAppsOK().WithPayload(r) -} - -func (g GetFCGIAppsHandlerImpl) getFCGIApplications(params fcgi_app.GetFCGIAppsParams, t string) (int64, models.FCGIApps, error) { - configuration, err := g.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredFCGIApplications(t) - } - return configuration.GetFCGIApplications(t) -} - -type ReplaceFCGIAppHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (r ReplaceFCGIAppHandlerImpl) Handle(params fcgi_app.ReplaceFCGIAppParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return fcgi_app.NewReplaceFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - params.Data.Name = params.Name - - var err error - if err = r.editFCGIApplication(params, t, v); err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewReplaceFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = r.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return fcgi_app.NewReplaceFCGIAppDefault(int(*e.Code)).WithPayload(e) - } - - return fcgi_app.NewReplaceFCGIAppOK().WithPayload(params.Data) - } - - return fcgi_app.NewReplaceFCGIAppAccepted().WithReloadID(r.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return fcgi_app.NewReplaceFCGIAppAccepted().WithPayload(params.Data) -} - -func (r ReplaceFCGIAppHandlerImpl) editFCGIApplication(params fcgi_app.ReplaceFCGIAppParams, t string, v int64) error { - configuration, err := r.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredFCGIApplication(params.Name, params.Data, t, v) - } - return configuration.EditFCGIApplication(params.Name, params.Data, t, v) -} diff --git a/handlers/filter.go b/handlers/filter.go deleted file mode 100644 index 576d8d12..00000000 --- a/handlers/filter.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/filter" -) - -// CreateFilterHandlerImpl implementation of the CreateFilterHandler interface using client-native client -type CreateFilterHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteFilterHandlerImpl implementation of the DeleteFilterHandler interface using client-native client -type DeleteFilterHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetFilterHandlerImpl implementation of the GetFilterHandler interface using client-native client -type GetFilterHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllFilterHandlerImpl implementation of the GetAllFilterHandler interface using client-native client -type GetAllFilterHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceFilterHandlerImpl implementation of the ReplaceFilterHandler interface using client-native client -type ReplaceFilterHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllFilterHandlerImpl implementation of the ReplaceAllFilterHandler interface using client-native client -type ReplaceAllFilterHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.CreateFilterBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return filter.NewCreateFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewCreateFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateFilter(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return filter.NewCreateFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return filter.NewCreateFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewCreateFilterBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return filter.NewCreateFilterBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return filter.NewCreateFilterBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.DeleteFilterBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return filter.NewDeleteFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewDeleteFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteFilter(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return filter.NewDeleteFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return filter.NewDeleteFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewDeleteFilterBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return filter.NewDeleteFilterBackendAccepted().WithReloadID(rID) - } - return filter.NewDeleteFilterBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.GetFilterBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewGetFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, f, err := configuration.GetFilter(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return filter.NewGetFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewGetFilterBackendOK().WithPayload(f) -} - -// Handle executing the request and returning a response -func (h *GetAllFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.GetAllFilterBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewGetAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, fs, err := configuration.GetFilters(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return filter.NewGetAllFilterBackendOK().WithPayload(models.Filters{}) - } - return filter.NewGetAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewGetAllFilterBackendOK().WithPayload(fs) -} - -// Handle executing the request and returning a response -func (h *ReplaceFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.ReplaceFilterBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return filter.NewReplaceFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewGetFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditFilter(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return filter.NewReplaceFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return filter.NewReplaceFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewReplaceFilterBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return filter.NewReplaceFilterBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return filter.NewReplaceFilterBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllFilterHandlerImpl) Handle(parentType cnconstants.CnParentType, params filter.ReplaceAllFilterBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return filter.NewReplaceAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return filter.NewReplaceAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceFilters(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return filter.NewReplaceAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return filter.NewReplaceAllFilterBackendDefault(int(*e.Code)).WithPayload(e) - } - return filter.NewReplaceAllFilterBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return filter.NewReplaceAllFilterBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return filter.NewReplaceAllFilterBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/frontend.go b/handlers/frontend.go deleted file mode 100644 index 31c93193..00000000 --- a/handlers/frontend.go +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/frontend" -) - -// CreateFrontendHandlerImpl implementation of the CreateFrontendHandler interface using client-native client -type CreateFrontendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteFrontendHandlerImpl implementation of the DeleteFrontendHandler interface using client-native client -type DeleteFrontendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetFrontendHandlerImpl implementation of the GetFrontendHandler interface using client-native client -type GetFrontendHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetFrontendsHandlerImpl implementation of the GetFrontendsHandler interface using client-native client -type GetFrontendsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceFrontendHandlerImpl implementation of the ReplaceFrontendHandler interface using client-native client -type ReplaceFrontendHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateFrontendHandlerImpl) Handle(params frontend.CreateFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return frontend.NewCreateFrontendDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createFrontend(params, t, v) - if err != nil { - e := misc.HandleError(err) - return frontend.NewCreateFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return frontend.NewCreateFrontendDefault(int(*e.Code)).WithPayload(e) - } - return frontend.NewCreateFrontendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return frontend.NewCreateFrontendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return frontend.NewCreateFrontendAccepted().WithPayload(params.Data) -} - -func (h *CreateFrontendHandlerImpl) createFrontend(params frontend.CreateFrontendParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredFrontend(params.Data, t, v) - } - return configuration.CreateFrontend(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteFrontendHandlerImpl) Handle(params frontend.DeleteFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return frontend.NewDeleteFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return frontend.NewDeleteFrontendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteFrontend(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return frontend.NewDeleteFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return frontend.NewDeleteFrontendDefault(int(*e.Code)).WithPayload(e) - } - return frontend.NewDeleteFrontendNoContent() - } - rID := h.ReloadAgent.Reload() - return frontend.NewDeleteFrontendAccepted().WithReloadID(rID) - } - return frontend.NewDeleteFrontendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetFrontendHandlerImpl) Handle(params frontend.GetFrontendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, f, err := h.getFrontend(params, t) - if err != nil { - e := misc.HandleError(err) - return frontend.NewGetFrontendDefault(int(*e.Code)).WithPayload(e) - } - return frontend.NewGetFrontendOK().WithPayload(f) -} - -func (h *GetFrontendHandlerImpl) getFrontend(params frontend.GetFrontendParams, t string) (int64, *models.Frontend, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredFrontend(params.Name, t) - } - return configuration.GetFrontend(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetFrontendsHandlerImpl) Handle(params frontend.GetFrontendsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, fs, err := h.getFrontends(params, t) - if err != nil { - e := misc.HandleError(err) - return frontend.NewGetFrontendsDefault(int(*e.Code)).WithPayload(e) - } - return frontend.NewGetFrontendsOK().WithPayload(fs) -} - -func (h *GetFrontendsHandlerImpl) getFrontends(params frontend.GetFrontendsParams, t string) (int64, models.Frontends, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredFrontends(t) - } - return configuration.GetFrontends(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceFrontendHandlerImpl) Handle(params frontend.ReplaceFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return frontend.NewReplaceFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return frontend.NewReplaceFrontendDefault(int(*e.Code)).WithPayload(e) - } - - _, ondisk, err := configuration.GetFrontend(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return frontend.NewReplaceFrontendDefault(int(*e.Code)).WithPayload(e) - } - - err = h.editFrontend(params, t, v) - if err != nil { - e := misc.HandleError(err) - return frontend.NewReplaceFrontendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - reload := changeThroughRuntimeAPI(*params.Data, *ondisk, "", h.Client) - if reload { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return frontend.NewReplaceFrontendDefault(int(*e.Code)).WithPayload(e) - } - return frontend.NewReplaceFrontendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return frontend.NewReplaceFrontendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return frontend.NewReplaceFrontendOK().WithPayload(params.Data) - } - return frontend.NewReplaceFrontendAccepted().WithPayload(params.Data) -} - -func (h *ReplaceFrontendHandlerImpl) editFrontend(params frontend.ReplaceFrontendParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredFrontend(params.Name, params.Data, t, v) - } - return configuration.EditFrontend(params.Name, params.Data, t, v) -} diff --git a/handlers/general_storage.go b/handlers/general_storage.go deleted file mode 100644 index eea32d87..00000000 --- a/handlers/general_storage.go +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "bufio" - "fmt" - "io" - "os" - "path/filepath" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - models "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/storage" -) - -// StorageCreateStorageGeneralFileHandlerImpl implementation of the StorageCreateStorageGeneralFileHandler interface using client-native client -type StorageCreateStorageGeneralFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageCreateStorageGeneralFileHandlerImpl) Handle(params storage.CreateStorageGeneralFileParams, principal any) middleware.Responder { - if params.FileUpload == nil { - e := &models.Error{ - Code: misc.Int64P(400), - Message: misc.StringP("No file_upload form param specified"), - } - return storage.NewReplaceStorageGeneralFileBadRequest().WithPayload(e) - } - - file, ok := params.FileUpload.(*runtime.File) - if !ok { - return storage.NewCreateStorageGeneralFileBadRequest() - } - - gs, err := h.Client.GeneralStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, size, err := gs.Create(file.Header.Filename, params.FileUpload) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return storage.NewCreateStorageGeneralFileDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - - me := &models.GeneralFile{ - Description: "managed general use file", - File: filename, - StorageName: filepath.Base(filename), - Size: &size, - } - - return storage.NewCreateStorageGeneralFileCreated().WithPayload(me) -} - -// StorageGetAllStorageGeneralFilesHandlerImpl implementation of the StorageGetAllStorageGeneralFilesHandler interface -type StorageGetAllStorageGeneralFilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *StorageGetAllStorageGeneralFilesHandlerImpl) Handle(params storage.GetAllStorageGeneralFilesParams, principal any) middleware.Responder { - gs, err := h.Client.GeneralStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageGeneralFilesDefault(int(*e.Code)).WithPayload(e) - } - - filenames, err := gs.GetAll() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageGeneralFilesDefault(int(*e.Code)).WithPayload(e) - } - - retFiles := models.GeneralFiles{} - for _, f := range filenames { - retFiles = append(retFiles, &models.GeneralFile{ - Description: "managed general use file", - File: f, - ID: "", - StorageName: filepath.Base(f), - }) - } - - return storage.NewGetAllStorageGeneralFilesOK().WithPayload(retFiles) -} - -// StorageGetOneStorageGeneralFileHandlerImpl implementation of the StorageGetOneStorageGeneralFileHandler interface -type StorageGetOneStorageGeneralFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageGetOneStorageGeneralFileHandlerImpl) Handle(params storage.GetOneStorageGeneralFileParams, principal any) middleware.Responder { - gs, err := h.Client.GeneralStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, _, err := gs.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - if filename == "" { - return storage.NewGetOneStorageGeneralFileNotFound() - } - f, err := os.Open(filename) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewGetOneStorageGeneralFileOK().WithPayload(f) -} - -// StorageDeleteStorageGeneralFileHandlerImpl implementation of the StorageDeleteStorageGeneralFileHandler interface -type StorageDeleteStorageGeneralFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageDeleteStorageGeneralFileHandlerImpl) Handle(params storage.DeleteStorageGeneralFileParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - gs, err := h.Client.GeneralStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - runningConf := strings.NewReader(configuration.Parser().String()) - - filename, _, err := gs.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - // this is far from perfect but should provide a basic level of protection - scanner := bufio.NewScanner(runningConf) - - lineNr := 0 - - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { - errCode := misc.ErrHTTPConflict - errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) - e := &models.Error{Code: &errCode, Message: &errMsg} - return storage.NewDeleteStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - lineNr++ - } - - err = gs.Delete(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewDeleteStorageGeneralFileNoContent() -} - -// StorageReplaceStorageGeneralFileHandlerImpl implementation of the StorageReplaceStorageGeneralFileHandler interface -type StorageReplaceStorageGeneralFileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageReplaceStorageGeneralFileHandlerImpl) Handle(params storage.ReplaceStorageGeneralFileParams, principal any) middleware.Responder { - gs, err := h.Client.GeneralStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - if params.FileUpload == nil { - e := &models.Error{ - Code: misc.Int64P(400), - Message: misc.StringP("No file_upload form param specified"), - } - return storage.NewReplaceStorageGeneralFileBadRequest().WithPayload(e) - } - - data, err := io.ReadAll(params.FileUpload) - if err != nil { - return storage.NewReplaceStorageGeneralFileBadRequest() - } - _, err = gs.Replace(params.Name, string(data)) - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewReplaceStorageGeneralFileNoContent() - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageGeneralFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewReplaceStorageGeneralFileNoContent() - } - rID := h.ReloadAgent.Reload() - return storage.NewReplaceStorageGeneralFileAccepted().WithReloadID(rID) -} diff --git a/handlers/global.go b/handlers/global.go deleted file mode 100644 index fcd5dca4..00000000 --- a/handlers/global.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - client_conf "github.com/haproxytech/client-native/v6/configuration" - "github.com/haproxytech/client-native/v6/models" - cn "github.com/haproxytech/dataplaneapi/client-native" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/global" -) - -// GetGlobalHandlerImpl implementation of the GetGlobalHandler interface -type GetGlobalHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceGlobalHandlerImpl implementation of the ReplaceGlobalHandler interface -type ReplaceGlobalHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *GetGlobalHandlerImpl) Handle(params global.GetGlobalParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, data, err := h.getGlobalConfiguration(params, t) - if err != nil { - e := misc.HandleError(err) - return global.NewGetGlobalDefault(int(*e.Code)).WithPayload(e) - } - return global.NewGetGlobalOK().WithPayload(data) -} - -func (h *GetGlobalHandlerImpl) getGlobalConfiguration(params global.GetGlobalParams, t string) (int64, *models.Global, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredGlobalConfiguration(t) - } - return configuration.GetGlobalConfiguration(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceGlobalHandlerImpl) Handle(params global.ReplaceGlobalParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return global.NewReplaceGlobalDefault(int(*e.Code)).WithPayload(e) - } - // validate constraints that can not be validated by the swagger 2.0 spec. - if err := client_conf.ValidateGlobalSection(params.Data); err != nil { - code := misc.ErrHTTPBadRequest - msg := err.Error() - e := &models.Error{Code: &code, Message: &msg} - return global.NewReplaceGlobalDefault(int(misc.ErrHTTPBadRequest)).WithPayload(e) - } - - err := h.pushGlobalConfiguration(params, t, v) - if err != nil { - e := misc.HandleError(err) - return global.NewReplaceGlobalDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) - if err != nil { - e := misc.HandleError(err) - return global.NewReplaceGlobalDefault(int(*e.Code)).WithPayload(e) - } - - if *params.ForceReload { - if callbackNeeded { - err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) - } else { - err = h.ReloadAgent.ForceReload() - } - - if err != nil { - e := misc.HandleError(err) - return global.NewReplaceGlobalDefault(int(*e.Code)).WithPayload(e) - } - return global.NewReplaceGlobalOK().WithPayload(params.Data) - } - - var rID string - if callbackNeeded { - rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) - } else { - rID = h.ReloadAgent.Reload() - } - return global.NewReplaceGlobalAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return global.NewReplaceGlobalAccepted().WithPayload(params.Data) -} - -func (h *ReplaceGlobalHandlerImpl) pushGlobalConfiguration(params global.ReplaceGlobalParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.PushStructuredGlobalConfiguration(params.Data, t, v) - } - return configuration.PushGlobalConfiguration(params.Data, t, v) -} diff --git a/handlers/group.go b/handlers/group.go deleted file mode 100644 index 5d150079..00000000 --- a/handlers/group.go +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/group" -) - -// CreateGroupHandlerImpl implementation of the CreateGroupHandler interface using client-native client -type CreateGroupHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteGroupHandlerImpl implementation of the DeleteGroupHandler interface using client-native client -type DeleteGroupHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetGroupHandlerImpl implementation of the GetGroupHandler interface using client-native client -type GetGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetGroupsHandlerImpl implementation of the GetGroupsHandler interface using client-native client -type GetGroupsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceGroupHandlerImpl implementation of the ReplaceGroupHandler interface using client-native client -type ReplaceGroupHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateGroupHandlerImpl) Handle(params group.CreateGroupParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return group.NewCreateGroupDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return group.NewCreateGroupDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateGroup(params.Userlist, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return group.NewCreateGroupDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return group.NewCreateGroupDefault(int(*e.Code)).WithPayload(e) - } - return group.NewCreateGroupCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return group.NewCreateGroupAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return group.NewCreateGroupAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteGroupHandlerImpl) Handle(params group.DeleteGroupParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return group.NewDeleteGroupDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return group.NewDeleteGroupDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if err != nil { - e := misc.HandleError(err) - return group.NewDeleteGroupDefault(int(*e.Code)).WithPayload(e) - } - if userlist == nil { - return group.NewDeleteGroupNotFound() - } - - err = configuration.DeleteGroup(params.Name, params.Userlist, t, v) - if err != nil { - e := misc.HandleError(err) - return group.NewDeleteGroupDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return group.NewDeleteGroupDefault(int(*e.Code)).WithPayload(e) - } - return group.NewDeleteGroupNoContent() - } - rID := h.ReloadAgent.Reload() - return group.NewDeleteGroupAccepted().WithReloadID(rID) - } - return group.NewDeleteGroupAccepted() -} - -// Handle executing the request and returning a response -func (h *GetGroupHandlerImpl) Handle(params group.GetGroupParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return group.NewGetGroupDefault(int(*e.Code)).WithPayload(e) - } - - _, g, err := configuration.GetGroup(params.Name, params.Userlist, t) - if err != nil { - e := misc.HandleError(err) - return group.NewGetGroupDefault(int(*e.Code)).WithPayload(e) - } - - if g == nil { - return group.NewGetGroupNotFound() - } - - return group.NewGetGroupOK().WithPayload(g) -} - -// Handle executing the request and returning a response -func (h *GetGroupsHandlerImpl) Handle(params group.GetGroupsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return group.NewGetGroupsDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return group.NewGetGroupNotFound() - } - if err != nil { - return group.NewGetGroupNotFound() - } - - _, groups, err := configuration.GetGroups(params.Userlist, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return group.NewGetGroupsOK().WithPayload(models.Groups{}) - } - return group.NewGetGroupsDefault(int(*e.Code)).WithPayload(e) - } - return group.NewGetGroupsOK().WithPayload(groups) -} - -// Handle executing the request and returning a response -func (h *ReplaceGroupHandlerImpl) Handle(params group.ReplaceGroupParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return group.NewReplaceGroupDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return group.NewReplaceGroupDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return group.NewReplaceGroupNotFound() - } - if err != nil { - return group.NewReplaceGroupNotFound() - } - - _, g, err := configuration.GetGroup(params.Name, params.Userlist, t) - if err != nil { - e := misc.HandleError(err) - return group.NewGetGroupDefault(int(*e.Code)).WithPayload(e) - } - if g == nil { - return group.NewReplaceGroupNotFound() - } - - err = configuration.EditGroup(params.Name, params.Userlist, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return group.NewReplaceGroupDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return group.NewReplaceGroupDefault(int(*e.Code)).WithPayload(e) - } - return group.NewReplaceGroupOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return group.NewReplaceGroupAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return group.NewReplaceGroupAccepted().WithPayload(params.Data) -} diff --git a/handlers/health.go b/handlers/health.go deleted file mode 100644 index 910a9bd2..00000000 --- a/handlers/health.go +++ /dev/null @@ -1,29 +0,0 @@ -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/operations/health" -) - -// GetHaproxyProcessInfoHandlerImpl implementation of the GetHaproxyProcessInfoHandler interface using client-native client -type GetHealthHandlerImpl struct { - HAProxy haproxy.IReloadAgent -} - -func (h *GetHealthHandlerImpl) Handle(health.GetHealthParams, any) middleware.Responder { - data := models.Health{} - status, err := h.HAProxy.Status() - if err == nil { - if status { - data.Haproxy = models.HealthHaproxyUp - } else { - data.Haproxy = models.HealthHaproxyDown - } - } else { - data.Haproxy = models.HealthHaproxyUnknown - } - - return health.NewGetHealthOK().WithPayload(&data) -} diff --git a/handlers/http_after_response_rule.go b/handlers/http_after_response_rule.go deleted file mode 100644 index 9a58c44a..00000000 --- a/handlers/http_after_response_rule.go +++ /dev/null @@ -1,269 +0,0 @@ -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_after_response_rule" -) - -type CreateHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (c CreateHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.CreateHTTPAfterResponseRuleBackendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := c.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateHTTPAfterResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = c.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendCreated().WithPayload(params.Data) - } - - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendAccepted().WithReloadID(c.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return http_after_response_rule.NewCreateHTTPAfterResponseRuleBackendAccepted().WithPayload(params.Data) -} - -type DeleteHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (d DeleteHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.DeleteHTTPAfterResponseRuleBackendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := d.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.DeleteHTTPAfterResponseRule(params.Index, string(parentType), params.ParentName, t, v); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = d.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendNoContent() - } - - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendAccepted().WithReloadID(d.ReloadAgent.Reload()) - } - - return http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackendAccepted() -} - -type GetHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.GetHTTPAfterResponseRuleBackendParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewGetHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetHTTPAfterResponseRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewGetHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - return http_after_response_rule.NewGetHTTPAfterResponseRuleBackendOK().WithPayload(rule) -} - -type GetAllHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetAllHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.GetAllHTTPAfterResponseRuleBackendParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewGetAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetHTTPAfterResponseRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewGetAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - return http_after_response_rule.NewGetAllHTTPAfterResponseRuleBackendOK().WithPayload(rules) -} - -type ReplaceHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (r ReplaceHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := r.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.EditHTTPAfterResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = r.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendOK().WithPayload(params.Data) - } - - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendAccepted().WithReloadID(r.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackendAccepted().WithPayload(params.Data) -} - -type ReplaceAllHTTPAfterResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *ReplaceAllHTTPAfterResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceHTTPAfterResponseRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/http_check.go b/handlers/http_check.go deleted file mode 100644 index 76477ca8..00000000 --- a/handlers/http_check.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2021 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_check" -) - -// CreateHTTPCheckHandlerImpl implementation of the CreateHTTPCheckHandler interface using client-native client -type CreateHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteHTTPCheckHandlerImpl implementation of the DeleteHTTPCheckHandler interface using client-native client -type DeleteHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetHTTPCheckHandlerImpl implementation of the GetHTTPCheckHandler interface using client-native client -type GetHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllHTTPCheckHandlerImpl implementation of the GetHTTPChecksHandler interface using client-native client -type GetAllHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceHTTPCheckHandlerImpl implementation of the ReplaceHTTPCheckHandler interface using client-native client -type ReplaceHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllHTTPCheckHandlerImpl implementation of the ReplaceHTTPChecksHandler interface using client-native client -type ReplaceAllHTTPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.CreateHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_check.NewCreateHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewCreateHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateHTTPCheck(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_check.NewCreateHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_check.NewCreateHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewCreateHTTPCheckBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_check.NewCreateHTTPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_check.NewCreateHTTPCheckBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.DeleteHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_check.NewDeleteHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewDeleteHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteHTTPCheck(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return http_check.NewDeleteHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_check.NewDeleteHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewDeleteHTTPCheckBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return http_check.NewDeleteHTTPCheckBackendAccepted().WithReloadID(rID) - } - return http_check.NewDeleteHTTPCheckBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.GetHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewGetHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetHTTPCheck(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_check.NewGetHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewGetHTTPCheckBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.GetAllHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewGetAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetHTTPChecks(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return http_check.NewGetAllHTTPCheckBackendOK().WithPayload(models.HTTPChecks{}) - } - return http_check.NewGetAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewGetAllHTTPCheckBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.ReplaceHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_check.NewReplaceHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditHTTPCheck(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewReplaceHTTPCheckBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_check.NewReplaceHTTPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_check.NewReplaceHTTPCheckBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllHTTPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_check.ReplaceAllHTTPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_check.NewReplaceAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceHTTPChecks(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_check.NewReplaceAllHTTPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_check.NewReplaceAllHTTPCheckBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_check.NewReplaceAllHTTPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_check.NewReplaceAllHTTPCheckBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/http_error_rule.go b/handlers/http_error_rule.go deleted file mode 100644 index ffa0015f..00000000 --- a/handlers/http_error_rule.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_error_rule" -) - -// CreateHTTPErrorRuleHandlerImpl implementation of the CreateHTTPErrorRuleHandler interface using client-native client -type CreateHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteHTTPErrorRuleHandlerImpl implementation of the DeleteHTTPErrorRuleHandler interface using client-native client -type DeleteHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetHTTPErrorRuleHandlerImpl implementation of the GetHTTPErrorRuleHandler interface using client-native client -type GetHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllHTTPErrorRuleHandlerImpl implementation of the GetHTTPErrorRulesHandler interface using client-native client -type GetAllHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceHTTPErrorRuleHandlerImpl implementation of the ReplaceHTTPErrorRuleHandler interface using client-native client -type ReplaceHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllHTTPErrorRuleHandlerImpl implementation of the ReplaceHTTPErrorRulesHandler interface using client-native client -type ReplaceAllHTTPErrorRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.CreateHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_error_rule.NewCreateHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewCreateHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateHTTPErrorRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewCreateHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewCreateHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewCreateHTTPErrorRuleBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_error_rule.NewCreateHTTPErrorRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_error_rule.NewCreateHTTPErrorRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.DeleteHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_error_rule.NewDeleteHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewDeleteHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteHTTPErrorRule(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewDeleteHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewDeleteHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewDeleteHTTPErrorRuleBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return http_error_rule.NewDeleteHTTPErrorRuleBackendAccepted().WithReloadID(rID) - } - return http_error_rule.NewDeleteHTTPErrorRuleBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.GetHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewCreateHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetHTTPErrorRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewGetHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewGetHTTPErrorRuleBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.GetAllHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewGetAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetHTTPErrorRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return http_error_rule.NewGetAllHTTPErrorRuleBackendOK().WithPayload(models.HTTPErrorRules{}) - } - return http_error_rule.NewGetAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewGetAllHTTPErrorRuleBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.ReplaceHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_error_rule.NewReplaceHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditHTTPErrorRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewReplaceHTTPErrorRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_error_rule.NewReplaceHTTPErrorRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_error_rule.NewReplaceHTTPErrorRuleBackendAccepted().WithPayload(params.Data) -} - -func (h *ReplaceAllHTTPErrorRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_error_rule.ReplaceAllHTTPErrorRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.ReplaceHTTPErrorRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_error_rule.NewReplaceAllHTTPErrorRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/http_errors.go b/handlers/http_errors.go deleted file mode 100644 index 54879cf5..00000000 --- a/handlers/http_errors.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_errors" -) - -// CreateHTTPErrorsSectionHandlerImpl implementation of the CreateHTTPErrorsSectionHandler interface using client-native client -type CreateHTTPErrorsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteHTTPErrorsSectionHandlerImpl implementation of the DeleteHTTPErrorsSectionHandler interface using client-native client -type DeleteHTTPErrorsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetHTTPErrorsSectionHandlerImpl implementation of the GetHTTPErrorsSectionHandler interface using client-native client -type GetHTTPErrorsSectionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetHTTPErrorsSectionsHandlerImpl implementation of the GetHTTPErrorsSectionsHandler interface using client-native client -type GetHTTPErrorsSectionsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceHTTPErrorsSectionHandlerImpl implementation of the ReplaceHTTPErrorsSectionHandler interface using client-native client -type ReplaceHTTPErrorsSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateHTTPErrorsSectionHandlerImpl) Handle(params http_errors.CreateHTTPErrorsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_errors.NewCreateHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewCreateHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateHTTPErrorsSection(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return http_errors.NewCreateHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewCreateHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - return http_errors.NewCreateHTTPErrorsSectionCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_errors.NewCreateHTTPErrorsSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return http_errors.NewCreateHTTPErrorsSectionAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteHTTPErrorsSectionHandlerImpl) Handle(params http_errors.DeleteHTTPErrorsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_errors.NewDeleteHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewDeleteHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteHTTPErrorsSection(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return http_errors.NewDeleteHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewDeleteHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - return http_errors.NewDeleteHTTPErrorsSectionNoContent() - } - rID := h.ReloadAgent.Reload() - return http_errors.NewDeleteHTTPErrorsSectionAccepted().WithReloadID(rID) - } - - return http_errors.NewDeleteHTTPErrorsSectionAccepted() -} - -// Handle executing the request and returning a response -func (h *GetHTTPErrorsSectionHandlerImpl) Handle(params http_errors.GetHTTPErrorsSectionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewGetHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - _, ms, err := configuration.GetHTTPErrorsSection(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return http_errors.NewGetHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - return http_errors.NewGetHTTPErrorsSectionOK().WithPayload(ms) -} - -// Handle executing the request and returning a response -func (h *GetHTTPErrorsSectionsHandlerImpl) Handle(params http_errors.GetHTTPErrorsSectionsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewGetHTTPErrorsSectionsDefault(int(*e.Code)).WithPayload(e) - } - - _, ms, err := configuration.GetHTTPErrorsSections(t) - if err != nil { - e := misc.HandleError(err) - return http_errors.NewGetHTTPErrorsSectionsDefault(int(*e.Code)).WithPayload(e) - } - - return http_errors.NewGetHTTPErrorsSectionsOK().WithPayload(ms) -} - -func (h *ReplaceHTTPErrorsSectionHandlerImpl) Handle(params http_errors.ReplaceHTTPErrorsSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_errors.NewReplaceHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_errors.NewReplaceHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditHTTPErrorsSection(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_errors.NewReplaceHTTPErrorsSectionDefault(int(*e.Code)).WithPayload(e) - } - - return http_errors.NewReplaceHTTPErrorsSectionOK().WithPayload(params.Data) -} diff --git a/handlers/http_request_rule.go b/handlers/http_request_rule.go deleted file mode 100644 index 4e378f8e..00000000 --- a/handlers/http_request_rule.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_request_rule" -) - -// CreateHTTPRequestRuleHandlerImpl implementation of the CreateHTTPRequestRuleHandler interface using client-native client -type CreateHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteHTTPRequestRuleHandlerImpl implementation of the DeleteHTTPRequestRuleHandler interface using client-native client -type DeleteHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetHTTPRequestRuleHandlerImpl implementation of the GetHTTPRequestRuleHandler interface using client-native client -type GetHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllHTTPRequestRuleHandlerImpl implementation of the GetHTTPRequestRulesHandler interface using client-native client -type GetAllHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceHTTPRequestRuleHandlerImpl implementation of the ReplaceHTTPRequestRuleHandler interface using client-native client -type ReplaceHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllHTTPRequestRuleHandlerImpl implementation of the ReplaceHTTPRequestRulesHandler interface using client-native client -type ReplaceAllHTTPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.CreateHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_request_rule.NewCreateHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewCreateHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateHTTPRequestRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewCreateHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewCreateHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewCreateHTTPRequestRuleBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_request_rule.NewCreateHTTPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_request_rule.NewCreateHTTPRequestRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.DeleteHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_request_rule.NewDeleteHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewDeleteHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteHTTPRequestRule(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewDeleteHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewDeleteHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewDeleteHTTPRequestRuleBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return http_request_rule.NewDeleteHTTPRequestRuleBackendAccepted().WithReloadID(rID) - } - return http_request_rule.NewDeleteHTTPRequestRuleBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.GetHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewGetHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetHTTPRequestRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewGetHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewGetHTTPRequestRuleBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.GetAllHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewGetHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetHTTPRequestRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return http_request_rule.NewGetAllHTTPRequestRuleBackendOK().WithPayload(models.HTTPRequestRules{}) - } - return http_request_rule.NewGetAllHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewGetAllHTTPRequestRuleBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.ReplaceHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_request_rule.NewReplaceHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditHTTPRequestRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewReplaceHTTPRequestRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_request_rule.NewReplaceHTTPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_request_rule.NewReplaceHTTPRequestRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllHTTPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_request_rule.ReplaceAllHTTPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceHTTPRequestRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_request_rule.NewReplaceAllHTTPRequestRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/http_response_rule.go b/handlers/http_response_rule.go deleted file mode 100644 index b244a7bd..00000000 --- a/handlers/http_response_rule.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/http_response_rule" -) - -// CreateHTTPResponseRuleHandlerImpl implementation of the CreateHTTPResponseRuleHandler interface using client-native client -type CreateHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteHTTPResponseRuleHandlerImpl implementation of the DeleteHTTPResponseRuleHandler interface using client-native client -type DeleteHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetHTTPResponseRuleHandlerImpl implementation of the GetHTTPResponseRuleHandler interface using client-native client -type GetHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllHTTPResponseRuleHandlerImpl implementation of the GetHTTPResponseRulesHandler interface using client-native client -type GetAllHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceHTTPResponseRuleHandlerImpl implementation of the ReplaceHTTPResponseRuleHandler interface using client-native client -type ReplaceHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllHTTPResponseRuleHandlerImpl implementation of the ReplaceHTTPResponseRulesHandler interface using client-native client -type ReplaceAllHTTPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.CreateHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_response_rule.NewCreateHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewCreateHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateHTTPResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewCreateHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewCreateHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewCreateHTTPResponseRuleBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_response_rule.NewCreateHTTPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_response_rule.NewCreateHTTPResponseRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.DeleteHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_response_rule.NewDeleteHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewDeleteHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteHTTPResponseRule(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewDeleteHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewDeleteHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewDeleteHTTPResponseRuleBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return http_response_rule.NewDeleteHTTPResponseRuleBackendAccepted().WithReloadID(rID) - } - return http_response_rule.NewDeleteHTTPResponseRuleBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.GetHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewCreateHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetHTTPResponseRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewGetHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewGetHTTPResponseRuleBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.GetAllHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewGetHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetHTTPResponseRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return http_response_rule.NewGetAllHTTPResponseRuleBackendOK().WithPayload(models.HTTPResponseRules{}) - } - return http_response_rule.NewGetAllHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewGetAllHTTPResponseRuleBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.ReplaceHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_response_rule.NewReplaceHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditHTTPResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewReplaceHTTPResponseRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_response_rule.NewReplaceHTTPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_response_rule.NewReplaceHTTPResponseRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllHTTPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params http_response_rule.ReplaceAllHTTPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceHTTPResponseRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return http_response_rule.NewReplaceAllHTTPResponseRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/information.go b/handlers/information.go deleted file mode 100644 index 723fcf5b..00000000 --- a/handlers/information.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "bufio" - "bytes" - "fmt" - "os" - "runtime" - "strings" - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/shirou/gopsutil/host" - "github.com/shirou/gopsutil/mem" - "golang.org/x/sys/unix" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/information" -) - -// GetHaproxyProcessInfoHandlerImpl implementation of the GetHaproxyProcessInfoHandler interface using client-native client -type GetHaproxyProcessInfoHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetHaproxyProcessInfoHandlerImpl) Handle(params information.GetHaproxyProcessInfoParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return information.NewGetHaproxyProcessInfoDefault(int(*e.Code)).WithPayload(e) - } - info, err := runtime.GetInfo() - if err != nil { - code := misc.ErrHTTPInternalServerError - msg := err.Error() - e := &models.Error{ - Code: &code, - Message: &msg, - } - return information.NewGetHaproxyProcessInfoDefault(int(misc.ErrHTTPInternalServerError)).WithPayload(e) - } - - return information.NewGetHaproxyProcessInfoOK().WithPayload(&info) -} - -// GetInfoHandlerImpl implementation of the GetInfoHandler interface -type GetInfoHandlerImpl struct { - BuildTime string - Version string - SystemInfo bool -} - -// Handle executing the request and returning a response -func (h *GetInfoHandlerImpl) Handle(params information.GetInfoParams, principal any) middleware.Responder { - api := &models.InfoAPI{ - Version: h.Version, - } - date, err := time.Parse("2006-01-02T15:04:05Z", h.BuildTime) - if err == nil { - api.BuildDate = strfmt.DateTime(date) - } else { - fmt.Println(err.Error()) - } - - sys := &models.InfoSystem{} - - if h.SystemInfo { - hName, err := os.Hostname() - if err == nil { - sys.Hostname = hName - } - - sys.MemInfo = &models.InfoSystemMemInfo{} - sys.CPUInfo = &models.InfoSystemCPUInfo{} - - mem, err := mem.VirtualMemory() - if err == nil { - sys.MemInfo.TotalMemory = int64(mem.Total) - sys.MemInfo.FreeMemory = int64(mem.Free) - } - if uptime, err := host.Uptime(); err == nil { - uptimeInt64 := int64(uptime) - sys.Uptime = &uptimeInt64 - } - - sys.CPUInfo.NumCpus = int64(runtime.NumCPU()) - - m := &runtime.MemStats{} - runtime.ReadMemStats(m) - sys.MemInfo.DataplaneapiMemory = int64(m.Sys) - - sys.CPUInfo.Model = parseCPUModel() - - uName := &unix.Utsname{} - err = unix.Uname(uName) - if err == nil { - sys.OsString = string(bytes.Trim(uName.Sysname[:], "\x00")) + " " + string(bytes.Trim(uName.Release[:], "\x00")) + " " + string(bytes.Trim(uName.Version[:], "\x00")) - } - sys.Time = time.Now().Unix() - } - - return information.NewGetInfoOK().WithPayload(&models.Info{API: api, System: sys}) -} - -func parseCPUModel() string { - file, err := os.Open("/proc/cpuinfo") - if err != nil { - return "" - } - defer file.Close() - - scanner := bufio.NewScanner(file) - for scanner.Scan() { - l := scanner.Text() - if strings.HasPrefix(l, "model name") { - s := strings.Split(l, ":") - return strings.TrimSpace(strings.Join(s[1:], ":")) - } - } - - if err := scanner.Err(); err != nil { - return "" - } - - return "" -} diff --git a/handlers/log_forward.go b/handlers/log_forward.go deleted file mode 100644 index f66fec4b..00000000 --- a/handlers/log_forward.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/log_forward" -) - -// CreateLogForwardHandlerImpl implementation of the CreateLogForwardHandler interface using client-native client -type CreateLogForwardHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteLogForwardHandlerImpl implementation of the DeleteLogForwardHandler interface using client-native client -type DeleteLogForwardHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetLogForwardHandlerImpl implementation of the GetLogForwardHandler interface using client-native client -type GetLogForwardHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetLogForwardsHandlerImpl implementation of the GetLogForwardsHandler interface using client-native client -type GetLogForwardsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceLogForwardHandlerImpl implementation of the ReplaceLogForwardHandler interface using client-native client -type ReplaceLogForwardHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateLogForwardHandlerImpl) Handle(params log_forward.CreateLogForwardParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_forward.NewCreateLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createLogForward(params, t, v) - if err != nil { - e := misc.HandleError(err) - return log_forward.NewCreateLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_forward.NewCreateLogForwardDefault(int(*e.Code)).WithPayload(e) - } - return log_forward.NewCreateLogForwardCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_forward.NewCreateLogForwardAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return log_forward.NewCreateLogForwardAccepted().WithPayload(params.Data) -} - -func (h *CreateLogForwardHandlerImpl) createLogForward(params log_forward.CreateLogForwardParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredLogForward(params.Data, t, v) - } - return configuration.CreateLogForward(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteLogForwardHandlerImpl) Handle(params log_forward.DeleteLogForwardParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_forward.NewDeleteLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_forward.NewDeleteLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteLogForward(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return log_forward.NewDeleteLogForwardDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_forward.NewDeleteLogForwardDefault(int(*e.Code)).WithPayload(e) - } - return log_forward.NewDeleteLogForwardNoContent() - } - rID := h.ReloadAgent.Reload() - return log_forward.NewDeleteLogForwardAccepted().WithReloadID(rID) - } - return log_forward.NewDeleteLogForwardAccepted() -} - -// Handle executing the request and returning a response -func (h *GetLogForwardHandlerImpl) Handle(params log_forward.GetLogForwardParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bck, err := h.getLogForward(params, t) - if err != nil { - e := misc.HandleError(err) - return log_forward.NewGetLogForwardDefault(int(*e.Code)).WithPayload(e) - } - return log_forward.NewGetLogForwardOK().WithPayload(bck) -} - -func (h *GetLogForwardHandlerImpl) getLogForward(params log_forward.GetLogForwardParams, t string) (int64, *models.LogForward, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredLogForward(params.Name, t) - } - return configuration.GetLogForward(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetLogForwardsHandlerImpl) Handle(params log_forward.GetLogForwardsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bcks, err := h.getLogForwards(params, t) - if err != nil { - e := misc.HandleError(err) - return log_forward.NewGetLogForwardsDefault(int(*e.Code)).WithPayload(e) - } - return log_forward.NewGetLogForwardsOK().WithPayload(bcks) -} - -func (h *GetLogForwardsHandlerImpl) getLogForwards(params log_forward.GetLogForwardsParams, t string) (int64, models.LogForwards, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredLogForwards(t) - } - return configuration.GetLogForwards(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceLogForwardHandlerImpl) Handle(params log_forward.ReplaceLogForwardParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_forward.NewReplaceLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - err := h.editLogForward(params, t, v) - if err != nil { - e := misc.HandleError(err) - return log_forward.NewReplaceLogForwardDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_forward.NewReplaceLogForwardDefault(int(*e.Code)).WithPayload(e) - } - return log_forward.NewReplaceLogForwardOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_forward.NewReplaceLogForwardAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return log_forward.NewReplaceLogForwardAccepted().WithPayload(params.Data) -} - -func (h *ReplaceLogForwardHandlerImpl) editLogForward(params log_forward.ReplaceLogForwardParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredLogForward(params.Name, params.Data, t, v) - } - return configuration.EditLogForward(params.Name, params.Data, t, v) -} diff --git a/handlers/log_profile.go b/handlers/log_profile.go deleted file mode 100644 index f684a1be..00000000 --- a/handlers/log_profile.go +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/log_profile" -) - -type GetLogProfilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get all log-profiles -func (h *GetLogProfilesHandlerImpl) Handle(params log_profile.GetLogProfilesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewGetLogProfilesDefault(int(*e.Code)).WithPayload(e) - } - - _, profiles, err := configuration.GetLogProfiles(t) - if err != nil { - e := misc.HandleError(err) - return log_profile.NewGetLogProfilesDefault(int(*e.Code)).WithPayload(e) - } - - return log_profile.NewGetLogProfilesOK().WithPayload(profiles) -} - -type GetLogProfileHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get one log-profile -func (h *GetLogProfileHandlerImpl) Handle(params log_profile.GetLogProfileParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewGetLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - _, profile, err := configuration.GetLogProfile(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return log_profile.NewGetLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - return log_profile.NewGetLogProfileOK().WithPayload(profile) -} - -type CreateLogProfileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateLogProfileHandlerImpl) Handle(params log_profile.CreateLogProfileParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_profile.NewCreateLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewCreateLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateLogProfile(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return log_profile.NewCreateLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewCreateLogProfileDefault(int(*e.Code)).WithPayload(e) - } - return log_profile.NewCreateLogProfileCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_profile.NewCreateLogProfileAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return log_profile.NewCreateLogProfileAccepted().WithPayload(params.Data) -} - -type EditLogProfileHandler struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *EditLogProfileHandler) Handle(params log_profile.EditLogProfileParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_profile.NewEditLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewEditLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditLogProfile(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return log_profile.NewEditLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - return log_profile.NewEditLogProfileOK().WithPayload(params.Data) -} - -type DeleteLogProfileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteLogProfileHandlerImpl) Handle(params log_profile.DeleteLogProfileParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_profile.NewDeleteLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewDeleteLogProfileDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteLogProfile(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return log_profile.NewDeleteLogProfileDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_profile.NewDeleteLogProfileDefault(int(*e.Code)).WithPayload(e) - } - return log_profile.NewDeleteLogProfileNoContent() - } - rID := h.ReloadAgent.Reload() - return log_profile.NewDeleteLogProfileAccepted().WithReloadID(rID) - } - - return log_profile.NewDeleteLogProfileAccepted() -} diff --git a/handlers/log_target.go b/handlers/log_target.go deleted file mode 100644 index e6767a9e..00000000 --- a/handlers/log_target.go +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/log_target" -) - -// CreateLogTargetHandlerImpl implementation of the CreateLogTargetHandler interface using client-native client -type CreateLogTargetHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteLogTargetHandlerImpl implementation of the DeleteLogTargetHandler interface using client-native client -type DeleteLogTargetHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetLogTargetHandlerImpl implementation of the GetLogTargetHandler interface using client-native client -type GetLogTargetHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllLogTargetHandlerImpl implementation of the GetLogTargetsHandler interface using client-native client -type GetAllLogTargetHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceLogTargetHandlerImpl implementation of the ReplaceLogTargetHandler interface using client-native client -type ReplaceLogTargetHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllLogTargetHandlerImpl implementation of the ReplaceLogTargetsHandler interface using client-native client -type ReplaceAllLogTargetHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.CreateLogTargetBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_target.NewCreateLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewCreateLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateLogTarget(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return log_target.NewCreateLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_target.NewCreateLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewCreateLogTargetBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_target.NewCreateLogTargetBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return log_target.NewCreateLogTargetBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.DeleteLogTargetBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_target.NewDeleteLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewDeleteLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteLogTarget(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return log_target.NewDeleteLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_target.NewDeleteLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewDeleteLogTargetBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return log_target.NewDeleteLogTargetBackendAccepted().WithReloadID(rID) - } - return log_target.NewDeleteLogTargetBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.GetLogTargetBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewGetLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, logTarget, err := configuration.GetLogTarget(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return log_target.NewGetLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewGetLogTargetBackendOK().WithPayload(logTarget) -} - -// Handle executing the request and returning a response -func (h *GetAllLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.GetAllLogTargetBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewGetAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, logTargets, err := configuration.GetLogTargets(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return log_target.NewGetAllLogTargetBackendOK().WithPayload(models.LogTargets{}) - } - return log_target.NewGetAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewGetAllLogTargetBackendOK().WithPayload(logTargets) -} - -// Handle executing the request and returning a response -func (h *ReplaceLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.ReplaceLogTargetBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_target.NewReplaceLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditLogTarget(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewReplaceLogTargetBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_target.NewReplaceLogTargetBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return log_target.NewReplaceLogTargetBackendAccepted().WithPayload(params.Data) -} - -func logTargetParentTypeRequiresParentName(parentType string) bool { - return (parentType == "frontend" || parentType == "backend" || parentType == "peers" || parentType == "log_forward") -} - -// Handle executing the request and returning a response -func (h *ReplaceAllLogTargetHandlerImpl) Handle(parentType cnconstants.CnParentType, params log_target.ReplaceAllLogTargetBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return log_target.NewReplaceAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.ReplaceLogTargets(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return log_target.NewReplaceAllLogTargetBackendDefault(int(*e.Code)).WithPayload(e) - } - return log_target.NewReplaceAllLogTargetBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return log_target.NewReplaceAllLogTargetBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return log_target.NewReplaceAllLogTargetBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/mailer_entry.go b/handlers/mailer_entry.go deleted file mode 100644 index 2f75df65..00000000 --- a/handlers/mailer_entry.go +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/mailer_entry" -) - -type CreateMailerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type DeleteMailerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type GetMailerEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -type GetMailerEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -type ReplaceMailerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateMailerEntryHandlerImpl) Handle(params mailer_entry.CreateMailerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailer_entry.NewCreateMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewCreateMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateMailerEntry(params.MailersSection, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewCreateMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewCreateMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - return mailer_entry.NewCreateMailerEntryCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return mailer_entry.NewCreateMailerEntryAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return mailer_entry.NewCreateMailerEntryAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteMailerEntryHandlerImpl) Handle(params mailer_entry.DeleteMailerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailer_entry.NewDeleteMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewDeleteMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteMailerEntry(params.Name, params.MailersSection, t, v) - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewDeleteMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewDeleteMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - return mailer_entry.NewDeleteMailerEntryNoContent() - } - rID := h.ReloadAgent.Reload() - return mailer_entry.NewDeleteMailerEntryAccepted().WithReloadID(rID) - } - return mailer_entry.NewDeleteMailerEntryAccepted() -} - -// Handle executing the request and returning a response -func (h *GetMailerEntryHandlerImpl) Handle(params mailer_entry.GetMailerEntryParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewGetMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - _, me, err := configuration.GetMailerEntry(params.Name, params.MailersSection, t) - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewGetMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - return mailer_entry.NewGetMailerEntryOK().WithPayload(me) -} - -// Handle executing the request and returning a response -func (h *GetMailerEntriesHandlerImpl) Handle(params mailer_entry.GetMailerEntriesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewGetMailerEntriesDefault(int(*e.Code)).WithPayload(e) - } - - _, mes, err := configuration.GetMailerEntries(params.MailersSection, t) - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewGetMailerEntriesDefault(int(*e.Code)).WithPayload(e) - } - return mailer_entry.NewGetMailerEntriesOK().WithPayload(mes) -} - -// Handle executing the request and returning a response -func (h *ReplaceMailerEntryHandlerImpl) Handle(params mailer_entry.ReplaceMailerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailer_entry.NewReplaceMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewReplaceMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditMailerEntry(params.Name, params.MailersSection, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewReplaceMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return mailer_entry.NewReplaceMailerEntryDefault(int(*e.Code)).WithPayload(e) - } - return mailer_entry.NewReplaceMailerEntryOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return mailer_entry.NewReplaceMailerEntryAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return mailer_entry.NewReplaceMailerEntryAccepted().WithPayload(params.Data) -} diff --git a/handlers/mailers.go b/handlers/mailers.go deleted file mode 100644 index 58584dd8..00000000 --- a/handlers/mailers.go +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/mailers" -) - -// CreateMailersSectionHandlerImpl implementation of the CreateMailersSectionHandler interface using client-native client -type CreateMailersSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteMailersSectionHandlerImpl implementation of the DeleteMailersSectionHandler interface using client-native client -type DeleteMailersSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetMailersSectionHandlerImpl implementation of the GetMailersSectionHandler interface using client-native client -type GetMailersSectionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetMailersSectionsHandlerImpl implementation of the GetMailersSectionsHandler interface using client-native client -type GetMailersSectionsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// EditMailersSectionHandlerImpl implementation of the EditMailersSectionHandler interface using client-native client -type EditMailersSectionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateMailersSectionHandlerImpl) Handle(params mailers.CreateMailersSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailers.NewCreateMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - if err := h.createMailersSection(params, t, v); err != nil { - e := misc.HandleError(err) - return mailers.NewCreateMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return mailers.NewCreateMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - return mailers.NewCreateMailersSectionCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return mailers.NewCreateMailersSectionAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return mailers.NewCreateMailersSectionAccepted().WithPayload(params.Data) -} - -func (h *CreateMailersSectionHandlerImpl) createMailersSection(params mailers.CreateMailersSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredMailersSection(params.Data, t, v) - } - return configuration.CreateMailersSection(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteMailersSectionHandlerImpl) Handle(params mailers.DeleteMailersSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailers.NewDeleteMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return mailers.NewDeleteMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteMailersSection(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return mailers.NewDeleteMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return mailers.NewDeleteMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - return mailers.NewDeleteMailersSectionNoContent() - } - rID := h.ReloadAgent.Reload() - return mailers.NewDeleteMailersSectionAccepted().WithReloadID(rID) - } - - return mailers.NewDeleteMailersSectionAccepted() -} - -// Handle executing the request and returning a response -func (h *GetMailersSectionHandlerImpl) Handle(params mailers.GetMailersSectionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, ms, err := h.getMailersSection(params, t) - if err != nil { - e := misc.HandleError(err) - return mailers.NewGetMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - return mailers.NewGetMailersSectionOK().WithPayload(ms) -} - -func (h *GetMailersSectionHandlerImpl) getMailersSection(params mailers.GetMailersSectionParams, t string) (int64, *models.MailersSection, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredMailersSection(params.Name, t) - } - return configuration.GetMailersSection(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetMailersSectionsHandlerImpl) Handle(params mailers.GetMailersSectionsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, ms, err := h.getMailersSections(params, t) - if err != nil { - e := misc.HandleError(err) - return mailers.NewGetMailersSectionsDefault(int(*e.Code)).WithPayload(e) - } - - return mailers.NewGetMailersSectionsOK().WithPayload(ms) -} - -func (h *GetMailersSectionsHandlerImpl) getMailersSections(params mailers.GetMailersSectionsParams, t string) (int64, models.MailersSections, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredMailersSections(t) - } - return configuration.GetMailersSections(t) -} - -func (h *EditMailersSectionHandlerImpl) Handle(params mailers.EditMailersSectionParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return mailers.NewEditMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - err := h.editMailersSection(params, t, v) - if err != nil { - e := misc.HandleError(err) - return mailers.NewEditMailersSectionDefault(int(*e.Code)).WithPayload(e) - } - - return mailers.NewEditMailersSectionOK().WithPayload(params.Data) -} - -func (h *EditMailersSectionHandlerImpl) editMailersSection(params mailers.EditMailersSectionParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredMailersSection(params.Name, params.Data, t, v) - } - return configuration.EditMailersSection(params.Name, params.Data, t, v) -} diff --git a/handlers/map.go b/handlers/map.go deleted file mode 100644 index e7b0a8af..00000000 --- a/handlers/map.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "path/filepath" - "strings" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - config "github.com/haproxytech/dataplaneapi/configuration" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/maps" -) - -// GetMapsHandlerImpl implementation of the GetAllRuntimeMapFilesHandler interface using client-native client -type GetMapsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetMapsHandlerImpl) Handle(params maps.GetAllRuntimeMapFilesParams, principal any) middleware.Responder { - mapList := []*models.Map{} - - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewShowRuntimeMapDefault(int(*e.Code)).WithPayload(e) - } - - runtimeMaps, err := runtime.ShowMaps() - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewShowRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - - mapsDir, err := runtime.GetMapsDir() - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewShowRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - - for _, m := range runtimeMaps { - if *params.IncludeUnmanaged || strings.HasPrefix(filepath.Dir(m.File), mapsDir) { - if strings.HasPrefix(filepath.Dir(m.File), mapsDir) { - m.StorageName = filepath.Base(m.File) - } - mapList = append(mapList, m) - } - } - return maps.NewGetAllRuntimeMapFilesOK().WithPayload(mapList) -} - -// GetMapHandlerImpl implementation of the MapsGetOneRuntimeMapHandler interface using client-native client -type GetMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetMapHandlerImpl) Handle(params maps.GetOneRuntimeMapParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewGetOneRuntimeMapDefault(int(*e.Code)).WithPayload(e) - } - - m, err := runtime.GetMap(params.Name) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewGetOneRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if m == nil { - return maps.NewGetOneRuntimeMapNotFound() - } - return maps.NewGetOneRuntimeMapOK().WithPayload(m) -} - -// ClearMapHandlerImpl implementation of the ClearRuntimeMapHandler interface using client-native client -type ClearMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *ClearMapHandlerImpl) Handle(params maps.ClearRuntimeMapParams, principal any) middleware.Responder { - forceDelete := false - if params.ForceDelete != nil { - forceDelete = *params.ForceDelete - } - - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewClearRuntimeMapDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.ClearMap(params.Name, forceDelete) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewClearRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if *params.ForceSync { - m, err := runtime.GetMap(params.Name) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewClearRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - ms := config.NewMapSync() - _, err = ms.Sync(m, h.Client) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewClearRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - } - return maps.NewClearRuntimeMapNoContent() -} - -// ShowMapHandlerImpl implementation of the ShowMapHandlerImpl interface using client-native client -type ShowMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *ShowMapHandlerImpl) Handle(params maps.ShowRuntimeMapParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewShowRuntimeMapDefault(int(*e.Code)).WithPayload(e) - } - m, err := runtime.ShowMapEntries(params.ParentName) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewShowRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if m == nil { - return maps.NewShowRuntimeMapNotFound() - } - return maps.NewShowRuntimeMapOK().WithPayload(m) -} - -// AddMapEntryHandlerImpl implementation of the AddMapEntryHandler interface using client-native client -type AddMapEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *AddMapEntryHandlerImpl) Handle(params maps.AddMapEntryParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewAddMapEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.AddMapEntry(params.ParentName, params.Data.Key, params.Data.Value) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if *params.ForceSync { - m, err := runtime.GetMap(params.ParentName) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - ms := config.NewMapSync() - _, err = ms.Sync(m, h.Client) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - } - return maps.NewAddMapEntryCreated().WithPayload(params.Data) -} - -type MapsAddPayloadRuntimeMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *MapsAddPayloadRuntimeMapHandlerImpl) Handle(params maps.AddPayloadRuntimeMapParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewAddPayloadRuntimeMapDefault(int(*e.Code)).WithPayload(e) - } - err = runtime.AddMapPayloadVersioned(params.Name, params.Data) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddPayloadRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if *params.ForceSync { - m, err := runtime.GetMap(params.Name) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddPayloadRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - ms := config.NewMapSync() - _, err = ms.Sync(m, h.Client) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewAddPayloadRuntimeMapDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - } - return maps.NewAddPayloadRuntimeMapCreated().WithPayload(params.Data) -} - -// GetRuntimeMapEntryHandlerImpl implementation of the GetRuntimeMapEntryHandler interface using client-native client -type GetRuntimeMapEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetRuntimeMapEntryHandlerImpl) Handle(params maps.GetRuntimeMapEntryParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewReplaceRuntimeMapEntryDefault(int(*e.Code)).WithPayload(e) - } - m, err := runtime.GetMapEntry(params.ParentName, params.ID) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewGetRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if m == nil { - return maps.NewGetRuntimeMapEntryNotFound() - } - return maps.NewGetRuntimeMapEntryOK().WithPayload(m) -} - -// ReplaceRuntimeMapEntryHandlerImpl implementation of the ReplaceRuntimeMapEntryHandler interface using client-native client -type ReplaceRuntimeMapEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *ReplaceRuntimeMapEntryHandlerImpl) Handle(params maps.ReplaceRuntimeMapEntryParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewReplaceRuntimeMapEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetMapEntry(params.ParentName, params.ID, *params.Data.Value) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewGetRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - e, err := runtime.GetMapEntry(params.ParentName, params.ID) - if err != nil { - return maps.NewReplaceRuntimeMapEntryNotFound() - } - if *params.ForceSync { - m, err := runtime.GetMap(params.ParentName) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewGetRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - ms := config.NewMapSync() - _, err = ms.Sync(m, h.Client) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewGetRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - } - return maps.NewGetRuntimeMapEntryOK().WithPayload(e) -} - -// DeleteRuntimeMapEntryHandlerImpl implementation of the DeleteRuntimeMapEntryHandler interface using client-native client -type DeleteRuntimeMapEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *DeleteRuntimeMapEntryHandlerImpl) Handle(params maps.DeleteRuntimeMapEntryParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return maps.NewDeleteRuntimeMapEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.DeleteMapEntry(params.ParentName, params.ID) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewDeleteRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - if *params.ForceSync { - m, err := runtime.GetMap(params.ParentName) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewDeleteRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - ms := config.NewMapSync() - _, err = ms.Sync(m, h.Client) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return maps.NewDeleteRuntimeMapEntryDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - } - return maps.NewDeleteRuntimeMapEntryNoContent() -} diff --git a/handlers/map_storage.go b/handlers/map_storage.go deleted file mode 100644 index f819fdb1..00000000 --- a/handlers/map_storage.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "bufio" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - models "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/storage" -) - -// StorageCreateStorageMapFileHandlerImpl implementation of the StorageCreateStorageMapFileHandler interface using client-native client -type StorageCreateStorageMapFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageCreateStorageMapFileHandlerImpl) Handle(params storage.CreateStorageMapFileParams, principal any) middleware.Responder { - file, ok := params.FileUpload.(*runtime.File) - if !ok { - return storage.NewCreateStorageMapFileBadRequest() - } - - st, err := h.Client.MapStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, size, err := st.Create(file.Header.Filename, params.FileUpload) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return storage.NewCreateStorageMapFileDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - - me := &models.Map{ - Description: "managed but not loaded map file (no runtime ID)", - File: filename, - StorageName: filepath.Base(filename), - Size: &size, - } - // no reload or force reload since this is just a file upload, - // haproxy configuration has not been changed - return storage.NewCreateStorageMapFileCreated().WithPayload(me) -} - -// GetMapStorageHandlerImpl implementation of the StorageGetAllStorageMapFilesHandler interface -type GetAllStorageMapFilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetAllStorageMapFilesHandlerImpl) Handle(params storage.GetAllStorageMapFilesParams, principal any) middleware.Responder { - st, err := h.Client.MapStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - // get filenames for files in storage - filenames, err := st.GetAll() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageMapFilesDefault(int(*e.Code)).WithPayload(e) - } - - retMaps := models.Maps{} - for _, f := range filenames { - retMaps = append(retMaps, &models.Map{ - Description: "managed map file", - File: f, - ID: "", - StorageName: filepath.Base(f), - }) - } - - return &storage.GetAllStorageMapFilesOK{Payload: retMaps} -} - -// StorageGetOneStorageMapHandlerImpl implementation of the StorageGetOneStorageMapHandler interface -type GetOneStorageMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *GetOneStorageMapHandlerImpl) Handle(params storage.GetOneStorageMapParams, principal any) middleware.Responder { - st, err := h.Client.MapStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageMapFilesDefault(int(*e.Code)).WithPayload(e) - } - - filename, _, err := st.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageMapDefault(int(*e.Code)).WithPayload(e) - } - if filename == "" { - return storage.NewGetOneStorageMapNotFound() - } - f, err := os.Open(filename) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageMapDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewGetOneStorageMapOK().WithPayload(f) -} - -// StorageDeleteStorageMapHandlerImpl implementation of the StorageDeleteStorageMapHandler interface -type StorageDeleteStorageMapHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageDeleteStorageMapHandlerImpl) Handle(params storage.DeleteStorageMapParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - st, err := h.Client.MapStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - runningConf := strings.NewReader(configuration.Parser().String()) - - filename, _, err := st.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - // this is far from perfect but should provide a basic level of protection - scanner := bufio.NewScanner(runningConf) - - lineNr := 0 - - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { - errCode := misc.ErrHTTPConflict - errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) - e := &models.Error{Code: &errCode, Message: &errMsg} - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - lineNr++ - } - - err = st.Delete(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageMapDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewDeleteStorageMapNoContent() -} - -// StorageReplaceStorageMapFileHandlerImpl implementation of the StorageReplaceStorageMapFileHandler interface -type StorageReplaceStorageMapFileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageReplaceStorageMapFileHandlerImpl) Handle(params storage.ReplaceStorageMapFileParams, principal any) middleware.Responder { - st, err := h.Client.MapStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - _, err = st.Replace(params.Name, params.Data) - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewReplaceStorageMapFileNoContent() - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewReplaceStorageMapFileNoContent() - } - rID := h.ReloadAgent.Reload() - return storage.NewReplaceStorageMapFileAccepted().WithReloadID(rID) -} diff --git a/handlers/middleware/middleware.go b/handlers/middleware/middleware.go new file mode 100644 index 00000000..fdaba70c --- /dev/null +++ b/handlers/middleware/middleware.go @@ -0,0 +1,264 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "errors" + "fmt" + "net/http" + "net/url" + "slices" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/getkin/kin-openapi/openapi3filter" + "github.com/getkin/kin-openapi/routers" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// NewValidator returns a middleware that validates incoming requests against spec. +// Call it with the result of a handler package's GetSpec() function. +// +// The middleware runs inside the oapi-codegen wrapper, after chi has already +// matched the route, so the OpenAPI operation is resolved from chi's route +// context instead of a second routing pass: the generated registrations use +// the spec's path strings verbatim and chi shares OpenAPI's {param} +// placeholder syntax, making the matched chi pattern (minus the server-URL +// mount prefix) the spec path key. +// +// On top of openapi3filter request validation it restores two go-swagger +// behaviours: 406 when the Accept header matches none of the operation's +// response content types, and 415 when the request Content-Type is not +// accepted by the operation. +func NewValidator(spec *openapi3.T) func(http.Handler) http.Handler { + var serverPrefix string + if len(spec.Servers) > 0 { + serverPrefix = spec.Servers[0].URL + } + specRoutes := make(map[string]*routers.Route) + for path, item := range spec.Paths.Map() { + for method, op := range item.Operations() { + specRoutes[method+" "+path] = &routers.Route{ + Spec: spec, + Path: path, + PathItem: item, + Method: method, + Operation: op, + } + } + } + filterOptions := &openapi3filter.Options{ + ExcludeReadOnlyValidations: true, + } + // Multipart operations skip body validation entirely: openapi3filter buffers + // the whole body in memory to validate it (go-swagger streamed uploads to + // disk), and every multipart body in this API is a single opaque + // "file_upload" binary part with nothing to validate. The handlers' + // ParseMultipartForm/FormFile calls stream the upload and already reject a + // missing part. The Content-Type check that openapi3filter would have done + // (415) is preserved below. + multipartFilterOptions := &openapi3filter.Options{ + ExcludeReadOnlyValidations: true, + ExcludeRequestBody: true, + } + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + route, pathParams := findRoute(specRoutes, serverPrefix, r) + if route == nil { + // Unreachable in practice: this middleware is attached per-route + // by the generated chi registrations, so the matched chi pattern + // is always one of this package's spec paths. Keep a 404 fallback. + writeError(w, http.StatusNotFound, routers.ErrPathNotFound.Error()) + return + } + + if produced := responseContentTypes(route.Operation); len(produced) > 0 && !acceptable(r.Header.Get("Accept"), produced) { + // Same message go-swagger returned for a non-negotiable Accept header. + writeError(w, http.StatusNotAcceptable, + fmt.Sprintf("unsupported media type requested, only %v are available", produced)) + return + } + + options := filterOptions + if content := requestBodyContent(route.Operation); content["multipart/form-data"] != nil { + ct, _, _ := strings.Cut(r.Header.Get("Content-Type"), ";") + // Media types are case-insensitive (RFC 9110); the spec's + // content keys are lowercase. + if content[strings.ToLower(strings.TrimSpace(ct))] == nil { + writeError(w, http.StatusUnsupportedMediaType, + fmt.Sprintf("%s %q", prefixInvalidCT, ct)) + return + } + options = multipartFilterOptions + } + + err := openapi3filter.ValidateRequest(r.Context(), &openapi3filter.RequestValidationInput{ + Request: r, + PathParams: pathParams, + Route: route, + Options: options, + }) + if err != nil { + statusCode, msg := normalizeValidationError(err, http.StatusBadRequest) + writeError(w, statusCode, msg) + return + } + + next.ServeHTTP(w, r) + }) + } +} + +// findRoute resolves the OpenAPI operation for an already-routed request from chi's +// route context. serverPrefix (the spec's server URL, e.g. "/v3") is stripped from +// the matched pattern to obtain the spec path key. Parameter values are +// path-unescaped because chi matches on the raw (still-encoded) path when the URL +// has one, while the validator must see the decoded values. +func findRoute(specRoutes map[string]*routers.Route, serverPrefix string, r *http.Request) (*routers.Route, map[string]string) { + rctx := chi.RouteContext(r.Context()) + if rctx == nil { + return nil, nil + } + pattern := strings.TrimPrefix(rctx.RoutePattern(), serverPrefix) + route, ok := specRoutes[r.Method+" "+pattern] + if !ok { + return nil, nil + } + pathParams := make(map[string]string, len(rctx.URLParams.Keys)) + for i, k := range rctx.URLParams.Keys { + v := rctx.URLParams.Values[i] + if dec, err := url.PathUnescape(v); err == nil { + v = dec + } + pathParams[k] = v + } + return route, pathParams +} + +// writeError emits the validation error JSON shape. The body code mirrors the +// HTTP status, consistent with the rest of the API. +func writeError(w http.ResponseWriter, statusCode int, msg string) { + code := int64(statusCode) + respond.JSON(w, statusCode, &models.Error{Code: &code, Message: &msg}) +} + +// responseContentTypes returns the union of content types this operation can +// produce across all of its declared responses (the OpenAPI 3 equivalent of +// the swagger 2 "produces" list). +func responseContentTypes(op *openapi3.Operation) []string { + if op == nil || op.Responses == nil { + return nil + } + var out []string + for _, ref := range op.Responses.Map() { + if ref == nil || ref.Value == nil { + continue + } + for ct := range ref.Value.Content { + if !slices.Contains(out, ct) { + out = append(out, ct) + } + } + } + slices.Sort(out) + return out +} + +// requestBodyContent returns the operation's declared request body content +// map, or nil when the operation has no request body. +func requestBodyContent(op *openapi3.Operation) openapi3.Content { + if op == nil || op.RequestBody == nil || op.RequestBody.Value == nil { + return nil + } + return op.RequestBody.Value.Content +} + +// acceptable reports whether the Accept header allows at least one of the +// produced content types. An absent header accepts anything; q-values are +// ignored beyond presence. +func acceptable(accept string, produced []string) bool { + accept = strings.TrimSpace(accept) + if accept == "" { + return true + } + for r := range strings.SplitSeq(accept, ",") { + mediaRange, _, _ := strings.Cut(r, ";") + mediaRange = strings.ToLower(strings.TrimSpace(mediaRange)) + switch { + case mediaRange == "*/*": + return true + case strings.HasSuffix(mediaRange, "/*"): + prefix := strings.TrimSuffix(mediaRange, "*") + for _, ct := range produced { + if strings.HasPrefix(ct, prefix) { + return true + } + } + default: + if slices.Contains(produced, mediaRange) { + return true + } + } + } + return false +} + +// prefixInvalidCT is the reason openapi3filter sets on a RequestError when the +// request Content-Type is not declared by the operation (see +// openapi3filter/validate_request.go). go-swagger answered these with 415. +const prefixInvalidCT = "header Content-Type has unexpected value" + +// normalizeValidationError extracts a concise error message from the verbose +// openapi3filter error chain, keeping it close to the go-swagger format. +// Unsupported request content types return 415 and body schema violations +// return 422 to preserve parity with the old go-swagger behaviour; parameter +// errors return the suggested statusCode. +func normalizeValidationError(err error, statusCode int) (int, string) { + var maxBytesErr *http.MaxBytesError + if errors.As(err, &maxBytesErr) { + // The body hit the MaxBodySizeMiddleware cap while the validator was + // buffering it. + return http.StatusRequestEntityTooLarge, + fmt.Sprintf("request body exceeds the maximum allowed size of %d bytes", maxBytesErr.Limit) + } + var reqErr *openapi3filter.RequestError + if errors.As(err, &reqErr) { + if strings.HasPrefix(reqErr.Reason, prefixInvalidCT) { + return http.StatusUnsupportedMediaType, reqErr.Reason + } + var schemaErr *openapi3.SchemaError + if errors.As(reqErr.Err, &schemaErr) { + if reqErr.Parameter != nil { + return statusCode, fmt.Sprintf("%s in %s: %s", reqErr.Parameter.Name, reqErr.Parameter.In, schemaErr.Reason) + } + // Body schema violation — go-swagger returned 422 for these. + return http.StatusUnprocessableEntity, schemaErr.Error() + } + // No SchemaError — strip the generic "request body has an error: " prefix. + msg := strings.TrimPrefix(reqErr.Error(), "request body has an error: ") + return statusCode, msg + } + return statusCode, err.Error() +} + +// ErrorHandler is the shared ChiServerOptions.ErrorHandlerFunc used by all handler +// packages. It converts oapi-codegen parameter-binding errors (RequiredParamError, +// InvalidParamFormatError, etc.) into JSON 400 responses. +func ErrorHandler(w http.ResponseWriter, r *http.Request, err error) { + respond.BadRequest(w, err.Error()) +} diff --git a/handlers/middleware/middleware_test.go b/handlers/middleware/middleware_test.go new file mode 100644 index 00000000..f99c1635 --- /dev/null +++ b/handlers/middleware/middleware_test.go @@ -0,0 +1,261 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "bytes" + "mime/multipart" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" +) + +const testSpec = ` +openapi: "3.0.1" +info: + title: test + version: "1" +servers: + - url: /v3 +paths: + /things: + get: + parameters: + - name: limit + in: query + schema: + type: integer + minimum: 1 + responses: + '200': + description: ok + content: + application/json: + schema: + type: array + items: + type: string + post: + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [name] + properties: + name: + type: string + responses: + '201': + description: created + content: + application/json: + schema: + type: object + /things/{id}: + get: + parameters: + - name: id + in: path + required: true + schema: + type: integer + responses: + '200': + description: ok + content: + application/json: + schema: + type: object + /files: + post: + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + required: [file_upload] + properties: + file_upload: + type: string + format: binary + responses: + '201': + description: created + content: + application/json: + schema: + type: object +` + +// newTestHandler mirrors the production setup: the validator wraps each +// handler on a subrouter registered with the spec's path strings, mounted +// under the spec's server URL (handlers/router.go mounts everything at /v3). +func newTestHandler(t *testing.T) http.Handler { + t.Helper() + loader := openapi3.NewLoader() + spec, err := loader.LoadFromData([]byte(testSpec)) + if err != nil { + t.Fatal(err) + } + ok := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + }) + // upload mirrors the production storage/runtime upload handlers: the + // validator must leave the multipart body unread so FormFile can stream it. + upload := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if _, _, err := r.FormFile("file_upload"); err != nil { + w.WriteHeader(http.StatusBadRequest) + return + } + w.WriteHeader(http.StatusOK) + }) + mw := NewValidator(spec) + sub := chi.NewRouter() + sub.Method(http.MethodGet, "/things", mw(ok)) + sub.Method(http.MethodPost, "/things", mw(ok)) + sub.Method(http.MethodGet, "/things/{id}", mw(ok)) + sub.Method(http.MethodPost, "/files", mw(upload)) + root := chi.NewRouter() + root.Mount("/v3", sub) + return root +} + +func TestValidator(t *testing.T) { + h := newTestHandler(t) + + tests := []struct { + name string + method string + target string + body string + contentType string + accept string + wantStatus int + }{ + {name: "valid GET", method: "GET", target: "/v3/things", wantStatus: 200}, + {name: "valid GET with Accept json", method: "GET", target: "/v3/things", accept: "application/json", wantStatus: 200}, + {name: "valid GET with Accept wildcard", method: "GET", target: "/v3/things", accept: "*/*", wantStatus: 200}, + {name: "valid GET with Accept type wildcard", method: "GET", target: "/v3/things", accept: "application/*", wantStatus: 200}, + {name: "Accept mismatch returns 406", method: "GET", target: "/v3/things", accept: "text/plain", wantStatus: 406}, + {name: "Accept list with one match passes", method: "GET", target: "/v3/things", accept: "text/plain, application/json;q=0.8", wantStatus: 200}, + {name: "invalid query param returns 400", method: "GET", target: "/v3/things?limit=0", wantStatus: 400}, + {name: "valid path param", method: "GET", target: "/v3/things/12", wantStatus: 200}, + {name: "invalid path param returns 400", method: "GET", target: "/v3/things/abc", wantStatus: 400}, + {name: "valid POST", method: "POST", target: "/v3/things", body: `{"name":"a"}`, contentType: "application/json", wantStatus: 200}, + {name: "wrong Content-Type returns 415", method: "POST", target: "/v3/things", body: `name=a`, contentType: "text/plain", wantStatus: 415}, + {name: "body schema violation returns 422", method: "POST", target: "/v3/things", body: `{}`, contentType: "application/json", wantStatus: 422}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var body *strings.Reader + if tt.body != "" { + body = strings.NewReader(tt.body) + } else { + body = strings.NewReader("") + } + req := httptest.NewRequest(tt.method, tt.target, body) + if tt.contentType != "" { + req.Header.Set("Content-Type", tt.contentType) + } + if tt.accept != "" { + req.Header.Set("Accept", tt.accept) + } + rec := httptest.NewRecorder() + h.ServeHTTP(rec, req) + if rec.Code != tt.wantStatus { + t.Errorf("got status %d, want %d (body: %s)", rec.Code, tt.wantStatus, rec.Body.String()) + } + }) + } +} + +// TestValidatorMultipart verifies that multipart operations skip body +// validation (the body must remain unread for the handler to stream it) while +// keeping the 415 check for undeclared content types. +func TestValidatorMultipart(t *testing.T) { + h := newTestHandler(t) + + var buf bytes.Buffer + mp := multipart.NewWriter(&buf) + part, err := mp.CreateFormFile("file_upload", "test.txt") + if err != nil { + t.Fatal(err) + } + if _, err := part.Write([]byte("payload")); err != nil { + t.Fatal(err) + } + mp.Close() + + req := httptest.NewRequest(http.MethodPost, "/v3/files", &buf) + req.Header.Set("Content-Type", mp.FormDataContentType()) + rec := httptest.NewRecorder() + h.ServeHTTP(rec, req) + if rec.Code != http.StatusOK { + t.Errorf("multipart upload: got status %d, want 200 (body: %s)", rec.Code, rec.Body.String()) + } + + req = httptest.NewRequest(http.MethodPost, "/v3/files", strings.NewReader(`{}`)) + req.Header.Set("Content-Type", "application/json") + rec = httptest.NewRecorder() + h.ServeHTTP(rec, req) + if rec.Code != http.StatusUnsupportedMediaType { + t.Errorf("wrong content type: got status %d, want 415 (body: %s)", rec.Code, rec.Body.String()) + } + + // Media types are case-insensitive (RFC 9110): an uppercase Content-Type + // must not trip the 415 check. + buf.Reset() + mp = multipart.NewWriter(&buf) + part, err = mp.CreateFormFile("file_upload", "test.txt") + if err != nil { + t.Fatal(err) + } + if _, err := part.Write([]byte("payload")); err != nil { + t.Fatal(err) + } + mp.Close() + req = httptest.NewRequest(http.MethodPost, "/v3/files", &buf) + req.Header.Set("Content-Type", strings.Replace(mp.FormDataContentType(), + "multipart/form-data", "Multipart/Form-Data", 1)) + rec = httptest.NewRecorder() + h.ServeHTTP(rec, req) + if rec.Code != http.StatusOK { + t.Errorf("uppercase content type: got status %d, want 200 (body: %s)", rec.Code, rec.Body.String()) + } +} + +// TestValidatorBodyTooLarge verifies that a body hitting the MaxBodySize cap +// while the validator buffers it surfaces as 413 instead of a generic 400. +func TestValidatorBodyTooLarge(t *testing.T) { + h := newTestHandler(t) + limited := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + r.Body = http.MaxBytesReader(w, r.Body, 8) + h.ServeHTTP(w, r) + }) + req := httptest.NewRequest(http.MethodPost, "/v3/things", strings.NewReader(`{"name":"too long for the limit"}`)) + req.Header.Set("Content-Type", "application/json") + rec := httptest.NewRecorder() + limited.ServeHTTP(rec, req) + if rec.Code != http.StatusRequestEntityTooLarge { + t.Errorf("got status %d, want 413 (body: %s)", rec.Code, rec.Body.String()) + } +} diff --git a/handlers/nameserver.go b/handlers/nameserver.go deleted file mode 100644 index 50fa77ce..00000000 --- a/handlers/nameserver.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/nameserver" -) - -// CreateNameserverHandlerImpl implementation of the CreateNameserverHandler interface using client-native client -type CreateNameserverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteNameserverHandlerImpl implementation of the DeleteNameserverHandler interface using client-native client -type DeleteNameserverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetNameserverHandlerImpl implementation of the GetNameserverHandler interface using client-native client -type GetNameserverHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetNameserversHandlerImpl implementation of the GetNameserversHandler interface using client-native client -type GetNameserversHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceNameserverHandlerImpl implementation of the ReplaceNameserverHandler interface using client-native client -type ReplaceNameserverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateNameserverHandlerImpl) Handle(params nameserver.CreateNameserverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return nameserver.NewCreateNameserverDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewCreateNameserverDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.CreateNameserver(params.Resolver, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return nameserver.NewCreateNameserverDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewCreateNameserverDefault(int(*e.Code)).WithPayload(e) - } - return nameserver.NewCreateNameserverCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return nameserver.NewCreateNameserverAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return nameserver.NewCreateNameserverAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteNameserverHandlerImpl) Handle(params nameserver.DeleteNameserverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return nameserver.NewDeleteNameserverDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewDeleteNameserverDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteNameserver(params.Name, params.Resolver, t, v) - if err != nil { - e := misc.HandleError(err) - return nameserver.NewDeleteNameserverDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewDeleteNameserverDefault(int(*e.Code)).WithPayload(e) - } - return nameserver.NewDeleteNameserverNoContent() - } - rID := h.ReloadAgent.Reload() - return nameserver.NewDeleteNameserverAccepted().WithReloadID(rID) - } - return nameserver.NewDeleteNameserverAccepted() -} - -// Handle executing the request and returning a response -func (h *GetNameserverHandlerImpl) Handle(params nameserver.GetNameserverParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewGetNameserverDefault(int(*e.Code)).WithPayload(e) - } - - _, b, err := configuration.GetNameserver(params.Name, params.Resolver, t) - if err != nil { - e := misc.HandleError(err) - return nameserver.NewGetNameserverDefault(int(*e.Code)).WithPayload(e) - } - return nameserver.NewGetNameserverOK().WithPayload(b) -} - -// Handle executing the request and returning a response -func (h *GetNameserversHandlerImpl) Handle(params nameserver.GetNameserversParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewGetNameserversDefault(int(*e.Code)).WithPayload(e) - } - - _, bs, err := configuration.GetNameservers(params.Resolver, t) - if err != nil { - e := misc.HandleError(err) - return nameserver.NewGetNameserversDefault(int(*e.Code)).WithPayload(e) - } - return nameserver.NewGetNameserversOK().WithPayload(bs) -} - -// Handle executing the request and returning a response -func (h *ReplaceNameserverHandlerImpl) Handle(params nameserver.ReplaceNameserverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return nameserver.NewReplaceNameserverDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewReplaceNameserverDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditNameserver(params.Name, params.Resolver, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return nameserver.NewReplaceNameserverDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return nameserver.NewReplaceNameserverDefault(int(*e.Code)).WithPayload(e) - } - return nameserver.NewReplaceNameserverOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return nameserver.NewReplaceNameserverAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return nameserver.NewReplaceNameserverAccepted().WithPayload(params.Data) -} diff --git a/handlers/parent_acl_generated.go b/handlers/parent_acl_generated.go deleted file mode 100644 index 1fb6f07c..00000000 --- a/handlers/parent_acl_generated.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/acl" -) - -type ( - CreateACLBackendHandlerImpl CreateACLHandlerImpl - CreateACLFrontendHandlerImpl CreateACLHandlerImpl - CreateACLFCGIAppHandlerImpl CreateACLHandlerImpl - CreateACLDefaultsHandlerImpl CreateACLHandlerImpl -) - -type ( - GetACLBackendHandlerImpl GetACLHandlerImpl - GetACLFrontendHandlerImpl GetACLHandlerImpl - GetACLFCGIAppHandlerImpl GetACLHandlerImpl - GetACLDefaultsHandlerImpl GetACLHandlerImpl -) - -type ( - GetAllACLBackendHandlerImpl GetAllACLHandlerImpl - GetAllACLFrontendHandlerImpl GetAllACLHandlerImpl - GetAllACLFCGIAppHandlerImpl GetAllACLHandlerImpl - GetAllACLDefaultsHandlerImpl GetAllACLHandlerImpl -) - -type ( - DeleteACLBackendHandlerImpl DeleteACLHandlerImpl - DeleteACLFrontendHandlerImpl DeleteACLHandlerImpl - DeleteACLFCGIAppHandlerImpl DeleteACLHandlerImpl - DeleteACLDefaultsHandlerImpl DeleteACLHandlerImpl -) - -type ( - ReplaceACLBackendHandlerImpl ReplaceACLHandlerImpl - ReplaceACLFrontendHandlerImpl ReplaceACLHandlerImpl - ReplaceACLFCGIAppHandlerImpl ReplaceACLHandlerImpl - ReplaceACLDefaultsHandlerImpl ReplaceACLHandlerImpl -) - -type ( - ReplaceAllACLBackendHandlerImpl ReplaceAllACLHandlerImpl - ReplaceAllACLFrontendHandlerImpl ReplaceAllACLHandlerImpl - ReplaceAllACLFCGIAppHandlerImpl ReplaceAllACLHandlerImpl - ReplaceAllACLDefaultsHandlerImpl ReplaceAllACLHandlerImpl -) - -func (h *CreateACLBackendHandlerImpl) Handle(params acl.CreateACLBackendParams, principal any) middleware.Responder { - g := CreateACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateACLFrontendHandlerImpl) Handle(params acl.CreateACLFrontendParams, principal any) middleware.Responder { - g := CreateACLHandlerImpl(*h) - pg := acl.CreateACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateACLFCGIAppHandlerImpl) Handle(params acl.CreateACLFCGIAppParams, principal any) middleware.Responder { - g := CreateACLHandlerImpl(*h) - pg := acl.CreateACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *CreateACLDefaultsHandlerImpl) Handle(params acl.CreateACLDefaultsParams, principal any) middleware.Responder { - g := CreateACLHandlerImpl(*h) - pg := acl.CreateACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetACLBackendHandlerImpl) Handle(params acl.GetACLBackendParams, principal any) middleware.Responder { - g := GetACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetACLFrontendHandlerImpl) Handle(params acl.GetACLFrontendParams, principal any) middleware.Responder { - g := GetACLHandlerImpl(*h) - pg := acl.GetACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetACLFCGIAppHandlerImpl) Handle(params acl.GetACLFCGIAppParams, principal any) middleware.Responder { - g := GetACLHandlerImpl(*h) - pg := acl.GetACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *GetACLDefaultsHandlerImpl) Handle(params acl.GetACLDefaultsParams, principal any) middleware.Responder { - g := GetACLHandlerImpl(*h) - pg := acl.GetACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllACLBackendHandlerImpl) Handle(params acl.GetAllACLBackendParams, principal any) middleware.Responder { - g := GetAllACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllACLFrontendHandlerImpl) Handle(params acl.GetAllACLFrontendParams, principal any) middleware.Responder { - g := GetAllACLHandlerImpl(*h) - pg := acl.GetAllACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllACLFCGIAppHandlerImpl) Handle(params acl.GetAllACLFCGIAppParams, principal any) middleware.Responder { - g := GetAllACLHandlerImpl(*h) - pg := acl.GetAllACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *GetAllACLDefaultsHandlerImpl) Handle(params acl.GetAllACLDefaultsParams, principal any) middleware.Responder { - g := GetAllACLHandlerImpl(*h) - pg := acl.GetAllACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteACLBackendHandlerImpl) Handle(params acl.DeleteACLBackendParams, principal any) middleware.Responder { - g := DeleteACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteACLFrontendHandlerImpl) Handle(params acl.DeleteACLFrontendParams, principal any) middleware.Responder { - g := DeleteACLHandlerImpl(*h) - pg := acl.DeleteACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteACLFCGIAppHandlerImpl) Handle(params acl.DeleteACLFCGIAppParams, principal any) middleware.Responder { - g := DeleteACLHandlerImpl(*h) - pg := acl.DeleteACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *DeleteACLDefaultsHandlerImpl) Handle(params acl.DeleteACLDefaultsParams, principal any) middleware.Responder { - g := DeleteACLHandlerImpl(*h) - pg := acl.DeleteACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceACLBackendHandlerImpl) Handle(params acl.ReplaceACLBackendParams, principal any) middleware.Responder { - g := ReplaceACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceACLFrontendHandlerImpl) Handle(params acl.ReplaceACLFrontendParams, principal any) middleware.Responder { - g := ReplaceACLHandlerImpl(*h) - pg := acl.ReplaceACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceACLFCGIAppHandlerImpl) Handle(params acl.ReplaceACLFCGIAppParams, principal any) middleware.Responder { - g := ReplaceACLHandlerImpl(*h) - pg := acl.ReplaceACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *ReplaceACLDefaultsHandlerImpl) Handle(params acl.ReplaceACLDefaultsParams, principal any) middleware.Responder { - g := ReplaceACLHandlerImpl(*h) - pg := acl.ReplaceACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllACLBackendHandlerImpl) Handle(params acl.ReplaceAllACLBackendParams, principal any) middleware.Responder { - g := ReplaceAllACLHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllACLFrontendHandlerImpl) Handle(params acl.ReplaceAllACLFrontendParams, principal any) middleware.Responder { - g := ReplaceAllACLHandlerImpl(*h) - pg := acl.ReplaceAllACLBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllACLFCGIAppHandlerImpl) Handle(params acl.ReplaceAllACLFCGIAppParams, principal any) middleware.Responder { - g := ReplaceAllACLHandlerImpl(*h) - pg := acl.ReplaceAllACLBackendParams(params) - return g.Handle(cnconstants.FCGIAppParentType, pg, principal) -} - -func (h *ReplaceAllACLDefaultsHandlerImpl) Handle(params acl.ReplaceAllACLDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllACLHandlerImpl(*h) - pg := acl.ReplaceAllACLBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_bind_generated.go b/handlers/parent_bind_generated.go deleted file mode 100644 index fe58c618..00000000 --- a/handlers/parent_bind_generated.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/bind" -) - -type ( - CreateBindFrontendHandlerImpl CreateBindHandlerImpl - CreateBindLogForwardHandlerImpl CreateBindHandlerImpl - CreateBindPeerHandlerImpl CreateBindHandlerImpl -) - -type ( - GetBindFrontendHandlerImpl GetBindHandlerImpl - GetBindLogForwardHandlerImpl GetBindHandlerImpl - GetBindPeerHandlerImpl GetBindHandlerImpl -) - -type ( - GetAllBindFrontendHandlerImpl GetAllBindHandlerImpl - GetAllBindLogForwardHandlerImpl GetAllBindHandlerImpl - GetAllBindPeerHandlerImpl GetAllBindHandlerImpl -) - -type ( - DeleteBindFrontendHandlerImpl DeleteBindHandlerImpl - DeleteBindLogForwardHandlerImpl DeleteBindHandlerImpl - DeleteBindPeerHandlerImpl DeleteBindHandlerImpl -) - -type ( - ReplaceBindFrontendHandlerImpl ReplaceBindHandlerImpl - ReplaceBindLogForwardHandlerImpl ReplaceBindHandlerImpl - ReplaceBindPeerHandlerImpl ReplaceBindHandlerImpl -) - -func (h *CreateBindFrontendHandlerImpl) Handle(params bind.CreateBindFrontendParams, principal any) middleware.Responder { - g := CreateBindHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *CreateBindLogForwardHandlerImpl) Handle(params bind.CreateBindLogForwardParams, principal any) middleware.Responder { - g := CreateBindHandlerImpl(*h) - pg := bind.CreateBindFrontendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *CreateBindPeerHandlerImpl) Handle(params bind.CreateBindPeerParams, principal any) middleware.Responder { - g := CreateBindHandlerImpl(*h) - pg := bind.CreateBindFrontendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetBindFrontendHandlerImpl) Handle(params bind.GetBindFrontendParams, principal any) middleware.Responder { - g := GetBindHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *GetBindLogForwardHandlerImpl) Handle(params bind.GetBindLogForwardParams, principal any) middleware.Responder { - g := GetBindHandlerImpl(*h) - pg := bind.GetBindFrontendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *GetBindPeerHandlerImpl) Handle(params bind.GetBindPeerParams, principal any) middleware.Responder { - g := GetBindHandlerImpl(*h) - pg := bind.GetBindFrontendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetAllBindFrontendHandlerImpl) Handle(params bind.GetAllBindFrontendParams, principal any) middleware.Responder { - g := GetAllBindHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *GetAllBindLogForwardHandlerImpl) Handle(params bind.GetAllBindLogForwardParams, principal any) middleware.Responder { - g := GetAllBindHandlerImpl(*h) - pg := bind.GetAllBindFrontendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *GetAllBindPeerHandlerImpl) Handle(params bind.GetAllBindPeerParams, principal any) middleware.Responder { - g := GetAllBindHandlerImpl(*h) - pg := bind.GetAllBindFrontendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *DeleteBindFrontendHandlerImpl) Handle(params bind.DeleteBindFrontendParams, principal any) middleware.Responder { - g := DeleteBindHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *DeleteBindLogForwardHandlerImpl) Handle(params bind.DeleteBindLogForwardParams, principal any) middleware.Responder { - g := DeleteBindHandlerImpl(*h) - pg := bind.DeleteBindFrontendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *DeleteBindPeerHandlerImpl) Handle(params bind.DeleteBindPeerParams, principal any) middleware.Responder { - g := DeleteBindHandlerImpl(*h) - pg := bind.DeleteBindFrontendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *ReplaceBindFrontendHandlerImpl) Handle(params bind.ReplaceBindFrontendParams, principal any) middleware.Responder { - g := ReplaceBindHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *ReplaceBindLogForwardHandlerImpl) Handle(params bind.ReplaceBindLogForwardParams, principal any) middleware.Responder { - g := ReplaceBindHandlerImpl(*h) - pg := bind.ReplaceBindFrontendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *ReplaceBindPeerHandlerImpl) Handle(params bind.ReplaceBindPeerParams, principal any) middleware.Responder { - g := ReplaceBindHandlerImpl(*h) - pg := bind.ReplaceBindFrontendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} diff --git a/handlers/parent_filter_generated.go b/handlers/parent_filter_generated.go deleted file mode 100644 index a9401717..00000000 --- a/handlers/parent_filter_generated.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/filter" -) - -type ( - CreateFilterBackendHandlerImpl CreateFilterHandlerImpl - CreateFilterFrontendHandlerImpl CreateFilterHandlerImpl -) - -type ( - GetFilterBackendHandlerImpl GetFilterHandlerImpl - GetFilterFrontendHandlerImpl GetFilterHandlerImpl -) - -type ( - GetAllFilterBackendHandlerImpl GetAllFilterHandlerImpl - GetAllFilterFrontendHandlerImpl GetAllFilterHandlerImpl -) - -type ( - DeleteFilterBackendHandlerImpl DeleteFilterHandlerImpl - DeleteFilterFrontendHandlerImpl DeleteFilterHandlerImpl -) - -type ( - ReplaceFilterBackendHandlerImpl ReplaceFilterHandlerImpl - ReplaceFilterFrontendHandlerImpl ReplaceFilterHandlerImpl -) - -type ( - ReplaceAllFilterBackendHandlerImpl ReplaceAllFilterHandlerImpl - ReplaceAllFilterFrontendHandlerImpl ReplaceAllFilterHandlerImpl -) - -func (h *CreateFilterBackendHandlerImpl) Handle(params filter.CreateFilterBackendParams, principal any) middleware.Responder { - g := CreateFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateFilterFrontendHandlerImpl) Handle(params filter.CreateFilterFrontendParams, principal any) middleware.Responder { - g := CreateFilterHandlerImpl(*h) - pg := filter.CreateFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetFilterBackendHandlerImpl) Handle(params filter.GetFilterBackendParams, principal any) middleware.Responder { - g := GetFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetFilterFrontendHandlerImpl) Handle(params filter.GetFilterFrontendParams, principal any) middleware.Responder { - g := GetFilterHandlerImpl(*h) - pg := filter.GetFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllFilterBackendHandlerImpl) Handle(params filter.GetAllFilterBackendParams, principal any) middleware.Responder { - g := GetAllFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllFilterFrontendHandlerImpl) Handle(params filter.GetAllFilterFrontendParams, principal any) middleware.Responder { - g := GetAllFilterHandlerImpl(*h) - pg := filter.GetAllFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteFilterBackendHandlerImpl) Handle(params filter.DeleteFilterBackendParams, principal any) middleware.Responder { - g := DeleteFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteFilterFrontendHandlerImpl) Handle(params filter.DeleteFilterFrontendParams, principal any) middleware.Responder { - g := DeleteFilterHandlerImpl(*h) - pg := filter.DeleteFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceFilterBackendHandlerImpl) Handle(params filter.ReplaceFilterBackendParams, principal any) middleware.Responder { - g := ReplaceFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceFilterFrontendHandlerImpl) Handle(params filter.ReplaceFilterFrontendParams, principal any) middleware.Responder { - g := ReplaceFilterHandlerImpl(*h) - pg := filter.ReplaceFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllFilterBackendHandlerImpl) Handle(params filter.ReplaceAllFilterBackendParams, principal any) middleware.Responder { - g := ReplaceAllFilterHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllFilterFrontendHandlerImpl) Handle(params filter.ReplaceAllFilterFrontendParams, principal any) middleware.Responder { - g := ReplaceAllFilterHandlerImpl(*h) - pg := filter.ReplaceAllFilterBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} diff --git a/handlers/parent_http_after_response_rule_generated.go b/handlers/parent_http_after_response_rule_generated.go deleted file mode 100644 index 16d1dde5..00000000 --- a/handlers/parent_http_after_response_rule_generated.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/http_after_response_rule" -) - -type ( - CreateHTTPAfterResponseRuleBackendHandlerImpl CreateHTTPAfterResponseRuleHandlerImpl - CreateHTTPAfterResponseRuleFrontendHandlerImpl CreateHTTPAfterResponseRuleHandlerImpl - CreateHTTPAfterResponseRuleDefaultsHandlerImpl CreateHTTPAfterResponseRuleHandlerImpl -) - -type ( - GetHTTPAfterResponseRuleBackendHandlerImpl GetHTTPAfterResponseRuleHandlerImpl - GetHTTPAfterResponseRuleFrontendHandlerImpl GetHTTPAfterResponseRuleHandlerImpl - GetHTTPAfterResponseRuleDefaultsHandlerImpl GetHTTPAfterResponseRuleHandlerImpl -) - -type ( - GetAllHTTPAfterResponseRuleBackendHandlerImpl GetAllHTTPAfterResponseRuleHandlerImpl - GetAllHTTPAfterResponseRuleFrontendHandlerImpl GetAllHTTPAfterResponseRuleHandlerImpl - GetAllHTTPAfterResponseRuleDefaultsHandlerImpl GetAllHTTPAfterResponseRuleHandlerImpl -) - -type ( - DeleteHTTPAfterResponseRuleBackendHandlerImpl DeleteHTTPAfterResponseRuleHandlerImpl - DeleteHTTPAfterResponseRuleFrontendHandlerImpl DeleteHTTPAfterResponseRuleHandlerImpl - DeleteHTTPAfterResponseRuleDefaultsHandlerImpl DeleteHTTPAfterResponseRuleHandlerImpl -) - -type ( - ReplaceHTTPAfterResponseRuleBackendHandlerImpl ReplaceHTTPAfterResponseRuleHandlerImpl - ReplaceHTTPAfterResponseRuleFrontendHandlerImpl ReplaceHTTPAfterResponseRuleHandlerImpl - ReplaceHTTPAfterResponseRuleDefaultsHandlerImpl ReplaceHTTPAfterResponseRuleHandlerImpl -) - -type ( - ReplaceAllHTTPAfterResponseRuleBackendHandlerImpl ReplaceAllHTTPAfterResponseRuleHandlerImpl - ReplaceAllHTTPAfterResponseRuleFrontendHandlerImpl ReplaceAllHTTPAfterResponseRuleHandlerImpl - ReplaceAllHTTPAfterResponseRuleDefaultsHandlerImpl ReplaceAllHTTPAfterResponseRuleHandlerImpl -) - -func (h *CreateHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.CreateHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := CreateHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.CreateHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := CreateHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.CreateHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.CreateHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := CreateHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.CreateHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.GetHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := GetHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.GetHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := GetHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.GetHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.GetHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.GetHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.GetAllHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := GetAllHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.GetAllHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := GetAllHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.GetAllHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.GetAllHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.GetAllHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.DeleteHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := DeleteHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.DeleteHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := DeleteHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.DeleteHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.DeleteHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.DeleteHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllHTTPAfterResponseRuleBackendHandlerImpl) Handle(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPAfterResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllHTTPAfterResponseRuleFrontendHandlerImpl) Handle(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllHTTPAfterResponseRuleDefaultsHandlerImpl) Handle(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllHTTPAfterResponseRuleHandlerImpl(*h) - pg := http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_http_check_generated.go b/handlers/parent_http_check_generated.go deleted file mode 100644 index 5746f4af..00000000 --- a/handlers/parent_http_check_generated.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/http_check" -) - -type ( - CreateHTTPCheckBackendHandlerImpl CreateHTTPCheckHandlerImpl - CreateHTTPCheckDefaultsHandlerImpl CreateHTTPCheckHandlerImpl -) - -type ( - GetHTTPCheckBackendHandlerImpl GetHTTPCheckHandlerImpl - GetHTTPCheckDefaultsHandlerImpl GetHTTPCheckHandlerImpl -) - -type ( - GetAllHTTPCheckBackendHandlerImpl GetAllHTTPCheckHandlerImpl - GetAllHTTPCheckDefaultsHandlerImpl GetAllHTTPCheckHandlerImpl -) - -type ( - DeleteHTTPCheckBackendHandlerImpl DeleteHTTPCheckHandlerImpl - DeleteHTTPCheckDefaultsHandlerImpl DeleteHTTPCheckHandlerImpl -) - -type ( - ReplaceHTTPCheckBackendHandlerImpl ReplaceHTTPCheckHandlerImpl - ReplaceHTTPCheckDefaultsHandlerImpl ReplaceHTTPCheckHandlerImpl -) - -type ( - ReplaceAllHTTPCheckBackendHandlerImpl ReplaceAllHTTPCheckHandlerImpl - ReplaceAllHTTPCheckDefaultsHandlerImpl ReplaceAllHTTPCheckHandlerImpl -) - -func (h *CreateHTTPCheckBackendHandlerImpl) Handle(params http_check.CreateHTTPCheckBackendParams, principal any) middleware.Responder { - g := CreateHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateHTTPCheckDefaultsHandlerImpl) Handle(params http_check.CreateHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := CreateHTTPCheckHandlerImpl(*h) - pg := http_check.CreateHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetHTTPCheckBackendHandlerImpl) Handle(params http_check.GetHTTPCheckBackendParams, principal any) middleware.Responder { - g := GetHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetHTTPCheckDefaultsHandlerImpl) Handle(params http_check.GetHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := GetHTTPCheckHandlerImpl(*h) - pg := http_check.GetHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllHTTPCheckBackendHandlerImpl) Handle(params http_check.GetAllHTTPCheckBackendParams, principal any) middleware.Responder { - g := GetAllHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllHTTPCheckDefaultsHandlerImpl) Handle(params http_check.GetAllHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := GetAllHTTPCheckHandlerImpl(*h) - pg := http_check.GetAllHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteHTTPCheckBackendHandlerImpl) Handle(params http_check.DeleteHTTPCheckBackendParams, principal any) middleware.Responder { - g := DeleteHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteHTTPCheckDefaultsHandlerImpl) Handle(params http_check.DeleteHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := DeleteHTTPCheckHandlerImpl(*h) - pg := http_check.DeleteHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceHTTPCheckBackendHandlerImpl) Handle(params http_check.ReplaceHTTPCheckBackendParams, principal any) middleware.Responder { - g := ReplaceHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceHTTPCheckDefaultsHandlerImpl) Handle(params http_check.ReplaceHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := ReplaceHTTPCheckHandlerImpl(*h) - pg := http_check.ReplaceHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllHTTPCheckBackendHandlerImpl) Handle(params http_check.ReplaceAllHTTPCheckBackendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllHTTPCheckDefaultsHandlerImpl) Handle(params http_check.ReplaceAllHTTPCheckDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllHTTPCheckHandlerImpl(*h) - pg := http_check.ReplaceAllHTTPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_http_error_rule_generated.go b/handlers/parent_http_error_rule_generated.go deleted file mode 100644 index 0949d140..00000000 --- a/handlers/parent_http_error_rule_generated.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/http_error_rule" -) - -type ( - CreateHTTPErrorRuleBackendHandlerImpl CreateHTTPErrorRuleHandlerImpl - CreateHTTPErrorRuleFrontendHandlerImpl CreateHTTPErrorRuleHandlerImpl - CreateHTTPErrorRuleDefaultsHandlerImpl CreateHTTPErrorRuleHandlerImpl -) - -type ( - GetHTTPErrorRuleBackendHandlerImpl GetHTTPErrorRuleHandlerImpl - GetHTTPErrorRuleFrontendHandlerImpl GetHTTPErrorRuleHandlerImpl - GetHTTPErrorRuleDefaultsHandlerImpl GetHTTPErrorRuleHandlerImpl -) - -type ( - GetAllHTTPErrorRuleBackendHandlerImpl GetAllHTTPErrorRuleHandlerImpl - GetAllHTTPErrorRuleFrontendHandlerImpl GetAllHTTPErrorRuleHandlerImpl - GetAllHTTPErrorRuleDefaultsHandlerImpl GetAllHTTPErrorRuleHandlerImpl -) - -type ( - DeleteHTTPErrorRuleBackendHandlerImpl DeleteHTTPErrorRuleHandlerImpl - DeleteHTTPErrorRuleFrontendHandlerImpl DeleteHTTPErrorRuleHandlerImpl - DeleteHTTPErrorRuleDefaultsHandlerImpl DeleteHTTPErrorRuleHandlerImpl -) - -type ( - ReplaceHTTPErrorRuleBackendHandlerImpl ReplaceHTTPErrorRuleHandlerImpl - ReplaceHTTPErrorRuleFrontendHandlerImpl ReplaceHTTPErrorRuleHandlerImpl - ReplaceHTTPErrorRuleDefaultsHandlerImpl ReplaceHTTPErrorRuleHandlerImpl -) - -type ( - ReplaceAllHTTPErrorRuleBackendHandlerImpl ReplaceAllHTTPErrorRuleHandlerImpl - ReplaceAllHTTPErrorRuleFrontendHandlerImpl ReplaceAllHTTPErrorRuleHandlerImpl - ReplaceAllHTTPErrorRuleDefaultsHandlerImpl ReplaceAllHTTPErrorRuleHandlerImpl -) - -func (h *CreateHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.CreateHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := CreateHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.CreateHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := CreateHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.CreateHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.CreateHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := CreateHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.CreateHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.GetHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := GetHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.GetHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := GetHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.GetHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.GetHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := GetHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.GetHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.GetAllHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := GetAllHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.GetAllHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := GetAllHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.GetAllHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.GetAllHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.GetAllHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.DeleteHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := DeleteHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.DeleteHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := DeleteHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.DeleteHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.DeleteHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.DeleteHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.ReplaceHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := ReplaceHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.ReplaceHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.ReplaceHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.ReplaceHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.ReplaceHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllHTTPErrorRuleBackendHandlerImpl) Handle(params http_error_rule.ReplaceAllHTTPErrorRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPErrorRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllHTTPErrorRuleFrontendHandlerImpl) Handle(params http_error_rule.ReplaceAllHTTPErrorRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.ReplaceAllHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllHTTPErrorRuleDefaultsHandlerImpl) Handle(params http_error_rule.ReplaceAllHTTPErrorRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllHTTPErrorRuleHandlerImpl(*h) - pg := http_error_rule.ReplaceAllHTTPErrorRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_http_request_rule_generated.go b/handlers/parent_http_request_rule_generated.go deleted file mode 100644 index 42b8c064..00000000 --- a/handlers/parent_http_request_rule_generated.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/http_request_rule" -) - -type ( - CreateHTTPRequestRuleBackendHandlerImpl CreateHTTPRequestRuleHandlerImpl - CreateHTTPRequestRuleFrontendHandlerImpl CreateHTTPRequestRuleHandlerImpl - CreateHTTPRequestRuleDefaultsHandlerImpl CreateHTTPRequestRuleHandlerImpl -) - -type ( - GetHTTPRequestRuleBackendHandlerImpl GetHTTPRequestRuleHandlerImpl - GetHTTPRequestRuleFrontendHandlerImpl GetHTTPRequestRuleHandlerImpl - GetHTTPRequestRuleDefaultsHandlerImpl GetHTTPRequestRuleHandlerImpl -) - -type ( - GetAllHTTPRequestRuleBackendHandlerImpl GetAllHTTPRequestRuleHandlerImpl - GetAllHTTPRequestRuleFrontendHandlerImpl GetAllHTTPRequestRuleHandlerImpl - GetAllHTTPRequestRuleDefaultsHandlerImpl GetAllHTTPRequestRuleHandlerImpl -) - -type ( - DeleteHTTPRequestRuleBackendHandlerImpl DeleteHTTPRequestRuleHandlerImpl - DeleteHTTPRequestRuleFrontendHandlerImpl DeleteHTTPRequestRuleHandlerImpl - DeleteHTTPRequestRuleDefaultsHandlerImpl DeleteHTTPRequestRuleHandlerImpl -) - -type ( - ReplaceHTTPRequestRuleBackendHandlerImpl ReplaceHTTPRequestRuleHandlerImpl - ReplaceHTTPRequestRuleFrontendHandlerImpl ReplaceHTTPRequestRuleHandlerImpl - ReplaceHTTPRequestRuleDefaultsHandlerImpl ReplaceHTTPRequestRuleHandlerImpl -) - -type ( - ReplaceAllHTTPRequestRuleBackendHandlerImpl ReplaceAllHTTPRequestRuleHandlerImpl - ReplaceAllHTTPRequestRuleFrontendHandlerImpl ReplaceAllHTTPRequestRuleHandlerImpl - ReplaceAllHTTPRequestRuleDefaultsHandlerImpl ReplaceAllHTTPRequestRuleHandlerImpl -) - -func (h *CreateHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.CreateHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := CreateHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.CreateHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := CreateHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.CreateHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.CreateHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := CreateHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.CreateHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.GetHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := GetHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.GetHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := GetHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.GetHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.GetHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := GetHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.GetHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.GetAllHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := GetAllHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.GetAllHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := GetAllHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.GetAllHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.GetAllHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.GetAllHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.DeleteHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := DeleteHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.DeleteHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := DeleteHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.DeleteHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.DeleteHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.DeleteHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.ReplaceHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := ReplaceHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.ReplaceHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.ReplaceHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.ReplaceHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.ReplaceHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllHTTPRequestRuleBackendHandlerImpl) Handle(params http_request_rule.ReplaceAllHTTPRequestRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllHTTPRequestRuleFrontendHandlerImpl) Handle(params http_request_rule.ReplaceAllHTTPRequestRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.ReplaceAllHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllHTTPRequestRuleDefaultsHandlerImpl) Handle(params http_request_rule.ReplaceAllHTTPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllHTTPRequestRuleHandlerImpl(*h) - pg := http_request_rule.ReplaceAllHTTPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_http_response_rule_generated.go b/handlers/parent_http_response_rule_generated.go deleted file mode 100644 index 27c4530f..00000000 --- a/handlers/parent_http_response_rule_generated.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/http_response_rule" -) - -type ( - CreateHTTPResponseRuleBackendHandlerImpl CreateHTTPResponseRuleHandlerImpl - CreateHTTPResponseRuleFrontendHandlerImpl CreateHTTPResponseRuleHandlerImpl - CreateHTTPResponseRuleDefaultsHandlerImpl CreateHTTPResponseRuleHandlerImpl -) - -type ( - GetHTTPResponseRuleBackendHandlerImpl GetHTTPResponseRuleHandlerImpl - GetHTTPResponseRuleFrontendHandlerImpl GetHTTPResponseRuleHandlerImpl - GetHTTPResponseRuleDefaultsHandlerImpl GetHTTPResponseRuleHandlerImpl -) - -type ( - GetAllHTTPResponseRuleBackendHandlerImpl GetAllHTTPResponseRuleHandlerImpl - GetAllHTTPResponseRuleFrontendHandlerImpl GetAllHTTPResponseRuleHandlerImpl - GetAllHTTPResponseRuleDefaultsHandlerImpl GetAllHTTPResponseRuleHandlerImpl -) - -type ( - DeleteHTTPResponseRuleBackendHandlerImpl DeleteHTTPResponseRuleHandlerImpl - DeleteHTTPResponseRuleFrontendHandlerImpl DeleteHTTPResponseRuleHandlerImpl - DeleteHTTPResponseRuleDefaultsHandlerImpl DeleteHTTPResponseRuleHandlerImpl -) - -type ( - ReplaceHTTPResponseRuleBackendHandlerImpl ReplaceHTTPResponseRuleHandlerImpl - ReplaceHTTPResponseRuleFrontendHandlerImpl ReplaceHTTPResponseRuleHandlerImpl - ReplaceHTTPResponseRuleDefaultsHandlerImpl ReplaceHTTPResponseRuleHandlerImpl -) - -type ( - ReplaceAllHTTPResponseRuleBackendHandlerImpl ReplaceAllHTTPResponseRuleHandlerImpl - ReplaceAllHTTPResponseRuleFrontendHandlerImpl ReplaceAllHTTPResponseRuleHandlerImpl - ReplaceAllHTTPResponseRuleDefaultsHandlerImpl ReplaceAllHTTPResponseRuleHandlerImpl -) - -func (h *CreateHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.CreateHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := CreateHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.CreateHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := CreateHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.CreateHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.CreateHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := CreateHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.CreateHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.GetHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := GetHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.GetHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := GetHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.GetHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.GetHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.GetHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.GetAllHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := GetAllHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.GetAllHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := GetAllHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.GetAllHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.GetAllHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.GetAllHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.DeleteHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := DeleteHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.DeleteHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := DeleteHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.DeleteHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.DeleteHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.DeleteHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.ReplaceHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.ReplaceHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.ReplaceHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.ReplaceHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.ReplaceHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllHTTPResponseRuleBackendHandlerImpl) Handle(params http_response_rule.ReplaceAllHTTPResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllHTTPResponseRuleFrontendHandlerImpl) Handle(params http_response_rule.ReplaceAllHTTPResponseRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.ReplaceAllHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllHTTPResponseRuleDefaultsHandlerImpl) Handle(params http_response_rule.ReplaceAllHTTPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllHTTPResponseRuleHandlerImpl(*h) - pg := http_response_rule.ReplaceAllHTTPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_log_target_generated.go b/handlers/parent_log_target_generated.go deleted file mode 100644 index b2fb408d..00000000 --- a/handlers/parent_log_target_generated.go +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/log_target" -) - -type ( - CreateLogTargetBackendHandlerImpl CreateLogTargetHandlerImpl - CreateLogTargetFrontendHandlerImpl CreateLogTargetHandlerImpl - CreateLogTargetDefaultsHandlerImpl CreateLogTargetHandlerImpl - CreateLogTargetPeerHandlerImpl CreateLogTargetHandlerImpl - CreateLogTargetLogForwardHandlerImpl CreateLogTargetHandlerImpl -) - -type ( - GetLogTargetBackendHandlerImpl GetLogTargetHandlerImpl - GetLogTargetFrontendHandlerImpl GetLogTargetHandlerImpl - GetLogTargetDefaultsHandlerImpl GetLogTargetHandlerImpl - GetLogTargetPeerHandlerImpl GetLogTargetHandlerImpl - GetLogTargetLogForwardHandlerImpl GetLogTargetHandlerImpl -) - -type ( - GetAllLogTargetBackendHandlerImpl GetAllLogTargetHandlerImpl - GetAllLogTargetFrontendHandlerImpl GetAllLogTargetHandlerImpl - GetAllLogTargetDefaultsHandlerImpl GetAllLogTargetHandlerImpl - GetAllLogTargetPeerHandlerImpl GetAllLogTargetHandlerImpl - GetAllLogTargetLogForwardHandlerImpl GetAllLogTargetHandlerImpl -) - -type ( - DeleteLogTargetBackendHandlerImpl DeleteLogTargetHandlerImpl - DeleteLogTargetFrontendHandlerImpl DeleteLogTargetHandlerImpl - DeleteLogTargetDefaultsHandlerImpl DeleteLogTargetHandlerImpl - DeleteLogTargetPeerHandlerImpl DeleteLogTargetHandlerImpl - DeleteLogTargetLogForwardHandlerImpl DeleteLogTargetHandlerImpl -) - -type ( - ReplaceLogTargetBackendHandlerImpl ReplaceLogTargetHandlerImpl - ReplaceLogTargetFrontendHandlerImpl ReplaceLogTargetHandlerImpl - ReplaceLogTargetDefaultsHandlerImpl ReplaceLogTargetHandlerImpl - ReplaceLogTargetPeerHandlerImpl ReplaceLogTargetHandlerImpl - ReplaceLogTargetLogForwardHandlerImpl ReplaceLogTargetHandlerImpl -) - -type ( - ReplaceAllLogTargetBackendHandlerImpl ReplaceAllLogTargetHandlerImpl - ReplaceAllLogTargetFrontendHandlerImpl ReplaceAllLogTargetHandlerImpl - ReplaceAllLogTargetDefaultsHandlerImpl ReplaceAllLogTargetHandlerImpl - ReplaceAllLogTargetPeerHandlerImpl ReplaceAllLogTargetHandlerImpl - ReplaceAllLogTargetLogForwardHandlerImpl ReplaceAllLogTargetHandlerImpl -) - -func (h *CreateLogTargetBackendHandlerImpl) Handle(params log_target.CreateLogTargetBackendParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateLogTargetFrontendHandlerImpl) Handle(params log_target.CreateLogTargetFrontendParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - pg := log_target.CreateLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateLogTargetDefaultsHandlerImpl) Handle(params log_target.CreateLogTargetDefaultsParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - pg := log_target.CreateLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *CreateLogTargetPeerHandlerImpl) Handle(params log_target.CreateLogTargetPeerParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - pg := log_target.CreateLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *CreateLogTargetLogForwardHandlerImpl) Handle(params log_target.CreateLogTargetLogForwardParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - pg := log_target.CreateLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *GetLogTargetBackendHandlerImpl) Handle(params log_target.GetLogTargetBackendParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetLogTargetFrontendHandlerImpl) Handle(params log_target.GetLogTargetFrontendParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - pg := log_target.GetLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetLogTargetDefaultsHandlerImpl) Handle(params log_target.GetLogTargetDefaultsParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - pg := log_target.GetLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetLogTargetPeerHandlerImpl) Handle(params log_target.GetLogTargetPeerParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - pg := log_target.GetLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetLogTargetLogForwardHandlerImpl) Handle(params log_target.GetLogTargetLogForwardParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - pg := log_target.GetLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *GetAllLogTargetBackendHandlerImpl) Handle(params log_target.GetAllLogTargetBackendParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllLogTargetFrontendHandlerImpl) Handle(params log_target.GetAllLogTargetFrontendParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - pg := log_target.GetAllLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllLogTargetDefaultsHandlerImpl) Handle(params log_target.GetAllLogTargetDefaultsParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - pg := log_target.GetAllLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllLogTargetPeerHandlerImpl) Handle(params log_target.GetAllLogTargetPeerParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - pg := log_target.GetAllLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetAllLogTargetLogForwardHandlerImpl) Handle(params log_target.GetAllLogTargetLogForwardParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - pg := log_target.GetAllLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *DeleteLogTargetBackendHandlerImpl) Handle(params log_target.DeleteLogTargetBackendParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteLogTargetFrontendHandlerImpl) Handle(params log_target.DeleteLogTargetFrontendParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - pg := log_target.DeleteLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteLogTargetDefaultsHandlerImpl) Handle(params log_target.DeleteLogTargetDefaultsParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - pg := log_target.DeleteLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteLogTargetPeerHandlerImpl) Handle(params log_target.DeleteLogTargetPeerParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - pg := log_target.DeleteLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *DeleteLogTargetLogForwardHandlerImpl) Handle(params log_target.DeleteLogTargetLogForwardParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - pg := log_target.DeleteLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *ReplaceLogTargetBackendHandlerImpl) Handle(params log_target.ReplaceLogTargetBackendParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceLogTargetFrontendHandlerImpl) Handle(params log_target.ReplaceLogTargetFrontendParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - pg := log_target.ReplaceLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceLogTargetDefaultsHandlerImpl) Handle(params log_target.ReplaceLogTargetDefaultsParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - pg := log_target.ReplaceLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceLogTargetPeerHandlerImpl) Handle(params log_target.ReplaceLogTargetPeerParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - pg := log_target.ReplaceLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *ReplaceLogTargetLogForwardHandlerImpl) Handle(params log_target.ReplaceLogTargetLogForwardParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - pg := log_target.ReplaceLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} - -func (h *ReplaceAllLogTargetBackendHandlerImpl) Handle(params log_target.ReplaceAllLogTargetBackendParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllLogTargetFrontendHandlerImpl) Handle(params log_target.ReplaceAllLogTargetFrontendParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - pg := log_target.ReplaceAllLogTargetBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllLogTargetDefaultsHandlerImpl) Handle(params log_target.ReplaceAllLogTargetDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - pg := log_target.ReplaceAllLogTargetBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllLogTargetPeerHandlerImpl) Handle(params log_target.ReplaceAllLogTargetPeerParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - pg := log_target.ReplaceAllLogTargetBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *ReplaceAllLogTargetLogForwardHandlerImpl) Handle(params log_target.ReplaceAllLogTargetLogForwardParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - pg := log_target.ReplaceAllLogTargetBackendParams(params) - return g.Handle(cnconstants.LogForwardParentType, pg, principal) -} diff --git a/handlers/parent_log_target_global.go b/handlers/parent_log_target_global.go deleted file mode 100644 index 7ff87fd2..00000000 --- a/handlers/parent_log_target_global.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/log_target" -) - -type ( - CreateLogTargetGlobalHandlerImpl CreateLogTargetHandlerImpl -) - -type ( - GetLogTargetGlobalHandlerImpl GetLogTargetHandlerImpl -) - -type ( - GetAllLogTargetGlobalHandlerImpl GetAllLogTargetHandlerImpl -) - -type ( - DeleteLogTargetGlobalHandlerImpl DeleteLogTargetHandlerImpl -) - -type ( - ReplaceLogTargetGlobalHandlerImpl ReplaceLogTargetHandlerImpl -) - -type ( - ReplaceAllLogTargetGlobalHandlerImpl ReplaceAllLogTargetHandlerImpl -) - -func (h *CreateLogTargetGlobalHandlerImpl) Handle(params log_target.CreateLogTargetGlobalParams, principal any) middleware.Responder { - g := CreateLogTargetHandlerImpl(*h) - paramsG := log_target.CreateLogTargetBackendParams{ - Data: params.Data, - HTTPRequest: params.HTTPRequest, - ForceReload: params.ForceReload, - Index: params.Index, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - Version: params.Version, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} - -func (h *GetLogTargetGlobalHandlerImpl) Handle(params log_target.GetLogTargetGlobalParams, principal any) middleware.Responder { - g := GetLogTargetHandlerImpl(*h) - paramsG := log_target.GetLogTargetBackendParams{ - HTTPRequest: params.HTTPRequest, - Index: params.Index, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} - -func (h *GetAllLogTargetGlobalHandlerImpl) Handle(params log_target.GetAllLogTargetGlobalParams, principal any) middleware.Responder { - g := GetAllLogTargetHandlerImpl(*h) - paramsG := log_target.GetAllLogTargetBackendParams{ - HTTPRequest: params.HTTPRequest, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} - -func (h *DeleteLogTargetGlobalHandlerImpl) Handle(params log_target.DeleteLogTargetGlobalParams, principal any) middleware.Responder { - g := DeleteLogTargetHandlerImpl(*h) - paramsG := log_target.DeleteLogTargetBackendParams{ - HTTPRequest: params.HTTPRequest, - ForceReload: params.ForceReload, - Index: params.Index, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - Version: params.Version, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} - -func (h *ReplaceLogTargetGlobalHandlerImpl) Handle(params log_target.ReplaceLogTargetGlobalParams, principal any) middleware.Responder { - g := ReplaceLogTargetHandlerImpl(*h) - paramsG := log_target.ReplaceLogTargetBackendParams{ - Data: params.Data, - HTTPRequest: params.HTTPRequest, - ForceReload: params.ForceReload, - Index: params.Index, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - Version: params.Version, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} - -func (h *ReplaceAllLogTargetGlobalHandlerImpl) Handle(params log_target.ReplaceAllLogTargetGlobalParams, principal any) middleware.Responder { - g := ReplaceAllLogTargetHandlerImpl(*h) - paramsG := log_target.ReplaceAllLogTargetBackendParams{ - Data: params.Data, - HTTPRequest: params.HTTPRequest, - ForceReload: params.ForceReload, - ParentName: "", // empty for Global - TransactionID: params.TransactionID, - Version: params.Version, - } - return g.Handle(cnconstants.GlobalParentType, paramsG, principal) -} diff --git a/handlers/parent_quic_initial_rule_generated.go b/handlers/parent_quic_initial_rule_generated.go deleted file mode 100644 index 53a5284c..00000000 --- a/handlers/parent_quic_initial_rule_generated.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/quic_initial_rule" -) - -type ( - CreateQUICInitialRuleFrontendHandlerImpl CreateQUICInitialRuleHandlerImpl - CreateQUICInitialRuleDefaultsHandlerImpl CreateQUICInitialRuleHandlerImpl -) - -type ( - GetQUICInitialRuleFrontendHandlerImpl GetQUICInitialRuleHandlerImpl - GetQUICInitialRuleDefaultsHandlerImpl GetQUICInitialRuleHandlerImpl -) - -type ( - GetAllQUICInitialRuleFrontendHandlerImpl GetAllQUICInitialRuleHandlerImpl - GetAllQUICInitialRuleDefaultsHandlerImpl GetAllQUICInitialRuleHandlerImpl -) - -type ( - DeleteQUICInitialRuleFrontendHandlerImpl DeleteQUICInitialRuleHandlerImpl - DeleteQUICInitialRuleDefaultsHandlerImpl DeleteQUICInitialRuleHandlerImpl -) - -type ( - ReplaceQUICInitialRuleFrontendHandlerImpl ReplaceQUICInitialRuleHandlerImpl - ReplaceQUICInitialRuleDefaultsHandlerImpl ReplaceQUICInitialRuleHandlerImpl -) - -type ( - ReplaceAllQUICInitialRuleFrontendHandlerImpl ReplaceAllQUICInitialRuleHandlerImpl - ReplaceAllQUICInitialRuleDefaultsHandlerImpl ReplaceAllQUICInitialRuleHandlerImpl -) - -func (h *CreateQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.CreateQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := CreateQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *CreateQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.CreateQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := CreateQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.CreateQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.GetQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := GetQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *GetQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.GetQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := GetQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.GetQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.GetAllQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := GetAllQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *GetAllQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.GetAllQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.GetAllQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.DeleteQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := DeleteQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *DeleteQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.DeleteQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.DeleteQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.ReplaceQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *ReplaceQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.ReplaceQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.ReplaceQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllQUICInitialRuleFrontendHandlerImpl) Handle(params quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllQUICInitialRuleHandlerImpl(*h) - return g.Handle(cnconstants.FrontendParentType, params, principal) -} - -func (h *ReplaceAllQUICInitialRuleDefaultsHandlerImpl) Handle(params quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllQUICInitialRuleHandlerImpl(*h) - pg := quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_server_generated.go b/handlers/parent_server_generated.go deleted file mode 100644 index 147ddbd1..00000000 --- a/handlers/parent_server_generated.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/server" -) - -type ( - CreateServerBackendHandlerImpl CreateServerHandlerImpl - CreateServerPeerHandlerImpl CreateServerHandlerImpl - CreateServerRingHandlerImpl CreateServerHandlerImpl -) - -type ( - GetServerBackendHandlerImpl GetServerHandlerImpl - GetServerPeerHandlerImpl GetServerHandlerImpl - GetServerRingHandlerImpl GetServerHandlerImpl -) - -type ( - GetAllServerBackendHandlerImpl GetAllServerHandlerImpl - GetAllServerPeerHandlerImpl GetAllServerHandlerImpl - GetAllServerRingHandlerImpl GetAllServerHandlerImpl -) - -type ( - DeleteServerBackendHandlerImpl DeleteServerHandlerImpl - DeleteServerPeerHandlerImpl DeleteServerHandlerImpl - DeleteServerRingHandlerImpl DeleteServerHandlerImpl -) - -type ( - ReplaceServerBackendHandlerImpl ReplaceServerHandlerImpl - ReplaceServerPeerHandlerImpl ReplaceServerHandlerImpl - ReplaceServerRingHandlerImpl ReplaceServerHandlerImpl -) - -func (h *CreateServerBackendHandlerImpl) Handle(params server.CreateServerBackendParams, principal any) middleware.Responder { - g := CreateServerHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateServerPeerHandlerImpl) Handle(params server.CreateServerPeerParams, principal any) middleware.Responder { - g := CreateServerHandlerImpl(*h) - pg := server.CreateServerBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *CreateServerRingHandlerImpl) Handle(params server.CreateServerRingParams, principal any) middleware.Responder { - g := CreateServerHandlerImpl(*h) - pg := server.CreateServerBackendParams(params) - return g.Handle(cnconstants.RingParentType, pg, principal) -} - -func (h *GetServerBackendHandlerImpl) Handle(params server.GetServerBackendParams, principal any) middleware.Responder { - g := GetServerHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetServerPeerHandlerImpl) Handle(params server.GetServerPeerParams, principal any) middleware.Responder { - g := GetServerHandlerImpl(*h) - pg := server.GetServerBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetServerRingHandlerImpl) Handle(params server.GetServerRingParams, principal any) middleware.Responder { - g := GetServerHandlerImpl(*h) - pg := server.GetServerBackendParams(params) - return g.Handle(cnconstants.RingParentType, pg, principal) -} - -func (h *GetAllServerBackendHandlerImpl) Handle(params server.GetAllServerBackendParams, principal any) middleware.Responder { - g := GetAllServerHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllServerPeerHandlerImpl) Handle(params server.GetAllServerPeerParams, principal any) middleware.Responder { - g := GetAllServerHandlerImpl(*h) - pg := server.GetAllServerBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *GetAllServerRingHandlerImpl) Handle(params server.GetAllServerRingParams, principal any) middleware.Responder { - g := GetAllServerHandlerImpl(*h) - pg := server.GetAllServerBackendParams(params) - return g.Handle(cnconstants.RingParentType, pg, principal) -} - -func (h *DeleteServerBackendHandlerImpl) Handle(params server.DeleteServerBackendParams, principal any) middleware.Responder { - g := DeleteServerHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteServerPeerHandlerImpl) Handle(params server.DeleteServerPeerParams, principal any) middleware.Responder { - g := DeleteServerHandlerImpl(*h) - pg := server.DeleteServerBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *DeleteServerRingHandlerImpl) Handle(params server.DeleteServerRingParams, principal any) middleware.Responder { - g := DeleteServerHandlerImpl(*h) - pg := server.DeleteServerBackendParams(params) - return g.Handle(cnconstants.RingParentType, pg, principal) -} - -func (h *ReplaceServerBackendHandlerImpl) Handle(params server.ReplaceServerBackendParams, principal any) middleware.Responder { - g := ReplaceServerHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceServerPeerHandlerImpl) Handle(params server.ReplaceServerPeerParams, principal any) middleware.Responder { - g := ReplaceServerHandlerImpl(*h) - pg := server.ReplaceServerBackendParams(params) - return g.Handle(cnconstants.PeerParentType, pg, principal) -} - -func (h *ReplaceServerRingHandlerImpl) Handle(params server.ReplaceServerRingParams, principal any) middleware.Responder { - g := ReplaceServerHandlerImpl(*h) - pg := server.ReplaceServerBackendParams(params) - return g.Handle(cnconstants.RingParentType, pg, principal) -} diff --git a/handlers/parent_tcp_check_generated.go b/handlers/parent_tcp_check_generated.go deleted file mode 100644 index 26458608..00000000 --- a/handlers/parent_tcp_check_generated.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/tcp_check" -) - -type ( - CreateTCPCheckBackendHandlerImpl CreateTCPCheckHandlerImpl - CreateTCPCheckDefaultsHandlerImpl CreateTCPCheckHandlerImpl -) - -type ( - GetTCPCheckBackendHandlerImpl GetTCPCheckHandlerImpl - GetTCPCheckDefaultsHandlerImpl GetTCPCheckHandlerImpl -) - -type ( - GetAllTCPCheckBackendHandlerImpl GetAllTCPCheckHandlerImpl - GetAllTCPCheckDefaultsHandlerImpl GetAllTCPCheckHandlerImpl -) - -type ( - DeleteTCPCheckBackendHandlerImpl DeleteTCPCheckHandlerImpl - DeleteTCPCheckDefaultsHandlerImpl DeleteTCPCheckHandlerImpl -) - -type ( - ReplaceTCPCheckBackendHandlerImpl ReplaceTCPCheckHandlerImpl - ReplaceTCPCheckDefaultsHandlerImpl ReplaceTCPCheckHandlerImpl -) - -type ( - ReplaceAllTCPCheckBackendHandlerImpl ReplaceAllTCPCheckHandlerImpl - ReplaceAllTCPCheckDefaultsHandlerImpl ReplaceAllTCPCheckHandlerImpl -) - -func (h *CreateTCPCheckBackendHandlerImpl) Handle(params tcp_check.CreateTCPCheckBackendParams, principal any) middleware.Responder { - g := CreateTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.CreateTCPCheckDefaultsParams, principal any) middleware.Responder { - g := CreateTCPCheckHandlerImpl(*h) - pg := tcp_check.CreateTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetTCPCheckBackendHandlerImpl) Handle(params tcp_check.GetTCPCheckBackendParams, principal any) middleware.Responder { - g := GetTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.GetTCPCheckDefaultsParams, principal any) middleware.Responder { - g := GetTCPCheckHandlerImpl(*h) - pg := tcp_check.GetTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllTCPCheckBackendHandlerImpl) Handle(params tcp_check.GetAllTCPCheckBackendParams, principal any) middleware.Responder { - g := GetAllTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.GetAllTCPCheckDefaultsParams, principal any) middleware.Responder { - g := GetAllTCPCheckHandlerImpl(*h) - pg := tcp_check.GetAllTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteTCPCheckBackendHandlerImpl) Handle(params tcp_check.DeleteTCPCheckBackendParams, principal any) middleware.Responder { - g := DeleteTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.DeleteTCPCheckDefaultsParams, principal any) middleware.Responder { - g := DeleteTCPCheckHandlerImpl(*h) - pg := tcp_check.DeleteTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceTCPCheckBackendHandlerImpl) Handle(params tcp_check.ReplaceTCPCheckBackendParams, principal any) middleware.Responder { - g := ReplaceTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.ReplaceTCPCheckDefaultsParams, principal any) middleware.Responder { - g := ReplaceTCPCheckHandlerImpl(*h) - pg := tcp_check.ReplaceTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllTCPCheckBackendHandlerImpl) Handle(params tcp_check.ReplaceAllTCPCheckBackendParams, principal any) middleware.Responder { - g := ReplaceAllTCPCheckHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllTCPCheckDefaultsHandlerImpl) Handle(params tcp_check.ReplaceAllTCPCheckDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllTCPCheckHandlerImpl(*h) - pg := tcp_check.ReplaceAllTCPCheckBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_tcp_request_rule_generated.go b/handlers/parent_tcp_request_rule_generated.go deleted file mode 100644 index a6ed2670..00000000 --- a/handlers/parent_tcp_request_rule_generated.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/tcp_request_rule" -) - -type ( - CreateTCPRequestRuleBackendHandlerImpl CreateTCPRequestRuleHandlerImpl - CreateTCPRequestRuleFrontendHandlerImpl CreateTCPRequestRuleHandlerImpl - CreateTCPRequestRuleDefaultsHandlerImpl CreateTCPRequestRuleHandlerImpl -) - -type ( - GetTCPRequestRuleBackendHandlerImpl GetTCPRequestRuleHandlerImpl - GetTCPRequestRuleFrontendHandlerImpl GetTCPRequestRuleHandlerImpl - GetTCPRequestRuleDefaultsHandlerImpl GetTCPRequestRuleHandlerImpl -) - -type ( - GetAllTCPRequestRuleBackendHandlerImpl GetAllTCPRequestRuleHandlerImpl - GetAllTCPRequestRuleFrontendHandlerImpl GetAllTCPRequestRuleHandlerImpl - GetAllTCPRequestRuleDefaultsHandlerImpl GetAllTCPRequestRuleHandlerImpl -) - -type ( - DeleteTCPRequestRuleBackendHandlerImpl DeleteTCPRequestRuleHandlerImpl - DeleteTCPRequestRuleFrontendHandlerImpl DeleteTCPRequestRuleHandlerImpl - DeleteTCPRequestRuleDefaultsHandlerImpl DeleteTCPRequestRuleHandlerImpl -) - -type ( - ReplaceTCPRequestRuleBackendHandlerImpl ReplaceTCPRequestRuleHandlerImpl - ReplaceTCPRequestRuleFrontendHandlerImpl ReplaceTCPRequestRuleHandlerImpl - ReplaceTCPRequestRuleDefaultsHandlerImpl ReplaceTCPRequestRuleHandlerImpl -) - -type ( - ReplaceAllTCPRequestRuleBackendHandlerImpl ReplaceAllTCPRequestRuleHandlerImpl - ReplaceAllTCPRequestRuleFrontendHandlerImpl ReplaceAllTCPRequestRuleHandlerImpl - ReplaceAllTCPRequestRuleDefaultsHandlerImpl ReplaceAllTCPRequestRuleHandlerImpl -) - -func (h *CreateTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.CreateTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := CreateTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.CreateTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := CreateTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.CreateTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *CreateTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.CreateTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := CreateTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.CreateTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.GetTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := GetTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.GetTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := GetTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.GetTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.GetTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := GetTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.GetTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.GetAllTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := GetAllTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.GetAllTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := GetAllTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.GetAllTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *GetAllTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.GetAllTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.GetAllTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.DeleteTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := DeleteTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.DeleteTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := DeleteTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.DeleteTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *DeleteTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.DeleteTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.DeleteTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.ReplaceTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := ReplaceTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.ReplaceTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.ReplaceTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.ReplaceTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.ReplaceTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllTCPRequestRuleBackendHandlerImpl) Handle(params tcp_request_rule.ReplaceAllTCPRequestRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllTCPRequestRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllTCPRequestRuleFrontendHandlerImpl) Handle(params tcp_request_rule.ReplaceAllTCPRequestRuleFrontendParams, principal any) middleware.Responder { - g := ReplaceAllTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.ReplaceAllTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.FrontendParentType, pg, principal) -} - -func (h *ReplaceAllTCPRequestRuleDefaultsHandlerImpl) Handle(params tcp_request_rule.ReplaceAllTCPRequestRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllTCPRequestRuleHandlerImpl(*h) - pg := tcp_request_rule.ReplaceAllTCPRequestRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/parent_tcp_response_rule_generated.go b/handlers/parent_tcp_response_rule_generated.go deleted file mode 100644 index 6835d06d..00000000 --- a/handlers/parent_tcp_response_rule_generated.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/operations/tcp_response_rule" -) - -type ( - CreateTCPResponseRuleBackendHandlerImpl CreateTCPResponseRuleHandlerImpl - CreateTCPResponseRuleDefaultsHandlerImpl CreateTCPResponseRuleHandlerImpl -) - -type ( - GetTCPResponseRuleBackendHandlerImpl GetTCPResponseRuleHandlerImpl - GetTCPResponseRuleDefaultsHandlerImpl GetTCPResponseRuleHandlerImpl -) - -type ( - GetAllTCPResponseRuleBackendHandlerImpl GetAllTCPResponseRuleHandlerImpl - GetAllTCPResponseRuleDefaultsHandlerImpl GetAllTCPResponseRuleHandlerImpl -) - -type ( - DeleteTCPResponseRuleBackendHandlerImpl DeleteTCPResponseRuleHandlerImpl - DeleteTCPResponseRuleDefaultsHandlerImpl DeleteTCPResponseRuleHandlerImpl -) - -type ( - ReplaceTCPResponseRuleBackendHandlerImpl ReplaceTCPResponseRuleHandlerImpl - ReplaceTCPResponseRuleDefaultsHandlerImpl ReplaceTCPResponseRuleHandlerImpl -) - -type ( - ReplaceAllTCPResponseRuleBackendHandlerImpl ReplaceAllTCPResponseRuleHandlerImpl - ReplaceAllTCPResponseRuleDefaultsHandlerImpl ReplaceAllTCPResponseRuleHandlerImpl -) - -func (h *CreateTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.CreateTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := CreateTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *CreateTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.CreateTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := CreateTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.CreateTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.GetTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := GetTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.GetTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.GetTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *GetAllTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.GetAllTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := GetAllTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *GetAllTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.GetAllTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := GetAllTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.GetAllTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *DeleteTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.DeleteTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := DeleteTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *DeleteTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.DeleteTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := DeleteTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.DeleteTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.ReplaceTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.ReplaceTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.ReplaceTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} - -func (h *ReplaceAllTCPResponseRuleBackendHandlerImpl) Handle(params tcp_response_rule.ReplaceAllTCPResponseRuleBackendParams, principal any) middleware.Responder { - g := ReplaceAllTCPResponseRuleHandlerImpl(*h) - return g.Handle(cnconstants.BackendParentType, params, principal) -} - -func (h *ReplaceAllTCPResponseRuleDefaultsHandlerImpl) Handle(params tcp_response_rule.ReplaceAllTCPResponseRuleDefaultsParams, principal any) middleware.Responder { - g := ReplaceAllTCPResponseRuleHandlerImpl(*h) - pg := tcp_response_rule.ReplaceAllTCPResponseRuleBackendParams(params) - return g.Handle(cnconstants.DefaultsParentType, pg, principal) -} diff --git a/handlers/peer.go b/handlers/peer.go deleted file mode 100644 index de53734c..00000000 --- a/handlers/peer.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/peer" -) - -// CreatePeerHandlerImpl implementation of the CreatePeerHandler interface using client-native client -type CreatePeerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeletePeerHandlerImpl implementation of the DeletePeerHandler interface using client-native client -type DeletePeerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetPeerHandlerImpl implementation of the GetPeerHandler interface using client-native client -type GetPeerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetPeersHandlerImpl implementation of the GetPeersHandler interface using client-native client -type GetPeersHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplacePeerHandlerImpl implementation of the ReplacePeerHandler interface using client-native client -type ReplacePeerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreatePeerHandlerImpl) Handle(params peer.CreatePeerParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return peer.NewCreatePeerDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createPeerSection(params, t, v) - if err != nil { - e := misc.HandleError(err) - return peer.NewCreatePeerDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return peer.NewCreatePeerDefault(int(*e.Code)).WithPayload(e) - } - return peer.NewCreatePeerCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return peer.NewCreatePeerAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return peer.NewCreatePeerAccepted().WithPayload(params.Data) -} - -func (h *CreatePeerHandlerImpl) createPeerSection(params peer.CreatePeerParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredPeerSection(params.Data, t, v) - } - return configuration.CreatePeerSection(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeletePeerHandlerImpl) Handle(params peer.DeletePeerParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return peer.NewDeletePeerDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer.NewDeletePeerDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeletePeerSection(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return peer.NewDeletePeerDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return peer.NewDeletePeerDefault(int(*e.Code)).WithPayload(e) - } - return peer.NewDeletePeerNoContent() - } - rID := h.ReloadAgent.Reload() - return peer.NewDeletePeerAccepted().WithReloadID(rID) - } - return peer.NewDeletePeerAccepted() -} - -// Handle executing the request and returning a response -func (h *GetPeerHandlerImpl) Handle(params peer.GetPeerSectionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, p, err := h.getPeerSection(params, t) - if err != nil { - e := misc.HandleError(err) - return peer.NewGetPeerSectionDefault(int(*e.Code)).WithPayload(e) - } - return peer.NewGetPeerSectionOK().WithPayload(p) -} - -func (h *GetPeerHandlerImpl) getPeerSection(params peer.GetPeerSectionParams, t string) (int64, *models.PeerSection, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredPeerSection(params.Name, t) - } - return configuration.GetPeerSection(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetPeersHandlerImpl) Handle(params peer.GetPeerSectionsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, ps, err := h.getPeerSections(params, t) - if err != nil { - e := misc.HandleError(err) - return peer.NewGetPeerSectionsDefault(int(*e.Code)).WithPayload(e) - } - return peer.NewGetPeerSectionsOK().WithPayload(ps) -} - -func (h *GetPeersHandlerImpl) getPeerSections(params peer.GetPeerSectionsParams, t string) (int64, models.PeerSections, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredPeerSections(t) - } - return configuration.GetPeerSections(t) -} diff --git a/handlers/peer_entry.go b/handlers/peer_entry.go deleted file mode 100644 index ec00a3c9..00000000 --- a/handlers/peer_entry.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/peer_entry" -) - -// CreatePeerEntryHandlerImpl implementation of the CreatePeerEntryHandler interface using client-native client -type CreatePeerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeletePeerEntryHandlerImpl implementation of the DeletePeerEntryHandler interface using client-native client -type DeletePeerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetPeerEntryHandlerImpl implementation of the GetPeerEntryHandler interface using client-native client -type GetPeerEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetPeerEntriesHandlerImpl implementation of the GetPeerEntriesHandler interface using client-native client -type GetPeerEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplacePeerEntryHandlerImpl implementation of the ReplacePeerEntryHandler interface using client-native client -type ReplacePeerEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreatePeerEntryHandlerImpl) Handle(params peer_entry.CreatePeerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return peer_entry.NewCreatePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewCreatePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreatePeerEntry(params.PeerSection, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewCreatePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewCreatePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - return peer_entry.NewCreatePeerEntryCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return peer_entry.NewCreatePeerEntryAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return peer_entry.NewCreatePeerEntryAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeletePeerEntryHandlerImpl) Handle(params peer_entry.DeletePeerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return peer_entry.NewDeletePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewDeletePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeletePeerEntry(params.Name, params.PeerSection, t, v) - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewDeletePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewDeletePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - return peer_entry.NewDeletePeerEntryNoContent() - } - rID := h.ReloadAgent.Reload() - return peer_entry.NewDeletePeerEntryAccepted().WithReloadID(rID) - } - return peer_entry.NewDeletePeerEntryAccepted() -} - -// Handle executing the request and returning a response -func (h *GetPeerEntryHandlerImpl) Handle(params peer_entry.GetPeerEntryParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewGetPeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - _, pe, err := configuration.GetPeerEntry(params.Name, params.PeerSection, t) - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewGetPeerEntryDefault(int(*e.Code)).WithPayload(e) - } - return peer_entry.NewGetPeerEntryOK().WithPayload(pe) -} - -// Handle executing the request and returning a response -func (h *GetPeerEntriesHandlerImpl) Handle(params peer_entry.GetPeerEntriesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewGetPeerEntriesDefault(int(*e.Code)).WithPayload(e) - } - - _, pes, err := configuration.GetPeerEntries(params.PeerSection, t) - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewGetPeerEntriesDefault(int(*e.Code)).WithPayload(e) - } - return peer_entry.NewGetPeerEntriesOK().WithPayload(pes) -} - -// Handle executing the request and returning a response -func (h *ReplacePeerEntryHandlerImpl) Handle(params peer_entry.ReplacePeerEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return peer_entry.NewReplacePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewReplacePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditPeerEntry(params.Name, params.PeerSection, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewReplacePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return peer_entry.NewReplacePeerEntryDefault(int(*e.Code)).WithPayload(e) - } - return peer_entry.NewReplacePeerEntryOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return peer_entry.NewReplacePeerEntryAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return peer_entry.NewReplacePeerEntryAccepted().WithPayload(params.Data) -} diff --git a/handlers/program.go b/handlers/program.go deleted file mode 100644 index 915db1a4..00000000 --- a/handlers/program.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2022 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/process_manager" -) - -type DeleteProgramHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (d DeleteProgramHandlerImpl) Handle(params process_manager.DeleteProgramParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return process_manager.NewDeleteProgramDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := d.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return process_manager.NewDeleteProgramDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.DeleteProgram(params.Name, t, v); err != nil { - e := misc.HandleError(err) - return process_manager.NewDeleteProgramDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = d.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return process_manager.NewDeleteProgramDefault(int(*e.Code)).WithPayload(e) - } - - return process_manager.NewDeleteProgramNoContent() - } - - return process_manager.NewDeleteProgramAccepted().WithReloadID(d.ReloadAgent.Reload()) - } - - return process_manager.NewDeleteProgramAccepted() -} - -type CreateProgramHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (c CreateProgramHandlerImpl) Handle(params process_manager.CreateProgramParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return process_manager.NewCreateProgramDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := c.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return process_manager.NewCreateProgramDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateProgram(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return process_manager.NewCreateProgramDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = c.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return process_manager.NewCreateProgramDefault(int(*e.Code)).WithPayload(e) - } - - return process_manager.NewCreateProgramCreated().WithPayload(params.Data) - } - - return process_manager.NewCreateProgramAccepted().WithReloadID(c.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return process_manager.NewCreateProgramAccepted().WithPayload(params.Data) -} - -type GetProgramHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetProgramHandlerImpl) Handle(params process_manager.GetProgramParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - - return process_manager.NewGetProgramDefault(int(*e.Code)).WithPayload(e) - } - - _, r, err := configuration.GetProgram(params.Name, t) - if err != nil { - e := misc.HandleError(err) - - return process_manager.NewGetProgramDefault(int(*e.Code)).WithPayload(e) - } - - return process_manager.NewGetProgramOK().WithPayload(r) -} - -type GetProgramsHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetProgramsHandlerImpl) Handle(params process_manager.GetProgramsParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - - return process_manager.NewGetProgramsDefault(int(*e.Code)).WithPayload(e) - } - - _, r, err := configuration.GetPrograms(t) - if err != nil { - e := misc.HandleError(err) - - return process_manager.NewGetProgramsDefault(int(*e.Code)).WithPayload(e) - } - - return process_manager.NewGetProgramsOK().WithPayload(r) -} - -type ReplaceProgramHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (r ReplaceProgramHandlerImpl) Handle(params process_manager.ReplaceProgramParams, _ any) middleware.Responder { - var t string - var v int64 - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - code := misc.ErrHTTPBadRequest - - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: &code, - } - - return process_manager.NewReplaceProgramDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := r.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - - return process_manager.NewReplaceProgramDefault(int(*e.Code)).WithPayload(e) - } - - params.Data.Name = params.Name - - if err = configuration.EditProgram(params.Name, params.Data, t, v); err != nil { - e := misc.HandleError(err) - - return process_manager.NewReplaceProgramDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = r.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - - return process_manager.NewReplaceProgramDefault(int(*e.Code)).WithPayload(e) - } - - return process_manager.NewReplaceProgramOK().WithPayload(params.Data) - } - - return process_manager.NewReplaceProgramAccepted().WithReloadID(r.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return process_manager.NewReplaceProgramAccepted().WithPayload(params.Data) -} diff --git a/handlers/quic_initial_rule.go b/handlers/quic_initial_rule.go deleted file mode 100644 index a6c6493e..00000000 --- a/handlers/quic_initial_rule.go +++ /dev/null @@ -1,269 +0,0 @@ -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/quic_initial_rule" -) - -type CreateQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (c CreateQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.CreateQUICInitialRuleFrontendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return quic_initial_rule.NewCreateQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := c.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewCreateQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateQUICInitialRule(params.Index, string(parentType), params.ParentName, params.Data, t, v); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewCreateQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = c.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewCreateQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - return quic_initial_rule.NewCreateQUICInitialRuleFrontendCreated().WithPayload(params.Data) - } - - return quic_initial_rule.NewCreateQUICInitialRuleFrontendAccepted().WithReloadID(c.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return quic_initial_rule.NewCreateQUICInitialRuleFrontendAccepted().WithPayload(params.Data) -} - -type DeleteQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (d DeleteQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.DeleteQUICInitialRuleFrontendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := d.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.DeleteQUICInitialRule(params.Index, string(parentType), params.ParentName, t, v); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = d.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendNoContent() - } - - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendAccepted().WithReloadID(d.ReloadAgent.Reload()) - } - - return quic_initial_rule.NewDeleteQUICInitialRuleFrontendAccepted() -} - -type GetQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.GetQUICInitialRuleFrontendParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewGetQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetQUICInitialRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewGetQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - return quic_initial_rule.NewGetQUICInitialRuleFrontendOK().WithPayload(rule) -} - -type GetAllQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (g GetAllQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.GetAllQUICInitialRuleFrontendParams, _ any) middleware.Responder { - var t string - - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := g.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewGetAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetQUICInitialRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewGetAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - return quic_initial_rule.NewGetAllQUICInitialRuleFrontendOK().WithPayload(rules) -} - -type ReplaceQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (r ReplaceQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.ReplaceQUICInitialRuleFrontendParams, _ any) middleware.Responder { - t, v := "", int64(0) - - if params.TransactionID != nil { - t = *params.TransactionID - } - - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - e := &models.Error{ - Message: misc.StringP("Both force_reload and transaction specified, specify only one"), - Code: misc.Int64P(int(misc.ErrHTTPBadRequest)), - } - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := r.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.EditQUICInitialRule(params.Index, string(parentType), params.ParentName, params.Data, t, v); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - if err = r.ReloadAgent.ForceReload(); err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendOK().WithPayload(params.Data) - } - - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendAccepted().WithReloadID(r.ReloadAgent.Reload()).WithPayload(params.Data) - } - - return quic_initial_rule.NewReplaceQUICInitialRuleFrontendAccepted().WithPayload(params.Data) -} - -type ReplaceAllQUICInitialRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *ReplaceAllQUICInitialRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceQUICInitialRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendDefault(int(*e.Code)).WithPayload(e) - } - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return quic_initial_rule.NewReplaceAllQUICInitialRuleFrontendAccepted().WithPayload(params.Data) -} diff --git a/handlers/raw.go b/handlers/raw.go deleted file mode 100644 index 01fe1e05..00000000 --- a/handlers/raw.go +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "encoding/json" - "fmt" - "net/http" - "strconv" - "strings" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - cn "github.com/haproxytech/dataplaneapi/client-native" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/configuration" -) - -// GetRawConfigurationHandlerImpl implementation of the GetHAProxyConfigurationHandler interface -type GetRawConfigurationHandlerImpl struct { - Client client_native.HAProxyClient -} - -// PostRawConfigurationHandlerImpl implementation of the PostHAProxyConfigurationHandler interface -type PostRawConfigurationHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *GetRawConfigurationHandlerImpl) Handle(params configuration.GetHAProxyConfigurationParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - v := int64(0) - if params.Version != nil { - v = *params.Version - } - - cfg, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return configuration.NewGetConfigurationVersionDefault(int(*e.Code)).WithPayload(e) - } - - _, clusterVersion, md5Hash, data, err := cfg.GetRawConfigurationWithClusterData(t, v) - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewGetHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - cVersion := "" - if clusterVersion != 0 { - cVersion = strconv.FormatInt(clusterVersion, 10) - } - return configuration.NewGetHAProxyConfigurationOK().WithPayload(data).WithClusterVersion(cVersion).WithConfigurationChecksum(md5Hash) -} - -// Handle executing the request and returning a response -func (h *PostRawConfigurationHandlerImpl) Handle(params configuration.PostHAProxyConfigurationParams, principal any) middleware.Responder { - v := int64(0) - if params.Version != nil { - v = *params.Version - } - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - skipVersion := false - if params.SkipVersion != nil { - skipVersion = *params.SkipVersion - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - onlyValidate := false - if params.OnlyValidate != nil { - onlyValidate = *params.OnlyValidate - } - - // Check for a common error where the user ran `curl -d @haproxy.cfg` without - // converting the file to json, which removes all the \n from the configuration. - if len(params.Data) > 0 && !strings.ContainsRune(params.Data, '\n') { - code := misc.ErrHTTPBadRequest - msg := "invalid configuration: no newline character found" - e := &models.Error{Code: &code, Message: &msg} - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationBadRequest().WithPayload(string(errorStr)) - } - - cfg, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - - err = cfg.PostRawConfiguration(¶ms.Data, v, skipVersion, onlyValidate) - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - - _, clusterVersion, md5Hash, data, err := cfg.GetRawConfigurationWithClusterData("", 0) - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - - cVersion := "" - if clusterVersion != 0 { - cVersion = strconv.FormatInt(clusterVersion, 10) - } - if onlyValidate { - // return here without reloading, since config is only validated. - return configuration.NewPostHAProxyConfigurationAccepted().WithPayload(data).WithClusterVersion(cVersion).WithConfigurationChecksum(md5Hash) - } - if skipReload { - if params.XRuntimeActions != nil { - if err = executeRuntimeActions(*params.XRuntimeActions, h.Client); err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - } - return configuration.NewPostHAProxyConfigurationCreated().WithPayload(data).WithClusterVersion(cVersion).WithConfigurationChecksum(md5Hash) - } - if forceReload { - var callbackNeeded bool - var reconfigureFunc func() - callbackNeeded, reconfigureFunc, err = cn.ReconfigureRuntime(h.Client) - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - if callbackNeeded { - err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) - } else { - err = h.ReloadAgent.ForceReload() - } - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - return configuration.NewPostHAProxyConfigurationCreated().WithPayload(data).WithClusterVersion(cVersion).WithConfigurationChecksum(md5Hash) - } - callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) - if err != nil { - e := misc.HandleError(err) - errorStr, marshallError := json.Marshal(e) - if marshallError != nil { - configuration.NewPostHAProxyConfigurationDefault(http.StatusInternalServerError).WithPayload(marshallError.Error()) - } - return configuration.NewPostHAProxyConfigurationDefault(int(*e.Code)).WithPayload(string(errorStr)) - } - - var rID string - if callbackNeeded { - rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) - } else { - rID = h.ReloadAgent.Reload() - } - - return configuration.NewPostHAProxyConfigurationAccepted().WithReloadID(rID).WithPayload(data).WithClusterVersion(cVersion).WithConfigurationChecksum(md5Hash) -} - -func executeRuntimeActions(actionsStr string, client client_native.HAProxyClient) error { - runtime, err := client.Runtime() - if err != nil { - return err - } - actions := strings.SplitSeq(actionsStr, ";") - for a := range actions { - params := strings.Split(a, " ") - if len(params) == 0 { - continue - } - action := params[0] - switch action { - case "SetFrontendMaxConn": - if len(params) > 2 { - fName := params[1] - maxConn, err := strconv.ParseInt(params[2], 10, 64) - if err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - if err := runtime.SetFrontendMaxConn(fName, int(maxConn)); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerWeight": - if len(params) > 3 { - backend := params[1] - server := params[2] - weight := params[3] - if err := runtime.SetServerWeight(backend, server, weight); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerCheckPort": - if len(params) > 3 { - backend := params[1] - server := params[2] - port, err := strconv.ParseInt(params[3], 10, 64) - if err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - if err := runtime.SetServerCheckPort(backend, server, int(port)); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerAddr": - if len(params) > 4 { - backend := params[1] - server := params[2] - ip := params[3] - port, err := strconv.ParseInt(params[4], 10, 64) - if err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - if err := runtime.SetServerAddr(backend, server, ip, int(port)); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerState": - if len(params) > 3 { - backend := params[1] - server := params[2] - state := params[3] - if err := runtime.SetServerState(backend, server, state); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "EnableAgentCheck": - if len(params) > 2 { - backend := params[1] - server := params[2] - if err := runtime.EnableAgentCheck(backend, server); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "DisableAgentCheck": - if len(params) > 2 { - backend := params[1] - server := params[2] - if err := runtime.DisableAgentCheck(backend, server); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerAgentAddr": - if len(params) > 3 { - backend := params[1] - server := params[2] - addr := params[3] - if err := runtime.SetServerAgentAddr(backend, server, addr); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - case "SetServerAgentSend": - if len(params) > 3 { - backend := params[1] - server := params[2] - send := params[3] - if err := runtime.SetServerAgentSend(backend, server, send); err != nil { - return fmt.Errorf("cannot execute %s: %s", action, err.Error()) - } - } else { - return fmt.Errorf("cannot execute %s: not enough parameters", action) - } - } - } - return nil -} diff --git a/handlers/reloads.go b/handlers/reloads.go deleted file mode 100644 index 74d3a7da..00000000 --- a/handlers/reloads.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "fmt" - - "github.com/go-openapi/runtime/middleware" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/reloads" -) - -// GetReloadHandlerImpl implementation of the GetReloadHandler interface using client-native client -type GetReloadHandlerImpl struct { - ReloadAgent haproxy.IReloadAgent -} - -// GetReloadsHandlerImpl implementation of the GetReloadsHandler interface using client-native client -type GetReloadsHandlerImpl struct { - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (rh *GetReloadHandlerImpl) Handle(params reloads.GetReloadParams, principal any) middleware.Responder { - r := rh.ReloadAgent.GetReload(params.ID) - if r == nil { - msg := fmt.Sprintf("Reload with ID %s does not exist", params.ID) - c := misc.ErrHTTPNotFound - e := &models.Error{ - Code: &c, - Message: &msg, - } - return reloads.NewGetReloadDefault(404).WithPayload(e) - } - return reloads.NewGetReloadOK().WithPayload(r) -} - -// Handle executing the request and returning a response -func (rh *GetReloadsHandlerImpl) Handle(params reloads.GetReloadsParams, principal any) middleware.Responder { - rs := rh.ReloadAgent.GetReloads() - return reloads.NewGetReloadsOK().WithPayload(rs) -} diff --git a/handlers/resolver.go b/handlers/resolver.go deleted file mode 100644 index 45a8ca7a..00000000 --- a/handlers/resolver.go +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/resolver" -) - -// CreateResolverHandlerImpl implementation of the CreateResolverHandler interface using client-native client -type CreateResolverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteResolverHandlerImpl implementation of the DeleteResolverHandler interface using client-native client -type DeleteResolverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetResolverHandlerImpl implementation of the GetResolverHandler interface using client-native client -type GetResolverHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetResolversHandlerImpl implementation of the GetResolversHandler interface using client-native client -type GetResolversHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceResolverHandlerImpl implementation of the ReplaceResolverHandler interface using client-native client -type ReplaceResolverHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateResolverHandlerImpl) Handle(params resolver.CreateResolverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return resolver.NewCreateResolverDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return resolver.NewCreateResolverDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateResolver(params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return resolver.NewCreateResolverDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return resolver.NewCreateResolverDefault(int(*e.Code)).WithPayload(e) - } - return resolver.NewCreateResolverCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return resolver.NewCreateResolverAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return resolver.NewCreateResolverAccepted().WithPayload(params.Data) -} - -func (h *CreateResolverHandlerImpl) getResolver(params resolver.CreateResolverParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredResolver(params.Data, t, v) - } - return configuration.CreateResolver(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteResolverHandlerImpl) Handle(params resolver.DeleteResolverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return resolver.NewDeleteResolverDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return resolver.NewDeleteResolverDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteResolver(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return resolver.NewDeleteResolverDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return resolver.NewDeleteResolverDefault(int(*e.Code)).WithPayload(e) - } - return resolver.NewDeleteResolverNoContent() - } - rID := h.ReloadAgent.Reload() - return resolver.NewDeleteResolverAccepted().WithReloadID(rID) - } - return resolver.NewDeleteResolverAccepted() -} - -// Handle executing the request and returning a response -func (h *GetResolverHandlerImpl) Handle(params resolver.GetResolverParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, r, err := h.getResolver(params, t) - if err != nil { - e := misc.HandleError(err) - return resolver.NewGetResolverDefault(int(*e.Code)).WithPayload(e) - } - return resolver.NewGetResolverOK().WithPayload(r) -} - -func (h *GetResolverHandlerImpl) getResolver(params resolver.GetResolverParams, t string) (int64, *models.Resolver, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredResolver(params.Name, t) - } - return configuration.GetResolver(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetResolversHandlerImpl) Handle(params resolver.GetResolversParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, rs, err := h.getResolvers(params, t) - if err != nil { - e := misc.HandleError(err) - return resolver.NewGetResolversDefault(int(*e.Code)).WithPayload(e) - } - return resolver.NewGetResolversOK().WithPayload(rs) -} - -func (h *GetResolversHandlerImpl) getResolvers(params resolver.GetResolversParams, t string) (int64, models.Resolvers, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredResolvers(t) - } - return configuration.GetResolvers(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceResolverHandlerImpl) Handle(params resolver.ReplaceResolverParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return resolver.NewReplaceResolverDefault(int(*e.Code)).WithPayload(e) - } - - err := h.editResolver(params, t, v) - if err != nil { - e := misc.HandleError(err) - return resolver.NewReplaceResolverDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return resolver.NewReplaceResolverDefault(int(*e.Code)).WithPayload(e) - } - return resolver.NewReplaceResolverOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return resolver.NewReplaceResolverAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return resolver.NewReplaceResolverAccepted().WithPayload(params.Data) -} - -func (h *ReplaceResolverHandlerImpl) editResolver(params resolver.ReplaceResolverParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredResolver(params.Name, params.Data, t, v) - } - return configuration.EditResolver(params.Name, params.Data, t, v) -} diff --git a/handlers/respond/respond.go b/handlers/respond/respond.go new file mode 100644 index 00000000..ddb633b2 --- /dev/null +++ b/handlers/respond/respond.go @@ -0,0 +1,238 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package respond + +import ( + "bytes" + "errors" + "fmt" + "io" + "net/http" + "strings" + + "github.com/go-chi/chi/v5" + "github.com/go-openapi/strfmt" + "github.com/haproxytech/client-native/v6/models" + jsoniter "github.com/json-iterator/go" + + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" +) + +var json = jsoniter.ConfigCompatibleWithStandardLibrary + +// ReloadIDHeader is the response header carrying the reload identifier for 202 +// responses. The spec spells it "Reload-ID", but header names are +// case-insensitive and http.Header.Set canonicalizes any spelling to +// "Reload-Id" on the wire, so the constant uses the canonical form directly. +const ReloadIDHeader = "Reload-Id" + +// JSON writes status and payload as JSON. A nil payload produces an empty body +// with no Content-Type, matching the previous go-swagger responses. +// The payload is encoded before any byte is written, so a marshaling failure +// still produces a 500 instead of a truncated body with a success status. +func JSON(w http.ResponseWriter, status int, payload any) { + if payload == nil { + w.WriteHeader(status) + return + } + var buf bytes.Buffer + enc := json.NewEncoder(&buf) + enc.SetEscapeHTML(false) + if err := enc.Encode(payload); err != nil { + log.Errorf("encoding %T response payload: %v", payload, err) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusInternalServerError) + _, _ = w.Write([]byte(`{"code":500,"message":"failed to encode response payload"}` + "\n")) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(status) + if _, err := w.Write(buf.Bytes()); err != nil { + log.Errorf("writing response body: %v", err) + } +} + +// NoContent writes a 204 No Content response. +func NoContent(w http.ResponseWriter) { + w.WriteHeader(http.StatusNoContent) +} + +// Write writes a raw (non-JSON) body after the header has been written, +// logging the error if the write fails. The status can no longer change at +// that point, so logging is the only remaining evidence of a truncated body. +func Write(w http.ResponseWriter, b []byte) { + if _, err := w.Write(b); err != nil { + log.Errorf("writing response body: %v", err) + } +} + +// Copy streams src to w after the header has been written, logging the error +// if the copy fails. See Write. +func Copy(w http.ResponseWriter, src io.Reader) { + if _, err := io.Copy(w, src); err != nil { + log.Errorf("writing response body: %v", err) + } +} + +// Accepted writes a 202 Accepted response with a Reload-ID header and JSON payload. +// A nil payload produces an empty body, matching the previous go-swagger responses. +func Accepted(w http.ResponseWriter, reloadID string, payload any) { + if reloadID != "" { + w.Header().Set(ReloadIDHeader, reloadID) + } + JSON(w, http.StatusAccepted, payload) +} + +// Error translates err to a models.Error via misc.HandleError and writes the appropriate status. +func Error(w http.ResponseWriter, err error) { + e := misc.HandleError(err) + JSON(w, int(*e.Code), e) +} + +// RuntimeError translates err using misc.GetHTTPStatusFromErr (which maps +// client_errors.ErrGeneral to 400) and writes the resulting status. Runtime and +// storage operation handlers use this to preserve the pre-migration status codes, +// where general runtime/storage failures return 400 rather than 500. +func RuntimeError(w http.ResponseWriter, err error) { + status := misc.GetHTTPStatusFromErr(err) + code := int64(status) + msg := err.Error() + JSON(w, status, &models.Error{Code: &code, Message: &msg}) +} + +// MultipartError writes the error from parsing a multipart upload body. With +// body validation excluded for multipart operations, the first read of the +// body happens in the handler's ParseMultipartForm call, so an upload that +// hit the server's max-body-size cap surfaces here as *http.MaxBytesError and +// maps to 413, matching the validator's handling of buffered bodies. Any +// other parse failure is a plain 400. +func MultipartError(w http.ResponseWriter, err error) { + var maxBytesErr *http.MaxBytesError + if errors.As(err, &maxBytesErr) { + code := int64(http.StatusRequestEntityTooLarge) + msg := fmt.Sprintf("request body exceeds the maximum allowed size of %d bytes", maxBytesErr.Limit) + JSON(w, http.StatusRequestEntityTooLarge, &models.Error{Code: &code, Message: &msg}) + return + } + BadRequest(w, err.Error()) +} + +// BadRequest writes a 400 response with msg as the error message. +func BadRequest(w http.ResponseWriter, msg string) { + code := misc.ErrHTTPBadRequest + JSON(w, http.StatusBadRequest, &models.Error{Code: &code, Message: &msg}) +} + +// NotFound is the router's chi.NotFound handler. It replaces chi's default +// plain-text "404 page not found" body with the JSON shape the previous +// go-swagger server returned for unmatched routes: +// {"code":404,"message":"path was not found"}. +func NotFound(w http.ResponseWriter, r *http.Request) { + code := misc.ErrHTTPNotFound + msg := "path " + r.URL.Path + " was not found" + JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) +} + +// MethodNotAllowed returns the router's chi.MethodNotAllowed handler. It +// replaces chi's default plain-text "405 method not allowed" body with a JSON +// error and sets the Allow header RFC 9110 requires on 405 responses. chi does +// not expose the allowed-method list to custom 405 handlers, so the handler +// probes routes for each standard method; routes must be the router the +// handler is registered on, since the probe path is relative to it. +func MethodNotAllowed(routes chi.Routes) http.HandlerFunc { + methods := []string{ + http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, + http.MethodPatch, http.MethodDelete, http.MethodOptions, + } + return func(w http.ResponseWriter, r *http.Request) { + // Inside a mounted sub-router the registered patterns do not carry the + // mount prefix; chi records the trimmed path in RoutePath. + path := r.URL.Path + if rctx := chi.RouteContext(r.Context()); rctx != nil && rctx.RoutePath != "" { + path = rctx.RoutePath + } + var allowed []string + for _, m := range methods { + if routes.Match(chi.NewRouteContext(), m, path) { + allowed = append(allowed, m) + } + } + if len(allowed) > 0 { + w.Header().Set("Allow", strings.Join(allowed, ", ")) + } + code := int64(http.StatusMethodNotAllowed) + msg := "method " + r.Method + " is not allowed for path " + r.URL.Path + JSON(w, http.StatusMethodNotAllowed, &models.Error{Code: &code, Message: &msg}) + } +} + +// DecodeBody decodes JSON from r.Body into out then calls out.Validate(strfmt.Default). +// On any failure it writes the appropriate error response and returns false. +// Pass a pointer to the target value: respond.DecodeBody(r, w, &data). +// All write handlers (POST/PUT) must use this instead of raw json.Decode; +// generated inline body structs without a Validate method use DecodeJSON. +func DecodeBody[T interface { + Validate(registry strfmt.Registry) error +}](r *http.Request, w http.ResponseWriter, out T) bool { + if !DecodeJSON(r, w, out) { + return false + } + if err := out.Validate(strfmt.Default); err != nil { + Unprocessable(w, err) + return false + } + return true +} + +// DecodeJSON decodes JSON from r.Body into out, writing a 400 response and +// returning false on failure. It is DecodeBody for the generated inline body +// structs that have no Validate method; client-native models embedded in such +// a body should still be validated individually (see Unprocessable). +func DecodeJSON(r *http.Request, w http.ResponseWriter, out any) bool { + dec := json.NewDecoder(r.Body) + dec.UseNumber() + if err := dec.Decode(out); err != nil { + BadRequest(w, err.Error()) + return false + } + return true +} + +// Unprocessable writes a 422 Unprocessable Entity response with a cleaned +// message from a go-openapi CompositeError. The body code matches the HTTP +// status, consistent with the rest of the API. +func Unprocessable(w http.ResponseWriter, err error) { + code := int64(http.StatusUnprocessableEntity) + msg := flattenValidationError(err) + JSON(w, http.StatusUnprocessableEntity, &models.Error{Code: &code, Message: &msg}) +} + +// flattenValidationError strips the repetitive "validation failure list:" wrapper +// lines that go-openapi/errors CompositeError nests for each schema level, leaving +// only the leaf error messages. +func flattenValidationError(err error) string { + const prefix = "validation failure list:" + var keep []string + for line := range strings.SplitSeq(err.Error(), "\n") { + if line != prefix { + keep = append(keep, line) + } + } + if len(keep) == 0 { + return err.Error() + } + return strings.Join(keep, "\n") +} diff --git a/handlers/respond/respond_test.go b/handlers/respond/respond_test.go new file mode 100644 index 00000000..6f8780c3 --- /dev/null +++ b/handlers/respond/respond_test.go @@ -0,0 +1,171 @@ +// Copyright 2026 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package respond + +import ( + "bytes" + stdjson "encoding/json" + "errors" + "mime/multipart" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/go-chi/chi/v5" +) + +type errorBody struct { + Code int64 `json:"code"` + Message string `json:"message"` +} + +func decodeErrorBody(t *testing.T, rec *httptest.ResponseRecorder) errorBody { + t.Helper() + if ct := rec.Header().Get("Content-Type"); ct != "application/json" { + t.Errorf("Content-Type = %q, want application/json", ct) + } + var e errorBody + if err := stdjson.Unmarshal(rec.Body.Bytes(), &e); err != nil { + t.Fatalf("body %q is not valid JSON: %v", rec.Body.String(), err) + } + return e +} + +func TestNotFound(t *testing.T) { + rec := httptest.NewRecorder() + NotFound(rec, httptest.NewRequest(http.MethodGet, "/v3/nonexistent", nil)) + + if rec.Code != http.StatusNotFound { + t.Errorf("status = %d, want 404", rec.Code) + } + e := decodeErrorBody(t, rec) + if e.Code != http.StatusNotFound { + t.Errorf("body code = %d, want 404", e.Code) + } + if want := "path /v3/nonexistent was not found"; e.Message != want { + t.Errorf("body message = %q, want %q", e.Message, want) + } +} + +func TestMethodNotAllowed(t *testing.T) { + ok := func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) } + inner := chi.NewRouter() + inner.Get("/info", ok) + inner.Put("/info", ok) + inner.MethodNotAllowed(MethodNotAllowed(inner)) + root := chi.NewRouter() + root.Mount("/v3", inner) + + rec := httptest.NewRecorder() + root.ServeHTTP(rec, httptest.NewRequest(http.MethodPatch, "/v3/info", nil)) + + if rec.Code != http.StatusMethodNotAllowed { + t.Errorf("status = %d, want 405", rec.Code) + } + if allow := rec.Header().Get("Allow"); allow != "GET, PUT" { + t.Errorf("Allow = %q, want %q", allow, "GET, PUT") + } + e := decodeErrorBody(t, rec) + if e.Code != http.StatusMethodNotAllowed { + t.Errorf("body code = %d, want 405", e.Code) + } + if want := "method PATCH is not allowed for path /v3/info"; e.Message != want { + t.Errorf("body message = %q, want %q", e.Message, want) + } +} + +// TestMultipartErrorBodyTooLarge runs a real multipart body through +// ParseMultipartForm with a MaxBytesReader cap, mirroring the upload handlers +// behind MaxBodySizeMiddleware, to verify the *http.MaxBytesError survives the +// parse error chain and maps to 413. +func TestMultipartErrorBodyTooLarge(t *testing.T) { + var buf bytes.Buffer + mp := multipart.NewWriter(&buf) + part, err := mp.CreateFormFile("file_upload", "test.txt") + if err != nil { + t.Fatal(err) + } + if _, err = part.Write(bytes.Repeat([]byte("x"), 1024)); err != nil { + t.Fatal(err) + } + mp.Close() + + rec := httptest.NewRecorder() + req := httptest.NewRequest(http.MethodPost, "/v3/files", &buf) + req.Header.Set("Content-Type", mp.FormDataContentType()) + req.Body = http.MaxBytesReader(rec, req.Body, 64) + + err = req.ParseMultipartForm(32 << 20) + if err == nil { + t.Fatal("ParseMultipartForm succeeded, want body-too-large error") + } + MultipartError(rec, err) + + if rec.Code != http.StatusRequestEntityTooLarge { + t.Errorf("status = %d, want 413", rec.Code) + } + e := decodeErrorBody(t, rec) + if e.Code != http.StatusRequestEntityTooLarge { + t.Errorf("body code = %d, want 413", e.Code) + } + if want := "request body exceeds the maximum allowed size of 64 bytes"; e.Message != want { + t.Errorf("body message = %q, want %q", e.Message, want) + } +} + +func TestMultipartErrorBadBody(t *testing.T) { + rec := httptest.NewRecorder() + MultipartError(rec, errors.New("multipart: boundary is empty")) + + if rec.Code != http.StatusBadRequest { + t.Errorf("status = %d, want 400", rec.Code) + } + e := decodeErrorBody(t, rec) + if !strings.Contains(e.Message, "boundary is empty") { + t.Errorf("body message = %q, want the parse error", e.Message) + } +} + +func TestJSONNilPayload(t *testing.T) { + rec := httptest.NewRecorder() + JSON(rec, http.StatusOK, nil) + + if rec.Code != http.StatusOK { + t.Errorf("status = %d, want 200", rec.Code) + } + if rec.Body.Len() != 0 { + t.Errorf("body = %q, want empty", rec.Body.String()) + } + if ct := rec.Header().Get("Content-Type"); ct != "" { + t.Errorf("Content-Type = %q, want unset", ct) + } +} + +func TestJSONEncodeFailure(t *testing.T) { + rec := httptest.NewRecorder() + JSON(rec, http.StatusOK, map[string]any{"bad": func() {}}) + + if rec.Code != http.StatusInternalServerError { + t.Errorf("status = %d, want 500", rec.Code) + } + e := decodeErrorBody(t, rec) + if e.Code != http.StatusInternalServerError { + t.Errorf("body code = %d, want 500", e.Code) + } + if e.Message == "" { + t.Error("body message is empty") + } +} diff --git a/handlers/ring.go b/handlers/ring.go deleted file mode 100644 index fa09e6d5..00000000 --- a/handlers/ring.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/ring" -) - -// CreateRingHandlerImpl implementation of the CreateRingHandler interface using client-native client -type CreateRingHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteRingHandlerImpl implementation of the DeleteRingHandler interface using client-native client -type DeleteRingHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetRingHandlerImpl implementation of the GetRingHandler interface using client-native client -type GetRingHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetRingsHandlerImpl implementation of the GetRingsHandler interface using client-native client -type GetRingsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceRingHandlerImpl implementation of the ReplaceRingHandler interface using client-native client -type ReplaceRingHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateRingHandlerImpl) Handle(params ring.CreateRingParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return ring.NewCreateRingDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createRing(params, t, v) - if err != nil { - e := misc.HandleError(err) - return ring.NewCreateRingDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return ring.NewCreateRingDefault(int(*e.Code)).WithPayload(e) - } - return ring.NewCreateRingCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return ring.NewCreateRingAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return ring.NewCreateRingAccepted().WithPayload(params.Data) -} - -func (h *CreateRingHandlerImpl) createRing(params ring.CreateRingParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredRing(params.Data, t, v) - } - return configuration.CreateRing(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteRingHandlerImpl) Handle(params ring.DeleteRingParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return ring.NewDeleteRingDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return ring.NewDeleteRingDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteRing(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return ring.NewDeleteRingDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return ring.NewDeleteRingDefault(int(*e.Code)).WithPayload(e) - } - return ring.NewDeleteRingNoContent() - } - rID := h.ReloadAgent.Reload() - return ring.NewDeleteRingAccepted().WithReloadID(rID) - } - return ring.NewDeleteRingAccepted() -} - -// Handle executing the request and returning a response -func (h *GetRingHandlerImpl) Handle(params ring.GetRingParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bck, err := h.getRing(params, t) - if err != nil { - e := misc.HandleError(err) - return ring.NewGetRingDefault(int(*e.Code)).WithPayload(e) - } - return ring.NewGetRingOK().WithPayload(bck) -} - -func (h *GetRingHandlerImpl) getRing(params ring.GetRingParams, t string) (int64, *models.Ring, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredRing(params.Name, t) - } - return configuration.GetRing(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetRingsHandlerImpl) Handle(params ring.GetRingsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, bcks, err := h.getRings(params, t) - if err != nil { - e := misc.HandleError(err) - return ring.NewGetRingsDefault(int(*e.Code)).WithPayload(e) - } - return ring.NewGetRingsOK().WithPayload(bcks) -} - -func (h *GetRingsHandlerImpl) getRings(params ring.GetRingsParams, t string) (int64, models.Rings, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredRings(t) - } - return configuration.GetRings(t) -} - -// Handle executing the request and returning a response -func (h *ReplaceRingHandlerImpl) Handle(params ring.ReplaceRingParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return ring.NewReplaceRingDefault(int(*e.Code)).WithPayload(e) - } - - err := h.editRing(params, t, v) - if err != nil { - e := misc.HandleError(err) - return ring.NewReplaceRingDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return ring.NewReplaceRingDefault(int(*e.Code)).WithPayload(e) - } - return ring.NewReplaceRingOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return ring.NewReplaceRingAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return ring.NewReplaceRingAccepted().WithPayload(params.Data) -} - -func (h *ReplaceRingHandlerImpl) editRing(params ring.ReplaceRingParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.EditStructuredRing(params.Name, params.Data, t, v) - } - return configuration.EditRing(params.Name, params.Data, t, v) -} diff --git a/handlers/router.go b/handlers/router.go new file mode 100644 index 00000000..371c6014 --- /dev/null +++ b/handlers/router.go @@ -0,0 +1,277 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package handlers + +import ( + "encoding/json" + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + dataplaneapi_config "github.com/haproxytech/dataplaneapi/configuration" + sc "github.com/haproxytech/dataplaneapi/discovery" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" + + // configuration + "github.com/haproxytech/dataplaneapi/handlers/configuration/acl" + "github.com/haproxytech/dataplaneapi/handlers/configuration/acme" + "github.com/haproxytech/dataplaneapi/handlers/configuration/backend" + "github.com/haproxytech/dataplaneapi/handlers/configuration/backend_switching_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/bind" + "github.com/haproxytech/dataplaneapi/handlers/configuration/cache" + "github.com/haproxytech/dataplaneapi/handlers/configuration/capture" + "github.com/haproxytech/dataplaneapi/handlers/configuration/crt_store" + "github.com/haproxytech/dataplaneapi/handlers/configuration/defaults" + "github.com/haproxytech/dataplaneapi/handlers/configuration/dgram_bind" + "github.com/haproxytech/dataplaneapi/handlers/configuration/fcgi_app" + "github.com/haproxytech/dataplaneapi/handlers/configuration/filter" + "github.com/haproxytech/dataplaneapi/handlers/configuration/frontend" + "github.com/haproxytech/dataplaneapi/handlers/configuration/global" + "github.com/haproxytech/dataplaneapi/handlers/configuration/groups" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http/http_after_response_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http/http_check" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http/http_error_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http/http_request_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http/http_response_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/http_errors_section" + "github.com/haproxytech/dataplaneapi/handlers/configuration/log_forward" + "github.com/haproxytech/dataplaneapi/handlers/configuration/log_profile" + "github.com/haproxytech/dataplaneapi/handlers/configuration/log_target" + "github.com/haproxytech/dataplaneapi/handlers/configuration/log_targets_global" + "github.com/haproxytech/dataplaneapi/handlers/configuration/mailers" + "github.com/haproxytech/dataplaneapi/handlers/configuration/peers" + "github.com/haproxytech/dataplaneapi/handlers/configuration/program" + "github.com/haproxytech/dataplaneapi/handlers/configuration/quic/quic_initial_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/raw" + "github.com/haproxytech/dataplaneapi/handlers/configuration/resolver" + "github.com/haproxytech/dataplaneapi/handlers/configuration/ring" + "github.com/haproxytech/dataplaneapi/handlers/configuration/server" + "github.com/haproxytech/dataplaneapi/handlers/configuration/server_switching_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/server_template" + "github.com/haproxytech/dataplaneapi/handlers/configuration/ssl_front_use" + "github.com/haproxytech/dataplaneapi/handlers/configuration/stick_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/table" + "github.com/haproxytech/dataplaneapi/handlers/configuration/tcp/tcp_check" + "github.com/haproxytech/dataplaneapi/handlers/configuration/tcp/tcp_request_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/tcp/tcp_response_rule" + "github.com/haproxytech/dataplaneapi/handlers/configuration/traces" + "github.com/haproxytech/dataplaneapi/handlers/configuration/userlist" + config_version "github.com/haproxytech/dataplaneapi/handlers/configuration/version" + + // dataplane + "github.com/haproxytech/dataplaneapi/handlers/dataplane/cluster" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/discovery" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/health" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/info" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/reloads" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/sites" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/specification" + "github.com/haproxytech/dataplaneapi/handlers/dataplane/stats" + dataplane_transactions "github.com/haproxytech/dataplaneapi/handlers/dataplane/transactions" + + // runtime + "github.com/haproxytech/dataplaneapi/handlers/runtime/acl_entries" + "github.com/haproxytech/dataplaneapi/handlers/runtime/acl_files" + runtime_acme "github.com/haproxytech/dataplaneapi/handlers/runtime/acme" + "github.com/haproxytech/dataplaneapi/handlers/runtime/map_entries" + "github.com/haproxytech/dataplaneapi/handlers/runtime/maps" + "github.com/haproxytech/dataplaneapi/handlers/runtime/process_info" + runtime_servers "github.com/haproxytech/dataplaneapi/handlers/runtime/servers" + "github.com/haproxytech/dataplaneapi/handlers/runtime/ssl_ca_files" + "github.com/haproxytech/dataplaneapi/handlers/runtime/ssl_certs" + "github.com/haproxytech/dataplaneapi/handlers/runtime/ssl_crl_files" + runtime_ssl_crt_lists "github.com/haproxytech/dataplaneapi/handlers/runtime/ssl_crt_lists" + "github.com/haproxytech/dataplaneapi/handlers/runtime/stick_table_entries" + "github.com/haproxytech/dataplaneapi/handlers/runtime/stick_tables" + + // service discovery + "github.com/haproxytech/dataplaneapi/handlers/service_discovery/aws" + "github.com/haproxytech/dataplaneapi/handlers/service_discovery/consul" + + // spoe + "github.com/haproxytech/dataplaneapi/handlers/spoe/agents" + spoe_files "github.com/haproxytech/dataplaneapi/handlers/spoe/files" + spoe_groups "github.com/haproxytech/dataplaneapi/handlers/spoe/groups" + "github.com/haproxytech/dataplaneapi/handlers/spoe/messages" + "github.com/haproxytech/dataplaneapi/handlers/spoe/scopes" + spoe_transactions "github.com/haproxytech/dataplaneapi/handlers/spoe/transactions" + spoe_version "github.com/haproxytech/dataplaneapi/handlers/spoe/version" + + // storage + "github.com/haproxytech/dataplaneapi/handlers/storage/general" + storage_maps "github.com/haproxytech/dataplaneapi/handlers/storage/maps" + "github.com/haproxytech/dataplaneapi/handlers/storage/ssl_certificates" + storage_ssl_crt_lists "github.com/haproxytech/dataplaneapi/handlers/storage/ssl_crt_lists" +) + +// Options holds all dependencies needed to build the router. +type Options struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent + + // Cluster management + Config *dataplaneapi_config.Configuration + Users *dataplaneapi_config.Users + + // Service discovery + ConsulDiscovery sc.ServiceDiscoveries + ConsulPersistCallback func([]*models.Consul) error + AWSDiscovery sc.ServiceDiscoveries + AWSPersistCallback func([]*models.AwsRegion) error + UseValidation bool + + // API info + Version string + BuildTime string + SystemInfo bool + + // MaxOpenTransactions limits concurrent in-progress transactions (0 = unlimited). + MaxOpenTransactions int + + // SwaggerJSON is the raw OpenAPI v2 / swagger spec passed to the discovery and + // specification handlers. It must not be nil. + SwaggerJSON json.RawMessage +} + +// NewRouter assembles all handler packages onto a single chi router and returns +// it as an http.Handler. All routes are served under the /v3 prefix to match +// the OpenAPI spec's server URL. The first error encountered during registration +// is returned; all RegisterRouter calls are otherwise non-failing (the embedded +// OpenAPI spec is always valid). +func NewRouter(opts Options) (http.Handler, error) { + r := chi.NewRouter() + r.Use(middleware.StripSlashes) + // Emit JSON instead of chi's default plain-text bodies for unmatched routes + // and disallowed methods, matching the previous go-swagger server. + r.NotFound(respond.NotFound) + r.MethodNotAllowed(respond.MethodNotAllowed(r)) + + registrations := []func() error{ + // — configuration — + func() error { return acl.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return acme.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return backend.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return backend_switching_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return bind.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return cache.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return capture.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return crt_store.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return defaults.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return dgram_bind.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return fcgi_app.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return filter.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return frontend.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return global.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return groups.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_after_response_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_check.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_error_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_request_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_response_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return http_errors_section.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return log_forward.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return log_profile.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return log_target.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return log_targets_global.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return mailers.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return peers.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return program.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return quic_initial_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return raw.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return resolver.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return ring.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return server.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return server_switching_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return server_template.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return ssl_front_use.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return stick_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return table.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return tcp_check.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return tcp_request_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return tcp_response_rule.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return traces.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return userlist.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return config_version.RegisterRouter(r, opts.Client) }, + + // — runtime — + func() error { return acl_entries.RegisterRouter(r, opts.Client) }, + func() error { return acl_files.RegisterRouter(r, opts.Client) }, + func() error { return runtime_acme.RegisterRouter(r, opts.Client) }, + func() error { return map_entries.RegisterRouter(r, opts.Client) }, + func() error { return maps.RegisterRouter(r, opts.Client) }, + func() error { return process_info.RegisterRouter(r, opts.Client) }, + func() error { return runtime_servers.RegisterRouter(r, opts.Client) }, + func() error { return ssl_ca_files.RegisterRouter(r, opts.Client) }, + func() error { return ssl_certs.RegisterRouter(r, opts.Client) }, + func() error { return ssl_crl_files.RegisterRouter(r, opts.Client) }, + func() error { return runtime_ssl_crt_lists.RegisterRouter(r, opts.Client) }, + func() error { return stick_table_entries.RegisterRouter(r, opts.Client) }, + func() error { return stick_tables.RegisterRouter(r, opts.Client) }, + + // — spoe — + func() error { return agents.RegisterRouter(r, opts.Client) }, + func() error { return spoe_files.RegisterRouter(r, opts.Client) }, + func() error { return spoe_groups.RegisterRouter(r, opts.Client) }, + func() error { return messages.RegisterRouter(r, opts.Client) }, + func() error { return scopes.RegisterRouter(r, opts.Client) }, + func() error { return spoe_transactions.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return spoe_version.RegisterRouter(r, opts.Client) }, + + // — dataplane — + func() error { + return cluster.RegisterRouter(r, opts.Client, opts.Config, opts.Users, opts.ReloadAgent) + }, + func() error { return discovery.RegisterRouter(r, opts.SwaggerJSON) }, + func() error { return health.RegisterRouter(r, opts.ReloadAgent) }, + func() error { return info.RegisterRouter(r, opts.Version, opts.BuildTime, opts.SystemInfo) }, + func() error { return reloads.RegisterRouter(r, opts.ReloadAgent) }, + func() error { return sites.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return specification.RegisterRouter(r, opts.SwaggerJSON) }, + func() error { return stats.RegisterRouter(r, opts.Client) }, + func() error { + return dataplane_transactions.RegisterRouter(r, opts.Client, opts.ReloadAgent, opts.MaxOpenTransactions) + }, + + // — storage — + func() error { return general.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return storage_maps.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return ssl_certificates.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + func() error { return storage_ssl_crt_lists.RegisterRouter(r, opts.Client, opts.ReloadAgent) }, + + // — service discovery — + func() error { + return consul.RegisterRouter(r, opts.ConsulDiscovery, opts.ConsulPersistCallback, opts.UseValidation) + }, + func() error { + return aws.RegisterRouter(r, opts.AWSDiscovery, opts.AWSPersistCallback, opts.UseValidation) + }, + } + + for _, reg := range registrations { + if err := reg(); err != nil { + return nil, err + } + } + + root := chi.NewRouter() + root.NotFound(respond.NotFound) + root.MethodNotAllowed(respond.MethodNotAllowed(root)) + root.Mount("/v3", r) + return root, nil +} diff --git a/handlers/runtime.go b/handlers/runtime.go deleted file mode 100644 index 3b54d5de..00000000 --- a/handlers/runtime.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "reflect" - "strconv" - - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/log" -) - -// RuntimeSupportedFields is a map of fields supported through the runtime API for -// it's respectable object type -var RuntimeSupportedFields = map[string][]string{ - "frontend": {"Maxconn"}, - "server": {"Weight", "Address", "Port", "Maintenance", "AgentCheck", "AgentAddr", "AgentSend", "HealthCheckPort"}, -} - -// ChangeThroughRuntimeAPI checks if something can be changed through the runtime API, and -// returns false if reload is not needed, or true if needed. -func changeThroughRuntimeAPI(data, ondisk any, parentName string, client client_native.HAProxyClient) (reload bool) { - // reflect kinds and values are loosely checked as they are bound strictly in - // schema, but in case of any panic, we will log and reload to ensure - // changes go through - defer func() { - if r := recover(); r != nil { - log.Warning("Change Through API Panic: ", r) - // we are panicking, so reload to ensure changes are through - reload = true - } - }() - - // check if runtime client is valid, if not, return reload needed - runtime, err := client.Runtime() - if err != nil { - return true - } - // objects are the same, do nothing and don't reload - diff := compareObjects(data, ondisk) - if len(diff) == 0 { - return false - } - switch vData := data.(type) { - case models.Frontend: - if compareChanged(diff, RuntimeSupportedFields["frontend"]) { - // only fields that are supported in runtime API are changed, if successful, do not reload - for _, field := range diff { - fieldValue := reflect.ValueOf(vData).FieldByName(field) - if fieldValue.IsValid() { - //nolint:gocritic - switch field { - case "Maxconn": - maxConn := fieldValue.Elem().Int() - err := runtime.SetFrontendMaxConn(vData.Name, int(maxConn)) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - } - } - } - } else { - // there are changed fields that are not supported in runtime API, so reload - return true - } - case models.Server: - if compareChanged(diff, RuntimeSupportedFields["server"]) { - // only fields that are supported in runtime API are changed, if successful, do not reload - addrPortChanged := false - for _, field := range diff { - fieldValue := reflect.ValueOf(vData).FieldByName(field) - if fieldValue.IsValid() { - switch field { - case "Weight": - weight := strconv.FormatInt(fieldValue.Elem().Int(), 10) - err := runtime.SetServerWeight(parentName, vData.Name, weight) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - case "HealthCheckPort": - portVal := fieldValue.Elem().Int() - err := runtime.SetServerCheckPort(parentName, vData.Name, int(portVal)) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - case "Address": - if !addrPortChanged { - portVal := reflect.ValueOf(vData).FieldByName("Port").Elem().Int() - addrVal := fieldValue.String() - err := runtime.SetServerAddr(parentName, vData.Name, addrVal, int(portVal)) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - addrPortChanged = true - } - case "Port": - if !addrPortChanged { - portVal := fieldValue.Elem().Int() - addrVal := reflect.ValueOf(vData).FieldByName("Address").String() - err := runtime.SetServerAddr(parentName, vData.Name, addrVal, int(portVal)) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - addrPortChanged = true - } - case "Maintenance": - maint := fieldValue.String() - if maint == "enabled" { - maint = "maint" - } else { - maint = "ready" - } - err := runtime.SetServerState(parentName, vData.Name, maint) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - case "AgentCheck": - aCheck := fieldValue.String() - if aCheck == "enabled" { - err := runtime.EnableAgentCheck(parentName, vData.Name) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - } - if aCheck == "disabled" { - err := runtime.DisableAgentCheck(parentName, vData.Name) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - } - case "AgentAddr": - aAddr := fieldValue.String() - err := runtime.SetServerAgentAddr(parentName, vData.Name, aAddr) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - case "AgentSend": - aSend := fieldValue.String() - err := runtime.SetServerAgentSend(parentName, vData.Name, aSend) - if err != nil { - // we have error's in runtime API changes, bail and reload - return true - } - } - } - } - } else { - // there are changed fields that are not supported in runtime API, so reload - return true - } - default: - // for this type, we do not support changing through runtime API, so reload - return true - } - return false -} - -// return string of field names that have a diff -func compareObjects(data, ondisk any) []string { - diff := make([]string, 0) - dataVal := reflect.ValueOf(data) - ondiskVal := reflect.ValueOf(ondisk) - for i := range dataVal.NumField() { - fName := dataVal.Type().Field(i).Name - dataField := dataVal.FieldByName(fName) - ondiskField := ondiskVal.FieldByName(fName) - - dataKind := dataField.Kind() - ondiskKind := ondiskField.Kind() - - if dataKind != ondiskKind { - diff = append(diff, fName) - continue - } - - if dataKind == reflect.Ptr { - dataField = dataField.Elem() - ondiskField = ondiskField.Elem() - - dataKind = dataField.Kind() - ondiskKind = ondiskField.Kind() - - if dataKind != ondiskKind { - diff = append(diff, fName) - continue - } - } - - switch dataKind { - case reflect.Float32, reflect.Float64: - if dataField.Float() != ondiskField.Float() { - diff = append(diff, fName) - } - case reflect.Bool: - if dataField.Bool() != ondiskField.Bool() { - diff = append(diff, fName) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if dataField.Int() != ondiskField.Int() { - diff = append(diff, fName) - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - if dataField.Uint() != ondiskField.Uint() { - diff = append(diff, fName) - } - case reflect.String: - if dataField.String() != ondiskField.String() { - diff = append(diff, fName) - } - case reflect.Struct: - diff = append(diff, compareObjects(dataField.Interface(), ondiskField.Interface())...) - } - } - return diff -} - -// this returns true if only changeable fields have been changed -func compareChanged(changed, changeable []string) bool { - if len(changed) > len(changeable) { - return false - } - - diff := make(map[string]bool, len(changed)) - for _, elem := range changed { - diff[elem] = true - } - - for _, elem := range changeable { - delete(diff, elem) - } - - return len(diff) == 0 -} diff --git a/handlers/runtime/acl_entries/acl_entries.gen.go b/handlers/runtime/acl_entries/acl_entries.gen.go new file mode 100644 index 00000000..4c04329c --- /dev/null +++ b/handlers/runtime/acl_entries/acl_entries.gen.go @@ -0,0 +1,489 @@ +// Package acl_entries provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package acl_entries + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// AclFileEntry defines model for acl_file_entry. +type AclFileEntry = models.ACLFileEntry + +// AclFilesEntries defines model for acl_files_entries. +type AclFilesEntries = models.ACLFilesEntries + +// CreateRuntimeAclFileEntryJSONRequestBody defines body for CreateRuntimeAclFileEntry for application/json ContentType. +type CreateRuntimeAclFileEntryJSONRequestBody = AclFileEntry + +// AddPayloadRuntimeACLJSONRequestBody defines body for AddPayloadRuntimeACL for application/json ContentType. +type AddPayloadRuntimeACLJSONRequestBody = AclFilesEntries + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return ACL entries + // (GET /services/haproxy/runtime/acls/{parent_name}/entries) + GetAllRuntimeAclFileEntries(w http.ResponseWriter, r *http.Request, parentName string) + // Add entry to an ACL file + // (POST /services/haproxy/runtime/acls/{parent_name}/entries) + CreateRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string) + // Add a new ACL payload + // (PUT /services/haproxy/runtime/acls/{parent_name}/entries) + AddPayloadRuntimeACL(w http.ResponseWriter, r *http.Request, parentName string) + // Delete an ACL entry + // (DELETE /services/haproxy/runtime/acls/{parent_name}/entries/{id}) + DeleteRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) + // Return an ACL entry + // (GET /services/haproxy/runtime/acls/{parent_name}/entries/{id}) + GetRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return ACL entries +// (GET /services/haproxy/runtime/acls/{parent_name}/entries) +func (_ Unimplemented) GetAllRuntimeAclFileEntries(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add entry to an ACL file +// (POST /services/haproxy/runtime/acls/{parent_name}/entries) +func (_ Unimplemented) CreateRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new ACL payload +// (PUT /services/haproxy/runtime/acls/{parent_name}/entries) +func (_ Unimplemented) AddPayloadRuntimeACL(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete an ACL entry +// (DELETE /services/haproxy/runtime/acls/{parent_name}/entries/{id}) +func (_ Unimplemented) DeleteRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an ACL entry +// (GET /services/haproxy/runtime/acls/{parent_name}/entries/{id}) +func (_ Unimplemented) GetRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllRuntimeAclFileEntries operation middleware +func (siw *ServerInterfaceWrapper) GetAllRuntimeAclFileEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllRuntimeAclFileEntries(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateRuntimeAclFileEntry operation middleware +func (siw *ServerInterfaceWrapper) CreateRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateRuntimeAclFileEntry(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddPayloadRuntimeACL operation middleware +func (siw *ServerInterfaceWrapper) AddPayloadRuntimeACL(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddPayloadRuntimeACL(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteRuntimeAclFileEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteRuntimeAclFileEntry(w, r, parentName, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRuntimeAclFileEntry operation middleware +func (siw *ServerInterfaceWrapper) GetRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRuntimeAclFileEntry(w, r, parentName, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/acls/{parent_name}/entries", wrapper.GetAllRuntimeAclFileEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/acls/{parent_name}/entries", wrapper.CreateRuntimeAclFileEntry) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/acls/{parent_name}/entries", wrapper.AddPayloadRuntimeACL) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/acls/{parent_name}/entries/{id}", wrapper.DeleteRuntimeAclFileEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/acls/{parent_name}/entries/{id}", wrapper.GetRuntimeAclFileEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7JdRb9s2EMe/CsHmaZOjtAkKTHtS4nQLEAxBNuylTg2GPNvsKFIjT24EQ999ICk5dhRnSea5CZAXQ5bE", + "4/+O/x+PWlBuitJo0OhotqAWXGm0g/DHlcDlRHKG0uhxYQQoN+amKIweL1/s7ufKAhP16Y10MRQ3GkGj", + "v2Rlqdow6VdndAjOZ1Awf7VnYUIz+i69lZLGpy59kgSw1ljaNE1CBThuZelH0Yz+MQPSRgJBLDhTWQ6E", + "RckEouaEzoAJsEH9idETOa1smHjwJ1gno+71yGuvkYlUQObtu8lKiliXQDPq0Eo99Qqb5GnVPWbiEv6u", + "wOELK+0x8wWNyl5yAYcwYZXC05DHyyrhL6DBMkWitpdcxN8MfjKVFq8D72/MEW2QTILknda16R6H2RhX", + "Yz94DBptvTLCXH8F7rm5GUzNoL0Zs93PT84/SQWnYcjKGwNZlMaGupcMZzSjU4mz6nqfmyKdsdKamxqB", + "z1KuJGgcaIZyDun8YxoDUy+uU+SCJBm3e4lQuH9bsTu5NEmXC7OW1Q+m4k7bubadzTNc9Lg16Ijcplwv", + "WOqJCRIkKj/dr/mFH0mGDBm5UEwDyS/OyIBcVhplASQ/OSe31es8mFFff1OCZqWkGT3cP9h/T5MgLSxk", + "6sDOJQfXaUttDOiX0aWLklnQONasgCZdccIUsA/DJWBltSNMBzltJOIAUeopqZz/xRncPjH8L8B9GiRG", + "hs5E2O8wV6pNLeeqs3lMrmSWFYAB1M93NfiJA4ZeMvWFpFlciYSGW/7fMieaUN+apAVBM7QVrEJbMkSw", + "fvyXz19GIzsa6VF1cHDIwy/88PPeO3/14eOiGdGrH/do0uP8Klk/L304ONjaztgn9J6N7/eKc3BuUimy", + "LLG3xFEUcl/8peD0ueePEP9oy/GXnSXkGFr1lmdYOwCEXaMqCua349bZwdWw9CGyqXdgsFzrVXrVJLQ0", + "7h44ciECGWFXJFKjCSgs/fp4Ok4sMIQ+HfUrZCMY5tiIeutYdO3HL+R6Hk0Pyvf/6+z9RYge4GEdxW5w", + "/GnL8dc/5r4Hk7kQbSHRdC3Hl34Tmb5JcyNgCnrQGm9wbUQ9aK0vGDKfSFltpJdo+BbmKVmtDBN9NnMh", + "LuKzjs+T8zcsN3er3ZP5YLtcWVvChNgNnN+FnJ6X/xs2TfKso2S6kKKJtClA6HM3DPdd6IsR9ok1xbJz", + "XtdEoiNzpqqndNAY9dV30OSuPJ9HW6az4f3ypNj9mfeov65v59KtkByN3HU/aC286WD64Edbh1S0TwvW", + "2fBpX21vSL3az8jNJ9Y3Vrf5DfkoVsNIsPMOmcoqmtF0fkibq+afAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/acl_entries/acl_entries.go b/handlers/runtime/acl_entries/acl_entries.go new file mode 100644 index 00000000..d4a08efb --- /dev/null +++ b/handlers/runtime/acl_entries/acl_entries.go @@ -0,0 +1,131 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acl_entries + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all acl_entries routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime ACL entries. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllRuntimeAclFileEntries(w http.ResponseWriter, r *http.Request, parentName string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.GetACLFilesEntries(parentName) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) CreateRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string) { + var data CreateRuntimeAclFileEntryJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddACLFileEntry(parentName, data.Value); err != nil { + respond.Error(w, err) + return + } + + fileEntry, err := rt.GetACLFileEntry(parentName, data.Value) + if err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusCreated, fileEntry) +} + +func (h *HandlerImpl) AddPayloadRuntimeACL(w http.ResponseWriter, r *http.Request, parentName string) { + var data AddPayloadRuntimeACLJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddACLAtomic(parentName, data); err != nil { + respond.RuntimeError(w, err) + return + } + + respond.JSON(w, http.StatusCreated, data) +} + +func (h *HandlerImpl) DeleteRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + if err = rt.DeleteACLFileEntry(parentName, "#"+id); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetRuntimeAclFileEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + fileEntry, err := rt.GetACLFileEntry(parentName, id) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, fileEntry) +} diff --git a/handlers/runtime/acl_files/acl_files.gen.go b/handlers/runtime/acl_files/acl_files.gen.go new file mode 100644 index 00000000..8d7c1a00 --- /dev/null +++ b/handlers/runtime/acl_files/acl_files.gen.go @@ -0,0 +1,334 @@ +// Package acl_files provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package acl_files + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// AclFile defines model for acl_file. +type AclFile = models.ACLFile + +// AclFiles defines model for acl_files. +type AclFiles = models.ACLFiles + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all ACL files + // (GET /services/haproxy/runtime/acls) + GetAllRuntimeAclFiles(w http.ResponseWriter, r *http.Request) + // Return an ACL file + // (GET /services/haproxy/runtime/acls/{id}) + GetRuntimeAclFile(w http.ResponseWriter, r *http.Request, id string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all ACL files +// (GET /services/haproxy/runtime/acls) +func (_ Unimplemented) GetAllRuntimeAclFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an ACL file +// (GET /services/haproxy/runtime/acls/{id}) +func (_ Unimplemented) GetRuntimeAclFile(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllRuntimeAclFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllRuntimeAclFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllRuntimeAclFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRuntimeAclFile operation middleware +func (siw *ServerInterfaceWrapper) GetRuntimeAclFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRuntimeAclFile(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/acls", wrapper.GetAllRuntimeAclFiles) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/acls/{id}", wrapper.GetRuntimeAclFile) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "zJXfT+M4EMf/FWvg6S5teoB4yD1VcNwhoRPiTvdCS2WcSWPOsbP2uEtV5X9f2WlCuyywRRW7L5Vrz4+P", + "Z76erECYqjYaNTnIVmDR1UY7jH9cjUIWUnCSRs8qk6NyM2GqyuhZb9jtn2PBvaI/rDU2OAujCTWFJa9r", + "tY6SPjijY2xRYsXD6tBiARkcpE8kaXvq0p0IMKZumiaBHJ2wsg5ekMGfqNFyxVq2BErkOdp4xTOjCzn3", + "NiYY/IfWyZZvO8KWGSukQrZY2yYbV6FljZCBIyv1PJA0yW5F/NvQhfE6/8kK+G+JbB0Jc2bRGW8Fss/c", + "MW2IFRH5Q+vadMcxGxdqFpw3bM39AwqCBB4HczNYb7b3HI7Pri6C9cbhQFa1sbHYNacSMphLKv39UJgq", + "LXltzeOSUJSpUBI1DTQnucB0cZq2MSEQdRiRSRJW7q329OBN0oFza/nyVW63d/B3qOT7Kt29uH3iBmCp", + "CxMRJIWuw1/j6+DJzjlxdq24Rja+vmQDduM1yQrZ+OyKdbXrFJZBKLupUfNaQgbHw9HwN0giWOxc6tAu", + "pEDXkaW2DRf6Fi3mSM9FfYPkrXaMKxXzRkkw76SeMyqRrYMwZ8T/SEOIDO0TuMzjuKKxUmvysVAd99Zs", + "PhqN9jYknnT7jbf/jxcCnSu8Yj0mRKs471+K3cOm7/+KRGn6quJ22ZeVcc3iE2Gm2K4wJEB87iC7hbC3", + "rh9MQ5TXO5muZN683U7d52L3Sybz3Vq63c8oM8srpDgwb79O2mdCTXbJLs8hiB6y9tUkoHkVdC/zqItP", + "XlrMISPrcXNu1pwIbXC7u72bTOxkoid+NDoW8Rd/+f3wIKyOTlfNBKa/HkLybNROP0B3u8juZHSyZ8n1", + "39wfK+qu4y/LODiiXXSC8VZBBuniGJpp8yUAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/acl_files/acl_files.go b/handlers/runtime/acl_files/acl_files.go new file mode 100644 index 00000000..49487c71 --- /dev/null +++ b/handlers/runtime/acl_files/acl_files.go @@ -0,0 +1,72 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acl_files + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all acl_files routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime ACL files. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllRuntimeAclFiles(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.GetACLFiles() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) GetRuntimeAclFile(w http.ResponseWriter, r *http.Request, id string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + aclFile, err := rt.GetACLFile(id) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, aclFile) +} diff --git a/handlers/runtime/acme/acme.gen.go b/handlers/runtime/acme/acme.gen.go new file mode 100644 index 00000000..e9cf1065 --- /dev/null +++ b/handlers/runtime/acme/acme.gen.go @@ -0,0 +1,345 @@ +// Package acme provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package acme + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// AcmeStatus defines model for acme_status. +type AcmeStatus = models.AcmeStatus + +// RenewAcmeCertificateParams defines parameters for RenewAcmeCertificate. +type RenewAcmeCertificateParams struct { + // Certificate Certificate file name + Certificate string `form:"certificate" json:"certificate"` +} + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // ACME Status + // (GET /services/haproxy/runtime/acme) + GetAcmeStatus(w http.ResponseWriter, r *http.Request) + // Renew ACME certificate + // (PUT /services/haproxy/runtime/acme) + RenewAcmeCertificate(w http.ResponseWriter, r *http.Request, params RenewAcmeCertificateParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// ACME Status +// (GET /services/haproxy/runtime/acme) +func (_ Unimplemented) GetAcmeStatus(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Renew ACME certificate +// (PUT /services/haproxy/runtime/acme) +func (_ Unimplemented) RenewAcmeCertificate(w http.ResponseWriter, r *http.Request, params RenewAcmeCertificateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAcmeStatus operation middleware +func (siw *ServerInterfaceWrapper) GetAcmeStatus(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAcmeStatus(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// RenewAcmeCertificate operation middleware +func (siw *ServerInterfaceWrapper) RenewAcmeCertificate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params RenewAcmeCertificateParams + + // ------------- Required query parameter "certificate" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "certificate", r.URL.Query(), ¶ms.Certificate, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "certificate"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "certificate", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.RenewAcmeCertificate(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/acme", wrapper.GetAcmeStatus) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/acme", wrapper.RenewAcmeCertificate) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3FXBbuM2EP0VYjanVrbczWIP6snI7rZ7aBtki15ix2CokcVAJJXh0IkR6N8LUpZjwQ7QFEFR7MWgyOHj", + "47zH5ydQzrTOomUPxRMQ+tZZj+nDt6h0pZVk7ezKuBIbv1LOGGdX+8Jh/hNWMjT8mchR3KycZbQch7Jt", + "mx1KfuedTdiqRiPj6IywggLe5c9M8n7V569igOnorusyKNEr0m3cBQX8ghZJNqLnlkGNskRKV7xwttLr", + "QOmAyV9IXvf8xgijMlHpBsVmV5sdXIW3LUIBnknbdWTSZa9r4u+Ov7hgy/9ZA/+sUeyQsBSE3gVSKB6k", + "F9axqBLl/7Sv3bCcTpPK4Mqz5JA+NaPxB/vc7R0qhi4bJiSR3EIGj5O1m+zm+h5M58rgtx7pYH2iTeso", + "adFKrqGAteY63E6VM3ktW3KPW0ZV56rRaHliJesN5puPeQ8Lr3YCDu9ofIeTnAdfvyXdSFjbyiUKmpt4", + "3K/zy7hTfJIsxWUjLYr55VcxEVfBsjYo5he/fYYMBgkLiD13LVrZaijgfDqb/gRZ4pT0yT3SRiv0A6mc", + "eqQ8Khor1sjHrrlCDmS94GjLpJVwlUCpamGklWssExOhkLhvOE4hEemN9rVMocAjrUfJ9342e7MneGjO", + "E2/rW1AKva9CI/YEY9s+zD68hLynmv+7cEkcUlq/8Qmj/4Bk+WCMpC0UkATZN5vl2kNxDVGBnXlg2WXQ", + "hhNyf3ExbAgtPsgmKi3tP9D3KtZH/IvnquQ9kgY5xdT1URw9l/ZhZKWJm3RcvA9IMTTSXAFqBEt4HzRh", + "CQVTwMPsaiUzUgS4ub5ZLGixsIswm52r9Is//Hz2Lo7ef3zqFrD88Qyyo7hbnnbnmPsfw+3jkyDG8js0", + "UdL0SPsX/ZQ2I20GsQM1UEC+OYdu2f0dAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/acme/acme.go b/handlers/runtime/acme/acme.go new file mode 100644 index 00000000..00fc9cf1 --- /dev/null +++ b/handlers/runtime/acme/acme.go @@ -0,0 +1,71 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package acme + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all acme routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime ACME operations. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAcmeStatus(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + status, err := rt.AcmeStatus() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, status) +} + +func (h *HandlerImpl) RenewAcmeCertificate(w http.ResponseWriter, r *http.Request, params RenewAcmeCertificateParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + if err = rt.AcmeRenew(params.Certificate); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, nil) +} diff --git a/handlers/runtime/map_entries/map_entries.gen.go b/handlers/runtime/map_entries/map_entries.gen.go new file mode 100644 index 00000000..1c486caa --- /dev/null +++ b/handlers/runtime/map_entries/map_entries.gen.go @@ -0,0 +1,573 @@ +// Package map_entries provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package map_entries + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// MapEntries defines model for map_entries. +type MapEntries = models.MapEntries + +// MapEntry defines model for map_entry. +type MapEntry = models.MapEntry + +// AddMapEntryParams defines parameters for AddMapEntry. +type AddMapEntryParams struct { + // ForceSync If true, immediately syncs changes to disk + ForceSync bool `form:"force_sync,omitempty" json:"force_sync,omitempty,omitzero"` +} + +// DeleteRuntimeMapEntryParams defines parameters for DeleteRuntimeMapEntry. +type DeleteRuntimeMapEntryParams struct { + // ForceSync If true, immediately syncs changes to disk + ForceSync bool `form:"force_sync,omitempty" json:"force_sync,omitempty,omitzero"` +} + +// ReplaceRuntimeMapEntryJSONBody defines parameters for ReplaceRuntimeMapEntry. +type ReplaceRuntimeMapEntryJSONBody struct { + // Value Map value + Value string `json:"value"` +} + +// ReplaceRuntimeMapEntryParams defines parameters for ReplaceRuntimeMapEntry. +type ReplaceRuntimeMapEntryParams struct { + // ForceSync If true, immediately syncs changes to disk + ForceSync bool `form:"force_sync,omitempty" json:"force_sync,omitempty,omitzero"` +} + +// AddMapEntryJSONRequestBody defines body for AddMapEntry for application/json ContentType. +type AddMapEntryJSONRequestBody = MapEntry + +// ReplaceRuntimeMapEntryJSONRequestBody defines body for ReplaceRuntimeMapEntry for application/json ContentType. +type ReplaceRuntimeMapEntryJSONRequestBody ReplaceRuntimeMapEntryJSONBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return one map runtime entries + // (GET /services/haproxy/runtime/maps/{parent_name}/entries) + ShowRuntimeMap(w http.ResponseWriter, r *http.Request, parentName string) + // Adds an entry into the map file + // (POST /services/haproxy/runtime/maps/{parent_name}/entries) + AddMapEntry(w http.ResponseWriter, r *http.Request, parentName string, params AddMapEntryParams) + // Deletes all the map entries from the map by its id + // (DELETE /services/haproxy/runtime/maps/{parent_name}/entries/{id}) + DeleteRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params DeleteRuntimeMapEntryParams) + // Return one map runtime setting + // (GET /services/haproxy/runtime/maps/{parent_name}/entries/{id}) + GetRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) + // Replace the value corresponding to each id in a map + // (PUT /services/haproxy/runtime/maps/{parent_name}/entries/{id}) + ReplaceRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params ReplaceRuntimeMapEntryParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return one map runtime entries +// (GET /services/haproxy/runtime/maps/{parent_name}/entries) +func (_ Unimplemented) ShowRuntimeMap(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Adds an entry into the map file +// (POST /services/haproxy/runtime/maps/{parent_name}/entries) +func (_ Unimplemented) AddMapEntry(w http.ResponseWriter, r *http.Request, parentName string, params AddMapEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes all the map entries from the map by its id +// (DELETE /services/haproxy/runtime/maps/{parent_name}/entries/{id}) +func (_ Unimplemented) DeleteRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params DeleteRuntimeMapEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one map runtime setting +// (GET /services/haproxy/runtime/maps/{parent_name}/entries/{id}) +func (_ Unimplemented) GetRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace the value corresponding to each id in a map +// (PUT /services/haproxy/runtime/maps/{parent_name}/entries/{id}) +func (_ Unimplemented) ReplaceRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params ReplaceRuntimeMapEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// ShowRuntimeMap operation middleware +func (siw *ServerInterfaceWrapper) ShowRuntimeMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ShowRuntimeMap(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddMapEntry operation middleware +func (siw *ServerInterfaceWrapper) AddMapEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params AddMapEntryParams + + // ------------- Optional query parameter "force_sync" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_sync", r.URL.Query(), ¶ms.ForceSync, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_sync"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_sync", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddMapEntry(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteRuntimeMapEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteRuntimeMapEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteRuntimeMapEntryParams + + // ------------- Optional query parameter "force_sync" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_sync", r.URL.Query(), ¶ms.ForceSync, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_sync"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_sync", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteRuntimeMapEntry(w, r, parentName, id, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRuntimeMapEntry operation middleware +func (siw *ServerInterfaceWrapper) GetRuntimeMapEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRuntimeMapEntry(w, r, parentName, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceRuntimeMapEntry operation middleware +func (siw *ServerInterfaceWrapper) ReplaceRuntimeMapEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceRuntimeMapEntryParams + + // ------------- Optional query parameter "force_sync" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_sync", r.URL.Query(), ¶ms.ForceSync, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_sync"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_sync", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceRuntimeMapEntry(w, r, parentName, id, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/maps/{parent_name}/entries", wrapper.ShowRuntimeMap) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/maps/{parent_name}/entries", wrapper.AddMapEntry) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/maps/{parent_name}/entries/{id}", wrapper.DeleteRuntimeMapEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/maps/{parent_name}/entries/{id}", wrapper.GetRuntimeMapEntry) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/maps/{parent_name}/entries/{id}", wrapper.ReplaceRuntimeMapEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhRT9w4EP4rlot00l2WbAuqdLknOLgeD5wQPd0LS1eDPUncJrZrO1silP9+sp0su+yWFrTHAeUFBSee", + "+Tz5vm8me0WZqrWSKJ2l2RU1aLWSFsM/ViMTuWDghJLTWnGs7JSpulZyOn9wWN+rDAJvDy+FjaGYkg6l", + "85egddWHST9aJUNwVmIN/mrLYE4z+iq9hpLGuza9EwQ0RhnadV1COVpmhPa7aEb/LpH0kZATg1Y1hiGB", + "CJlgxJzQEoGjCeh/VzIXRWNC4tE/aKyIuJcjLz1GclEhmfXPJgtHdK1GmlHrjJCFR9gld6vuPvBT/Nyg", + "dY+stPvgCxqRPeYCHmAOTeUOwzkeVwnfoUQDFYnYHnMR/1LuD9VI/jTk/QUskcqRPEB+0Lp2w+2QrQY9", + "RemMiLYqHNb2W5UZ9rS0S4YEYAy0NKGXo0KN+rVYm+1j0Id9hoX7I1FrZcI70uBKmtFCuLK52GaqTkvQ", + "Rl22DlmZskqgdCMJTswwnb1NY1jqD3KN5Pqo6uIjMncrlHbjQO5Blu9DPAhvk3A9YCFzFSAIV/l0f+6d", + "+J3kAByQkwokkr2TIzIip410okZyDJpcv8aBahn1HFAaJWhBM7qzPd5+TZMALfAotWhmgqEdsKUmBvQs", + "sumVBoPSTSXU2KULRCzQrXL+FF1jpCUgSeAbUTmBqiL9PiIkAVKIGUrSZyE16CCObRpgRrkccZrR96X6", + "0h/uGHTAbKBGF2R4djP1cR+HeKTU149m8QUkNCz5/+ZHoQn1jUcY5DRzpsFFSWpwDo3f/+Hsw2RiJhM5", + "acbjHRb+4s+/bb3yV2/eXnUTev7LFk1WVHyeLE9Db8bjjfneoiOsMbT3DWNobd5UZF5Pz4Hd8e7XIs+h", + "pvdz9IAhtMgNZ1hqvEHGTV2Dd5OeakTJSKGBTjhXgIPC88QTw9LzLqFa2TWU3eM88DW4FBHSKeLK22i5", + "x/mCSz0hTiY34R3lJKQhoq6RC3BYtcS2klnCSpAFWuIU4cJ+GrB/bjCcugefK8Nw6ncstbQ5F3KoLM6B", + "XChVIchBHWHs21e83bgw2iiL5WJ2K4p8/V8lXiVBJBczCA55FON4w1JZGPJD/F83HH/5E+3/UPw3lLoi", + "ed+TmeJYoBz1dBtdKN6OevZycBBS3KcFpleCd5HsFTpc9ZWDsB6634By6IK5UfV88aIlwlki+KrTxBDX", + "LfA5eI6HJ/h6XGH9R7LAJTvaXeWQL9YnbNMZVA2SyDT+DHt5JLq9g1jW9fdbJ9Kbc4JF54QsYsSf1uvv", + "HboX8T2tmbh9mYi/wvS1E3GzVjG6AuaNr0QSnYcpE4FwLxmnCAIrieDxe64GvaqdPsqLfl7m9yURa+N5", + "4vofEQK91ve9eGtNFRaKfNYHOE9u/FLzXfP/+OHm/ygjEzXxQB8Az8zbQunu4kn3/R7wedHMBoNqTEUz", + "ms52aHfe/RsAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/map_entries/map_entries.go b/handlers/runtime/map_entries/map_entries.go new file mode 100644 index 00000000..65fb2d81 --- /dev/null +++ b/handlers/runtime/map_entries/map_entries.go @@ -0,0 +1,178 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package map_entries + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + config "github.com/haproxytech/dataplaneapi/configuration" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all map_entries routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime map entries. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) ShowRuntimeMap(w http.ResponseWriter, r *http.Request, parentName string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + m, err := rt.ShowMapEntries(parentName) + if err != nil { + respond.RuntimeError(w, err) + return + } + if m == nil { + w.WriteHeader(http.StatusNotFound) + return + } + respond.JSON(w, http.StatusOK, m) +} + +func (h *HandlerImpl) AddMapEntry(w http.ResponseWriter, r *http.Request, parentName string, params AddMapEntryParams) { + var data AddMapEntryJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddMapEntry(parentName, data.Key, data.Value); err != nil { + respond.RuntimeError(w, err) + return + } + + if params.ForceSync { + m, err := rt.GetMap(parentName) + if err != nil { + respond.RuntimeError(w, err) + return + } + ms := config.NewMapSync() + if _, err = ms.Sync(m, h.Client); err != nil { + respond.RuntimeError(w, err) + return + } + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params DeleteRuntimeMapEntryParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.DeleteMapEntry(parentName, id); err != nil { + respond.RuntimeError(w, err) + return + } + + if params.ForceSync { + m, err := rt.GetMap(parentName) + if err != nil { + respond.RuntimeError(w, err) + return + } + ms := config.NewMapSync() + if _, err = ms.Sync(m, h.Client); err != nil { + respond.RuntimeError(w, err) + return + } + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + m, err := rt.GetMapEntry(parentName, id) + if err != nil { + respond.RuntimeError(w, err) + return + } + if m == nil { + w.WriteHeader(http.StatusNotFound) + return + } + respond.JSON(w, http.StatusOK, m) +} + +func (h *HandlerImpl) ReplaceRuntimeMapEntry(w http.ResponseWriter, r *http.Request, parentName string, id string, params ReplaceRuntimeMapEntryParams) { + var data ReplaceRuntimeMapEntryJSONRequestBody + if !respond.DecodeJSON(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetMapEntry(parentName, id, data.Value); err != nil { + respond.RuntimeError(w, err) + return + } + + e, err := rt.GetMapEntry(parentName, id) + if err != nil { + w.WriteHeader(http.StatusNotFound) + return + } + + if params.ForceSync { + m, err := rt.GetMap(parentName) + if err != nil { + respond.RuntimeError(w, err) + return + } + ms := config.NewMapSync() + if _, err = ms.Sync(m, h.Client); err != nil { + respond.RuntimeError(w, err) + return + } + } + respond.JSON(w, http.StatusOK, e) +} diff --git a/handlers/runtime/maps/maps.gen.go b/handlers/runtime/maps/maps.gen.go new file mode 100644 index 00000000..e0215c62 --- /dev/null +++ b/handlers/runtime/maps/maps.gen.go @@ -0,0 +1,510 @@ +// Package maps provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package maps + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Map defines model for map. +type Map = models.Map + +// MapEntries defines model for map_entries. +type MapEntries = models.MapEntries + +// MapEntry defines model for map_entry. +type MapEntry = models.MapEntry + +// Maps defines model for maps. +type Maps = models.Maps + +// GetAllRuntimeMapFilesParams defines parameters for GetAllRuntimeMapFiles. +type GetAllRuntimeMapFilesParams struct { + // IncludeUnmanaged If true, also show unmanaged map files loaded in haproxy + IncludeUnmanaged bool `form:"include_unmanaged,omitempty" json:"include_unmanaged,omitempty,omitzero"` +} + +// ClearRuntimeMapParams defines parameters for ClearRuntimeMap. +type ClearRuntimeMapParams struct { + // ForceDelete If true, deletes file from disk + ForceDelete bool `form:"forceDelete,omitempty" json:"forceDelete,omitempty,omitzero"` + + // ForceSync If true, immediately syncs changes to disk + ForceSync bool `form:"force_sync,omitempty" json:"force_sync,omitempty,omitzero"` +} + +// AddPayloadRuntimeMapParams defines parameters for AddPayloadRuntimeMap. +type AddPayloadRuntimeMapParams struct { + // ForceSync If true, immediately syncs changes to disk + ForceSync bool `form:"force_sync,omitempty" json:"force_sync,omitempty,omitzero"` +} + +// AddPayloadRuntimeMapJSONRequestBody defines body for AddPayloadRuntimeMap for application/json ContentType. +type AddPayloadRuntimeMapJSONRequestBody = MapEntries + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return runtime map files + // (GET /services/haproxy/runtime/maps) + GetAllRuntimeMapFiles(w http.ResponseWriter, r *http.Request, params GetAllRuntimeMapFilesParams) + // Remove all map entries from the map file + // (DELETE /services/haproxy/runtime/maps/{name}) + ClearRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params ClearRuntimeMapParams) + // Return one runtime map file + // (GET /services/haproxy/runtime/maps/{name}) + GetOneRuntimeMap(w http.ResponseWriter, r *http.Request, name string) + // Add a new map payload + // (PUT /services/haproxy/runtime/maps/{name}) + AddPayloadRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params AddPayloadRuntimeMapParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return runtime map files +// (GET /services/haproxy/runtime/maps) +func (_ Unimplemented) GetAllRuntimeMapFiles(w http.ResponseWriter, r *http.Request, params GetAllRuntimeMapFilesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Remove all map entries from the map file +// (DELETE /services/haproxy/runtime/maps/{name}) +func (_ Unimplemented) ClearRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params ClearRuntimeMapParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one runtime map file +// (GET /services/haproxy/runtime/maps/{name}) +func (_ Unimplemented) GetOneRuntimeMap(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new map payload +// (PUT /services/haproxy/runtime/maps/{name}) +func (_ Unimplemented) AddPayloadRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params AddPayloadRuntimeMapParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllRuntimeMapFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllRuntimeMapFiles(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllRuntimeMapFilesParams + + // ------------- Optional query parameter "include_unmanaged" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "include_unmanaged", r.URL.Query(), ¶ms.IncludeUnmanaged, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "include_unmanaged"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "include_unmanaged", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllRuntimeMapFiles(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ClearRuntimeMap operation middleware +func (siw *ServerInterfaceWrapper) ClearRuntimeMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ClearRuntimeMapParams + + // ------------- Optional query parameter "forceDelete" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "forceDelete", r.URL.Query(), ¶ms.ForceDelete, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "forceDelete"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "forceDelete", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_sync" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_sync", r.URL.Query(), ¶ms.ForceSync, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_sync"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_sync", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ClearRuntimeMap(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneRuntimeMap operation middleware +func (siw *ServerInterfaceWrapper) GetOneRuntimeMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneRuntimeMap(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddPayloadRuntimeMap operation middleware +func (siw *ServerInterfaceWrapper) AddPayloadRuntimeMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params AddPayloadRuntimeMapParams + + // ------------- Optional query parameter "force_sync" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_sync", r.URL.Query(), ¶ms.ForceSync, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_sync"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_sync", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddPayloadRuntimeMap(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/maps", wrapper.GetAllRuntimeMapFiles) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/maps/{name}", wrapper.ClearRuntimeMap) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/maps/{name}", wrapper.GetOneRuntimeMap) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/maps/{name}", wrapper.AddPayloadRuntimeMap) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhNc9s2EP0rGMSnljKV2JMDe5Jjp/XBrcft9BI5mjWwlJDiKwAoh+Phf+8AJGUrlGI7lRs304uHFrC7", + "Dw/vLUDeUGaUNRp18LS4oQ69Ndpj+sdbZKIUDIIweqYMR+lnzChl9Gw1sf/9CPgFfqzQhxjKjA6o0yNY", + "K7sc+QdvdMrMFqggPu05LGlBX+S3OPJ21OePqo/OGUebpskoR8+csDGKFvQIOHEdsowuEDi6tLw3Rpdi", + "XrmUfvQnOi9adOvxa9NIKSSSZTc3u7OQUFukBfXBCT2POJrscQQeYwmVDCdpHc+Lwp9RowNJWmzPmcRf", + "TXhrKs2fGYF/LJB0mTCq0ZvKMSTX4Ik2gZQJ8r/Ka9MPp2oK7J1p5uoDsmiWT6O5GXU/tkvcPwN7d2Ak", + "lDUucWwhLGhB5yIsqqt9ZlS+AOvMpzogW+RMCtRhpCGIJebL13mbj0YgCuwMdXCibTsioPL37UsfU9Mm", + "63GDc1BvhX3SVXgq9PXDGTxJ058AyKP4ezBzu+fsK1z1MHL7DrVLuBGw0KVJEESQsdwvk/MYSY4hADmX", + "oJFMzk/JiFxUOgiFpKOtN2NBI9vGogYraEEP9sf7L2mWMKW9yj26pWDoe1C5azPl/bbOMQz9f4GhctqT", + "bjJRYFMX8Ps0lWsbwylPTTxMpOzwnYF9G6clCA4UhtR33n2e/7QkwVWYEZDeEL8w16TSCjTMkd8WI9IA", + "R06EJh16GimjBf1YYVK6BhVpE5rJiuNslWOtS/H2BKRFCdLjSpxXxkgETZvmMlu/oLwaj3fW6BPNG1r3", + "7xVj6H1ZSbLiM+7l4fhwW8oVxvzrzq6EoaNipxXWrhjJh5VSEDtXJ6ShjmhGA8yjNGiS9GUM+7JY85u4", + "2027oxIDbpKtMkskIGWq1DV/UjqjSFjclh+q+I1EcLcivk+/Z10ikgTYiTI1gpUmu5F4RRQOOS2S4O+o", + "xkII6GLg+3fvp1M3neppNR4fsPQXf/hp70V8evX6ppnSyx/3aDY4b7OtvmoZ8i3ItH4u/F9b7FMax/C4", + "5XTD8X5rlO31hFLIBQSUNfG1Zp6wBeg5ehLMvaVnMeKfWvZwKIfJZzpoSeHfpc0eJvyh7bIvHwBG48C8", + "G8+A3zT+5+zzxH3//7a/ST2bJGirDRKccO4JEI3XKdZCHa8DQ/FNOD9vx76j/v1N+mn6mHFkeL1LF6xe", + "wZIb1ulsBgZ8+XSlhwroJEWA8/5UGO/YI3c+X30LH044H1po4MD4XsMMxznqUaeC0ZXh9agTFYcALYfx", + "gtY7qnKSFjRfHtDmsvk7AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/maps/maps.go b/handlers/runtime/maps/maps.go new file mode 100644 index 00000000..de09ed1a --- /dev/null +++ b/handlers/runtime/maps/maps.go @@ -0,0 +1,157 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package maps + +import ( + "net/http" + "path/filepath" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + config "github.com/haproxytech/dataplaneapi/configuration" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all maps routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime maps. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllRuntimeMapFiles(w http.ResponseWriter, r *http.Request, params GetAllRuntimeMapFilesParams) { + mapList := []*models.Map{} + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + runtimeMaps, err := rt.ShowMaps() + if err != nil { + respond.RuntimeError(w, err) + return + } + + mapsDir, err := rt.GetMapsDir() + if err != nil { + respond.RuntimeError(w, err) + return + } + + for _, m := range runtimeMaps { + if params.IncludeUnmanaged || strings.HasPrefix(filepath.Dir(m.File), mapsDir) { + if strings.HasPrefix(filepath.Dir(m.File), mapsDir) { + m.StorageName = filepath.Base(m.File) + } + mapList = append(mapList, m) + } + } + respond.JSON(w, http.StatusOK, mapList) +} + +func (h *HandlerImpl) ClearRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params ClearRuntimeMapParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.ClearMap(name, params.ForceDelete); err != nil { + respond.RuntimeError(w, err) + return + } + + if params.ForceSync { + m, err := rt.GetMap(name) + if err != nil { + respond.RuntimeError(w, err) + return + } + ms := config.NewMapSync() + if _, err = ms.Sync(m, h.Client); err != nil { + respond.RuntimeError(w, err) + return + } + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetOneRuntimeMap(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + m, err := rt.GetMap(name) + if err != nil { + respond.RuntimeError(w, err) + return + } + if m == nil { + w.WriteHeader(http.StatusNotFound) + return + } + respond.JSON(w, http.StatusOK, m) +} + +func (h *HandlerImpl) AddPayloadRuntimeMap(w http.ResponseWriter, r *http.Request, name string, params AddPayloadRuntimeMapParams) { + var data AddPayloadRuntimeMapJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddMapPayloadVersioned(name, data); err != nil { + respond.RuntimeError(w, err) + return + } + + if params.ForceSync { + m, err := rt.GetMap(name) + if err != nil { + respond.RuntimeError(w, err) + return + } + ms := config.NewMapSync() + if _, err = ms.Sync(m, h.Client); err != nil { + respond.RuntimeError(w, err) + return + } + } + respond.JSON(w, http.StatusCreated, data) +} diff --git a/handlers/runtime/process_info/process_info.gen.go b/handlers/runtime/process_info/process_info.gen.go new file mode 100644 index 00000000..53c19db4 --- /dev/null +++ b/handlers/runtime/process_info/process_info.gen.go @@ -0,0 +1,288 @@ +// Package process_info provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package process_info + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" +) + +// ProcessInfo defines model for process_info. +type ProcessInfo = models.ProcessInfo + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return HAProxy process information + // (GET /services/haproxy/runtime/info) + GetHaproxyProcessInfo(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return HAProxy process information +// (GET /services/haproxy/runtime/info) +func (_ Unimplemented) GetHaproxyProcessInfo(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetHaproxyProcessInfo operation middleware +func (siw *ServerInterfaceWrapper) GetHaproxyProcessInfo(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetHaproxyProcessInfo(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/info", wrapper.GetHaproxyProcessInfo) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "rJTNattAEMdfZZn2KHnTBnrQLTSl8c2k0EsIZrMeSRu0H8yORIzRu5ddSa5FW0hKbvLO12/+M+MTaG+D", + "d+g4QnUCwhi8i5h/xIDa1EYrNt7trT9gF/faW+vd/uy4vN9irfqOvxF5SsHaO0bH6VOF0M1Z5HP0LufW", + "LVqVvj4S1lDBB/mbRE7WKN9EgLn0OI4FHDBqMiFFQQXf0SGpTkxsBbSoDki5xa/e1abpKRcofyJFM/Gt", + "M6zcRG06FMPsW1y0wseAUEFkMq5JJIll7iXZA3mNMe6Nq/2Fv396Rs1QwEvZ+HJ+nJra7KaQbYq4cCiN", + "DZ6yukFxCxU0htv+aaO9la0K5F+OjLqVujPouHSKzYBy+CKnvJDJ3q7u66AXod8TNwGfdTPcpXJ3N7sU", + "KW4VK7HrlENxs9uKUtz3jo1FMasnZvmWmVUAYwE+oFPBQAXXm6vNJygyWx6UjEiD0RgXOElTRrkgNMh/", + "rsk9ck9OLFjzuEWKIZtVhlx22qPtIe8m300l1pNeHeLnq6t3O6nVDv7lWH70OtkhG/JJ/yvjGVH+/x9F", + "XsPeWkXH1+rHqolQPcD24vVxujSkId/1wwl66qACOVzD+Dj+CgAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/process_info/process_info.go b/handlers/runtime/process_info/process_info.go new file mode 100644 index 00000000..6ab07c86 --- /dev/null +++ b/handlers/runtime/process_info/process_info.go @@ -0,0 +1,58 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package process_info + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all process_info routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy process info. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetHaproxyProcessInfo(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + info, err := rt.GetInfo() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &info) +} diff --git a/handlers/runtime/servers/servers.gen.go b/handlers/runtime/servers/servers.gen.go new file mode 100644 index 00000000..16ffad90 --- /dev/null +++ b/handlers/runtime/servers/servers.gen.go @@ -0,0 +1,501 @@ +// Package servers provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package servers + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// RuntimeAddServer defines model for runtime_add_server. +type RuntimeAddServer = models.RuntimeAddServer + +// RuntimeServer defines model for runtime_server. +type RuntimeServer = models.RuntimeServer + +// RuntimeServers defines model for runtime_servers. +type RuntimeServers = models.RuntimeServers + +// AddRuntimeServerJSONRequestBody defines body for AddRuntimeServer for application/json ContentType. +type AddRuntimeServerJSONRequestBody = RuntimeAddServer + +// ReplaceRuntimeServerJSONRequestBody defines body for ReplaceRuntimeServer for application/json ContentType. +type ReplaceRuntimeServerJSONRequestBody = RuntimeServer + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of runtime servers' settings + // (GET /services/haproxy/runtime/backends/{parent_name}/servers) + GetAllRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) + // Adds a new server to a backend + // (POST /services/haproxy/runtime/backends/{parent_name}/servers) + AddRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) + // Deletes a server from a backend + // (DELETE /services/haproxy/runtime/backends/{parent_name}/servers/{name}) + DeleteRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) + // Return one server runtime settings + // (GET /services/haproxy/runtime/backends/{parent_name}/servers/{name}) + GetRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) + // Replace server transient settings + // (PUT /services/haproxy/runtime/backends/{parent_name}/servers/{name}) + ReplaceRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of runtime servers' settings +// (GET /services/haproxy/runtime/backends/{parent_name}/servers) +func (_ Unimplemented) GetAllRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Adds a new server to a backend +// (POST /services/haproxy/runtime/backends/{parent_name}/servers) +func (_ Unimplemented) AddRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes a server from a backend +// (DELETE /services/haproxy/runtime/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) DeleteRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one server runtime settings +// (GET /services/haproxy/runtime/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) GetRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace server transient settings +// (PUT /services/haproxy/runtime/backends/{parent_name}/servers/{name}) +func (_ Unimplemented) ReplaceRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllRuntimeServer operation middleware +func (siw *ServerInterfaceWrapper) GetAllRuntimeServer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllRuntimeServer(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddRuntimeServer operation middleware +func (siw *ServerInterfaceWrapper) AddRuntimeServer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddRuntimeServer(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteRuntimeServer operation middleware +func (siw *ServerInterfaceWrapper) DeleteRuntimeServer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteRuntimeServer(w, r, parentName, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetRuntimeServer operation middleware +func (siw *ServerInterfaceWrapper) GetRuntimeServer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetRuntimeServer(w, r, parentName, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceRuntimeServer operation middleware +func (siw *ServerInterfaceWrapper) ReplaceRuntimeServer(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceRuntimeServer(w, r, parentName, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/backends/{parent_name}/servers", wrapper.GetAllRuntimeServer) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/backends/{parent_name}/servers", wrapper.AddRuntimeServer) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/backends/{parent_name}/servers/{name}", wrapper.DeleteRuntimeServer) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/backends/{parent_name}/servers/{name}", wrapper.GetRuntimeServer) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/backends/{parent_name}/servers/{name}", wrapper.ReplaceRuntimeServer) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XCDZAgU2y3CYoMO3JWbqtL0OQDnuJU+NMnmx2EqmRlBvD0P8+kJQc+VeWeG4aF3kJJJo8", + "fnf3fXenLChTRakkSmtouqAaTamkQf9iSmQiEwysUHJUKI65GTFVFEqOlhvb9UGuEfj8/a0wwRRT0qK0", + "7hHKMm/MJJ+Nkt44m2IB7ulEY0ZT+iq5g5KEX03yKAiotdK0ruuIcjRMi9Kdoin9c4qksYScaDSq0gwJ", + "BMgEA+aIThE4ao/+FyUzMam0vzj+C7URAfeq5ZVtJBM5klmzN+q4aOcl0pQaq4WcOIR19LjongO/wn8q", + "NPaZhfYcXEADsuccwAvMoMrte+/H8wrhbyhRQ04CtuccxD+U/VVVkh+HvL+AIVJZknnITxrXuv05FNVK", + "WlHgCDgfGdQz1J1TavwZmdPObTxRcbMYPO5dhYMDzj+GY51dsShKpX38S7BTmtKJsNNq3GOqSKZQanU7", + "t8imCcsFShtLsGKGyexdEoxTB7JFtg+qJ4Hk4ycsFua/qLTmSh21roDWMH+AJ+bgruzB7odloK0Uh4Tr", + "AAuZKQ9B2Nxd9/vg0p0kF2CBXOYgkQwuP5CYNIEjd5FrdZFSF3pVooRS0JSe9vq9NzTysHwOE5cgwdC0", + "uNrMJWNgf6PkJlmUoFHakYQC66RDhAnaTZFeoa20NAQk8akmKiOQ56Q595o09olBa4WcmB71AIOqP3Bf", + "ge0gz9d5XYKGAq2/+3r91ksPkTiI1AWOpiHyEfVL7m3pA42oa5FCI6ep1RV2i0cJ1qJ25z9dfxoO9XAo", + "h1W/f8r8X/zh55NX7untu0U9pDc/ntBoo97cRKtz29t+/2AVel2OW8rvx4oxNCarcrIMK/W7fMvddcMS", + "crJ/I/cqq4oC9HzJhBUi3OW+IUNLAhdGmLjM0ibhN3VES2W2MGzAuSFAJH5p7BCriF1pOg13N5g14Py4", + "aeUnu3PF5wdnVKcbelKt+lJvcPrNV0ewRuuQauAcuaPzWVDVAancGeq9/bMD21+Oa976Twe2vvrB9y30", + "vlWX0NHiusJdx2SK4wRl3FA7His+jxtxcbDg79i3SSUL/xpKSI4WN4vJhV93uBvMmVbFA6tJOHu0BSVa", + "bJfYbnDfpnuebWatQRqS+h2UgyfX6nba3yfWOrp/3lOybesbEx4Zz4mwr41nFhFyu7y2zoEv4jrS0fQx", + "k+l3pq1m7r1HEDum3WqrvMocWFepVoM07rPxf+ursf2isWOa0x8zoz+puHeyUweavbTpfUqJD91u6e8/", + "Vbt72n/lXC9opXOa0mR2Suub+t8AAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/servers/servers.go b/handlers/runtime/servers/servers.go new file mode 100644 index 00000000..d98a5842 --- /dev/null +++ b/handlers/runtime/servers/servers.go @@ -0,0 +1,554 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package servers + +import ( + "fmt" + "net/http" + "strconv" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + native_errors "github.com/haproxytech/client-native/v6/errors" + "github.com/haproxytech/client-native/v6/models" + cn_runtime "github.com/haproxytech/client-native/v6/runtime" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" +) + +// RegisterRouter registers all servers routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime servers. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + rs, err := rt.GetServersState(parentName) + if err != nil { + e := misc.HandleContainerGetError(err) + if *e.Code == misc.ErrHTTPOk { + respond.JSON(w, http.StatusOK, models.RuntimeServers{}) + return + } + respond.JSON(w, int(*e.Code), e) + return + } + respond.JSON(w, http.StatusOK, rs) +} + +func (h *HandlerImpl) AddRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string) { + var data AddRuntimeServerJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + if data.Name == "" { + respond.BadRequest(w, "the new server must have a name") + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + haversion, err := rt.GetVersion() + if err != nil { + respond.Error(w, err) + return + } + + err = rt.AddServer(parentName, data.Name, SerializeRuntimeAddServer(&data, &haversion)) + if err != nil { + msg := err.Error() + switch { + case strings.Contains(msg, "No such backend"): + code := int64(404) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + case strings.Contains(msg, "Already exists"): + code := int64(409) + respond.JSON(w, http.StatusConflict, &models.Error{Code: &code, Message: &msg}) + default: + respond.Error(w, err) + } + return + } + + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + rs, err := rt.GetServerState(parentName, name) + if err != nil { + if isNotFoundError(err) { + msg := err.Error() + code := int64(http.StatusNotFound) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + respond.Error(w, err) + return + } + + if rs.AdminState != "maint" { + if err = rt.DisableServer(parentName, name); err != nil { + respond.Error(w, err) + return + } + } + + if err = rt.DeleteServer(parentName, name); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + rs, err := rt.GetServerState(parentName, name) + if err != nil { + if isNotFoundError(err) { + code := int64(404) + msg := err.Error() + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + respond.Error(w, err) + return + } + + if rs == nil { + msg := fmt.Sprintf("Runtime server %s not found in backend %s", name, parentName) + code := int64(404) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + + respond.JSON(w, http.StatusOK, rs) +} + +func isNotFoundError(err error) bool { + msg := err.Error() + return strings.Contains(msg, "No such backend") || + strings.Contains(msg, native_errors.ErrNotFound.Error()) +} + +func (h *HandlerImpl) ReplaceRuntimeServer(w http.ResponseWriter, r *http.Request, parentName string, name string) { + var data ReplaceRuntimeServerJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + rs, err := rt.GetServerState(parentName, name) + if err != nil { + respond.Error(w, err) + return + } + + if rs == nil { + msg := fmt.Sprintf("Runtime server %s not found in backend %s", name, parentName) + code := int64(404) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + + // save original values for rollback + origOperationalState := rs.OperationalState + origAdminState := rs.AdminState + origWeight := rs.Weight + + var changedOperational, changedAdmin, changedWeight bool + + // change operational state + if data.OperationalState != "" && rs.OperationalState != data.OperationalState { + if err = rt.SetServerHealth(parentName, name, data.OperationalState); err != nil { + respond.Error(w, err) + return + } + changedOperational = true + } + + // change admin state + if data.AdminState != "" && rs.AdminState != data.AdminState { + if err = rt.SetServerState(parentName, name, data.AdminState); err != nil { + if changedOperational { + //nolint:errcheck + rt.SetServerHealth(parentName, name, origOperationalState) + } + respond.Error(w, err) + return + } + changedAdmin = true + } + + // change weight + if data.Weight != nil && (rs.Weight == nil || *data.Weight != *rs.Weight) { + if err = rt.SetServerWeight(parentName, name, strconv.FormatInt(*data.Weight, 10)); err != nil { + if changedAdmin { + //nolint:errcheck + rt.SetServerState(parentName, name, origAdminState) + } + if changedOperational { + //nolint:errcheck + rt.SetServerHealth(parentName, name, origOperationalState) + } + respond.Error(w, err) + return + } + changedWeight = true + } + + // change address/port + addrChanged := data.Address != "" && rs.Address != data.Address + portChanged := data.Port != nil && (rs.Port == nil || *data.Port != *rs.Port) + if addrChanged || portChanged { + newAddr := rs.Address + if data.Address != "" { + newAddr = data.Address + } + var newPort int + if data.Port != nil { + newPort = int(*data.Port) + } else if rs.Port != nil { + newPort = int(*rs.Port) + } + if err = rt.SetServerAddr(parentName, name, newAddr, newPort); err != nil { + if changedWeight { + //nolint:errcheck + rt.SetServerWeight(parentName, name, formatWeightPtr(origWeight)) + } + if changedAdmin { + //nolint:errcheck + rt.SetServerState(parentName, name, origAdminState) + } + if changedOperational { + //nolint:errcheck + rt.SetServerHealth(parentName, name, origOperationalState) + } + respond.Error(w, err) + return + } + } + + rs, err = rt.GetServerState(parentName, name) + if err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, rs) +} + +func formatWeightPtr(w *int64) string { + if w == nil { + return "0" + } + return strconv.FormatInt(*w, 10) +} + +// SerializeRuntimeAddServer returns a string in the HAProxy config format, suitable +// for the "add server" operation over the control socket. +func SerializeRuntimeAddServer(srv *models.RuntimeAddServer, version *cn_runtime.HAProxyVersion) string { //nolint: cyclop,maintidx + b := &strings.Builder{} + + push := func(s string) { + b.WriteByte(' ') + b.WriteString(s) + } + pushi := func(key string, val *int64) { + fmt.Fprintf(b, " %s %d", key, *val) + } + pushq := func(key, val string) { + fmt.Fprintf(b, ` %s %s`, key, val) + } + enabled := func(s string) bool { + return s == "enabled" + } + disabled := func(s string) bool { + return s == "disabled" + } + + addr := srv.Address + if srv.Port != nil { + addr += fmt.Sprintf(":%d", *srv.Port) + } + push(addr) + + if enabled(srv.AgentCheck) { + push("agent-check") + } + if srv.AgentAddr != "" { + pushq("agent-addr", srv.AgentAddr) + } + if srv.AgentPort != nil { + pushi("agent-port", srv.AgentPort) + } + if srv.AgentInter != nil { + pushi("agent-inter", srv.AgentInter) + } + if srv.AgentSend != "" { + pushq("agent-send", srv.AgentSend) + } + if srv.Allow0rtt { + push("allow-0rtt") + } + if srv.Alpn != "" { + pushq("alpn", srv.Alpn) + } + if enabled(srv.Backup) { + push("backup") + } + if srv.SslCafile != "" { + pushq("ca-file", srv.SslCafile) + } + if enabled(srv.Check) { + push("check") + } + if srv.CheckAlpn != "" { + pushq("check-alpn", srv.CheckAlpn) + } + if srv.HealthCheckAddress != "" { + pushq("addr", srv.HealthCheckAddress) + } + if srv.HealthCheckPort != nil { + pushi("port", srv.HealthCheckPort) + } + if srv.CheckProto != "" { + pushq("check-proto", srv.CheckProto) + } + if enabled(srv.CheckSendProxy) { + push("check-send-proxy") + } + if srv.CheckSni != "" { + pushq("check-sni", srv.CheckSni) + } + if enabled(srv.CheckSsl) { + push("check-ssl") + } + if enabled(srv.CheckViaSocks4) { + push("check-via-socks4") + } + if srv.Ciphers != "" { + pushq("ciphers", srv.Ciphers) + } + if srv.Ciphersuites != "" { + pushq("ciphersuites", srv.Ciphersuites) + } + if srv.CrlFile != "" { + pushq("crl-file", srv.CrlFile) + } + if srv.SslCertificate != "" { + pushq("crt", srv.SslCertificate) + } + if enabled(srv.Maintenance) { + push("disabled") + } + if srv.Downinter != nil { + pushi("downinter", srv.Downinter) + } + if disabled(srv.Maintenance) { + required := new(cn_runtime.HAProxyVersion) + required.ParseHAProxyVersion("3.0.0") + if !cn_runtime.IsBiggerOrEqual(required, version) { + push("enabled") + } + } + if srv.ErrorLimit != nil { + pushi("error-limit", srv.ErrorLimit) + } + if srv.Fall != nil { + pushi("fall", srv.Fall) + } + if srv.Fastinter != nil { + pushi("fastinter", srv.Fastinter) + } + if enabled(srv.ForceSslv3) { + push("force-sslv3") + } + if enabled(srv.ForceTlsv10) { + push("force-tlsv10") + } + if enabled(srv.ForceTlsv11) { + push("force-tlsv11") + } + if enabled(srv.ForceTlsv12) { + push("force-tlsv12") + } + if enabled(srv.ForceTlsv13) { + push("force-tlsv13") + } + if srv.ID != "" { + pushq("id", srv.ID) + } + if srv.Inter != nil { + pushi("inter", srv.Inter) + } + if srv.Maxconn != nil { + pushi("maxconn", srv.Maxconn) + } + if srv.Maxqueue != nil { + pushi("maxqueue", srv.Maxqueue) + } + if srv.Minconn != nil { + pushi("minconn", srv.Minconn) + } + if disabled(srv.SslReuse) { + push("no-ssl-reuse") + } + if enabled(srv.NoSslv3) { + push("no-sslv3") + } + if enabled(srv.NoTlsv10) { + push("no-tlsv10") + } + if enabled(srv.NoTlsv11) { + push("no-tlsv11") + } + if enabled(srv.NoTlsv12) { + push("no-tlsv12") + } + if enabled(srv.NoTlsv13) { + push("no-tlsv13") + } + if disabled(srv.TLSTickets) { + push("no-tls-tickets") + } + if srv.Npn != "" { + pushq("npm", srv.Npn) + } + if srv.Observe != "" { + pushq("observe", srv.Observe) + } + if srv.OnError != "" { + pushq("on-error", srv.OnError) + } + if srv.OnMarkedDown != "" { + pushq("on-marked-down", srv.OnMarkedDown) + } + if srv.OnMarkedUp != "" { + pushq("on-marked-up", srv.OnMarkedUp) + } + if srv.PoolLowConn != nil { + pushi("pool-low-conn", srv.PoolLowConn) + } + if srv.PoolMaxConn != nil { + pushi("pool-max-conn", srv.PoolMaxConn) + } + if srv.PoolPurgeDelay != nil { + pushi("pool-purge-delay", srv.PoolPurgeDelay) + } + if srv.Proto != "" { + pushq("proto", srv.Proto) + } + if len(srv.ProxyV2Options) > 0 { + pushq("proxy-v2-options", strings.Join(srv.ProxyV2Options, ",")) + } + if srv.Rise != nil { + pushi("rise", srv.Rise) + } + if enabled(srv.SendProxy) { + push("send-proxy") + } + if enabled(srv.SendProxyV2) { + push("send-proxy-v2") + } + if enabled(srv.SendProxyV2Ssl) { + push("send-proxy-v2-ssl") + } + if enabled(srv.SendProxyV2SslCn) { + push("send-proxy-v2-ssl-cn") + } + if srv.Slowstart != nil { + pushi("slowstart", srv.Slowstart) + } + if srv.Sni != "" { + pushq("sni", srv.Sni) + } + if srv.Source != "" { + pushq("source", srv.Source) + } + if enabled(srv.Ssl) { + push("ssl") + } + if srv.SslMaxVer != "" { + pushq("ssl-max-ver", srv.SslMaxVer) + } + if srv.SslMinVer != "" { + pushq("ssl-min-ver", srv.SslMinVer) + } + if enabled(srv.Tfo) { + push("tfo") + } + if enabled(srv.TLSTickets) { + push("tls-tickets") + } + if srv.Track != "" { + pushq("track", srv.Track) + } + if srv.Verify != "" { + pushq("verify", srv.Verify) + } + if srv.Verifyhost != "" { + pushq("verifyhost", srv.Verifyhost) + } + if srv.Weight != nil { + pushi("weight", srv.Weight) + } + if srv.Ws != "" { + pushq("ws", srv.Ws) + } + return b.String() +} diff --git a/handlers/runtime/servers/servers_test.go b/handlers/runtime/servers/servers_test.go new file mode 100644 index 00000000..5fc2bc6f --- /dev/null +++ b/handlers/runtime/servers/servers_test.go @@ -0,0 +1,159 @@ +package servers + +import ( + "testing" + + "github.com/haproxytech/client-native/v6/models" + cn_runtime "github.com/haproxytech/client-native/v6/runtime" +) + +func TestSerializeRuntimeAddServer(t *testing.T) { + tests := []struct { + name string + srv *models.RuntimeAddServer + version *cn_runtime.HAProxyVersion + want string + }{ + { + name: "basic server", + srv: &models.RuntimeAddServer{ + Address: "127.0.0.1", + Port: new(int64(8080)), + }, + version: &cn_runtime.HAProxyVersion{}, + want: " 127.0.0.1:8080", + }, + { + name: "server with weight", + srv: &models.RuntimeAddServer{ + Address: "192.168.1.100", + Port: new(int64(9000)), + Weight: new(int64(50)), + }, + version: &cn_runtime.HAProxyVersion{}, + want: " 192.168.1.100:9000 weight 50", + }, + { + name: "server with maintenance", + srv: &models.RuntimeAddServer{ + Address: "10.0.0.10", + Maintenance: "enabled", + }, + version: &cn_runtime.HAProxyVersion{}, + want: " 10.0.0.10 disabled", + }, + { + name: "server with maintenance disabled", + srv: &models.RuntimeAddServer{ + Address: "10.0.0.10", + Maintenance: "disabled", + }, + version: &cn_runtime.HAProxyVersion{}, + want: " 10.0.0.10 enabled", + }, + { + name: "server with maintenance disabled, HAProxy 3.0", + srv: &models.RuntimeAddServer{ + Address: "10.0.0.10", + Maintenance: "disabled", + }, + version: func() *cn_runtime.HAProxyVersion { + v := new(cn_runtime.HAProxyVersion) + v.ParseHAProxyVersion("3.0.0") + return v + }(), + want: " 10.0.0.10", + }, + { + name: "server with agent check", + srv: &models.RuntimeAddServer{ + Address: "172.16.0.5", + AgentCheck: "enabled", + }, + version: &cn_runtime.HAProxyVersion{}, + want: " 172.16.0.5 agent-check", + }, + { + name: "server with agent addr", + srv: &models.RuntimeAddServer{ + Address: "172.16.0.6", + AgentAddr: "127.0.0.1", + }, + version: &cn_runtime.HAProxyVersion{}, + want: ` 172.16.0.6 agent-addr 127.0.0.1`, + }, + { + name: "server with multiple options", + srv: &models.RuntimeAddServer{ + Address: "10.1.1.10", + Port: new(int64(80)), + Weight: new(int64(10)), + Check: "enabled", + Backup: "enabled", + Maintenance: "enabled", + AgentCheck: "enabled", + AgentAddr: "127.0.0.1", + AgentPort: new(int64(5000)), + HealthCheckAddress: "127.0.0.2", + }, + version: &cn_runtime.HAProxyVersion{}, + want: ` 10.1.1.10:80 agent-check agent-addr 127.0.0.1 agent-port 5000 backup check addr 127.0.0.2 disabled weight 10`, + }, + { + name: "server with all fields", + srv: &models.RuntimeAddServer{ + Address: "10.1.1.10", + Port: new(int64(80)), + Weight: new(int64(10)), + Check: "enabled", + Backup: "enabled", + Maintenance: "enabled", + AgentCheck: "enabled", + AgentAddr: "127.0.0.1", + AgentPort: new(int64(5000)), + AgentInter: new(int64(1000)), + AgentSend: "foobar", + Allow0rtt: true, + Alpn: "h2,http/1.1", + CheckAlpn: "h2", + CheckProto: "HTTP", + CheckSendProxy: "enabled", + CheckSni: "example.com", + CheckSsl: "enabled", + CheckViaSocks4: "enabled", + Ciphers: "HIGH:!aNULL:!MD5", + Ciphersuites: "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256", + CrlFile: "/path/to/crl.pem", + SslCertificate: "/path/to/cert.pem", + Downinter: new(int64(2000)), + ErrorLimit: new(int64(10)), + Fall: new(int64(2)), + Fastinter: new(int64(500)), + ForceSslv3: "enabled", + ForceTlsv10: "enabled", + ForceTlsv11: "enabled", + ForceTlsv12: "enabled", + ForceTlsv13: "enabled", + HealthCheckAddress: "127.0.0.2", + HealthCheckPort: new(int64(8080)), + Inter: new(int64(3000)), + Maxconn: new(int64(100)), + Maxqueue: new(int64(200)), + Minconn: new(int64(50)), + Rise: new(int64(1)), + }, + version: &cn_runtime.HAProxyVersion{}, + want: ` 10.1.1.10:80 agent-check agent-addr 127.0.0.1 agent-port 5000 agent-inter 1000 agent-send foobar allow-0rtt alpn h2,http/1.1 backup check check-alpn h2 addr 127.0.0.2 port 8080 check-proto HTTP check-send-proxy check-sni example.com check-ssl check-via-socks4 ciphers HIGH:!aNULL:!MD5 ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 crl-file /path/to/crl.pem crt /path/to/cert.pem disabled downinter 2000 error-limit 10 fall 2 fastinter 500 force-sslv3 force-tlsv10 force-tlsv11 force-tlsv12 force-tlsv13 inter 3000 maxconn 100 maxqueue 200 minconn 50 rise 1 weight 10`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.version == nil { + tt.version = &cn_runtime.HAProxyVersion{} + } + if got := SerializeRuntimeAddServer(tt.srv, tt.version); got != tt.want { + t.Errorf("SerializeRuntimeAddServer() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/handlers/runtime/ssl_ca_files/ssl_ca_files.gen.go b/handlers/runtime/ssl_ca_files/ssl_ca_files.gen.go new file mode 100644 index 00000000..68b6ecf3 --- /dev/null +++ b/handlers/runtime/ssl_ca_files/ssl_ca_files.gen.go @@ -0,0 +1,559 @@ +// Package ssl_ca_files provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_ca_files + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SslCaFile defines model for ssl_ca_file. +type SslCaFile = models.SslCaFile + +// SslCaFiles defines model for ssl_ca_files. +type SslCaFiles = models.SslCaFiles + +// SslCertificate defines model for ssl_certificate. +type SslCertificate = models.SslCertificate + +// CreateCaFileMultipartBody defines parameters for CreateCaFile. +type CreateCaFileMultipartBody struct { + // FileUpload CA certificate file + FileUpload openapi_types.File `json:"file_upload"` +} + +// SetCaFileMultipartBody defines parameters for SetCaFile. +type SetCaFileMultipartBody struct { + FileUpload openapi_types.File `json:"file_upload"` +} + +// AddCaEntryMultipartBody defines parameters for AddCaEntry. +type AddCaEntryMultipartBody struct { + // FileUpload Payload of the cert entry + FileUpload openapi_types.File `json:"file_upload"` +} + +// CreateCaFileMultipartRequestBody defines body for CreateCaFile for multipart/form-data ContentType. +type CreateCaFileMultipartRequestBody CreateCaFileMultipartBody + +// SetCaFileMultipartRequestBody defines body for SetCaFile for multipart/form-data ContentType. +type SetCaFileMultipartRequestBody SetCaFileMultipartBody + +// AddCaEntryMultipartRequestBody defines body for AddCaEntry for multipart/form-data ContentType. +type AddCaEntryMultipartRequestBody AddCaEntryMultipartBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all SSL CA files + // (GET /services/haproxy/runtime/ssl_ca_files) + GetAllCaFiles(w http.ResponseWriter, r *http.Request) + // Creates a new SSL CA file + // (POST /services/haproxy/runtime/ssl_ca_files) + CreateCaFile(w http.ResponseWriter, r *http.Request) + // Deletes a CA file + // (DELETE /services/haproxy/runtime/ssl_ca_files/{name}) + DeleteCaFile(w http.ResponseWriter, r *http.Request, name string) + // Return an SSL CA file + // (GET /services/haproxy/runtime/ssl_ca_files/{name}) + GetCaFile(w http.ResponseWriter, r *http.Request, name string) + // Update the contents of a CA file + // (PUT /services/haproxy/runtime/ssl_ca_files/{name}) + SetCaFile(w http.ResponseWriter, r *http.Request, name string) + // Add a certificate to a CA file + // (POST /services/haproxy/runtime/ssl_ca_files/{name}/entries) + AddCaEntry(w http.ResponseWriter, r *http.Request, name string) + // Return an SSL CA file cert entry + // (GET /services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}) + GetCaEntry(w http.ResponseWriter, r *http.Request, name string, index int) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all SSL CA files +// (GET /services/haproxy/runtime/ssl_ca_files) +func (_ Unimplemented) GetAllCaFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Creates a new SSL CA file +// (POST /services/haproxy/runtime/ssl_ca_files) +func (_ Unimplemented) CreateCaFile(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes a CA file +// (DELETE /services/haproxy/runtime/ssl_ca_files/{name}) +func (_ Unimplemented) DeleteCaFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an SSL CA file +// (GET /services/haproxy/runtime/ssl_ca_files/{name}) +func (_ Unimplemented) GetCaFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Update the contents of a CA file +// (PUT /services/haproxy/runtime/ssl_ca_files/{name}) +func (_ Unimplemented) SetCaFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a certificate to a CA file +// (POST /services/haproxy/runtime/ssl_ca_files/{name}/entries) +func (_ Unimplemented) AddCaEntry(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an SSL CA file cert entry +// (GET /services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}) +func (_ Unimplemented) GetCaEntry(w http.ResponseWriter, r *http.Request, name string, index int) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllCaFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllCaFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllCaFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCaFile operation middleware +func (siw *ServerInterfaceWrapper) CreateCaFile(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCaFile(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCaFile operation middleware +func (siw *ServerInterfaceWrapper) DeleteCaFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCaFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCaFile operation middleware +func (siw *ServerInterfaceWrapper) GetCaFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCaFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// SetCaFile operation middleware +func (siw *ServerInterfaceWrapper) SetCaFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.SetCaFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddCaEntry operation middleware +func (siw *ServerInterfaceWrapper) AddCaEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddCaEntry(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCaEntry operation middleware +func (siw *ServerInterfaceWrapper) GetCaEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // ------------- Path parameter "index" ------------- + var index int + + err = runtime.BindStyledParameterWithOptions("simple", "index", chi.URLParam(r, "index"), &index, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCaEntry(w, r, name, index) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files", wrapper.GetAllCaFiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files", wrapper.CreateCaFile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files/{name}", wrapper.DeleteCaFile) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files/{name}", wrapper.GetCaFile) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files/{name}", wrapper.SetCaFile) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files/{name}/entries", wrapper.AddCaEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}", wrapper.GetCaEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XCLZPmxy5TVBg2pPzo1uBYgjibi9xajDkyWYnkRp5cmMY+t8HkpIjOXZSF07ibH0JFIk8", + "fnf3fXdHLyjXeaEVKLQ0WVADttDKgv/HFsBlKjlDqdU41wIyO+Y6z7UaLxc27weZASbmZzfSBlNcKwSF", + "7pEVRVabib9YrbxxPoWcuafXBlKa0FfxLZQ4fLXxVhDAGG1oVVURFWC5kYXbRRP6aQqktgSCGLC6NBwI", + "C5AJBMwRnQITYDz6E61SOSmNP7j3FxgrA+6u5c4yksoMyKxeG7VcxHkBNKEWjVQTh7CKtovuMRMX8E8J", + "FvcstMfMBTQg2+cAnkLKygzPvB/7FcLfQIFhGQnY9jmIf2h8r0slXoa8vzJLlEaSeshPGteq+bx9HYWG", + "obVVff0FuNPWTW+ie/XLsPagYczyU0/mhTY+KQXDKU3oROK0vD7gOo+nrDD6Zo7ApzHPJCjsKYZyBvHs", + "XRwsUo/cZmPOxs7db8QxtNkJe+/WPyIWH0qJkNsHWdVyoIoaB5gxbP4Afvs4DoDBkP9tAtratFtQDpZU", + "qfZYJLos098H524nOWXIyHnGFJDB+QfSIxelQpkDGQ4/kpMBaYLUyCChLsK6AMUKSRN6eNA/eEMjj83n", + "KbZgZpKDbcDFJliMV1M7AbyrwAvA0ihLWJY1EPwGUlqpJgSnQGp7xGr+N+AB9XCCZD8IX15xkLXy2xlx", + "3vb7uytmbYfWlKlhyTlYm5YZWSKkfpVvTZvML/HG39/wPBPLPGdmvgwqYYp4TRCd3okvjSiyiaXJJR0O", + "P9YkoFdVRAtt1+TpxABDsIQRBV/blrZIVLCxLCT1VHGsxXwlRXmZoSyYwTjVJu8Jhj43oLgWrgInC+qO", + "HpdFplm7WX0KIkO4wbjImFT0tlJ7RRmHCGXgxoqNFYcHpCVr7yqNqMPDkCb0WioX6+hObwh+SQPCxbZ9", + "xFW0UhmCUlfo+uYulHa0uY+hcLQ6CtTeIaVaQ6i3/8uO7XevEM+hjI003qAHV5i5FjAB1av52rvWYt5T", + "LHeZbOfXnfRt1TBeuO1VyHQGoWt0c37q3zugtwC7agorlmoqmGE5oJ9/Lu9jkEfuGgRNQoeJaO1M/eWW", + "v2hK6MiHIYJxGz9ffh6NzGikRmW/f8j9X/jp19ev3NPbd4tqRK9+fr1GHld3CH+0kfAhNk/C9Scn4rr8", + "bijI9/dN1SnG13Of3+2658vn0KP0+G1a/FGg8Q65s7yKPe8A8XCJdCNDuZahRcY4eBLWqbF+EvmOyWH4", + "Qkm6XwPO4w8v/Y21vGBzZ4cwIf6jFf3PQrhBcSPdn2PCiEGhqcmwfq4fCOGbiFs4J6j9s5vPnDS3F+pA", + "iBN25mz9UOrOriLntXZ0GtgFBkO+nu5Csrve2vrV4//bXwdCENa5Xzrl7UOliBdSCbipHv7Bpjt43pJy", + "w4j5wopCdB80H6L12JpPm8HlUsm8zGnSX54qFcIEzFOMtj/kt2m87dbVtZOutwJm1pC3NBlNaDw7pNVV", + "9W8AAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/ssl_ca_files/ssl_ca_files.go b/handlers/runtime/ssl_ca_files/ssl_ca_files.go new file mode 100644 index 00000000..fdc938ba --- /dev/null +++ b/handlers/runtime/ssl_ca_files/ssl_ca_files.go @@ -0,0 +1,217 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_ca_files + +import ( + "io" + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all ssl_ca_files routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime SSL CA files. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllCaFiles(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.ShowCAFiles() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) CreateCaFile(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.NewCAFile(header.Filename); err != nil { + respond.Error(w, err) + return + } + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCAFile(header.Filename, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCAFile(header.Filename); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} + +func (h *HandlerImpl) DeleteCaFile(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + if err = rt.DeleteCAFile(name); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetCaFile(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + caFile, err := rt.GetCAFile(name) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, caFile) +} + +func (h *HandlerImpl) SetCaFile(w http.ResponseWriter, r *http.Request, name string) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, _, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCAFile(name, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCAFile(name); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} + +func (h *HandlerImpl) AddCaEntry(w http.ResponseWriter, r *http.Request, name string) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, _, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddCAFileEntry(name, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCAFile(name); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} + +func (h *HandlerImpl) GetCaEntry(w http.ResponseWriter, r *http.Request, name string, index int) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + idx := int64(index) + entry, err := rt.ShowCAFile(name, &idx) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, entry) +} diff --git a/handlers/runtime/ssl_certs/ssl_certs.gen.go b/handlers/runtime/ssl_certs/ssl_certs.gen.go new file mode 100644 index 00000000..2818b341 --- /dev/null +++ b/handlers/runtime/ssl_certs/ssl_certs.gen.go @@ -0,0 +1,459 @@ +// Package ssl_certs provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_certs + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SslCertificate defines model for ssl_certificate. +type SslCertificate = models.SslCertificate + +// SslCertificates defines model for ssl_certificates. +type SslCertificates = models.SslCertificates + +// CreateCertMultipartBody defines parameters for CreateCert. +type CreateCertMultipartBody struct { + // FileUpload Certificate file + FileUpload openapi_types.File `json:"file_upload"` +} + +// ReplaceCertMultipartBody defines parameters for ReplaceCert. +type ReplaceCertMultipartBody struct { + FileUpload openapi_types.File `json:"file_upload"` +} + +// CreateCertMultipartRequestBody defines body for CreateCert for multipart/form-data ContentType. +type CreateCertMultipartRequestBody CreateCertMultipartBody + +// ReplaceCertMultipartRequestBody defines body for ReplaceCert for multipart/form-data ContentType. +type ReplaceCertMultipartRequestBody ReplaceCertMultipartBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return a list of SSL certificate files + // (GET /services/haproxy/runtime/ssl_certs) + GetAllCerts(w http.ResponseWriter, r *http.Request) + // Create a new SSL certificate file + // (POST /services/haproxy/runtime/ssl_certs) + CreateCert(w http.ResponseWriter, r *http.Request) + // Delete a certificate + // (DELETE /services/haproxy/runtime/ssl_certs/{name}) + DeleteCert(w http.ResponseWriter, r *http.Request, name string) + // Return one structured certificate + // (GET /services/haproxy/runtime/ssl_certs/{name}) + GetCert(w http.ResponseWriter, r *http.Request, name string) + // Replace the contents of a certificate + // (PUT /services/haproxy/runtime/ssl_certs/{name}) + ReplaceCert(w http.ResponseWriter, r *http.Request, name string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return a list of SSL certificate files +// (GET /services/haproxy/runtime/ssl_certs) +func (_ Unimplemented) GetAllCerts(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Create a new SSL certificate file +// (POST /services/haproxy/runtime/ssl_certs) +func (_ Unimplemented) CreateCert(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a certificate +// (DELETE /services/haproxy/runtime/ssl_certs/{name}) +func (_ Unimplemented) DeleteCert(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one structured certificate +// (GET /services/haproxy/runtime/ssl_certs/{name}) +func (_ Unimplemented) GetCert(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace the contents of a certificate +// (PUT /services/haproxy/runtime/ssl_certs/{name}) +func (_ Unimplemented) ReplaceCert(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllCerts operation middleware +func (siw *ServerInterfaceWrapper) GetAllCerts(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllCerts(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCert operation middleware +func (siw *ServerInterfaceWrapper) CreateCert(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCert(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCert operation middleware +func (siw *ServerInterfaceWrapper) DeleteCert(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCert(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCert operation middleware +func (siw *ServerInterfaceWrapper) GetCert(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCert(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceCert operation middleware +func (siw *ServerInterfaceWrapper) ReplaceCert(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceCert(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_certs", wrapper.GetAllCerts) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/ssl_certs", wrapper.CreateCert) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/ssl_certs/{name}", wrapper.DeleteCert) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_certs/{name}", wrapper.GetCert) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/ssl_certs/{name}", wrapper.ReplaceCert) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3Fbfb9s2EP5XCDZPmxS5TVFg2lN+dF2BPgRxsZc4DRjqZLOjSI48ejEC/e8DSdmxZTuziyRN+2LIEnn8", + "7rvvPt4d5boxWoFCR8s7asEZrRzEP84AF7XgDIVW142uQLprrptGq+vFwvn7Y2mBVbP3t8KlUFwrBIXh", + "kRkjuzDFV6dVDM4n0LDwdGChpiV9VdxDKdJXV+wFAazVlrZtm9EKHLfChF20pJ8nQLpIUBELTnvLgbAE", + "mUDCnNEJsApsRH+qVS3G3saD87/AOpFwr0ZeWUZqIYFMu7XZUoo4M0BL6tAKNQ4I22w/dk9YdQH/eHD4", + "wqg9YYHQhOwlE3gGNfMS38c8XhaFH0CBZZIkbM9KYjv/vH+/w5zJLqq++Qo8aOA2H+u8e5nWHs4zW3zK", + "RWO0jewbhhNa0rHAib855LopJsxYfTtD4JOCSwEKc8VQTKGYvitSRBqRO3nNwWKCDDtiGTp5urTpiUFF", + "XgVC4/5XS71s2myeDbOWzXZJxj1yNiEfoWodmRUow8F/Hp+HneSMISPnkikgx+cfSU4uvELRABkOP5Ee", + "prkWSxqy0gYUM4KW9OhwcPiaZhFf5KdwYKeCg5sDLGyKumAnLhsDrvfABaC3ypElDmMnOLK0zpHa6oZ0", + "UQ9pRJPa5mMVWxGPZaQ04F65DN8MBo/nG32RbHCFoeccnKu9JAuMNK6KRrbtiAXm4tvtMerYNw2zswWx", + "hBEpHBJdxwqvsUwzimzsaHlJh8NPnRjoVZtRo92Gcp1aCJkTRhT8uzEk8U6oMcEJzOtFnOZ/A66XLQUL", + "ZYtVi7fRia5mvYI1XqIwzGJRa9vkFcNYKVBcV8ERyzsaDr72RmpWLW3+nJoO4RYLI5lQ9N45Y4PZgAdF", + "UkovRi/vXpY0owEMQ1rSG6EC5dmaUaekhIUq8Lsc/yrreV7q2p5yXz+Mg0f6qqCut0nlj6ispcklxv/t", + "keOvzp3fo0GS+h5Q8pbeCGbNdQVjUHkn2vxGV7NcsSZUdLnO4cQd3LG4C3vbVG4J6VJcLfxZfB8abxnm", + "7r2W9ne9ZphlDWCcVi77J/WpiGmFG4WW6UrKaJdp9+Ve5Gg9rDQYQwQbNn65/DIa2dFIjfxgcMTjL/zy", + "+8Gr8PTm3V07ole/Hmzooau1rni7Ts4fwXcSc8/SDs+u1VS91eJvt+4HL1qtgDi0nqO3UH2jmj4A/gxS", + "erLR4EeYDLYL4YGhwG9Q1hCw70uGzYL/7aGoCzCS8R/VoF7W6PL0k8lgiwd7U7Gf1YM7hUY1d1VyYa7e", + "xZT3mxnCsWCnc/V7K2lJi+kRba/a/wIAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/ssl_certs/ssl_certs.go b/handlers/runtime/ssl_certs/ssl_certs.go new file mode 100644 index 00000000..437b7a10 --- /dev/null +++ b/handlers/runtime/ssl_certs/ssl_certs.go @@ -0,0 +1,165 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_certs + +import ( + "io" + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all ssl_certs routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime SSL certificates. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllCerts(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.ShowCerts() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) CreateCert(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.NewCertEntry(header.Filename); err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCertEntry(header.Filename, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCertEntry(header.Filename); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} + +func (h *HandlerImpl) DeleteCert(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + if err = rt.DeleteCertEntry(name); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetCert(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + cert, err := rt.ShowCertificate(name) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, cert) +} + +func (h *HandlerImpl) ReplaceCert(w http.ResponseWriter, r *http.Request, name string) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, _, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCertEntry(name, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCertEntry(name); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, nil) +} diff --git a/handlers/runtime/ssl_crl_files/ssl_crl_files.gen.go b/handlers/runtime/ssl_crl_files/ssl_crl_files.gen.go new file mode 100644 index 00000000..63c7eef9 --- /dev/null +++ b/handlers/runtime/ssl_crl_files/ssl_crl_files.gen.go @@ -0,0 +1,486 @@ +// Package ssl_crl_files provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_crl_files + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SslCrlEntries defines model for ssl_crl_entries. +type SslCrlEntries = models.SslCrlEntries + +// SslCrls defines model for ssl_crls. +type SslCrls = models.SslCrls + +// CreateCrlMultipartBody defines parameters for CreateCrl. +type CreateCrlMultipartBody struct { + // FileUpload CRL file + FileUpload openapi_types.File `json:"file_upload"` +} + +// GetCrlParams defines parameters for GetCrl. +type GetCrlParams struct { + // Index Entry index to return. Starts at 1. If not provided, all entries are returned. + Index *int `form:"index,omitempty" json:"index,omitempty"` +} + +// ReplaceCrlMultipartBody defines parameters for ReplaceCrl. +type ReplaceCrlMultipartBody struct { + // FileUpload CRL file contents + FileUpload openapi_types.File `json:"file_upload"` +} + +// CreateCrlMultipartRequestBody defines body for CreateCrl for multipart/form-data ContentType. +type CreateCrlMultipartRequestBody CreateCrlMultipartBody + +// ReplaceCrlMultipartRequestBody defines body for ReplaceCrl for multipart/form-data ContentType. +type ReplaceCrlMultipartRequestBody ReplaceCrlMultipartBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all the CRL files + // (GET /services/haproxy/runtime/ssl_crl_files) + GetAllCrl(w http.ResponseWriter, r *http.Request) + // Create a new CRL file + // (POST /services/haproxy/runtime/ssl_crl_files) + CreateCrl(w http.ResponseWriter, r *http.Request) + // Delete a CRL file + // (DELETE /services/haproxy/runtime/ssl_crl_files/{name}) + DeleteCrl(w http.ResponseWriter, r *http.Request, name string) + // Get the contents of a CRL file + // (GET /services/haproxy/runtime/ssl_crl_files/{name}) + GetCrl(w http.ResponseWriter, r *http.Request, name string, params GetCrlParams) + // Replace the contents of a CRL file + // (PUT /services/haproxy/runtime/ssl_crl_files/{name}) + ReplaceCrl(w http.ResponseWriter, r *http.Request, name string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all the CRL files +// (GET /services/haproxy/runtime/ssl_crl_files) +func (_ Unimplemented) GetAllCrl(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Create a new CRL file +// (POST /services/haproxy/runtime/ssl_crl_files) +func (_ Unimplemented) CreateCrl(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a CRL file +// (DELETE /services/haproxy/runtime/ssl_crl_files/{name}) +func (_ Unimplemented) DeleteCrl(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Get the contents of a CRL file +// (GET /services/haproxy/runtime/ssl_crl_files/{name}) +func (_ Unimplemented) GetCrl(w http.ResponseWriter, r *http.Request, name string, params GetCrlParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace the contents of a CRL file +// (PUT /services/haproxy/runtime/ssl_crl_files/{name}) +func (_ Unimplemented) ReplaceCrl(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllCrl operation middleware +func (siw *ServerInterfaceWrapper) GetAllCrl(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllCrl(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateCrl operation middleware +func (siw *ServerInterfaceWrapper) CreateCrl(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateCrl(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCrl operation middleware +func (siw *ServerInterfaceWrapper) DeleteCrl(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCrl(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetCrl operation middleware +func (siw *ServerInterfaceWrapper) GetCrl(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetCrlParams + + // ------------- Optional query parameter "index" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "index", r.URL.Query(), ¶ms.Index, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "index"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "index", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetCrl(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceCrl operation middleware +func (siw *ServerInterfaceWrapper) ReplaceCrl(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceCrl(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_crl_files", wrapper.GetAllCrl) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/ssl_crl_files", wrapper.CreateCrl) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/ssl_crl_files/{name}", wrapper.DeleteCrl) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_crl_files/{name}", wrapper.GetCrl) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/runtime/ssl_crl_files/{name}", wrapper.ReplaceCrl) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3FhNb9s4EP0rBNvTrmQ5TVBgtad8NRsgWARxsZc4NRhqZLOlSJUcOTEM/fcFSUnxZxEX3jTZS6BI5OOb", + "mfeGk8wp10WpFSi0NJ1TA7bUyoL/xZbARS44Q6HVqNAZSDviuii0GnUL2/fH0gDLZuePwgYorhWCQvfI", + "ylI2MMlXq5UH5xMomHt6byCnKX2XPFFJwleb7EQBjNGG1nUd0QwsN6J0u2hKP0+ANEiQEQNWV4YDYYEy", + "gcA5ohNgGRjP/lSrXIwr4w+O/wFjReC9jLy0jORCApk2a6OFEHFWAk2pRSPU2DGso92ye8KyG/hegcVX", + "ltoT5hIamL3mBJ5BziqJ5z6O15XCC1BgmCSB22tO4t8aP+lKZW/D3g/MEqWR5J7yi+a1bj/v3kehVWiD", + "qu+/AnfeeozHOm5ehrW9VjHdp1gUpTa+KCXDCU3pWOCkuu9xXSQTVhr9OEPgk4RLAQpjxVBMIZl+TAIi", + "9cytHHEjR6DQiHATCITCrpOqo/YFM4bNNpMcWHlq5HkD9h+R3RPLffNzDIXKtSclULoD/zq+djvJGUNG", + "riVTQI6vL0lMbiqFogAyGFyR05sr8klIn7BWcil1oegSFCsFTelhr987oJEn58NOLJip4GBbdokJkElb", + "0txDpnM6BlyX+w1gZZQlTEqCEyAcDAbdAjEw1UHARAqL3gyWVFaosV/bnESs5t8Ae9QTDca5zHyTw2Pp", + "Ukyj5SHjQ7+/v3bSimFDkxhUnIO1eSVJx4z6Vf5i2AbdcU1+/rrxOq2KgplZl2XCFPFyJDrvEu6qnjdV", + "Rza2NL2lg8FVIwx6V0e01HZD5U4NMARLGFHw0MGQB4ETItCSJru7FCxAtgXzF/yJzmYrtSoqiaJkBpNc", + "myLOGPoigeI6c80wnVPHZFSVUrPFe+NzcB/CIyalZELRp6bpHWccHWz6zwrGSvBNuDSijgRDmtJ7oVy2", + "o7XeHIIRBjKX3EXcu2i1b9Rh+ZJYD7afT7hPWeZUdRRUvUdFLUyAHv+PPeMvz++/whhBcSsa3uIE16a5", + "zmAMKm7UGd/rbBYrVrgSLhbWnfLM1pjM3f461FgCwnq1z/x7Z7Wu7s83VdgcTFUywwpAP5HcbtWUj8dd", + "IjQNt1BEmxCbL09yRlPBkoUYIhi38cvtl+HQDIdqWPX7h9z/hN/+fP/OPX34OK+H9O739xvccrem/6P1", + "jLh7ioR0vYj2X1yYoWoLFd/enn94r2oFRBvf7ZvZigj1c0K6AHw7KopWeblhcEaEyuCRoCbG56dHBsgM", + "WsKQHPTIZe6H99Loqcggi5bSxgw0uyDrtYF9r8C3/CYyD780pxdCiaIqaHoQUVVJye7dQBYCbjgLhTCG", + "5ZnafhNlrD13JuNSuzWGpjmTFjZZZO/zTDeJ7zDWHAWn7tEg3R9/v8KCF4BhJG0HGTc1PcOPZbXRj6Vk", + "HOwPEHewYoP2xpr6Wxjoutq8yGTX33KzFTrz/1j4X15tjXh399ZuA5g7E8y0tUVlJE1pMj2k9V39bwAA", + "AP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/ssl_crl_files/ssl_crl_files.go b/handlers/runtime/ssl_crl_files/ssl_crl_files.go new file mode 100644 index 00000000..8cebc927 --- /dev/null +++ b/handlers/runtime/ssl_crl_files/ssl_crl_files.go @@ -0,0 +1,171 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_crl_files + +import ( + "io" + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all ssl_crl_files routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime SSL CRL files. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllCrl(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.ShowCrlFiles() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) CreateCrl(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.NewCrlFile(header.Filename); err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCrlFile(header.Filename, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCrlFile(header.Filename); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} + +func (h *HandlerImpl) DeleteCrl(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + if err = rt.DeleteCrlFile(name); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetCrl(w http.ResponseWriter, r *http.Request, name string, params GetCrlParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + var idx *int64 + if params.Index != nil { + idx = new(int64(*params.Index)) + } + + entries, err := rt.ShowCrlFile(name, idx) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, *entries) +} + +func (h *HandlerImpl) ReplaceCrl(w http.ResponseWriter, r *http.Request, name string) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, _, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + payload, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetCrlFile(name, string(payload)); err != nil { + respond.Error(w, err) + return + } + + if err = rt.CommitCrlFile(name); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, nil) +} diff --git a/handlers/runtime/ssl_crt_lists/ssl_crt_lists.gen.go b/handlers/runtime/ssl_crt_lists/ssl_crt_lists.gen.go new file mode 100644 index 00000000..a43ed6f0 --- /dev/null +++ b/handlers/runtime/ssl_crt_lists/ssl_crt_lists.gen.go @@ -0,0 +1,498 @@ +// Package ssl_crt_lists provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_crt_lists + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SslCrtList defines model for ssl_crt_list. +type SslCrtList = models.SslCrtList + +// SslCrtListEntries defines model for ssl_crt_list_entries. +type SslCrtListEntries = models.SslCrtListEntries + +// SslCrtListEntry defines model for ssl_crt_list_entry. +type SslCrtListEntry = models.SslCrtListEntry + +// SslCrtLists defines model for ssl_crt_lists. +type SslCrtLists = models.SslCrtLists + +// DeleteCrtListEntryParams defines parameters for DeleteCrtListEntry. +type DeleteCrtListEntryParams struct { + // Name SSL crt list name + Name string `form:"name" json:"name"` + + // CertFile SSL cert entry name + CertFile string `form:"cert_file" json:"cert_file"` + + // LineNumber The line number where the entry is located, in case several entries share the same certificate. + LineNumber *int `form:"line_number,omitempty" json:"line_number,omitempty"` +} + +// GetAllCrtListEntriesParams defines parameters for GetAllCrtListEntries. +type GetAllCrtListEntriesParams struct { + // Name SSL crt-list filename + Name string `form:"name" json:"name"` +} + +// AddCrtListEntryParams defines parameters for AddCrtListEntry. +type AddCrtListEntryParams struct { + // Name SSL crt-list filename + Name string `form:"name" json:"name"` +} + +// AddCrtListEntryJSONRequestBody defines body for AddCrtListEntry for application/json ContentType. +type AddCrtListEntryJSONRequestBody = SslCrtListEntry + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Get the list of all crt-list files + // (GET /services/haproxy/runtime/ssl_crt_lists) + GetAllCrtLists(w http.ResponseWriter, r *http.Request) + // Delete an entry from a crt-list + // (DELETE /services/haproxy/runtime/ssl_crt_lists/entries) + DeleteCrtListEntry(w http.ResponseWriter, r *http.Request, params DeleteCrtListEntryParams) + // Get all the entries inside a crt-list + // (GET /services/haproxy/runtime/ssl_crt_lists/entries) + GetAllCrtListEntries(w http.ResponseWriter, r *http.Request, params GetAllCrtListEntriesParams) + // Add an entry into a crt-list + // (POST /services/haproxy/runtime/ssl_crt_lists/entries) + AddCrtListEntry(w http.ResponseWriter, r *http.Request, params AddCrtListEntryParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Get the list of all crt-list files +// (GET /services/haproxy/runtime/ssl_crt_lists) +func (_ Unimplemented) GetAllCrtLists(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete an entry from a crt-list +// (DELETE /services/haproxy/runtime/ssl_crt_lists/entries) +func (_ Unimplemented) DeleteCrtListEntry(w http.ResponseWriter, r *http.Request, params DeleteCrtListEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Get all the entries inside a crt-list +// (GET /services/haproxy/runtime/ssl_crt_lists/entries) +func (_ Unimplemented) GetAllCrtListEntries(w http.ResponseWriter, r *http.Request, params GetAllCrtListEntriesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add an entry into a crt-list +// (POST /services/haproxy/runtime/ssl_crt_lists/entries) +func (_ Unimplemented) AddCrtListEntry(w http.ResponseWriter, r *http.Request, params AddCrtListEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllCrtLists operation middleware +func (siw *ServerInterfaceWrapper) GetAllCrtLists(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllCrtLists(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteCrtListEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteCrtListEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteCrtListEntryParams + + // ------------- Required query parameter "name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "name", r.URL.Query(), ¶ms.Name, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + } + return + } + + // ------------- Required query parameter "cert_file" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "cert_file", r.URL.Query(), ¶ms.CertFile, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "cert_file"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "cert_file", Err: err}) + } + return + } + + // ------------- Optional query parameter "line_number" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "line_number", r.URL.Query(), ¶ms.LineNumber, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "line_number"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "line_number", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteCrtListEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAllCrtListEntries operation middleware +func (siw *ServerInterfaceWrapper) GetAllCrtListEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllCrtListEntriesParams + + // ------------- Required query parameter "name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "name", r.URL.Query(), ¶ms.Name, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllCrtListEntries(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// AddCrtListEntry operation middleware +func (siw *ServerInterfaceWrapper) AddCrtListEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params AddCrtListEntryParams + + // ------------- Required query parameter "name" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "name", r.URL.Query(), ¶ms.Name, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "name"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.AddCrtListEntry(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_crt_lists", wrapper.GetAllCrtLists) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/runtime/ssl_crt_lists/entries", wrapper.DeleteCrtListEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/ssl_crt_lists/entries", wrapper.GetAllCrtListEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/ssl_crt_lists/entries", wrapper.AddCrtListEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "1FjbbuM2EP2VATdPrWUlm2CBqk/Ope0CQRHEQV/irEGTI4u7FKklKW+MQP9ekJR8iZPm0ly8L4EikcMz", + "h2fOTHJDmC4rrVA5S7IbYtBWWlkMv9gKmcgFo05oNS41R2nHTJelVuPFwu79QBqkfH5yLWwMxbRyqJx/", + "pFUl2zDpV6tVCM4KLKl/2jGYk4x8SJdQ0vjVpk+CgMZoQ5qm6RGOlhlR+V0kIxcFQhsJORi0ujYMgUbI", + "gBFzjxRIOZqA/kirXExrEw5O/kFjRcS9HnltGeRCIszatb2VFN28QpIR64xQU4+w6T2N3UPKz/F7jdZt", + "GbWH1BMakW0zgceY01q6k5DHdlH4Jyo0VELEts0k/q3dH7pW/Oco7x/UgtIO8gD5TXltus9P91HsFNpG", + "1ZOvyHxtXSdTnbQv49p+p5jFp0SUlTbhUirqCpKRqXBFPekzXaYFrYy+njtkRcqkQOUSRZ2YYTr7lMaI", + "JCC3csyMG0sR3eYRQIZWHhl3Kqx7VTRjVM6I2JyEw9I+qK/bm+ek6XUJUWPo/KF8TtoTXz2t+ZOpPgm7", + "XhPY84h+KsUvTa7PQqhcB0KFk/7QvwZnficcU0fhTFKFMDj7DAmc18qJEmE4PIWj8wvoAHV1nhGfjq5Q", + "0UqQjOz3d/t7pBfABVZSi2YmGNoOXWpiyHSDySm6TY85R1cbZYEqCGyBzoEZl/hd0XJW1lvIjS6hPaFP", + "ArJoT595aCVuIFd5XZvnPu7uvpxzryV3hykPa8bQ2ryWsMBIwqrQiO+LvwCcPr+9BxnXZUl9UXlOwBUI", + "gVCdA5VynWDPk6NTS7JLMhyetoogVz7MI283XTEmjhIdbl70cXhvgYIVaioRQtXHC/X4pmKGaoms9qvC", + "h/ZEsJp9Q7d56THwLVOoqKElutDvLm9D8WJnxkVKFC2R+IohGfleY9gd3mWk/eTnO2GQk8yZGlc7X0Wd", + "Q+N3frn8MhqZ0UiN6t3dfRZ+4i+/73zwTx8/3TQjcvXrDultNMveneDQuJaf/4DnV439Db45xougJ4Wg", + "6nKCBn4UaDBcVgQtLEjNqEPeA6GAUYtgcRbGvFYqYAva7rG0xJBylHuo67vy9SeO44lr80cplCjrkmR7", + "PaJqKenEe17koU1FKIdTXJ8V7DdRJTqkRGVSab/GkCyn0mLTXG2Yx8Gmpu8r8oPoNC9Y4Ct/AIX4By8c", + "fzHavodFxQr2LWDFE+jCC+7zp97jO0onusqgReVAKCs43uU7vp76cFGgMCAUx2tgVMEEobbIwWmI/ua3", + "lg80oOXs9Bg3Wh7/zo509UZtczHNbnv39B2z8zYvolY8jxFope0dCh1UFSpul4J3+v+1wAHnz+h/26W4", + "YG6Hms9fT2zzKLX1XJoNue9tk9H/9sLx1/9P+R4lNeB8qXyhnH64knzbZprjFFXSKiWZaD5PWpFy6mi8", + "Wz+vdqKvjSQZSWf7pLlq/g0AAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/ssl_crt_lists/ssl_crt_lists.go b/handlers/runtime/ssl_crt_lists/ssl_crt_lists.go new file mode 100644 index 00000000..dc75e665 --- /dev/null +++ b/handlers/runtime/ssl_crt_lists/ssl_crt_lists.go @@ -0,0 +1,111 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_crt_lists + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all ssl_crt_lists routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy runtime SSL CRT lists. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllCrtLists(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + files, err := rt.ShowCrtLists() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) DeleteCrtListEntry(w http.ResponseWriter, r *http.Request, params DeleteCrtListEntryParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + var lineNumber *int64 + if params.LineNumber != nil { + lineNumber = new(int64(*params.LineNumber)) + } + + if err = rt.DeleteCrtListEntry(params.Name, params.CertFile, lineNumber); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusNoContent) +} + +func (h *HandlerImpl) GetAllCrtListEntries(w http.ResponseWriter, r *http.Request, params GetAllCrtListEntriesParams) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + crtList, err := rt.ShowCrtListEntries(params.Name) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, crtList) +} + +func (h *HandlerImpl) AddCrtListEntry(w http.ResponseWriter, r *http.Request, params AddCrtListEntryParams) { + var data AddCrtListEntryJSONRequestBody + if !respond.DecodeBody(r, w, &data) { + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.AddCrtListEntry(params.Name, data); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusCreated) +} diff --git a/handlers/runtime/stick_table_entries/stick_table_entries.gen.go b/handlers/runtime/stick_table_entries/stick_table_entries.gen.go new file mode 100644 index 00000000..45497a41 --- /dev/null +++ b/handlers/runtime/stick_table_entries/stick_table_entries.gen.go @@ -0,0 +1,430 @@ +// Package stick_table_entries provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package stick_table_entries + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// StickTableEntries defines model for stick_table_entries. +type StickTableEntries = models.StickTableEntries + +// StickTableEntry defines model for stick_table_entry. +type StickTableEntry = models.StickTableEntry + +// GetStickTableEntriesParams defines parameters for GetStickTableEntries. +type GetStickTableEntriesParams struct { + // Filter A list of filters in format data. separated by comma + Filter string `form:"filter,omitempty" json:"filter,omitempty,omitzero"` + + // Key Key which we want the entries for + Key string `form:"key,omitempty" json:"key,omitempty,omitzero"` + + // Count Max number of entries to be returned for pagination + Count *int `form:"count,omitempty" json:"count,omitempty"` + + // Offset Offset which indicates how many items we skip in pagination + Offset int `form:"offset,omitempty" json:"offset,omitempty,omitzero"` +} + +// SetStickTableEntriesJSONBody defines parameters for SetStickTableEntries. +type SetStickTableEntriesJSONBody struct { + DataType StickTableEntry `json:"data_type"` + Key string `json:"key"` +} + +// SetStickTableEntriesJSONRequestBody defines body for SetStickTableEntries for application/json ContentType. +type SetStickTableEntriesJSONRequestBody SetStickTableEntriesJSONBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return Stick Table Entries + // (GET /services/haproxy/runtime/stick_tables/{parent_name}/entries) + GetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string, params GetStickTableEntriesParams) + // Set Entry to Stick Table + // (POST /services/haproxy/runtime/stick_tables/{parent_name}/entries) + SetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return Stick Table Entries +// (GET /services/haproxy/runtime/stick_tables/{parent_name}/entries) +func (_ Unimplemented) GetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string, params GetStickTableEntriesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Set Entry to Stick Table +// (POST /services/haproxy/runtime/stick_tables/{parent_name}/entries) +func (_ Unimplemented) SetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetStickTableEntries operation middleware +func (siw *ServerInterfaceWrapper) GetStickTableEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetStickTableEntriesParams + + // ------------- Optional query parameter "filter" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "filter", r.URL.Query(), ¶ms.Filter, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "filter"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter", Err: err}) + } + return + } + + // ------------- Optional query parameter "key" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "key", r.URL.Query(), ¶ms.Key, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "key"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "key", Err: err}) + } + return + } + + // ------------- Optional query parameter "count" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "count", r.URL.Query(), ¶ms.Count, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "count"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "count", Err: err}) + } + return + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "offset", r.URL.Query(), ¶ms.Offset, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "offset"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "offset", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStickTableEntries(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// SetStickTableEntries operation middleware +func (siw *ServerInterfaceWrapper) SetStickTableEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.SetStickTableEntries(w, r, parentName) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/stick_tables/{parent_name}/entries", wrapper.GetStickTableEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/runtime/stick_tables/{parent_name}/entries", wrapper.SetStickTableEntries) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3FZRb9s2EP4rByZPm2RlzdAH9Slri60YhgXNsJfYNWjpZLGRSJY8OREC/ffhSMmxE2dpigwY+mLIFHn3", + "3cfvvtOtKExrjUZNXuS3wqG3RnsMf7zFQlWqkKSMXramxMYvC9O2Ri+3G6f1d1jJrqH3zhnHhwujCTXx", + "o7S2GaNkn73RIXZRYyv56dhhJXJxlN0hyeJbnz0LAYbUwzAkokRfOGX5lMjFr6jRyQYitkTUKEt0ocS3", + "Rldq3bmQIP0bnVcR336EvW1QqQZhM+5Ndkqh3qLIhSen9JqRMJaxlmcTihOTY1Sz+owFiUTcpGuTjotx", + "72yqbPsqVa01LrBvJdUiF2tFdbeaFabNammduekJizorGoWaUi1JbTDbvM5iRBGQkyquliRXDS5Rk1NR", + "Foqw9U/e3L2zvRiSqRLpnOwPF3LBx/7iU+/HhP91Uf1XUryPrH9hXIxM6coEMIoaTvzb2TmfhHeSJJw3", + "UiOcnX+AFD52mlSLECBBwAR3dE3CzAVTbixqaZXIxensZPaTSALEcH2ZR7dRBfoJY+Zi4N3L89mtlQ41", + "LbVscch2dLBGetgpH5E6pz1IDeGawVQgmwbGc6A0SFirDWoIWSBmmYkANTbYhzI0LR0Sg5VOtkihfS/v", + "J7+4iwgMVzCpIo+3koiwxP+29YhEOPzSKYelyMl1uNvNVhKh4/OfLj/N524+1/Pu5OS0CL/4w5vjI356", + "9fp2mIvFj8cieWAAyX2EZ9AoT0xKpRquggmpjGslQSlJzmIGjhOzQFyI3Bi3t7iRTTdt88jMEJaw6oEt", + "RU7Ff+kwyHWsPuYVTxT65ugrC/ode7iuVVHDNcK11ARU4/a2q+BKh2BcYf9iGP6QN6C7doWOiZ1yk4EV", + "ggt6xJKhgJVrpYPEHkFVmE7TIUtXmnCN+xbrr5RNTQAhm9Qa3uNEXsnG4wGUf1aVRxrJUrrkMYAeanMN", + "rdQ9BFtlFjkuy+JJtCZE/De4w7BI9mf6q5OTl5vOB+bDgfF70RUFel91DWxbXIRd4YvhsSxb2Nm3f4cE", + "w+/aVrLNj970iG2SXLOliDvTEYshEdb4Ay731qEkBOOgsyU/yehmafSeMFf4CrkXwtJDf7v4HvxtEeOj", + "p19M2T9LWNYxHzTOEva+ZYz+Dd8VbCbP9JAdXi5HM7rDsEjufRHEAX2vkX5+qIv/jdQvkIK2e7bBHcE/", + "InS2tcKUuEadjhearkzZp6OkDrAe8qHbTErtXCNykW1OxbAY/gkAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/stick_table_entries/stick_table_entries.go b/handlers/runtime/stick_table_entries/stick_table_entries.go new file mode 100644 index 00000000..c46a1d74 --- /dev/null +++ b/handlers/runtime/stick_table_entries/stick_table_entries.go @@ -0,0 +1,121 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stick_table_entries + +import ( + "fmt" + "net/http" + "strings" + + "github.com/go-chi/chi/v5" + "github.com/go-openapi/strfmt" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" +) + +// RegisterRouter registers all stick_table_entries routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy stick table entries. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string, params GetStickTableEntriesParams) { + filter := make([]string, 0) + if params.Filter != "" { + filter = strings.Split(params.Filter, ",") + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + stkEntries, err := rt.GetTableEntries(parentName, filter, params.Key) + if err != nil { + respond.Error(w, err) + return + } + + // if no entries return empty array + if len(stkEntries) == 0 { + respond.JSON(w, http.StatusOK, stkEntries) + return + } + + // check for pagination + offset := params.Offset + if offset >= len(stkEntries) { + msg := fmt.Sprintf("Offset %d is larger than the slice size %d", offset, len(stkEntries)) + c := misc.ErrHTTPBadRequest + respond.JSON(w, int(c), &models.Error{ + Message: &msg, + Code: &c, + }) + return + } + + if params.Count != nil { + if offset+*params.Count >= len(stkEntries) { + stkEntries = stkEntries[offset:] + } else { + stkEntries = stkEntries[offset : offset+*params.Count] + } + } else { + stkEntries = stkEntries[offset:] + } + respond.JSON(w, http.StatusOK, stkEntries) +} + +func (h *HandlerImpl) SetStickTableEntries(w http.ResponseWriter, r *http.Request, parentName string) { + var data SetStickTableEntriesJSONRequestBody + if !respond.DecodeJSON(r, w, &data) { + return + } + if err := data.DataType.Validate(strfmt.Default); err != nil { + respond.Unprocessable(w, err) + return + } + + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + + if err = rt.SetTableEntry(parentName, data.Key, data.DataType); err != nil { + respond.Error(w, err) + return + } + + w.WriteHeader(http.StatusNoContent) +} diff --git a/handlers/runtime/stick_tables/stick_tables.gen.go b/handlers/runtime/stick_tables/stick_tables.gen.go new file mode 100644 index 00000000..5c88caa9 --- /dev/null +++ b/handlers/runtime/stick_tables/stick_tables.gen.go @@ -0,0 +1,333 @@ +// Package stick_tables provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package stick_tables + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// StickTable defines model for stick_table. +type StickTable = models.StickTable + +// StickTables defines model for stick_tables. +type StickTables = models.StickTables + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return Stick Tables + // (GET /services/haproxy/runtime/stick_tables) + GetStickTables(w http.ResponseWriter, r *http.Request) + // Return Stick Table + // (GET /services/haproxy/runtime/stick_tables/{name}) + GetStickTable(w http.ResponseWriter, r *http.Request, name string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return Stick Tables +// (GET /services/haproxy/runtime/stick_tables) +func (_ Unimplemented) GetStickTables(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return Stick Table +// (GET /services/haproxy/runtime/stick_tables/{name}) +func (_ Unimplemented) GetStickTable(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetStickTables operation middleware +func (siw *ServerInterfaceWrapper) GetStickTables(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStickTables(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetStickTable operation middleware +func (siw *ServerInterfaceWrapper) GetStickTable(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStickTable(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/stick_tables", wrapper.GetStickTables) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/runtime/stick_tables/{name}", wrapper.GetStickTable) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "zFVPTxs/EP0q1sDp99tkU0ActidU+odLhQD1QkJknNnEdNfejscpUbTfvbI3m26gKKSiiEvk2DPPb948", + "zy5B2bKyBg07yJZA6CprHMY/rkKlc60ka2vGpZ1g4cbKlqU143Vgu3+KufQFfySyFJKVNYyGw1JWVbFC", + "Se+cNRFbzbCUYbVPmEMGe+lvJmlz6tKdGGC8uq7rBCboFOkqZEEGn9EgyUI03BKYoZwgxRI/WJPrqad4", + "Qe8bktMNv02EjTCR6wLFfBWbdErhRYWQgWPSZhqY1MluIn61/Ml6M3ljAl7NUKyQcCIInfWkUPyUThjL", + "Io+UX1XXuj3e3ajYOnSFam/vUDEkcN+b2t5qs4ntt45ZH/V0WVmKTakkzyCDqeaZv+0rW6YzWZG9XzCq", + "WaoKjYZ7RrKeYzo/ThtEiMxZq+9jlrcFPpPHZci4ign/kEzUUjOWbqutOhXUSVuBJJKLbQW4F64g1KBN", + "bqOSmoOk8OXkPGSKU8lSnBfSoDg5PxM9ceEN6xJFpCPWfFrPZRCqsRUaWWnI4LA/6L+DJHKLmqQOaa4V", + "upZcSg1i+lDGKfJju18gezJOSCOiVsLmQhaFiMmiSe5DZNA8ibNJHF+8Kd/GkD4YDF5uWnSL+MMcuPRK", + "oXO5L8SaIsSoOPufgl/zTf/+ixKt6stS0mIt5MM2spw6yK6h81pGIe95XUuXRpZYb22eNdhtmMjJlmIF", + "uKV50UokS+Q4Jq8fXnHZgQ1kIFgbsuZtJBC3MlidEP7wmnACGZPH7risJDNSSLy5vhkOaTg0Qz8YHKr4", + "i/+9398Lq4PjZT2E0f/7kDyasKPXcdkuJjsaHL2wwdZf27dh4ScdHPKQ5q1nPBWQQTo/hHpU/woAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/runtime/stick_tables/stick_tables.go b/handlers/runtime/stick_tables/stick_tables.go new file mode 100644 index 00000000..f1f7100f --- /dev/null +++ b/handlers/runtime/stick_tables/stick_tables.go @@ -0,0 +1,123 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stick_tables + +import ( + "fmt" + "net/http" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" +) + +// RegisterRouter registers all stick_tables routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy stick tables. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetStickTables(w http.ResponseWriter, r *http.Request) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + stkTS, err := rt.ShowTables() + if err != nil { + respond.Error(w, err) + return + } + for _, table := range stkTS { + table.Fields = findTableFields(table.Name, h.Client) + } + respond.JSON(w, http.StatusOK, stkTS) +} + +func (h *HandlerImpl) GetStickTable(w http.ResponseWriter, r *http.Request, name string) { + rt, err := h.Client.Runtime() + if err != nil { + respond.Error(w, err) + return + } + stkT, err := rt.ShowTable(name) + if stkT == nil { + msg := fmt.Sprintf("Stick table %s not found", name) + c := misc.ErrHTTPNotFound + respond.JSON(w, int(c), &models.Error{ + Message: &msg, + Code: &c, + }) + return + } + stkT.Fields = findTableFields(stkT.Name, h.Client) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, stkT) +} + +func findTableFields(name string, client client_native.HAProxyClient) []*models.StickTableField { + configuration, err := client.Configuration() + if err != nil { + return nil + } + _, bck, err := configuration.GetBackend(name, "") + if err != nil { + return nil + } + if bck.StickTable == nil { + return nil + } + data := strings.Split(bck.StickTable.Store, ",") + fields := make([]*models.StickTableField, 0) + for _, d := range data { + f := &models.StickTableField{} + spl := strings.Split(d, "(") + if len(spl) == 1 { + f.Field = d + f.Type = "counter" + fields = append(fields, f) + } else if len(spl) == 2 { + p := misc.ParseTimeout(spl[1][:len(spl[1])-1]) + if p != nil { + f.Field = spl[0] + f.Period = *p + f.Type = "rate" + fields = append(fields, f) + } + } + } + return fields +} diff --git a/handlers/runtime_server.go b/handlers/runtime_server.go deleted file mode 100644 index 71370de1..00000000 --- a/handlers/runtime_server.go +++ /dev/null @@ -1,498 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "fmt" - "strings" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - native_errors "github.com/haproxytech/client-native/v6/errors" - "github.com/haproxytech/client-native/v6/models" - cn_runtime "github.com/haproxytech/client-native/v6/runtime" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/server" -) - -// GetRuntimeServerHandlerImpl implementation of the GetRuntimeServerHandler interface using client-native client -type GetRuntimeServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllRuntimeServerHandlerImpl implementation of the GetRuntimeServersHandler interface using client-native client -type GetAllRuntimeServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceRuntimeServerHandlerImpl implementation of the ReplaceRuntimeServerHandler interface using client-native client -type ReplaceRuntimeServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// AddRuntimeServerHandlerImpl implementation of the ServerAddRuntimeServerHandler interface using client-native client -type AddRuntimeServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// DeleteRuntimeServerHandlerImpl implementation of the ServerDeleteRuntimeServerHandler interface using client-native client -type DeleteRuntimeServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetRuntimeServerHandlerImpl) Handle(params server.GetRuntimeServerParams, principal any) middleware.Responder { - rn, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return server.NewGetRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - rs, err := rn.GetServerState(params.ParentName, params.Name) - if err != nil { - if isNotFoundError(err) { - code := int64(404) - msg := err.Error() - return server.NewGetRuntimeServerNotFound().WithPayload(&models.Error{Code: &code, Message: &msg}) - } - e := misc.HandleError(err) - return server.NewGetRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - if rs == nil { - code := int64(404) - msg := fmt.Sprintf("Runtime server %s not found in backend %s", params.Name, params.ParentName) - return server.NewGetRuntimeServerNotFound().WithPayload(&models.Error{Code: &code, Message: &msg}) - } - - return server.NewGetRuntimeServerOK().WithPayload(rs) -} - -// Handle executing the request and returning a response -func (h *GetAllRuntimeServerHandlerImpl) Handle(params server.GetAllRuntimeServerParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return server.NewGetAllRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - rs, err := runtime.GetServersState(params.ParentName) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return server.NewGetAllRuntimeServerOK().WithPayload(models.RuntimeServers{}) - } - return server.NewGetAllRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - return server.NewGetAllRuntimeServerOK().WithPayload(rs) -} - -// Handle executing the request and returning a response -func (h *ReplaceRuntimeServerHandlerImpl) Handle(params server.ReplaceRuntimeServerParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - rs, err := runtime.GetServerState(params.ParentName, params.Name) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - if rs == nil { - code := int64(404) - msg := fmt.Sprintf("Runtime server %s not found in backend %s", params.Name, params.ParentName) - return server.NewReplaceRuntimeServerNotFound().WithPayload(&models.Error{Code: &code, Message: &msg}) - } - - // change operational state - if params.Data.OperationalState != "" && rs.OperationalState != params.Data.OperationalState { - err = runtime.SetServerHealth(params.ParentName, params.Name, params.Data.OperationalState) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - } - - // change admin state - if params.Data.AdminState != "" && rs.AdminState != params.Data.AdminState { - err = runtime.SetServerState(params.ParentName, params.Name, params.Data.AdminState) - if err != nil { - e := misc.HandleError(err) - - // try to revert operational state and fall silently - //nolint:errcheck - runtime.SetServerHealth(params.ParentName, params.Name, rs.OperationalState) - return server.NewReplaceRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - } - - rs, err = runtime.GetServerState(params.ParentName, params.Name) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - return server.NewReplaceRuntimeServerOK().WithPayload(rs) -} - -// Adds a new server dynamically without modifying the configuration. -// Warning: this only works if you have not defined a `default_server` in the defaults -// or in the current `backend` section. -func (h *AddRuntimeServerHandlerImpl) Handle(params server.AddRuntimeServerParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return server.NewAddRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - if params.Data.Name == "" { - code := int64(400) - msg := "the new server must have a name" - return server.NewAddRuntimeServerBadRequest().WithPayload(&models.Error{Code: &code, Message: &msg}) - } - - haversion, err := runtime.GetVersion() - if err != nil { - e := misc.HandleError(err) - return server.NewAddRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.AddServer(params.ParentName, params.Data.Name, SerializeRuntimeAddServer(params.Data, &haversion)) - if err != nil { - msg := err.Error() - switch { - case strings.Contains(msg, "No such backend"): - code := int64(404) - return server.NewAddRuntimeServerNotFound().WithPayload(&models.Error{Code: &code, Message: &msg}) - case strings.Contains(msg, "Already exists"): - code := int64(409) - return server.NewAddRuntimeServerConflict().WithPayload(&models.Error{Code: &code, Message: &msg}) - default: - e := misc.HandleError(err) - return server.NewAddRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - } - - return server.NewAddRuntimeServerCreated().WithPayload(params.Data) -} - -func isNotFoundError(err error) bool { - msg := err.Error() - return strings.Contains(msg, "No such backend") || - strings.Contains(msg, native_errors.ErrNotFound.Error()) -} - -// Deletes a server from a backend immediately, without waiting for connections to drain. -func (h *DeleteRuntimeServerHandlerImpl) Handle(params server.DeleteRuntimeServerParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - // Check if this server exists. - rs, err := runtime.GetServerState(params.ParentName, params.Name) - if err != nil { - if isNotFoundError(err) { - code := int64(404) - msg := err.Error() - return server.NewDeleteRuntimeServerNotFound().WithPayload(&models.Error{Code: &code, Message: &msg}) - } - e := misc.HandleError(err) - return server.NewDeleteRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - // Put the server in maintenance state before deleting it. - if rs.AdminState != "maint" { - err = runtime.DisableServer(params.ParentName, params.Name) - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - } - - // TODO: wait for connections to drain. This is not yet possible with HAProxy 2.6. - - err = runtime.DeleteServer(params.ParentName, params.Name) - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteRuntimeServerDefault(int(*e.Code)).WithPayload(e) - } - - return server.NewDeleteRuntimeServerNoContent() -} - -// SerializeRuntimeAddServer returns a string in the HAProxy config format, suitable -// for the "add server" operation over the control socket. -// Not all the Server attributes are available in this case. -func SerializeRuntimeAddServer(srv *models.RuntimeAddServer, version *cn_runtime.HAProxyVersion) string { //nolint: cyclop,maintidx - b := &strings.Builder{} - - push := func(s string) { - b.WriteByte(' ') - b.WriteString(s) - } - pushi := func(key string, val *int64) { - fmt.Fprintf(b, " %s %d", key, *val) - } - // push a quoted string - pushq := func(key, val string) { - fmt.Fprintf(b, ` %s %s`, key, val) - } - enabled := func(s string) bool { - return s == "enabled" - } - disabled := func(s string) bool { - return s == "disabled" - } - - // Address is mandatory and must come first, with an optional port number. - addr := srv.Address - if srv.Port != nil { - addr += fmt.Sprintf(":%d", *srv.Port) - } - push(addr) - - if enabled(srv.AgentCheck) { - push("agent-check") - } - if srv.AgentAddr != "" { - pushq("agent-addr", srv.AgentAddr) - } - if srv.AgentPort != nil { - pushi("agent-port", srv.AgentPort) - } - if srv.AgentInter != nil { - pushi("agent-inter", srv.AgentInter) - } - if srv.AgentSend != "" { - pushq("agent-send", srv.AgentSend) - } - if srv.Allow0rtt { - push("allow-0rtt") - } - if srv.Alpn != "" { - pushq("alpn", srv.Alpn) - } - if enabled(srv.Backup) { - push("backup") - } - if srv.SslCafile != "" { - pushq("ca-file", srv.SslCafile) - } - if enabled(srv.Check) { - push("check") - } - if srv.CheckAlpn != "" { - pushq("check-alpn", srv.CheckAlpn) - } - if srv.HealthCheckAddress != "" { - pushq("addr", srv.HealthCheckAddress) - } - if srv.HealthCheckPort != nil { - pushi("port", srv.HealthCheckPort) - } - if srv.CheckProto != "" { - pushq("check-proto", srv.CheckProto) - } - if enabled(srv.CheckSendProxy) { - push("check-send-proxy") - } - if srv.CheckSni != "" { - pushq("check-sni", srv.CheckSni) - } - if enabled(srv.CheckSsl) { - push("check-ssl") - } - if enabled(srv.CheckViaSocks4) { - push("check-via-socks4") - } - if srv.Ciphers != "" { - pushq("ciphers", srv.Ciphers) - } - if srv.Ciphersuites != "" { - pushq("ciphersuites", srv.Ciphersuites) - } - if srv.CrlFile != "" { - pushq("crl-file", srv.CrlFile) - } - if srv.SslCertificate != "" { - pushq("crt", srv.SslCertificate) - } - if enabled(srv.Maintenance) { - push("disabled") - } - if srv.Downinter != nil { - pushi("downinter", srv.Downinter) - } - if disabled(srv.Maintenance) { - required := new(cn_runtime.HAProxyVersion) - required.ParseHAProxyVersion("3.0.0") - if !cn_runtime.IsBiggerOrEqual(required, version) { - push("enabled") - } - } - if srv.ErrorLimit != nil { - pushi("error-limit", srv.ErrorLimit) - } - if srv.Fall != nil { - pushi("fall", srv.Fall) - } - if srv.Fastinter != nil { - pushi("fastinter", srv.Fastinter) - } - if enabled(srv.ForceSslv3) { - push("force-sslv3") - } - if enabled(srv.ForceTlsv10) { - push("force-tlsv10") - } - if enabled(srv.ForceTlsv11) { - push("force-tlsv11") - } - if enabled(srv.ForceTlsv12) { - push("force-tlsv12") - } - if enabled(srv.ForceTlsv13) { - push("force-tlsv13") - } - if srv.ID != "" { - pushq("id", srv.ID) - } - if srv.Inter != nil { - pushi("inter", srv.Inter) - } - if srv.Maxconn != nil { - pushi("maxconn", srv.Maxconn) - } - if srv.Maxqueue != nil { - pushi("maxqueue", srv.Maxqueue) - } - if srv.Minconn != nil { - pushi("minconn", srv.Minconn) - } - if disabled(srv.SslReuse) { - push("no-ssl-reuse") - } - if enabled(srv.NoSslv3) { - push("no-sslv3") - } - if enabled(srv.NoTlsv10) { - push("no-tlsv10") - } - if enabled(srv.NoTlsv11) { - push("no-tlsv11") - } - if enabled(srv.NoTlsv12) { - push("no-tlsv12") - } - if enabled(srv.NoTlsv13) { - push("no-tlsv13") - } - if disabled(srv.TLSTickets) { - push("no-tls-tickets") - } - if srv.Npn != "" { - pushq("npm", srv.Npn) - } - if srv.Observe != "" { - pushq("observe", srv.Observe) - } - if srv.OnError != "" { - pushq("on-error", srv.OnError) - } - if srv.OnMarkedDown != "" { - pushq("on-marked-down", srv.OnMarkedDown) - } - if srv.OnMarkedUp != "" { - pushq("on-marked-up", srv.OnMarkedUp) - } - if srv.PoolLowConn != nil { - pushi("pool-low-conn", srv.PoolLowConn) - } - if srv.PoolMaxConn != nil { - pushi("pool-max-conn", srv.PoolMaxConn) - } - if srv.PoolPurgeDelay != nil { - pushi("pool-purge-delay", srv.PoolPurgeDelay) - } - if srv.Proto != "" { - pushq("proto", srv.Proto) - } - if len(srv.ProxyV2Options) > 0 { - pushq("proxy-v2-options", strings.Join(srv.ProxyV2Options, ",")) - } - if srv.Rise != nil { - pushi("rise", srv.Rise) - } - if enabled(srv.SendProxy) { - push("send-proxy") - } - if enabled(srv.SendProxyV2) { - push("send-proxy-v2") - } - if enabled(srv.SendProxyV2Ssl) { - push("send-proxy-v2-ssl") - } - if enabled(srv.SendProxyV2SslCn) { - push("send-proxy-v2-ssl-cn") - } - if srv.Slowstart != nil { - pushi("slowstart", srv.Slowstart) - } - if srv.Sni != "" { - pushq("sni", srv.Sni) - } - if srv.Source != "" { - pushq("source", srv.Source) - } - if enabled(srv.Ssl) { - push("ssl") - } - if srv.SslMaxVer != "" { - pushq("ssl-max-ver", srv.SslMaxVer) - } - if srv.SslMinVer != "" { - pushq("ssl-min-ver", srv.SslMinVer) - } - if enabled(srv.Tfo) { - push("tfo") - } - if enabled(srv.TLSTickets) { - push("tls-tickets") - } - if srv.Track != "" { - pushq("track", srv.Track) - } - if srv.Verify != "" { - pushq("verify", srv.Verify) - } - if srv.Verifyhost != "" { - pushq("verifyhost", srv.Verifyhost) - } - if srv.Weight != nil { - pushi("weight", srv.Weight) - } - if srv.Ws != "" { - pushq("ws", srv.Ws) - } - return b.String() -} diff --git a/handlers/runtime_server_test.go b/handlers/runtime_server_test.go deleted file mode 100644 index 8b39597f..00000000 --- a/handlers/runtime_server_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package handlers - -import ( - "testing" - - "github.com/haproxytech/client-native/v6/models" - cn_runtime "github.com/haproxytech/client-native/v6/runtime" - "github.com/haproxytech/dataplaneapi/misc" -) - -func TestSerializeRuntimeAddServer(t *testing.T) { - tests := []struct { - name string - srv *models.RuntimeAddServer - version *cn_runtime.HAProxyVersion - want string - }{ - { - name: "basic server", - srv: &models.RuntimeAddServer{ - Address: "127.0.0.1", - Port: misc.Int64P(8080), - }, - version: &cn_runtime.HAProxyVersion{}, - want: " 127.0.0.1:8080", - }, - { - name: "server with weight", - srv: &models.RuntimeAddServer{ - Address: "192.168.1.100", - Port: misc.Int64P(9000), - Weight: misc.Int64P(50), - }, - version: &cn_runtime.HAProxyVersion{}, - want: " 192.168.1.100:9000 weight 50", - }, - { - name: "server with maintenance", - srv: &models.RuntimeAddServer{ - Address: "10.0.0.10", - Maintenance: "enabled", - }, - version: &cn_runtime.HAProxyVersion{}, - want: " 10.0.0.10 disabled", - }, - { - name: "server with maintenance disabled", - srv: &models.RuntimeAddServer{ - Address: "10.0.0.10", - Maintenance: "disabled", - }, - version: &cn_runtime.HAProxyVersion{}, - want: " 10.0.0.10 enabled", - }, - { - name: "server with maintenance disabled, HAProxy 3.0", - srv: &models.RuntimeAddServer{ - Address: "10.0.0.10", - Maintenance: "disabled", - }, - version: func() *cn_runtime.HAProxyVersion { - v := new(cn_runtime.HAProxyVersion) - v.ParseHAProxyVersion("3.0.0") - return v - }(), - want: " 10.0.0.10", - }, - { - name: "server with agent check", - srv: &models.RuntimeAddServer{ - Address: "172.16.0.5", - AgentCheck: "enabled", - }, - version: &cn_runtime.HAProxyVersion{}, - want: " 172.16.0.5 agent-check", - }, - { - name: "server with agent addr", - srv: &models.RuntimeAddServer{ - Address: "172.16.0.6", - AgentAddr: "127.0.0.1", - }, - version: &cn_runtime.HAProxyVersion{}, - want: ` 172.16.0.6 agent-addr 127.0.0.1`, - }, - { - name: "server with multiple options", - srv: &models.RuntimeAddServer{ - Address: "10.1.1.10", - Port: misc.Int64P(80), - Weight: misc.Int64P(10), - Check: "enabled", - Backup: "enabled", - Maintenance: "enabled", - AgentCheck: "enabled", - AgentAddr: "127.0.0.1", - AgentPort: misc.Int64P(5000), - HealthCheckAddress: "127.0.0.2", - }, - version: &cn_runtime.HAProxyVersion{}, - want: ` 10.1.1.10:80 agent-check agent-addr 127.0.0.1 agent-port 5000 backup check addr 127.0.0.2 disabled weight 10`, - }, - { - name: "server with all fields", - srv: &models.RuntimeAddServer{ - Address: "10.1.1.10", - Port: misc.Int64P(80), - Weight: misc.Int64P(10), - Check: "enabled", - Backup: "enabled", - Maintenance: "enabled", - AgentCheck: "enabled", - AgentAddr: "127.0.0.1", - AgentPort: misc.Int64P(5000), - AgentInter: misc.Int64P(1000), - AgentSend: "foobar", - Allow0rtt: true, - Alpn: "h2,http/1.1", - CheckAlpn: "h2", - CheckProto: "HTTP", - CheckSendProxy: "enabled", - CheckSni: "example.com", - CheckSsl: "enabled", - CheckViaSocks4: "enabled", - Ciphers: "HIGH:!aNULL:!MD5", - Ciphersuites: "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256", - CrlFile: "/path/to/crl.pem", - SslCertificate: "/path/to/cert.pem", - Downinter: misc.Int64P(2000), - ErrorLimit: misc.Int64P(10), - Fall: misc.Int64P(2), - Fastinter: misc.Int64P(500), - ForceSslv3: "enabled", - ForceTlsv10: "enabled", - ForceTlsv11: "enabled", - ForceTlsv12: "enabled", - ForceTlsv13: "enabled", - HealthCheckAddress: "127.0.0.2", - HealthCheckPort: misc.Int64P(8080), - Inter: misc.Int64P(3000), - Maxconn: misc.Int64P(100), - Maxqueue: misc.Int64P(200), - Minconn: misc.Int64P(50), - Rise: misc.Int64P(1), - }, - version: &cn_runtime.HAProxyVersion{}, - want: ` 10.1.1.10:80 agent-check agent-addr 127.0.0.1 agent-port 5000 agent-inter 1000 agent-send foobar allow-0rtt alpn h2,http/1.1 backup check check-alpn h2 addr 127.0.0.2 port 8080 check-proto HTTP check-send-proxy check-sni example.com check-ssl check-via-socks4 ciphers HIGH:!aNULL:!MD5 ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 crl-file /path/to/crl.pem crt /path/to/cert.pem disabled downinter 2000 error-limit 10 fall 2 fastinter 500 force-sslv3 force-tlsv10 force-tlsv11 force-tlsv12 force-tlsv13 inter 3000 maxconn 100 maxqueue 200 minconn 50 rise 1 weight 10`, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.version == nil { - tt.version = &cn_runtime.HAProxyVersion{} - } - if got := SerializeRuntimeAddServer(tt.srv, tt.version); got != tt.want { - t.Errorf("SerializeRuntimeAddServer() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/handlers/server.go b/handlers/server.go deleted file mode 100644 index 1377daf3..00000000 --- a/handlers/server.go +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "errors" - - "github.com/haproxytech/client-native/v6/runtime" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/server" -) - -// CreateServerHandlerImpl implementation of the CreateServerHandler interface using client-native client -type CreateServerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteServerHandlerImpl implementation of the DeleteServerHandler interface using client-native client -type DeleteServerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetServerHandlerImpl implementation of the GetServerHandler interface using client-native client -type GetServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllServerHandlerImpl implementation of the GetServersHandler interface using client-native client -type GetAllServerHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceServerHandlerImpl implementation of the ReplaceServerHandler interface using client-native client -type ReplaceServerHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func serverTypeParams(backend *string, parentType *string, parentName *string) (pType string, pName string, err error) { - if backend != nil && *backend != "" { - return "backend", *backend, nil - } - if parentType == nil || *parentType == "" { - return "", "", errors.New("parentType empty") - } - if parentName == nil || *parentName == "" { - return "", "", errors.New("parentName empty") - } - return *parentType, *parentName, nil -} - -// Handle executing the request and returning a response -func (h *CreateServerHandlerImpl) Handle(parentType cnconstants.CnParentType, params server.CreateServerBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := serverTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateServer(pType, pName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - // Try to create the new server dynamically. This is only possible if parentType is `backend` and no `default_server` - // was defined in the current backend or in the `defaults` section. - useRuntime := false - ras := &models.RuntimeAddServer{} - var runtimeClient runtime.Runtime - if pType == "backend" { - _, defaults, errRuntime := configuration.GetDefaultsConfiguration(t) - if errRuntime != nil { - e := misc.HandleError(errRuntime) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - _, backend, errRuntime := configuration.GetBackend(pName, t) - if errRuntime != nil { - e := misc.HandleError(errRuntime) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - runtimeClient, errRuntime = h.Client.Runtime() - if errRuntime == nil && defaults.DefaultServer == nil && backend.DefaultServer == nil { - // Also make sure the server attributes are supported by the runtime API. - errRuntime = misc.ConvertStruct(params.Data, ras) - useRuntime = errRuntime == nil - } - } - - if params.TransactionID == nil { - if *params.ForceReload { - err = h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server.NewCreateServerBackendDefault(int(*e.Code)).WithPayload(e) - } - return server.NewCreateServerBackendCreated().WithPayload(params.Data) - } - if useRuntime { - haversion, _ := runtimeClient.GetVersion() - err = runtimeClient.AddServer(pName, params.Data.Name, SerializeRuntimeAddServer(ras, &haversion)) - if err == nil { - // No need to reload. - log.Debugf("backend %s: server %s added though runtime", pName, params.Data.Name) - return server.NewCreateServerBackendCreated().WithPayload(params.Data) - } - log.Warning("failed to add server through runtime:", err) - } - rID := h.ReloadAgent.Reload() - return server.NewCreateServerBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server.NewCreateServerBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteServerHandlerImpl) Handle(parentType cnconstants.CnParentType, params server.DeleteServerBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server.NewDeleteServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := serverTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteServer(params.Name, pType, pName, t, v) - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server.NewDeleteServerBackendDefault(int(*e.Code)).WithPayload(e) - } - return server.NewDeleteServerBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return server.NewDeleteServerBackendAccepted().WithReloadID(rID) - } - return server.NewDeleteServerBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetServerHandlerImpl) Handle(parentType cnconstants.CnParentType, params server.GetServerBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server.NewGetServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := serverTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return server.NewGetServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, srv, err := configuration.GetServer(params.Name, pType, pName, t) - if err != nil { - e := misc.HandleError(err) - return server.NewGetServerBackendDefault(int(*e.Code)).WithPayload(e) - } - return server.NewGetServerBackendOK().WithPayload(srv) -} - -// Handle executing the request and returning a response -func (h *GetAllServerHandlerImpl) Handle(parentType cnconstants.CnParentType, params server.GetAllServerBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server.NewGetAllServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := serverTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return server.NewGetAllServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, srvs, err := configuration.GetServers(pType, pName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return server.NewGetAllServerBackendOK().WithPayload(models.Servers{}) - } - return server.NewGetAllServerBackendDefault(int(*e.Code)).WithPayload(e) - } - return server.NewGetAllServerBackendOK().WithPayload(srvs) -} - -// Handle executing the request and returning a response -func (h *ReplaceServerHandlerImpl) Handle(parentType cnconstants.CnParentType, params server.ReplaceServerBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - pType, pName, err := serverTypeParams(nil, misc.StringP(string(parentType)), ¶ms.ParentName) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, ondisk, err := configuration.GetServer(params.Name, pType, pName, t) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditServer(params.Name, pType, pName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - reload := changeThroughRuntimeAPI(*params.Data, *ondisk, pName, h.Client) - if reload { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server.NewReplaceServerBackendDefault(int(*e.Code)).WithPayload(e) - } - return server.NewReplaceServerBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server.NewReplaceServerBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server.NewReplaceServerBackendOK().WithPayload(params.Data) - } - return server.NewReplaceServerBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/server_switching_rule.go b/handlers/server_switching_rule.go deleted file mode 100644 index 036ae378..00000000 --- a/handlers/server_switching_rule.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/server_switching_rule" -) - -// CreateServerSwitchingRuleHandlerImpl implementation of the CreateServerSwitchingRuleHandler interface using client-native client -type CreateServerSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteServerSwitchingRuleHandlerImpl implementation of the DeleteServerSwitchingRuleHandler interface using client-native client -type DeleteServerSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetServerSwitchingRuleHandlerImpl implementation of the GetServerSwitchingRuleHandler interface using client-native client -type GetServerSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetServerSwitchingRulesHandlerImpl implementation of the GetServerSwitchingRulesHandler interface using client-native client -type GetServerSwitchingRulesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceServerSwitchingRuleHandlerImpl implementation of the ReplaceServerSwitchingRuleHandler interface using client-native client -type ReplaceServerSwitchingRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -type ReplaceServerSwitchingRulesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateServerSwitchingRuleHandlerImpl) Handle(params server_switching_rule.CreateServerSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_switching_rule.NewCreateServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewCreateServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateServerSwitchingRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewCreateServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewCreateServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewCreateServerSwitchingRuleCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server_switching_rule.NewCreateServerSwitchingRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server_switching_rule.NewCreateServerSwitchingRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteServerSwitchingRuleHandlerImpl) Handle(params server_switching_rule.DeleteServerSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_switching_rule.NewDeleteServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewDeleteServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteServerSwitchingRule(params.Index, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewDeleteServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewDeleteServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewDeleteServerSwitchingRuleNoContent() - } - rID := h.ReloadAgent.Reload() - return server_switching_rule.NewDeleteServerSwitchingRuleAccepted().WithReloadID(rID) - } - return server_switching_rule.NewDeleteServerSwitchingRuleAccepted() -} - -// Handle executing the request and returning a response -func (h *GetServerSwitchingRuleHandlerImpl) Handle(params server_switching_rule.GetServerSwitchingRuleParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewGetServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetServerSwitchingRule(params.Index, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewGetServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewGetServerSwitchingRuleOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetServerSwitchingRulesHandlerImpl) Handle(params server_switching_rule.GetServerSwitchingRulesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewGetServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetServerSwitchingRules(params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return server_switching_rule.NewGetServerSwitchingRulesOK().WithPayload(models.ServerSwitchingRules{}) - } - return server_switching_rule.NewGetServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewGetServerSwitchingRulesOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceServerSwitchingRuleHandlerImpl) Handle(params server_switching_rule.ReplaceServerSwitchingRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_switching_rule.NewReplaceServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditServerSwitchingRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRuleDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewReplaceServerSwitchingRuleOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server_switching_rule.NewReplaceServerSwitchingRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server_switching_rule.NewReplaceServerSwitchingRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceServerSwitchingRulesHandlerImpl) Handle(params server_switching_rule.ReplaceServerSwitchingRulesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_switching_rule.NewReplaceServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceServerSwitchingRules(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_switching_rule.NewReplaceServerSwitchingRulesDefault(int(*e.Code)).WithPayload(e) - } - return server_switching_rule.NewReplaceServerSwitchingRulesOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server_switching_rule.NewReplaceServerSwitchingRulesAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server_switching_rule.NewReplaceServerSwitchingRulesAccepted().WithPayload(params.Data) -} diff --git a/handlers/server_template.go b/handlers/server_template.go deleted file mode 100644 index 84f9ec3c..00000000 --- a/handlers/server_template.go +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/server_template" -) - -// CreateServerTemplateHandlerImpl implementation of the CreateServerTemplateHandler interface using client-native client -type CreateServerTemplateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteServerTemplateHandlerImpl implementation of the DeleteServerTemplateHandler interface using client-native client -type DeleteServerTemplateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetServerTemplateHandlerImpl implementation of the GetServerTemplateHandler interface using client-native client -type GetServerTemplateHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetServerTemplatesHandlerImpl implementation of the GetServerTemplatesHandler interface using client-native client -type GetServerTemplatesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceServerTemplateHandlerImpl implementation of the ReplaceServerTemplateHandler interface using client-native client -type ReplaceServerTemplateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateServerTemplateHandlerImpl) Handle(params server_template.CreateServerTemplateParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_template.NewCreateServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_template.NewCreateServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateServerTemplate(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server_template.NewCreateServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_template.NewCreateServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - return server_template.NewCreateServerTemplateCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server_template.NewCreateServerTemplateAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server_template.NewCreateServerTemplateAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteServerTemplateHandlerImpl) Handle(params server_template.DeleteServerTemplateParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_template.NewDeleteServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_template.NewDeleteServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteServerTemplate(params.Prefix, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return server_template.NewDeleteServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_template.NewDeleteServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - return server_template.NewDeleteServerTemplateNoContent() - } - rID := h.ReloadAgent.Reload() - return server_template.NewDeleteServerTemplateAccepted().WithReloadID(rID) - } - return server_template.NewDeleteServerTemplateAccepted() -} - -// Handle executing the request and returning a response -func (h *GetServerTemplateHandlerImpl) Handle(params server_template.GetServerTemplateParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_template.NewGetServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - _, template, err := configuration.GetServerTemplate(params.Prefix, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return server_template.NewGetServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - return server_template.NewGetServerTemplateOK().WithPayload(template) -} - -// Handle executing the request and returning a response -func (h *GetServerTemplatesHandlerImpl) Handle(params server_template.GetServerTemplatesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_template.NewGetServerTemplatesDefault(int(*e.Code)).WithPayload(e) - } - - _, templates, err := configuration.GetServerTemplates(params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return server_template.NewGetServerTemplatesOK().WithPayload(models.ServerTemplates{}) - } - return server_template.NewGetServerTemplatesDefault(int(*e.Code)).WithPayload(e) - } - return server_template.NewGetServerTemplatesOK().WithPayload(templates) -} - -// Handle executing the request and returning a response -func (h *ReplaceServerTemplateHandlerImpl) Handle(params server_template.ReplaceServerTemplateParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return server_template.NewReplaceServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return server_template.NewReplaceServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - _, ondisk, err := configuration.GetServerTemplate(params.Prefix, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return server_template.NewReplaceServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditServerTemplate(params.Prefix, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return server_template.NewReplaceServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - reload := changeThroughRuntimeAPI(*params.Data, *ondisk, params.ParentName, h.Client) - if reload { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return server_template.NewReplaceServerTemplateDefault(int(*e.Code)).WithPayload(e) - } - return server_template.NewReplaceServerTemplateOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return server_template.NewReplaceServerTemplateAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return server_template.NewReplaceServerTemplateOK().WithPayload(params.Data) - } - return server_template.NewReplaceServerTemplateAccepted().WithPayload(params.Data) -} diff --git a/handlers/service_discovery/aws/aws.gen.go b/handlers/service_discovery/aws/aws.gen.go new file mode 100644 index 00000000..d2e13d59 --- /dev/null +++ b/handlers/service_discovery/aws/aws.gen.go @@ -0,0 +1,446 @@ +// Package aws provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package aws + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// AwsRegion defines model for awsRegion. +type AwsRegion = models.AwsRegion + +// AwsRegions defines model for awsRegions. +type AwsRegions = models.AwsRegions + +// CreateAWSRegionJSONRequestBody defines body for CreateAWSRegion for application/json ContentType. +type CreateAWSRegionJSONRequestBody = AwsRegion + +// ReplaceAWSRegionJSONRequestBody defines body for ReplaceAWSRegion for application/json ContentType. +type ReplaceAWSRegionJSONRequestBody = AwsRegion + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all configured AWS regions + // (GET /service_discovery/aws) + GetAWSRegions(w http.ResponseWriter, r *http.Request) + // Add a new AWS region + // (POST /service_discovery/aws) + CreateAWSRegion(w http.ResponseWriter, r *http.Request) + // Delete an AWS region + // (DELETE /service_discovery/aws/{id}) + DeleteAWSRegion(w http.ResponseWriter, r *http.Request, id string) + // Return an AWS region + // (GET /service_discovery/aws/{id}) + GetAWSRegion(w http.ResponseWriter, r *http.Request, id string) + // Replace an AWS region + // (PUT /service_discovery/aws/{id}) + ReplaceAWSRegion(w http.ResponseWriter, r *http.Request, id string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all configured AWS regions +// (GET /service_discovery/aws) +func (_ Unimplemented) GetAWSRegions(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new AWS region +// (POST /service_discovery/aws) +func (_ Unimplemented) CreateAWSRegion(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete an AWS region +// (DELETE /service_discovery/aws/{id}) +func (_ Unimplemented) DeleteAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return an AWS region +// (GET /service_discovery/aws/{id}) +func (_ Unimplemented) GetAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace an AWS region +// (PUT /service_discovery/aws/{id}) +func (_ Unimplemented) ReplaceAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAWSRegions operation middleware +func (siw *ServerInterfaceWrapper) GetAWSRegions(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAWSRegions(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateAWSRegion operation middleware +func (siw *ServerInterfaceWrapper) CreateAWSRegion(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateAWSRegion(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteAWSRegion operation middleware +func (siw *ServerInterfaceWrapper) DeleteAWSRegion(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteAWSRegion(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetAWSRegion operation middleware +func (siw *ServerInterfaceWrapper) GetAWSRegion(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAWSRegion(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceAWSRegion operation middleware +func (siw *ServerInterfaceWrapper) ReplaceAWSRegion(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceAWSRegion(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/service_discovery/aws", wrapper.GetAWSRegions) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/service_discovery/aws", wrapper.CreateAWSRegion) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/service_discovery/aws/{id}", wrapper.DeleteAWSRegion) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/service_discovery/aws/{id}", wrapper.GetAWSRegion) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/service_discovery/aws/{id}", wrapper.ReplaceAWSRegion) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3JZRTyM3EMe/ijWt1JdNlrtDlbpvgdCWh1YoqcrDFaHBniQ+7dqu7Q1EaL97ZXuzCZc9IKcc0HtL1vbM", + "3zO/mfE9cF0ZrUh5B8U9WHJGK0fxjzPE5Uxy9FKr60oLKt0111Wl1XW3cf19VFpCsTq7ky6Z4lp5Uj78", + "RGPK1kz+yWkVjfMFVRh+/WhpBgX8kG+k5GnV5XtJIGu1haZpMhDkuJUmnIIC/loQay2RYJacri0nhkky", + "o6Q5gwWhIBvVn2o1k/PaRseDv8k6mXQ/tPxgG5vJktiy3ZttXdGvDEEBzlup5kFhk+0X3RMUE/q3Juff", + "WGhPMAQ0KXvLARzTDOvSn8V7vK0Q/kaKLJYsaXvLQfxT+191rcT/o7xv0TGlPZtFyS8a12a9HL3hrZvQ", + "vPXQbtY3n4iHkrkbzPWg/ZguOhx1+7eWB7Iy2sZ4G/QLKGAu/aK+GXJd5Qs0Vt+tPPFFzktJyg8Uermk", + "fPlznqxCENUpibqkp8o9laKN+CZbi0drcfWEdndw8V8By/PivS68Q8oNgqWa6ShB+jK4+310EU6yMXpk", + "FyUqYqOLczZgU7JLyYmNpeN6SXbFRpdTyGANWwEh+NqQQiOhgA/Do+E7yKK4mMDcJQvXYm0h5C2szMnv", + "cj0hX1vFsCwZbxEnEXwym3I3hOgugX8uYpPyo8vpJrUPHgrvj44O1hK2EO0p9WnNOTk3q0vW6YO4K7b3", + "Lxnv1OZfPzQignVVoV1thVCxWAxMzx4JJ2Tgce6g+AhtqrtMw1WTgdGuJ0sjIRgyRbdbpob/qFNLgpSX", + "WDqGlmKLCxNYBqdSMY6OImKmI0w6ZmulpJqHDajY2el7JpXzqEKflH7BjA3xZOejP5jVJTH0HvmCxC4J", + "p5bQUwdDZCHO/xMtVofHIFGwviAU3tbU7PD37ls5/rxw2tnCYxBEQO84wX9A7LYee9H+Lwe2//Cp/hrV", + "04f2o0USmjPXguakBi1ugxstVgOFVWitAj1GH/2dML+XokkVVpKn3Vobx++hNDaCumJO4/9mxaT/yTHZ", + "UxPp+HZNGLRYkY/vjY87lb3xcT6GMCigSJMmg/ZCUsDn1D/25LjaqYjjvrbf0pui0NJ7fOC0d4/E1wCr", + "L49Pdd/HRqQOHfRyyib7ErE9L/fAIab9W+Bw9DIN8kvz+TvDbDP9n4+ZqXsxMyXyZzSefsra43uRNjl8", + "43n18X/0wuO/NuLlxv93Vjk9wB9i9AcvZJdr7mtbQgH58gM0V81/AQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/service_discovery/aws/aws.go b/handlers/service_discovery/aws/aws.go new file mode 100644 index 00000000..c94ea3d5 --- /dev/null +++ b/handlers/service_discovery/aws/aws.go @@ -0,0 +1,171 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aws + +import ( + "errors" + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + + sc "github.com/haproxytech/dataplaneapi/discovery" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all AWS service discovery routes onto r. +func RegisterRouter(r chi.Router, discovery sc.ServiceDiscoveries, persistCallback func([]*models.AwsRegion) error, useValidation bool) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{ + Discovery: discovery, + PersistCallback: persistCallback, + UseValidation: useValidation, + }, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for AWS service discovery. +type HandlerImpl struct { + Discovery sc.ServiceDiscoveries + PersistCallback func([]*models.AwsRegion) error + UseValidation bool +} + +func (h *HandlerImpl) GetAWSRegions(w http.ResponseWriter, r *http.Request) { + regions, err := getAWSRegions(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, regions) +} + +func (h *HandlerImpl) CreateAWSRegion(w http.ResponseWriter, r *http.Request) { + var data AwsRegion + if !respond.DecodeBody(r, w, &data) { + return + } + + data.ID = sc.NewServiceDiscoveryUUID() + + if err := sc.ValidateAWSData(&data, h.UseValidation); err != nil { + respond.Error(w, err) + return + } + + if err := h.Discovery.AddNode("aws", *data.ID, &data); err != nil { + respond.Error(w, err) + return + } + + regions, err := getAWSRegions(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err = h.PersistCallback(regions); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + if err := h.Discovery.RemoveNode("aws", id); err != nil { + respond.Error(w, err) + return + } + + regions, err := getAWSRegions(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err := h.PersistCallback(regions); err != nil { + respond.Error(w, err) + return + } + + respond.NoContent(w) +} + +func (h *HandlerImpl) GetAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + nodes, err := h.Discovery.GetNode("aws", id) + if err != nil { + respond.Error(w, err) + return + } + + region, ok := nodes.(*models.AwsRegion) + if !ok { + respond.Error(w, errors.New("expected *models.AwsRegion")) + return + } + + respond.JSON(w, http.StatusOK, region) +} + +func (h *HandlerImpl) ReplaceAWSRegion(w http.ResponseWriter, r *http.Request, id string) { + var data AwsRegion + if !respond.DecodeBody(r, w, &data) { + return + } + + if err := sc.ValidateAWSData(&data, h.UseValidation); err != nil { + respond.Error(w, err) + return + } + + if err := h.Discovery.UpdateNode("aws", *data.ID, &data); err != nil { + respond.Error(w, err) + return + } + + regions, err := getAWSRegions(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err := h.PersistCallback(regions); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, &data) +} + +func getAWSRegions(discovery sc.ServiceDiscoveries) (models.AwsRegions, error) { + nodes, err := discovery.GetNodes("aws") + if err != nil { + return nil, err + } + regions, ok := nodes.(models.AwsRegions) + if !ok { + return nil, errors.New("expected models.AwsRegions") + } + return regions, nil +} diff --git a/handlers/service_discovery/consul/consul.gen.go b/handlers/service_discovery/consul/consul.gen.go new file mode 100644 index 00000000..4b0f5efa --- /dev/null +++ b/handlers/service_discovery/consul/consul.gen.go @@ -0,0 +1,445 @@ +// Package consul provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package consul + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Consul defines model for consul. +type Consul = models.Consul + +// Consuls defines model for consuls. +type Consuls = models.Consuls + +// CreateConsulJSONRequestBody defines body for CreateConsul for application/json ContentType. +type CreateConsulJSONRequestBody = Consul + +// ReplaceConsulJSONRequestBody defines body for ReplaceConsul for application/json ContentType. +type ReplaceConsulJSONRequestBody = Consul + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of all configured Consul servers + // (GET /service_discovery/consul) + GetConsuls(w http.ResponseWriter, r *http.Request) + // Add a new Consul server + // (POST /service_discovery/consul) + CreateConsul(w http.ResponseWriter, r *http.Request) + // Delete a Consul server + // (DELETE /service_discovery/consul/{id}) + DeleteConsul(w http.ResponseWriter, r *http.Request, id string) + // Return one Consul server + // (GET /service_discovery/consul/{id}) + GetConsul(w http.ResponseWriter, r *http.Request, id string) + // Replace a Consul server + // (PUT /service_discovery/consul/{id}) + ReplaceConsul(w http.ResponseWriter, r *http.Request, id string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of all configured Consul servers +// (GET /service_discovery/consul) +func (_ Unimplemented) GetConsuls(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new Consul server +// (POST /service_discovery/consul) +func (_ Unimplemented) CreateConsul(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a Consul server +// (DELETE /service_discovery/consul/{id}) +func (_ Unimplemented) DeleteConsul(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one Consul server +// (GET /service_discovery/consul/{id}) +func (_ Unimplemented) GetConsul(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a Consul server +// (PUT /service_discovery/consul/{id}) +func (_ Unimplemented) ReplaceConsul(w http.ResponseWriter, r *http.Request, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetConsuls operation middleware +func (siw *ServerInterfaceWrapper) GetConsuls(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetConsuls(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateConsul operation middleware +func (siw *ServerInterfaceWrapper) CreateConsul(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateConsul(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteConsul operation middleware +func (siw *ServerInterfaceWrapper) DeleteConsul(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteConsul(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetConsul operation middleware +func (siw *ServerInterfaceWrapper) GetConsul(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetConsul(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceConsul operation middleware +func (siw *ServerInterfaceWrapper) ReplaceConsul(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceConsul(w, r, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/service_discovery/consul", wrapper.GetConsuls) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/service_discovery/consul", wrapper.CreateConsul) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/service_discovery/consul/{id}", wrapper.DeleteConsul) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/service_discovery/consul/{id}", wrapper.GetConsul) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/service_discovery/consul/{id}", wrapper.ReplaceConsul) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3Jbfb9s2EMf/FeI2YC+S5a7BgOnNSbotL0PQDnspguBCnmwWEqmRlBsh0P8+8IcVu3acOnOTrG+2RN19", + "efe5H3fAddNqRcpZKO/AkG21shT+2Ja4rCRHJ7W6brSg2l5z3TRaXY8HV89ntSEU/btbaaMprpUj5fxP", + "bNs6mSk+Wa2Ccb6gBv2vHw1VUMIPxb2UIr61xUESyBhtYBiGDARZbmTrv4IS/loQS5ZIMENWd4YTwyiZ", + "UdScwYJQkAnqz7Sq5LwzwXH+Nxkro+5NyxvHWCVrYst0Nlu7outbghKsM1LNvcIhOyy6pyje0z8dWffK", + "QnuKPqBR2WsO4DlV2NXuXbjH6wrh76TIYM2ittccxD+1+013Svw/yvszWqa0Y1WQ/KxxHVavV53QdvXa", + "SX3zibivl9t8rvP0MN5ychYPr73LZdNqEyLdoltACXPpFt3NhOumWGBr9G3viC8KXktSLlfo5JKK5S9F", + "NAleTtQQ5EhHjX0sM0nzkK00ozHY75Nsj675CXR8XYxXlXZMuV6wVJUOEqSrvbs/Zpf+S3aODtlljYrY", + "7PKC5ewDmaXkxM6l5XpJpmdj2leAleCDr1tS2Eoo4e1kOnkDWdAXslfYaORarIwU96DNyW3j/J5cZ5Rl", + "WNeMJ7RJJNfMmyNjJxC8RuYvROhP7j7DGwvCz9Pp0VrBCtAd9f2h45ysrbqajcognAo9/SHLo9Ti6ZMi", + "YNg1DZp+DCBDxUI1MF3tjyVk4HBuofwIKeNjwuFqyKDVdkeaZkJYhkzR501z25k5M4SORnTSHD7Voj9y", + "WmJWvH1pSEDpTEfDFgxvvonXrZbsI8LDzYWn4CRCeEQC1patYP/XI9vfXJVfAuSZELsI28urb5dcC5qT", + "yhNp+Y0Wfa6w8c1OoMPg5sHGVNxJMUTea3K0Tf55eO7h35A1Flicwzc9k+4ny6TYrohoYayIFg025MLU", + "/3i3G6Xk40IJugXfw6GMQyCDdDMp4Ev4943/q63CONm5Wqw5jwFJOJ8cmYNxa3sJ0mJCvszoY41x7/jS", + "ip7MxzjLDoMjEPAtyJg+Q8t8aHx+Z6Sl4bxFx6NDuNvJWlsj/0+tKJk4CLcjN6GXXQemz7cOpOSYGPJn", + "Wgu+s+oJoTuoUX/lRuD9pH3Yg9+ZGkoolm9huBr+DQAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/service_discovery/consul/consul.go b/handlers/service_discovery/consul/consul.go new file mode 100644 index 00000000..0f3aab3a --- /dev/null +++ b/handlers/service_discovery/consul/consul.go @@ -0,0 +1,181 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package consul + +import ( + "errors" + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + + sc "github.com/haproxytech/dataplaneapi/discovery" + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all Consul service discovery routes onto r. +func RegisterRouter(r chi.Router, discovery sc.ServiceDiscoveries, persistCallback func([]*models.Consul) error, useValidation bool) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{ + Discovery: discovery, + PersistCallback: persistCallback, + UseValidation: useValidation, + }, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for Consul service discovery. +type HandlerImpl struct { + Discovery sc.ServiceDiscoveries + PersistCallback func([]*models.Consul) error + UseValidation bool +} + +func (h *HandlerImpl) GetConsuls(w http.ResponseWriter, r *http.Request) { + consuls, err := getConsuls(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, consuls) +} + +func (h *HandlerImpl) CreateConsul(w http.ResponseWriter, r *http.Request) { + var data Consul + if !respond.DecodeBody(r, w, &data) { + return + } + + data.ID = sc.NewServiceDiscoveryUUID() + + if err := sc.ValidateConsulData(&data, h.UseValidation); err != nil { + respond.Error(w, err) + return + } + + if data.HealthCheckPolicy != nil && *data.HealthCheckPolicy == models.ConsulHealthCheckPolicyMin && data.HealthCheckPolicyMin <= 0 { + respond.BadRequest(w, "health_check_policy_min is required for 'min' health_check_policy") + return + } + + if err := h.Discovery.AddNode("consul", *data.ID, &data); err != nil { + respond.Error(w, err) + return + } + + consuls, err := getConsuls(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err = h.PersistCallback(consuls); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteConsul(w http.ResponseWriter, r *http.Request, id string) { + if err := h.Discovery.RemoveNode("consul", id); err != nil { + respond.Error(w, err) + return + } + + consuls, err := getConsuls(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err = h.PersistCallback(consuls); err != nil { + respond.Error(w, err) + return + } + + respond.NoContent(w) +} + +func (h *HandlerImpl) GetConsul(w http.ResponseWriter, r *http.Request, id string) { + nodes, err := h.Discovery.GetNode("consul", id) + if err != nil { + respond.Error(w, err) + return + } + + consul, ok := nodes.(*models.Consul) + if !ok { + respond.Error(w, errors.New("expected *models.Consul")) + return + } + + respond.JSON(w, http.StatusOK, consul) +} + +func (h *HandlerImpl) ReplaceConsul(w http.ResponseWriter, r *http.Request, id string) { + var data Consul + if !respond.DecodeBody(r, w, &data) { + return + } + + if err := sc.ValidateConsulData(&data, h.UseValidation); err != nil { + respond.Error(w, err) + return + } + + if data.HealthCheckPolicy != nil && *data.HealthCheckPolicy == models.ConsulHealthCheckPolicyMin && data.HealthCheckPolicyMin <= 0 { + respond.BadRequest(w, "health_check_policy_min is required for 'min' health_check_policy") + return + } + + if err := h.Discovery.UpdateNode("consul", *data.ID, &data); err != nil { + respond.Error(w, err) + return + } + + consuls, err := getConsuls(h.Discovery) + if err != nil { + respond.Error(w, err) + return + } + + if err = h.PersistCallback(consuls); err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, &data) +} + +func getConsuls(discovery sc.ServiceDiscoveries) (models.Consuls, error) { + nodes, err := discovery.GetNodes("consul") + if err != nil { + return nil, err + } + consuls, ok := nodes.(models.Consuls) + if !ok { + return nil, errors.New("expected models.Consuls") + } + return consuls, nil +} diff --git a/handlers/site.go b/handlers/site.go deleted file mode 100644 index 031d1f59..00000000 --- a/handlers/site.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/sites" -) - -// CreateSiteHandlerImpl implementation of the CreateSiteHandler interface using client-native client -type CreateSiteHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteSiteHandlerImpl implementation of the DeleteSiteHandler interface using client-native client -type DeleteSiteHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetSiteHandlerImpl implementation of the GetSiteHandler interface using client-native client -type GetSiteHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetSitesHandlerImpl implementation of the GetSitesHandler interface using client-native client -type GetSitesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceSiteHandlerImpl implementation of the ReplaceSiteHandler interface using client-native client -type ReplaceSiteHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateSiteHandlerImpl) Handle(params sites.CreateSiteParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sites.NewCreateSiteDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sites.NewCreateSiteDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateSite(params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return sites.NewCreateSiteDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sites.NewCreateSiteDefault(int(*e.Code)).WithPayload(e) - } - return sites.NewCreateSiteCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return sites.NewCreateSiteAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return sites.NewCreateSiteAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteSiteHandlerImpl) Handle(params sites.DeleteSiteParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sites.NewDeleteSiteDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sites.NewCreateSiteDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteSite(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return sites.NewDeleteSiteDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sites.NewDeleteSiteDefault(int(*e.Code)).WithPayload(e) - } - return sites.NewDeleteSiteNoContent() - } - rID := h.ReloadAgent.Reload() - return sites.NewDeleteSiteAccepted().WithReloadID(rID) - } - return sites.NewDeleteSiteAccepted() -} - -// Handle executing the request and returning a response -func (h *GetSiteHandlerImpl) Handle(params sites.GetSiteParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sites.NewGetSiteDefault(int(*e.Code)).WithPayload(e) - } - - _, site, err := configuration.GetSite(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return sites.NewGetSiteDefault(int(*e.Code)).WithPayload(e) - } - return sites.NewGetSiteOK().WithPayload(site) -} - -// Handle executing the request and returning a response -func (h *GetSitesHandlerImpl) Handle(params sites.GetSitesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sites.NewGetSitesDefault(int(*e.Code)).WithPayload(e) - } - - _, s, err := configuration.GetSites(t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return sites.NewGetSitesOK().WithPayload(models.Sites{}) - } - return sites.NewGetSitesDefault(int(*e.Code)).WithPayload(e) - } - return sites.NewGetSitesOK().WithPayload(s) -} - -// Handle executing the request and returning a response -func (h *ReplaceSiteHandlerImpl) Handle(params sites.ReplaceSiteParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sites.NewReplaceSiteDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sites.NewReplaceSiteDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditSite(params.Name, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return sites.NewReplaceSiteDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sites.NewReplaceSiteDefault(int(*e.Code)).WithPayload(e) - } - return sites.NewReplaceSiteOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return sites.NewReplaceSiteAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return sites.NewReplaceSiteAccepted().WithPayload(params.Data) -} diff --git a/handlers/spoe.go b/handlers/spoe.go deleted file mode 100644 index 970d6ad5..00000000 --- a/handlers/spoe.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeCreateSpoeHandlerImpl implementation of the SpoeCreateSpoeAgentHandler interface -type SpoeCreateSpoeHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeCreateSpoeHandlerImpl) Handle(params spoe.CreateSpoeParams, principal any) middleware.Responder { - file, ok := params.FileUpload.(*runtime.File) - if !ok { - return spoe.NewCreateSpoeBadRequest() - } - - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeDefault(int(*e.Code)).WithPayload(e) - } - - path, err := spoeStorage.Create(file.Header.Filename, params.FileUpload) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewCreateSpoeCreated().WithPayload(path) -} - -// SpoeDeleteSpoeFileHandlerImpl implementation of the SpoeDeleteSpoeFileHandler interface -type SpoeDeleteSpoeFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeDeleteSpoeFileHandlerImpl) Handle(params spoe.DeleteSpoeFileParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeFileDefault(int(*e.Code)).WithPayload(e) - } - - err = spoeStorage.Delete(params.Name) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeFileDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewDeleteSpoeFileNoContent() -} - -// SpoeGetAllSpoeFilesHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler interface -type SpoeGetAllSpoeFilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// SpoeGetAllSpoeFilesHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler -func (h *SpoeGetAllSpoeFilesHandlerImpl) Handle(params spoe.GetAllSpoeFilesParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - - files, err := spoeStorage.GetAll() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetAllSpoeFilesOK().WithPayload(files) -} - -// SpoeGetOneSpoeFileHandlerImpl implementation of the MapsGetOneRuntimeMapHandler interface -type SpoeGetOneSpoeFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeGetOneSpoeFileHandlerImpl) Handle(params spoe.GetOneSpoeFileParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetOneSpoeFileDefault(int(*e.Code)).WithPayload(e) - } - - path, err := spoeStorage.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetOneSpoeFileDefault(int(*e.Code)).WithPayload(e) - } - if path == "" { - return spoe.NewGetOneSpoeFileNotFound() - } - return spoe.NewGetOneSpoeFileOK().WithPayload(&spoe.GetOneSpoeFileOKBody{Data: path}) -} diff --git a/handlers/spoe/agents/agents.gen.go b/handlers/spoe/agents/agents.gen.go new file mode 100644 index 00000000..e4822b1f --- /dev/null +++ b/handlers/spoe/agents/agents.gen.go @@ -0,0 +1,704 @@ +// Package agents provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package agents + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SpoeAgent defines model for spoe_agent. +type SpoeAgent = models.SpoeAgent + +// SpoeAgents defines model for spoe_agents. +type SpoeAgents = models.SpoeAgents + +// GetAllSpoeAgentParams defines parameters for GetAllSpoeAgent. +type GetAllSpoeAgentParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSpoeAgentParams defines parameters for CreateSpoeAgent. +type CreateSpoeAgentParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// DeleteSpoeAgentParams defines parameters for DeleteSpoeAgent. +type DeleteSpoeAgentParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// GetSpoeAgentParams defines parameters for GetSpoeAgent. +type GetSpoeAgentParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceSpoeAgentParams defines parameters for ReplaceSpoeAgent. +type ReplaceSpoeAgentParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// CreateSpoeAgentJSONRequestBody defines body for CreateSpoeAgent for application/json ContentType. +type CreateSpoeAgentJSONRequestBody = SpoeAgent + +// ReplaceSpoeAgentJSONRequestBody defines body for ReplaceSpoeAgent for application/json ContentType. +type ReplaceSpoeAgentJSONRequestBody = SpoeAgent + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of spoe agents in one scope + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents) + GetAllSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeAgentParams) + // Add a new spoe agent to scope + // (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents) + CreateSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeAgentParams) + // Delete a SPOE agent + // (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) + DeleteSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeAgentParams) + // Return a spoe agent + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) + GetSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeAgentParams) + // Replace a SPOE agent + // (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) + ReplaceSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeAgentParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of spoe agents in one scope +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents) +func (_ Unimplemented) GetAllSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeAgentParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new spoe agent to scope +// (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents) +func (_ Unimplemented) CreateSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeAgentParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a SPOE agent +// (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) +func (_ Unimplemented) DeleteSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeAgentParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a spoe agent +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) +func (_ Unimplemented) GetSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeAgentParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a SPOE agent +// (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}) +func (_ Unimplemented) ReplaceSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeAgentParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeAgent operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeAgent(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSpoeAgentParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeAgent(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSpoeAgent operation middleware +func (siw *ServerInterfaceWrapper) CreateSpoeAgent(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSpoeAgentParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSpoeAgent(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeAgent operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeAgent(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSpoeAgentParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeAgent(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeAgent operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeAgent(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSpoeAgentParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeAgent(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceSpoeAgent operation middleware +func (siw *ServerInterfaceWrapper) ReplaceSpoeAgent(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceSpoeAgentParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceSpoeAgent(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents", wrapper.GetAllSpoeAgent) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents", wrapper.CreateSpoeAgent) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}", wrapper.DeleteSpoeAgent) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}", wrapper.GetSpoeAgent) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}", wrapper.ReplaceSpoeAgent) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FhLc9s2EP4rGMSnlhKV2JOZqif50dSX1hN3eokcDQwsRaQkwACgbI2H/72DBSlR1sOPkR3Fo4stgeDu", + "t4v9PuzqjnKdF1qBcpb276gBW2hlAb/YArhMJGdOajXKtYDMjrjOc61Gs43N+iAzwMT07FbaYIpr5UA5", + "/5EVRVabib9ZrdA4TyFn/tOBgYT26bt4DiUOT238JAhgjDa0qqqICrDcyMK/Rfv0nxRIbQkEMWB1aTgQ", + "FiATCJgjmgITYBD9iVaJHJcGHXf+BWNlwL1oeWEbSWQGZFLvjVohumkBtE+tM1KNPcIqelp2j5n4DN9L", + "sG7HUnvMfEIDsl1O4CkkrMzcGcaxWyn8BAoMy0jAtstJ/Eu7P3SpxM9B7xtmidKOJAj5VfNaNY+frqPQ", + "VGhtVV9/A+65ddsZ6069GPZ2m4qZPerIvNAGD6VgLqV9OpYuLa+7XOdxygqjb6cOeBrzTIJyHcWcnEA8", + "+RgHizSUhIYRG9eH+wgYl4WGAe5/OSiYSOkgtw/X1Ax+FTXwmTFs+gB6u2X4PgCpEo1ZlC7zPv8cXPg3", + "ySlzjFxkTAEZXJyTDrm8+PuMzGA0VdanPgZdgGKFpH162O1139MIIWEiYgtmIjnYBhOGH3Lg69XGdwUz", + "oNxIsRyq2HJd+EX8X6/N8zsGt0yCz+BKoyxhimAWiU4IyzLCa3KAIN4dCWaIVEQrIOigSxF84M+5QK1z", + "gyxrF0zBDMvBITG/3PeNWUHeeajU55P2w4FEFJf8t1l8NKL+LpIGBO07U0KbpQVzDox//+uXr8OhGQ7V", + "sOz1Djn+hV9+P3jnP334eFcN6dWvBzRaIna0hM8HjqFuADjP9UZ8Dzo7P/WpdykQZ5iyjKMq3aRggNx4", + "uVOOOE2YELhplvguOWHKC+E1kNKC8K+oRsiItHPt7DYBfC/BTOcRtPyNpNiofVfRYg/5odfb4m0xV4MV", + "18BlyTlYm5TZPPZnyT6eKn/+nSpCr7EunFl+4ud3MCiOZZ4zM51RdIGh6yjpq5qNPdcwTHpVRbTQdgXv", + "B0JYwoiCm5YxX2AOr1u9luMnBpiDPcffLMeXUNdMCp4TbQhPgf8n1fgei2o8q8G2A34M4A1slMrBGEwj", + "RzidHGsxfQElCkK0eOLVkga+fzHPK2o1EJUjC4XvH46CBm9Ri1rjKNr/bcv2F39M+BGSOhBipfitFlHf", + "OHItYAyqU9db51qLaaeuVcEcQwfb69fiO/wWdDsDB8sKforrXsRRY0MMidE5asciNes7Ajeu0fVgbq/r", + "z9H1FjHXO9tfHzt5fSwo+dGadjGcbWBiLbpHW1ar2a8vP0IPA/kXpGRVK7lxgsQmtHVDPVWAPoHbq89e", + "fX6GAXWn59M3Jk3N9NvSlpVTbrlSmoqM8fs90pOVqTazV6e9Ou1H69cdrXuvP1qbwPZXmq3fmFZj6jb3", + "kY+cpr1hMJNGYUuT0T6NJ4e0uqr+DwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/agents/agents.go b/handlers/spoe/agents/agents.go new file mode 100644 index 00000000..0c203965 --- /dev/null +++ b/handlers/spoe/agents/agents.go @@ -0,0 +1,153 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package agents + +import ( + "fmt" + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all SPOE agent routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE agent configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeAgentParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, agents, err := ss.GetAgents(scopeName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, agents) +} + +func (h *HandlerImpl) CreateSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeAgentParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeAgent + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.CreateAgent(scopeName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeAgentParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + if err = ss.DeleteAgent(scopeName, name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeAgentParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, agent, err := ss.GetAgent(scopeName, name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + if agent == nil { + code := int64(404) + msg := fmt.Sprintf("SPOE agent %s not found in scope %s", name, scopeName) + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + respond.JSON(w, http.StatusOK, agent) +} + +func (h *HandlerImpl) ReplaceSpoeAgent(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeAgentParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeAgent + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.EditAgent(scopeName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + w.WriteHeader(http.StatusOK) +} diff --git a/handlers/spoe/files/files.gen.go b/handlers/spoe/files/files.gen.go new file mode 100644 index 00000000..500c7346 --- /dev/null +++ b/handlers/spoe/files/files.gen.go @@ -0,0 +1,408 @@ +// Package files provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package files + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SpoeFiles defines model for spoe_files. +type SpoeFiles = models.SpoeFiles + +// CreateSpoeMultipartBody defines parameters for CreateSpoe. +type CreateSpoeMultipartBody struct { + // FileUpload The spoe file to upload + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// CreateSpoeMultipartRequestBody defines body for CreateSpoe for multipart/form-data ContentType. +type CreateSpoeMultipartRequestBody CreateSpoeMultipartBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return all available SPOE files + // (GET /services/haproxy/spoe/spoe_files) + GetAllSpoeFiles(w http.ResponseWriter, r *http.Request) + // Creates SPOE file with its entries + // (POST /services/haproxy/spoe/spoe_files) + CreateSpoe(w http.ResponseWriter, r *http.Request) + // Delete SPOE file + // (DELETE /services/haproxy/spoe/spoe_files/{name}) + DeleteSpoeFile(w http.ResponseWriter, r *http.Request, name string) + // Return one SPOE file + // (GET /services/haproxy/spoe/spoe_files/{name}) + GetOneSpoeFile(w http.ResponseWriter, r *http.Request, name string) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return all available SPOE files +// (GET /services/haproxy/spoe/spoe_files) +func (_ Unimplemented) GetAllSpoeFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Creates SPOE file with its entries +// (POST /services/haproxy/spoe/spoe_files) +func (_ Unimplemented) CreateSpoe(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete SPOE file +// (DELETE /services/haproxy/spoe/spoe_files/{name}) +func (_ Unimplemented) DeleteSpoeFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one SPOE file +// (GET /services/haproxy/spoe/spoe_files/{name}) +func (_ Unimplemented) GetOneSpoeFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSpoe operation middleware +func (siw *ServerInterfaceWrapper) CreateSpoe(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSpoe(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeFile operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneSpoeFile operation middleware +func (siw *ServerInterfaceWrapper) GetOneSpoeFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneSpoeFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files", wrapper.GetAllSpoeFiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files", wrapper.CreateSpoe) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{name}", wrapper.DeleteSpoeFile) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{name}", wrapper.GetOneSpoeFile) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "3Fffb9s2EP5XiNseJctdgwHTW9KkXV/WoCn2UgQGTZ1tFhTJkSc3hqH/fSAp+UfkpHVgbG7fHJE8fnff", + "d98xaxCmtkajJg/lGhx6a7TH+Ie3KORMCk7S6EltKlR+IkxdGz3ZbOy/XyqHvFrdPEifQgmjCTWFn9xa", + "1YUpvnijY3CxwJqHX786nEEJvxRbKEVa9cVRENA546Bt2wwq9MJJG05BCZ8WyLpIWDGH3jROIOMJMsOE", + "OYMF8gpdRP/G6JmcNy5enP+NzsuEez/y3jY2kwrZstub7aRIK4tQgicn9TwgbLPjqnvFq4/4T4Oezqy0", + "VzwUNCE75wJe44w3im5iHudVwneo0XHFErZzLuJfht6aRlc/Rnt/5Z5pQ2wWIf+ndW375eN9FHuFdlHN", + "9AuK0FsP+dzk3ce0d9QrZrOUy9oaF0mxnBZQwlzSopmOhKmLBbfOPKwIxaIQSqKmXHOSSyyWvxcpIiRJ", + "GJyEZCN4SVj7A1lm/QfuHF8dxndnDb6NgU6LMaCUemYiLEkqXPnn5W04ya45cXaruEZ2efue5ezu9sMN", + "61H09JUQMjAWNbcSSng9Go9eQRYRxWwLj24pBfoeUhHKUuzXZo40FM1HpMZpz7hSjC+5VHyqMKGIB0cQ", + "L06iel9FA6BLpXaLtTeGfxuPT9hwG/wHGumuEQK9nzWKbRCGOl2ML54KvEFavMxJIoZozSe+Yc/wo6yb", + "uuZutWHoSYIgA+JzD+VnCJzAfZuBNf4A1W8cckK/Pcu+SlowSZ6hJicPkZ3OxMCB5zg5r0y1ekRx3SiS", + "ljsqZsbVecUpcotamCr0X7mGcOGkscrwXUP+lDqQ8IEKq7jUsHWj2HMu4CGZtPUoxiFfNZhSI8O6jRkE", + "TJyghKnUoabZwAOzR/6VmvaRrl8dpeuBzQ7ku6FBxCJXAzqSmMcnltrO4yzG/+PE8fef1v9Hx3xb6IOm", + "CY4vTIVz1Hkn83xqqlWueR1o3FVeuOybhlusw8k2yVQh4VCw1/H7Dsxh+6UtvddGx3e8RooPg8/rJxUV", + "UYepA2UaWxl0iXQrIUfpsIKSXIPPPQ/uB31wMUxle3NKtvoJfThxsWXrkPE+O2KNxue4fof0QZ8b18fN", + "8n237qfAd5jtd432l7yJQzmZePk/HD/nW2JPiUMdxzPolr3yGqeghGL5Gtr79t8AAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/files/files.go b/handlers/spoe/files/files.go new file mode 100644 index 00000000..034db7ba --- /dev/null +++ b/handlers/spoe/files/files.go @@ -0,0 +1,121 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package files + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" +) + +// RegisterRouter registers all SPOE file routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE file management. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllSpoeFiles(w http.ResponseWriter, r *http.Request) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + files, err := spoeStorage.GetAll() + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, files) +} + +func (h *HandlerImpl) CreateSpoe(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + path, err := spoeStorage.Create(header.Filename, file) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, path) +} + +func (h *HandlerImpl) DeleteSpoeFile(w http.ResponseWriter, r *http.Request, name string) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + if err = spoeStorage.Delete(name); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetOneSpoeFile(w http.ResponseWriter, r *http.Request, name string) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + path, err := spoeStorage.Get(name) + if err != nil { + respond.Error(w, err) + return + } + if path == "" { + code := misc.ErrHTTPNotFound + msg := "spoe file " + name + " not found" + respond.JSON(w, http.StatusNotFound, &models.Error{Code: &code, Message: &msg}) + return + } + respond.JSON(w, http.StatusOK, struct { + Data string `json:"data,omitempty"` + }{Data: path}) +} diff --git a/handlers/spoe/groups/groups.gen.go b/handlers/spoe/groups/groups.gen.go new file mode 100644 index 00000000..26f3a309 --- /dev/null +++ b/handlers/spoe/groups/groups.gen.go @@ -0,0 +1,704 @@ +// Package groups provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package groups + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SpoeGroup defines model for spoe_group. +type SpoeGroup = models.SpoeGroup + +// SpoeGroups defines model for spoe_groups. +type SpoeGroups = models.SpoeGroups + +// GetAllSpoeGroupParams defines parameters for GetAllSpoeGroup. +type GetAllSpoeGroupParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSpoeGroupParams defines parameters for CreateSpoeGroup. +type CreateSpoeGroupParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// DeleteSpoeGroupParams defines parameters for DeleteSpoeGroup. +type DeleteSpoeGroupParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// GetSpoeGroupParams defines parameters for GetSpoeGroup. +type GetSpoeGroupParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceSpoeGroupParams defines parameters for ReplaceSpoeGroup. +type ReplaceSpoeGroupParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// CreateSpoeGroupJSONRequestBody defines body for CreateSpoeGroup for application/json ContentType. +type CreateSpoeGroupJSONRequestBody = SpoeGroup + +// ReplaceSpoeGroupJSONRequestBody defines body for ReplaceSpoeGroup for application/json ContentType. +type ReplaceSpoeGroupJSONRequestBody = SpoeGroup + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of SPOE groups + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups) + GetAllSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeGroupParams) + // Add a new SPOE groups + // (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups) + CreateSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeGroupParams) + // Delete a SPOE groups + // (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) + DeleteSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeGroupParams) + // Return a SPOE groups + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) + GetSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeGroupParams) + // Replace a SPOE groups + // (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) + ReplaceSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeGroupParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of SPOE groups +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups) +func (_ Unimplemented) GetAllSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new SPOE groups +// (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups) +func (_ Unimplemented) CreateSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a SPOE groups +// (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) +func (_ Unimplemented) DeleteSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a SPOE groups +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) +func (_ Unimplemented) GetSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a SPOE groups +// (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}) +func (_ Unimplemented) ReplaceSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeGroupParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeGroup operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSpoeGroupParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeGroup(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSpoeGroup operation middleware +func (siw *ServerInterfaceWrapper) CreateSpoeGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSpoeGroupParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSpoeGroup(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeGroup operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSpoeGroupParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeGroup(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeGroup operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSpoeGroupParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeGroup(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceSpoeGroup operation middleware +func (siw *ServerInterfaceWrapper) ReplaceSpoeGroup(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceSpoeGroupParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceSpoeGroup(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups", wrapper.GetAllSpoeGroup) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups", wrapper.CreateSpoeGroup) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}", wrapper.DeleteSpoeGroup) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}", wrapper.GetSpoeGroup) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}", wrapper.ReplaceSpoeGroup) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XCLZPm2y5TVBg3pPzY11etqAZ9lKnBkOeJHYSyZKUE8PQ/z6QlGSrdu0kcBI38EsiUeTx", + "u+N9H+88x1QWSgoQ1uDhHGswSgoD/sUooDzhlFguxaSQDHIzobIopJi0E5vxUa6BsNn5HTfBFJXCgrDu", + "kSiV12bir0YKb5xmUBD39FZDgof4TbyAEoevJn4QBNBaalxVVYQZGKq5cqvwEP+TAaotAUMajCw1BUQC", + "ZAQBc4QzIAy0R38qRcLTUvuNe/+CNjzg7lruTEMJzwFN67nRkot2pgAPsbGai9QhrKKHRfeEsE/wrQRj", + "9yy0J8QFNCDb5wCeQULK3J57P/YrhB9BgCY5Ctj2OYh/SfuHLAX7Oeh9SwwS0qLEQ37WuFbN54frKDQZ", + "WluVN1+BOm7d9VLZqwfD3H6TMe2nHi+U1P5QFLEZHuKU26y86VNZxBlRWt7NLNAspjkHYXuCWD6FePoh", + "DhZxSAkJk1TLUt0TxpWS8NHPfzooPpDcQmG251QLv4oa+ERrMtuC3uwYvnOAi0T6KHKbuz3/HF26leiM", + "WIIucyIAjS4vUA9dXf59jloYTZYNsfNBKhBEcTzER/1B/x2OPCQfiNiAnnIKpsHk3Q8xcPlq4rkiGoSd", + "CFJAFRsqlRv0/+uxRXxTsKsk+AS21MIgIpCPIpIJInmOaE0OYAF8MIO4QFJAGPK79LH3IJDognnBs6M8", + "X84aRTQpwHp2fv4egDflyefwYhdUPAynEmE/5N5aJ3GE3YXENTA8tLqEZaoqYi1ot/7L5y/jsR6Pxbgc", + "DI6o/wu//P72jXt6/2FejfH1r29xtMLuaAWfkhBc3QBwEfCN+LZudnHm4m8zQFYTYQj10nSbgQZ06zRP", + "WGQlIoz5SW3g++iUCKeGN4BKA8wtEY2aIW4WAtpvHPhWgp4tPFjab8LZRgG8jrqF5PvBYIdXxkIS1twF", + "VyWlYExS5gvfH6X9/lTp4y9WFgqOH7nTxid+fBnjFbIsCqJnLU87NF3ipUtkkjp6ec/wdRVhJc0avo8Y", + "M4ggAbcdXlvpE2oTr081EAsHXr9aXq+grtkTdk6kRjQD+h8X6XfMqfGsB7vs8H0Ab2AgFxZS0I0E+bbk", + "RLLZE6hPEJ/uiVcruvfuyXZek6s1U6mnIXOVw3EQ3h0K0FIj6u3/tmP73Z8RXkJHR4ytyt+KfLpSkUoG", + "KYhenWi9G8lmvTpJGbHEG95dhRbP/VtQ7BwsrGr3mR938r0s3YmWRVCNLYVZWH4Q8McI+IKBGzY73BN7", + "eU90JPv4B7VgONvAvFpcj3esSu3vKy+he4H8XelYVzVubBJbhWnuos7x3q83POjPQX9+hv5zr9vPVyZO", + "TXO7taUt14qTygldKYserE21nYM+HfTp0Ec/bx89eIE+Wge6P1Mj/crk2odui17fs4d2lkFPG40tdY6H", + "OJ4e4eq6+j8AAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/groups/groups.go b/handlers/spoe/groups/groups.go new file mode 100644 index 00000000..3e139704 --- /dev/null +++ b/handlers/spoe/groups/groups.go @@ -0,0 +1,145 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package groups + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all SPOE group routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE group configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeGroupParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, groups, err := ss.GetGroups(scopeName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, groups) +} + +func (h *HandlerImpl) CreateSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeGroupParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeGroup + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.CreateGroup(scopeName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeGroupParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + if err = ss.DeleteGroup(scopeName, name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeGroupParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, group, err := ss.GetGroup(scopeName, name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, group) +} + +func (h *HandlerImpl) ReplaceSpoeGroup(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeGroupParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeGroup + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.EditGroup(scopeName, &data, name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) +} diff --git a/handlers/spoe/messages/messages.gen.go b/handlers/spoe/messages/messages.gen.go new file mode 100644 index 00000000..7b98d852 --- /dev/null +++ b/handlers/spoe/messages/messages.gen.go @@ -0,0 +1,704 @@ +// Package messages provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package messages + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SpoeMessage defines model for spoe_message. +type SpoeMessage = models.SpoeMessage + +// SpoeMessages defines model for spoe_messages. +type SpoeMessages = models.SpoeMessages + +// GetAllSpoeMessageParams defines parameters for GetAllSpoeMessage. +type GetAllSpoeMessageParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSpoeMessageParams defines parameters for CreateSpoeMessage. +type CreateSpoeMessageParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// DeleteSpoeMessageParams defines parameters for DeleteSpoeMessage. +type DeleteSpoeMessageParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// GetSpoeMessageParams defines parameters for GetSpoeMessage. +type GetSpoeMessageParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ReplaceSpoeMessageParams defines parameters for ReplaceSpoeMessage. +type ReplaceSpoeMessageParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// CreateSpoeMessageJSONRequestBody defines body for CreateSpoeMessage for application/json ContentType. +type CreateSpoeMessageJSONRequestBody = SpoeMessage + +// ReplaceSpoeMessageJSONRequestBody defines body for ReplaceSpoeMessage for application/json ContentType. +type ReplaceSpoeMessageJSONRequestBody = SpoeMessage + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of spoe messages in one scope + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages) + GetAllSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeMessageParams) + // Add a new spoe message to scope + // (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages) + CreateSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeMessageParams) + // Delete a spoe message + // (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) + DeleteSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeMessageParams) + // Return a spoe message + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) + GetSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeMessageParams) + // Replace a spoe message + // (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) + ReplaceSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeMessageParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of spoe messages in one scope +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages) +func (_ Unimplemented) GetAllSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new spoe message to scope +// (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages) +func (_ Unimplemented) CreateSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a spoe message +// (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) +func (_ Unimplemented) DeleteSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return a spoe message +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) +func (_ Unimplemented) GetSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a spoe message +// (PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}) +func (_ Unimplemented) ReplaceSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeMessage operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSpoeMessageParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeMessage(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSpoeMessage operation middleware +func (siw *ServerInterfaceWrapper) CreateSpoeMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSpoeMessageParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSpoeMessage(w, r, parentName, scopeName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeMessage operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSpoeMessageParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeMessage(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeMessage operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSpoeMessageParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeMessage(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceSpoeMessage operation middleware +func (siw *ServerInterfaceWrapper) ReplaceSpoeMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "scope_name" ------------- + var scopeName string + + err = runtime.BindStyledParameterWithOptions("simple", "scope_name", chi.URLParam(r, "scope_name"), &scopeName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "scope_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceSpoeMessageParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceSpoeMessage(w, r, parentName, scopeName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages", wrapper.GetAllSpoeMessage) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages", wrapper.CreateSpoeMessage) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}", wrapper.DeleteSpoeMessage) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}", wrapper.GetSpoeMessage) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}", wrapper.ReplaceSpoeMessage) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Jhdb9s2F8e/CsHm6nlky22CAtOunJd1udgWNMNu6tRgyCOJnUSyJOXECPTdB5KSY8VvSeA0buCbxNbL", + "4f8cnv+PpO8wlaWSAoQ1OLnDGoySwoD/YhRQnnJKLJdiXEoGhRlTWZZSjGcPtteHhQbCpme33IRQVAoL", + "wrqPRKmiCRN/M1L44DSHkrhPBxpSnOB38b2UONw18ZMkgNZS47quI8zAUM2Vewsn+O8cUBMJGNJgZKUp", + "IBIkIwiaI5wDYaC9+hMpUp5V2g/c+we04UF3N3LnMZTyAtCkeTaaS9FOFeAEG6u5yJzCOnpadY8J+wzf", + "KzB2x0p7TFxBg7JdLuAppKQq7JnPY7dK+AkEaFKgoG2Xi/intL/JSrCfw943xCAhLUq95B9a17q9/XSO", + "QtuhTVR5/Q2o89ZtL5O95mJ4tt92zOxWj5dKaj8pitgcJzjjNq+u+1SWcU6UlrdTCzSPacFB2J4glk8g", + "nnyMQ0QcWkLCuARjSAaPFHKpJPzRvPGScnw5uYXSbO6suSTqqE2CaE2mG3MwW07CpcFFKn01uS3cqL8P", + "L9yb6JRYgi4KIgANL85RD11e/HWG5oS0HZdgl4dUIIjiOMGH/UH/PY68KF+O2ICecAqmVeWLECrhetfE", + "d4poEHYsSAl1bKhU7qL/31ybr3MGdtESn8FWWhhEBPK1RDJFpCgQbawCDLkBURsIcYGkAOQH6WOfQPDT", + "OfPss8Oi6LaPIpqUYL1Vvzwc31fHO9EJxq6uOAkTE2F/yX2bZYkj7FYnroHhxOoK5n2riLWg3ftfv3wd", + "jfRoJEbVYHBI/V/4368H79ynDx/v6hG++v8BjhasHi3oc8n7ZNcIvK/4Wn0bBzs/deW3OSCriTCEek7d", + "5KAB3TgACousRIQx/9Cs9H10QoRD4zWgygBzr4gWbYibe5r22wS+V6Cn9xnMjTfmbC0Nr6LurvLDYLDF", + "9WOeDUuWhsuKUjAmrYr77J+1FPh5pc9fZ1nYf6xKaFah+Pm7Gg/LqiyJns6M2vHpamO6ziaZ85tPFF/V", + "EVbSLPH/kDGDCBJw0wnn2sz6ZViu9PqJBmJh7/U37PUF1Y2fwsip1IjmQP/lInvgpUbPcrHzCT9G8BpP", + "cmEhA91iyZ9bjiWbvgiRApC6c14v0PD9C469pF9bw1LvRub2FEeByFvk0txx1cf/Zcvxuz82vAZeh4yt", + "wOByoLoNJZUMMhC9pu9615JNe03PMmKJH2Kbu7j4zn8PFC/AwiLPT/11h/ROHqmWpeeIZ/AKoId390B/", + "HtA7blw93H7l2MmVo4PwoxX7xXZ2g/ka1h5tGVKzH2VeA4MBAQ/osWw3ufYw6fehncWpM8VcrMXQJ7B7", + "Bu0Z9POcVHf6oPrGANUegzcCSlVLAaUKQhe3Rwt8cgRbx6gm0J5Te07tT9mvccoevM4pWwff/6Bj9hsj", + "ty/dJnQ/8mDtQoOetKytdIETHE8OcX1V/xcAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/messages/messages.go b/handlers/spoe/messages/messages.go new file mode 100644 index 00000000..793da791 --- /dev/null +++ b/handlers/spoe/messages/messages.go @@ -0,0 +1,145 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package messages + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all SPOE message routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE message configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params GetAllSpoeMessageParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, messages, err := ss.GetMessages(scopeName, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, messages) +} + +func (h *HandlerImpl) CreateSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, params CreateSpoeMessageParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeMessage + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.CreateMessage(scopeName, &data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params DeleteSpoeMessageParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + if err = ss.DeleteMessage(scopeName, name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params GetSpoeMessageParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, message, err := ss.GetMessage(scopeName, name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, message) +} + +func (h *HandlerImpl) ReplaceSpoeMessage(w http.ResponseWriter, r *http.Request, parentName string, scopeName string, name string, params ReplaceSpoeMessageParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeMessage + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.EditMessage(scopeName, &data, name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, &data) +} diff --git a/handlers/spoe/scopes/scopes.gen.go b/handlers/spoe/scopes/scopes.gen.go new file mode 100644 index 00000000..f7939db6 --- /dev/null +++ b/handlers/spoe/scopes/scopes.gen.go @@ -0,0 +1,570 @@ +// Package scopes provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package scopes + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// SpoeScope defines model for spoe_scope. +type SpoeScope = models.SpoeScope + +// SpoeScopes defines model for spoe_scopes. +type SpoeScopes = models.SpoeScopes + +// GetAllSpoeScopeParams defines parameters for GetAllSpoeScope. +type GetAllSpoeScopeParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSpoeScopeParams defines parameters for CreateSpoeScope. +type CreateSpoeScopeParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// DeleteSpoeScopeParams defines parameters for DeleteSpoeScope. +type DeleteSpoeScopeParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` + + // Version Version used for checking configuration version. Cannot be used when transaction is specified. + Version int `form:"version,omitempty" json:"version,omitempty,omitzero"` +} + +// GetSpoeScopeParams defines parameters for GetSpoeScope. +type GetSpoeScopeParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// CreateSpoeScopeJSONRequestBody defines body for CreateSpoeScope for application/json ContentType. +type CreateSpoeScopeJSONRequestBody = SpoeScope + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return an array of spoe scopes + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes) + GetAllSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeScopeParams) + // Add a new spoe scope + // (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes) + CreateSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params CreateSpoeScopeParams) + // Delete a SPOE scope + // (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}) + DeleteSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteSpoeScopeParams) + // Return one SPOE scope + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}) + GetSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetSpoeScopeParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return an array of spoe scopes +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes) +func (_ Unimplemented) GetAllSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeScopeParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Add a new spoe scope +// (POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes) +func (_ Unimplemented) CreateSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params CreateSpoeScopeParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a SPOE scope +// (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}) +func (_ Unimplemented) DeleteSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteSpoeScopeParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one SPOE scope +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}) +func (_ Unimplemented) GetSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetSpoeScopeParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeScope operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeScope(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSpoeScopeParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeScope(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateSpoeScope operation middleware +func (siw *ServerInterfaceWrapper) CreateSpoeScope(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateSpoeScopeParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSpoeScope(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeScope operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeScope(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteSpoeScopeParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeScope(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeScope operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeScope(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSpoeScopeParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeScope(w, r, parentName, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes", wrapper.GetAllSpoeScope) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes", wrapper.CreateSpoeScope) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}", wrapper.DeleteSpoeScope) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}", wrapper.GetSpoeScope) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Jffbts2FMZfhWBztcmW2wQFpl05f9blZguaYTd1ajDkkcROIlWScmIYeveBpCRLkZMsgZN4aW4MSyIP", + "v3N0vp/IFaYyL6QAYTSOVliBLqTQ4C50AZTHnBLDpZjnkkGm51TmuRTzdmBzf5opIGx5cs21D0WlMCCM", + "/UuKIqvDhN+0FC44TSEn9t+eghhH+F24lhL6pzp8kARQSipcVVWAGWiqeGFn4Qj/lQKqIwFDCrQsFQVE", + "vGQEXnOAUyAMlFN/JEXMk1K5hUd/g9Lc6+5H7g1DMc8ALeqxQSdFsywAR1gbxUViFVbBw6p7SNhn+F6C", + "NjtW2kNiC+qV7XIBjyEmZWZOXB67VcJPIECRDHltu1zEP6T5TZaC/T/sfUU0EtKg2El+1rpWzeOHcxSa", + "Dq2jystvQK23rkeJHNU3/dhx0zHtoxHPC6ncSymISXGEE27S8nJMZR6mpFDyemmApiHNOAgzEsTwBYSL", + "j6GPiH1LSJhrKu1KN5PbKOO8kHDuxj+dFFdIbiDX9/dUK78KGvlEKbK8R73esnybABexdFXkJrNr/j49", + "szPRMTEEnWVEAJqenaIROj/78wS1Mpoui7DNQRYgSMFxhPfHk/F7HDhJrhChBrXgFHSjyaXva2D7VYer", + "gigQZi5IDlW4rmUCZtjwn8GUSmhEBHIVQzJGJMsQrY0ADNnQyIcZY6fN2+OUOZSZaZZ1+6EgiuRgnO++", + "3FzOJe1sZdVhWy4c+XoH2N2yV618HGD7qeEKGI6MKqFrwoIYA8rO//rl62ymZjMxKyeTfep+4adf997Z", + "fx8+rqoZvvh5DwcD3wY39Z0e2wKYFJBRRGhCHQeuUlCArixghEFGIsKYG9TWYoyOiLDouQRUamB2imjQ", + "gbhe02rcJP29BLVcZ91Zb87ZnbS5CPq7tg+TyRb5vPbfBvCel5SC1nGZrXN/FGhtx7RN9oivGPNf99vS", + "aesTPn7P4HBU5jlRy9YoPZ90jGF7iyS2411m+KIKcCH1BsNNGdOIIAFXnflDXx0pIAbefPWcvhqorrvX", + "rxxLhWgK9B8ukhudW+vZLLab8H8RfIcDuDCQgGoQ4Pbgh5Itn8D93vz9JqkG3Hn/ZCtvoIV7iqgzBrNf", + "yQPPvS36v3PocvF/2XL8/pH5JTA2ZWxAnwG87K6ISgYJiFHdZqNLyZajukUZMcTFfdxmJFy5K8/GDAwM", + "KXns7ltQOrL5Vx8rmTs8DL8bQ4D6CK8GoB0H3C7wXmVvnH4JTveQeXDLXsi/W++Hmm4HW8ZCe5h/CfB4", + "P/YMvWnTdOchRQro8oCL9Z3NEPgE5hUS4Ic2//Mcfnb67PPKyFCfrPrmHrLBTQK1aNxbqgxHOFzs4+qi", + "+jcAAP//", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/scopes/scopes.go b/handlers/spoe/scopes/scopes.go new file mode 100644 index 00000000..0b0a6dff --- /dev/null +++ b/handlers/spoe/scopes/scopes.go @@ -0,0 +1,123 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scopes + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all SPOE scope routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE scope configuration. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetAllSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeScopeParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, scopes, err := ss.GetScopes(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, scopes) +} + +func (h *HandlerImpl) CreateSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, params CreateSpoeScopeParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + var data SpoeScope + if !respond.DecodeBody(r, w, &data) { + return + } + if err = ss.CreateScope(&data, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &data) +} + +func (h *HandlerImpl) DeleteSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params DeleteSpoeScopeParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + if err = ss.DeleteScope(name, params.TransactionId, int64(params.Version)); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetSpoeScope(w http.ResponseWriter, r *http.Request, parentName string, name string, params GetSpoeScopeParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + _, scope, err := ss.GetScope(name, params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, scope) +} diff --git a/handlers/spoe/transactions/transactions.gen.go b/handlers/spoe/transactions/transactions.gen.go new file mode 100644 index 00000000..0b79fd69 --- /dev/null +++ b/handlers/spoe/transactions/transactions.gen.go @@ -0,0 +1,583 @@ +// Package transactions provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package transactions + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" +) + +// Defines values for GetAllSpoeTransactionParamsStatus. +const ( + Failed GetAllSpoeTransactionParamsStatus = "failed" + InProgress GetAllSpoeTransactionParamsStatus = "in_progress" +) + +// Valid indicates whether the value is a known member of the GetAllSpoeTransactionParamsStatus enum. +func (e GetAllSpoeTransactionParamsStatus) Valid() bool { + switch e { + case Failed: + return true + case InProgress: + return true + default: + return false + } +} + +// SpoeTransaction defines model for spoe_transaction. +type SpoeTransaction = models.SpoeTransaction + +// SpoeTransactions defines model for spoe_transactions. +type SpoeTransactions = models.SpoeTransactions + +// GetAllSpoeTransactionParams defines parameters for GetAllSpoeTransaction. +type GetAllSpoeTransactionParams struct { + // Status Filter by transaction status + Status GetAllSpoeTransactionParamsStatus `form:"status,omitempty" json:"status,omitempty,omitzero"` +} + +// GetAllSpoeTransactionParamsStatus defines parameters for GetAllSpoeTransaction. +type GetAllSpoeTransactionParamsStatus string + +// StartSpoeTransactionParams defines parameters for StartSpoeTransaction. +type StartSpoeTransactionParams struct { + // Version Configuration version on which to work on + Version int `form:"version" json:"version"` +} + +// CommitSpoeTransactionParams defines parameters for CommitSpoeTransaction. +type CommitSpoeTransactionParams struct { + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return list of SPOE configuration transactions. + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions) + GetAllSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeTransactionParams) + // Start a new transaction + // (POST /services/haproxy/spoe/spoe_files/{parent_name}/transactions) + StartSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params StartSpoeTransactionParams) + // Delete a transaction + // (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) + DeleteSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) + // Return one SPOE configuration transactions + // (GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) + GetSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) + // Commit transaction + // (PUT /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) + CommitSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string, params CommitSpoeTransactionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return list of SPOE configuration transactions. +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions) +func (_ Unimplemented) GetAllSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeTransactionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Start a new transaction +// (POST /services/haproxy/spoe/spoe_files/{parent_name}/transactions) +func (_ Unimplemented) StartSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params StartSpoeTransactionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a transaction +// (DELETE /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) +func (_ Unimplemented) DeleteSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one SPOE configuration transactions +// (GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) +func (_ Unimplemented) GetSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Commit transaction +// (PUT /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}) +func (_ Unimplemented) CommitSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string, params CommitSpoeTransactionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllSpoeTransaction operation middleware +func (siw *ServerInterfaceWrapper) GetAllSpoeTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetAllSpoeTransactionParams + + // ------------- Optional query parameter "status" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "status", r.URL.Query(), ¶ms.Status, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "status"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "status", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllSpoeTransaction(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// StartSpoeTransaction operation middleware +func (siw *ServerInterfaceWrapper) StartSpoeTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params StartSpoeTransactionParams + + // ------------- Required query parameter "version" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "version", r.URL.Query(), ¶ms.Version, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "version"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "version", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.StartSpoeTransaction(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteSpoeTransaction operation middleware +func (siw *ServerInterfaceWrapper) DeleteSpoeTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteSpoeTransaction(w, r, parentName, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSpoeTransaction operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeTransaction(w, r, parentName, id) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CommitSpoeTransaction operation middleware +func (siw *ServerInterfaceWrapper) CommitSpoeTransaction(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // ------------- Path parameter "id" ------------- + var id string + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CommitSpoeTransactionParams + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CommitSpoeTransaction(w, r, parentName, id, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/transactions", wrapper.GetAllSpoeTransaction) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/transactions", wrapper.StartSpoeTransaction) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}", wrapper.DeleteSpoeTransaction) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}", wrapper.GetSpoeTransaction) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}", wrapper.CommitSpoeTransaction) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FjRb9u2E/5XDmyBH/CbbLlpUGDeU7q0W162ICn2EqcGQ50sdhKpkicnRqD/fSApK5alxMmWpkHQl8Ah", + "eafvjt93d9I1E7ootUJFlk2vmUFbamXR/2NLFDKVgpPUal7oBHM7F7ootJq3B9fr73lygl8rtORMhVaE", + "yv/kZZk3PuIvVivvWWRYcPfrtcGUTdmr+AZHHHZt/KDnozHasLquI5agFUaWzopN2XuegGmQRSxDnqDx", + "4f2qVSoXlfHuR3+hsTKg69p3jkEqc4RlczbaCIRWJbIps2SkWjgcdfSwBB5iyqucPvg4nlcKf0OFhucQ", + "sD3nJP6h6aOuVPLMEvgpQ2g8oWOj1ZURCJfcgtIEqYf8pHmt19sPVzquGdp41RdfUDhtXY0WetQshrPj", + "NWParZEsSm38pZScMjZlC0lZdTEWuogzXhp9tSIUWSxyiYpGipNcYrx8FwePLFBC45wMV5YLavJyDzCn", + "pcZPG1bfGpZPrSQs7G6WbQVUR+uAuDF8da947CMH5EKSKtU+u5Jy9+TfD46dJRxy4nCcc4VwcHwEIzg9", + "/vMDbIFZM3HKXDy6RMVLyabs7XgyfsMiD8ynJrZollKgXSPzCQlZcZy28XXJDSqaK15gHW/neIHUl8YJ", + "UmWUBQ65tAQ6DRhFRzGbnsYd/CC4ggt0miI0mMDFCihDacASp8qOmQ8p+DlKfJWkgzzvk6zkhhdIXthn", + "2yg9Jq9bFxpzGWfTcGUR80vuvzZ2FjHXy6TBhE3JVLip8pIToXH2n88+z2ZmNlOzajJ5K/xf/P8vr1+5", + "X3vvrusZO//pNYt6hSHaxvfRh++DvwmqScEa7dcKzeoGbrt5gwxVVbDpGUu5zDHxdvPS6IVBa9l5H8Z5", + "1J1E9iaTR6zo2yodKNinlRAOm9/wffk2ty3O+N93e188qqLgZtUS996sdbfIF45brFcQzuuIldoOqOOU", + "uCEnDoWXnavlyjWoIB1J/7Mgkx7TvfELI3q3kzalC7SCy0yKDEjDpTZ/gw90iPU3bfd23A0IqQgXaAZ5", + "/uab8XxwLulq2hAmjvL7ez8/CEZpHD9IhiCETnAo2ogVaC1f4NBEEm018CGwWkPB1QpcJ4Gugr+DTL0I", + "+gK6W4519J+aXXwtkzqIOUfCvqwP/brT9YZZv1WFYy9MwZtklskwPr++U6B39KH9fs43nxvuJYgonH1E", + "MrYvN9+D7oEyXWLtaj13zmVa4X16W2/G+sHah7N28qRdpRme0iqH9vZeoCKaOe0ePN45olU09GpfFJI2", + "/USAVygqp8J8I7UWpLplhIPCLnoaCo5/yGiXjHrPOErBIkWQaOCQaiMQDOaaJ35JaYJLLsntuDfFlg/+", + "i487Nkow56vxLQOkdzgPJzsvTy2xU55bbHNxoXWOXD0DvXemyFb7+QqEZ1rTD/cme0+KqjvQi4yrBQIX", + "AkvCpNGIy/X64zBufYE7CXd2dNiX5tGhezFzd9zawsDFDX3N3A9384gVauPD+8ursf0iuGO+dtZolusi", + "VpmcTVm8fMvq8/qfAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/transactions/transactions.go b/handlers/spoe/transactions/transactions.go new file mode 100644 index 00000000..2e7e4c8f --- /dev/null +++ b/handlers/spoe/transactions/transactions.go @@ -0,0 +1,174 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transactions + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all SPOE transaction routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE transaction management. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params GetAllSpoeTransactionParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + ts, err := ss.Transaction.GetTransactions(string(params.Status)) + if err != nil { + respond.Error(w, err) + return + } + var result models.SpoeTransactions + for _, t := range *ts { + m := &models.SpoeTransaction{ + ID: t.ID, + Version: t.Version, + Status: t.Status, + } + result = append(result, m) + } + respond.JSON(w, http.StatusOK, result) +} + +func (h *HandlerImpl) StartSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, params StartSpoeTransactionParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + t, err := ss.Transaction.StartTransaction(int64(params.Version)) + if err != nil { + respond.Error(w, err) + return + } + m := &models.SpoeTransaction{ + ID: t.ID, + Version: t.Version, + Status: t.Status, + } + respond.JSON(w, http.StatusCreated, m) +} + +func (h *HandlerImpl) DeleteSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + if err = ss.Transaction.DeleteTransaction(id); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) +} + +func (h *HandlerImpl) GetSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + t, err := ss.Transaction.GetTransaction(id) + if err != nil { + respond.Error(w, err) + return + } + m := &models.SpoeTransaction{ + ID: t.ID, + Version: t.Version, + Status: t.Status, + } + respond.JSON(w, http.StatusOK, m) +} + +func (h *HandlerImpl) CommitSpoeTransaction(w http.ResponseWriter, r *http.Request, parentName string, id string, params CommitSpoeTransactionParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.Error(w, err) + return + } + t, err := ss.Transaction.CommitTransaction(id) + if err != nil { + respond.Error(w, err) + return + } + m := &models.SpoeTransaction{ + ID: t.ID, + Version: t.Version, + Status: t.Status, + } + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, m) + return + } + respond.Accepted(w, h.ReloadAgent.Reload(), m) +} diff --git a/handlers/spoe/version/version.gen.go b/handlers/spoe/version/version.gen.go new file mode 100644 index 00000000..6560e97e --- /dev/null +++ b/handlers/spoe/version/version.gen.go @@ -0,0 +1,323 @@ +// Package version provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package version + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/oapi-codegen/runtime" +) + +// GetSpoeConfigurationVersionParams defines parameters for GetSpoeConfigurationVersion. +type GetSpoeConfigurationVersionParams struct { + // TransactionId ID of the transaction where we want to add the operation. Cannot be used when version is specified. + TransactionId string `form:"transaction_id,omitempty" json:"transaction_id,omitempty,omitzero"` +} + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return a SPOE configuration version + // (GET /services/haproxy/spoe/{parent_name}/version) + GetSpoeConfigurationVersion(w http.ResponseWriter, r *http.Request, parentName string, params GetSpoeConfigurationVersionParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return a SPOE configuration version +// (GET /services/haproxy/spoe/{parent_name}/version) +func (_ Unimplemented) GetSpoeConfigurationVersion(w http.ResponseWriter, r *http.Request, parentName string, params GetSpoeConfigurationVersionParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetSpoeConfigurationVersion operation middleware +func (siw *ServerInterfaceWrapper) GetSpoeConfigurationVersion(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "parent_name" ------------- + var parentName string + + err = runtime.BindStyledParameterWithOptions("simple", "parent_name", chi.URLParam(r, "parent_name"), &parentName, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "parent_name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params GetSpoeConfigurationVersionParams + + // ------------- Optional query parameter "transaction_id" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "transaction_id", r.URL.Query(), ¶ms.TransactionId, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "transaction_id"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "transaction_id", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSpoeConfigurationVersion(w, r, parentName, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/spoe/{parent_name}/version", wrapper.GetSpoeConfigurationVersion) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "zFVNb+M2EP0rxGxOrWy5m0UO6ilI0jaX1miKXGLHYKiRxUAimeHIiWHovxekPhwnTQAXRbEXgSLn4/HN", + "m+EOlK2dNWjYQ7YDQu+s8Rh/vEOlC60ka2tWtc2x8itl69qa1Wg47F9iIZuKr4gsBWdlDaPhsJTOVX2U", + "9NFbE2OrEmsZVieEBWTwJd0jSbtTnx6FAGPqtm0TyNEr0i54QQa/okGSleiwJVCizJHiFS+sKfS6oZhg", + "covkdYfvMMKBmSh0hWLT2yavrsJbh5CBZ9JmHZC0yXEk/m75F9uY/Dsj8K8SRR8Jc0HobUMKxbP0wlgW", + "RYT8v/LaDsfHCxUHhfZR7cMjKoYEXiZrO+k3O9vpoJjxaKJrZykWxUkuIYO15rJ5mCpbp6V0ZF+2jKpM", + "VaXR8MRI1htMN2dpF7EXhTaFjRA0VyHdb+fz4CkuJUsxr6RBcT6/FhNxM//jStyOlAzkZABtAtahkU5D", + "BqfT2fQnSCKmyEjqkTZaoR9Apd5ZTHdOEhpeGVljm272ZVkjv6/On8gNGd+BUAel6l2nEFF0m9d57DW+", + "cRYPCrvH7yTJGjmK5O5tupgmaiDAg8ASZB3NCcSt8DfihwQInxpNmEPG1OBrxTjJjBT87+/uFwtaLMyi", + "mc1OVfziDz+ffAmrr2e7dgHLH08geSey5C2+60thC8ElCiZpvFSRiecSCcVz6AbDgq2QeR6NRl6m4kKa", + "0CcPKBqPeXAZGRTa71trOlz6qUHa7m/9Kt9K55+2xjI5nOFfZ7OjhkkfTxvGNf7jMPhYDUGT32bfPppJ", + "I670383EiCQ+Mv9xhoOnK46Wpq4lbccWEPKTHgjSkesgaAjKh2U3nZA2g8wbqiCDdHMK7bL9OwAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/spoe/version/version.go b/handlers/spoe/version/version.go new file mode 100644 index 00000000..66041d16 --- /dev/null +++ b/handlers/spoe/version/version.go @@ -0,0 +1,64 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "net/http" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" +) + +// RegisterRouter registers all SPOE version routes onto r using spec-based request validation +// and a shared error handler. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SPOE configuration version. +type HandlerImpl struct { + Client client_native.HAProxyClient +} + +func (h *HandlerImpl) GetSpoeConfigurationVersion(w http.ResponseWriter, r *http.Request, parentName string, params GetSpoeConfigurationVersionParams) { + spoeStorage, err := h.Client.Spoe() + if err != nil { + respond.Error(w, err) + return + } + ss, err := spoeStorage.GetSingleSpoe(parentName) + if err != nil { + respond.RuntimeError(w, err) + return + } + v, err := ss.GetConfigurationVersion(params.TransactionId) + if err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, v) +} diff --git a/handlers/spoe_agent.go b/handlers/spoe_agent.go deleted file mode 100644 index 1cbe03f4..00000000 --- a/handlers/spoe_agent.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeCreateSpoeAgentHandlerImpl implementation of the SpoeCreateSpoeAgentHandler interface -type SpoeCreateSpoeAgentHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeCreateSpoeAgentHandlerImpl) Handle(params spoe.CreateSpoeAgentParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.CreateAgent(params.ScopeName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewCreateSpoeAgentCreated().WithPayload(spoe.NewCreateSpoeAgentCreated().Payload) -} - -// SpoeDeleteSpoeAgentHandlerImpl implementation of the SpoeDeleteSpoeAgentHandler interface -type SpoeDeleteSpoeAgentHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeDeleteSpoeAgentHandlerImpl) Handle(params spoe.DeleteSpoeAgentParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.DeleteAgent(params.ScopeName, params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewDeleteSpoeAgentNoContent() -} - -// SpoeGetAllSpoeAgentHandlerImpl implementation of the SpoeGetSpoeAgentsHandler interface -type SpoeGetAllSpoeAgentHandlerImpl struct { - Client client_native.HAProxyClient -} - -// SpoeGetAllSpoeFilesHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler -func (h *SpoeGetAllSpoeAgentHandlerImpl) Handle(params spoe.GetAllSpoeAgentParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, agents, err := ss.GetAgents(params.ScopeName, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetAllSpoeAgentOK().WithPayload(agents) -} - -// SpoeGetSpoeAgentHandlerImpl implementation of the SpoeGetSpoeAgentHandler interface -type SpoeGetSpoeAgentHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeGetSpoeAgentHandlerImpl) Handle(params spoe.GetSpoeAgentParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, agent, err := ss.GetAgent(params.ScopeName, params.Name, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - if agent == nil { - return spoe.NewGetSpoeAgentNotFound() - } - return spoe.NewGetSpoeAgentOK().WithPayload(agent) -} - -// SpoeReplaceSpoeAgentHandlerImpl implementation of the SpoeReplaceSpoeAgentHandler interface -type SpoeReplaceSpoeAgentHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeReplaceSpoeAgentHandlerImpl) Handle(params spoe.ReplaceSpoeAgentParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.EditAgent(params.ScopeName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeAgentDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewReplaceSpoeAgentOK() -} diff --git a/handlers/spoe_group.go b/handlers/spoe_group.go deleted file mode 100644 index 32191a11..00000000 --- a/handlers/spoe_group.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeCreateSpoeGroupHandlerImpl implementation of the SpoeCreateSpoeGroupHandler interface -type SpoeCreateSpoeGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeCreateSpoeGroupHandlerImpl) Handle(params spoe.CreateSpoeGroupParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.CreateGroup(params.ScopeName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewCreateSpoeGroupCreated().WithPayload(spoe.NewCreateSpoeGroupCreated().Payload) -} - -// SpoeDeleteSpoeGroupHandlerImpl implementation of the SpoeDeleteSpoeGroupHandler interface -type SpoeDeleteSpoeGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeDeleteSpoeGroupHandlerImpl) Handle(params spoe.DeleteSpoeGroupParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.DeleteGroup(params.ScopeName, params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewDeleteSpoeAgentNoContent() -} - -// SpoeGetAllSpoeGroupHandlerImpl implementation of the SpoeGetSpoeGroupsHandler interface -type SpoeGetAllSpoeGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -// SpoeGetAllSpoeGroupHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler -func (h *SpoeGetAllSpoeGroupHandlerImpl) Handle(params spoe.GetAllSpoeGroupParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, groups, err := ss.GetGroups(params.ScopeName, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetAllSpoeGroupOK().WithPayload(groups) -} - -// SpoeGetSpoeGroupHandlerImpl implementation of the SpoeGetSpoeGroupHandler interface -type SpoeGetSpoeGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeGetSpoeGroupHandlerImpl) Handle(params spoe.GetSpoeGroupParams, c any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, group, err := ss.GetGroup(params.ScopeName, params.Name, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - if group == nil { - return spoe.NewGetSpoeGroupNotFound() - } - return spoe.NewGetSpoeGroupOK().WithPayload(group) -} - -// SpoeReplaceSpoeGroupHandlerImpl implementation of the SpoeReplaceSpoeGroupHandler interface -type SpoeReplaceSpoeGroupHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeReplaceSpoeGroupHandlerImpl) Handle(params spoe.ReplaceSpoeGroupParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.EditGroup(params.ScopeName, params.Data, params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeGroupDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewReplaceSpoeGroupOK() -} diff --git a/handlers/spoe_message.go b/handlers/spoe_message.go deleted file mode 100644 index 3d97c542..00000000 --- a/handlers/spoe_message.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeCreateSpoeMessageHandlerImpl implementation of the SpoeCreateSpoeMessageHandler interface -type SpoeCreateSpoeMessageHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeCreateSpoeMessageHandlerImpl) Handle(params spoe.CreateSpoeMessageParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.CreateMessage(params.ScopeName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewCreateSpoeMessageCreated().WithPayload(spoe.NewCreateSpoeMessageCreated().Payload) -} - -// SpoeDeleteSpoeMessageHandlerImpl implementation of the SpoeDeleteSpoeMessageHandler interface -type SpoeDeleteSpoeMessageHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeDeleteSpoeMessageHandlerImpl) Handle(params spoe.DeleteSpoeMessageParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.DeleteMessage(params.ScopeName, params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewDeleteSpoeAgentNoContent() -} - -// SpoeGetAllSpoeMessageHandlerImpl implementation of the SpoeGetSpoeMessagesHandler interface -type SpoeGetAllSpoeMessageHandlerImpl struct { - Client client_native.HAProxyClient -} - -// SpoeGetAllSpoeMessageHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler -func (h *SpoeGetAllSpoeMessageHandlerImpl) Handle(params spoe.GetAllSpoeMessageParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, messages, err := ss.GetMessages(params.ScopeName, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetAllSpoeMessageOK().WithPayload(messages) -} - -// SpoeGetSpoeMessageHandlerImpl implementation of the SpoeGetSpoeMessageHandler interface -type SpoeGetSpoeMessageHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeGetSpoeMessageHandlerImpl) Handle(params spoe.GetSpoeMessageParams, c any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, message, err := ss.GetMessage(params.ScopeName, params.Name, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - if message == nil { - return spoe.NewGetSpoeMessageNotFound() - } - return spoe.NewGetSpoeMessageOK().WithPayload(message) -} - -// SpoeReplaceSpoeMessageHandlerImpl implementation of the SpoeReplaceSpoeMessageHandler interface -type SpoeReplaceSpoeMessageHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeReplaceSpoeMessageHandlerImpl) Handle(params spoe.ReplaceSpoeMessageParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.EditMessage(params.ScopeName, params.Data, params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewReplaceSpoeMessageDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewReplaceSpoeMessageOK() -} diff --git a/handlers/spoe_scope.go b/handlers/spoe_scope.go deleted file mode 100644 index 0c124ae3..00000000 --- a/handlers/spoe_scope.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeCreateSpoeScopeHandlerImpl implementation of the SpoeCreateSpoeScopeHandler interface -type SpoeCreateSpoeScopeHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeCreateSpoeScopeHandlerImpl) Handle(params spoe.CreateSpoeScopeParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.CreateScope(¶ms.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewCreateSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewCreateSpoeScopeCreated().WithPayload(spoe.NewCreateSpoeScopeCreated().Payload) -} - -// SpoeDeleteSpoeScopeHandlerImpl implementation of the SpoeDeleteSpoeScopeHandler interface -type SpoeDeleteSpoeScopeHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeDeleteSpoeScopeHandlerImpl) Handle(params spoe.DeleteSpoeScopeParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - v := int64(0) - if params.Version != nil { - v = *params.Version - } - err = ss.DeleteScope(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return spoe.NewDeleteSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewDeleteSpoeScopeNoContent() -} - -// SpoeGetAllSpoeScopeHandlerImpl implementation of the SpoeGetSpoeScopesHandler interface -type SpoeGetAllSpoeScopeHandlerImpl struct { - Client client_native.HAProxyClient -} - -// SpoeGetAllSpoeFilesHandlerImpl implementation of the SpoeGetAllSpoeFilesHandler -func (h *SpoeGetAllSpoeScopeHandlerImpl) Handle(params spoe.GetAllSpoeScopeParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, scopes, err := ss.GetScopes(t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetAllSpoeFilesDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetAllSpoeScopeOK().WithPayload(scopes) -} - -// SpoeGetSpoeScopeHandlerImpl implementation of the SpoeGetSpoeScopeHandler interface -type SpoeGetSpoeScopeHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *SpoeGetSpoeScopeHandlerImpl) Handle(params spoe.GetSpoeScopeParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - _, scope, err := ss.GetScope(params.Name, t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - if scope == nil { - return spoe.NewGetSpoeScopeNotFound() - } - return spoe.NewGetSpoeScopeOK().WithPayload(*scope) -} diff --git a/handlers/spoe_transaction.go b/handlers/spoe_transaction.go deleted file mode 100644 index d545b7f0..00000000 --- a/handlers/spoe_transaction.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe_transactions" -) - -// SpoeTransactionsStartSpoeTransactionHandlerImpl implementation of the SpoeTransactionsStartSpoeTransactionHandler interface -type SpoeTransactionsStartSpoeTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *SpoeTransactionsStartSpoeTransactionHandlerImpl) Handle(params spoe_transactions.StartSpoeTransactionParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - t, err := ss.Transaction.StartTransaction(params.Version) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - m := &models.SpoeTransaction{ - ID: t.ID, - Version: t.Version, - Status: t.Status, - } - return spoe_transactions.NewStartSpoeTransactionCreated().WithPayload(m) -} - -// SpoeTransactionsDeleteSpoeTransactionHandlerImpl implementation of the DeleteTransactionHandler interface -type SpoeTransactionsDeleteSpoeTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *SpoeTransactionsDeleteSpoeTransactionHandlerImpl) Handle(params spoe_transactions.DeleteSpoeTransactionParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - err = ss.Transaction.DeleteTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewDeleteSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - return spoe_transactions.NewDeleteSpoeTransactionNoContent() -} - -// SpoeTransactionsGetSpoeTransactionHandlerImpl implementation of the SpoeTransactionsGetSpoeTransactionHandler interface -type SpoeTransactionsGetSpoeTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *SpoeTransactionsGetSpoeTransactionHandlerImpl) Handle(params spoe_transactions.GetSpoeTransactionParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - t, err := ss.Transaction.GetTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - m := &models.SpoeTransaction{ - ID: t.ID, - Version: t.Version, - Status: t.Status, - } - return spoe_transactions.NewGetSpoeTransactionOK().WithPayload(m) -} - -// SpoeTransactionsGetAllSpoeTransactionHandlerImpl implementation of the SpoeTransactionsGetSpoeTransactionsHandler interface -type SpoeTransactionsGetAllSpoeTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *SpoeTransactionsGetAllSpoeTransactionHandlerImpl) Handle(params spoe_transactions.GetAllSpoeTransactionParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewGetAllSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewGetAllSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - s := "" - if params.Status != nil { - s = *params.Status - } - ts, err := ss.Transaction.GetTransactions(s) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewGetAllSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - var ms models.SpoeTransactions - if *ts != nil && len(*ts) > 0 { - for _, t := range *ts { - m := &models.SpoeTransaction{ - Version: t.Version, - ID: t.ID, - Status: t.Status, - } - ms = append(ms, m) - } - } - return spoe_transactions.NewGetAllSpoeTransactionOK().WithPayload(ms) -} - -// SpoeTransactionsCommitSpoeTransactionHandlerImpl implementation of the SpoeTransactionsCommitSpoeTransactionHandler interface -type SpoeTransactionsCommitSpoeTransactionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *SpoeTransactionsCommitSpoeTransactionHandlerImpl) Handle(params spoe_transactions.CommitSpoeTransactionParams, principal any) middleware.Responder { - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewStartSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - t, err := ss.Transaction.CommitTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewCommitSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - m := &models.SpoeTransaction{ - ID: t.ID, - Version: t.Version, - Status: t.Status, - } - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return spoe_transactions.NewCommitSpoeTransactionDefault(int(*e.Code)).WithPayload(e) - } - return spoe_transactions.NewCommitSpoeTransactionOK().WithPayload(m) - } - rID := h.ReloadAgent.Reload() - return spoe_transactions.NewCommitSpoeTransactionAccepted().WithReloadID(rID).WithPayload(m) -} diff --git a/handlers/spoe_version.go b/handlers/spoe_version.go deleted file mode 100644 index 8847da2d..00000000 --- a/handlers/spoe_version.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/spoe" -) - -// SpoeGetSpoeConfigurationVersionHandlerImpl implementation of the SpoeGetSpoeConfigurationVersionHandler interface -type SpoeGetSpoeConfigurationVersionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *SpoeGetSpoeConfigurationVersionHandlerImpl) Handle(params spoe.GetSpoeConfigurationVersionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - spoeStorage, err := h.Client.Spoe() - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeScopeDefault(int(*e.Code)).WithPayload(e) - } - - ss, err := spoeStorage.GetSingleSpoe(params.ParentName) - if err != nil { - status := misc.GetHTTPStatusFromErr(err) - return spoe.NewGetSpoeScopeDefault(status).WithPayload(misc.SetError(status, err.Error())) - } - v, err := ss.GetConfigurationVersion(t) - if err != nil { - e := misc.HandleError(err) - return spoe.NewGetSpoeConfigurationVersionDefault(int(*e.Code)).WithPayload(e) - } - return spoe.NewGetSpoeConfigurationVersionOK().WithPayload(v) -} diff --git a/handlers/ssl_ca_runtime.go b/handlers/ssl_ca_runtime.go deleted file mode 100644 index 3d113d68..00000000 --- a/handlers/ssl_ca_runtime.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "io" - - oapi "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/dataplaneapi/misc" - ssl_runtime "github.com/haproxytech/dataplaneapi/operations/s_s_l_runtime" -) - -type GetAllCaFilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetAllCaFilesHandlerImpl) Handle(params ssl_runtime.GetAllCaFilesParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCaFilesDefault(int(*e.Code)).WithPayload(e) - } - - files, err := runtime.ShowCAFiles() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCaFilesDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetAllCaFilesOK().WithPayload(files) -} - -type CreateCaFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h CreateCaFileHandlerImpl) Handle(params ssl_runtime.CreateCaFileParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCaFileDefault(int(*e.Code)).WithPayload(e) - } - - file, ok := params.FileUpload.(*oapi.File) - if !ok { - return ssl_runtime.NewCreateCaFileBadRequest() - } - - // Create a new empty file. - if err = runtime.NewCAFile(file.Header.Filename); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCaFileDefault(int(*e.Code)).WithPayload(e) - } - - // Set its contents. - payload, err := io.ReadAll(file) - file.Close() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCaFileDefault(int(*e.Code)).WithPayload(e) - } - if err = runtime.SetCAFile(file.Header.Filename, string(payload)); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCaFileDefault(int(*e.Code)).WithPayload(e) - } - - // Commit. - if err = runtime.CommitCAFile(file.Header.Filename); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCaFileDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewCreateCaFileCreated() -} - -type GetCaFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetCaFileHandlerImpl) Handle(params ssl_runtime.GetCaFileParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCaFileDefault(int(*e.Code)).WithPayload(e) - } - - caFile, err := runtime.GetCAFile(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCaFileDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetCaFileOK().WithPayload(caFile) -} - -type SetCaFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h SetCaFileHandlerImpl) Handle(params ssl_runtime.SetCaFileParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewSetCaFileDefault(int(*e.Code)).WithPayload(e) - } - - payload, err := io.ReadAll(params.FileUpload) - params.FileUpload.Close() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewSetCaFileDefault(int(*e.Code)).WithPayload(e) - } - if err = runtime.SetCAFile(params.Name, string(payload)); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewSetCaFileDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.CommitCAFile(params.Name); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewSetCaFileDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewCreateCaFileCreated() -} - -type DeleteCaFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h DeleteCaFileHandlerImpl) Handle(params ssl_runtime.DeleteCaFileParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCaFileDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.DeleteCAFile(params.Name); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCaFileDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewDeleteCaFileNoContent() -} - -type AddCaEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h AddCaEntryHandlerImpl) Handle(params ssl_runtime.AddCaEntryParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCaEntryDefault(int(*e.Code)).WithPayload(e) - } - - payload, err := io.ReadAll(params.FileUpload) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCaEntryDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.AddCAFileEntry(params.Name, string(payload)); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCaEntryDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.CommitCAFile(params.Name); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCaEntryDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewAddCaEntryCreated() -} - -type GetCaEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetCaEntryHandlerImpl) Handle(params ssl_runtime.GetCaEntryParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCaEntryDefault(int(*e.Code)).WithPayload(e) - } - entry, err := runtime.ShowCAFile(params.Name, ¶ms.Index) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCaEntryDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetCaEntryOK().WithPayload(entry) -} diff --git a/handlers/ssl_cert_storage.go b/handlers/ssl_cert_storage.go deleted file mode 100644 index 9f4100a1..00000000 --- a/handlers/ssl_cert_storage.go +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "bufio" - "bytes" - "fmt" - "io" - "path/filepath" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - client_native "github.com/haproxytech/client-native/v6" - models "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/storage" -) - -// StorageGetAllStorageSSLCertificatesHandlerImpl implementation of the StorageGetAllStorageSSLCertificatesHandler interface -type StorageGetAllStorageSSLCertificatesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *StorageGetAllStorageSSLCertificatesHandlerImpl) Handle(params storage.GetAllStorageSSLCertificatesParams, principal any) middleware.Responder { - sslStorage, err := h.Client.SSLCertStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageSSLCertificatesDefault(int(*e.Code)).WithPayload(e) - } - - filelist, err := sslStorage.GetAll() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageSSLCertificatesDefault(int(*e.Code)).WithPayload(e) - } - - retFiles := []*models.SslCertificate{} - for _, f := range filelist { - retFiles = append(retFiles, &models.SslCertificate{ - File: f, - Description: "managed SSL file", - StorageName: filepath.Base(f), - }) - } - return &storage.GetAllStorageSSLCertificatesOK{Payload: retFiles} -} - -// StorageGetOneStorageMapHandlerImpl implementation of the StorageGetOneStorageSSLCertificateHandler interface -type StorageGetOneStorageSSLCertificateHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageGetOneStorageSSLCertificateHandlerImpl) Handle(params storage.GetOneStorageSSLCertificateParams, principal any) middleware.Responder { - sslStorage, err := h.Client.SSLCertStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - filename, size, err := sslStorage.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - if filename == "" { - return storage.NewGetOneStorageSSLCertificateNotFound() - } - info, err := sslStorage.GetCertificatesInfo(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - retf := &models.SslCertificate{ - File: filename, - Description: "managed SSL file", - StorageName: filepath.Base(filename), - Size: &size, - NotAfter: (*strfmt.DateTime)(info.NotAfter), - NotBefore: (*strfmt.DateTime)(info.NotBefore), - Issuers: info.Issuers, - Domains: info.DNS, - IPAddresses: info.IPs, - Subject: info.Subject, - Serial: info.Serial, - } - return storage.NewGetOneStorageSSLCertificateOK().WithPayload(retf) -} - -// StorageDeleteStorageSSLCertificateHandlerImpl implementation of the StorageDeleteStorageSSLCertificateHandler interface -type StorageDeleteStorageSSLCertificateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageDeleteStorageSSLCertificateHandlerImpl) Handle(params storage.DeleteStorageSSLCertificateParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - runningConf := strings.NewReader(configuration.Parser().String()) - - sslStorage, err := h.Client.SSLCertStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - filename, _, err := sslStorage.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - // this is far from perfect but should provide a basic level of protection - scanner := bufio.NewScanner(runningConf) - - lineNr := 0 - - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { - errCode := misc.ErrHTTPConflict - errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) - e := &models.Error{Code: &errCode, Message: &errMsg} - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - lineNr++ - } - - err = sslStorage.Delete(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewDeleteStorageSSLCertificateNoContent() - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewDeleteStorageSSLCertificateNoContent() - } - - if runtime, err := h.Client.Runtime(); err != nil { - if err = runtime.DeleteCertEntry(params.Name); err == nil { - return storage.NewDeleteStorageSSLCertificateNoContent() - } - log.Debugf("failed to delete certificate via runtime, reloading instead: %s", err.Error()) - } - - rID := h.ReloadAgent.Reload() - return storage.NewDeleteStorageSSLCertificateAccepted().WithReloadID(rID) -} - -// StorageReplaceStorageSSLCertificateHandlerImpl implementation of the StorageReplaceStorageSSLCertificateHandler interface -type StorageReplaceStorageSSLCertificateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageReplaceStorageSSLCertificateHandlerImpl) Handle(params storage.ReplaceStorageSSLCertificateParams, principal any) middleware.Responder { - sslStorage, err := h.Client.SSLCertStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - filename, err := sslStorage.Replace(params.Name, params.Data) - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - info, err := sslStorage.GetCertificatesInfo(filename) - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - retf := &models.SslCertificate{ - File: filename, - Description: "managed SSL file", - StorageName: filepath.Base(filename), - Size: misc.Int64P(len(params.Data)), - NotAfter: (*strfmt.DateTime)(info.NotAfter), - NotBefore: (*strfmt.DateTime)(info.NotBefore), - Issuers: info.Issuers, - Domains: info.DNS, - IPAddresses: info.IPs, - Subject: info.Subject, - Serial: info.Serial, - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewReplaceStorageSSLCertificateOK().WithPayload(retf) - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewReplaceStorageSSLCertificateOK().WithPayload(retf) - } - - // Try to push the new cert to HAProxy using the runtime socket. - err = pushCertToRuntime(h.Client, filename, params.Data, false) - if err != nil { - log.Debugf("failed to push certificate via runtime, reloading instead: %s", err.Error()) - rID := h.ReloadAgent.Reload() - return storage.NewReplaceStorageSSLCertificateAccepted().WithReloadID(rID).WithPayload(retf) - } - - return storage.NewReplaceStorageSSLCertificateOK().WithPayload(retf) -} - -// StorageCreateStorageSSLCertificateHandlerImpl implementation of the StorageCreateStorageSSLCertificateHandler interface -type StorageCreateStorageSSLCertificateHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageCreateStorageSSLCertificateHandlerImpl) Handle(params storage.CreateStorageSSLCertificateParams, principal any) middleware.Responder { - sslStorage, err := h.Client.SSLCertStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - file, ok := params.FileUpload.(*runtime.File) - if !ok { - return storage.NewCreateStorageSSLCertificateBadRequest() - } - - // We need to read the cert here because we are going to write it twice: - // once to the filesystem, and (optionally) to HAProxy's runtime socket. - certBody, err := io.ReadAll(file) - file.Close() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - - filename, size, err := sslStorage.Create(file.Header.Filename, io.NopCloser(bytes.NewReader(certBody))) - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - info, err := sslStorage.GetCertificatesInfo(filename) - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - retf := &models.SslCertificate{ - File: filename, - Description: "managed SSL file", - StorageName: filepath.Base(filename), - Size: &size, - NotAfter: (*strfmt.DateTime)(info.NotAfter), - NotBefore: (*strfmt.DateTime)(info.NotBefore), - Issuers: info.Issuers, - Domains: info.DNS, - IPAddresses: info.IPs, - Subject: info.Subject, - Serial: info.Serial, - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewCreateStorageSSLCertificateCreated().WithPayload(retf) - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCertificateDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewCreateStorageSSLCertificateCreated().WithPayload(retf) - } - - // Try to push the new cert to HAProxy using the runtime socket. - err = pushCertToRuntime(h.Client, filename, string(certBody), true) - if err != nil { - log.Debugf("failed to push certificate via runtime, reloading instead: %s", err.Error()) - rID := h.ReloadAgent.Reload() - return storage.NewCreateStorageSSLCertificateAccepted().WithReloadID(rID).WithPayload(retf) - } - - return storage.NewCreateStorageSSLCertificateCreated().WithPayload(retf) -} - -func pushCertToRuntime(c client_native.HAProxyClient, filename, body string, newCert bool) error { - runtime, err := c.Runtime() - if err != nil { - return err - } - - if newCert { - err = runtime.NewCertEntry(filename) - if err != nil { - return err - } - } - - err = runtime.SetCertEntry(filename, body) - if err != nil { - return err - } - - return runtime.CommitCertEntry(filename) -} diff --git a/handlers/ssl_certs_runtime.go b/handlers/ssl_certs_runtime.go deleted file mode 100644 index 51c337f2..00000000 --- a/handlers/ssl_certs_runtime.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "io" - - oapi "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/dataplaneapi/misc" - ssl_runtime "github.com/haproxytech/dataplaneapi/operations/s_s_l_runtime" -) - -type GetAllCertsHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetAllCertsHandlerImpl) Handle(params ssl_runtime.GetAllCertsParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCertsDefault(int(*e.Code)).WithPayload(e) - } - - files, err := runtime.ShowCerts() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCertsDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetAllCertsOK().WithPayload(files) -} - -type CreateCertHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h CreateCertHandlerImpl) Handle(params ssl_runtime.CreateCertParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCertDefault(int(*e.Code)).WithPayload(e) - } - - file, ok := params.FileUpload.(*oapi.File) - if !ok { - return ssl_runtime.NewCreateCertBadRequest() - } - - payload, err := io.ReadAll(file) - file.Close() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.NewCertEntry(file.Header.Filename) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetCertEntry(file.Header.Filename, string(payload)) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.CommitCertEntry(file.Header.Filename) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCertDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewCreateCertCreated() -} - -type GetCertHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetCertHandlerImpl) Handle(params ssl_runtime.GetCertParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCertDefault(int(*e.Code)).WithPayload(e) - } - - cert, err := runtime.ShowCertificate(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCertDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetCertOK().WithPayload(cert) -} - -type ReplaceCertHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h ReplaceCertHandlerImpl) Handle(params ssl_runtime.ReplaceCertParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCertDefault(int(*e.Code)).WithPayload(e) - } - - payload, err := io.ReadAll(params.FileUpload) - params.FileUpload.Close() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetCertEntry(params.Name, string(payload)) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.CommitCertEntry(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCertDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewReplaceCertOK() -} - -// api.SslRuntimeDeleteCertHandler = nil -type DeleteCertHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h DeleteCertHandlerImpl) Handle(params ssl_runtime.DeleteCertParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCertDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.DeleteCertEntry(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCertDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewDeleteCertNoContent() -} diff --git a/handlers/ssl_crl_lists_runtime.go b/handlers/ssl_crl_lists_runtime.go deleted file mode 100644 index a2253ed2..00000000 --- a/handlers/ssl_crl_lists_runtime.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "io" - - oapi "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/dataplaneapi/misc" - ssl_runtime "github.com/haproxytech/dataplaneapi/operations/s_s_l_runtime" -) - -type GetAllCrlHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetAllCrlHandlerImpl) Handle(params ssl_runtime.GetAllCrlParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrlDefault(int(*e.Code)).WithPayload(e) - } - - files, err := runtime.ShowCrlFiles() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrlDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetAllCrlOK().WithPayload(files) -} - -type CreateCrlHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h CreateCrlHandlerImpl) Handle(params ssl_runtime.CreateCrlParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCrlDefault(int(*e.Code)).WithPayload(e) - } - - file, ok := params.FileUpload.(*oapi.File) - if !ok { - return ssl_runtime.NewCreateCaFileBadRequest() - } - - payload, err := io.ReadAll(file) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCrlDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.NewCrlFile(file.Header.Filename) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCrlDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetCrlFile(file.Header.Filename, string(payload)) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCrlDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.CommitCrlFile(file.Header.Filename) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewCreateCrlDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewCreateCrlCreated() -} - -type GetCrlHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetCrlHandlerImpl) Handle(params ssl_runtime.GetCrlParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCrlDefault(int(*e.Code)).WithPayload(e) - } - - entries, err := runtime.ShowCrlFile(params.Name, params.Index) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetCrlDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetCrlOK().WithPayload(*entries) -} - -type ReplaceCrlHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h ReplaceCrlHandlerImpl) Handle(params ssl_runtime.ReplaceCrlParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCrlDefault(int(*e.Code)).WithPayload(e) - } - - payload, err := io.ReadAll(params.FileUpload) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCrlDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetCrlFile(params.Name, string(payload)) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCrlDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.CommitCrlFile(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewReplaceCrlDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewReplaceCrlOK() -} - -type DeleteCrlHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h DeleteCrlHandlerImpl) Handle(params ssl_runtime.DeleteCrlParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCrlDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.DeleteCrlFile(params.Name); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCrlDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewDeleteCrlNoContent() -} diff --git a/handlers/ssl_crt_list_storage.go b/handlers/ssl_crt_list_storage.go deleted file mode 100644 index 2c8e8a53..00000000 --- a/handlers/ssl_crt_list_storage.go +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "bufio" - "errors" - "fmt" - "io" - "os" - "path/filepath" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconf "github.com/haproxytech/client-native/v6/configuration" - models "github.com/haproxytech/client-native/v6/models" - cnruntime "github.com/haproxytech/client-native/v6/runtime" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/log" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/storage" -) - -type StorageGetAllStorageSSLCrtListFilesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *StorageGetAllStorageSSLCrtListFilesHandlerImpl) Handle(params storage.GetAllStorageSSLCrtListFilesParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageSSLCrtListFilesDefault(int(*e.Code)).WithPayload(e) - } - - filelist, err := crtListStorage.GetAll() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetAllStorageSSLCrtListFilesDefault(int(*e.Code)).WithPayload(e) - } - - retFiles := models.SslCrtListFiles{} - for _, f := range filelist { - retFiles = append(retFiles, &models.SslCrtListFile{ - File: f, - Description: "managed certificate list", - StorageName: filepath.Base(f), - }) - } - return &storage.GetAllStorageSSLCrtListFilesOK{Payload: retFiles} -} - -type StorageGetOneStorageSSLCrtListFileHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageGetOneStorageSSLCrtListFileHandlerImpl) Handle(params storage.GetOneStorageSSLCrtListFileParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, _, err := crtListStorage.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - if filename == "" { - return storage.NewGetOneStorageSSLCrtListFileNotFound() - } - - f, err := os.Open(filename) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetOneStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - return storage.NewGetOneStorageSSLCrtListFileOK().WithPayload(f) -} - -type StorageDeleteStorageSSLCrtListFileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageDeleteStorageSSLCrtListFileHandlerImpl) Handle(params storage.DeleteStorageSSLCrtListFileParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - runningConf := strings.NewReader(configuration.Parser().String()) - - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, _, err := crtListStorage.Get(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - // this is far from perfect but should provide a basic level of protection - scanner := bufio.NewScanner(runningConf) - - lineNr := 0 - - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if len(line) > 0 && line[0] != '#' && strings.Contains(line, filename) { - errCode := misc.ErrHTTPConflict - errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) - e := &models.Error{Code: &errCode, Message: &errMsg} - return storage.NewDeleteStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - lineNr++ - } - - err = crtListStorage.Delete(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewDeleteStorageSSLCrtListFileNoContent() - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewDeleteStorageSSLCrtListFileNoContent() - } - - rID := h.ReloadAgent.Reload() - return storage.NewDeleteStorageSSLCrtListFileAccepted().WithReloadID(rID) -} - -type StorageReplaceStorageSSLCrtListFileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageReplaceStorageSSLCrtListFileHandlerImpl) Handle(params storage.ReplaceStorageSSLCrtListFileParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - filename, err := crtListStorage.Replace(params.Name, params.Data) - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - retf := &models.SslCrtListFile{ - File: filename, - Description: "managed certificate list", - StorageName: filepath.Base(filename), - Size: misc.Int64P(len(params.Data)), - } - - skipReload := false - if params.SkipReload != nil { - skipReload = *params.SkipReload - } - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if skipReload { - return storage.NewReplaceStorageSSLCrtListFileOK().WithPayload(retf) - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewReplaceStorageSSLCrtListFileOK().WithPayload(retf) - } - - rID := h.ReloadAgent.Reload() - return storage.NewReplaceStorageSSLCrtListFileAccepted().WithReloadID(rID).WithPayload(retf) -} - -type StorageCreateStorageSSLCrtListFileHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageCreateStorageSSLCrtListFileHandlerImpl) Handle(params storage.CreateStorageSSLCrtListFileParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - file, ok := params.FileUpload.(*runtime.File) - if !ok { - return storage.NewCreateStorageSSLCrtListFileBadRequest() - } - filename, size, err := crtListStorage.Create(file.Header.Filename, params.FileUpload) - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCrtListFileDefault(int(*e.Code)).WithPayload(e) - } - - retf := &models.SslCrtListFile{ - File: filename, - Description: "managed certificate list", - StorageName: filepath.Base(filename), - Size: &size, - } - - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewReplaceStorageMapFileDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewCreateStorageSSLCrtListFileCreated().WithPayload(retf) - } - rID := h.ReloadAgent.Reload() - return storage.NewCreateStorageSSLCrtListFileAccepted().WithReloadID(rID).WithPayload(retf) -} - -// -// crt-list entries -// - -type StorageGetStorageSSLCrtListEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h *StorageGetStorageSSLCrtListEntriesHandlerImpl) Handle(params storage.GetStorageSSLCrtListEntriesParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewGetStorageSSLCrtListEntriesDefault(int(*e.Code)).WithPayload(e) - } - contents, err := crtListStorage.GetContents(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetStorageSSLCrtListEntriesDefault(int(*e.Code)).WithPayload(e) - } - entries, err := cnruntime.ParseCrtListEntries(contents) - if err != nil { - e := misc.HandleError(err) - return storage.NewGetStorageSSLCrtListEntriesDefault(int(*e.Code)).WithPayload(e) - } - - return storage.NewGetStorageSSLCrtListEntriesOK().WithPayload(entries) -} - -type StorageCreateStorageSSLCrtListEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *StorageCreateStorageSSLCrtListEntryHandlerImpl) Handle(params storage.CreateStorageSSLCrtListEntryParams, principal any) middleware.Responder { - entry := params.Data - if entry.File == "" { - e := misc.SetError(400, "missing certificate file name") - return storage.NewCreateStorageSSLCrtListEntryBadRequest().WithPayload(e) - } - - // Serialize the entry to a single line. - var sb strings.Builder - sb.Grow(len(entry.File) + len(entry.SSLBindConfig) + 32) - sb.WriteString(entry.File) - if entry.SSLBindConfig != "" { - sb.WriteString(" [") - sb.WriteString(entry.SSLBindConfig) - sb.WriteByte(']') - } - if len(entry.SNIFilter) > 0 { - sb.WriteByte(' ') - sb.WriteString(strings.Join(entry.SNIFilter, " ")) - } - sb.WriteByte('\n') - line := sb.String() - - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - // Append the entry to the crt-list file. - content, err := crtListStorage.GetContents(params.Name) - if err == nil { - _, err = crtListStorage.Replace(params.Name, content+line) - } else if errors.Is(err, cnconf.ErrObjectDoesNotExist) { - _, _, err = crtListStorage.Create(params.Name, io.NopCloser(strings.NewReader(line))) - } - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - // Try to add the entry to the HAProxy runtime. Force the reload if that fails. - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - rt, err := h.Client.Runtime() - if err != nil { - forceReload = true - } else { - if errAdd := rt.AddCrtListEntry(params.Name, *entry); errAdd != nil { - log.Warning("failed to add crt-list entry via runtime: ", errAdd) - forceReload = true - } - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewCreateStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewCreateStorageSSLCrtListEntryCreated().WithPayload(entry) - } - rID := h.ReloadAgent.Reload() - return storage.NewCreateStorageSSLCrtListEntryAccepted().WithReloadID(rID) -} - -type StorageDeleteStorageSSLCrtListEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Delete an entry in a crt-list. If the line_number is not provided, -// delete the first match, which is what the runtime API does. -func (h *StorageDeleteStorageSSLCrtListEntryHandlerImpl) Handle(params storage.DeleteStorageSSLCrtListEntryParams, principal any) middleware.Responder { - crtListStorage, err := h.Client.CrtListStorage() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - // Modify the crt-file on storage. - content, err := crtListStorage.GetContents(params.Name) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - lineno := int64(0) - firstMatch := params.LineNumber > 0 - var sb strings.Builder // the modified contents - sb.Grow(len(content)) - strings.SplitSeq(content, "\n")(func(line string) bool { - lineno++ - if strings.HasPrefix(line, params.Certificate) { - if params.LineNumber == lineno || firstMatch { - // skip that line - firstMatch = false - return true - } - } - sb.WriteString(line) - sb.WriteByte('\n') - return true - }) - _, err = crtListStorage.Replace(params.Name, sb.String()) - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - // Try to delete the entry with the HAProxy runtime. Force the reload if that fails. - forceReload := false - if params.ForceReload != nil { - forceReload = *params.ForceReload - } - rt, err := h.Client.Runtime() - if err != nil { - forceReload = true - } else { - num := ¶ms.LineNumber - if params.LineNumber == 0 { - num = nil - } - if errDel := rt.DeleteCrtListEntry(params.Name, params.Certificate, num); errDel != nil { - log.Warning("failed to delete crt-list entry via runtime: ", errDel) - forceReload = true - } - } - - if forceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return storage.NewDeleteStorageSSLCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - return storage.NewDeleteStorageSSLCrtListEntryNoContent() - } - rID := h.ReloadAgent.Reload() - return storage.NewDeleteStorageSSLCrtListEntryAccepted().WithReloadID(rID) -} diff --git a/handlers/ssl_crt_lists_runtime.go b/handlers/ssl_crt_lists_runtime.go deleted file mode 100644 index 4fd069f4..00000000 --- a/handlers/ssl_crt_lists_runtime.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/dataplaneapi/misc" - ssl_runtime "github.com/haproxytech/dataplaneapi/operations/s_s_l_runtime" -) - -type GetAllCrtListsHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetAllCrtListsHandlerImpl) Handle(params ssl_runtime.GetAllCrtListsParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrtListsDefault(int(*e.Code)).WithPayload(e) - } - - files, err := runtime.ShowCrtLists() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrtListsDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetAllCrtListsOK().WithPayload(files) -} - -type GetAllCrtListEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h GetAllCrtListEntriesHandlerImpl) Handle(params ssl_runtime.GetAllCrtListEntriesParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrtListEntriesDefault(int(*e.Code)).WithPayload(e) - } - - crtList, err := runtime.ShowCrtListEntries(params.Name) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewGetAllCrtListEntriesDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewGetAllCrtListEntriesOK().WithPayload(crtList) -} - -type AddCrtListEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h AddCrtListEntryHandlerImpl) Handle(params ssl_runtime.AddCrtListEntryParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.AddCrtListEntry(params.Name, *params.Data) - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewAddCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewAddCrtListEntryCreated() -} - -type DeleteCrtListEntryHandlerImpl struct { - Client client_native.HAProxyClient -} - -func (h DeleteCrtListEntryHandlerImpl) Handle(params ssl_runtime.DeleteCrtListEntryParams, i any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - if err = runtime.DeleteCrtListEntry(params.Name, params.CertFile, params.LineNumber); err != nil { - e := misc.HandleError(err) - return ssl_runtime.NewDeleteCrtListEntryDefault(int(*e.Code)).WithPayload(e) - } - - return ssl_runtime.NewDeleteCrtListEntryNoContent() -} diff --git a/handlers/ssl_front_use.go b/handlers/ssl_front_use.go deleted file mode 100644 index 62abee7a..00000000 --- a/handlers/ssl_front_use.go +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2025 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - cn "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - sfu "github.com/haproxytech/dataplaneapi/operations/s_s_l_front_use" -) - -type GetAllSSLFrontUsesHandlerImpl struct { - Client cn.HAProxyClient -} - -func (h GetAllSSLFrontUsesHandlerImpl) Handle(params sfu.GetAllSSLFrontUsesParams, i any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sfu.NewGetAllSSLFrontUsesDefault(int(*e.Code)).WithPayload(e) - } - - _, uses, err := configuration.GetSSLFrontUses(string(parents.FrontendParentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return sfu.NewGetAllSSLFrontUsesDefault(int(*e.Code)).WithPayload(e) - } - - return sfu.NewGetAllSSLFrontUsesOK().WithPayload(uses) -} - -type CreateSSLFrontUseHandlerImpl struct { - Client cn.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h CreateSSLFrontUseHandlerImpl) Handle(params sfu.CreateSSLFrontUseParams, i any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sfu.NewCreateSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sfu.NewCreateSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateSSLFrontUse(string(parents.FrontendParentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return sfu.NewCreateSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sfu.NewCreateSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - return sfu.NewCreateSSLFrontUseCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return sfu.NewCreateSSLFrontUseAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return sfu.NewCreateSSLFrontUseAccepted().WithPayload(params.Data) -} - -type GetSSLFrontUseHandlerImpl struct { - Client cn.HAProxyClient -} - -func (h GetSSLFrontUseHandlerImpl) Handle(params sfu.GetSSLFrontUseParams, i any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sfu.NewGetSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - _, use, err := configuration.GetSSLFrontUse(params.Index, string(parents.FrontendParentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return sfu.NewGetSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - return sfu.NewGetSSLFrontUseOK().WithPayload(use) -} - -type ReplaceSSLFrontUseHandlerImpl struct { - Client cn.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h ReplaceSSLFrontUseHandlerImpl) Handle(params sfu.ReplaceSSLFrontUseParams, i any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sfu.NewReplaceSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sfu.NewReplaceSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditSSLFrontUse(params.Index, string(parents.FrontendParentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return sfu.NewReplaceSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sfu.NewReplaceSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - return sfu.NewReplaceSSLFrontUseOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return sfu.NewReplaceSSLFrontUseAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return sfu.NewReplaceSSLFrontUseOK().WithPayload(params.Data) -} - -type DeleteSSLFrontUseHandlerImpl struct { - Client cn.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h DeleteSSLFrontUseHandlerImpl) Handle(params sfu.DeleteSSLFrontUseParams, i any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return sfu.NewDeleteSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return sfu.NewDeleteSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteSSLFrontUse(params.Index, string(parents.FrontendParentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return sfu.NewDeleteSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return sfu.NewDeleteSSLFrontUseDefault(int(*e.Code)).WithPayload(e) - } - return sfu.NewDeleteSSLFrontUseNoContent() - } - rID := h.ReloadAgent.Reload() - return sfu.NewDeleteSSLFrontUseAccepted().WithReloadID(rID) - } - - return sfu.NewDeleteSSLFrontUseAccepted() -} diff --git a/handlers/stats.go b/handlers/stats.go deleted file mode 100644 index ed8dd461..00000000 --- a/handlers/stats.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/stats" -) - -// GetStatsHandlerImpl implementation of the GetStatsHandler interface using client-native client -type GetStatsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetStatsHandlerImpl) Handle(params stats.GetStatsParams, principal any) middleware.Responder { - if params.Name != nil { - if params.Type == nil { - code := misc.ErrHTTPBadRequest - msg := "Type required when filtering by name" - e := &models.Error{Code: &code, Message: &msg} - return stats.NewGetStatsDefault(int(code)).WithPayload(e) - } else if *params.Type == "server" { - if params.Parent == nil { - code := misc.ErrHTTPBadRequest - msg := "Parent backend required when filtering by server" - e := &models.Error{Code: &code, Message: &msg} - return stats.NewGetStatsDefault(int(code)).WithPayload(e) - } - } - } - - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return stats.NewGetStatsDefault(int(*e.Code)).WithPayload(e) - } - - nStat := runtime.GetStats() - - if nStat.Error != "" { - return stats.NewGetStatsInternalServerError().WithPayload(&nStat) - } - retVal := make([]*models.NativeStat, 0, len(nStat.Stats)) - for _, item := range nStat.Stats { - if params.Name != nil { - if item.Type == "server" { - if item.Name == *params.Name && item.Type == *params.Type && item.BackendName == *params.Parent { - retVal = append(retVal, item) - } - } else if item.Name == *params.Name && item.Type == *params.Type { - retVal = append(retVal, item) - } - } else { - if params.Type != nil { - if *params.Type == "server" && params.Parent != nil { - if item.Type == *params.Type && item.BackendName == *params.Parent { - retVal = append(retVal, item) - } - } else { - if item.Type == *params.Type { - retVal = append(retVal, item) - } - } - } else { - retVal = append(retVal, item) - } - } - } - nStat.Stats = retVal - - return stats.NewGetStatsOK().WithPayload(&nStat) -} diff --git a/handlers/stick_rule.go b/handlers/stick_rule.go deleted file mode 100644 index 358e3df5..00000000 --- a/handlers/stick_rule.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/stick_rule" -) - -// CreateStickRuleHandlerImpl implementation of the CreateStickRuleHandler interface using client-native client -type CreateStickRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteStickRuleHandlerImpl implementation of the DeleteStickRuleHandler interface using client-native client -type DeleteStickRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetStickRuleHandlerImpl implementation of the GetStickRuleHandler interface using client-native client -type GetStickRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetStickRulesHandlerImpl implementation of the GetStickRulesHandler interface using client-native client -type GetStickRulesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceStickRuleHandlerImpl implementation of the ReplaceStickRuleHandler interface using client-native client -type ReplaceStickRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceStickRulesHandlerImpl implementation of the ReplaceStickRulesHandler interface using client-native client -type ReplaceStickRulesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateStickRuleHandlerImpl) Handle(params stick_rule.CreateStickRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_rule.NewCreateStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewCreateStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateStickRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewCreateStickRuleDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewCreateStickRuleDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewCreateStickRuleCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return stick_rule.NewCreateStickRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return stick_rule.NewCreateStickRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteStickRuleHandlerImpl) Handle(params stick_rule.DeleteStickRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_rule.NewDeleteStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewDeleteStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteStickRule(params.Index, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewDeleteStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewDeleteStickRuleDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewDeleteStickRuleNoContent() - } - rID := h.ReloadAgent.Reload() - return stick_rule.NewDeleteStickRuleAccepted().WithReloadID(rID) - } - return stick_rule.NewDeleteStickRuleAccepted() -} - -// Handle executing the request and returning a response -func (h *GetStickRuleHandlerImpl) Handle(params stick_rule.GetStickRuleParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewGetStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetStickRule(params.Index, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewGetStickRuleDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewGetStickRuleOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetStickRulesHandlerImpl) Handle(params stick_rule.GetStickRulesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewGetStickRulesDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetStickRules(params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return stick_rule.NewGetStickRulesOK().WithPayload(models.StickRules{}) - } - return stick_rule.NewGetStickRulesDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewGetStickRulesOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceStickRuleHandlerImpl) Handle(params stick_rule.ReplaceStickRuleParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_rule.NewReplaceStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditStickRule(params.Index, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRuleDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRuleDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewReplaceStickRuleOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return stick_rule.NewReplaceStickRuleAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return stick_rule.NewReplaceStickRuleAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceStickRulesHandlerImpl) Handle(params stick_rule.ReplaceStickRulesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_rule.NewReplaceStickRulesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRulesDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceStickRules(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRulesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return stick_rule.NewReplaceStickRuleDefault(int(*e.Code)).WithPayload(e) - } - return stick_rule.NewReplaceStickRulesOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return stick_rule.NewReplaceStickRulesAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return stick_rule.NewReplaceStickRulesAccepted().WithPayload(params.Data) -} diff --git a/handlers/stick_table.go b/handlers/stick_table.go deleted file mode 100644 index 28806a0b..00000000 --- a/handlers/stick_table.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "fmt" - "strings" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/stick_table" -) - -// GetStickTablesHandlerImpl implementation of the GetStickTablesHandler interface using client-native client -type GetStickTablesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetStickTableHandlerImpl implementation of the GetStickTableHandler interface using client-native client -type GetStickTableHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetStickTableEntriesHandlerImpl implementation of the GetStickTableEntriesHandler interface using client-native client -type GetStickTableEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -type SetStickTableEntriesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *GetStickTablesHandlerImpl) Handle(params stick_table.GetStickTablesParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTablesDefault(int(*e.Code)).WithPayload(e) - } - - stkTS, err := runtime.ShowTables() - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTablesDefault(int(*e.Code)).WithPayload(e) - } - - for _, table := range stkTS { - table.Fields = findTableFields(table.Name, h.Client) - } - - return stick_table.NewGetStickTablesOK().WithPayload(stkTS) -} - -// Handle executing the request and returning a response -func (h *GetStickTableHandlerImpl) Handle(params stick_table.GetStickTableParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTableDefault(int(*e.Code)).WithPayload(e) - } - - stkT, err := runtime.ShowTable(params.Name) - if stkT == nil { - msg := fmt.Sprintf("Stick table %s not found", params.Name) - c := misc.ErrHTTPNotFound - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_table.NewGetStickTableDefault(int(*e.Code)).WithPayload(e) - } - - stkT.Fields = findTableFields(stkT.Name, h.Client) - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTableDefault(int(*e.Code)).WithPayload(e) - } - - return stick_table.NewGetStickTableOK().WithPayload(stkT) -} - -// Handle executing the request and returning a response -func (h *SetStickTableEntriesHandlerImpl) Handle(params stick_table.SetStickTableEntriesParams, principal any) middleware.Responder { - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return stick_table.NewSetStickTableEntriesDefault(int(*e.Code)).WithPayload(e) - } - - err = runtime.SetTableEntry(params.ParentName, *params.StickTableEntry.Key, *params.StickTableEntry.DataType) - if err != nil { - e := misc.HandleError(err) - return stick_table.NewSetStickTableEntriesDefault(int(*e.Code)).WithPayload(e) - } - - return stick_table.NewSetStickTableEntriesNoContent() -} - -// Handle executing the request and returning a response -func (h *GetStickTableEntriesHandlerImpl) Handle(params stick_table.GetStickTableEntriesParams, principal any) middleware.Responder { - filter := make([]string, 0) - if params.Filter != nil { - filter = strings.Split(*params.Filter, ",") - } - - key := "" - if params.Key != nil { - key = *params.Key - } - runtime, err := h.Client.Runtime() - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e) - } - - stkEntries, err := runtime.GetTableEntries(params.ParentName, filter, key) - if err != nil { - e := misc.HandleError(err) - return stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e) - } - - // if no entries return empty array - if len(stkEntries) == 0 { - return stick_table.NewGetStickTableEntriesOK().WithPayload(stkEntries) - } - - // else check for pagination - offset := int64(0) - if params.Offset != nil { - offset = *params.Offset - } - - if int(offset) >= len(stkEntries) { - msg := fmt.Sprintf("Offset %d is larger than the slice size %d", offset, len(stkEntries)) - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e) - } - - if params.Count != nil { - if int(offset+*params.Count) >= len(stkEntries) { - stkEntries = stkEntries[offset:] - } else { - stkEntries = stkEntries[offset : offset+*params.Count] - } - } else { - stkEntries = stkEntries[offset:] - } - return stick_table.NewGetStickTableEntriesOK().WithPayload(stkEntries) -} - -func findTableFields(name string, client client_native.HAProxyClient) []*models.StickTableField { - configuration, err := client.Configuration() - if err != nil { - return nil - } - - _, bck, err := configuration.GetBackend(name, "") - if err != nil { - return nil - } - - if bck.StickTable == nil { - return nil - } - - data := strings.Split(bck.StickTable.Store, ",") - fields := make([]*models.StickTableField, 0) - for _, d := range data { - f := &models.StickTableField{} - spl := strings.Split(d, "(") - if len(spl) == 1 { - f.Field = d - f.Type = "counter" - fields = append(fields, f) - } else if len(spl) == 2 { - p := misc.ParseTimeout(spl[1][:len(spl[1])-1]) - if p != nil { - f.Field = spl[0] - f.Period = *p - f.Type = "rate" - fields = append(fields, f) - } - } - } - - return fields -} diff --git a/handlers/storage/general/general.gen.go b/handlers/storage/general/general.gen.go new file mode 100644 index 00000000..3668ac4e --- /dev/null +++ b/handlers/storage/general/general.gen.go @@ -0,0 +1,501 @@ +// Package general provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package general + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// GeneralFile defines model for general_file. +type GeneralFile = models.GeneralFile + +// GeneralFiles defines model for general_files. +type GeneralFiles = models.GeneralFiles + +// CreateStorageGeneralFileMultipartBody defines parameters for CreateStorageGeneralFile. +type CreateStorageGeneralFileMultipartBody struct { + // FileUpload General use file content + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// ReplaceStorageGeneralFileMultipartBody defines parameters for ReplaceStorageGeneralFile. +type ReplaceStorageGeneralFileMultipartBody struct { + // FileUpload General use file content + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// ReplaceStorageGeneralFileParams defines parameters for ReplaceStorageGeneralFile. +type ReplaceStorageGeneralFileParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateStorageGeneralFileMultipartRequestBody defines body for CreateStorageGeneralFile for multipart/form-data ContentType. +type CreateStorageGeneralFileMultipartRequestBody CreateStorageGeneralFileMultipartBody + +// ReplaceStorageGeneralFileMultipartRequestBody defines body for ReplaceStorageGeneralFile for multipart/form-data ContentType. +type ReplaceStorageGeneralFileMultipartRequestBody ReplaceStorageGeneralFileMultipartBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return a list of all managed general use files + // (GET /services/haproxy/storage/general) + GetAllStorageGeneralFiles(w http.ResponseWriter, r *http.Request) + // Creates a managed storage general use file with contents + // (POST /services/haproxy/storage/general) + CreateStorageGeneralFile(w http.ResponseWriter, r *http.Request) + // Deletes a managed general use file from disk + // (DELETE /services/haproxy/storage/general/{name}) + DeleteStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) + // Return the contents of one managed general use file from disk + // (GET /services/haproxy/storage/general/{name}) + GetOneStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) + // Replace contents of a managed general use file on disk + // (PUT /services/haproxy/storage/general/{name}) + ReplaceStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageGeneralFileParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return a list of all managed general use files +// (GET /services/haproxy/storage/general) +func (_ Unimplemented) GetAllStorageGeneralFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Creates a managed storage general use file with contents +// (POST /services/haproxy/storage/general) +func (_ Unimplemented) CreateStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes a managed general use file from disk +// (DELETE /services/haproxy/storage/general/{name}) +func (_ Unimplemented) DeleteStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return the contents of one managed general use file from disk +// (GET /services/haproxy/storage/general/{name}) +func (_ Unimplemented) GetOneStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace contents of a managed general use file on disk +// (PUT /services/haproxy/storage/general/{name}) +func (_ Unimplemented) ReplaceStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageGeneralFileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllStorageGeneralFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllStorageGeneralFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllStorageGeneralFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStorageGeneralFile operation middleware +func (siw *ServerInterfaceWrapper) CreateStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStorageGeneralFile(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStorageGeneralFile operation middleware +func (siw *ServerInterfaceWrapper) DeleteStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStorageGeneralFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneStorageGeneralFile operation middleware +func (siw *ServerInterfaceWrapper) GetOneStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneStorageGeneralFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStorageGeneralFile operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStorageGeneralFileParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStorageGeneralFile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/general", wrapper.GetAllStorageGeneralFiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/storage/general", wrapper.CreateStorageGeneralFile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/storage/general/{name}", wrapper.DeleteStorageGeneralFile) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/general/{name}", wrapper.GetOneStorageGeneralFile) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/storage/general/{name}", wrapper.ReplaceStorageGeneralFile) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FjRb9u2E/5XCP5+j5KVtsGA6S1p2i0vW5AWeykC40yeZLYUqZKUEyPw/z6QlBTLcuwk8zq325stkcfv", + "7r7v7qh7ynRVa4XKWZrfU4O21spi+GNrZKIQDJzQalppjtJOma4qrab9wu75mTQIfPnuTthoimnlUDn/", + "E+patmayz1arYJzNsQL/6/8GC5rT/2UPULL41mbPgoDGaENXq1VCOVpmRO130Zx+nCNpLSEnBq1uDEMC", + "ETLBiDmhcwSOJqB/q1UhysaEg9M/0FgRcQ8tD5aRQkgki3ZtsuaiW9ZIc2qdEar0CFfJ86J7DvwavzZo", + "3ZGF9hx8QCOyYw7gBRbQSPcu+HFcIfwFFRqQJGI75iD+pt173Sj+fcj7FixR2pEiQP6mcV11r8NpZUzw", + "1BtYW69nn5F51dylpU7bh9HXScuJ937H2oJUVLU2Ieg1uDnNaSncvJlNmK6yOdRG3y0dsnnGpEDlUgVO", + "LDBb/JRFu9QjW4cT8AmHld2XqoETq6RzAoyB5V4f7MGdeAFznhb5ToWHhOsBC1XoAEE4zwL669mV30ku", + "wAG5kqCQnF1dkpR8cNpAiaQrC138Oubl1Idf16igFjSnbyYnk1c0CeBCFjOLZiEY2g5dZqPJLoeRk27M", + "92t0jVGWAJHCOqILAlKSChSUyEm7mzQWSdGC0jVGdVzyUMncmZStAxvpH0wWr09ODlZDhnTeUh4+NIyh", + "tUUjSQ/Xh/D05PQx2z3Y7GX1MWAIDefAJwzaWNBBU1Vgln3ynpE7B6Wl+Sfa5overBJaa7uFF28NgkPP", + "i85ey6iRXXIr3Jy0ebWTEUOipTFDAkHCFHGu+XKDG1UjnajBuKzQpko5uEAKVExzX3Hze+rPnja11LDe", + "nD62NWqNW5o5dKl1BqGiD3U6qNt4rE5Eim5Y3N6ye7c7tAn1EMHRnM6E8olJRu0h2ShDsT5s6OPV36KP", + "XePHgy8hRzymUjjbpzOK5uTAlF4bbYP9nw9sf3gx+SeU+VL5bNOob0xMcyxRpa1i0pnmy1RB5Tm1TluP", + "Ym8zyO79zlXkuESHY7ZfhOfr+Ee4C6MrwoX9MpZ83L1V8jUYqNCFoezTXo21wKfBU99QaR47ckJb59s3", + "Pi7CIKe5Mw3umtRuRro7fYLYY5z4D9hDnpPpRzrIzsHCzftSaX2L0gqfdtJozvhdfTeU2jXqDNrRoKTv", + "7yP/8kHnxVzaOvc0W1lbS2A4pu0OeWi1nbKtrePkbLJ56GVBLLqEKE0M+l5CboWUZIZEKOFEGA+gcGh8", + "WApREjYHVfZwvjYYGNvisV9EPY12BvfmnjkFSIs9wWdaSwS1CxfXBEih/S0/2g2P/GX/FoS/8ZsuZ+H+", + "Hr4K+GUpRwnLySM4g8EXAb35b3wd1rzX+z6mRMIQYAzrwCbV5aj7nIgb32yuYwYvL8amLy+8Kn3G+71k", + "Sxq3ff96Wsc3Ub3820zAP1i1DqF7fv38i6OvB4Fm0RXVxkia02zxhq5uVn8GAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/storage/general/general.go b/handlers/storage/general/general.go new file mode 100644 index 00000000..28348a13 --- /dev/null +++ b/handlers/storage/general/general.go @@ -0,0 +1,223 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package general + +import ( + "bufio" + "fmt" + "io" + "net/http" + "path/filepath" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all general storage routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy general storage. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllStorageGeneralFiles(w http.ResponseWriter, r *http.Request) { + gs, err := h.Client.GeneralStorage() + if err != nil { + respond.Error(w, err) + return + } + + filenames, err := gs.GetAll() + if err != nil { + respond.Error(w, err) + return + } + + retFiles := models.GeneralFiles{} + for _, f := range filenames { + retFiles = append(retFiles, &models.GeneralFile{ + Description: "managed general use file", + File: f, + ID: "", + StorageName: filepath.Base(f), + }) + } + + respond.JSON(w, http.StatusOK, retFiles) +} + +func (h *HandlerImpl) CreateStorageGeneralFile(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + gs, err := h.Client.GeneralStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, size, err := gs.Create(header.Filename, io.NopCloser(file)) + if err != nil { + respond.RuntimeError(w, err) + return + } + + me := &models.GeneralFile{ + Description: "managed general use file", + File: filename, + StorageName: filepath.Base(filename), + Size: &size, + } + + respond.JSON(w, http.StatusCreated, me) +} + +func (h *HandlerImpl) DeleteStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) { + configuration, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + + gs, err := h.Client.GeneralStorage() + if err != nil { + respond.Error(w, err) + return + } + + runningConf := strings.NewReader(configuration.Parser().String()) + + filename, _, err := gs.Get(name) + if err != nil { + respond.Error(w, err) + return + } + + // this is far from perfect but should provide a basic level of protection + scanner := bufio.NewScanner(runningConf) + + lineNr := 0 + + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { + errCode := misc.ErrHTTPConflict + errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) + respond.JSON(w, int(errCode), &models.Error{Code: &errCode, Message: &errMsg}) + return + } + lineNr++ + } + + if err = gs.Delete(name); err != nil { + respond.Error(w, err) + return + } + + respond.NoContent(w) +} + +func (h *HandlerImpl) GetOneStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string) { + gs, err := h.Client.GeneralStorage() + if err != nil { + respond.Error(w, err) + return + } + + rc, err := gs.GetRawContents(name) + if err != nil { + respond.Error(w, err) + return + } + defer rc.Close() + + w.Header().Set("Content-Type", "application/octet-stream") + w.WriteHeader(http.StatusOK) + respond.Copy(w, rc) +} + +func (h *HandlerImpl) ReplaceStorageGeneralFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageGeneralFileParams) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, _, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + data, err := io.ReadAll(file) + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + + gs, err := h.Client.GeneralStorage() + if err != nil { + respond.Error(w, err) + return + } + + if _, err = gs.Replace(name, string(data)); err != nil { + respond.Error(w, err) + return + } + + if params.SkipReload { + respond.NoContent(w) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} diff --git a/handlers/storage/maps/maps.gen.go b/handlers/storage/maps/maps.gen.go new file mode 100644 index 00000000..ab1ea038 --- /dev/null +++ b/handlers/storage/maps/maps.gen.go @@ -0,0 +1,498 @@ +// Package maps provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package maps + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// Map defines model for map. +type Map = models.Map + +// Maps defines model for maps. +type Maps = models.Maps + +// CreateStorageMapFileMultipartBody defines parameters for CreateStorageMapFile. +type CreateStorageMapFileMultipartBody struct { + // FileUpload The map file contents + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// ReplaceStorageMapFileTextBody defines parameters for ReplaceStorageMapFile. +type ReplaceStorageMapFileTextBody = string + +// ReplaceStorageMapFileParams defines parameters for ReplaceStorageMapFile. +type ReplaceStorageMapFileParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateStorageMapFileMultipartRequestBody defines body for CreateStorageMapFile for multipart/form-data ContentType. +type CreateStorageMapFileMultipartRequestBody CreateStorageMapFileMultipartBody + +// ReplaceStorageMapFileTextRequestBody defines body for ReplaceStorageMapFile for text/plain ContentType. +type ReplaceStorageMapFileTextRequestBody = ReplaceStorageMapFileTextBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return a list of all managed map files + // (GET /services/haproxy/storage/maps) + GetAllStorageMapFiles(w http.ResponseWriter, r *http.Request) + // Creates a managed storage map file with its entries + // (POST /services/haproxy/storage/maps) + CreateStorageMapFile(w http.ResponseWriter, r *http.Request) + // Deletes a managed map file from disk + // (DELETE /services/haproxy/storage/maps/{name}) + DeleteStorageMap(w http.ResponseWriter, r *http.Request, name string) + // Return the contents of one managed map file from disk + // (GET /services/haproxy/storage/maps/{name}) + GetOneStorageMap(w http.ResponseWriter, r *http.Request, name string) + // Replace contents of a managed map file on disk + // (PUT /services/haproxy/storage/maps/{name}) + ReplaceStorageMapFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageMapFileParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return a list of all managed map files +// (GET /services/haproxy/storage/maps) +func (_ Unimplemented) GetAllStorageMapFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Creates a managed storage map file with its entries +// (POST /services/haproxy/storage/maps) +func (_ Unimplemented) CreateStorageMapFile(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes a managed map file from disk +// (DELETE /services/haproxy/storage/maps/{name}) +func (_ Unimplemented) DeleteStorageMap(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return the contents of one managed map file from disk +// (GET /services/haproxy/storage/maps/{name}) +func (_ Unimplemented) GetOneStorageMap(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace contents of a managed map file on disk +// (PUT /services/haproxy/storage/maps/{name}) +func (_ Unimplemented) ReplaceStorageMapFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageMapFileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllStorageMapFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllStorageMapFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllStorageMapFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStorageMapFile operation middleware +func (siw *ServerInterfaceWrapper) CreateStorageMapFile(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStorageMapFile(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStorageMap operation middleware +func (siw *ServerInterfaceWrapper) DeleteStorageMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStorageMap(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneStorageMap operation middleware +func (siw *ServerInterfaceWrapper) GetOneStorageMap(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneStorageMap(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStorageMapFile operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStorageMapFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStorageMapFileParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStorageMapFile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/maps", wrapper.GetAllStorageMapFiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/storage/maps", wrapper.CreateStorageMapFile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/storage/maps/{name}", wrapper.DeleteStorageMap) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/maps/{name}", wrapper.GetOneStorageMap) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/storage/maps/{name}", wrapper.ReplaceStorageMapFile) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "5Fhbb9s2FP4rBLdHyUovGDC9JU275SFbkBZ7KQLjWDqy2VIkSx45MQL/94GkpNiW4lxgtFn3Zkvk4Xe+", + "850LdcsLXRutUJHj+S236IxWDsMfZ7AQlSiAhFbTWpco3bTQda3VtF/YPT+WFqFcvb8RLpoqtCJU5H+C", + "MbI1k31xWgXjxQJr8L9+tVjxnP+S3UHJ4luXPQkCWqstX6/XCS/RFVYYv4vn/NMCWWsJS2bR6cYWyCBC", + "ZhgxJ3yBUKIN6N9pVYl5Y8PB6T9onYi4ty1vLWOVkMiW7dpkw0VaGeQ5d2SFmnuE6+Rp7J5AeYnfGnT0", + "wqg9AU9oRPaSCTzFChpJ74MfL4vCP1ChBckitpdM4l+aPuhGlf+N9L4Gx5QmVgXI35XXdfc6nFaD2Vim", + "Z1+w8Mlyk8512j6MLk7OwWy+SEVttA0cG6AFz/lc0KKZTQpdZwswVt+sCItFVkiBilIFJJaYLX/Loj3u", + "gdRgAgpBWLuHAuKhrpMOKlgLq3uRuoNDfYYcHsdrl1qHhOsBC1XpAEGQ9Mf9eXzhd7JTIGAXEhSy44sz", + "lrKPpC3MkbW0dSrKuWdbG1RgBM/5m8nR5BVPAqYQq8yhXYoCXQcqc9FS1oV1jjQU7iVSY5VjwKRwxHTF", + "QEpWg4I5lqwGE8TskWiDUd5nZShFdCxlC/YczId21dZY8Pro6GAFIHgxktIfm6JA56pGsh6hp+rt0dv7", + "TPYYs+fVtIAhNIkDn7DVeoLMm7oGu+rj9IgwEcwdzz/zNjT8ap1wo91I6N9ZBEIf+s5Oq5jeHrsWtGCC", + "HENFVqCbDHQQjWzrIMggNPoTXa52FFA3koQBS1mlbZ2WQCH0qApd+qKY33J/9LQxUsNm//gU85TwhjIj", + "QSh+VzxDdlqPjESU3o6NYRvofWzNe+48IiCe85lQnvZkULCTnRoSk3tH9K8OKfoxzZ/32AP75SBOMQGO", + "DizPjdEy2P/9wPa3LwY/IsuekRJjKefbR6FLnKNK20xIZ7pcpQpqL55NcXoA+2t3duu3raOMJRIOBX0a", + "nm/i7vFWVtesFO7rMHfjrrvcDe3EQo0Uhp/Pt/fJrkU3De743sbz2BwT3nrYvvHOC4slz8k2uG8Suhpk", + "0duhmz2AyEP5E9b5x0Tyniq/t7/T4q7S+fahFe4/YdDu/1YvVir7pgxdEFLqyCLU24X34Wr/Px82nqyZ", + "0dmjGVWlkVDgUJYjstdqXJKtjcHo8cN0mewedlYxh5QwpZlFX+zZtZCSzZAJJUiEzg0VofUUVGLOigWo", + "eQ/nW4NBlS0e91WYabSzdafs1VGBdNiLeKa1RFD7cJWaAau0vwFHu+GRvwhfg/C3YdvFJ9xtw43ZL0tL", + "lLCa3IMzGHwW0Kt9c+PG3LeVxSM5ux2y4Xz2+qH7e4wDg6JAE4KkOte7L1i485ngMhJzdjo0fXbqhe2J", + "7PeyEXbGPrnsb4I2JkD5fYa9n6zABeoeX3qePOKFe038vIN22RWjxkqe82z5hq+v1v8GAAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/storage/maps/maps.go b/handlers/storage/maps/maps.go new file mode 100644 index 00000000..41cc267c --- /dev/null +++ b/handlers/storage/maps/maps.go @@ -0,0 +1,213 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package maps + +import ( + "bufio" + "fmt" + "io" + "net/http" + "path/filepath" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all map storage routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy map storage. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllStorageMapFiles(w http.ResponseWriter, r *http.Request) { + st, err := h.Client.MapStorage() + if err != nil { + respond.Error(w, err) + return + } + + filenames, err := st.GetAll() + if err != nil { + respond.Error(w, err) + return + } + + retMaps := models.Maps{} + for _, f := range filenames { + retMaps = append(retMaps, &models.Map{ + Description: "managed map file", + File: f, + ID: "", + StorageName: filepath.Base(f), + }) + } + + respond.JSON(w, http.StatusOK, retMaps) +} + +func (h *HandlerImpl) CreateStorageMapFile(w http.ResponseWriter, r *http.Request) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + st, err := h.Client.MapStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, size, err := st.Create(header.Filename, io.NopCloser(file)) + if err != nil { + respond.RuntimeError(w, err) + return + } + + me := &models.Map{ + Description: "managed but not loaded map file (no runtime ID)", + File: filename, + StorageName: filepath.Base(filename), + Size: &size, + } + // no reload or force reload since this is just a file upload, + // haproxy configuration has not been changed + respond.JSON(w, http.StatusCreated, me) +} + +func (h *HandlerImpl) DeleteStorageMap(w http.ResponseWriter, r *http.Request, name string) { + configuration, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + + st, err := h.Client.MapStorage() + if err != nil { + respond.Error(w, err) + return + } + + runningConf := strings.NewReader(configuration.Parser().String()) + + filename, _, err := st.Get(name) + if err != nil { + respond.Error(w, err) + return + } + + // this is far from perfect but should provide a basic level of protection + scanner := bufio.NewScanner(runningConf) + + lineNr := 0 + + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { + errCode := misc.ErrHTTPConflict + errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) + respond.JSON(w, int(errCode), &models.Error{Code: &errCode, Message: &errMsg}) + return + } + lineNr++ + } + + if err = st.Delete(name); err != nil { + respond.Error(w, err) + return + } + + respond.NoContent(w) +} + +func (h *HandlerImpl) GetOneStorageMap(w http.ResponseWriter, r *http.Request, name string) { + st, err := h.Client.MapStorage() + if err != nil { + respond.Error(w, err) + return + } + + rc, err := st.GetRawContents(name) + if err != nil { + respond.Error(w, err) + return + } + defer rc.Close() + + w.Header().Set("Content-Type", "application/octet-stream") + w.WriteHeader(http.StatusOK) + respond.Copy(w, rc) +} + +func (h *HandlerImpl) ReplaceStorageMapFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageMapFileParams) { + data, err := io.ReadAll(r.Body) + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + + st, err := h.Client.MapStorage() + if err != nil { + respond.Error(w, err) + return + } + + if _, err = st.Replace(name, string(data)); err != nil { + respond.Error(w, err) + return + } + + if params.SkipReload { + respond.NoContent(w) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} diff --git a/handlers/storage/ssl_certificates/ssl_certificates.gen.go b/handlers/storage/ssl_certificates/ssl_certificates.gen.go new file mode 100644 index 00000000..54a449e1 --- /dev/null +++ b/handlers/storage/ssl_certificates/ssl_certificates.gen.go @@ -0,0 +1,577 @@ +// Package ssl_certificates provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_certificates + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SslCertificate defines model for ssl_certificate. +type SslCertificate = models.SslCertificate + +// SslCertificates defines model for ssl_certificates. +type SslCertificates = models.SslCertificates + +// CreateStorageSSLCertificateMultipartBody defines parameters for CreateStorageSSLCertificate. +type CreateStorageSSLCertificateMultipartBody struct { + // FileUpload The SSL certificate to upload + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// CreateStorageSSLCertificateParams defines parameters for CreateStorageSSLCertificate. +type CreateStorageSSLCertificateParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteStorageSSLCertificateParams defines parameters for DeleteStorageSSLCertificate. +type DeleteStorageSSLCertificateParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceStorageSSLCertificateTextBody defines parameters for ReplaceStorageSSLCertificate. +type ReplaceStorageSSLCertificateTextBody = string + +// ReplaceStorageSSLCertificateParams defines parameters for ReplaceStorageSSLCertificate. +type ReplaceStorageSSLCertificateParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateStorageSSLCertificateMultipartRequestBody defines body for CreateStorageSSLCertificate for multipart/form-data ContentType. +type CreateStorageSSLCertificateMultipartRequestBody CreateStorageSSLCertificateMultipartBody + +// ReplaceStorageSSLCertificateTextRequestBody defines body for ReplaceStorageSSLCertificate for text/plain ContentType. +type ReplaceStorageSSLCertificateTextRequestBody = ReplaceStorageSSLCertificateTextBody + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return all available SSL certificates on disk + // (GET /services/haproxy/storage/ssl_certificates) + GetAllStorageSSLCertificates(w http.ResponseWriter, r *http.Request) + // Create SSL certificate + // (POST /services/haproxy/storage/ssl_certificates) + CreateStorageSSLCertificate(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCertificateParams) + // Delete SSL certificate from disk + // (DELETE /services/haproxy/storage/ssl_certificates/{name}) + DeleteStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCertificateParams) + // Return one SSL certificate from disk + // (GET /services/haproxy/storage/ssl_certificates/{name}) + GetOneStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string) + // Replace SSL certificates on disk + // (PUT /services/haproxy/storage/ssl_certificates/{name}) + ReplaceStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCertificateParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return all available SSL certificates on disk +// (GET /services/haproxy/storage/ssl_certificates) +func (_ Unimplemented) GetAllStorageSSLCertificates(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Create SSL certificate +// (POST /services/haproxy/storage/ssl_certificates) +func (_ Unimplemented) CreateStorageSSLCertificate(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCertificateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete SSL certificate from disk +// (DELETE /services/haproxy/storage/ssl_certificates/{name}) +func (_ Unimplemented) DeleteStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCertificateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one SSL certificate from disk +// (GET /services/haproxy/storage/ssl_certificates/{name}) +func (_ Unimplemented) GetOneStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace SSL certificates on disk +// (PUT /services/haproxy/storage/ssl_certificates/{name}) +func (_ Unimplemented) ReplaceStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCertificateParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllStorageSSLCertificates operation middleware +func (siw *ServerInterfaceWrapper) GetAllStorageSSLCertificates(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllStorageSSLCertificates(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStorageSSLCertificate operation middleware +func (siw *ServerInterfaceWrapper) CreateStorageSSLCertificate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateStorageSSLCertificateParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStorageSSLCertificate(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStorageSSLCertificate operation middleware +func (siw *ServerInterfaceWrapper) DeleteStorageSSLCertificate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteStorageSSLCertificateParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStorageSSLCertificate(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneStorageSSLCertificate operation middleware +func (siw *ServerInterfaceWrapper) GetOneStorageSSLCertificate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneStorageSSLCertificate(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStorageSSLCertificate operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStorageSSLCertificate(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStorageSSLCertificateParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStorageSSLCertificate(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/ssl_certificates", wrapper.GetAllStorageSSLCertificates) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/storage/ssl_certificates", wrapper.CreateStorageSSLCertificate) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/storage/ssl_certificates/{name}", wrapper.DeleteStorageSSLCertificate) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/ssl_certificates/{name}", wrapper.GetOneStorageSSLCertificate) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/storage/ssl_certificates/{name}", wrapper.ReplaceStorageSSLCertificate) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7Fjfb9s2EP5XCG6PkpWmwYDpLT+6LkCxBXGxlyIwzuTJZkuRKkk5MQL97wNJybFlO00CJ/G6vNkSefzu", + "+N13d7qlTJeVVqicpfktNWgrrSyGP7ZCJgrBwAmtRqXmKO2I6bLUarRY2D0/lgaBzz/cCBtNMa0cKud/", + "QlXJ1kz21WoVjLMpluB//WqwoDn9JbuDksW3NnsUBDRGG9o0TUI5WmZE5XfRnH6eImktIScGra4NQwIR", + "MsGIOaFTBI4moD/VqhCT2oSD03/QWBFxr1peWUYKIZHM2rXJkotuXiHNqXVGqIlH2CSPi+4J8Ev8XqN1", + "exbaE/ABjcj2OYBnWEAt3Yfgx36F8CMqNCBJxLbPQfxLuz90rfh/I72vwRKlHSkC5BeNa9O9fryOYsfQ", + "1qoef0Xmc+smnei0fRjXDjrGLF6loqy0CZdSgZvSnE6Em9bjAdNlNoXK6Ju5QzbNmBSoXKrAiRlms9+y", + "aJEG5FaOGBoXIeMDsQytPF3a9MygQlyFw9L+kGI9b5qk8waMgflDnLE79sb7I1ShQ2SFk/7gP48v/E5y", + "Bg7IhQSF5PjinKRk6LSBCZLh8BPpYeq4mFPvla5QQSVoTt8PDgbvaBLwhfhkFs1MMLQdwMxGq9mmsE7Q", + "rafCJbraKEtASgIzEBLGMoJa3k60IlzYbwMa8MTEOedB5NyxlK0zw+GnnisrfcfhwcHuFKbv4Ab9GNaM", + "obVFLckCtI/o0cHRNvMLvNnTBDRgCBVpxyes1LmQOHVZgpkvrvCBN0gT6mBiaf6FtpdGr5qEVtpuIMep", + "wbC3Z2ydBXHhRhYEvhoo0QWN/tI/47wgFl1ClCYGpQZOroWUZIxEKOEEOOQECoeGsKDahE1BTbxZ4bd/", + "r9H4ZFdQBq3+JqpRtLMi5YtLKUBaXEjFWGuJoHxAt+HimgAptC880W545OvPNQhfhAxxU2zB1SYUKr8s", + "5ShhPtiCMxh8EtArn1ShLzvRfN7Lp7KWTlRgXFZoU6YcXDCKimnua1h+S321G9VVOPhu8+d4jMMbl1US", + "hKJ3tS5IovEX7kRM5J6N9ardIwxxmrTLE+96Cc77JBSEmPTrbNKrS1FZe1Ly7rmkZKOS9Pxhge8h3Q8P", + "DvcASderY68huoxcPD9bv6fzM6KLwN3FXrKBkJuay6Mo5DuUt6U5KNj/fcf2V6fY11DpKJH9zNgkx74p", + "YZrjBFXaXk061nyedtqxlH3+jId3AdmtN9FELkiMPeAqK87C8zXJJ4XR5ZYWIG55kvj3TwketooZurCF", + "YLZvfDyEQU5zZ2q8j6fJW6HZQaFZkdzDdbr0LzDSihNQHbyXVabD2No9CORP2ArGVNyevFu6v3snA63w", + "MWrwEd3fau/U4OrlRpG3SeRexmwbQOqNFKwksA3VaOs42u54K0b/p6lnaWpZSdq1AtG/suaVVaFHOBPJ", + "uw9jRQfl1Qr5848YP5nyhvt61GefH80Z4etB/OaNZtZpZm0kzWk2e0+bq+bfAAAA//8=", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/storage/ssl_certificates/ssl_certificates.go b/handlers/storage/ssl_certificates/ssl_certificates.go new file mode 100644 index 00000000..8b4c3c4b --- /dev/null +++ b/handlers/storage/ssl_certificates/ssl_certificates.go @@ -0,0 +1,342 @@ +// Copyright 2019 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_certificates + +import ( + "bufio" + "bytes" + "fmt" + "io" + "net/http" + "path/filepath" + "strings" + + "github.com/go-chi/chi/v5" + "github.com/go-openapi/strfmt" + client_native "github.com/haproxytech/client-native/v6" + "github.com/haproxytech/client-native/v6/models" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all SSL certificate storage routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SSL certificate storage. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllStorageSSLCertificates(w http.ResponseWriter, r *http.Request) { + sslStorage, err := h.Client.SSLCertStorage() + if err != nil { + respond.Error(w, err) + return + } + + filelist, err := sslStorage.GetAll() + if err != nil { + respond.Error(w, err) + return + } + + retFiles := models.SslCertificates{} + for _, f := range filelist { + retFiles = append(retFiles, &models.SslCertificate{ + File: f, + Description: "managed SSL file", + StorageName: filepath.Base(f), + }) + } + + respond.JSON(w, http.StatusOK, retFiles) +} + +func (h *HandlerImpl) CreateStorageSSLCertificate(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCertificateParams) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + sslStorage, err := h.Client.SSLCertStorage() + if err != nil { + respond.Error(w, err) + return + } + + // We need to read the cert here because we are going to write it twice: + // once to the filesystem, and (optionally) to HAProxy's runtime socket. + certBody, err := io.ReadAll(file) + if err != nil { + respond.Error(w, err) + return + } + + filename, size, err := sslStorage.Create(header.Filename, io.NopCloser(bytes.NewReader(certBody))) + if err != nil { + respond.Error(w, err) + return + } + + info, err := sslStorage.GetCertificatesInfo(filename) + if err != nil { + respond.Error(w, err) + return + } + + retf := &models.SslCertificate{ + File: filename, + Description: "managed SSL file", + StorageName: filepath.Base(filename), + Size: &size, + NotAfter: (*strfmt.DateTime)(info.NotAfter), + NotBefore: (*strfmt.DateTime)(info.NotBefore), + Issuers: info.Issuers, + Domains: info.DNS, + IPAddresses: info.IPs, + Subject: info.Subject, + Serial: info.Serial, + } + + if params.SkipReload { + respond.JSON(w, http.StatusCreated, retf) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, retf) + return + } + + // Try to push the new cert to HAProxy using the runtime socket. + if err = pushCertToRuntime(h.Client, filename, string(certBody), true); err != nil { + log.Debugf("failed to push certificate via runtime, reloading instead: %s", err.Error()) + respond.Accepted(w, h.ReloadAgent.Reload(), retf) + return + } + + respond.JSON(w, http.StatusCreated, retf) +} + +func (h *HandlerImpl) DeleteStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCertificateParams) { + configuration, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + runningConf := strings.NewReader(configuration.Parser().String()) + + sslStorage, err := h.Client.SSLCertStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, _, err := sslStorage.Get(name) + if err != nil { + respond.Error(w, err) + return + } + + // this is far from perfect but should provide a basic level of protection + scanner := bufio.NewScanner(runningConf) + + lineNr := 0 + + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if strings.Contains(line, filename) && !strings.HasPrefix(line, "#") { + errCode := misc.ErrHTTPConflict + errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) + respond.JSON(w, int(errCode), &models.Error{Code: &errCode, Message: &errMsg}) + return + } + lineNr++ + } + + if err = sslStorage.Delete(name); err != nil { + respond.Error(w, err) + return + } + + if params.SkipReload { + respond.NoContent(w) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + + if rt, rtErr := h.Client.Runtime(); rtErr == nil { + if err = rt.DeleteCertEntry(name); err == nil { + respond.NoContent(w) + return + } + log.Debugf("failed to delete certificate via runtime, reloading instead: %s", err.Error()) + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} + +func (h *HandlerImpl) GetOneStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string) { + sslStorage, err := h.Client.SSLCertStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, size, err := sslStorage.Get(name) + if err != nil { + respond.Error(w, err) + return + } + + info, err := sslStorage.GetCertificatesInfo(name) + if err != nil { + respond.Error(w, err) + return + } + + retf := &models.SslCertificate{ + File: filename, + Description: "managed SSL file", + StorageName: filepath.Base(filename), + Size: &size, + NotAfter: (*strfmt.DateTime)(info.NotAfter), + NotBefore: (*strfmt.DateTime)(info.NotBefore), + Issuers: info.Issuers, + Domains: info.DNS, + IPAddresses: info.IPs, + Subject: info.Subject, + Serial: info.Serial, + } + + respond.JSON(w, http.StatusOK, retf) +} + +func (h *HandlerImpl) ReplaceStorageSSLCertificate(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCertificateParams) { + data, err := io.ReadAll(r.Body) + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + + sslStorage, err := h.Client.SSLCertStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, err := sslStorage.Replace(name, string(data)) + if err != nil { + respond.Error(w, err) + return + } + + info, err := sslStorage.GetCertificatesInfo(filename) + if err != nil { + respond.Error(w, err) + return + } + + size := int64(len(data)) + retf := &models.SslCertificate{ + File: filename, + Description: "managed SSL file", + StorageName: filepath.Base(filename), + Size: &size, + NotAfter: (*strfmt.DateTime)(info.NotAfter), + NotBefore: (*strfmt.DateTime)(info.NotBefore), + Issuers: info.Issuers, + Domains: info.DNS, + IPAddresses: info.IPs, + Subject: info.Subject, + Serial: info.Serial, + } + + if params.SkipReload { + respond.JSON(w, http.StatusOK, retf) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, retf) + return + } + + // Try to push the new cert to HAProxy using the runtime socket. + if err = pushCertToRuntime(h.Client, filename, string(data), false); err != nil { + log.Debugf("failed to push certificate via runtime, reloading instead: %s", err.Error()) + respond.Accepted(w, h.ReloadAgent.Reload(), retf) + return + } + + respond.JSON(w, http.StatusOK, retf) +} + +func pushCertToRuntime(c client_native.HAProxyClient, filename, body string, newCert bool) error { + rt, err := c.Runtime() + if err != nil { + return err + } + + if newCert { + if err = rt.NewCertEntry(filename); err != nil { + return err + } + } + + if err = rt.SetCertEntry(filename, body); err != nil { + return err + } + + return rt.CommitCertEntry(filename) +} diff --git a/handlers/storage/ssl_crt_lists/ssl_crt_lists.gen.go b/handlers/storage/ssl_crt_lists/ssl_crt_lists.gen.go new file mode 100644 index 00000000..1becd9e4 --- /dev/null +++ b/handlers/storage/ssl_crt_lists/ssl_crt_lists.gen.go @@ -0,0 +1,765 @@ +// Package ssl_crt_lists provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT. +package ssl_crt_lists + +import ( + "bytes" + "compress/flate" + "encoding/base64" + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/go-chi/chi/v5" + "github.com/haproxytech/client-native/v6/models" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// SslCrtListEntries defines model for ssl_crt_list_entries. +type SslCrtListEntries = models.SslCrtListEntries + +// SslCrtListEntry defines model for ssl_crt_list_entry. +type SslCrtListEntry = models.SslCrtListEntry + +// SslCrtListFile defines model for ssl_crt_list_file. +type SslCrtListFile = models.SslCrtListFile + +// SslCrtListFiles defines model for ssl_crt_list_files. +type SslCrtListFiles = models.SslCrtListFiles + +// CreateStorageSSLCrtListFileMultipartBody defines parameters for CreateStorageSSLCrtListFile. +type CreateStorageSSLCrtListFileMultipartBody struct { + // FileUpload The certificate list to upload + FileUpload openapi_types.File `json:"file_upload,omitempty,omitzero"` +} + +// CreateStorageSSLCrtListFileParams defines parameters for CreateStorageSSLCrtListFile. +type CreateStorageSSLCrtListFileParams struct { + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteStorageSSLCrtListFileParams defines parameters for DeleteStorageSSLCrtListFile. +type DeleteStorageSSLCrtListFileParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// ReplaceStorageSSLCrtListFileTextBody defines parameters for ReplaceStorageSSLCrtListFile. +type ReplaceStorageSSLCrtListFileTextBody = string + +// ReplaceStorageSSLCrtListFileParams defines parameters for ReplaceStorageSSLCrtListFile. +type ReplaceStorageSSLCrtListFileParams struct { + // SkipReload If set, no reload will be initiated after config change + SkipReload bool `form:"skip_reload,omitempty" json:"skip_reload,omitempty,omitzero"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// DeleteStorageSSLCrtListEntryParams defines parameters for DeleteStorageSSLCrtListEntry. +type DeleteStorageSSLCrtListEntryParams struct { + // Certificate SSL certificate filename + Certificate string `form:"certificate" json:"certificate"` + + // LineNumber The line number in the crt-list + LineNumber int `form:"line_number" json:"line_number"` + + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateStorageSSLCrtListEntryParams defines parameters for CreateStorageSSLCrtListEntry. +type CreateStorageSSLCrtListEntryParams struct { + // ForceReload If set, do a force reload, do not wait for the configured reload-delay. + ForceReload bool `form:"force_reload,omitempty" json:"force_reload,omitempty,omitzero"` +} + +// CreateStorageSSLCrtListFileMultipartRequestBody defines body for CreateStorageSSLCrtListFile for multipart/form-data ContentType. +type CreateStorageSSLCrtListFileMultipartRequestBody CreateStorageSSLCrtListFileMultipartBody + +// ReplaceStorageSSLCrtListFileTextRequestBody defines body for ReplaceStorageSSLCrtListFile for text/plain ContentType. +type ReplaceStorageSSLCrtListFileTextRequestBody = ReplaceStorageSSLCrtListFileTextBody + +// CreateStorageSSLCrtListEntryJSONRequestBody defines body for CreateStorageSSLCrtListEntry for application/json ContentType. +type CreateStorageSSLCrtListEntryJSONRequestBody = SslCrtListEntry + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // Return all available certificate lists on disk + // (GET /services/haproxy/storage/ssl_crt_lists) + GetAllStorageSSLCrtListFiles(w http.ResponseWriter, r *http.Request) + // Create a certificate list + // (POST /services/haproxy/storage/ssl_crt_lists) + CreateStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCrtListFileParams) + // Delete a certificate list from disk + // (DELETE /services/haproxy/storage/ssl_crt_lists/{name}) + DeleteStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListFileParams) + // Return one certificate list from disk + // (GET /services/haproxy/storage/ssl_crt_lists/{name}) + GetOneStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string) + // Replace a certificate lists on disk + // (PUT /services/haproxy/storage/ssl_crt_lists/{name}) + ReplaceStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCrtListFileParams) + // Deletes an entry from CrtList file + // (DELETE /services/haproxy/storage/ssl_crt_lists/{name}/entries) + DeleteStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListEntryParams) + // Returns all the entries in a CrtList + // (GET /services/haproxy/storage/ssl_crt_lists/{name}/entries) + GetStorageSSLCrtListEntries(w http.ResponseWriter, r *http.Request, name string) + // Creates a new entry in a CrtList + // (POST /services/haproxy/storage/ssl_crt_lists/{name}/entries) + CreateStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params CreateStorageSSLCrtListEntryParams) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// Return all available certificate lists on disk +// (GET /services/haproxy/storage/ssl_crt_lists) +func (_ Unimplemented) GetAllStorageSSLCrtListFiles(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Create a certificate list +// (POST /services/haproxy/storage/ssl_crt_lists) +func (_ Unimplemented) CreateStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCrtListFileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete a certificate list from disk +// (DELETE /services/haproxy/storage/ssl_crt_lists/{name}) +func (_ Unimplemented) DeleteStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListFileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Return one certificate list from disk +// (GET /services/haproxy/storage/ssl_crt_lists/{name}) +func (_ Unimplemented) GetOneStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Replace a certificate lists on disk +// (PUT /services/haproxy/storage/ssl_crt_lists/{name}) +func (_ Unimplemented) ReplaceStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCrtListFileParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Deletes an entry from CrtList file +// (DELETE /services/haproxy/storage/ssl_crt_lists/{name}/entries) +func (_ Unimplemented) DeleteStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Returns all the entries in a CrtList +// (GET /services/haproxy/storage/ssl_crt_lists/{name}/entries) +func (_ Unimplemented) GetStorageSSLCrtListEntries(w http.ResponseWriter, r *http.Request, name string) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Creates a new entry in a CrtList +// (POST /services/haproxy/storage/ssl_crt_lists/{name}/entries) +func (_ Unimplemented) CreateStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params CreateStorageSSLCrtListEntryParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// GetAllStorageSSLCrtListFiles operation middleware +func (siw *ServerInterfaceWrapper) GetAllStorageSSLCrtListFiles(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetAllStorageSSLCrtListFiles(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStorageSSLCrtListFile operation middleware +func (siw *ServerInterfaceWrapper) CreateStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params CreateStorageSSLCrtListFileParams + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStorageSSLCrtListFile(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStorageSSLCrtListFile operation middleware +func (siw *ServerInterfaceWrapper) DeleteStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteStorageSSLCrtListFileParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStorageSSLCrtListFile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetOneStorageSSLCrtListFile operation middleware +func (siw *ServerInterfaceWrapper) GetOneStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetOneStorageSSLCrtListFile(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ReplaceStorageSSLCrtListFile operation middleware +func (siw *ServerInterfaceWrapper) ReplaceStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ReplaceStorageSSLCrtListFileParams + + // ------------- Optional query parameter "skip_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "skip_reload", r.URL.Query(), ¶ms.SkipReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "skip_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "skip_reload", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ReplaceStorageSSLCrtListFile(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// DeleteStorageSSLCrtListEntry operation middleware +func (siw *ServerInterfaceWrapper) DeleteStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params DeleteStorageSSLCrtListEntryParams + + // ------------- Required query parameter "certificate" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "certificate", r.URL.Query(), ¶ms.Certificate, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "certificate"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "certificate", Err: err}) + } + return + } + + // ------------- Required query parameter "line_number" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, true, "line_number", r.URL.Query(), ¶ms.LineNumber, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "line_number"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "line_number", Err: err}) + } + return + } + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.DeleteStorageSSLCrtListEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetStorageSSLCrtListEntries operation middleware +func (siw *ServerInterfaceWrapper) GetStorageSSLCrtListEntries(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStorageSSLCrtListEntries(w, r, name) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateStorageSSLCrtListEntry operation middleware +func (siw *ServerInterfaceWrapper) CreateStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "name" ------------- + var name string + + err = runtime.BindStyledParameterWithOptions("simple", "name", chi.URLParam(r, "name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "name", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateStorageSSLCrtListEntryParams + + // ------------- Optional query parameter "force_reload" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "force_reload", r.URL.Query(), ¶ms.ForceReload, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "force_reload"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "force_reload", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateStorageSSLCrtListEntry(w, r, name, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists", wrapper.GetAllStorageSSLCrtListFiles) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists", wrapper.CreateStorageSSLCrtListFile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}", wrapper.DeleteStorageSSLCrtListFile) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}", wrapper.GetOneStorageSSLCrtListFile) + }) + r.Group(func(r chi.Router) { + r.Put(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}", wrapper.ReplaceStorageSSLCrtListFile) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}/entries", wrapper.DeleteStorageSSLCrtListEntry) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}/entries", wrapper.GetStorageSSLCrtListEntries) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/services/haproxy/storage/ssl_crt_lists/{name}/entries", wrapper.CreateStorageSSLCrtListEntry) + }) + + return r +} + +// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec. +// Stored as a slice of fixed-width chunks rather than one concatenated +// const string: with thousands of chunks the chained `+` fold is several +// times slower for the Go compiler than parsing a slice literal. +var swaggerSpec = []string{ + "7FnNbtu6En4VgvcurShNiwtc79Kk7QkQ9BRxcDZFYNDUyGZLkSo5cmIEevcDkpJrybJju3bqpt0lFjm/", + "33wzIz1SrrNcK1Boaf+RGrC5Vhb8PzYHLlLBGQqthplOQNoh11mm1XB+sP79XBpgyezdg7BBFNcKQaH7", + "k+W5rMTEX6xWXjifQMbcX/81kNI+/U/83ZQ4PLXxViaAMdrQsix7NAHLjcjdLdqntxMglSRIiAGrC8OB", + "sGAygWBzj06AJWC89RdapWJcGK84+geMFcHupuTGMZIKCWRane0tuIizHGifWjRCjZ2FZW+76L5lyQ18", + "K8DikYX2LXMBDZYdcwAvIWWFxHfej+MK4QdQYJgkwbZjDuJHje91oZJfo7zvmSVKI0m9yc8a17J+vD2P", + "Qo3QSqoefQHuaushGuuo+jGcPakRM38UiSzXxiclZzihfToWOClGJ1xn8YTlRj/MEPgk5lKAwkgxFFOI", + "p/+Lg0TqLbdyyA0OpbA4BIVGhHYgEDL7ZEbbl2e07NW+MGPYrNuVgZUXBq+FxXeVxoO7Ndswyk3TZoc1", + "zIFsa7veu0sHN2tHEHiPtsTAe69uvx45n4RKtY+uQBdm+tf5J3eTXDJk5JNkCsj5pysSkQFqw8ZABoNr", + "cnFzS66rCaEu/z51LukcFMsF7dPXJ6cnr2jPG+fDE1swU8HB1tbFNohsBMcfHQMuU88NYGGUJUxKwqZM", + "SDaSQDgYDEwCxN8nWpFE2K8n1FsTmOoq8V0Fz6Ws/BgMrluRbQx6Z6en+6P0Zdh0UPag4BysTQtJ5ma7", + "iL45fbNKwdzieLee5W3wQ8CeNTRGC185RZYxRy9VFjdNIu1RZGNL+59plTd6V/Zorm0HQC4MMARL2JK8", + "ZSyEs51Y8Jg1LAP0rfFzW81VSixgjySaMJJq11cNSM0S/5Nrr/dMuB5rCE6A8Kpj+j7sjkUJSDZzJgkn", + "7lsBnkEVy1z9eYHDcLLRUueZSpm0MCePkdYSmKJleecg7MfOtzqZtdCbFRJFzgzGqTZZlDD0QkFxnbgW", + "3X+kDpnDIveKv1++DWoQHjDOJROKfm/lnnuMCyxWDbElY3koaWeGoCbV+Z7zPWPonBKK+aC054heqwsE", + "DmtV7qvDVW5X4V60XeIeW768zk7PjsOYeiOB1th3EyB5dbmcrqtLolMP4fld0oHLrhH6TWDPPTLKwrbn", + "5f9/z/Kbu/rPIMbASB3k1cWBbg7gOoExqKjKTjTSySyqWWShDp2aDXtv/OjulwELEhCWUXHpf+8iWZIa", + "na1oveHWTnS7hGjvYkWefvKZc2f1xAVEGEhoH00B67DaW8XtSldQJ/dCSjICIpRA4SuJpQimonXCJ0yN", + "YQWX268i34nKe79Uz2mQ71lHX25nMGArIUzV9j0vPZ2FkWozK1/gDBaqcW0Jrxi81g7mWsFWpPAB8G91", + "fKRwt9UqoDkCRhYNsKzZy5+eZn7zHWA9XlaN/kUnAnPJeHdXWrkOVpf+NKUX2ZRWLUILi0yjWjtqs5my", + "8jnfEGw02psA4CNZNGprflpXP/zS8cJI2OergzLXvn15avPwbxa2XznihbfqT64eiviX1aFXbPK2Z8X6", + "Ub+8Xkv1g8E14QYPT/Ne0YIrrvIW9bX4ceHoj+m9nbiwKSCqyEZgiFCBrg1G1frZpd7dGIYba9VnQoms", + "yGj/dM7UQiGMwby8PafxbSw0YcI4h/zolp3Vg+YfDt16kWozUsUuvoB32aOYlD7VFSW6gtyE5D4AdjJc", + "+HK4CcdFcsHs51+lfmBKqbvH775TrQBPhYYdv6YouK/gvSESV3xc2abd7h2KL2N72WO5zDZbcl4d3IJm", + "Wj7OwcaSpLHb/ArN9s+Hj10/fHQQzRrW2nALcXrATGumKYykfRpPX9Pyrvw3AAD//w==", +} + +// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes, +// after base64-decoding and flate-decompressing the embedded blob. +func decodeSpec() ([]byte, error) { + encoded := strings.Join(swaggerSpec, "") + compressed, err := base64.StdEncoding.DecodeString(encoded) + if err != nil { + return nil, fmt.Errorf("error base64 decoding spec: %w", err) + } + zr := flate.NewReader(bytes.NewReader(compressed)) + var buf bytes.Buffer + if _, err := buf.ReadFrom(zr); err != nil { + return nil, fmt.Errorf("read flate: %w", err) + } + if err := zr.Close(); err != nil { + return nil, fmt.Errorf("close flate reader: %w", err) + } + + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cache of the decoded OpenAPI spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + res := make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSpec returns the OpenAPI specification corresponding to the generated +// code in this file. External references in the spec are resolved through +// PathToRawSpec; externally-referenced files must be embedded in their +// corresponding Go packages (via the import-mapping feature). URL-based +// external refs are not supported. +func GetSpec() (swagger *openapi3.T, err error) { + resolvePath := PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + pathToFile := url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) + if err != nil { + return + } + return +} + +// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI +// specification: decompressed but not unmarshaled. External references +// are not resolved here; the bytes are the spec exactly as embedded by +// codegen. The result is cached at package init time, so repeated calls +// are cheap. +func GetSpecJSON() ([]byte, error) { + return rawSpec() +} + +// GetSwagger returns the OpenAPI specification corresponding to the +// generated code in this file. +// +// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger +// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for +// backwards compatibility. +func GetSwagger() (*openapi3.T, error) { + return GetSpec() +} diff --git a/handlers/storage/ssl_crt_lists/ssl_crt_lists.go b/handlers/storage/ssl_crt_lists/ssl_crt_lists.go new file mode 100644 index 00000000..0a170006 --- /dev/null +++ b/handlers/storage/ssl_crt_lists/ssl_crt_lists.go @@ -0,0 +1,402 @@ +// Copyright 2025 HAProxy Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ssl_crt_lists + +import ( + "bufio" + "errors" + "fmt" + "io" + "net/http" + "path/filepath" + "strings" + + "github.com/go-chi/chi/v5" + client_native "github.com/haproxytech/client-native/v6" + cnconf "github.com/haproxytech/client-native/v6/configuration" + "github.com/haproxytech/client-native/v6/models" + cnruntime "github.com/haproxytech/client-native/v6/runtime" + + "github.com/haproxytech/dataplaneapi/handlers/middleware" + "github.com/haproxytech/dataplaneapi/handlers/respond" + "github.com/haproxytech/dataplaneapi/log" + "github.com/haproxytech/dataplaneapi/misc" + "github.com/haproxytech/dataplaneapi/reload_agent" +) + +// RegisterRouter registers all SSL crt-list storage routes onto r using spec-based request validation. +func RegisterRouter(r chi.Router, client client_native.HAProxyClient, ra reload_agent.IReloadAgent) error { + spec, err := GetSpec() + if err != nil { + return err + } + HandlerWithOptions(&HandlerImpl{Client: client, ReloadAgent: ra}, ChiServerOptions{ + BaseRouter: r, + Middlewares: []MiddlewareFunc{middleware.NewValidator(spec)}, + ErrorHandlerFunc: middleware.ErrorHandler, + }) + return nil +} + +// HandlerImpl implements ServerInterface for HAProxy SSL crt-list storage. +type HandlerImpl struct { + Client client_native.HAProxyClient + ReloadAgent reload_agent.IReloadAgent +} + +func (h *HandlerImpl) GetAllStorageSSLCrtListFiles(w http.ResponseWriter, r *http.Request) { + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + filelist, err := crtListStorage.GetAll() + if err != nil { + respond.Error(w, err) + return + } + + retFiles := models.SslCrtListFiles{} + for _, f := range filelist { + retFiles = append(retFiles, &models.SslCrtListFile{ + File: f, + Description: "managed certificate list", + StorageName: filepath.Base(f), + }) + } + + respond.JSON(w, http.StatusOK, retFiles) +} + +func (h *HandlerImpl) CreateStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, params CreateStorageSSLCrtListFileParams) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + respond.MultipartError(w, err) + return + } + file, header, err := r.FormFile("file_upload") + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + defer file.Close() + + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, size, err := crtListStorage.Create(header.Filename, io.NopCloser(file)) + if err != nil { + respond.Error(w, err) + return + } + + retf := &models.SslCrtListFile{ + File: filename, + Description: "managed certificate list", + StorageName: filepath.Base(filename), + Size: &size, + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, retf) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), retf) +} + +func (h *HandlerImpl) DeleteStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListFileParams) { + configuration, err := h.Client.Configuration() + if err != nil { + respond.Error(w, err) + return + } + runningConf := strings.NewReader(configuration.Parser().String()) + + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, _, err := crtListStorage.Get(name) + if err != nil { + respond.Error(w, err) + return + } + + // this is far from perfect but should provide a basic level of protection + scanner := bufio.NewScanner(runningConf) + + lineNr := 0 + + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if len(line) > 0 && line[0] != '#' && strings.Contains(line, filename) { + errCode := misc.ErrHTTPConflict + errMsg := fmt.Sprintf("rejecting attempt to delete file %s referenced in haproxy conf at line %d: %s", filename, lineNr-1, line) + respond.JSON(w, int(errCode), &models.Error{Code: &errCode, Message: &errMsg}) + return + } + lineNr++ + } + + if err = crtListStorage.Delete(name); err != nil { + respond.Error(w, err) + return + } + + if params.SkipReload { + respond.NoContent(w) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} + +func (h *HandlerImpl) GetOneStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string) { + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + rc, err := crtListStorage.GetRawContents(name) + if err != nil { + respond.Error(w, err) + return + } + defer rc.Close() + + w.Header().Set("Content-Type", "application/octet-stream") + w.WriteHeader(http.StatusOK) + respond.Copy(w, rc) +} + +func (h *HandlerImpl) ReplaceStorageSSLCrtListFile(w http.ResponseWriter, r *http.Request, name string, params ReplaceStorageSSLCrtListFileParams) { + data, err := io.ReadAll(r.Body) + if err != nil { + respond.BadRequest(w, err.Error()) + return + } + + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + filename, err := crtListStorage.Replace(name, string(data)) + if err != nil { + respond.Error(w, err) + return + } + + size := int64(len(data)) + retf := &models.SslCrtListFile{ + File: filename, + Description: "managed certificate list", + StorageName: filepath.Base(filename), + Size: &size, + } + + if params.SkipReload { + respond.JSON(w, http.StatusOK, retf) + return + } + + if params.ForceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusOK, retf) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), retf) +} + +func (h *HandlerImpl) GetStorageSSLCrtListEntries(w http.ResponseWriter, r *http.Request, name string) { + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + contents, err := crtListStorage.GetContents(name) + if err != nil { + respond.Error(w, err) + return + } + + entries, err := cnruntime.ParseCrtListEntries(contents) + if err != nil { + respond.Error(w, err) + return + } + + respond.JSON(w, http.StatusOK, entries) +} + +func (h *HandlerImpl) CreateStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params CreateStorageSSLCrtListEntryParams) { + var entry SslCrtListEntry + if !respond.DecodeBody(r, w, &entry) { + return + } + + if entry.File == "" { + respond.BadRequest(w, "missing certificate file name") + return + } + + // Serialize the entry to a single line. + var sb strings.Builder + sb.Grow(len(entry.File) + len(entry.SSLBindConfig) + 32) + sb.WriteString(entry.File) + if entry.SSLBindConfig != "" { + sb.WriteString(" [") + sb.WriteString(entry.SSLBindConfig) + sb.WriteByte(']') + } + if len(entry.SNIFilter) > 0 { + sb.WriteByte(' ') + sb.WriteString(strings.Join(entry.SNIFilter, " ")) + } + sb.WriteByte('\n') + line := sb.String() + + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + // Append the entry to the crt-list file. + content, err := crtListStorage.GetContents(name) + if err == nil { + _, err = crtListStorage.Replace(name, content+line) + } else if errors.Is(err, cnconf.ErrObjectDoesNotExist) { + _, _, err = crtListStorage.Create(name, io.NopCloser(strings.NewReader(line))) + } + if err != nil { + respond.Error(w, err) + return + } + + // Try to add the entry to the HAProxy runtime. Force the reload if that fails. + forceReload := params.ForceReload + rt, err := h.Client.Runtime() + if err != nil { + forceReload = true + } else { + if errAdd := rt.AddCrtListEntry(name, entry); errAdd != nil { + log.Warning("failed to add crt-list entry via runtime: ", errAdd) + forceReload = true + } + } + + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.JSON(w, http.StatusCreated, &entry) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} + +func (h *HandlerImpl) DeleteStorageSSLCrtListEntry(w http.ResponseWriter, r *http.Request, name string, params DeleteStorageSSLCrtListEntryParams) { + crtListStorage, err := h.Client.CrtListStorage() + if err != nil { + respond.Error(w, err) + return + } + + // Modify the crt-file on storage. + content, err := crtListStorage.GetContents(name) + if err != nil { + respond.Error(w, err) + return + } + + lineNumber := int64(params.LineNumber) + lineno := int64(0) + firstMatch := lineNumber > 0 + var sbOut strings.Builder // the modified contents + sbOut.Grow(len(content)) + for line := range strings.SplitSeq(content, "\n") { + lineno++ + if strings.HasPrefix(line, params.Certificate) { + if lineNumber == lineno || firstMatch { + // skip that line + firstMatch = false + continue + } + } + sbOut.WriteString(line) + sbOut.WriteByte('\n') + } + + if _, err = crtListStorage.Replace(name, sbOut.String()); err != nil { + respond.Error(w, err) + return + } + + // Try to delete the entry with the HAProxy runtime. Force the reload if that fails. + forceReload := params.ForceReload + rt, err := h.Client.Runtime() + if err != nil { + forceReload = true + } else { + var num *int64 + if lineNumber != 0 { + num = &lineNumber + } + if errDel := rt.DeleteCrtListEntry(name, params.Certificate, num); errDel != nil { + log.Warning("failed to delete crt-list entry via runtime: ", errDel) + forceReload = true + } + } + + if forceReload { + if err = h.ReloadAgent.ForceReload(); err != nil { + respond.Error(w, err) + return + } + respond.NoContent(w) + return + } + + respond.Accepted(w, h.ReloadAgent.Reload(), nil) +} diff --git a/handlers/table.go b/handlers/table.go deleted file mode 100644 index 3e9a4056..00000000 --- a/handlers/table.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2023 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/table" -) - -// CreateTableHandlerImpl implementation of the CreateTableHandler interface using client-native client -type CreateTableHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteTableHandlerImpl implementation of the DeleteTableHandler interface using client-native client -type DeleteTableHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetTableHandlerImpl implementation of the GetTableHandler interface using client-native client -type GetTableHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetTablesHandlerImpl implementation of the GetTablesHandler interface using client-native client -type GetTablesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceTableHandlerImpl implementation of the ReplaceTableHandler interface using client-native client -type ReplaceTableHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateTableHandlerImpl) Handle(params table.CreateTableParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return table.NewCreateTableDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return table.NewCreateTableDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateTable(params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return table.NewCreateTableDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return table.NewCreateTableDefault(int(*e.Code)).WithPayload(e) - } - return table.NewCreateTableCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return table.NewCreateTableAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return table.NewCreateTableAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteTableHandlerImpl) Handle(params table.DeleteTableParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return table.NewDeleteTableDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return table.NewDeleteTableDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTable(params.Name, params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return table.NewDeleteTableDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return table.NewDeleteTableDefault(int(*e.Code)).WithPayload(e) - } - return table.NewDeleteTableNoContent() - } - rID := h.ReloadAgent.Reload() - return table.NewDeleteTableAccepted().WithReloadID(rID) - } - return table.NewDeleteTableAccepted() -} - -// Handle executing the request and returning a response -func (h *GetTableHandlerImpl) Handle(params table.GetTableParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return table.NewGetTableDefault(int(*e.Code)).WithPayload(e) - } - - _, ta, err := configuration.GetTable(params.Name, params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return table.NewGetTableDefault(int(*e.Code)).WithPayload(e) - } - return table.NewGetTableOK().WithPayload(ta) -} - -// Handle executing the request and returning a response -func (h *GetTablesHandlerImpl) Handle(params table.GetTablesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return table.NewGetTablesDefault(int(*e.Code)).WithPayload(e) - } - - _, tables, err := configuration.GetTables(params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return table.NewGetTablesDefault(int(*e.Code)).WithPayload(e) - } - return table.NewGetTablesOK().WithPayload(tables) -} - -// Handle executing the request and returning a response -func (h *ReplaceTableHandlerImpl) Handle(params table.ReplaceTableParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return table.NewReplaceTableDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return table.NewReplaceTableDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditTable(params.Name, params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return table.NewReplaceTableDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return table.NewReplaceTableDefault(int(*e.Code)).WithPayload(e) - } - return table.NewReplaceTableOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return table.NewReplaceTableAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return table.NewReplaceTableAccepted().WithPayload(params.Data) -} diff --git a/handlers/tcp_check.go b/handlers/tcp_check.go deleted file mode 100644 index 903f3ffb..00000000 --- a/handlers/tcp_check.go +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/tcp_check" -) - -// CreateTCPCheckHandlerImpl implementation of the CreateTCPCheckHandler interface using client-native client -type CreateTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteTCPCheckHandlerImpl implementation of the DeleteTCPCheckHandler interface using client-native client -type DeleteTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetTCPCheckHandlerImpl implementation of the GetTCPCheckHandler interface using client-native client -type GetTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllTCPCheckHandlerImpl implementation of the GetTCPChecksHandler interface using client-native client -type GetAllTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceTCPCheckHandlerImpl implementation of the ReplaceTCPCheckHandler interface using client-native client -type ReplaceTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllTCPCheckHandlerImpl implementation of the ReplaceTCPChecksHandler interface using client-native client -type ReplaceAllTCPCheckHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.CreateTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_check.NewCreateTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewCreateTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateTCPCheck(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewCreateTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewCreateTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_check.NewCreateTCPCheckBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_check.NewCreateTCPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return tcp_check.NewCreateTCPCheckBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.DeleteTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_check.NewDeleteTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewDeleteTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTCPCheck(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewDeleteTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewDeleteTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_check.NewDeleteTCPCheckBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return tcp_check.NewCreateTCPCheckBackendAccepted().WithReloadID(rID) - } - - return tcp_check.NewDeleteTCPCheckBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.GetTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewGetTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, data, err := configuration.GetTCPCheck(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewGetTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - return tcp_check.NewGetTCPCheckBackendOK().WithPayload(data) -} - -// Handle executing the request and returning a response -func (h *GetAllTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.GetAllTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewGetAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, data, err := configuration.GetTCPChecks(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return tcp_check.NewGetAllTCPCheckBackendOK().WithPayload(models.TCPChecks{}) - } - return tcp_check.NewGetAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - return tcp_check.NewGetAllTCPCheckBackendOK().WithPayload(data) -} - -// Handle executing the request and returning a response -func (h *ReplaceTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.ReplaceTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_check.NewReplaceTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditTCPCheck(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_check.NewReplaceTCPCheckBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_check.NewReplaceTCPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return tcp_check.NewReplaceTCPCheckBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllTCPCheckHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_check.ReplaceAllTCPCheckBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_check.NewReplaceAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceTCPChecks(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_check.NewReplaceAllTCPCheckBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_check.NewReplaceAllTCPCheckBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_check.NewReplaceAllTCPCheckBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_check.NewReplaceAllTCPCheckBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/tcp_request_rule.go b/handlers/tcp_request_rule.go deleted file mode 100644 index 856e0337..00000000 --- a/handlers/tcp_request_rule.go +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/tcp_request_rule" -) - -// CreateTCPRequestRuleHandlerImpl implementation of the CreateTCPRequestRuleHandler interface using client-native client -type CreateTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteTCPRequestRuleHandlerImpl implementation of the DeleteTCPRequestRuleHandler interface using client-native client -type DeleteTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetTCPRequestRuleHandlerImpl implementation of the GetTCPRequestRuleHandler interface using client-native client -type GetTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllTCPRequestRuleHandlerImpl implementation of the GetTCPRequestRulesHandler interface using client-native client -type GetAllTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceTCPRequestRuleHandlerImpl implementation of the ReplaceTCPRequestRuleHandler interface using client-native client -type ReplaceTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllTCPRequestRuleHandlerImpl implementation of the ReplaceTCPRequestRulesHandler interface using client-native client -type ReplaceAllTCPRequestRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.CreateTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_request_rule.NewCreateTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewCreateTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateTCPRequestRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewCreateTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewCreateTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewCreateTCPRequestRuleBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_request_rule.NewCreateTCPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_request_rule.NewCreateTCPRequestRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.DeleteTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_request_rule.NewDeleteTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewDeleteTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTCPRequestRule(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewDeleteTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewDeleteTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewDeleteTCPRequestRuleBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return tcp_request_rule.NewDeleteTCPRequestRuleBackendAccepted().WithReloadID(rID) - } - return tcp_request_rule.NewDeleteTCPRequestRuleBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.GetTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewGetTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rule, err := configuration.GetTCPRequestRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewGetTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewGetTCPRequestRuleBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.GetAllTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewGetAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetTCPRequestRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return tcp_request_rule.NewGetAllTCPRequestRuleBackendOK().WithPayload(models.TCPRequestRules{}) - } - return tcp_request_rule.NewGetAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewGetAllTCPRequestRuleBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.ReplaceTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_request_rule.NewReplaceTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditTCPRequestRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewReplaceTCPRequestRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_request_rule.NewReplaceTCPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_request_rule.NewReplaceTCPRequestRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *ReplaceAllTCPRequestRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_request_rule.ReplaceAllTCPRequestRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceTCPRequestRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_request_rule.NewReplaceAllTCPRequestRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/tcp_response_rule.go b/handlers/tcp_response_rule.go deleted file mode 100644 index 3e03636e..00000000 --- a/handlers/tcp_response_rule.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - cnconstants "github.com/haproxytech/client-native/v6/configuration/parents" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/tcp_response_rule" -) - -// CreateTCPResponseRuleHandlerImpl implementation of the CreateTCPResponseRuleHandler interface using client-native client -type CreateTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteTCPResponseRuleHandlerImpl implementation of the DeleteTCPResponseRuleHandler interface using client-native client -type DeleteTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetTCPResponseRuleHandlerImpl implementation of the GetTCPResponseRuleHandler interface using client-native client -type GetTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetAllTCPResponseRuleHandlerImpl implementation of the GetTCPResponseRulesHandler interface using client-native client -type GetAllTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceTCPResponseRuleHandlerImpl implementation of the ReplaceTCPResponseRuleHandler interface using client-native client -type ReplaceTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// ReplaceAllTCPResponseRuleHandlerImpl implementation of the ReplaceTCPResponseRulesHandler interface using client-native client -type ReplaceAllTCPResponseRuleHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.CreateTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_response_rule.NewCreateTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewCreateTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateTCPResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewCreateTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewCreateTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewCreateTCPResponseRuleBackendCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_response_rule.NewCreateTCPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_response_rule.NewCreateTCPResponseRuleBackendAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.DeleteTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_response_rule.NewDeleteTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewDeleteTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTCPResponseRule(params.Index, string(parentType), params.ParentName, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewDeleteTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewDeleteTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewDeleteTCPResponseRuleBackendNoContent() - } - rID := h.ReloadAgent.Reload() - return tcp_response_rule.NewDeleteTCPResponseRuleBackendAccepted().WithReloadID(rID) - } - return tcp_response_rule.NewDeleteTCPResponseRuleBackendAccepted() -} - -// Handle executing the request and returning a response -func (h *GetTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.GetTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewGetTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - _, rule, err := configuration.GetTCPResponseRule(params.Index, string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewGetTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewGetTCPResponseRuleBackendOK().WithPayload(rule) -} - -// Handle executing the request and returning a response -func (h *GetAllTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.GetAllTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewGetAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - _, rules, err := configuration.GetTCPResponseRules(string(parentType), params.ParentName, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return tcp_response_rule.NewGetAllTCPResponseRuleBackendOK().WithPayload(models.TCPResponseRules{}) - } - return tcp_response_rule.NewGetAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewGetAllTCPResponseRuleBackendOK().WithPayload(rules) -} - -// Handle executing the request and returning a response -func (h *ReplaceTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.ReplaceTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_response_rule.NewReplaceTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.EditTCPResponseRule(params.Index, string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewReplaceTCPResponseRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_response_rule.NewReplaceTCPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_response_rule.NewReplaceTCPResponseRuleBackendAccepted().WithPayload(params.Data) -} - -func (h *ReplaceAllTCPResponseRuleHandlerImpl) Handle(parentType cnconstants.CnParentType, params tcp_response_rule.ReplaceAllTCPResponseRuleBackendParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.ReplaceTCPResponseRules(string(parentType), params.ParentName, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendDefault(int(*e.Code)).WithPayload(e) - } - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return tcp_response_rule.NewReplaceAllTCPResponseRuleBackendAccepted().WithPayload(params.Data) -} diff --git a/handlers/traces.go b/handlers/traces.go deleted file mode 100644 index bfddbf92..00000000 --- a/handlers/traces.go +++ /dev/null @@ -1,327 +0,0 @@ -// Copyright 2024 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/traces" -) - -type GetTracesHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Get the traces section (it is unique) -func (h *GetTracesHandlerImpl) Handle(params traces.GetTracesParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewGetTracesDefault(int(*e.Code)).WithPayload(e) - } - - var ts *models.Traces - - if params.FullSection != nil && *params.FullSection { - _, ts, err = configuration.GetStructuredTraces(t) - } else { - _, ts, err = configuration.GetTraces(t) - } - - if err != nil { - e := misc.HandleError(err) - return traces.NewGetTracesDefault(int(*e.Code)).WithPayload(e) - } - - return traces.NewGetTracesOK().WithPayload(ts) -} - -type CreateTracesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateTracesHandlerImpl) Handle(params traces.CreateTracesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return traces.NewCreateTracesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewCreateTracesDefault(int(*e.Code)).WithPayload(e) - } - - if err = configuration.CreateTraces(params.Data, t, v); err != nil { - e := misc.HandleError(err) - return traces.NewCreateTracesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return traces.NewCreateTracesDefault(int(*e.Code)).WithPayload(e) - } - return traces.NewCreateTracesCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return traces.NewCreateTracesAccepted().WithReloadID(rID).WithPayload(params.Data) - } - - return traces.NewCreateTracesAccepted().WithPayload(params.Data) -} - -type ReplaceTracesHandler struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *ReplaceTracesHandler) Handle(params traces.ReplaceTracesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return traces.NewReplaceTracesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewReplaceTracesDefault(int(*e.Code)).WithPayload(e) - } - - if params.FullSection != nil && *params.FullSection { - err = configuration.PushStructuredTraces(params.Data, t, v) - } else { - err = configuration.EditTraces(params.Data, t, v) - } - - if err != nil { - e := misc.HandleError(err) - return traces.NewReplaceTracesDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return traces.NewReplaceTracesDefault(int(*e.Code)).WithPayload(e) - } - return traces.NewReplaceTracesOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return traces.NewReplaceTracesAccepted().WithReloadID(rID) - } - - return traces.NewReplaceTracesOK().WithPayload(params.Data) -} - -type DeleteTracesHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteTracesHandlerImpl) Handle(params traces.DeleteTracesParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return traces.NewDeleteTracesDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTracesDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTraces(t, v) - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTracesDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTracesDefault(int(*e.Code)).WithPayload(e) - } - return traces.NewDeleteTracesNoContent() - } - rID := h.ReloadAgent.Reload() - return traces.NewDeleteTracesAccepted().WithReloadID(rID) - } - - return traces.NewDeleteTracesAccepted() -} - -// Trace Entries - -type CreateTraceEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *CreateTraceEntryHandlerImpl) Handle(params traces.CreateTraceEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return traces.NewCreateTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewCreateTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.CreateTraceEntry(params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return traces.NewCreateTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return traces.NewCreateTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - return traces.NewCreateTraceEntryCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return traces.NewCreateTraceEntryAccepted().WithReloadID(rID) - } - - return traces.NewCreateTraceEntryCreated().WithPayload(params.Data) -} - -type DeleteTraceEntryHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -func (h *DeleteTraceEntryHandlerImpl) Handle(params traces.DeleteTraceEntryParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return traces.NewDeleteTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteTraceEntry(params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return traces.NewDeleteTraceEntryDefault(int(*e.Code)).WithPayload(e) - } - return traces.NewDeleteTraceEntryNoContent() - } - rID := h.ReloadAgent.Reload() - return traces.NewDeleteTraceEntryAccepted().WithReloadID(rID) - } - - return traces.NewDeleteTraceEntryAccepted() -} diff --git a/handlers/transaction.go b/handlers/transaction.go deleted file mode 100644 index 1c496862..00000000 --- a/handlers/transaction.go +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "strings" - "sync" - - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - cn "github.com/haproxytech/dataplaneapi/client-native" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/transactions" - "github.com/haproxytech/dataplaneapi/rate" -) - -// RateLimitedStartTransactionHandlerImpl decorates StartTransactionHandlerImpl with the rate limiting logic -type RateLimitedStartTransactionHandlerImpl struct { - TransactionCounter rate.Threshold - Handler transactions.StartTransactionHandler -} - -// StartTransactionHandlerImpl implementation of the StartTransactionHandler interface using client-native client -type StartTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// DeleteTransactionHandlerImpl implementation of the DeleteTransactionHandler interface using client-native client -type DeleteTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetTransactionHandlerImpl implementation of the GetTransactionHandler interface using client-native client -type GetTransactionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetTransactionsHandlerImpl implementation of the GetTransactionsHandler interface using client-native client -type GetTransactionsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// CommitTransactionHandlerImpl implementation of the CommitTransactionHandlerImpl interface using client-native client -type CommitTransactionHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent - Mutex *sync.Mutex -} - -// Handle executing the request and returning a response -func (h *StartTransactionHandlerImpl) Handle(params transactions.StartTransactionParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return transactions.NewStartTransactionDefault(int(*e.Code)).WithPayload(e) - } - t, err := configuration.StartTransaction(params.Version) - if err != nil { - e := misc.HandleError(err) - return transactions.NewStartTransactionDefault(int(*e.Code)).WithPayload(e) - } - return transactions.NewStartTransactionCreated().WithPayload(t) -} - -// Handle executing the request and returning a response -func (h *DeleteTransactionHandlerImpl) Handle(params transactions.DeleteTransactionParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return transactions.NewDeleteTransactionDefault(int(*e.Code)).WithPayload(e) - } - err = configuration.DeleteTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - if strings.HasSuffix(*e.Message, "does not exist") { - e.Code = misc.Int64P(404) - return transactions.NewDeleteTransactionNotFound().WithPayload(e) - } - return transactions.NewDeleteTransactionDefault(int(*e.Code)).WithPayload(e) - } - return transactions.NewDeleteTransactionNoContent() -} - -// Handle executing the request and returning a response -func (h *GetTransactionHandlerImpl) Handle(params transactions.GetTransactionParams, principal any) middleware.Responder { - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return transactions.NewGetTransactionDefault(int(*e.Code)).WithPayload(e) - } - t, err := configuration.GetTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - if strings.HasSuffix(*e.Message, "does not exist") { - e.Code = misc.Int64P(404) - return transactions.NewDeleteTransactionNotFound().WithPayload(e) - } - return transactions.NewGetTransactionsDefault(int(*e.Code)).WithPayload(e) - } - return transactions.NewGetTransactionOK().WithPayload(t) -} - -// Handle executing the request and returning a response -func (h *GetTransactionsHandlerImpl) Handle(params transactions.GetTransactionsParams, principal any) middleware.Responder { - s := "" - if params.Status != nil { - s = *params.Status - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return transactions.NewGetTransactionsDefault(int(*e.Code)).WithPayload(e) - } - - ts, err := configuration.GetTransactions(s) - if err != nil { - e := misc.HandleError(err) - return transactions.NewGetTransactionsDefault(int(*e.Code)).WithPayload(e) - } - return transactions.NewGetTransactionsOK().WithPayload(*ts) -} - -// Handle executing the request and returning a response -func (h *CommitTransactionHandlerImpl) Handle(params transactions.CommitTransactionParams, principal any) middleware.Responder { - h.Mutex.Lock() - defer h.Mutex.Unlock() - - var err error - - var transaction *models.Transaction - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - - if transaction, err = configuration.GetTransaction(params.ID); err != nil { - e := misc.HandleError(err) - if strings.HasSuffix(*e.Message, "does not exist") { - e.Code = misc.Int64P(404) - return transactions.NewDeleteTransactionNotFound().WithPayload(e) - } - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - switch transaction.Status { - case models.TransactionStatusOutdated: - return transactions.NewCommitTransactionNotAcceptable().WithPayload(misc.OutdatedTransactionError(transaction.ID)) - case models.TransactionStatusFailed: - return transactions.NewCommitTransactionNotAcceptable().WithPayload(misc.FailedTransactionError(transaction.ID)) - } - - var t *models.Transaction - t, err = configuration.CommitTransaction(params.ID) - if err != nil { - e := misc.HandleError(err) - if strings.HasSuffix(*e.Message, "does not exist") { - e.Code = misc.Int64P(404) - return transactions.NewDeleteTransactionNotFound().WithPayload(e) - } - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - - // Deleting outdated transactions with mismatching version ID - var txs *models.Transactions - txs, err = configuration.GetTransactions(models.TransactionStatusInProgress) - if err != nil { - e := misc.HandleError(err) - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - for _, tx := range *txs { - if tx.Version <= t.Version { - _ = configuration.MarkTransactionOutdated(tx.ID) - } - } - - callbackNeeded, reconfigureFunc, err := cn.ReconfigureRuntime(h.Client) - if err != nil { - e := misc.HandleError(err) - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - - if *params.ForceReload { - if callbackNeeded { - err = h.ReloadAgent.ForceReloadWithCallback(reconfigureFunc) - } else { - err = h.ReloadAgent.ForceReload() - } - - if err != nil { - e := misc.HandleError(err) - return transactions.NewCommitTransactionDefault(int(*e.Code)).WithPayload(e) - } - return transactions.NewCommitTransactionOK().WithPayload(t) - } - - var rID string - if callbackNeeded { - rID = h.ReloadAgent.ReloadWithCallback(reconfigureFunc) - } else { - rID = h.ReloadAgent.Reload() - } - - return transactions.NewCommitTransactionAccepted().WithReloadID(rID).WithPayload(t) -} - -// Handle executes the decorated Handler and, in case of successful creation, increase the counter if this is -func (r RateLimitedStartTransactionHandlerImpl) Handle(params transactions.StartTransactionParams, principal any) middleware.Responder { - if err := r.TransactionCounter.LimitReached(); err != nil { - e := misc.HandleError(err) - return transactions.NewStartTransactionDefault(int(*e.Code)).WithPayload(e) - } - return r.Handler.Handle(params, principal) -} diff --git a/handlers/user.go b/handlers/user.go deleted file mode 100644 index 745c025d..00000000 --- a/handlers/user.go +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/user" -) - -// CreateUserHandlerImpl implementation of the CreateUserHandler interface using client-native client -type CreateUserHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteUserHandlerImpl implementation of the DeleteUserHandler interface using client-native client -type DeleteUserHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetUserHandlerImpl implementation of the GetUserHandler interface using client-native client -type GetUserHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetUsersHandlerImpl implementation of the GetUsersHandler interface using client-native client -type GetUsersHandlerImpl struct { - Client client_native.HAProxyClient -} - -// ReplaceUserHandlerImpl implementation of the ReplaceUserHandler interface using client-native client -type ReplaceUserHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// Handle executing the request and returning a response -func (h *CreateUserHandlerImpl) Handle(params user.CreateUserParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return user.NewCreateUserDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return user.NewCreateUserDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, _ := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return user.NewCreateUserBadRequest() - } - - err = configuration.CreateUser(params.Userlist, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return user.NewCreateUserDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return user.NewCreateUserDefault(int(*e.Code)).WithPayload(e) - } - return user.NewCreateUserCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return user.NewCreateUserAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return user.NewCreateUserAccepted().WithPayload(params.Data) -} - -// Handle executing the request and returning a response -func (h *DeleteUserHandlerImpl) Handle(params user.DeleteUserParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return user.NewDeleteUserDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return user.NewDeleteUserDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return user.NewDeleteUserNotFound() - } - if err != nil { - return user.NewDeleteUserNotFound() - } - - _, u, err := configuration.GetUser(params.Username, params.Userlist, t) - if u == nil { - return user.NewDeleteUserNotFound() - } - if err != nil { - return user.NewDeleteUserNotFound() - } - - err = configuration.DeleteUser(params.Username, params.Userlist, t, v) - if err != nil { - e := misc.HandleError(err) - return user.NewDeleteUserDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return user.NewDeleteUserDefault(int(*e.Code)).WithPayload(e) - } - return user.NewDeleteUserNoContent() - } - rID := h.ReloadAgent.Reload() - return user.NewDeleteUserAccepted().WithReloadID(rID) - } - return user.NewDeleteUserAccepted() -} - -// Handle executing the request and returning a response -func (h *GetUserHandlerImpl) Handle(params user.GetUserParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return user.NewGetUserDefault(int(*e.Code)).WithPayload(e) - } - - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return user.NewGetUserNotFound() - } - if err != nil { - return user.NewGetUserNotFound() - } - - _, u, err := configuration.GetUser(params.Username, params.Userlist, t) - if u == nil { - return user.NewGetUserNotFound() - } - if err != nil { - e := misc.HandleError(err) - return user.NewGetUserDefault(int(*e.Code)).WithPayload(e) - } - - return user.NewGetUserOK().WithPayload(u) -} - -// Handle executing the request and returning a response -func (h *GetUsersHandlerImpl) Handle(params user.GetUsersParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return user.NewGetUsersDefault(int(*e.Code)).WithPayload(e) - } - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return user.NewGetUserNotFound() - } - if err != nil { - return user.NewGetUserNotFound() - } - _, users, err := configuration.GetUsers(params.Userlist, t) - if err != nil { - e := misc.HandleContainerGetError(err) - if *e.Code == misc.ErrHTTPOk { - return user.NewGetUsersOK().WithPayload(models.Users{}) - } - return user.NewGetUsersDefault(int(*e.Code)).WithPayload(e) - } - return user.NewGetUsersOK().WithPayload(users) -} - -// Handle executing the request and returning a response -func (h *ReplaceUserHandlerImpl) Handle(params user.ReplaceUserParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return user.NewReplaceUserDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return user.NewReplaceUserDefault(int(*e.Code)).WithPayload(e) - } - _, userlist, err := configuration.GetUserList(params.Userlist, t) - if userlist == nil { - return user.NewReplaceUserNotFound() - } - if err != nil { - return user.NewReplaceUserNotFound() - } - - _, u, err := configuration.GetUser(params.Username, params.Userlist, t) - if u == nil { - return user.NewReplaceUserNotFound() - } - if err != nil { - return user.NewReplaceUserNotFound() - } - - err = configuration.EditUser(params.Username, params.Userlist, params.Data, t, v) - if err != nil { - e := misc.HandleError(err) - return user.NewReplaceUserDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return user.NewReplaceUserDefault(int(*e.Code)).WithPayload(e) - } - return user.NewReplaceUserOK().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return user.NewReplaceUserAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return user.NewReplaceUserAccepted().WithPayload(params.Data) -} diff --git a/handlers/userlist.go b/handlers/userlist.go deleted file mode 100644 index eb6cf15c..00000000 --- a/handlers/userlist.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - "github.com/haproxytech/client-native/v6/models" - - "github.com/haproxytech/dataplaneapi/haproxy" - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/userlist" -) - -// CreateUserListHandlerImpl implementation of the CreateUserlistHandler interface using client-native client -type CreateUserListHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// DeleteUserListHandlerImpl implementation of the DeleteUserListHandler interface using client-native client -type DeleteUserListHandlerImpl struct { - Client client_native.HAProxyClient - ReloadAgent haproxy.IReloadAgent -} - -// GetUserListHandlerImpl implementation of the GetUserListHandler interface using client-native client -type GetUserListHandlerImpl struct { - Client client_native.HAProxyClient -} - -// GetUserListsHandlerImpl implementation of the GetUserListsHandler interface using client-native client -type GetUserListsHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *CreateUserListHandlerImpl) Handle(params userlist.CreateUserlistParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return userlist.NewCreateUserlistDefault(int(*e.Code)).WithPayload(e) - } - - err := h.createUserList(params, t, v) - if err != nil { - e := misc.HandleError(err) - return userlist.NewCreateUserlistDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return userlist.NewCreateUserlistDefault(int(*e.Code)).WithPayload(e) - } - return userlist.NewCreateUserlistCreated().WithPayload(params.Data) - } - rID := h.ReloadAgent.Reload() - return userlist.NewCreateUserlistAccepted().WithReloadID(rID).WithPayload(params.Data) - } - return userlist.NewCreateUserlistAccepted().WithPayload(params.Data) -} - -func (h *CreateUserListHandlerImpl) createUserList(params userlist.CreateUserlistParams, t string, v int64) error { - configuration, err := h.Client.Configuration() - if err != nil { - return err - } - if params.FullSection != nil && *params.FullSection { - return configuration.CreateStructuredUserList(params.Data, t, v) - } - return configuration.CreateUserList(params.Data, t, v) -} - -// Handle executing the request and returning a response -func (h *DeleteUserListHandlerImpl) Handle(params userlist.DeleteUserlistParams, principal any) middleware.Responder { - t := "" - v := int64(0) - if params.TransactionID != nil { - t = *params.TransactionID - } - if params.Version != nil { - v = *params.Version - } - - if t != "" && *params.ForceReload { - msg := "Both force_reload and transaction specified, specify only one" - c := misc.ErrHTTPBadRequest - e := &models.Error{ - Message: &msg, - Code: &c, - } - return userlist.NewDeleteUserlistDefault(int(*e.Code)).WithPayload(e) - } - - configuration, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return userlist.NewDeleteUserlistDefault(int(*e.Code)).WithPayload(e) - } - - err = configuration.DeleteUserList(params.Name, t, v) - if err != nil { - e := misc.HandleError(err) - return userlist.NewDeleteUserlistDefault(int(*e.Code)).WithPayload(e) - } - if params.TransactionID == nil { - if *params.ForceReload { - err := h.ReloadAgent.ForceReload() - if err != nil { - e := misc.HandleError(err) - return userlist.NewDeleteUserlistDefault(int(*e.Code)).WithPayload(e) - } - return userlist.NewDeleteUserlistNoContent() - } - rID := h.ReloadAgent.Reload() - return userlist.NewDeleteUserlistAccepted().WithReloadID(rID) - } - return userlist.NewDeleteUserlistAccepted() -} - -// Handle executing the request and returning a response -func (h *GetUserListHandlerImpl) Handle(params userlist.GetUserlistParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, u, err := h.getUserList(params, t) - if err != nil { - e := misc.HandleError(err) - return userlist.NewGetUserlistDefault(int(*e.Code)).WithPayload(e) - } - return userlist.NewGetUserlistOK().WithPayload(u) -} - -func (h *GetUserListHandlerImpl) getUserList(params userlist.GetUserlistParams, t string) (int64, *models.Userlist, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredUserList(params.Name, t) - } - return configuration.GetUserList(params.Name, t) -} - -// Handle executing the request and returning a response -func (h *GetUserListsHandlerImpl) Handle(params userlist.GetUserlistsParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - _, userlists, err := h.getUserLists(params, t) - if err != nil { - e := misc.HandleError(err) - return userlist.NewGetUserlistsDefault(int(*e.Code)).WithPayload(e) - } - return userlist.NewGetUserlistsOK().WithPayload(userlists) -} - -func (h *GetUserListsHandlerImpl) getUserLists(params userlist.GetUserlistsParams, t string) (int64, models.Userlists, error) { - configuration, err := h.Client.Configuration() - if err != nil { - return 0, nil, err - } - if params.FullSection != nil && *params.FullSection { - return configuration.GetStructuredUserLists(t) - } - return configuration.GetUserLists(t) -} diff --git a/handlers/version.go b/handlers/version.go deleted file mode 100644 index 2726d612..00000000 --- a/handlers/version.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package handlers - -import ( - "github.com/go-openapi/runtime/middleware" - client_native "github.com/haproxytech/client-native/v6" - - "github.com/haproxytech/dataplaneapi/misc" - "github.com/haproxytech/dataplaneapi/operations/configuration" -) - -// GetMapsHandlerImpl implementation of the GetAllRuntimeMapFilesHandler interface using client-native client -type ConfigurationGetConfigurationVersionHandlerImpl struct { - Client client_native.HAProxyClient -} - -// Handle executing the request and returning a response -func (h *ConfigurationGetConfigurationVersionHandlerImpl) Handle(params configuration.GetConfigurationVersionParams, principal any) middleware.Responder { - t := "" - if params.TransactionID != nil { - t = *params.TransactionID - } - - cfg, err := h.Client.Configuration() - if err != nil { - e := misc.HandleError(err) - return configuration.NewGetConfigurationVersionDefault(int(*e.Code)).WithPayload(e) - } - - v, err := cfg.GetConfigurationVersion(t) - if err != nil { - e := misc.HandleError(err) - return configuration.NewGetConfigurationVersionDefault(int(*e.Code)).WithPayload(e) - } - return configuration.NewGetConfigurationVersionOK().WithPayload(v) -} diff --git a/misc/misc.go b/misc/misc.go index 31ecc8a6..41abf3d9 100644 --- a/misc/misc.go +++ b/misc/misc.go @@ -34,9 +34,9 @@ import ( "github.com/haproxytech/client-native/v6/models" jsoniter "github.com/json-iterator/go" - "github.com/haproxytech/dataplaneapi/haproxy" "github.com/haproxytech/dataplaneapi/log" "github.com/haproxytech/dataplaneapi/rate" + "github.com/haproxytech/dataplaneapi/reload_agent" ) const ( @@ -89,7 +89,7 @@ func HandleError(err error) *models.Error { httpCode = ErrHTTPBadRequest } return &models.Error{Code: &httpCode, Message: &msg} - case *haproxy.ReloadError: + case *reload_agent.ReloadError: httpCode := ErrHTTPBadRequest msg := t.Error() return &models.Error{Code: &httpCode, Message: &msg} @@ -102,6 +102,8 @@ func HandleError(err error) *models.Error { code := ErrHTTPInternalServerError if errors.Is(t, client_errors.ErrNotFound) { code = ErrHTTPNotFound + } else if errors.Is(t, client_errors.ErrAlreadyExists) { + code = ErrHTTPConflict } return &models.Error{Code: &code, Message: &msg} } @@ -224,26 +226,6 @@ func GetHTTPStatusFromErr(err error) int { } } -func SetError(code int, msg string) *models.Error { - return &models.Error{ - Code: Int64P(code), - Message: StringP(msg), - } -} - -func StringP(s string) *string { - return &s -} - -func Int64P(i int) *int64 { - i64 := int64(i) - return &i64 -} - -func PtrTo[T any](v T) *T { - return &v -} - // extractEnvVar extracts and returns env variable from HAProxy variable // provided in "${SOME_VAR}" format func ExtractEnvVar(pass string) string { diff --git a/operations/acl/create_acl_backend.go b/operations/acl/create_acl_backend.go deleted file mode 100644 index ce52e01c..00000000 --- a/operations/acl/create_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateACLBackendHandlerFunc turns a function with the right signature into a create Acl backend handler -type CreateACLBackendHandlerFunc func(CreateACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateACLBackendHandlerFunc) Handle(params CreateACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateACLBackendHandler interface for that can handle valid create Acl backend params -type CreateACLBackendHandler interface { - Handle(CreateACLBackendParams, interface{}) middleware.Responder -} - -// NewCreateACLBackend creates a new http.Handler for the create Acl backend operation -func NewCreateACLBackend(ctx *middleware.Context, handler CreateACLBackendHandler) *CreateACLBackend { - return &CreateACLBackend{Context: ctx, Handler: handler} -} - -/* - CreateACLBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/acls/{index} ACL createAclBackend - -# Add a new ACL line - -Adds a new ACL line of the specified type in the specified parent. -*/ -type CreateACLBackend struct { - Context *middleware.Context - Handler CreateACLBackendHandler -} - -func (o *CreateACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/create_acl_backend_parameters.go b/operations/acl/create_acl_backend_parameters.go deleted file mode 100644 index 4cc2c5db..00000000 --- a/operations/acl/create_acl_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateACLBackendParams creates a new CreateACLBackendParams object -// with the default values initialized. -func NewCreateACLBackendParams() CreateACLBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateACLBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateACLBackendParams contains all the bound params for the create Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAclBackend -type CreateACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateACLBackendParams() beforehand. -func (o *CreateACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateACLBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateACLBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateACLBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateACLBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/create_acl_backend_responses.go b/operations/acl/create_acl_backend_responses.go deleted file mode 100644 index 9d924cd7..00000000 --- a/operations/acl/create_acl_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateACLBackendCreatedCode is the HTTP code returned for type CreateACLBackendCreated -const CreateACLBackendCreatedCode int = 201 - -/* -CreateACLBackendCreated ACL line created - -swagger:response createAclBackendCreated -*/ -type CreateACLBackendCreated struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLBackendCreated creates CreateACLBackendCreated with default headers values -func NewCreateACLBackendCreated() *CreateACLBackendCreated { - - return &CreateACLBackendCreated{} -} - -// WithPayload adds the payload to the create Acl backend created response -func (o *CreateACLBackendCreated) WithPayload(payload *models.ACL) *CreateACLBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl backend created response -func (o *CreateACLBackendCreated) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLBackendAcceptedCode is the HTTP code returned for type CreateACLBackendAccepted -const CreateACLBackendAcceptedCode int = 202 - -/* -CreateACLBackendAccepted Configuration change accepted and reload requested - -swagger:response createAclBackendAccepted -*/ -type CreateACLBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLBackendAccepted creates CreateACLBackendAccepted with default headers values -func NewCreateACLBackendAccepted() *CreateACLBackendAccepted { - - return &CreateACLBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Acl backend accepted response -func (o *CreateACLBackendAccepted) WithReloadID(reloadID string) *CreateACLBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Acl backend accepted response -func (o *CreateACLBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Acl backend accepted response -func (o *CreateACLBackendAccepted) WithPayload(payload *models.ACL) *CreateACLBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl backend accepted response -func (o *CreateACLBackendAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLBackendBadRequestCode is the HTTP code returned for type CreateACLBackendBadRequest -const CreateACLBackendBadRequestCode int = 400 - -/* -CreateACLBackendBadRequest Bad request - -swagger:response createAclBackendBadRequest -*/ -type CreateACLBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLBackendBadRequest creates CreateACLBackendBadRequest with default headers values -func NewCreateACLBackendBadRequest() *CreateACLBackendBadRequest { - - return &CreateACLBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl backend bad request response -func (o *CreateACLBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateACLBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl backend bad request response -func (o *CreateACLBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl backend bad request response -func (o *CreateACLBackendBadRequest) WithPayload(payload *models.Error) *CreateACLBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl backend bad request response -func (o *CreateACLBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLBackendConflictCode is the HTTP code returned for type CreateACLBackendConflict -const CreateACLBackendConflictCode int = 409 - -/* -CreateACLBackendConflict The specified resource already exists - -swagger:response createAclBackendConflict -*/ -type CreateACLBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLBackendConflict creates CreateACLBackendConflict with default headers values -func NewCreateACLBackendConflict() *CreateACLBackendConflict { - - return &CreateACLBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl backend conflict response -func (o *CreateACLBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateACLBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl backend conflict response -func (o *CreateACLBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl backend conflict response -func (o *CreateACLBackendConflict) WithPayload(payload *models.Error) *CreateACLBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl backend conflict response -func (o *CreateACLBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateACLBackendDefault General Error - -swagger:response createAclBackendDefault -*/ -type CreateACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLBackendDefault creates CreateACLBackendDefault with default headers values -func NewCreateACLBackendDefault(code int) *CreateACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create Acl backend default response -func (o *CreateACLBackendDefault) WithStatusCode(code int) *CreateACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create Acl backend default response -func (o *CreateACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl backend default response -func (o *CreateACLBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl backend default response -func (o *CreateACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl backend default response -func (o *CreateACLBackendDefault) WithPayload(payload *models.Error) *CreateACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl backend default response -func (o *CreateACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/create_acl_backend_urlbuilder.go b/operations/acl/create_acl_backend_urlbuilder.go deleted file mode 100644 index 6cfbe3e1..00000000 --- a/operations/acl/create_acl_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateACLBackendURL generates an URL for the create Acl backend operation -type CreateACLBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLBackendURL) WithBasePath(bp string) *CreateACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateACLBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/create_acl_defaults.go b/operations/acl/create_acl_defaults.go deleted file mode 100644 index fa218d8a..00000000 --- a/operations/acl/create_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateACLDefaultsHandlerFunc turns a function with the right signature into a create Acl defaults handler -type CreateACLDefaultsHandlerFunc func(CreateACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateACLDefaultsHandlerFunc) Handle(params CreateACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateACLDefaultsHandler interface for that can handle valid create Acl defaults params -type CreateACLDefaultsHandler interface { - Handle(CreateACLDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateACLDefaults creates a new http.Handler for the create Acl defaults operation -func NewCreateACLDefaults(ctx *middleware.Context, handler CreateACLDefaultsHandler) *CreateACLDefaults { - return &CreateACLDefaults{Context: ctx, Handler: handler} -} - -/* - CreateACLDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/acls/{index} ACL createAclDefaults - -# Add a new ACL line - -Adds a new ACL line of the specified type in the specified parent. -*/ -type CreateACLDefaults struct { - Context *middleware.Context - Handler CreateACLDefaultsHandler -} - -func (o *CreateACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/create_acl_defaults_parameters.go b/operations/acl/create_acl_defaults_parameters.go deleted file mode 100644 index f1768048..00000000 --- a/operations/acl/create_acl_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateACLDefaultsParams creates a new CreateACLDefaultsParams object -// with the default values initialized. -func NewCreateACLDefaultsParams() CreateACLDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateACLDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateACLDefaultsParams contains all the bound params for the create Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAclDefaults -type CreateACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateACLDefaultsParams() beforehand. -func (o *CreateACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateACLDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateACLDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateACLDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateACLDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/create_acl_defaults_responses.go b/operations/acl/create_acl_defaults_responses.go deleted file mode 100644 index db1ad6a2..00000000 --- a/operations/acl/create_acl_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateACLDefaultsCreatedCode is the HTTP code returned for type CreateACLDefaultsCreated -const CreateACLDefaultsCreatedCode int = 201 - -/* -CreateACLDefaultsCreated ACL line created - -swagger:response createAclDefaultsCreated -*/ -type CreateACLDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLDefaultsCreated creates CreateACLDefaultsCreated with default headers values -func NewCreateACLDefaultsCreated() *CreateACLDefaultsCreated { - - return &CreateACLDefaultsCreated{} -} - -// WithPayload adds the payload to the create Acl defaults created response -func (o *CreateACLDefaultsCreated) WithPayload(payload *models.ACL) *CreateACLDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl defaults created response -func (o *CreateACLDefaultsCreated) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLDefaultsAcceptedCode is the HTTP code returned for type CreateACLDefaultsAccepted -const CreateACLDefaultsAcceptedCode int = 202 - -/* -CreateACLDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createAclDefaultsAccepted -*/ -type CreateACLDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLDefaultsAccepted creates CreateACLDefaultsAccepted with default headers values -func NewCreateACLDefaultsAccepted() *CreateACLDefaultsAccepted { - - return &CreateACLDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Acl defaults accepted response -func (o *CreateACLDefaultsAccepted) WithReloadID(reloadID string) *CreateACLDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Acl defaults accepted response -func (o *CreateACLDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Acl defaults accepted response -func (o *CreateACLDefaultsAccepted) WithPayload(payload *models.ACL) *CreateACLDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl defaults accepted response -func (o *CreateACLDefaultsAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLDefaultsBadRequestCode is the HTTP code returned for type CreateACLDefaultsBadRequest -const CreateACLDefaultsBadRequestCode int = 400 - -/* -CreateACLDefaultsBadRequest Bad request - -swagger:response createAclDefaultsBadRequest -*/ -type CreateACLDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLDefaultsBadRequest creates CreateACLDefaultsBadRequest with default headers values -func NewCreateACLDefaultsBadRequest() *CreateACLDefaultsBadRequest { - - return &CreateACLDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl defaults bad request response -func (o *CreateACLDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateACLDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl defaults bad request response -func (o *CreateACLDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl defaults bad request response -func (o *CreateACLDefaultsBadRequest) WithPayload(payload *models.Error) *CreateACLDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl defaults bad request response -func (o *CreateACLDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLDefaultsConflictCode is the HTTP code returned for type CreateACLDefaultsConflict -const CreateACLDefaultsConflictCode int = 409 - -/* -CreateACLDefaultsConflict The specified resource already exists - -swagger:response createAclDefaultsConflict -*/ -type CreateACLDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLDefaultsConflict creates CreateACLDefaultsConflict with default headers values -func NewCreateACLDefaultsConflict() *CreateACLDefaultsConflict { - - return &CreateACLDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl defaults conflict response -func (o *CreateACLDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateACLDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl defaults conflict response -func (o *CreateACLDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl defaults conflict response -func (o *CreateACLDefaultsConflict) WithPayload(payload *models.Error) *CreateACLDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl defaults conflict response -func (o *CreateACLDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateACLDefaultsDefault General Error - -swagger:response createAclDefaultsDefault -*/ -type CreateACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLDefaultsDefault creates CreateACLDefaultsDefault with default headers values -func NewCreateACLDefaultsDefault(code int) *CreateACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) WithStatusCode(code int) *CreateACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) WithPayload(payload *models.Error) *CreateACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl defaults default response -func (o *CreateACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/create_acl_defaults_urlbuilder.go b/operations/acl/create_acl_defaults_urlbuilder.go deleted file mode 100644 index 89cc6e14..00000000 --- a/operations/acl/create_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateACLDefaultsURL generates an URL for the create Acl defaults operation -type CreateACLDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLDefaultsURL) WithBasePath(bp string) *CreateACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateACLDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/create_acl_fcgi_app.go b/operations/acl/create_acl_fcgi_app.go deleted file mode 100644 index 694ad7f4..00000000 --- a/operations/acl/create_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateACLFCGIAppHandlerFunc turns a function with the right signature into a create Acl FCGI app handler -type CreateACLFCGIAppHandlerFunc func(CreateACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateACLFCGIAppHandlerFunc) Handle(params CreateACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateACLFCGIAppHandler interface for that can handle valid create Acl FCGI app params -type CreateACLFCGIAppHandler interface { - Handle(CreateACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewCreateACLFCGIApp creates a new http.Handler for the create Acl FCGI app operation -func NewCreateACLFCGIApp(ctx *middleware.Context, handler CreateACLFCGIAppHandler) *CreateACLFCGIApp { - return &CreateACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - CreateACLFCGIApp swagger:route POST /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index} ACL createAclFcgiApp - -# Add a new ACL line - -Adds a new ACL line of the specified type in the specified parent. -*/ -type CreateACLFCGIApp struct { - Context *middleware.Context - Handler CreateACLFCGIAppHandler -} - -func (o *CreateACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/create_acl_fcgi_app_parameters.go b/operations/acl/create_acl_fcgi_app_parameters.go deleted file mode 100644 index b4dc7d85..00000000 --- a/operations/acl/create_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateACLFCGIAppParams creates a new CreateACLFCGIAppParams object -// with the default values initialized. -func NewCreateACLFCGIAppParams() CreateACLFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateACLFCGIAppParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateACLFCGIAppParams contains all the bound params for the create Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAclFCGIApp -type CreateACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateACLFCGIAppParams() beforehand. -func (o *CreateACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateACLFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateACLFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateACLFCGIAppParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateACLFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/create_acl_fcgi_app_responses.go b/operations/acl/create_acl_fcgi_app_responses.go deleted file mode 100644 index 1e7ed59d..00000000 --- a/operations/acl/create_acl_fcgi_app_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateACLFCGIAppCreatedCode is the HTTP code returned for type CreateACLFCGIAppCreated -const CreateACLFCGIAppCreatedCode int = 201 - -/* -CreateACLFCGIAppCreated ACL line created - -swagger:response createAclFcgiAppCreated -*/ -type CreateACLFCGIAppCreated struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLFCGIAppCreated creates CreateACLFCGIAppCreated with default headers values -func NewCreateACLFCGIAppCreated() *CreateACLFCGIAppCreated { - - return &CreateACLFCGIAppCreated{} -} - -// WithPayload adds the payload to the create Acl Fcgi app created response -func (o *CreateACLFCGIAppCreated) WithPayload(payload *models.ACL) *CreateACLFCGIAppCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl Fcgi app created response -func (o *CreateACLFCGIAppCreated) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFCGIAppCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFCGIAppAcceptedCode is the HTTP code returned for type CreateACLFCGIAppAccepted -const CreateACLFCGIAppAcceptedCode int = 202 - -/* -CreateACLFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response createAclFcgiAppAccepted -*/ -type CreateACLFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLFCGIAppAccepted creates CreateACLFCGIAppAccepted with default headers values -func NewCreateACLFCGIAppAccepted() *CreateACLFCGIAppAccepted { - - return &CreateACLFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the create Acl Fcgi app accepted response -func (o *CreateACLFCGIAppAccepted) WithReloadID(reloadID string) *CreateACLFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Acl Fcgi app accepted response -func (o *CreateACLFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Acl Fcgi app accepted response -func (o *CreateACLFCGIAppAccepted) WithPayload(payload *models.ACL) *CreateACLFCGIAppAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl Fcgi app accepted response -func (o *CreateACLFCGIAppAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFCGIAppBadRequestCode is the HTTP code returned for type CreateACLFCGIAppBadRequest -const CreateACLFCGIAppBadRequestCode int = 400 - -/* -CreateACLFCGIAppBadRequest Bad request - -swagger:response createAclFcgiAppBadRequest -*/ -type CreateACLFCGIAppBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFCGIAppBadRequest creates CreateACLFCGIAppBadRequest with default headers values -func NewCreateACLFCGIAppBadRequest() *CreateACLFCGIAppBadRequest { - - return &CreateACLFCGIAppBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl Fcgi app bad request response -func (o *CreateACLFCGIAppBadRequest) WithConfigurationVersion(configurationVersion string) *CreateACLFCGIAppBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl Fcgi app bad request response -func (o *CreateACLFCGIAppBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl Fcgi app bad request response -func (o *CreateACLFCGIAppBadRequest) WithPayload(payload *models.Error) *CreateACLFCGIAppBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl Fcgi app bad request response -func (o *CreateACLFCGIAppBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFCGIAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFCGIAppConflictCode is the HTTP code returned for type CreateACLFCGIAppConflict -const CreateACLFCGIAppConflictCode int = 409 - -/* -CreateACLFCGIAppConflict The specified resource already exists - -swagger:response createAclFcgiAppConflict -*/ -type CreateACLFCGIAppConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFCGIAppConflict creates CreateACLFCGIAppConflict with default headers values -func NewCreateACLFCGIAppConflict() *CreateACLFCGIAppConflict { - - return &CreateACLFCGIAppConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl Fcgi app conflict response -func (o *CreateACLFCGIAppConflict) WithConfigurationVersion(configurationVersion string) *CreateACLFCGIAppConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl Fcgi app conflict response -func (o *CreateACLFCGIAppConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl Fcgi app conflict response -func (o *CreateACLFCGIAppConflict) WithPayload(payload *models.Error) *CreateACLFCGIAppConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl Fcgi app conflict response -func (o *CreateACLFCGIAppConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFCGIAppConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateACLFCGIAppDefault General Error - -swagger:response createAclFcgiAppDefault -*/ -type CreateACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFCGIAppDefault creates CreateACLFCGIAppDefault with default headers values -func NewCreateACLFCGIAppDefault(code int) *CreateACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &CreateACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) WithStatusCode(code int) *CreateACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *CreateACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) WithPayload(payload *models.Error) *CreateACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl FCGI app default response -func (o *CreateACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/create_acl_fcgi_app_urlbuilder.go b/operations/acl/create_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index 82209b87..00000000 --- a/operations/acl/create_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateACLFCGIAppURL generates an URL for the create Acl FCGI app operation -type CreateACLFCGIAppURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLFCGIAppURL) WithBasePath(bp string) *CreateACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateACLFCGIAppURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/create_acl_frontend.go b/operations/acl/create_acl_frontend.go deleted file mode 100644 index 1de8f32a..00000000 --- a/operations/acl/create_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateACLFrontendHandlerFunc turns a function with the right signature into a create Acl frontend handler -type CreateACLFrontendHandlerFunc func(CreateACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateACLFrontendHandlerFunc) Handle(params CreateACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateACLFrontendHandler interface for that can handle valid create Acl frontend params -type CreateACLFrontendHandler interface { - Handle(CreateACLFrontendParams, interface{}) middleware.Responder -} - -// NewCreateACLFrontend creates a new http.Handler for the create Acl frontend operation -func NewCreateACLFrontend(ctx *middleware.Context, handler CreateACLFrontendHandler) *CreateACLFrontend { - return &CreateACLFrontend{Context: ctx, Handler: handler} -} - -/* - CreateACLFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/acls/{index} ACL createAclFrontend - -# Add a new ACL line - -Adds a new ACL line of the specified type in the specified parent. -*/ -type CreateACLFrontend struct { - Context *middleware.Context - Handler CreateACLFrontendHandler -} - -func (o *CreateACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/create_acl_frontend_parameters.go b/operations/acl/create_acl_frontend_parameters.go deleted file mode 100644 index aad64edf..00000000 --- a/operations/acl/create_acl_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateACLFrontendParams creates a new CreateACLFrontendParams object -// with the default values initialized. -func NewCreateACLFrontendParams() CreateACLFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateACLFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateACLFrontendParams contains all the bound params for the create Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAclFrontend -type CreateACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateACLFrontendParams() beforehand. -func (o *CreateACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateACLFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateACLFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateACLFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateACLFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/create_acl_frontend_responses.go b/operations/acl/create_acl_frontend_responses.go deleted file mode 100644 index d646ace2..00000000 --- a/operations/acl/create_acl_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateACLFrontendCreatedCode is the HTTP code returned for type CreateACLFrontendCreated -const CreateACLFrontendCreatedCode int = 201 - -/* -CreateACLFrontendCreated ACL line created - -swagger:response createAclFrontendCreated -*/ -type CreateACLFrontendCreated struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLFrontendCreated creates CreateACLFrontendCreated with default headers values -func NewCreateACLFrontendCreated() *CreateACLFrontendCreated { - - return &CreateACLFrontendCreated{} -} - -// WithPayload adds the payload to the create Acl frontend created response -func (o *CreateACLFrontendCreated) WithPayload(payload *models.ACL) *CreateACLFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl frontend created response -func (o *CreateACLFrontendCreated) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFrontendAcceptedCode is the HTTP code returned for type CreateACLFrontendAccepted -const CreateACLFrontendAcceptedCode int = 202 - -/* -CreateACLFrontendAccepted Configuration change accepted and reload requested - -swagger:response createAclFrontendAccepted -*/ -type CreateACLFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewCreateACLFrontendAccepted creates CreateACLFrontendAccepted with default headers values -func NewCreateACLFrontendAccepted() *CreateACLFrontendAccepted { - - return &CreateACLFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Acl frontend accepted response -func (o *CreateACLFrontendAccepted) WithReloadID(reloadID string) *CreateACLFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Acl frontend accepted response -func (o *CreateACLFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Acl frontend accepted response -func (o *CreateACLFrontendAccepted) WithPayload(payload *models.ACL) *CreateACLFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl frontend accepted response -func (o *CreateACLFrontendAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFrontendBadRequestCode is the HTTP code returned for type CreateACLFrontendBadRequest -const CreateACLFrontendBadRequestCode int = 400 - -/* -CreateACLFrontendBadRequest Bad request - -swagger:response createAclFrontendBadRequest -*/ -type CreateACLFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFrontendBadRequest creates CreateACLFrontendBadRequest with default headers values -func NewCreateACLFrontendBadRequest() *CreateACLFrontendBadRequest { - - return &CreateACLFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl frontend bad request response -func (o *CreateACLFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateACLFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl frontend bad request response -func (o *CreateACLFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl frontend bad request response -func (o *CreateACLFrontendBadRequest) WithPayload(payload *models.Error) *CreateACLFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl frontend bad request response -func (o *CreateACLFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateACLFrontendConflictCode is the HTTP code returned for type CreateACLFrontendConflict -const CreateACLFrontendConflictCode int = 409 - -/* -CreateACLFrontendConflict The specified resource already exists - -swagger:response createAclFrontendConflict -*/ -type CreateACLFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFrontendConflict creates CreateACLFrontendConflict with default headers values -func NewCreateACLFrontendConflict() *CreateACLFrontendConflict { - - return &CreateACLFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl frontend conflict response -func (o *CreateACLFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateACLFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl frontend conflict response -func (o *CreateACLFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl frontend conflict response -func (o *CreateACLFrontendConflict) WithPayload(payload *models.Error) *CreateACLFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl frontend conflict response -func (o *CreateACLFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateACLFrontendDefault General Error - -swagger:response createAclFrontendDefault -*/ -type CreateACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateACLFrontendDefault creates CreateACLFrontendDefault with default headers values -func NewCreateACLFrontendDefault(code int) *CreateACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create Acl frontend default response -func (o *CreateACLFrontendDefault) WithStatusCode(code int) *CreateACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create Acl frontend default response -func (o *CreateACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create Acl frontend default response -func (o *CreateACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Acl frontend default response -func (o *CreateACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Acl frontend default response -func (o *CreateACLFrontendDefault) WithPayload(payload *models.Error) *CreateACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Acl frontend default response -func (o *CreateACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/create_acl_frontend_urlbuilder.go b/operations/acl/create_acl_frontend_urlbuilder.go deleted file mode 100644 index 579199fe..00000000 --- a/operations/acl/create_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateACLFrontendURL generates an URL for the create Acl frontend operation -type CreateACLFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLFrontendURL) WithBasePath(bp string) *CreateACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateACLFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/delete_acl_backend.go b/operations/acl/delete_acl_backend.go deleted file mode 100644 index daad1184..00000000 --- a/operations/acl/delete_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteACLBackendHandlerFunc turns a function with the right signature into a delete Acl backend handler -type DeleteACLBackendHandlerFunc func(DeleteACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteACLBackendHandlerFunc) Handle(params DeleteACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteACLBackendHandler interface for that can handle valid delete Acl backend params -type DeleteACLBackendHandler interface { - Handle(DeleteACLBackendParams, interface{}) middleware.Responder -} - -// NewDeleteACLBackend creates a new http.Handler for the delete Acl backend operation -func NewDeleteACLBackend(ctx *middleware.Context, handler DeleteACLBackendHandler) *DeleteACLBackend { - return &DeleteACLBackend{Context: ctx, Handler: handler} -} - -/* - DeleteACLBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/acls/{index} ACL deleteAclBackend - -# Delete a ACL line - -Deletes a ACL line configuration by it's index from the specified parent. -*/ -type DeleteACLBackend struct { - Context *middleware.Context - Handler DeleteACLBackendHandler -} - -func (o *DeleteACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/delete_acl_backend_parameters.go b/operations/acl/delete_acl_backend_parameters.go deleted file mode 100644 index 0227d37b..00000000 --- a/operations/acl/delete_acl_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteACLBackendParams creates a new DeleteACLBackendParams object -// with the default values initialized. -func NewDeleteACLBackendParams() DeleteACLBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteACLBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteACLBackendParams contains all the bound params for the delete Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAclBackend -type DeleteACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteACLBackendParams() beforehand. -func (o *DeleteACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteACLBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteACLBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteACLBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteACLBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/delete_acl_backend_responses.go b/operations/acl/delete_acl_backend_responses.go deleted file mode 100644 index 1308a8ed..00000000 --- a/operations/acl/delete_acl_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteACLBackendAcceptedCode is the HTTP code returned for type DeleteACLBackendAccepted -const DeleteACLBackendAcceptedCode int = 202 - -/* -DeleteACLBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteAclBackendAccepted -*/ -type DeleteACLBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteACLBackendAccepted creates DeleteACLBackendAccepted with default headers values -func NewDeleteACLBackendAccepted() *DeleteACLBackendAccepted { - - return &DeleteACLBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Acl backend accepted response -func (o *DeleteACLBackendAccepted) WithReloadID(reloadID string) *DeleteACLBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Acl backend accepted response -func (o *DeleteACLBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteACLBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteACLBackendNoContentCode is the HTTP code returned for type DeleteACLBackendNoContent -const DeleteACLBackendNoContentCode int = 204 - -/* -DeleteACLBackendNoContent ACL line deleted - -swagger:response deleteAclBackendNoContent -*/ -type DeleteACLBackendNoContent struct { -} - -// NewDeleteACLBackendNoContent creates DeleteACLBackendNoContent with default headers values -func NewDeleteACLBackendNoContent() *DeleteACLBackendNoContent { - - return &DeleteACLBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteACLBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteACLBackendNotFoundCode is the HTTP code returned for type DeleteACLBackendNotFound -const DeleteACLBackendNotFoundCode int = 404 - -/* -DeleteACLBackendNotFound The specified resource was not found - -swagger:response deleteAclBackendNotFound -*/ -type DeleteACLBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLBackendNotFound creates DeleteACLBackendNotFound with default headers values -func NewDeleteACLBackendNotFound() *DeleteACLBackendNotFound { - - return &DeleteACLBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl backend not found response -func (o *DeleteACLBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteACLBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl backend not found response -func (o *DeleteACLBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl backend not found response -func (o *DeleteACLBackendNotFound) WithPayload(payload *models.Error) *DeleteACLBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl backend not found response -func (o *DeleteACLBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteACLBackendDefault General Error - -swagger:response deleteAclBackendDefault -*/ -type DeleteACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLBackendDefault creates DeleteACLBackendDefault with default headers values -func NewDeleteACLBackendDefault(code int) *DeleteACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete Acl backend default response -func (o *DeleteACLBackendDefault) WithStatusCode(code int) *DeleteACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete Acl backend default response -func (o *DeleteACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl backend default response -func (o *DeleteACLBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl backend default response -func (o *DeleteACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl backend default response -func (o *DeleteACLBackendDefault) WithPayload(payload *models.Error) *DeleteACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl backend default response -func (o *DeleteACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/delete_acl_backend_urlbuilder.go b/operations/acl/delete_acl_backend_urlbuilder.go deleted file mode 100644 index 676b0b0d..00000000 --- a/operations/acl/delete_acl_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteACLBackendURL generates an URL for the delete Acl backend operation -type DeleteACLBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLBackendURL) WithBasePath(bp string) *DeleteACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteACLBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/delete_acl_defaults.go b/operations/acl/delete_acl_defaults.go deleted file mode 100644 index d560f37b..00000000 --- a/operations/acl/delete_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteACLDefaultsHandlerFunc turns a function with the right signature into a delete Acl defaults handler -type DeleteACLDefaultsHandlerFunc func(DeleteACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteACLDefaultsHandlerFunc) Handle(params DeleteACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteACLDefaultsHandler interface for that can handle valid delete Acl defaults params -type DeleteACLDefaultsHandler interface { - Handle(DeleteACLDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteACLDefaults creates a new http.Handler for the delete Acl defaults operation -func NewDeleteACLDefaults(ctx *middleware.Context, handler DeleteACLDefaultsHandler) *DeleteACLDefaults { - return &DeleteACLDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteACLDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/acls/{index} ACL deleteAclDefaults - -# Delete a ACL line - -Deletes a ACL line configuration by it's index from the specified parent. -*/ -type DeleteACLDefaults struct { - Context *middleware.Context - Handler DeleteACLDefaultsHandler -} - -func (o *DeleteACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/delete_acl_defaults_parameters.go b/operations/acl/delete_acl_defaults_parameters.go deleted file mode 100644 index 8f069b4e..00000000 --- a/operations/acl/delete_acl_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteACLDefaultsParams creates a new DeleteACLDefaultsParams object -// with the default values initialized. -func NewDeleteACLDefaultsParams() DeleteACLDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteACLDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteACLDefaultsParams contains all the bound params for the delete Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAclDefaults -type DeleteACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteACLDefaultsParams() beforehand. -func (o *DeleteACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteACLDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteACLDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteACLDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteACLDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/delete_acl_defaults_responses.go b/operations/acl/delete_acl_defaults_responses.go deleted file mode 100644 index 95f9c43d..00000000 --- a/operations/acl/delete_acl_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteACLDefaultsAcceptedCode is the HTTP code returned for type DeleteACLDefaultsAccepted -const DeleteACLDefaultsAcceptedCode int = 202 - -/* -DeleteACLDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteAclDefaultsAccepted -*/ -type DeleteACLDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteACLDefaultsAccepted creates DeleteACLDefaultsAccepted with default headers values -func NewDeleteACLDefaultsAccepted() *DeleteACLDefaultsAccepted { - - return &DeleteACLDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Acl defaults accepted response -func (o *DeleteACLDefaultsAccepted) WithReloadID(reloadID string) *DeleteACLDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Acl defaults accepted response -func (o *DeleteACLDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteACLDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteACLDefaultsNoContentCode is the HTTP code returned for type DeleteACLDefaultsNoContent -const DeleteACLDefaultsNoContentCode int = 204 - -/* -DeleteACLDefaultsNoContent ACL line deleted - -swagger:response deleteAclDefaultsNoContent -*/ -type DeleteACLDefaultsNoContent struct { -} - -// NewDeleteACLDefaultsNoContent creates DeleteACLDefaultsNoContent with default headers values -func NewDeleteACLDefaultsNoContent() *DeleteACLDefaultsNoContent { - - return &DeleteACLDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteACLDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteACLDefaultsNotFoundCode is the HTTP code returned for type DeleteACLDefaultsNotFound -const DeleteACLDefaultsNotFoundCode int = 404 - -/* -DeleteACLDefaultsNotFound The specified resource was not found - -swagger:response deleteAclDefaultsNotFound -*/ -type DeleteACLDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLDefaultsNotFound creates DeleteACLDefaultsNotFound with default headers values -func NewDeleteACLDefaultsNotFound() *DeleteACLDefaultsNotFound { - - return &DeleteACLDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl defaults not found response -func (o *DeleteACLDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteACLDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl defaults not found response -func (o *DeleteACLDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl defaults not found response -func (o *DeleteACLDefaultsNotFound) WithPayload(payload *models.Error) *DeleteACLDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl defaults not found response -func (o *DeleteACLDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteACLDefaultsDefault General Error - -swagger:response deleteAclDefaultsDefault -*/ -type DeleteACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLDefaultsDefault creates DeleteACLDefaultsDefault with default headers values -func NewDeleteACLDefaultsDefault(code int) *DeleteACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) WithStatusCode(code int) *DeleteACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) WithPayload(payload *models.Error) *DeleteACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl defaults default response -func (o *DeleteACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/delete_acl_defaults_urlbuilder.go b/operations/acl/delete_acl_defaults_urlbuilder.go deleted file mode 100644 index 6c5caecc..00000000 --- a/operations/acl/delete_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteACLDefaultsURL generates an URL for the delete Acl defaults operation -type DeleteACLDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLDefaultsURL) WithBasePath(bp string) *DeleteACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteACLDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/delete_acl_fcgi_app.go b/operations/acl/delete_acl_fcgi_app.go deleted file mode 100644 index 71837377..00000000 --- a/operations/acl/delete_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteACLFCGIAppHandlerFunc turns a function with the right signature into a delete Acl FCGI app handler -type DeleteACLFCGIAppHandlerFunc func(DeleteACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteACLFCGIAppHandlerFunc) Handle(params DeleteACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteACLFCGIAppHandler interface for that can handle valid delete Acl FCGI app params -type DeleteACLFCGIAppHandler interface { - Handle(DeleteACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewDeleteACLFCGIApp creates a new http.Handler for the delete Acl FCGI app operation -func NewDeleteACLFCGIApp(ctx *middleware.Context, handler DeleteACLFCGIAppHandler) *DeleteACLFCGIApp { - return &DeleteACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - DeleteACLFCGIApp swagger:route DELETE /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index} ACL deleteAclFcgiApp - -# Delete a ACL line - -Deletes a ACL line configuration by it's index from the specified parent. -*/ -type DeleteACLFCGIApp struct { - Context *middleware.Context - Handler DeleteACLFCGIAppHandler -} - -func (o *DeleteACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/delete_acl_fcgi_app_parameters.go b/operations/acl/delete_acl_fcgi_app_parameters.go deleted file mode 100644 index 41120243..00000000 --- a/operations/acl/delete_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteACLFCGIAppParams creates a new DeleteACLFCGIAppParams object -// with the default values initialized. -func NewDeleteACLFCGIAppParams() DeleteACLFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteACLFCGIAppParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteACLFCGIAppParams contains all the bound params for the delete Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAclFCGIApp -type DeleteACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteACLFCGIAppParams() beforehand. -func (o *DeleteACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteACLFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteACLFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteACLFCGIAppParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteACLFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/delete_acl_fcgi_app_responses.go b/operations/acl/delete_acl_fcgi_app_responses.go deleted file mode 100644 index a8d162ab..00000000 --- a/operations/acl/delete_acl_fcgi_app_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteACLFCGIAppAcceptedCode is the HTTP code returned for type DeleteACLFCGIAppAccepted -const DeleteACLFCGIAppAcceptedCode int = 202 - -/* -DeleteACLFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response deleteAclFcgiAppAccepted -*/ -type DeleteACLFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteACLFCGIAppAccepted creates DeleteACLFCGIAppAccepted with default headers values -func NewDeleteACLFCGIAppAccepted() *DeleteACLFCGIAppAccepted { - - return &DeleteACLFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the delete Acl Fcgi app accepted response -func (o *DeleteACLFCGIAppAccepted) WithReloadID(reloadID string) *DeleteACLFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Acl Fcgi app accepted response -func (o *DeleteACLFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteACLFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteACLFCGIAppNoContentCode is the HTTP code returned for type DeleteACLFCGIAppNoContent -const DeleteACLFCGIAppNoContentCode int = 204 - -/* -DeleteACLFCGIAppNoContent ACL line deleted - -swagger:response deleteAclFcgiAppNoContent -*/ -type DeleteACLFCGIAppNoContent struct { -} - -// NewDeleteACLFCGIAppNoContent creates DeleteACLFCGIAppNoContent with default headers values -func NewDeleteACLFCGIAppNoContent() *DeleteACLFCGIAppNoContent { - - return &DeleteACLFCGIAppNoContent{} -} - -// WriteResponse to the client -func (o *DeleteACLFCGIAppNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteACLFCGIAppNotFoundCode is the HTTP code returned for type DeleteACLFCGIAppNotFound -const DeleteACLFCGIAppNotFoundCode int = 404 - -/* -DeleteACLFCGIAppNotFound The specified resource was not found - -swagger:response deleteAclFcgiAppNotFound -*/ -type DeleteACLFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLFCGIAppNotFound creates DeleteACLFCGIAppNotFound with default headers values -func NewDeleteACLFCGIAppNotFound() *DeleteACLFCGIAppNotFound { - - return &DeleteACLFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl Fcgi app not found response -func (o *DeleteACLFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *DeleteACLFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl Fcgi app not found response -func (o *DeleteACLFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl Fcgi app not found response -func (o *DeleteACLFCGIAppNotFound) WithPayload(payload *models.Error) *DeleteACLFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl Fcgi app not found response -func (o *DeleteACLFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteACLFCGIAppDefault General Error - -swagger:response deleteAclFcgiAppDefault -*/ -type DeleteACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLFCGIAppDefault creates DeleteACLFCGIAppDefault with default headers values -func NewDeleteACLFCGIAppDefault(code int) *DeleteACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &DeleteACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) WithStatusCode(code int) *DeleteACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *DeleteACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) WithPayload(payload *models.Error) *DeleteACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl FCGI app default response -func (o *DeleteACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/delete_acl_fcgi_app_urlbuilder.go b/operations/acl/delete_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index e2685a93..00000000 --- a/operations/acl/delete_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteACLFCGIAppURL generates an URL for the delete Acl FCGI app operation -type DeleteACLFCGIAppURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLFCGIAppURL) WithBasePath(bp string) *DeleteACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteACLFCGIAppURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/delete_acl_frontend.go b/operations/acl/delete_acl_frontend.go deleted file mode 100644 index d4e8eb96..00000000 --- a/operations/acl/delete_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteACLFrontendHandlerFunc turns a function with the right signature into a delete Acl frontend handler -type DeleteACLFrontendHandlerFunc func(DeleteACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteACLFrontendHandlerFunc) Handle(params DeleteACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteACLFrontendHandler interface for that can handle valid delete Acl frontend params -type DeleteACLFrontendHandler interface { - Handle(DeleteACLFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteACLFrontend creates a new http.Handler for the delete Acl frontend operation -func NewDeleteACLFrontend(ctx *middleware.Context, handler DeleteACLFrontendHandler) *DeleteACLFrontend { - return &DeleteACLFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteACLFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/acls/{index} ACL deleteAclFrontend - -# Delete a ACL line - -Deletes a ACL line configuration by it's index from the specified parent. -*/ -type DeleteACLFrontend struct { - Context *middleware.Context - Handler DeleteACLFrontendHandler -} - -func (o *DeleteACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/delete_acl_frontend_parameters.go b/operations/acl/delete_acl_frontend_parameters.go deleted file mode 100644 index f05ad3d2..00000000 --- a/operations/acl/delete_acl_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteACLFrontendParams creates a new DeleteACLFrontendParams object -// with the default values initialized. -func NewDeleteACLFrontendParams() DeleteACLFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteACLFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteACLFrontendParams contains all the bound params for the delete Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAclFrontend -type DeleteACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteACLFrontendParams() beforehand. -func (o *DeleteACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteACLFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteACLFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteACLFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteACLFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/delete_acl_frontend_responses.go b/operations/acl/delete_acl_frontend_responses.go deleted file mode 100644 index 519f20e0..00000000 --- a/operations/acl/delete_acl_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteACLFrontendAcceptedCode is the HTTP code returned for type DeleteACLFrontendAccepted -const DeleteACLFrontendAcceptedCode int = 202 - -/* -DeleteACLFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteAclFrontendAccepted -*/ -type DeleteACLFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteACLFrontendAccepted creates DeleteACLFrontendAccepted with default headers values -func NewDeleteACLFrontendAccepted() *DeleteACLFrontendAccepted { - - return &DeleteACLFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Acl frontend accepted response -func (o *DeleteACLFrontendAccepted) WithReloadID(reloadID string) *DeleteACLFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Acl frontend accepted response -func (o *DeleteACLFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteACLFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteACLFrontendNoContentCode is the HTTP code returned for type DeleteACLFrontendNoContent -const DeleteACLFrontendNoContentCode int = 204 - -/* -DeleteACLFrontendNoContent ACL line deleted - -swagger:response deleteAclFrontendNoContent -*/ -type DeleteACLFrontendNoContent struct { -} - -// NewDeleteACLFrontendNoContent creates DeleteACLFrontendNoContent with default headers values -func NewDeleteACLFrontendNoContent() *DeleteACLFrontendNoContent { - - return &DeleteACLFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteACLFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteACLFrontendNotFoundCode is the HTTP code returned for type DeleteACLFrontendNotFound -const DeleteACLFrontendNotFoundCode int = 404 - -/* -DeleteACLFrontendNotFound The specified resource was not found - -swagger:response deleteAclFrontendNotFound -*/ -type DeleteACLFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLFrontendNotFound creates DeleteACLFrontendNotFound with default headers values -func NewDeleteACLFrontendNotFound() *DeleteACLFrontendNotFound { - - return &DeleteACLFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl frontend not found response -func (o *DeleteACLFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteACLFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl frontend not found response -func (o *DeleteACLFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl frontend not found response -func (o *DeleteACLFrontendNotFound) WithPayload(payload *models.Error) *DeleteACLFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl frontend not found response -func (o *DeleteACLFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteACLFrontendDefault General Error - -swagger:response deleteAclFrontendDefault -*/ -type DeleteACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteACLFrontendDefault creates DeleteACLFrontendDefault with default headers values -func NewDeleteACLFrontendDefault(code int) *DeleteACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) WithStatusCode(code int) *DeleteACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) WithPayload(payload *models.Error) *DeleteACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Acl frontend default response -func (o *DeleteACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/delete_acl_frontend_urlbuilder.go b/operations/acl/delete_acl_frontend_urlbuilder.go deleted file mode 100644 index 7b83e866..00000000 --- a/operations/acl/delete_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteACLFrontendURL generates an URL for the delete Acl frontend operation -type DeleteACLFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLFrontendURL) WithBasePath(bp string) *DeleteACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteACLFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_acl_backend.go b/operations/acl/get_acl_backend.go deleted file mode 100644 index a7bec7db..00000000 --- a/operations/acl/get_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetACLBackendHandlerFunc turns a function with the right signature into a get Acl backend handler -type GetACLBackendHandlerFunc func(GetACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetACLBackendHandlerFunc) Handle(params GetACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetACLBackendHandler interface for that can handle valid get Acl backend params -type GetACLBackendHandler interface { - Handle(GetACLBackendParams, interface{}) middleware.Responder -} - -// NewGetACLBackend creates a new http.Handler for the get Acl backend operation -func NewGetACLBackend(ctx *middleware.Context, handler GetACLBackendHandler) *GetACLBackend { - return &GetACLBackend{Context: ctx, Handler: handler} -} - -/* - GetACLBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/acls/{index} ACL getAclBackend - -# Return one ACL line - -Returns one ACL line configuration by it's index in the specified parent. -*/ -type GetACLBackend struct { - Context *middleware.Context - Handler GetACLBackendHandler -} - -func (o *GetACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_acl_backend_parameters.go b/operations/acl/get_acl_backend_parameters.go deleted file mode 100644 index 34ac388e..00000000 --- a/operations/acl/get_acl_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetACLBackendParams creates a new GetACLBackendParams object -// -// There are no default values defined in the spec. -func NewGetACLBackendParams() GetACLBackendParams { - - return GetACLBackendParams{} -} - -// GetACLBackendParams contains all the bound params for the get Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAclBackend -type GetACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetACLBackendParams() beforehand. -func (o *GetACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetACLBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_acl_backend_responses.go b/operations/acl/get_acl_backend_responses.go deleted file mode 100644 index 8c495777..00000000 --- a/operations/acl/get_acl_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetACLBackendOKCode is the HTTP code returned for type GetACLBackendOK -const GetACLBackendOKCode int = 200 - -/* -GetACLBackendOK Successful operation - -swagger:response getAclBackendOK -*/ -type GetACLBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewGetACLBackendOK creates GetACLBackendOK with default headers values -func NewGetACLBackendOK() *GetACLBackendOK { - - return &GetACLBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl backend o k response -func (o *GetACLBackendOK) WithConfigurationVersion(configurationVersion string) *GetACLBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl backend o k response -func (o *GetACLBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl backend o k response -func (o *GetACLBackendOK) WithPayload(payload *models.ACL) *GetACLBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl backend o k response -func (o *GetACLBackendOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetACLBackendNotFoundCode is the HTTP code returned for type GetACLBackendNotFound -const GetACLBackendNotFoundCode int = 404 - -/* -GetACLBackendNotFound The specified resource was not found - -swagger:response getAclBackendNotFound -*/ -type GetACLBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLBackendNotFound creates GetACLBackendNotFound with default headers values -func NewGetACLBackendNotFound() *GetACLBackendNotFound { - - return &GetACLBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl backend not found response -func (o *GetACLBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetACLBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl backend not found response -func (o *GetACLBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl backend not found response -func (o *GetACLBackendNotFound) WithPayload(payload *models.Error) *GetACLBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl backend not found response -func (o *GetACLBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetACLBackendDefault General Error - -swagger:response getAclBackendDefault -*/ -type GetACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLBackendDefault creates GetACLBackendDefault with default headers values -func NewGetACLBackendDefault(code int) *GetACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get Acl backend default response -func (o *GetACLBackendDefault) WithStatusCode(code int) *GetACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get Acl backend default response -func (o *GetACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl backend default response -func (o *GetACLBackendDefault) WithConfigurationVersion(configurationVersion string) *GetACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl backend default response -func (o *GetACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl backend default response -func (o *GetACLBackendDefault) WithPayload(payload *models.Error) *GetACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl backend default response -func (o *GetACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_acl_backend_urlbuilder.go b/operations/acl/get_acl_backend_urlbuilder.go deleted file mode 100644 index c64b3e7a..00000000 --- a/operations/acl/get_acl_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetACLBackendURL generates an URL for the get Acl backend operation -type GetACLBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLBackendURL) WithBasePath(bp string) *GetACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetACLBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_acl_defaults.go b/operations/acl/get_acl_defaults.go deleted file mode 100644 index b46681ad..00000000 --- a/operations/acl/get_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetACLDefaultsHandlerFunc turns a function with the right signature into a get Acl defaults handler -type GetACLDefaultsHandlerFunc func(GetACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetACLDefaultsHandlerFunc) Handle(params GetACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetACLDefaultsHandler interface for that can handle valid get Acl defaults params -type GetACLDefaultsHandler interface { - Handle(GetACLDefaultsParams, interface{}) middleware.Responder -} - -// NewGetACLDefaults creates a new http.Handler for the get Acl defaults operation -func NewGetACLDefaults(ctx *middleware.Context, handler GetACLDefaultsHandler) *GetACLDefaults { - return &GetACLDefaults{Context: ctx, Handler: handler} -} - -/* - GetACLDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/acls/{index} ACL getAclDefaults - -# Return one ACL line - -Returns one ACL line configuration by it's index in the specified parent. -*/ -type GetACLDefaults struct { - Context *middleware.Context - Handler GetACLDefaultsHandler -} - -func (o *GetACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_acl_defaults_parameters.go b/operations/acl/get_acl_defaults_parameters.go deleted file mode 100644 index 4a6cf33c..00000000 --- a/operations/acl/get_acl_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetACLDefaultsParams creates a new GetACLDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetACLDefaultsParams() GetACLDefaultsParams { - - return GetACLDefaultsParams{} -} - -// GetACLDefaultsParams contains all the bound params for the get Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAclDefaults -type GetACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetACLDefaultsParams() beforehand. -func (o *GetACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetACLDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_acl_defaults_responses.go b/operations/acl/get_acl_defaults_responses.go deleted file mode 100644 index 670f3a21..00000000 --- a/operations/acl/get_acl_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetACLDefaultsOKCode is the HTTP code returned for type GetACLDefaultsOK -const GetACLDefaultsOKCode int = 200 - -/* -GetACLDefaultsOK Successful operation - -swagger:response getAclDefaultsOK -*/ -type GetACLDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewGetACLDefaultsOK creates GetACLDefaultsOK with default headers values -func NewGetACLDefaultsOK() *GetACLDefaultsOK { - - return &GetACLDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl defaults o k response -func (o *GetACLDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetACLDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl defaults o k response -func (o *GetACLDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl defaults o k response -func (o *GetACLDefaultsOK) WithPayload(payload *models.ACL) *GetACLDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl defaults o k response -func (o *GetACLDefaultsOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetACLDefaultsNotFoundCode is the HTTP code returned for type GetACLDefaultsNotFound -const GetACLDefaultsNotFoundCode int = 404 - -/* -GetACLDefaultsNotFound The specified resource was not found - -swagger:response getAclDefaultsNotFound -*/ -type GetACLDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLDefaultsNotFound creates GetACLDefaultsNotFound with default headers values -func NewGetACLDefaultsNotFound() *GetACLDefaultsNotFound { - - return &GetACLDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl defaults not found response -func (o *GetACLDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetACLDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl defaults not found response -func (o *GetACLDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl defaults not found response -func (o *GetACLDefaultsNotFound) WithPayload(payload *models.Error) *GetACLDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl defaults not found response -func (o *GetACLDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetACLDefaultsDefault General Error - -swagger:response getAclDefaultsDefault -*/ -type GetACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLDefaultsDefault creates GetACLDefaultsDefault with default headers values -func NewGetACLDefaultsDefault(code int) *GetACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get Acl defaults default response -func (o *GetACLDefaultsDefault) WithStatusCode(code int) *GetACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get Acl defaults default response -func (o *GetACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl defaults default response -func (o *GetACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl defaults default response -func (o *GetACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl defaults default response -func (o *GetACLDefaultsDefault) WithPayload(payload *models.Error) *GetACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl defaults default response -func (o *GetACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_acl_defaults_urlbuilder.go b/operations/acl/get_acl_defaults_urlbuilder.go deleted file mode 100644 index 1269c31d..00000000 --- a/operations/acl/get_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetACLDefaultsURL generates an URL for the get Acl defaults operation -type GetACLDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLDefaultsURL) WithBasePath(bp string) *GetACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetACLDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_acl_fcgi_app.go b/operations/acl/get_acl_fcgi_app.go deleted file mode 100644 index 27f75b76..00000000 --- a/operations/acl/get_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetACLFCGIAppHandlerFunc turns a function with the right signature into a get Acl FCGI app handler -type GetACLFCGIAppHandlerFunc func(GetACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetACLFCGIAppHandlerFunc) Handle(params GetACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetACLFCGIAppHandler interface for that can handle valid get Acl FCGI app params -type GetACLFCGIAppHandler interface { - Handle(GetACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewGetACLFCGIApp creates a new http.Handler for the get Acl FCGI app operation -func NewGetACLFCGIApp(ctx *middleware.Context, handler GetACLFCGIAppHandler) *GetACLFCGIApp { - return &GetACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - GetACLFCGIApp swagger:route GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index} ACL getAclFcgiApp - -# Return one ACL line - -Returns one ACL line configuration by it's index in the specified parent. -*/ -type GetACLFCGIApp struct { - Context *middleware.Context - Handler GetACLFCGIAppHandler -} - -func (o *GetACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_acl_fcgi_app_parameters.go b/operations/acl/get_acl_fcgi_app_parameters.go deleted file mode 100644 index ce5ab160..00000000 --- a/operations/acl/get_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetACLFCGIAppParams creates a new GetACLFCGIAppParams object -// -// There are no default values defined in the spec. -func NewGetACLFCGIAppParams() GetACLFCGIAppParams { - - return GetACLFCGIAppParams{} -} - -// GetACLFCGIAppParams contains all the bound params for the get Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAclFCGIApp -type GetACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetACLFCGIAppParams() beforehand. -func (o *GetACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetACLFCGIAppParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_acl_fcgi_app_responses.go b/operations/acl/get_acl_fcgi_app_responses.go deleted file mode 100644 index d6898f96..00000000 --- a/operations/acl/get_acl_fcgi_app_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetACLFCGIAppOKCode is the HTTP code returned for type GetACLFCGIAppOK -const GetACLFCGIAppOKCode int = 200 - -/* -GetACLFCGIAppOK Successful operation - -swagger:response getAclFcgiAppOK -*/ -type GetACLFCGIAppOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewGetACLFCGIAppOK creates GetACLFCGIAppOK with default headers values -func NewGetACLFCGIAppOK() *GetACLFCGIAppOK { - - return &GetACLFCGIAppOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl Fcgi app o k response -func (o *GetACLFCGIAppOK) WithConfigurationVersion(configurationVersion string) *GetACLFCGIAppOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl Fcgi app o k response -func (o *GetACLFCGIAppOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl Fcgi app o k response -func (o *GetACLFCGIAppOK) WithPayload(payload *models.ACL) *GetACLFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl Fcgi app o k response -func (o *GetACLFCGIAppOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetACLFCGIAppNotFoundCode is the HTTP code returned for type GetACLFCGIAppNotFound -const GetACLFCGIAppNotFoundCode int = 404 - -/* -GetACLFCGIAppNotFound The specified resource was not found - -swagger:response getAclFcgiAppNotFound -*/ -type GetACLFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLFCGIAppNotFound creates GetACLFCGIAppNotFound with default headers values -func NewGetACLFCGIAppNotFound() *GetACLFCGIAppNotFound { - - return &GetACLFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl Fcgi app not found response -func (o *GetACLFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *GetACLFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl Fcgi app not found response -func (o *GetACLFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl Fcgi app not found response -func (o *GetACLFCGIAppNotFound) WithPayload(payload *models.Error) *GetACLFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl Fcgi app not found response -func (o *GetACLFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetACLFCGIAppDefault General Error - -swagger:response getAclFcgiAppDefault -*/ -type GetACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLFCGIAppDefault creates GetACLFCGIAppDefault with default headers values -func NewGetACLFCGIAppDefault(code int) *GetACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &GetACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) WithStatusCode(code int) *GetACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *GetACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) WithPayload(payload *models.Error) *GetACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl FCGI app default response -func (o *GetACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_acl_fcgi_app_urlbuilder.go b/operations/acl/get_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index 3bfd1473..00000000 --- a/operations/acl/get_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetACLFCGIAppURL generates an URL for the get Acl FCGI app operation -type GetACLFCGIAppURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLFCGIAppURL) WithBasePath(bp string) *GetACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetACLFCGIAppURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_acl_frontend.go b/operations/acl/get_acl_frontend.go deleted file mode 100644 index 6b27e1de..00000000 --- a/operations/acl/get_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetACLFrontendHandlerFunc turns a function with the right signature into a get Acl frontend handler -type GetACLFrontendHandlerFunc func(GetACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetACLFrontendHandlerFunc) Handle(params GetACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetACLFrontendHandler interface for that can handle valid get Acl frontend params -type GetACLFrontendHandler interface { - Handle(GetACLFrontendParams, interface{}) middleware.Responder -} - -// NewGetACLFrontend creates a new http.Handler for the get Acl frontend operation -func NewGetACLFrontend(ctx *middleware.Context, handler GetACLFrontendHandler) *GetACLFrontend { - return &GetACLFrontend{Context: ctx, Handler: handler} -} - -/* - GetACLFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/acls/{index} ACL getAclFrontend - -# Return one ACL line - -Returns one ACL line configuration by it's index in the specified parent. -*/ -type GetACLFrontend struct { - Context *middleware.Context - Handler GetACLFrontendHandler -} - -func (o *GetACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_acl_frontend_parameters.go b/operations/acl/get_acl_frontend_parameters.go deleted file mode 100644 index 1c850bdd..00000000 --- a/operations/acl/get_acl_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetACLFrontendParams creates a new GetACLFrontendParams object -// -// There are no default values defined in the spec. -func NewGetACLFrontendParams() GetACLFrontendParams { - - return GetACLFrontendParams{} -} - -// GetACLFrontendParams contains all the bound params for the get Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAclFrontend -type GetACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetACLFrontendParams() beforehand. -func (o *GetACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetACLFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_acl_frontend_responses.go b/operations/acl/get_acl_frontend_responses.go deleted file mode 100644 index bbd1bad4..00000000 --- a/operations/acl/get_acl_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetACLFrontendOKCode is the HTTP code returned for type GetACLFrontendOK -const GetACLFrontendOKCode int = 200 - -/* -GetACLFrontendOK Successful operation - -swagger:response getAclFrontendOK -*/ -type GetACLFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewGetACLFrontendOK creates GetACLFrontendOK with default headers values -func NewGetACLFrontendOK() *GetACLFrontendOK { - - return &GetACLFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl frontend o k response -func (o *GetACLFrontendOK) WithConfigurationVersion(configurationVersion string) *GetACLFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl frontend o k response -func (o *GetACLFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl frontend o k response -func (o *GetACLFrontendOK) WithPayload(payload *models.ACL) *GetACLFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl frontend o k response -func (o *GetACLFrontendOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetACLFrontendNotFoundCode is the HTTP code returned for type GetACLFrontendNotFound -const GetACLFrontendNotFoundCode int = 404 - -/* -GetACLFrontendNotFound The specified resource was not found - -swagger:response getAclFrontendNotFound -*/ -type GetACLFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLFrontendNotFound creates GetACLFrontendNotFound with default headers values -func NewGetACLFrontendNotFound() *GetACLFrontendNotFound { - - return &GetACLFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl frontend not found response -func (o *GetACLFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetACLFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl frontend not found response -func (o *GetACLFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl frontend not found response -func (o *GetACLFrontendNotFound) WithPayload(payload *models.Error) *GetACLFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl frontend not found response -func (o *GetACLFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetACLFrontendDefault General Error - -swagger:response getAclFrontendDefault -*/ -type GetACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetACLFrontendDefault creates GetACLFrontendDefault with default headers values -func NewGetACLFrontendDefault(code int) *GetACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get Acl frontend default response -func (o *GetACLFrontendDefault) WithStatusCode(code int) *GetACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get Acl frontend default response -func (o *GetACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get Acl frontend default response -func (o *GetACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Acl frontend default response -func (o *GetACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Acl frontend default response -func (o *GetACLFrontendDefault) WithPayload(payload *models.Error) *GetACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Acl frontend default response -func (o *GetACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_acl_frontend_urlbuilder.go b/operations/acl/get_acl_frontend_urlbuilder.go deleted file mode 100644 index 7c4abab1..00000000 --- a/operations/acl/get_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetACLFrontendURL generates an URL for the get Acl frontend operation -type GetACLFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLFrontendURL) WithBasePath(bp string) *GetACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetACLFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_all_acl_backend.go b/operations/acl/get_all_acl_backend.go deleted file mode 100644 index 6faeb27d..00000000 --- a/operations/acl/get_all_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllACLBackendHandlerFunc turns a function with the right signature into a get all Acl backend handler -type GetAllACLBackendHandlerFunc func(GetAllACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllACLBackendHandlerFunc) Handle(params GetAllACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllACLBackendHandler interface for that can handle valid get all Acl backend params -type GetAllACLBackendHandler interface { - Handle(GetAllACLBackendParams, interface{}) middleware.Responder -} - -// NewGetAllACLBackend creates a new http.Handler for the get all Acl backend operation -func NewGetAllACLBackend(ctx *middleware.Context, handler GetAllACLBackendHandler) *GetAllACLBackend { - return &GetAllACLBackend{Context: ctx, Handler: handler} -} - -/* - GetAllACLBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/acls ACL getAllAclBackend - -# Return an array of all ACL lines - -Returns all ACL lines that are configured in specified parent. -*/ -type GetAllACLBackend struct { - Context *middleware.Context - Handler GetAllACLBackendHandler -} - -func (o *GetAllACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_all_acl_backend_parameters.go b/operations/acl/get_all_acl_backend_parameters.go deleted file mode 100644 index afe3db8f..00000000 --- a/operations/acl/get_all_acl_backend_parameters.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllACLBackendParams creates a new GetAllACLBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllACLBackendParams() GetAllACLBackendParams { - - return GetAllACLBackendParams{} -} - -// GetAllACLBackendParams contains all the bound params for the get all Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllAclBackend -type GetAllACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL name - In: query - */ - ACLName *string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllACLBackendParams() beforehand. -func (o *GetAllACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qACLName, qhkACLName, _ := qs.GetOK("acl_name") - if err := o.bindACLName(qACLName, qhkACLName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindACLName binds and validates parameter ACLName from query. -func (o *GetAllACLBackendParams) bindACLName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.ACLName = &raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_all_acl_backend_responses.go b/operations/acl/get_all_acl_backend_responses.go deleted file mode 100644 index 2d1d9251..00000000 --- a/operations/acl/get_all_acl_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllACLBackendOKCode is the HTTP code returned for type GetAllACLBackendOK -const GetAllACLBackendOKCode int = 200 - -/* -GetAllACLBackendOK Successful operation - -swagger:response getAllAclBackendOK -*/ -type GetAllACLBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewGetAllACLBackendOK creates GetAllACLBackendOK with default headers values -func NewGetAllACLBackendOK() *GetAllACLBackendOK { - - return &GetAllACLBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl backend o k response -func (o *GetAllACLBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllACLBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl backend o k response -func (o *GetAllACLBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl backend o k response -func (o *GetAllACLBackendOK) WithPayload(payload models.Acls) *GetAllACLBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl backend o k response -func (o *GetAllACLBackendOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllACLBackendDefault General Error - -swagger:response getAllAclBackendDefault -*/ -type GetAllACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllACLBackendDefault creates GetAllACLBackendDefault with default headers values -func NewGetAllACLBackendDefault(code int) *GetAllACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all Acl backend default response -func (o *GetAllACLBackendDefault) WithStatusCode(code int) *GetAllACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all Acl backend default response -func (o *GetAllACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl backend default response -func (o *GetAllACLBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl backend default response -func (o *GetAllACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl backend default response -func (o *GetAllACLBackendDefault) WithPayload(payload *models.Error) *GetAllACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl backend default response -func (o *GetAllACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_all_acl_backend_urlbuilder.go b/operations/acl/get_all_acl_backend_urlbuilder.go deleted file mode 100644 index a3bf1698..00000000 --- a/operations/acl/get_all_acl_backend_urlbuilder.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllACLBackendURL generates an URL for the get all Acl backend operation -type GetAllACLBackendURL struct { - ParentName string - - ACLName *string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLBackendURL) WithBasePath(bp string) *GetAllACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var aCLNameQ string - if o.ACLName != nil { - aCLNameQ = *o.ACLName - } - if aCLNameQ != "" { - qs.Set("acl_name", aCLNameQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_all_acl_defaults.go b/operations/acl/get_all_acl_defaults.go deleted file mode 100644 index dfa70f3a..00000000 --- a/operations/acl/get_all_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllACLDefaultsHandlerFunc turns a function with the right signature into a get all Acl defaults handler -type GetAllACLDefaultsHandlerFunc func(GetAllACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllACLDefaultsHandlerFunc) Handle(params GetAllACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllACLDefaultsHandler interface for that can handle valid get all Acl defaults params -type GetAllACLDefaultsHandler interface { - Handle(GetAllACLDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllACLDefaults creates a new http.Handler for the get all Acl defaults operation -func NewGetAllACLDefaults(ctx *middleware.Context, handler GetAllACLDefaultsHandler) *GetAllACLDefaults { - return &GetAllACLDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllACLDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/acls ACL getAllAclDefaults - -# Return an array of all ACL lines - -Returns all ACL lines that are configured in specified parent. -*/ -type GetAllACLDefaults struct { - Context *middleware.Context - Handler GetAllACLDefaultsHandler -} - -func (o *GetAllACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_all_acl_defaults_parameters.go b/operations/acl/get_all_acl_defaults_parameters.go deleted file mode 100644 index b1c06a7b..00000000 --- a/operations/acl/get_all_acl_defaults_parameters.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllACLDefaultsParams creates a new GetAllACLDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllACLDefaultsParams() GetAllACLDefaultsParams { - - return GetAllACLDefaultsParams{} -} - -// GetAllACLDefaultsParams contains all the bound params for the get all Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllAclDefaults -type GetAllACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL name - In: query - */ - ACLName *string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllACLDefaultsParams() beforehand. -func (o *GetAllACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qACLName, qhkACLName, _ := qs.GetOK("acl_name") - if err := o.bindACLName(qACLName, qhkACLName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindACLName binds and validates parameter ACLName from query. -func (o *GetAllACLDefaultsParams) bindACLName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.ACLName = &raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_all_acl_defaults_responses.go b/operations/acl/get_all_acl_defaults_responses.go deleted file mode 100644 index aee7dd69..00000000 --- a/operations/acl/get_all_acl_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllACLDefaultsOKCode is the HTTP code returned for type GetAllACLDefaultsOK -const GetAllACLDefaultsOKCode int = 200 - -/* -GetAllACLDefaultsOK Successful operation - -swagger:response getAllAclDefaultsOK -*/ -type GetAllACLDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewGetAllACLDefaultsOK creates GetAllACLDefaultsOK with default headers values -func NewGetAllACLDefaultsOK() *GetAllACLDefaultsOK { - - return &GetAllACLDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl defaults o k response -func (o *GetAllACLDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllACLDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl defaults o k response -func (o *GetAllACLDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl defaults o k response -func (o *GetAllACLDefaultsOK) WithPayload(payload models.Acls) *GetAllACLDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl defaults o k response -func (o *GetAllACLDefaultsOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllACLDefaultsDefault General Error - -swagger:response getAllAclDefaultsDefault -*/ -type GetAllACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllACLDefaultsDefault creates GetAllACLDefaultsDefault with default headers values -func NewGetAllACLDefaultsDefault(code int) *GetAllACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) WithStatusCode(code int) *GetAllACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) WithPayload(payload *models.Error) *GetAllACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl defaults default response -func (o *GetAllACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_all_acl_defaults_urlbuilder.go b/operations/acl/get_all_acl_defaults_urlbuilder.go deleted file mode 100644 index d1a2eba8..00000000 --- a/operations/acl/get_all_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllACLDefaultsURL generates an URL for the get all Acl defaults operation -type GetAllACLDefaultsURL struct { - ParentName string - - ACLName *string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLDefaultsURL) WithBasePath(bp string) *GetAllACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var aCLNameQ string - if o.ACLName != nil { - aCLNameQ = *o.ACLName - } - if aCLNameQ != "" { - qs.Set("acl_name", aCLNameQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_all_acl_fcgi_app.go b/operations/acl/get_all_acl_fcgi_app.go deleted file mode 100644 index 45c7d98a..00000000 --- a/operations/acl/get_all_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllACLFCGIAppHandlerFunc turns a function with the right signature into a get all Acl FCGI app handler -type GetAllACLFCGIAppHandlerFunc func(GetAllACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllACLFCGIAppHandlerFunc) Handle(params GetAllACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllACLFCGIAppHandler interface for that can handle valid get all Acl FCGI app params -type GetAllACLFCGIAppHandler interface { - Handle(GetAllACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewGetAllACLFCGIApp creates a new http.Handler for the get all Acl FCGI app operation -func NewGetAllACLFCGIApp(ctx *middleware.Context, handler GetAllACLFCGIAppHandler) *GetAllACLFCGIApp { - return &GetAllACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - GetAllACLFCGIApp swagger:route GET /services/haproxy/configuration/fcgi_apps/{parent_name}/acls ACL getAllAclFcgiApp - -# Return an array of all ACL lines - -Returns all ACL lines that are configured in specified parent. -*/ -type GetAllACLFCGIApp struct { - Context *middleware.Context - Handler GetAllACLFCGIAppHandler -} - -func (o *GetAllACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_all_acl_fcgi_app_parameters.go b/operations/acl/get_all_acl_fcgi_app_parameters.go deleted file mode 100644 index 16e39a18..00000000 --- a/operations/acl/get_all_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllACLFCGIAppParams creates a new GetAllACLFCGIAppParams object -// -// There are no default values defined in the spec. -func NewGetAllACLFCGIAppParams() GetAllACLFCGIAppParams { - - return GetAllACLFCGIAppParams{} -} - -// GetAllACLFCGIAppParams contains all the bound params for the get all Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllAclFCGIApp -type GetAllACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL name - In: query - */ - ACLName *string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllACLFCGIAppParams() beforehand. -func (o *GetAllACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qACLName, qhkACLName, _ := qs.GetOK("acl_name") - if err := o.bindACLName(qACLName, qhkACLName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindACLName binds and validates parameter ACLName from query. -func (o *GetAllACLFCGIAppParams) bindACLName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.ACLName = &raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_all_acl_fcgi_app_responses.go b/operations/acl/get_all_acl_fcgi_app_responses.go deleted file mode 100644 index 0463500d..00000000 --- a/operations/acl/get_all_acl_fcgi_app_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllACLFCGIAppOKCode is the HTTP code returned for type GetAllACLFCGIAppOK -const GetAllACLFCGIAppOKCode int = 200 - -/* -GetAllACLFCGIAppOK Successful operation - -swagger:response getAllAclFcgiAppOK -*/ -type GetAllACLFCGIAppOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewGetAllACLFCGIAppOK creates GetAllACLFCGIAppOK with default headers values -func NewGetAllACLFCGIAppOK() *GetAllACLFCGIAppOK { - - return &GetAllACLFCGIAppOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl Fcgi app o k response -func (o *GetAllACLFCGIAppOK) WithConfigurationVersion(configurationVersion string) *GetAllACLFCGIAppOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl Fcgi app o k response -func (o *GetAllACLFCGIAppOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl Fcgi app o k response -func (o *GetAllACLFCGIAppOK) WithPayload(payload models.Acls) *GetAllACLFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl Fcgi app o k response -func (o *GetAllACLFCGIAppOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllACLFCGIAppDefault General Error - -swagger:response getAllAclFcgiAppDefault -*/ -type GetAllACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllACLFCGIAppDefault creates GetAllACLFCGIAppDefault with default headers values -func NewGetAllACLFCGIAppDefault(code int) *GetAllACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &GetAllACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) WithStatusCode(code int) *GetAllACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *GetAllACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) WithPayload(payload *models.Error) *GetAllACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl FCGI app default response -func (o *GetAllACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_all_acl_fcgi_app_urlbuilder.go b/operations/acl/get_all_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index 2ab15370..00000000 --- a/operations/acl/get_all_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllACLFCGIAppURL generates an URL for the get all Acl FCGI app operation -type GetAllACLFCGIAppURL struct { - ParentName string - - ACLName *string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLFCGIAppURL) WithBasePath(bp string) *GetAllACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var aCLNameQ string - if o.ACLName != nil { - aCLNameQ = *o.ACLName - } - if aCLNameQ != "" { - qs.Set("acl_name", aCLNameQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/get_all_acl_frontend.go b/operations/acl/get_all_acl_frontend.go deleted file mode 100644 index 8a1010bd..00000000 --- a/operations/acl/get_all_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllACLFrontendHandlerFunc turns a function with the right signature into a get all Acl frontend handler -type GetAllACLFrontendHandlerFunc func(GetAllACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllACLFrontendHandlerFunc) Handle(params GetAllACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllACLFrontendHandler interface for that can handle valid get all Acl frontend params -type GetAllACLFrontendHandler interface { - Handle(GetAllACLFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllACLFrontend creates a new http.Handler for the get all Acl frontend operation -func NewGetAllACLFrontend(ctx *middleware.Context, handler GetAllACLFrontendHandler) *GetAllACLFrontend { - return &GetAllACLFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllACLFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/acls ACL getAllAclFrontend - -# Return an array of all ACL lines - -Returns all ACL lines that are configured in specified parent. -*/ -type GetAllACLFrontend struct { - Context *middleware.Context - Handler GetAllACLFrontendHandler -} - -func (o *GetAllACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/get_all_acl_frontend_parameters.go b/operations/acl/get_all_acl_frontend_parameters.go deleted file mode 100644 index d3f51e84..00000000 --- a/operations/acl/get_all_acl_frontend_parameters.go +++ /dev/null @@ -1,143 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllACLFrontendParams creates a new GetAllACLFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllACLFrontendParams() GetAllACLFrontendParams { - - return GetAllACLFrontendParams{} -} - -// GetAllACLFrontendParams contains all the bound params for the get all Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllAclFrontend -type GetAllACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL name - In: query - */ - ACLName *string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllACLFrontendParams() beforehand. -func (o *GetAllACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qACLName, qhkACLName, _ := qs.GetOK("acl_name") - if err := o.bindACLName(qACLName, qhkACLName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindACLName binds and validates parameter ACLName from query. -func (o *GetAllACLFrontendParams) bindACLName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.ACLName = &raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acl/get_all_acl_frontend_responses.go b/operations/acl/get_all_acl_frontend_responses.go deleted file mode 100644 index a60ee50a..00000000 --- a/operations/acl/get_all_acl_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllACLFrontendOKCode is the HTTP code returned for type GetAllACLFrontendOK -const GetAllACLFrontendOKCode int = 200 - -/* -GetAllACLFrontendOK Successful operation - -swagger:response getAllAclFrontendOK -*/ -type GetAllACLFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewGetAllACLFrontendOK creates GetAllACLFrontendOK with default headers values -func NewGetAllACLFrontendOK() *GetAllACLFrontendOK { - - return &GetAllACLFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl frontend o k response -func (o *GetAllACLFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllACLFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl frontend o k response -func (o *GetAllACLFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl frontend o k response -func (o *GetAllACLFrontendOK) WithPayload(payload models.Acls) *GetAllACLFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl frontend o k response -func (o *GetAllACLFrontendOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllACLFrontendDefault General Error - -swagger:response getAllAclFrontendDefault -*/ -type GetAllACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllACLFrontendDefault creates GetAllACLFrontendDefault with default headers values -func NewGetAllACLFrontendDefault(code int) *GetAllACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) WithStatusCode(code int) *GetAllACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) WithPayload(payload *models.Error) *GetAllACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Acl frontend default response -func (o *GetAllACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/get_all_acl_frontend_urlbuilder.go b/operations/acl/get_all_acl_frontend_urlbuilder.go deleted file mode 100644 index db85701d..00000000 --- a/operations/acl/get_all_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllACLFrontendURL generates an URL for the get all Acl frontend operation -type GetAllACLFrontendURL struct { - ParentName string - - ACLName *string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLFrontendURL) WithBasePath(bp string) *GetAllACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var aCLNameQ string - if o.ACLName != nil { - aCLNameQ = *o.ACLName - } - if aCLNameQ != "" { - qs.Set("acl_name", aCLNameQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_acl_backend.go b/operations/acl/replace_acl_backend.go deleted file mode 100644 index bcb260ee..00000000 --- a/operations/acl/replace_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceACLBackendHandlerFunc turns a function with the right signature into a replace Acl backend handler -type ReplaceACLBackendHandlerFunc func(ReplaceACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceACLBackendHandlerFunc) Handle(params ReplaceACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceACLBackendHandler interface for that can handle valid replace Acl backend params -type ReplaceACLBackendHandler interface { - Handle(ReplaceACLBackendParams, interface{}) middleware.Responder -} - -// NewReplaceACLBackend creates a new http.Handler for the replace Acl backend operation -func NewReplaceACLBackend(ctx *middleware.Context, handler ReplaceACLBackendHandler) *ReplaceACLBackend { - return &ReplaceACLBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceACLBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/acls/{index} ACL replaceAclBackend - -# Replace a ACL line - -Replaces a ACL line configuration by it's index in the specified parent. -*/ -type ReplaceACLBackend struct { - Context *middleware.Context - Handler ReplaceACLBackendHandler -} - -func (o *ReplaceACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_acl_backend_parameters.go b/operations/acl/replace_acl_backend_parameters.go deleted file mode 100644 index b0c54444..00000000 --- a/operations/acl/replace_acl_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceACLBackendParams creates a new ReplaceACLBackendParams object -// with the default values initialized. -func NewReplaceACLBackendParams() ReplaceACLBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceACLBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceACLBackendParams contains all the bound params for the replace Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAclBackend -type ReplaceACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceACLBackendParams() beforehand. -func (o *ReplaceACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceACLBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceACLBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceACLBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceACLBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_acl_backend_responses.go b/operations/acl/replace_acl_backend_responses.go deleted file mode 100644 index d05cdcea..00000000 --- a/operations/acl/replace_acl_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceACLBackendOKCode is the HTTP code returned for type ReplaceACLBackendOK -const ReplaceACLBackendOKCode int = 200 - -/* -ReplaceACLBackendOK ACL line replaced - -swagger:response replaceAclBackendOK -*/ -type ReplaceACLBackendOK struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLBackendOK creates ReplaceACLBackendOK with default headers values -func NewReplaceACLBackendOK() *ReplaceACLBackendOK { - - return &ReplaceACLBackendOK{} -} - -// WithPayload adds the payload to the replace Acl backend o k response -func (o *ReplaceACLBackendOK) WithPayload(payload *models.ACL) *ReplaceACLBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl backend o k response -func (o *ReplaceACLBackendOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLBackendAcceptedCode is the HTTP code returned for type ReplaceACLBackendAccepted -const ReplaceACLBackendAcceptedCode int = 202 - -/* -ReplaceACLBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAclBackendAccepted -*/ -type ReplaceACLBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLBackendAccepted creates ReplaceACLBackendAccepted with default headers values -func NewReplaceACLBackendAccepted() *ReplaceACLBackendAccepted { - - return &ReplaceACLBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Acl backend accepted response -func (o *ReplaceACLBackendAccepted) WithReloadID(reloadID string) *ReplaceACLBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Acl backend accepted response -func (o *ReplaceACLBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Acl backend accepted response -func (o *ReplaceACLBackendAccepted) WithPayload(payload *models.ACL) *ReplaceACLBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl backend accepted response -func (o *ReplaceACLBackendAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLBackendBadRequestCode is the HTTP code returned for type ReplaceACLBackendBadRequest -const ReplaceACLBackendBadRequestCode int = 400 - -/* -ReplaceACLBackendBadRequest Bad request - -swagger:response replaceAclBackendBadRequest -*/ -type ReplaceACLBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLBackendBadRequest creates ReplaceACLBackendBadRequest with default headers values -func NewReplaceACLBackendBadRequest() *ReplaceACLBackendBadRequest { - - return &ReplaceACLBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl backend bad request response -func (o *ReplaceACLBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceACLBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl backend bad request response -func (o *ReplaceACLBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl backend bad request response -func (o *ReplaceACLBackendBadRequest) WithPayload(payload *models.Error) *ReplaceACLBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl backend bad request response -func (o *ReplaceACLBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLBackendNotFoundCode is the HTTP code returned for type ReplaceACLBackendNotFound -const ReplaceACLBackendNotFoundCode int = 404 - -/* -ReplaceACLBackendNotFound The specified resource was not found - -swagger:response replaceAclBackendNotFound -*/ -type ReplaceACLBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLBackendNotFound creates ReplaceACLBackendNotFound with default headers values -func NewReplaceACLBackendNotFound() *ReplaceACLBackendNotFound { - - return &ReplaceACLBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl backend not found response -func (o *ReplaceACLBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceACLBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl backend not found response -func (o *ReplaceACLBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl backend not found response -func (o *ReplaceACLBackendNotFound) WithPayload(payload *models.Error) *ReplaceACLBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl backend not found response -func (o *ReplaceACLBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceACLBackendDefault General Error - -swagger:response replaceAclBackendDefault -*/ -type ReplaceACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLBackendDefault creates ReplaceACLBackendDefault with default headers values -func NewReplaceACLBackendDefault(code int) *ReplaceACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) WithStatusCode(code int) *ReplaceACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) WithPayload(payload *models.Error) *ReplaceACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl backend default response -func (o *ReplaceACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_acl_backend_urlbuilder.go b/operations/acl/replace_acl_backend_urlbuilder.go deleted file mode 100644 index 64481a09..00000000 --- a/operations/acl/replace_acl_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceACLBackendURL generates an URL for the replace Acl backend operation -type ReplaceACLBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLBackendURL) WithBasePath(bp string) *ReplaceACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceACLBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_acl_defaults.go b/operations/acl/replace_acl_defaults.go deleted file mode 100644 index a1b9745c..00000000 --- a/operations/acl/replace_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceACLDefaultsHandlerFunc turns a function with the right signature into a replace Acl defaults handler -type ReplaceACLDefaultsHandlerFunc func(ReplaceACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceACLDefaultsHandlerFunc) Handle(params ReplaceACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceACLDefaultsHandler interface for that can handle valid replace Acl defaults params -type ReplaceACLDefaultsHandler interface { - Handle(ReplaceACLDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceACLDefaults creates a new http.Handler for the replace Acl defaults operation -func NewReplaceACLDefaults(ctx *middleware.Context, handler ReplaceACLDefaultsHandler) *ReplaceACLDefaults { - return &ReplaceACLDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceACLDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/acls/{index} ACL replaceAclDefaults - -# Replace a ACL line - -Replaces a ACL line configuration by it's index in the specified parent. -*/ -type ReplaceACLDefaults struct { - Context *middleware.Context - Handler ReplaceACLDefaultsHandler -} - -func (o *ReplaceACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_acl_defaults_parameters.go b/operations/acl/replace_acl_defaults_parameters.go deleted file mode 100644 index 30d95a54..00000000 --- a/operations/acl/replace_acl_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceACLDefaultsParams creates a new ReplaceACLDefaultsParams object -// with the default values initialized. -func NewReplaceACLDefaultsParams() ReplaceACLDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceACLDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceACLDefaultsParams contains all the bound params for the replace Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAclDefaults -type ReplaceACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceACLDefaultsParams() beforehand. -func (o *ReplaceACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceACLDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceACLDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceACLDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceACLDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_acl_defaults_responses.go b/operations/acl/replace_acl_defaults_responses.go deleted file mode 100644 index ebc3ee78..00000000 --- a/operations/acl/replace_acl_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceACLDefaultsOKCode is the HTTP code returned for type ReplaceACLDefaultsOK -const ReplaceACLDefaultsOKCode int = 200 - -/* -ReplaceACLDefaultsOK ACL line replaced - -swagger:response replaceAclDefaultsOK -*/ -type ReplaceACLDefaultsOK struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLDefaultsOK creates ReplaceACLDefaultsOK with default headers values -func NewReplaceACLDefaultsOK() *ReplaceACLDefaultsOK { - - return &ReplaceACLDefaultsOK{} -} - -// WithPayload adds the payload to the replace Acl defaults o k response -func (o *ReplaceACLDefaultsOK) WithPayload(payload *models.ACL) *ReplaceACLDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl defaults o k response -func (o *ReplaceACLDefaultsOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLDefaultsAcceptedCode is the HTTP code returned for type ReplaceACLDefaultsAccepted -const ReplaceACLDefaultsAcceptedCode int = 202 - -/* -ReplaceACLDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAclDefaultsAccepted -*/ -type ReplaceACLDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLDefaultsAccepted creates ReplaceACLDefaultsAccepted with default headers values -func NewReplaceACLDefaultsAccepted() *ReplaceACLDefaultsAccepted { - - return &ReplaceACLDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Acl defaults accepted response -func (o *ReplaceACLDefaultsAccepted) WithReloadID(reloadID string) *ReplaceACLDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Acl defaults accepted response -func (o *ReplaceACLDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Acl defaults accepted response -func (o *ReplaceACLDefaultsAccepted) WithPayload(payload *models.ACL) *ReplaceACLDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl defaults accepted response -func (o *ReplaceACLDefaultsAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLDefaultsBadRequestCode is the HTTP code returned for type ReplaceACLDefaultsBadRequest -const ReplaceACLDefaultsBadRequestCode int = 400 - -/* -ReplaceACLDefaultsBadRequest Bad request - -swagger:response replaceAclDefaultsBadRequest -*/ -type ReplaceACLDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLDefaultsBadRequest creates ReplaceACLDefaultsBadRequest with default headers values -func NewReplaceACLDefaultsBadRequest() *ReplaceACLDefaultsBadRequest { - - return &ReplaceACLDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl defaults bad request response -func (o *ReplaceACLDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceACLDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl defaults bad request response -func (o *ReplaceACLDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl defaults bad request response -func (o *ReplaceACLDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceACLDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl defaults bad request response -func (o *ReplaceACLDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLDefaultsNotFoundCode is the HTTP code returned for type ReplaceACLDefaultsNotFound -const ReplaceACLDefaultsNotFoundCode int = 404 - -/* -ReplaceACLDefaultsNotFound The specified resource was not found - -swagger:response replaceAclDefaultsNotFound -*/ -type ReplaceACLDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLDefaultsNotFound creates ReplaceACLDefaultsNotFound with default headers values -func NewReplaceACLDefaultsNotFound() *ReplaceACLDefaultsNotFound { - - return &ReplaceACLDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl defaults not found response -func (o *ReplaceACLDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceACLDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl defaults not found response -func (o *ReplaceACLDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl defaults not found response -func (o *ReplaceACLDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceACLDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl defaults not found response -func (o *ReplaceACLDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceACLDefaultsDefault General Error - -swagger:response replaceAclDefaultsDefault -*/ -type ReplaceACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLDefaultsDefault creates ReplaceACLDefaultsDefault with default headers values -func NewReplaceACLDefaultsDefault(code int) *ReplaceACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) WithStatusCode(code int) *ReplaceACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) WithPayload(payload *models.Error) *ReplaceACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl defaults default response -func (o *ReplaceACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_acl_defaults_urlbuilder.go b/operations/acl/replace_acl_defaults_urlbuilder.go deleted file mode 100644 index 8b20eed0..00000000 --- a/operations/acl/replace_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceACLDefaultsURL generates an URL for the replace Acl defaults operation -type ReplaceACLDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLDefaultsURL) WithBasePath(bp string) *ReplaceACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceACLDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_acl_fcgi_app.go b/operations/acl/replace_acl_fcgi_app.go deleted file mode 100644 index 70c33850..00000000 --- a/operations/acl/replace_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceACLFCGIAppHandlerFunc turns a function with the right signature into a replace Acl FCGI app handler -type ReplaceACLFCGIAppHandlerFunc func(ReplaceACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceACLFCGIAppHandlerFunc) Handle(params ReplaceACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceACLFCGIAppHandler interface for that can handle valid replace Acl FCGI app params -type ReplaceACLFCGIAppHandler interface { - Handle(ReplaceACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewReplaceACLFCGIApp creates a new http.Handler for the replace Acl FCGI app operation -func NewReplaceACLFCGIApp(ctx *middleware.Context, handler ReplaceACLFCGIAppHandler) *ReplaceACLFCGIApp { - return &ReplaceACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - ReplaceACLFCGIApp swagger:route PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index} ACL replaceAclFcgiApp - -# Replace a ACL line - -Replaces a ACL line configuration by it's index in the specified parent. -*/ -type ReplaceACLFCGIApp struct { - Context *middleware.Context - Handler ReplaceACLFCGIAppHandler -} - -func (o *ReplaceACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_acl_fcgi_app_parameters.go b/operations/acl/replace_acl_fcgi_app_parameters.go deleted file mode 100644 index b6ad5b8f..00000000 --- a/operations/acl/replace_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceACLFCGIAppParams creates a new ReplaceACLFCGIAppParams object -// with the default values initialized. -func NewReplaceACLFCGIAppParams() ReplaceACLFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceACLFCGIAppParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceACLFCGIAppParams contains all the bound params for the replace Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAclFCGIApp -type ReplaceACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceACLFCGIAppParams() beforehand. -func (o *ReplaceACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceACLFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceACLFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceACLFCGIAppParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceACLFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_acl_fcgi_app_responses.go b/operations/acl/replace_acl_fcgi_app_responses.go deleted file mode 100644 index 71c0d224..00000000 --- a/operations/acl/replace_acl_fcgi_app_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceACLFCGIAppOKCode is the HTTP code returned for type ReplaceACLFCGIAppOK -const ReplaceACLFCGIAppOKCode int = 200 - -/* -ReplaceACLFCGIAppOK ACL line replaced - -swagger:response replaceAclFcgiAppOK -*/ -type ReplaceACLFCGIAppOK struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLFCGIAppOK creates ReplaceACLFCGIAppOK with default headers values -func NewReplaceACLFCGIAppOK() *ReplaceACLFCGIAppOK { - - return &ReplaceACLFCGIAppOK{} -} - -// WithPayload adds the payload to the replace Acl Fcgi app o k response -func (o *ReplaceACLFCGIAppOK) WithPayload(payload *models.ACL) *ReplaceACLFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl Fcgi app o k response -func (o *ReplaceACLFCGIAppOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFCGIAppAcceptedCode is the HTTP code returned for type ReplaceACLFCGIAppAccepted -const ReplaceACLFCGIAppAcceptedCode int = 202 - -/* -ReplaceACLFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response replaceAclFcgiAppAccepted -*/ -type ReplaceACLFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLFCGIAppAccepted creates ReplaceACLFCGIAppAccepted with default headers values -func NewReplaceACLFCGIAppAccepted() *ReplaceACLFCGIAppAccepted { - - return &ReplaceACLFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the replace Acl Fcgi app accepted response -func (o *ReplaceACLFCGIAppAccepted) WithReloadID(reloadID string) *ReplaceACLFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Acl Fcgi app accepted response -func (o *ReplaceACLFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Acl Fcgi app accepted response -func (o *ReplaceACLFCGIAppAccepted) WithPayload(payload *models.ACL) *ReplaceACLFCGIAppAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl Fcgi app accepted response -func (o *ReplaceACLFCGIAppAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFCGIAppBadRequestCode is the HTTP code returned for type ReplaceACLFCGIAppBadRequest -const ReplaceACLFCGIAppBadRequestCode int = 400 - -/* -ReplaceACLFCGIAppBadRequest Bad request - -swagger:response replaceAclFcgiAppBadRequest -*/ -type ReplaceACLFCGIAppBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFCGIAppBadRequest creates ReplaceACLFCGIAppBadRequest with default headers values -func NewReplaceACLFCGIAppBadRequest() *ReplaceACLFCGIAppBadRequest { - - return &ReplaceACLFCGIAppBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl Fcgi app bad request response -func (o *ReplaceACLFCGIAppBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceACLFCGIAppBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl Fcgi app bad request response -func (o *ReplaceACLFCGIAppBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl Fcgi app bad request response -func (o *ReplaceACLFCGIAppBadRequest) WithPayload(payload *models.Error) *ReplaceACLFCGIAppBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl Fcgi app bad request response -func (o *ReplaceACLFCGIAppBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFCGIAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFCGIAppNotFoundCode is the HTTP code returned for type ReplaceACLFCGIAppNotFound -const ReplaceACLFCGIAppNotFoundCode int = 404 - -/* -ReplaceACLFCGIAppNotFound The specified resource was not found - -swagger:response replaceAclFcgiAppNotFound -*/ -type ReplaceACLFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFCGIAppNotFound creates ReplaceACLFCGIAppNotFound with default headers values -func NewReplaceACLFCGIAppNotFound() *ReplaceACLFCGIAppNotFound { - - return &ReplaceACLFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl Fcgi app not found response -func (o *ReplaceACLFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceACLFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl Fcgi app not found response -func (o *ReplaceACLFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl Fcgi app not found response -func (o *ReplaceACLFCGIAppNotFound) WithPayload(payload *models.Error) *ReplaceACLFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl Fcgi app not found response -func (o *ReplaceACLFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceACLFCGIAppDefault General Error - -swagger:response replaceAclFcgiAppDefault -*/ -type ReplaceACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFCGIAppDefault creates ReplaceACLFCGIAppDefault with default headers values -func NewReplaceACLFCGIAppDefault(code int) *ReplaceACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) WithStatusCode(code int) *ReplaceACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *ReplaceACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) WithPayload(payload *models.Error) *ReplaceACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl FCGI app default response -func (o *ReplaceACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_acl_fcgi_app_urlbuilder.go b/operations/acl/replace_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index da60f787..00000000 --- a/operations/acl/replace_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceACLFCGIAppURL generates an URL for the replace Acl FCGI app operation -type ReplaceACLFCGIAppURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLFCGIAppURL) WithBasePath(bp string) *ReplaceACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceACLFCGIAppURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_acl_frontend.go b/operations/acl/replace_acl_frontend.go deleted file mode 100644 index 2b41554e..00000000 --- a/operations/acl/replace_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceACLFrontendHandlerFunc turns a function with the right signature into a replace Acl frontend handler -type ReplaceACLFrontendHandlerFunc func(ReplaceACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceACLFrontendHandlerFunc) Handle(params ReplaceACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceACLFrontendHandler interface for that can handle valid replace Acl frontend params -type ReplaceACLFrontendHandler interface { - Handle(ReplaceACLFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceACLFrontend creates a new http.Handler for the replace Acl frontend operation -func NewReplaceACLFrontend(ctx *middleware.Context, handler ReplaceACLFrontendHandler) *ReplaceACLFrontend { - return &ReplaceACLFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceACLFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/acls/{index} ACL replaceAclFrontend - -# Replace a ACL line - -Replaces a ACL line configuration by it's index in the specified parent. -*/ -type ReplaceACLFrontend struct { - Context *middleware.Context - Handler ReplaceACLFrontendHandler -} - -func (o *ReplaceACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_acl_frontend_parameters.go b/operations/acl/replace_acl_frontend_parameters.go deleted file mode 100644 index e98e70a4..00000000 --- a/operations/acl/replace_acl_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceACLFrontendParams creates a new ReplaceACLFrontendParams object -// with the default values initialized. -func NewReplaceACLFrontendParams() ReplaceACLFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceACLFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceACLFrontendParams contains all the bound params for the replace Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAclFrontend -type ReplaceACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACL - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ACL line Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceACLFrontendParams() beforehand. -func (o *ReplaceACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACL - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceACLFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceACLFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceACLFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceACLFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_acl_frontend_responses.go b/operations/acl/replace_acl_frontend_responses.go deleted file mode 100644 index 7f5f356d..00000000 --- a/operations/acl/replace_acl_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceACLFrontendOKCode is the HTTP code returned for type ReplaceACLFrontendOK -const ReplaceACLFrontendOKCode int = 200 - -/* -ReplaceACLFrontendOK ACL line replaced - -swagger:response replaceAclFrontendOK -*/ -type ReplaceACLFrontendOK struct { - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLFrontendOK creates ReplaceACLFrontendOK with default headers values -func NewReplaceACLFrontendOK() *ReplaceACLFrontendOK { - - return &ReplaceACLFrontendOK{} -} - -// WithPayload adds the payload to the replace Acl frontend o k response -func (o *ReplaceACLFrontendOK) WithPayload(payload *models.ACL) *ReplaceACLFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl frontend o k response -func (o *ReplaceACLFrontendOK) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFrontendAcceptedCode is the HTTP code returned for type ReplaceACLFrontendAccepted -const ReplaceACLFrontendAcceptedCode int = 202 - -/* -ReplaceACLFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAclFrontendAccepted -*/ -type ReplaceACLFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ACL `json:"body,omitempty"` -} - -// NewReplaceACLFrontendAccepted creates ReplaceACLFrontendAccepted with default headers values -func NewReplaceACLFrontendAccepted() *ReplaceACLFrontendAccepted { - - return &ReplaceACLFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Acl frontend accepted response -func (o *ReplaceACLFrontendAccepted) WithReloadID(reloadID string) *ReplaceACLFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Acl frontend accepted response -func (o *ReplaceACLFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Acl frontend accepted response -func (o *ReplaceACLFrontendAccepted) WithPayload(payload *models.ACL) *ReplaceACLFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl frontend accepted response -func (o *ReplaceACLFrontendAccepted) SetPayload(payload *models.ACL) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFrontendBadRequestCode is the HTTP code returned for type ReplaceACLFrontendBadRequest -const ReplaceACLFrontendBadRequestCode int = 400 - -/* -ReplaceACLFrontendBadRequest Bad request - -swagger:response replaceAclFrontendBadRequest -*/ -type ReplaceACLFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFrontendBadRequest creates ReplaceACLFrontendBadRequest with default headers values -func NewReplaceACLFrontendBadRequest() *ReplaceACLFrontendBadRequest { - - return &ReplaceACLFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl frontend bad request response -func (o *ReplaceACLFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceACLFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl frontend bad request response -func (o *ReplaceACLFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl frontend bad request response -func (o *ReplaceACLFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceACLFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl frontend bad request response -func (o *ReplaceACLFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceACLFrontendNotFoundCode is the HTTP code returned for type ReplaceACLFrontendNotFound -const ReplaceACLFrontendNotFoundCode int = 404 - -/* -ReplaceACLFrontendNotFound The specified resource was not found - -swagger:response replaceAclFrontendNotFound -*/ -type ReplaceACLFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFrontendNotFound creates ReplaceACLFrontendNotFound with default headers values -func NewReplaceACLFrontendNotFound() *ReplaceACLFrontendNotFound { - - return &ReplaceACLFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl frontend not found response -func (o *ReplaceACLFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceACLFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl frontend not found response -func (o *ReplaceACLFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl frontend not found response -func (o *ReplaceACLFrontendNotFound) WithPayload(payload *models.Error) *ReplaceACLFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl frontend not found response -func (o *ReplaceACLFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceACLFrontendDefault General Error - -swagger:response replaceAclFrontendDefault -*/ -type ReplaceACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceACLFrontendDefault creates ReplaceACLFrontendDefault with default headers values -func NewReplaceACLFrontendDefault(code int) *ReplaceACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) WithStatusCode(code int) *ReplaceACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) WithPayload(payload *models.Error) *ReplaceACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Acl frontend default response -func (o *ReplaceACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_acl_frontend_urlbuilder.go b/operations/acl/replace_acl_frontend_urlbuilder.go deleted file mode 100644 index 260cd733..00000000 --- a/operations/acl/replace_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceACLFrontendURL generates an URL for the replace Acl frontend operation -type ReplaceACLFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLFrontendURL) WithBasePath(bp string) *ReplaceACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceACLFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_all_acl_backend.go b/operations/acl/replace_all_acl_backend.go deleted file mode 100644 index 80b897b6..00000000 --- a/operations/acl/replace_all_acl_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllACLBackendHandlerFunc turns a function with the right signature into a replace all Acl backend handler -type ReplaceAllACLBackendHandlerFunc func(ReplaceAllACLBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllACLBackendHandlerFunc) Handle(params ReplaceAllACLBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllACLBackendHandler interface for that can handle valid replace all Acl backend params -type ReplaceAllACLBackendHandler interface { - Handle(ReplaceAllACLBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllACLBackend creates a new http.Handler for the replace all Acl backend operation -func NewReplaceAllACLBackend(ctx *middleware.Context, handler ReplaceAllACLBackendHandler) *ReplaceAllACLBackend { - return &ReplaceAllACLBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllACLBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/acls ACL replaceAllAclBackend - -# Replace an ACL list - -Replaces a whole list of ACLs with the list given in parameter -*/ -type ReplaceAllACLBackend struct { - Context *middleware.Context - Handler ReplaceAllACLBackendHandler -} - -func (o *ReplaceAllACLBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllACLBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_all_acl_backend_parameters.go b/operations/acl/replace_all_acl_backend_parameters.go deleted file mode 100644 index 4a34a42a..00000000 --- a/operations/acl/replace_all_acl_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllACLBackendParams creates a new ReplaceAllACLBackendParams object -// with the default values initialized. -func NewReplaceAllACLBackendParams() ReplaceAllACLBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllACLBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllACLBackendParams contains all the bound params for the replace all Acl backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllAclBackend -type ReplaceAllACLBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Acls - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllACLBackendParams() beforehand. -func (o *ReplaceAllACLBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Acls - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllACLBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllACLBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllACLBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllACLBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllACLBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_all_acl_backend_responses.go b/operations/acl/replace_all_acl_backend_responses.go deleted file mode 100644 index 52390845..00000000 --- a/operations/acl/replace_all_acl_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllACLBackendOKCode is the HTTP code returned for type ReplaceAllACLBackendOK -const ReplaceAllACLBackendOKCode int = 200 - -/* -ReplaceAllACLBackendOK All ACL lines replaced - -swagger:response replaceAllAclBackendOK -*/ -type ReplaceAllACLBackendOK struct { - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLBackendOK creates ReplaceAllACLBackendOK with default headers values -func NewReplaceAllACLBackendOK() *ReplaceAllACLBackendOK { - - return &ReplaceAllACLBackendOK{} -} - -// WithPayload adds the payload to the replace all Acl backend o k response -func (o *ReplaceAllACLBackendOK) WithPayload(payload models.Acls) *ReplaceAllACLBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl backend o k response -func (o *ReplaceAllACLBackendOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLBackendAcceptedCode is the HTTP code returned for type ReplaceAllACLBackendAccepted -const ReplaceAllACLBackendAcceptedCode int = 202 - -/* -ReplaceAllACLBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllAclBackendAccepted -*/ -type ReplaceAllACLBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLBackendAccepted creates ReplaceAllACLBackendAccepted with default headers values -func NewReplaceAllACLBackendAccepted() *ReplaceAllACLBackendAccepted { - - return &ReplaceAllACLBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Acl backend accepted response -func (o *ReplaceAllACLBackendAccepted) WithReloadID(reloadID string) *ReplaceAllACLBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Acl backend accepted response -func (o *ReplaceAllACLBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Acl backend accepted response -func (o *ReplaceAllACLBackendAccepted) WithPayload(payload models.Acls) *ReplaceAllACLBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl backend accepted response -func (o *ReplaceAllACLBackendAccepted) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLBackendBadRequestCode is the HTTP code returned for type ReplaceAllACLBackendBadRequest -const ReplaceAllACLBackendBadRequestCode int = 400 - -/* -ReplaceAllACLBackendBadRequest Bad request - -swagger:response replaceAllAclBackendBadRequest -*/ -type ReplaceAllACLBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLBackendBadRequest creates ReplaceAllACLBackendBadRequest with default headers values -func NewReplaceAllACLBackendBadRequest() *ReplaceAllACLBackendBadRequest { - - return &ReplaceAllACLBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl backend bad request response -func (o *ReplaceAllACLBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl backend bad request response -func (o *ReplaceAllACLBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl backend bad request response -func (o *ReplaceAllACLBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllACLBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl backend bad request response -func (o *ReplaceAllACLBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllACLBackendDefault General Error - -swagger:response replaceAllAclBackendDefault -*/ -type ReplaceAllACLBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLBackendDefault creates ReplaceAllACLBackendDefault with default headers values -func NewReplaceAllACLBackendDefault(code int) *ReplaceAllACLBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllACLBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) WithStatusCode(code int) *ReplaceAllACLBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) WithPayload(payload *models.Error) *ReplaceAllACLBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl backend default response -func (o *ReplaceAllACLBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_all_acl_backend_urlbuilder.go b/operations/acl/replace_all_acl_backend_urlbuilder.go deleted file mode 100644 index 3b3c0809..00000000 --- a/operations/acl/replace_all_acl_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllACLBackendURL generates an URL for the replace all Acl backend operation -type ReplaceAllACLBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLBackendURL) WithBasePath(bp string) *ReplaceAllACLBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllACLBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllACLBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllACLBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllACLBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllACLBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllACLBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllACLBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllACLBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_all_acl_defaults.go b/operations/acl/replace_all_acl_defaults.go deleted file mode 100644 index 92bbc674..00000000 --- a/operations/acl/replace_all_acl_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllACLDefaultsHandlerFunc turns a function with the right signature into a replace all Acl defaults handler -type ReplaceAllACLDefaultsHandlerFunc func(ReplaceAllACLDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllACLDefaultsHandlerFunc) Handle(params ReplaceAllACLDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllACLDefaultsHandler interface for that can handle valid replace all Acl defaults params -type ReplaceAllACLDefaultsHandler interface { - Handle(ReplaceAllACLDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllACLDefaults creates a new http.Handler for the replace all Acl defaults operation -func NewReplaceAllACLDefaults(ctx *middleware.Context, handler ReplaceAllACLDefaultsHandler) *ReplaceAllACLDefaults { - return &ReplaceAllACLDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllACLDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/acls ACL replaceAllAclDefaults - -# Replace an ACL list - -Replaces a whole list of ACLs with the list given in parameter -*/ -type ReplaceAllACLDefaults struct { - Context *middleware.Context - Handler ReplaceAllACLDefaultsHandler -} - -func (o *ReplaceAllACLDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllACLDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_all_acl_defaults_parameters.go b/operations/acl/replace_all_acl_defaults_parameters.go deleted file mode 100644 index febfff9b..00000000 --- a/operations/acl/replace_all_acl_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllACLDefaultsParams creates a new ReplaceAllACLDefaultsParams object -// with the default values initialized. -func NewReplaceAllACLDefaultsParams() ReplaceAllACLDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllACLDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllACLDefaultsParams contains all the bound params for the replace all Acl defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllAclDefaults -type ReplaceAllACLDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Acls - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllACLDefaultsParams() beforehand. -func (o *ReplaceAllACLDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Acls - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllACLDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllACLDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllACLDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllACLDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllACLDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_all_acl_defaults_responses.go b/operations/acl/replace_all_acl_defaults_responses.go deleted file mode 100644 index 28d73898..00000000 --- a/operations/acl/replace_all_acl_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllACLDefaultsOKCode is the HTTP code returned for type ReplaceAllACLDefaultsOK -const ReplaceAllACLDefaultsOKCode int = 200 - -/* -ReplaceAllACLDefaultsOK All ACL lines replaced - -swagger:response replaceAllAclDefaultsOK -*/ -type ReplaceAllACLDefaultsOK struct { - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLDefaultsOK creates ReplaceAllACLDefaultsOK with default headers values -func NewReplaceAllACLDefaultsOK() *ReplaceAllACLDefaultsOK { - - return &ReplaceAllACLDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Acl defaults o k response -func (o *ReplaceAllACLDefaultsOK) WithPayload(payload models.Acls) *ReplaceAllACLDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl defaults o k response -func (o *ReplaceAllACLDefaultsOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllACLDefaultsAccepted -const ReplaceAllACLDefaultsAcceptedCode int = 202 - -/* -ReplaceAllACLDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllAclDefaultsAccepted -*/ -type ReplaceAllACLDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLDefaultsAccepted creates ReplaceAllACLDefaultsAccepted with default headers values -func NewReplaceAllACLDefaultsAccepted() *ReplaceAllACLDefaultsAccepted { - - return &ReplaceAllACLDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Acl defaults accepted response -func (o *ReplaceAllACLDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllACLDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Acl defaults accepted response -func (o *ReplaceAllACLDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Acl defaults accepted response -func (o *ReplaceAllACLDefaultsAccepted) WithPayload(payload models.Acls) *ReplaceAllACLDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl defaults accepted response -func (o *ReplaceAllACLDefaultsAccepted) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllACLDefaultsBadRequest -const ReplaceAllACLDefaultsBadRequestCode int = 400 - -/* -ReplaceAllACLDefaultsBadRequest Bad request - -swagger:response replaceAllAclDefaultsBadRequest -*/ -type ReplaceAllACLDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLDefaultsBadRequest creates ReplaceAllACLDefaultsBadRequest with default headers values -func NewReplaceAllACLDefaultsBadRequest() *ReplaceAllACLDefaultsBadRequest { - - return &ReplaceAllACLDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl defaults bad request response -func (o *ReplaceAllACLDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl defaults bad request response -func (o *ReplaceAllACLDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl defaults bad request response -func (o *ReplaceAllACLDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllACLDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl defaults bad request response -func (o *ReplaceAllACLDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllACLDefaultsDefault General Error - -swagger:response replaceAllAclDefaultsDefault -*/ -type ReplaceAllACLDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLDefaultsDefault creates ReplaceAllACLDefaultsDefault with default headers values -func NewReplaceAllACLDefaultsDefault(code int) *ReplaceAllACLDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllACLDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) WithStatusCode(code int) *ReplaceAllACLDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllACLDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl defaults default response -func (o *ReplaceAllACLDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_all_acl_defaults_urlbuilder.go b/operations/acl/replace_all_acl_defaults_urlbuilder.go deleted file mode 100644 index e297a56c..00000000 --- a/operations/acl/replace_all_acl_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllACLDefaultsURL generates an URL for the replace all Acl defaults operation -type ReplaceAllACLDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLDefaultsURL) WithBasePath(bp string) *ReplaceAllACLDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllACLDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllACLDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllACLDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllACLDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllACLDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllACLDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllACLDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllACLDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_all_acl_fcgi_app.go b/operations/acl/replace_all_acl_fcgi_app.go deleted file mode 100644 index 28564885..00000000 --- a/operations/acl/replace_all_acl_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllACLFCGIAppHandlerFunc turns a function with the right signature into a replace all Acl FCGI app handler -type ReplaceAllACLFCGIAppHandlerFunc func(ReplaceAllACLFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllACLFCGIAppHandlerFunc) Handle(params ReplaceAllACLFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllACLFCGIAppHandler interface for that can handle valid replace all Acl FCGI app params -type ReplaceAllACLFCGIAppHandler interface { - Handle(ReplaceAllACLFCGIAppParams, interface{}) middleware.Responder -} - -// NewReplaceAllACLFCGIApp creates a new http.Handler for the replace all Acl FCGI app operation -func NewReplaceAllACLFCGIApp(ctx *middleware.Context, handler ReplaceAllACLFCGIAppHandler) *ReplaceAllACLFCGIApp { - return &ReplaceAllACLFCGIApp{Context: ctx, Handler: handler} -} - -/* - ReplaceAllACLFCGIApp swagger:route PUT /services/haproxy/configuration/fcgi_apps/{parent_name}/acls ACL replaceAllAclFcgiApp - -# Replace an ACL list - -Replaces a whole list of ACLs with the list given in parameter -*/ -type ReplaceAllACLFCGIApp struct { - Context *middleware.Context - Handler ReplaceAllACLFCGIAppHandler -} - -func (o *ReplaceAllACLFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllACLFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_all_acl_fcgi_app_parameters.go b/operations/acl/replace_all_acl_fcgi_app_parameters.go deleted file mode 100644 index c3b0d8d8..00000000 --- a/operations/acl/replace_all_acl_fcgi_app_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllACLFCGIAppParams creates a new ReplaceAllACLFCGIAppParams object -// with the default values initialized. -func NewReplaceAllACLFCGIAppParams() ReplaceAllACLFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllACLFCGIAppParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllACLFCGIAppParams contains all the bound params for the replace all Acl FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllAclFCGIApp -type ReplaceAllACLFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Acls - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllACLFCGIAppParams() beforehand. -func (o *ReplaceAllACLFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Acls - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllACLFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllACLFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllACLFCGIAppParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllACLFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllACLFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_all_acl_fcgi_app_responses.go b/operations/acl/replace_all_acl_fcgi_app_responses.go deleted file mode 100644 index a88857e8..00000000 --- a/operations/acl/replace_all_acl_fcgi_app_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllACLFCGIAppOKCode is the HTTP code returned for type ReplaceAllACLFCGIAppOK -const ReplaceAllACLFCGIAppOKCode int = 200 - -/* -ReplaceAllACLFCGIAppOK All ACL lines replaced - -swagger:response replaceAllAclFcgiAppOK -*/ -type ReplaceAllACLFCGIAppOK struct { - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLFCGIAppOK creates ReplaceAllACLFCGIAppOK with default headers values -func NewReplaceAllACLFCGIAppOK() *ReplaceAllACLFCGIAppOK { - - return &ReplaceAllACLFCGIAppOK{} -} - -// WithPayload adds the payload to the replace all Acl Fcgi app o k response -func (o *ReplaceAllACLFCGIAppOK) WithPayload(payload models.Acls) *ReplaceAllACLFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl Fcgi app o k response -func (o *ReplaceAllACLFCGIAppOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLFCGIAppAcceptedCode is the HTTP code returned for type ReplaceAllACLFCGIAppAccepted -const ReplaceAllACLFCGIAppAcceptedCode int = 202 - -/* -ReplaceAllACLFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response replaceAllAclFcgiAppAccepted -*/ -type ReplaceAllACLFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLFCGIAppAccepted creates ReplaceAllACLFCGIAppAccepted with default headers values -func NewReplaceAllACLFCGIAppAccepted() *ReplaceAllACLFCGIAppAccepted { - - return &ReplaceAllACLFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Acl Fcgi app accepted response -func (o *ReplaceAllACLFCGIAppAccepted) WithReloadID(reloadID string) *ReplaceAllACLFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Acl Fcgi app accepted response -func (o *ReplaceAllACLFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Acl Fcgi app accepted response -func (o *ReplaceAllACLFCGIAppAccepted) WithPayload(payload models.Acls) *ReplaceAllACLFCGIAppAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl Fcgi app accepted response -func (o *ReplaceAllACLFCGIAppAccepted) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLFCGIAppBadRequestCode is the HTTP code returned for type ReplaceAllACLFCGIAppBadRequest -const ReplaceAllACLFCGIAppBadRequestCode int = 400 - -/* -ReplaceAllACLFCGIAppBadRequest Bad request - -swagger:response replaceAllAclFcgiAppBadRequest -*/ -type ReplaceAllACLFCGIAppBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLFCGIAppBadRequest creates ReplaceAllACLFCGIAppBadRequest with default headers values -func NewReplaceAllACLFCGIAppBadRequest() *ReplaceAllACLFCGIAppBadRequest { - - return &ReplaceAllACLFCGIAppBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl Fcgi app bad request response -func (o *ReplaceAllACLFCGIAppBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLFCGIAppBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl Fcgi app bad request response -func (o *ReplaceAllACLFCGIAppBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl Fcgi app bad request response -func (o *ReplaceAllACLFCGIAppBadRequest) WithPayload(payload *models.Error) *ReplaceAllACLFCGIAppBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl Fcgi app bad request response -func (o *ReplaceAllACLFCGIAppBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFCGIAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllACLFCGIAppDefault General Error - -swagger:response replaceAllAclFcgiAppDefault -*/ -type ReplaceAllACLFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLFCGIAppDefault creates ReplaceAllACLFCGIAppDefault with default headers values -func NewReplaceAllACLFCGIAppDefault(code int) *ReplaceAllACLFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllACLFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) WithStatusCode(code int) *ReplaceAllACLFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) WithPayload(payload *models.Error) *ReplaceAllACLFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl FCGI app default response -func (o *ReplaceAllACLFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_all_acl_fcgi_app_urlbuilder.go b/operations/acl/replace_all_acl_fcgi_app_urlbuilder.go deleted file mode 100644 index b29f5800..00000000 --- a/operations/acl/replace_all_acl_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllACLFCGIAppURL generates an URL for the replace all Acl FCGI app operation -type ReplaceAllACLFCGIAppURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLFCGIAppURL) WithBasePath(bp string) *ReplaceAllACLFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllACLFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllACLFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllACLFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllACLFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllACLFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllACLFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllACLFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllACLFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl/replace_all_acl_frontend.go b/operations/acl/replace_all_acl_frontend.go deleted file mode 100644 index 49acb9c0..00000000 --- a/operations/acl/replace_all_acl_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllACLFrontendHandlerFunc turns a function with the right signature into a replace all Acl frontend handler -type ReplaceAllACLFrontendHandlerFunc func(ReplaceAllACLFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllACLFrontendHandlerFunc) Handle(params ReplaceAllACLFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllACLFrontendHandler interface for that can handle valid replace all Acl frontend params -type ReplaceAllACLFrontendHandler interface { - Handle(ReplaceAllACLFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllACLFrontend creates a new http.Handler for the replace all Acl frontend operation -func NewReplaceAllACLFrontend(ctx *middleware.Context, handler ReplaceAllACLFrontendHandler) *ReplaceAllACLFrontend { - return &ReplaceAllACLFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllACLFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/acls ACL replaceAllAclFrontend - -# Replace an ACL list - -Replaces a whole list of ACLs with the list given in parameter -*/ -type ReplaceAllACLFrontend struct { - Context *middleware.Context - Handler ReplaceAllACLFrontendHandler -} - -func (o *ReplaceAllACLFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllACLFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl/replace_all_acl_frontend_parameters.go b/operations/acl/replace_all_acl_frontend_parameters.go deleted file mode 100644 index 6bfd0e8c..00000000 --- a/operations/acl/replace_all_acl_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllACLFrontendParams creates a new ReplaceAllACLFrontendParams object -// with the default values initialized. -func NewReplaceAllACLFrontendParams() ReplaceAllACLFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllACLFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllACLFrontendParams contains all the bound params for the replace all Acl frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllAclFrontend -type ReplaceAllACLFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Acls - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllACLFrontendParams() beforehand. -func (o *ReplaceAllACLFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Acls - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllACLFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllACLFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllACLFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllACLFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllACLFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acl/replace_all_acl_frontend_responses.go b/operations/acl/replace_all_acl_frontend_responses.go deleted file mode 100644 index c72aee46..00000000 --- a/operations/acl/replace_all_acl_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllACLFrontendOKCode is the HTTP code returned for type ReplaceAllACLFrontendOK -const ReplaceAllACLFrontendOKCode int = 200 - -/* -ReplaceAllACLFrontendOK All ACL lines replaced - -swagger:response replaceAllAclFrontendOK -*/ -type ReplaceAllACLFrontendOK struct { - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLFrontendOK creates ReplaceAllACLFrontendOK with default headers values -func NewReplaceAllACLFrontendOK() *ReplaceAllACLFrontendOK { - - return &ReplaceAllACLFrontendOK{} -} - -// WithPayload adds the payload to the replace all Acl frontend o k response -func (o *ReplaceAllACLFrontendOK) WithPayload(payload models.Acls) *ReplaceAllACLFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl frontend o k response -func (o *ReplaceAllACLFrontendOK) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLFrontendAcceptedCode is the HTTP code returned for type ReplaceAllACLFrontendAccepted -const ReplaceAllACLFrontendAcceptedCode int = 202 - -/* -ReplaceAllACLFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllAclFrontendAccepted -*/ -type ReplaceAllACLFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Acls `json:"body,omitempty"` -} - -// NewReplaceAllACLFrontendAccepted creates ReplaceAllACLFrontendAccepted with default headers values -func NewReplaceAllACLFrontendAccepted() *ReplaceAllACLFrontendAccepted { - - return &ReplaceAllACLFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Acl frontend accepted response -func (o *ReplaceAllACLFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllACLFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Acl frontend accepted response -func (o *ReplaceAllACLFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Acl frontend accepted response -func (o *ReplaceAllACLFrontendAccepted) WithPayload(payload models.Acls) *ReplaceAllACLFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl frontend accepted response -func (o *ReplaceAllACLFrontendAccepted) SetPayload(payload models.Acls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Acls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllACLFrontendBadRequestCode is the HTTP code returned for type ReplaceAllACLFrontendBadRequest -const ReplaceAllACLFrontendBadRequestCode int = 400 - -/* -ReplaceAllACLFrontendBadRequest Bad request - -swagger:response replaceAllAclFrontendBadRequest -*/ -type ReplaceAllACLFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLFrontendBadRequest creates ReplaceAllACLFrontendBadRequest with default headers values -func NewReplaceAllACLFrontendBadRequest() *ReplaceAllACLFrontendBadRequest { - - return &ReplaceAllACLFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl frontend bad request response -func (o *ReplaceAllACLFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl frontend bad request response -func (o *ReplaceAllACLFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl frontend bad request response -func (o *ReplaceAllACLFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllACLFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl frontend bad request response -func (o *ReplaceAllACLFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllACLFrontendDefault General Error - -swagger:response replaceAllAclFrontendDefault -*/ -type ReplaceAllACLFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllACLFrontendDefault creates ReplaceAllACLFrontendDefault with default headers values -func NewReplaceAllACLFrontendDefault(code int) *ReplaceAllACLFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllACLFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) WithStatusCode(code int) *ReplaceAllACLFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllACLFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllACLFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Acl frontend default response -func (o *ReplaceAllACLFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllACLFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl/replace_all_acl_frontend_urlbuilder.go b/operations/acl/replace_all_acl_frontend_urlbuilder.go deleted file mode 100644 index 83b0dcac..00000000 --- a/operations/acl/replace_all_acl_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllACLFrontendURL generates an URL for the replace all Acl frontend operation -type ReplaceAllACLFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLFrontendURL) WithBasePath(bp string) *ReplaceAllACLFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllACLFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllACLFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/acls" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllACLFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllACLFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllACLFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllACLFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllACLFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllACLFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllACLFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/add_payload_runtime_acl.go b/operations/acl_runtime/add_payload_runtime_acl.go deleted file mode 100644 index 23fdd9e8..00000000 --- a/operations/acl_runtime/add_payload_runtime_acl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddPayloadRuntimeACLHandlerFunc turns a function with the right signature into a add payload runtime ACL handler -type AddPayloadRuntimeACLHandlerFunc func(AddPayloadRuntimeACLParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddPayloadRuntimeACLHandlerFunc) Handle(params AddPayloadRuntimeACLParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddPayloadRuntimeACLHandler interface for that can handle valid add payload runtime ACL params -type AddPayloadRuntimeACLHandler interface { - Handle(AddPayloadRuntimeACLParams, interface{}) middleware.Responder -} - -// NewAddPayloadRuntimeACL creates a new http.Handler for the add payload runtime ACL operation -func NewAddPayloadRuntimeACL(ctx *middleware.Context, handler AddPayloadRuntimeACLHandler) *AddPayloadRuntimeACL { - return &AddPayloadRuntimeACL{Context: ctx, Handler: handler} -} - -/* - AddPayloadRuntimeACL swagger:route PUT /services/haproxy/runtime/acls/{parent_name}/entries ACL Runtime addPayloadRuntimeAcl - -# Add a new ACL payload - -Adds a new ACL payload. -*/ -type AddPayloadRuntimeACL struct { - Context *middleware.Context - Handler AddPayloadRuntimeACLHandler -} - -func (o *AddPayloadRuntimeACL) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddPayloadRuntimeACLParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/add_payload_runtime_acl_parameters.go b/operations/acl_runtime/add_payload_runtime_acl_parameters.go deleted file mode 100644 index c6db445d..00000000 --- a/operations/acl_runtime/add_payload_runtime_acl_parameters.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddPayloadRuntimeACLParams creates a new AddPayloadRuntimeACLParams object -// -// There are no default values defined in the spec. -func NewAddPayloadRuntimeACLParams() AddPayloadRuntimeACLParams { - - return AddPayloadRuntimeACLParams{} -} - -// AddPayloadRuntimeACLParams contains all the bound params for the add payload runtime ACL operation -// typically these are obtained from a http.Request -// -// swagger:parameters addPayloadRuntimeACL -type AddPayloadRuntimeACLParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.ACLFilesEntries - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddPayloadRuntimeACLParams() beforehand. -func (o *AddPayloadRuntimeACLParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACLFilesEntries - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *AddPayloadRuntimeACLParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/acl_runtime/add_payload_runtime_acl_responses.go b/operations/acl_runtime/add_payload_runtime_acl_responses.go deleted file mode 100644 index 25dfdc6c..00000000 --- a/operations/acl_runtime/add_payload_runtime_acl_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddPayloadRuntimeACLCreatedCode is the HTTP code returned for type AddPayloadRuntimeACLCreated -const AddPayloadRuntimeACLCreatedCode int = 201 - -/* -AddPayloadRuntimeACLCreated ACL payload added - -swagger:response addPayloadRuntimeAclCreated -*/ -type AddPayloadRuntimeACLCreated struct { - - /* - In: Body - */ - Payload models.ACLFilesEntries `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeACLCreated creates AddPayloadRuntimeACLCreated with default headers values -func NewAddPayloadRuntimeACLCreated() *AddPayloadRuntimeACLCreated { - - return &AddPayloadRuntimeACLCreated{} -} - -// WithPayload adds the payload to the add payload runtime Acl created response -func (o *AddPayloadRuntimeACLCreated) WithPayload(payload models.ACLFilesEntries) *AddPayloadRuntimeACLCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime Acl created response -func (o *AddPayloadRuntimeACLCreated) SetPayload(payload models.ACLFilesEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeACLCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ACLFilesEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// AddPayloadRuntimeACLBadRequestCode is the HTTP code returned for type AddPayloadRuntimeACLBadRequest -const AddPayloadRuntimeACLBadRequestCode int = 400 - -/* -AddPayloadRuntimeACLBadRequest Bad request - -swagger:response addPayloadRuntimeAclBadRequest -*/ -type AddPayloadRuntimeACLBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeACLBadRequest creates AddPayloadRuntimeACLBadRequest with default headers values -func NewAddPayloadRuntimeACLBadRequest() *AddPayloadRuntimeACLBadRequest { - - return &AddPayloadRuntimeACLBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add payload runtime Acl bad request response -func (o *AddPayloadRuntimeACLBadRequest) WithConfigurationVersion(configurationVersion string) *AddPayloadRuntimeACLBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add payload runtime Acl bad request response -func (o *AddPayloadRuntimeACLBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add payload runtime Acl bad request response -func (o *AddPayloadRuntimeACLBadRequest) WithPayload(payload *models.Error) *AddPayloadRuntimeACLBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime Acl bad request response -func (o *AddPayloadRuntimeACLBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeACLBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddPayloadRuntimeACLDefault General Error - -swagger:response addPayloadRuntimeAclDefault -*/ -type AddPayloadRuntimeACLDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeACLDefault creates AddPayloadRuntimeACLDefault with default headers values -func NewAddPayloadRuntimeACLDefault(code int) *AddPayloadRuntimeACLDefault { - if code <= 0 { - code = 500 - } - - return &AddPayloadRuntimeACLDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) WithStatusCode(code int) *AddPayloadRuntimeACLDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) WithConfigurationVersion(configurationVersion string) *AddPayloadRuntimeACLDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) WithPayload(payload *models.Error) *AddPayloadRuntimeACLDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime ACL default response -func (o *AddPayloadRuntimeACLDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeACLDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/add_payload_runtime_acl_urlbuilder.go b/operations/acl_runtime/add_payload_runtime_acl_urlbuilder.go deleted file mode 100644 index f26f4ac6..00000000 --- a/operations/acl_runtime/add_payload_runtime_acl_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// AddPayloadRuntimeACLURL generates an URL for the add payload runtime ACL operation -type AddPayloadRuntimeACLURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddPayloadRuntimeACLURL) WithBasePath(bp string) *AddPayloadRuntimeACLURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddPayloadRuntimeACLURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddPayloadRuntimeACLURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on AddPayloadRuntimeACLURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddPayloadRuntimeACLURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddPayloadRuntimeACLURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddPayloadRuntimeACLURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddPayloadRuntimeACLURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddPayloadRuntimeACLURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddPayloadRuntimeACLURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id.go b/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id.go deleted file mode 100644 index 4ca8c776..00000000 --- a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc turns a function with the right signature into a delete services haproxy runtime acls parent name entries ID handler -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc func(DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc) Handle(params DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler interface for that can handle valid delete services haproxy runtime acls parent name entries ID params -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler interface { - Handle(DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams, interface{}) middleware.Responder -} - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesID creates a new http.Handler for the delete services haproxy runtime acls parent name entries ID operation -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesID(ctx *middleware.Context, handler DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesID { - return &DeleteServicesHaproxyRuntimeAclsParentNameEntriesID{Context: ctx, Handler: handler} -} - -/* - DeleteServicesHaproxyRuntimeAclsParentNameEntriesID swagger:route DELETE /services/haproxy/runtime/acls/{parent_name}/entries/{id} ACL Runtime deleteServicesHaproxyRuntimeAclsParentNameEntriesId - -# Delete an ACL entry - -Deletes the entry from the ACL by its value using the runtime socket. -*/ -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesID struct { - Context *middleware.Context - Handler DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler -} - -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesID) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go b/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go deleted file mode 100644 index b621688c..00000000 --- a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams creates a new DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams object -// -// There are no default values defined in the spec. -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams() DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams { - - return DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams{} -} - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams contains all the bound params for the delete services haproxy runtime acls parent name entries ID operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteServicesHaproxyRuntimeAclsParentNameEntriesID -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*File entry ID - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams() beforehand. -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_responses.go b/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_responses.go deleted file mode 100644 index c98d4663..00000000 --- a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContentCode is the HTTP code returned for type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent -const DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContentCode int = 204 - -/* -DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent Successful operation - -swagger:response deleteServicesHaproxyRuntimeAclsParentNameEntriesIdNoContent -*/ -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent struct { -} - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent creates DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent with default headers values -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent() *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent { - - return &DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequestCode is the HTTP code returned for type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest -const DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequestCode int = 400 - -/* -DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest Bad request - -swagger:response deleteServicesHaproxyRuntimeAclsParentNameEntriesIdBadRequest -*/ -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest creates DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest with default headers values -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest() *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - - return &DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete services haproxy runtime acls parent name entries Id bad request response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete services haproxy runtime acls parent name entries Id bad request response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete services haproxy runtime acls parent name entries Id bad request response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WithPayload(payload *models.Error) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete services haproxy runtime acls parent name entries Id bad request response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFoundCode is the HTTP code returned for type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound -const DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFoundCode int = 404 - -/* -DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound The specified resource was not found - -swagger:response deleteServicesHaproxyRuntimeAclsParentNameEntriesIdNotFound -*/ -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound creates DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound with default headers values -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound() *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - - return &DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete services haproxy runtime acls parent name entries Id not found response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete services haproxy runtime acls parent name entries Id not found response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete services haproxy runtime acls parent name entries Id not found response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WithPayload(payload *models.Error) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete services haproxy runtime acls parent name entries Id not found response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault General Error - -swagger:response deleteServicesHaproxyRuntimeAclsParentNameEntriesIdDefault -*/ -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault creates DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault with default headers values -func NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(code int) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithStatusCode(code int) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithConfigurationVersion(configurationVersion string) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithPayload(payload *models.Error) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete services haproxy runtime acls parent name entries ID default response -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go b/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go deleted file mode 100644 index 33b14a42..00000000 --- a/operations/acl_runtime/delete_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL generates an URL for the delete services haproxy runtime acls parent name entries ID operation -type DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL struct { - ID string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) WithBasePath(bp string) *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{parent_name}/entries/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls.go b/operations/acl_runtime/get_services_haproxy_runtime_acls.go deleted file mode 100644 index ba12d062..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServicesHaproxyRuntimeAclsHandlerFunc turns a function with the right signature into a get services haproxy runtime acls handler -type GetServicesHaproxyRuntimeAclsHandlerFunc func(GetServicesHaproxyRuntimeAclsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServicesHaproxyRuntimeAclsHandlerFunc) Handle(params GetServicesHaproxyRuntimeAclsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServicesHaproxyRuntimeAclsHandler interface for that can handle valid get services haproxy runtime acls params -type GetServicesHaproxyRuntimeAclsHandler interface { - Handle(GetServicesHaproxyRuntimeAclsParams, interface{}) middleware.Responder -} - -// NewGetServicesHaproxyRuntimeAcls creates a new http.Handler for the get services haproxy runtime acls operation -func NewGetServicesHaproxyRuntimeAcls(ctx *middleware.Context, handler GetServicesHaproxyRuntimeAclsHandler) *GetServicesHaproxyRuntimeAcls { - return &GetServicesHaproxyRuntimeAcls{Context: ctx, Handler: handler} -} - -/* - GetServicesHaproxyRuntimeAcls swagger:route GET /services/haproxy/runtime/acls ACL Runtime getServicesHaproxyRuntimeAcls - -# Return an array of all ACL files - -Returns all ACL files using the runtime socket. -*/ -type GetServicesHaproxyRuntimeAcls struct { - Context *middleware.Context - Handler GetServicesHaproxyRuntimeAclsHandler -} - -func (o *GetServicesHaproxyRuntimeAcls) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServicesHaproxyRuntimeAclsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_id.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_id.go deleted file mode 100644 index b51bc51d..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_id.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServicesHaproxyRuntimeAclsIDHandlerFunc turns a function with the right signature into a get services haproxy runtime acls ID handler -type GetServicesHaproxyRuntimeAclsIDHandlerFunc func(GetServicesHaproxyRuntimeAclsIDParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServicesHaproxyRuntimeAclsIDHandlerFunc) Handle(params GetServicesHaproxyRuntimeAclsIDParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServicesHaproxyRuntimeAclsIDHandler interface for that can handle valid get services haproxy runtime acls ID params -type GetServicesHaproxyRuntimeAclsIDHandler interface { - Handle(GetServicesHaproxyRuntimeAclsIDParams, interface{}) middleware.Responder -} - -// NewGetServicesHaproxyRuntimeAclsID creates a new http.Handler for the get services haproxy runtime acls ID operation -func NewGetServicesHaproxyRuntimeAclsID(ctx *middleware.Context, handler GetServicesHaproxyRuntimeAclsIDHandler) *GetServicesHaproxyRuntimeAclsID { - return &GetServicesHaproxyRuntimeAclsID{Context: ctx, Handler: handler} -} - -/* - GetServicesHaproxyRuntimeAclsID swagger:route GET /services/haproxy/runtime/acls/{id} ACL Runtime getServicesHaproxyRuntimeAclsId - -# Return an ACL file - -Returns an ACL file by id using the runtime socket. -*/ -type GetServicesHaproxyRuntimeAclsID struct { - Context *middleware.Context - Handler GetServicesHaproxyRuntimeAclsIDHandler -} - -func (o *GetServicesHaproxyRuntimeAclsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServicesHaproxyRuntimeAclsIDParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_parameters.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_id_parameters.go deleted file mode 100644 index e9dfc131..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServicesHaproxyRuntimeAclsIDParams creates a new GetServicesHaproxyRuntimeAclsIDParams object -// -// There are no default values defined in the spec. -func NewGetServicesHaproxyRuntimeAclsIDParams() GetServicesHaproxyRuntimeAclsIDParams { - - return GetServicesHaproxyRuntimeAclsIDParams{} -} - -// GetServicesHaproxyRuntimeAclsIDParams contains all the bound params for the get services haproxy runtime acls ID operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetServicesHaproxyRuntimeAclsID -type GetServicesHaproxyRuntimeAclsIDParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ACL file entry ID - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServicesHaproxyRuntimeAclsIDParams() beforehand. -func (o *GetServicesHaproxyRuntimeAclsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetServicesHaproxyRuntimeAclsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_responses.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_id_responses.go deleted file mode 100644 index f228d6cf..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServicesHaproxyRuntimeAclsIDOKCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsIDOK -const GetServicesHaproxyRuntimeAclsIDOKCode int = 200 - -/* -GetServicesHaproxyRuntimeAclsIDOK Successful operation - -swagger:response getServicesHaproxyRuntimeAclsIdOK -*/ -type GetServicesHaproxyRuntimeAclsIDOK struct { - - /* - In: Body - */ - Payload *models.ACLFile `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsIDOK creates GetServicesHaproxyRuntimeAclsIDOK with default headers values -func NewGetServicesHaproxyRuntimeAclsIDOK() *GetServicesHaproxyRuntimeAclsIDOK { - - return &GetServicesHaproxyRuntimeAclsIDOK{} -} - -// WithPayload adds the payload to the get services haproxy runtime acls Id o k response -func (o *GetServicesHaproxyRuntimeAclsIDOK) WithPayload(payload *models.ACLFile) *GetServicesHaproxyRuntimeAclsIDOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls Id o k response -func (o *GetServicesHaproxyRuntimeAclsIDOK) SetPayload(payload *models.ACLFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServicesHaproxyRuntimeAclsIDNotFoundCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsIDNotFound -const GetServicesHaproxyRuntimeAclsIDNotFoundCode int = 404 - -/* -GetServicesHaproxyRuntimeAclsIDNotFound The specified resource was not found - -swagger:response getServicesHaproxyRuntimeAclsIdNotFound -*/ -type GetServicesHaproxyRuntimeAclsIDNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsIDNotFound creates GetServicesHaproxyRuntimeAclsIDNotFound with default headers values -func NewGetServicesHaproxyRuntimeAclsIDNotFound() *GetServicesHaproxyRuntimeAclsIDNotFound { - - return &GetServicesHaproxyRuntimeAclsIDNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls Id not found response -func (o *GetServicesHaproxyRuntimeAclsIDNotFound) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsIDNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls Id not found response -func (o *GetServicesHaproxyRuntimeAclsIDNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls Id not found response -func (o *GetServicesHaproxyRuntimeAclsIDNotFound) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsIDNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls Id not found response -func (o *GetServicesHaproxyRuntimeAclsIDNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServicesHaproxyRuntimeAclsIDDefault General Error - -swagger:response getServicesHaproxyRuntimeAclsIdDefault -*/ -type GetServicesHaproxyRuntimeAclsIDDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsIDDefault creates GetServicesHaproxyRuntimeAclsIDDefault with default headers values -func NewGetServicesHaproxyRuntimeAclsIDDefault(code int) *GetServicesHaproxyRuntimeAclsIDDefault { - if code <= 0 { - code = 500 - } - - return &GetServicesHaproxyRuntimeAclsIDDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) WithStatusCode(code int) *GetServicesHaproxyRuntimeAclsIDDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsIDDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsIDDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls ID default response -func (o *GetServicesHaproxyRuntimeAclsIDDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_urlbuilder.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_id_urlbuilder.go deleted file mode 100644 index a9366eda..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_id_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServicesHaproxyRuntimeAclsIDURL generates an URL for the get services haproxy runtime acls ID operation -type GetServicesHaproxyRuntimeAclsIDURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsIDURL) WithBasePath(bp string) *GetServicesHaproxyRuntimeAclsIDURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsIDURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServicesHaproxyRuntimeAclsIDURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetServicesHaproxyRuntimeAclsIDURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServicesHaproxyRuntimeAclsIDURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServicesHaproxyRuntimeAclsIDURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServicesHaproxyRuntimeAclsIDURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServicesHaproxyRuntimeAclsIDURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServicesHaproxyRuntimeAclsIDURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServicesHaproxyRuntimeAclsIDURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parameters.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parameters.go deleted file mode 100644 index e86f8cc9..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetServicesHaproxyRuntimeAclsParams creates a new GetServicesHaproxyRuntimeAclsParams object -// -// There are no default values defined in the spec. -func NewGetServicesHaproxyRuntimeAclsParams() GetServicesHaproxyRuntimeAclsParams { - - return GetServicesHaproxyRuntimeAclsParams{} -} - -// GetServicesHaproxyRuntimeAclsParams contains all the bound params for the get services haproxy runtime acls operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetServicesHaproxyRuntimeAcls -type GetServicesHaproxyRuntimeAclsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServicesHaproxyRuntimeAclsParams() beforehand. -func (o *GetServicesHaproxyRuntimeAclsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries.go deleted file mode 100644 index e493bd92..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc turns a function with the right signature into a get services haproxy runtime acls parent name entries handler -type GetServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc func(GetServicesHaproxyRuntimeAclsParentNameEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc) Handle(params GetServicesHaproxyRuntimeAclsParentNameEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesHandler interface for that can handle valid get services haproxy runtime acls parent name entries params -type GetServicesHaproxyRuntimeAclsParentNameEntriesHandler interface { - Handle(GetServicesHaproxyRuntimeAclsParentNameEntriesParams, interface{}) middleware.Responder -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntries creates a new http.Handler for the get services haproxy runtime acls parent name entries operation -func NewGetServicesHaproxyRuntimeAclsParentNameEntries(ctx *middleware.Context, handler GetServicesHaproxyRuntimeAclsParentNameEntriesHandler) *GetServicesHaproxyRuntimeAclsParentNameEntries { - return &GetServicesHaproxyRuntimeAclsParentNameEntries{Context: ctx, Handler: handler} -} - -/* - GetServicesHaproxyRuntimeAclsParentNameEntries swagger:route GET /services/haproxy/runtime/acls/{parent_name}/entries ACL Runtime getServicesHaproxyRuntimeAclsParentNameEntries - -# Return an ACL entries - -Returns an ACL runtime setting using the runtime socket. -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntries struct { - Context *middleware.Context - Handler GetServicesHaproxyRuntimeAclsParentNameEntriesHandler -} - -func (o *GetServicesHaproxyRuntimeAclsParentNameEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServicesHaproxyRuntimeAclsParentNameEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id.go deleted file mode 100644 index fc8f393b..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc turns a function with the right signature into a get services haproxy runtime acls parent name entries ID handler -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc func(GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc) Handle(params GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler interface for that can handle valid get services haproxy runtime acls parent name entries ID params -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler interface { - Handle(GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams, interface{}) middleware.Responder -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesID creates a new http.Handler for the get services haproxy runtime acls parent name entries ID operation -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesID(ctx *middleware.Context, handler GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler) *GetServicesHaproxyRuntimeAclsParentNameEntriesID { - return &GetServicesHaproxyRuntimeAclsParentNameEntriesID{Context: ctx, Handler: handler} -} - -/* - GetServicesHaproxyRuntimeAclsParentNameEntriesID swagger:route GET /services/haproxy/runtime/acls/{parent_name}/entries/{id} ACL Runtime getServicesHaproxyRuntimeAclsParentNameEntriesId - -# Return an ACL entry - -Returns the ACL entry by its ID using the runtime socket. -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesID struct { - Context *middleware.Context - Handler GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler -} - -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesID) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go deleted file mode 100644 index d8e86e8e..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDParams creates a new GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams object -// -// There are no default values defined in the spec. -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDParams() GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams { - - return GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams{} -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams contains all the bound params for the get services haproxy runtime acls parent name entries ID operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetServicesHaproxyRuntimeAclsParentNameEntriesID -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*File entry ID - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDParams() beforehand. -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_responses.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_responses.go deleted file mode 100644 index 9ff92249..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDOKCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK -const GetServicesHaproxyRuntimeAclsParentNameEntriesIDOKCode int = 200 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK Successful operation - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesIdOK -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK struct { - - /* - In: Body - */ - Payload *models.ACLFileEntry `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDOK creates GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDOK() *GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK{} -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries Id o k response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK) WithPayload(payload *models.ACLFileEntry) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries Id o k response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK) SetPayload(payload *models.ACLFileEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequestCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest -const GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequestCode int = 400 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest Bad request - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesIdBadRequest -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest creates GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest() *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries Id bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries Id bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries Id bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries Id bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFoundCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound -const GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFoundCode int = 404 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound The specified resource was not found - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesIdNotFound -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound creates GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound() *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries Id not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries Id not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries Id not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries Id not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault General Error - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesIdDefault -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault creates GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault(code int) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - if code <= 0 { - code = 500 - } - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithStatusCode(code int) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries ID default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go deleted file mode 100644 index fbe19135..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_id_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL generates an URL for the get services haproxy runtime acls parent name entries ID operation -type GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL struct { - ID string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) WithBasePath(bp string) *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{parent_name}/entries/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesIDURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_parameters.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_parameters.go deleted file mode 100644 index db8ee71b..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesParams creates a new GetServicesHaproxyRuntimeAclsParentNameEntriesParams object -// -// There are no default values defined in the spec. -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesParams() GetServicesHaproxyRuntimeAclsParentNameEntriesParams { - - return GetServicesHaproxyRuntimeAclsParentNameEntriesParams{} -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesParams contains all the bound params for the get services haproxy runtime acls parent name entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetServicesHaproxyRuntimeAclsParentNameEntries -type GetServicesHaproxyRuntimeAclsParentNameEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServicesHaproxyRuntimeAclsParentNameEntriesParams() beforehand. -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_responses.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_responses.go deleted file mode 100644 index 67bfd627..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_responses.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesOKCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesOK -const GetServicesHaproxyRuntimeAclsParentNameEntriesOKCode int = 200 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesOK Successful operation - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesOK -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesOK struct { - - /* - In: Body - */ - Payload models.ACLFilesEntries `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesOK creates GetServicesHaproxyRuntimeAclsParentNameEntriesOK with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesOK() *GetServicesHaproxyRuntimeAclsParentNameEntriesOK { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesOK{} -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries o k response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesOK) WithPayload(payload models.ACLFilesEntries) *GetServicesHaproxyRuntimeAclsParentNameEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries o k response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesOK) SetPayload(payload models.ACLFilesEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ACLFilesEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequestCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest -const GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequestCode int = 400 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest Bad request - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesBadRequest -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest creates GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest() *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries bad request response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServicesHaproxyRuntimeAclsParentNameEntriesNotFoundCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound -const GetServicesHaproxyRuntimeAclsParentNameEntriesNotFoundCode int = 404 - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound The specified resource was not found - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesNotFound -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesNotFound creates GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesNotFound() *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound { - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries not found response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServicesHaproxyRuntimeAclsParentNameEntriesDefault General Error - -swagger:response getServicesHaproxyRuntimeAclsParentNameEntriesDefault -*/ -type GetServicesHaproxyRuntimeAclsParentNameEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsParentNameEntriesDefault creates GetServicesHaproxyRuntimeAclsParentNameEntriesDefault with default headers values -func NewGetServicesHaproxyRuntimeAclsParentNameEntriesDefault(code int) *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetServicesHaproxyRuntimeAclsParentNameEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithStatusCode(code int) *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls parent name entries default response -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go deleted file mode 100644 index 1e5d05be..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServicesHaproxyRuntimeAclsParentNameEntriesURL generates an URL for the get services haproxy runtime acls parent name entries operation -type GetServicesHaproxyRuntimeAclsParentNameEntriesURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) WithBasePath(bp string) *GetServicesHaproxyRuntimeAclsParentNameEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServicesHaproxyRuntimeAclsParentNameEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_responses.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_responses.go deleted file mode 100644 index 21a6f7fa..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServicesHaproxyRuntimeAclsOKCode is the HTTP code returned for type GetServicesHaproxyRuntimeAclsOK -const GetServicesHaproxyRuntimeAclsOKCode int = 200 - -/* -GetServicesHaproxyRuntimeAclsOK Successful operation - -swagger:response getServicesHaproxyRuntimeAclsOK -*/ -type GetServicesHaproxyRuntimeAclsOK struct { - - /* - In: Body - */ - Payload models.ACLFiles `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsOK creates GetServicesHaproxyRuntimeAclsOK with default headers values -func NewGetServicesHaproxyRuntimeAclsOK() *GetServicesHaproxyRuntimeAclsOK { - - return &GetServicesHaproxyRuntimeAclsOK{} -} - -// WithPayload adds the payload to the get services haproxy runtime acls o k response -func (o *GetServicesHaproxyRuntimeAclsOK) WithPayload(payload models.ACLFiles) *GetServicesHaproxyRuntimeAclsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls o k response -func (o *GetServicesHaproxyRuntimeAclsOK) SetPayload(payload models.ACLFiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ACLFiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetServicesHaproxyRuntimeAclsDefault General Error - -swagger:response getServicesHaproxyRuntimeAclsDefault -*/ -type GetServicesHaproxyRuntimeAclsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesHaproxyRuntimeAclsDefault creates GetServicesHaproxyRuntimeAclsDefault with default headers values -func NewGetServicesHaproxyRuntimeAclsDefault(code int) *GetServicesHaproxyRuntimeAclsDefault { - if code <= 0 { - code = 500 - } - - return &GetServicesHaproxyRuntimeAclsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) WithStatusCode(code int) *GetServicesHaproxyRuntimeAclsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) WithConfigurationVersion(configurationVersion string) *GetServicesHaproxyRuntimeAclsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) WithPayload(payload *models.Error) *GetServicesHaproxyRuntimeAclsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services haproxy runtime acls default response -func (o *GetServicesHaproxyRuntimeAclsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesHaproxyRuntimeAclsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/get_services_haproxy_runtime_acls_urlbuilder.go b/operations/acl_runtime/get_services_haproxy_runtime_acls_urlbuilder.go deleted file mode 100644 index 71e33e09..00000000 --- a/operations/acl_runtime/get_services_haproxy_runtime_acls_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetServicesHaproxyRuntimeAclsURL generates an URL for the get services haproxy runtime acls operation -type GetServicesHaproxyRuntimeAclsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsURL) WithBasePath(bp string) *GetServicesHaproxyRuntimeAclsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesHaproxyRuntimeAclsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServicesHaproxyRuntimeAclsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServicesHaproxyRuntimeAclsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServicesHaproxyRuntimeAclsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServicesHaproxyRuntimeAclsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServicesHaproxyRuntimeAclsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServicesHaproxyRuntimeAclsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServicesHaproxyRuntimeAclsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries.go b/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries.go deleted file mode 100644 index d330221d..00000000 --- a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// PostServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc turns a function with the right signature into a post services haproxy runtime acls parent name entries handler -type PostServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc func(PostServicesHaproxyRuntimeAclsParentNameEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn PostServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc) Handle(params PostServicesHaproxyRuntimeAclsParentNameEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// PostServicesHaproxyRuntimeAclsParentNameEntriesHandler interface for that can handle valid post services haproxy runtime acls parent name entries params -type PostServicesHaproxyRuntimeAclsParentNameEntriesHandler interface { - Handle(PostServicesHaproxyRuntimeAclsParentNameEntriesParams, interface{}) middleware.Responder -} - -// NewPostServicesHaproxyRuntimeAclsParentNameEntries creates a new http.Handler for the post services haproxy runtime acls parent name entries operation -func NewPostServicesHaproxyRuntimeAclsParentNameEntries(ctx *middleware.Context, handler PostServicesHaproxyRuntimeAclsParentNameEntriesHandler) *PostServicesHaproxyRuntimeAclsParentNameEntries { - return &PostServicesHaproxyRuntimeAclsParentNameEntries{Context: ctx, Handler: handler} -} - -/* - PostServicesHaproxyRuntimeAclsParentNameEntries swagger:route POST /services/haproxy/runtime/acls/{parent_name}/entries ACL Runtime postServicesHaproxyRuntimeAclsParentNameEntries - -# Add entry to an ACL file - -Adds an entry into the ACL file using the runtime socket. -*/ -type PostServicesHaproxyRuntimeAclsParentNameEntries struct { - Context *middleware.Context - Handler PostServicesHaproxyRuntimeAclsParentNameEntriesHandler -} - -func (o *PostServicesHaproxyRuntimeAclsParentNameEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPostServicesHaproxyRuntimeAclsParentNameEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_parameters.go b/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_parameters.go deleted file mode 100644 index ec3501af..00000000 --- a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_parameters.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewPostServicesHaproxyRuntimeAclsParentNameEntriesParams creates a new PostServicesHaproxyRuntimeAclsParentNameEntriesParams object -// -// There are no default values defined in the spec. -func NewPostServicesHaproxyRuntimeAclsParentNameEntriesParams() PostServicesHaproxyRuntimeAclsParentNameEntriesParams { - - return PostServicesHaproxyRuntimeAclsParentNameEntriesParams{} -} - -// PostServicesHaproxyRuntimeAclsParentNameEntriesParams contains all the bound params for the post services haproxy runtime acls parent name entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters PostServicesHaproxyRuntimeAclsParentNameEntries -type PostServicesHaproxyRuntimeAclsParentNameEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ACLFileEntry - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewPostServicesHaproxyRuntimeAclsParentNameEntriesParams() beforehand. -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ACLFileEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_responses.go b/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_responses.go deleted file mode 100644 index d8955a19..00000000 --- a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// PostServicesHaproxyRuntimeAclsParentNameEntriesCreatedCode is the HTTP code returned for type PostServicesHaproxyRuntimeAclsParentNameEntriesCreated -const PostServicesHaproxyRuntimeAclsParentNameEntriesCreatedCode int = 201 - -/* -PostServicesHaproxyRuntimeAclsParentNameEntriesCreated ACL entry created - -swagger:response postServicesHaproxyRuntimeAclsParentNameEntriesCreated -*/ -type PostServicesHaproxyRuntimeAclsParentNameEntriesCreated struct { - - /* - In: Body - */ - Payload *models.ACLFileEntry `json:"body,omitempty"` -} - -// NewPostServicesHaproxyRuntimeAclsParentNameEntriesCreated creates PostServicesHaproxyRuntimeAclsParentNameEntriesCreated with default headers values -func NewPostServicesHaproxyRuntimeAclsParentNameEntriesCreated() *PostServicesHaproxyRuntimeAclsParentNameEntriesCreated { - - return &PostServicesHaproxyRuntimeAclsParentNameEntriesCreated{} -} - -// WithPayload adds the payload to the post services haproxy runtime acls parent name entries created response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesCreated) WithPayload(payload *models.ACLFileEntry) *PostServicesHaproxyRuntimeAclsParentNameEntriesCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post services haproxy runtime acls parent name entries created response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesCreated) SetPayload(payload *models.ACLFileEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequestCode is the HTTP code returned for type PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest -const PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequestCode int = 400 - -/* -PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest Bad request - -swagger:response postServicesHaproxyRuntimeAclsParentNameEntriesBadRequest -*/ -type PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest creates PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest with default headers values -func NewPostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest() *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - - return &PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the post services haproxy runtime acls parent name entries bad request response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WithConfigurationVersion(configurationVersion string) *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post services haproxy runtime acls parent name entries bad request response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post services haproxy runtime acls parent name entries bad request response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WithPayload(payload *models.Error) *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post services haproxy runtime acls parent name entries bad request response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// PostServicesHaproxyRuntimeAclsParentNameEntriesConflictCode is the HTTP code returned for type PostServicesHaproxyRuntimeAclsParentNameEntriesConflict -const PostServicesHaproxyRuntimeAclsParentNameEntriesConflictCode int = 409 - -/* -PostServicesHaproxyRuntimeAclsParentNameEntriesConflict The specified resource already exists - -swagger:response postServicesHaproxyRuntimeAclsParentNameEntriesConflict -*/ -type PostServicesHaproxyRuntimeAclsParentNameEntriesConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostServicesHaproxyRuntimeAclsParentNameEntriesConflict creates PostServicesHaproxyRuntimeAclsParentNameEntriesConflict with default headers values -func NewPostServicesHaproxyRuntimeAclsParentNameEntriesConflict() *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict { - - return &PostServicesHaproxyRuntimeAclsParentNameEntriesConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the post services haproxy runtime acls parent name entries conflict response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict) WithConfigurationVersion(configurationVersion string) *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post services haproxy runtime acls parent name entries conflict response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post services haproxy runtime acls parent name entries conflict response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict) WithPayload(payload *models.Error) *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post services haproxy runtime acls parent name entries conflict response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -PostServicesHaproxyRuntimeAclsParentNameEntriesDefault General Error - -swagger:response postServicesHaproxyRuntimeAclsParentNameEntriesDefault -*/ -type PostServicesHaproxyRuntimeAclsParentNameEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostServicesHaproxyRuntimeAclsParentNameEntriesDefault creates PostServicesHaproxyRuntimeAclsParentNameEntriesDefault with default headers values -func NewPostServicesHaproxyRuntimeAclsParentNameEntriesDefault(code int) *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault { - if code <= 0 { - code = 500 - } - - return &PostServicesHaproxyRuntimeAclsParentNameEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithStatusCode(code int) *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithConfigurationVersion(configurationVersion string) *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) WithPayload(payload *models.Error) *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post services haproxy runtime acls parent name entries default response -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go b/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go deleted file mode 100644 index 2b3e46f9..00000000 --- a/operations/acl_runtime/post_services_haproxy_runtime_acls_parent_name_entries_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acl_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// PostServicesHaproxyRuntimeAclsParentNameEntriesURL generates an URL for the post services haproxy runtime acls parent name entries operation -type PostServicesHaproxyRuntimeAclsParentNameEntriesURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) WithBasePath(bp string) *PostServicesHaproxyRuntimeAclsParentNameEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acls/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on PostServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PostServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PostServicesHaproxyRuntimeAclsParentNameEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *PostServicesHaproxyRuntimeAclsParentNameEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme/create_acme_provider.go b/operations/acme/create_acme_provider.go deleted file mode 100644 index abfc2954..00000000 --- a/operations/acme/create_acme_provider.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateAcmeProviderHandlerFunc turns a function with the right signature into a create acme provider handler -type CreateAcmeProviderHandlerFunc func(CreateAcmeProviderParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateAcmeProviderHandlerFunc) Handle(params CreateAcmeProviderParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateAcmeProviderHandler interface for that can handle valid create acme provider params -type CreateAcmeProviderHandler interface { - Handle(CreateAcmeProviderParams, interface{}) middleware.Responder -} - -// NewCreateAcmeProvider creates a new http.Handler for the create acme provider operation -func NewCreateAcmeProvider(ctx *middleware.Context, handler CreateAcmeProviderHandler) *CreateAcmeProvider { - return &CreateAcmeProvider{Context: ctx, Handler: handler} -} - -/* - CreateAcmeProvider swagger:route POST /services/haproxy/configuration/acme Acme createAcmeProvider - -# Add a new Acme provider - -Creates a new acme section -*/ -type CreateAcmeProvider struct { - Context *middleware.Context - Handler CreateAcmeProviderHandler -} - -func (o *CreateAcmeProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateAcmeProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme/create_acme_provider_parameters.go b/operations/acme/create_acme_provider_parameters.go deleted file mode 100644 index 41a47b62..00000000 --- a/operations/acme/create_acme_provider_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateAcmeProviderParams creates a new CreateAcmeProviderParams object -// with the default values initialized. -func NewCreateAcmeProviderParams() CreateAcmeProviderParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateAcmeProviderParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateAcmeProviderParams contains all the bound params for the create acme provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAcmeProvider -type CreateAcmeProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.AcmeProvider - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateAcmeProviderParams() beforehand. -func (o *CreateAcmeProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.AcmeProvider - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateAcmeProviderParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateAcmeProviderParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateAcmeProviderParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateAcmeProviderParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acme/create_acme_provider_responses.go b/operations/acme/create_acme_provider_responses.go deleted file mode 100644 index ffd4395b..00000000 --- a/operations/acme/create_acme_provider_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateAcmeProviderCreatedCode is the HTTP code returned for type CreateAcmeProviderCreated -const CreateAcmeProviderCreatedCode int = 201 - -/* -CreateAcmeProviderCreated Log Profile created - -swagger:response createAcmeProviderCreated -*/ -type CreateAcmeProviderCreated struct { - - /* - In: Body - */ - Payload *models.AcmeProvider `json:"body,omitempty"` -} - -// NewCreateAcmeProviderCreated creates CreateAcmeProviderCreated with default headers values -func NewCreateAcmeProviderCreated() *CreateAcmeProviderCreated { - - return &CreateAcmeProviderCreated{} -} - -// WithPayload adds the payload to the create acme provider created response -func (o *CreateAcmeProviderCreated) WithPayload(payload *models.AcmeProvider) *CreateAcmeProviderCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create acme provider created response -func (o *CreateAcmeProviderCreated) SetPayload(payload *models.AcmeProvider) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAcmeProviderCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateAcmeProviderAcceptedCode is the HTTP code returned for type CreateAcmeProviderAccepted -const CreateAcmeProviderAcceptedCode int = 202 - -/* -CreateAcmeProviderAccepted Configuration change accepted and reload requested - -swagger:response createAcmeProviderAccepted -*/ -type CreateAcmeProviderAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.AcmeProvider `json:"body,omitempty"` -} - -// NewCreateAcmeProviderAccepted creates CreateAcmeProviderAccepted with default headers values -func NewCreateAcmeProviderAccepted() *CreateAcmeProviderAccepted { - - return &CreateAcmeProviderAccepted{} -} - -// WithReloadID adds the reloadId to the create acme provider accepted response -func (o *CreateAcmeProviderAccepted) WithReloadID(reloadID string) *CreateAcmeProviderAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create acme provider accepted response -func (o *CreateAcmeProviderAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create acme provider accepted response -func (o *CreateAcmeProviderAccepted) WithPayload(payload *models.AcmeProvider) *CreateAcmeProviderAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create acme provider accepted response -func (o *CreateAcmeProviderAccepted) SetPayload(payload *models.AcmeProvider) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAcmeProviderAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateAcmeProviderBadRequestCode is the HTTP code returned for type CreateAcmeProviderBadRequest -const CreateAcmeProviderBadRequestCode int = 400 - -/* -CreateAcmeProviderBadRequest Bad request - -swagger:response createAcmeProviderBadRequest -*/ -type CreateAcmeProviderBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAcmeProviderBadRequest creates CreateAcmeProviderBadRequest with default headers values -func NewCreateAcmeProviderBadRequest() *CreateAcmeProviderBadRequest { - - return &CreateAcmeProviderBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create acme provider bad request response -func (o *CreateAcmeProviderBadRequest) WithConfigurationVersion(configurationVersion string) *CreateAcmeProviderBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create acme provider bad request response -func (o *CreateAcmeProviderBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create acme provider bad request response -func (o *CreateAcmeProviderBadRequest) WithPayload(payload *models.Error) *CreateAcmeProviderBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create acme provider bad request response -func (o *CreateAcmeProviderBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAcmeProviderBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateAcmeProviderConflictCode is the HTTP code returned for type CreateAcmeProviderConflict -const CreateAcmeProviderConflictCode int = 409 - -/* -CreateAcmeProviderConflict The specified resource already exists - -swagger:response createAcmeProviderConflict -*/ -type CreateAcmeProviderConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAcmeProviderConflict creates CreateAcmeProviderConflict with default headers values -func NewCreateAcmeProviderConflict() *CreateAcmeProviderConflict { - - return &CreateAcmeProviderConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create acme provider conflict response -func (o *CreateAcmeProviderConflict) WithConfigurationVersion(configurationVersion string) *CreateAcmeProviderConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create acme provider conflict response -func (o *CreateAcmeProviderConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create acme provider conflict response -func (o *CreateAcmeProviderConflict) WithPayload(payload *models.Error) *CreateAcmeProviderConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create acme provider conflict response -func (o *CreateAcmeProviderConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAcmeProviderConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateAcmeProviderDefault General Error - -swagger:response createAcmeProviderDefault -*/ -type CreateAcmeProviderDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAcmeProviderDefault creates CreateAcmeProviderDefault with default headers values -func NewCreateAcmeProviderDefault(code int) *CreateAcmeProviderDefault { - if code <= 0 { - code = 500 - } - - return &CreateAcmeProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create acme provider default response -func (o *CreateAcmeProviderDefault) WithStatusCode(code int) *CreateAcmeProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create acme provider default response -func (o *CreateAcmeProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create acme provider default response -func (o *CreateAcmeProviderDefault) WithConfigurationVersion(configurationVersion string) *CreateAcmeProviderDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create acme provider default response -func (o *CreateAcmeProviderDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create acme provider default response -func (o *CreateAcmeProviderDefault) WithPayload(payload *models.Error) *CreateAcmeProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create acme provider default response -func (o *CreateAcmeProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAcmeProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme/create_acme_provider_urlbuilder.go b/operations/acme/create_acme_provider_urlbuilder.go deleted file mode 100644 index cca4d10b..00000000 --- a/operations/acme/create_acme_provider_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateAcmeProviderURL generates an URL for the create acme provider operation -type CreateAcmeProviderURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateAcmeProviderURL) WithBasePath(bp string) *CreateAcmeProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateAcmeProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateAcmeProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/acme" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateAcmeProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateAcmeProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateAcmeProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateAcmeProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateAcmeProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateAcmeProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme/delete_acme_provider.go b/operations/acme/delete_acme_provider.go deleted file mode 100644 index a49c2c48..00000000 --- a/operations/acme/delete_acme_provider.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteAcmeProviderHandlerFunc turns a function with the right signature into a delete acme provider handler -type DeleteAcmeProviderHandlerFunc func(DeleteAcmeProviderParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteAcmeProviderHandlerFunc) Handle(params DeleteAcmeProviderParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteAcmeProviderHandler interface for that can handle valid delete acme provider params -type DeleteAcmeProviderHandler interface { - Handle(DeleteAcmeProviderParams, interface{}) middleware.Responder -} - -// NewDeleteAcmeProvider creates a new http.Handler for the delete acme provider operation -func NewDeleteAcmeProvider(ctx *middleware.Context, handler DeleteAcmeProviderHandler) *DeleteAcmeProvider { - return &DeleteAcmeProvider{Context: ctx, Handler: handler} -} - -/* - DeleteAcmeProvider swagger:route DELETE /services/haproxy/configuration/acme/{name} Acme deleteAcmeProvider - -# Delete an ACME provider - -Deletes an acme section from the configuration -*/ -type DeleteAcmeProvider struct { - Context *middleware.Context - Handler DeleteAcmeProviderHandler -} - -func (o *DeleteAcmeProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteAcmeProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme/delete_acme_provider_parameters.go b/operations/acme/delete_acme_provider_parameters.go deleted file mode 100644 index c8b6041d..00000000 --- a/operations/acme/delete_acme_provider_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteAcmeProviderParams creates a new DeleteAcmeProviderParams object -// with the default values initialized. -func NewDeleteAcmeProviderParams() DeleteAcmeProviderParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteAcmeProviderParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteAcmeProviderParams contains all the bound params for the delete acme provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAcmeProvider -type DeleteAcmeProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*acme section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteAcmeProviderParams() beforehand. -func (o *DeleteAcmeProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteAcmeProviderParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteAcmeProviderParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteAcmeProviderParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteAcmeProviderParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteAcmeProviderParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acme/delete_acme_provider_responses.go b/operations/acme/delete_acme_provider_responses.go deleted file mode 100644 index bdc6e894..00000000 --- a/operations/acme/delete_acme_provider_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteAcmeProviderAcceptedCode is the HTTP code returned for type DeleteAcmeProviderAccepted -const DeleteAcmeProviderAcceptedCode int = 202 - -/* -DeleteAcmeProviderAccepted Configuration change accepted and reload requested - -swagger:response deleteAcmeProviderAccepted -*/ -type DeleteAcmeProviderAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteAcmeProviderAccepted creates DeleteAcmeProviderAccepted with default headers values -func NewDeleteAcmeProviderAccepted() *DeleteAcmeProviderAccepted { - - return &DeleteAcmeProviderAccepted{} -} - -// WithReloadID adds the reloadId to the delete acme provider accepted response -func (o *DeleteAcmeProviderAccepted) WithReloadID(reloadID string) *DeleteAcmeProviderAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete acme provider accepted response -func (o *DeleteAcmeProviderAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteAcmeProviderAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteAcmeProviderNoContentCode is the HTTP code returned for type DeleteAcmeProviderNoContent -const DeleteAcmeProviderNoContentCode int = 204 - -/* -DeleteAcmeProviderNoContent acme provider deleted - -swagger:response deleteAcmeProviderNoContent -*/ -type DeleteAcmeProviderNoContent struct { -} - -// NewDeleteAcmeProviderNoContent creates DeleteAcmeProviderNoContent with default headers values -func NewDeleteAcmeProviderNoContent() *DeleteAcmeProviderNoContent { - - return &DeleteAcmeProviderNoContent{} -} - -// WriteResponse to the client -func (o *DeleteAcmeProviderNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteAcmeProviderNotFoundCode is the HTTP code returned for type DeleteAcmeProviderNotFound -const DeleteAcmeProviderNotFoundCode int = 404 - -/* -DeleteAcmeProviderNotFound The specified resource was not found - -swagger:response deleteAcmeProviderNotFound -*/ -type DeleteAcmeProviderNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteAcmeProviderNotFound creates DeleteAcmeProviderNotFound with default headers values -func NewDeleteAcmeProviderNotFound() *DeleteAcmeProviderNotFound { - - return &DeleteAcmeProviderNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete acme provider not found response -func (o *DeleteAcmeProviderNotFound) WithConfigurationVersion(configurationVersion string) *DeleteAcmeProviderNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete acme provider not found response -func (o *DeleteAcmeProviderNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete acme provider not found response -func (o *DeleteAcmeProviderNotFound) WithPayload(payload *models.Error) *DeleteAcmeProviderNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete acme provider not found response -func (o *DeleteAcmeProviderNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAcmeProviderNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteAcmeProviderDefault General Error - -swagger:response deleteAcmeProviderDefault -*/ -type DeleteAcmeProviderDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteAcmeProviderDefault creates DeleteAcmeProviderDefault with default headers values -func NewDeleteAcmeProviderDefault(code int) *DeleteAcmeProviderDefault { - if code <= 0 { - code = 500 - } - - return &DeleteAcmeProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) WithStatusCode(code int) *DeleteAcmeProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) WithConfigurationVersion(configurationVersion string) *DeleteAcmeProviderDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) WithPayload(payload *models.Error) *DeleteAcmeProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete acme provider default response -func (o *DeleteAcmeProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAcmeProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme/delete_acme_provider_urlbuilder.go b/operations/acme/delete_acme_provider_urlbuilder.go deleted file mode 100644 index b046f052..00000000 --- a/operations/acme/delete_acme_provider_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteAcmeProviderURL generates an URL for the delete acme provider operation -type DeleteAcmeProviderURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteAcmeProviderURL) WithBasePath(bp string) *DeleteAcmeProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteAcmeProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteAcmeProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/acme/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteAcmeProviderURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteAcmeProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteAcmeProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteAcmeProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteAcmeProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteAcmeProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteAcmeProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme/edit_acme_provider.go b/operations/acme/edit_acme_provider.go deleted file mode 100644 index 95d9c6b6..00000000 --- a/operations/acme/edit_acme_provider.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// EditAcmeProviderHandlerFunc turns a function with the right signature into a edit acme provider handler -type EditAcmeProviderHandlerFunc func(EditAcmeProviderParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditAcmeProviderHandlerFunc) Handle(params EditAcmeProviderParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// EditAcmeProviderHandler interface for that can handle valid edit acme provider params -type EditAcmeProviderHandler interface { - Handle(EditAcmeProviderParams, interface{}) middleware.Responder -} - -// NewEditAcmeProvider creates a new http.Handler for the edit acme provider operation -func NewEditAcmeProvider(ctx *middleware.Context, handler EditAcmeProviderHandler) *EditAcmeProvider { - return &EditAcmeProvider{Context: ctx, Handler: handler} -} - -/* - EditAcmeProvider swagger:route PUT /services/haproxy/configuration/acme/{name} Acme editAcmeProvider - -# Modify an ACME provider - -Modifies a acme_provider's configuration by its name -*/ -type EditAcmeProvider struct { - Context *middleware.Context - Handler EditAcmeProviderHandler -} - -func (o *EditAcmeProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditAcmeProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme/edit_acme_provider_parameters.go b/operations/acme/edit_acme_provider_parameters.go deleted file mode 100644 index cda306ba..00000000 --- a/operations/acme/edit_acme_provider_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewEditAcmeProviderParams creates a new EditAcmeProviderParams object -// with the default values initialized. -func NewEditAcmeProviderParams() EditAcmeProviderParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return EditAcmeProviderParams{ - ForceReload: &forceReloadDefault, - } -} - -// EditAcmeProviderParams contains all the bound params for the edit acme provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters editAcmeProvider -type EditAcmeProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.AcmeProvider - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*acme section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEditAcmeProviderParams() beforehand. -func (o *EditAcmeProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.AcmeProvider - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *EditAcmeProviderParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewEditAcmeProviderParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *EditAcmeProviderParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *EditAcmeProviderParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *EditAcmeProviderParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/acme/edit_acme_provider_responses.go b/operations/acme/edit_acme_provider_responses.go deleted file mode 100644 index a01bd930..00000000 --- a/operations/acme/edit_acme_provider_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// EditAcmeProviderOKCode is the HTTP code returned for type EditAcmeProviderOK -const EditAcmeProviderOKCode int = 200 - -/* -EditAcmeProviderOK acme_provider configuration updated - -swagger:response editAcmeProviderOK -*/ -type EditAcmeProviderOK struct { - - /* - In: Body - */ - Payload *models.AcmeProvider `json:"body,omitempty"` -} - -// NewEditAcmeProviderOK creates EditAcmeProviderOK with default headers values -func NewEditAcmeProviderOK() *EditAcmeProviderOK { - - return &EditAcmeProviderOK{} -} - -// WithPayload adds the payload to the edit acme provider o k response -func (o *EditAcmeProviderOK) WithPayload(payload *models.AcmeProvider) *EditAcmeProviderOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit acme provider o k response -func (o *EditAcmeProviderOK) SetPayload(payload *models.AcmeProvider) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditAcmeProviderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditAcmeProviderAcceptedCode is the HTTP code returned for type EditAcmeProviderAccepted -const EditAcmeProviderAcceptedCode int = 202 - -/* -EditAcmeProviderAccepted Configuration change accepted and reload requested - -swagger:response editAcmeProviderAccepted -*/ -type EditAcmeProviderAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.AcmeProvider `json:"body,omitempty"` -} - -// NewEditAcmeProviderAccepted creates EditAcmeProviderAccepted with default headers values -func NewEditAcmeProviderAccepted() *EditAcmeProviderAccepted { - - return &EditAcmeProviderAccepted{} -} - -// WithReloadID adds the reloadId to the edit acme provider accepted response -func (o *EditAcmeProviderAccepted) WithReloadID(reloadID string) *EditAcmeProviderAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the edit acme provider accepted response -func (o *EditAcmeProviderAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the edit acme provider accepted response -func (o *EditAcmeProviderAccepted) WithPayload(payload *models.AcmeProvider) *EditAcmeProviderAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit acme provider accepted response -func (o *EditAcmeProviderAccepted) SetPayload(payload *models.AcmeProvider) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditAcmeProviderAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditAcmeProviderBadRequestCode is the HTTP code returned for type EditAcmeProviderBadRequest -const EditAcmeProviderBadRequestCode int = 400 - -/* -EditAcmeProviderBadRequest Bad request - -swagger:response editAcmeProviderBadRequest -*/ -type EditAcmeProviderBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditAcmeProviderBadRequest creates EditAcmeProviderBadRequest with default headers values -func NewEditAcmeProviderBadRequest() *EditAcmeProviderBadRequest { - - return &EditAcmeProviderBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit acme provider bad request response -func (o *EditAcmeProviderBadRequest) WithConfigurationVersion(configurationVersion string) *EditAcmeProviderBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit acme provider bad request response -func (o *EditAcmeProviderBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit acme provider bad request response -func (o *EditAcmeProviderBadRequest) WithPayload(payload *models.Error) *EditAcmeProviderBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit acme provider bad request response -func (o *EditAcmeProviderBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditAcmeProviderBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditAcmeProviderNotFoundCode is the HTTP code returned for type EditAcmeProviderNotFound -const EditAcmeProviderNotFoundCode int = 404 - -/* -EditAcmeProviderNotFound The specified resource was not found - -swagger:response editAcmeProviderNotFound -*/ -type EditAcmeProviderNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditAcmeProviderNotFound creates EditAcmeProviderNotFound with default headers values -func NewEditAcmeProviderNotFound() *EditAcmeProviderNotFound { - - return &EditAcmeProviderNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit acme provider not found response -func (o *EditAcmeProviderNotFound) WithConfigurationVersion(configurationVersion string) *EditAcmeProviderNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit acme provider not found response -func (o *EditAcmeProviderNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit acme provider not found response -func (o *EditAcmeProviderNotFound) WithPayload(payload *models.Error) *EditAcmeProviderNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit acme provider not found response -func (o *EditAcmeProviderNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditAcmeProviderNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -EditAcmeProviderDefault General Error - -swagger:response editAcmeProviderDefault -*/ -type EditAcmeProviderDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditAcmeProviderDefault creates EditAcmeProviderDefault with default headers values -func NewEditAcmeProviderDefault(code int) *EditAcmeProviderDefault { - if code <= 0 { - code = 500 - } - - return &EditAcmeProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit acme provider default response -func (o *EditAcmeProviderDefault) WithStatusCode(code int) *EditAcmeProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit acme provider default response -func (o *EditAcmeProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the edit acme provider default response -func (o *EditAcmeProviderDefault) WithConfigurationVersion(configurationVersion string) *EditAcmeProviderDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit acme provider default response -func (o *EditAcmeProviderDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit acme provider default response -func (o *EditAcmeProviderDefault) WithPayload(payload *models.Error) *EditAcmeProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit acme provider default response -func (o *EditAcmeProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditAcmeProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme/edit_acme_provider_urlbuilder.go b/operations/acme/edit_acme_provider_urlbuilder.go deleted file mode 100644 index 2744d6ab..00000000 --- a/operations/acme/edit_acme_provider_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// EditAcmeProviderURL generates an URL for the edit acme provider operation -type EditAcmeProviderURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditAcmeProviderURL) WithBasePath(bp string) *EditAcmeProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditAcmeProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditAcmeProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/acme/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on EditAcmeProviderURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EditAcmeProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EditAcmeProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditAcmeProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditAcmeProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditAcmeProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EditAcmeProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme/get_acme_provider.go b/operations/acme/get_acme_provider.go deleted file mode 100644 index e4f90e66..00000000 --- a/operations/acme/get_acme_provider.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAcmeProviderHandlerFunc turns a function with the right signature into a get acme provider handler -type GetAcmeProviderHandlerFunc func(GetAcmeProviderParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAcmeProviderHandlerFunc) Handle(params GetAcmeProviderParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAcmeProviderHandler interface for that can handle valid get acme provider params -type GetAcmeProviderHandler interface { - Handle(GetAcmeProviderParams, interface{}) middleware.Responder -} - -// NewGetAcmeProvider creates a new http.Handler for the get acme provider operation -func NewGetAcmeProvider(ctx *middleware.Context, handler GetAcmeProviderHandler) *GetAcmeProvider { - return &GetAcmeProvider{Context: ctx, Handler: handler} -} - -/* - GetAcmeProvider swagger:route GET /services/haproxy/configuration/acme/{name} Acme getAcmeProvider - -# Find an ACME provider - -Find an acme section by its name -*/ -type GetAcmeProvider struct { - Context *middleware.Context - Handler GetAcmeProviderHandler -} - -func (o *GetAcmeProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAcmeProviderParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme/get_acme_provider_parameters.go b/operations/acme/get_acme_provider_parameters.go deleted file mode 100644 index 2f5548e9..00000000 --- a/operations/acme/get_acme_provider_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAcmeProviderParams creates a new GetAcmeProviderParams object -// -// There are no default values defined in the spec. -func NewGetAcmeProviderParams() GetAcmeProviderParams { - - return GetAcmeProviderParams{} -} - -// GetAcmeProviderParams contains all the bound params for the get acme provider operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAcmeProvider -type GetAcmeProviderParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*acme section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAcmeProviderParams() beforehand. -func (o *GetAcmeProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetAcmeProviderParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAcmeProviderParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acme/get_acme_provider_responses.go b/operations/acme/get_acme_provider_responses.go deleted file mode 100644 index db80566c..00000000 --- a/operations/acme/get_acme_provider_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAcmeProviderOKCode is the HTTP code returned for type GetAcmeProviderOK -const GetAcmeProviderOKCode int = 200 - -/* -GetAcmeProviderOK Successful operation - -swagger:response getAcmeProviderOK -*/ -type GetAcmeProviderOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.AcmeProvider `json:"body,omitempty"` -} - -// NewGetAcmeProviderOK creates GetAcmeProviderOK with default headers values -func NewGetAcmeProviderOK() *GetAcmeProviderOK { - - return &GetAcmeProviderOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get acme provider o k response -func (o *GetAcmeProviderOK) WithConfigurationVersion(configurationVersion string) *GetAcmeProviderOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme provider o k response -func (o *GetAcmeProviderOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme provider o k response -func (o *GetAcmeProviderOK) WithPayload(payload *models.AcmeProvider) *GetAcmeProviderOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme provider o k response -func (o *GetAcmeProviderOK) SetPayload(payload *models.AcmeProvider) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeProviderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetAcmeProviderNotFoundCode is the HTTP code returned for type GetAcmeProviderNotFound -const GetAcmeProviderNotFoundCode int = 404 - -/* -GetAcmeProviderNotFound The specified resource was not found - -swagger:response getAcmeProviderNotFound -*/ -type GetAcmeProviderNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAcmeProviderNotFound creates GetAcmeProviderNotFound with default headers values -func NewGetAcmeProviderNotFound() *GetAcmeProviderNotFound { - - return &GetAcmeProviderNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get acme provider not found response -func (o *GetAcmeProviderNotFound) WithConfigurationVersion(configurationVersion string) *GetAcmeProviderNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme provider not found response -func (o *GetAcmeProviderNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme provider not found response -func (o *GetAcmeProviderNotFound) WithPayload(payload *models.Error) *GetAcmeProviderNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme provider not found response -func (o *GetAcmeProviderNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeProviderNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAcmeProviderDefault General Error - -swagger:response getAcmeProviderDefault -*/ -type GetAcmeProviderDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAcmeProviderDefault creates GetAcmeProviderDefault with default headers values -func NewGetAcmeProviderDefault(code int) *GetAcmeProviderDefault { - if code <= 0 { - code = 500 - } - - return &GetAcmeProviderDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get acme provider default response -func (o *GetAcmeProviderDefault) WithStatusCode(code int) *GetAcmeProviderDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get acme provider default response -func (o *GetAcmeProviderDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get acme provider default response -func (o *GetAcmeProviderDefault) WithConfigurationVersion(configurationVersion string) *GetAcmeProviderDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme provider default response -func (o *GetAcmeProviderDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme provider default response -func (o *GetAcmeProviderDefault) WithPayload(payload *models.Error) *GetAcmeProviderDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme provider default response -func (o *GetAcmeProviderDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme/get_acme_provider_urlbuilder.go b/operations/acme/get_acme_provider_urlbuilder.go deleted file mode 100644 index d3d07bff..00000000 --- a/operations/acme/get_acme_provider_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAcmeProviderURL generates an URL for the get acme provider operation -type GetAcmeProviderURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeProviderURL) WithBasePath(bp string) *GetAcmeProviderURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeProviderURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAcmeProviderURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/acme/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetAcmeProviderURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAcmeProviderURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAcmeProviderURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAcmeProviderURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAcmeProviderURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAcmeProviderURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAcmeProviderURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme/get_acme_providers.go b/operations/acme/get_acme_providers.go deleted file mode 100644 index 3efa1e30..00000000 --- a/operations/acme/get_acme_providers.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAcmeProvidersHandlerFunc turns a function with the right signature into a get acme providers handler -type GetAcmeProvidersHandlerFunc func(GetAcmeProvidersParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAcmeProvidersHandlerFunc) Handle(params GetAcmeProvidersParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAcmeProvidersHandler interface for that can handle valid get acme providers params -type GetAcmeProvidersHandler interface { - Handle(GetAcmeProvidersParams, interface{}) middleware.Responder -} - -// NewGetAcmeProviders creates a new http.Handler for the get acme providers operation -func NewGetAcmeProviders(ctx *middleware.Context, handler GetAcmeProvidersHandler) *GetAcmeProviders { - return &GetAcmeProviders{Context: ctx, Handler: handler} -} - -/* - GetAcmeProviders swagger:route GET /services/haproxy/configuration/acme Acme getAcmeProviders - -# Return all the ACME providers - -Returns an array of all the configured ACME providers -*/ -type GetAcmeProviders struct { - Context *middleware.Context - Handler GetAcmeProvidersHandler -} - -func (o *GetAcmeProviders) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAcmeProvidersParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme/get_acme_providers_parameters.go b/operations/acme/get_acme_providers_parameters.go deleted file mode 100644 index 88b45317..00000000 --- a/operations/acme/get_acme_providers_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAcmeProvidersParams creates a new GetAcmeProvidersParams object -// -// There are no default values defined in the spec. -func NewGetAcmeProvidersParams() GetAcmeProvidersParams { - - return GetAcmeProvidersParams{} -} - -// GetAcmeProvidersParams contains all the bound params for the get acme providers operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAcmeProviders -type GetAcmeProvidersParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAcmeProvidersParams() beforehand. -func (o *GetAcmeProvidersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAcmeProvidersParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/acme/get_acme_providers_responses.go b/operations/acme/get_acme_providers_responses.go deleted file mode 100644 index d844b61b..00000000 --- a/operations/acme/get_acme_providers_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAcmeProvidersOKCode is the HTTP code returned for type GetAcmeProvidersOK -const GetAcmeProvidersOKCode int = 200 - -/* -GetAcmeProvidersOK Successful operation - -swagger:response getAcmeProvidersOK -*/ -type GetAcmeProvidersOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.AcmeProviders `json:"body,omitempty"` -} - -// NewGetAcmeProvidersOK creates GetAcmeProvidersOK with default headers values -func NewGetAcmeProvidersOK() *GetAcmeProvidersOK { - - return &GetAcmeProvidersOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get acme providers o k response -func (o *GetAcmeProvidersOK) WithConfigurationVersion(configurationVersion string) *GetAcmeProvidersOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme providers o k response -func (o *GetAcmeProvidersOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme providers o k response -func (o *GetAcmeProvidersOK) WithPayload(payload models.AcmeProviders) *GetAcmeProvidersOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme providers o k response -func (o *GetAcmeProvidersOK) SetPayload(payload models.AcmeProviders) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeProvidersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.AcmeProviders{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAcmeProvidersDefault General Error - -swagger:response getAcmeProvidersDefault -*/ -type GetAcmeProvidersDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAcmeProvidersDefault creates GetAcmeProvidersDefault with default headers values -func NewGetAcmeProvidersDefault(code int) *GetAcmeProvidersDefault { - if code <= 0 { - code = 500 - } - - return &GetAcmeProvidersDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get acme providers default response -func (o *GetAcmeProvidersDefault) WithStatusCode(code int) *GetAcmeProvidersDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get acme providers default response -func (o *GetAcmeProvidersDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get acme providers default response -func (o *GetAcmeProvidersDefault) WithConfigurationVersion(configurationVersion string) *GetAcmeProvidersDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme providers default response -func (o *GetAcmeProvidersDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme providers default response -func (o *GetAcmeProvidersDefault) WithPayload(payload *models.Error) *GetAcmeProvidersDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme providers default response -func (o *GetAcmeProvidersDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeProvidersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme/get_acme_providers_urlbuilder.go b/operations/acme/get_acme_providers_urlbuilder.go deleted file mode 100644 index e8835c11..00000000 --- a/operations/acme/get_acme_providers_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAcmeProvidersURL generates an URL for the get acme providers operation -type GetAcmeProvidersURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeProvidersURL) WithBasePath(bp string) *GetAcmeProvidersURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeProvidersURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAcmeProvidersURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/acme" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAcmeProvidersURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAcmeProvidersURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAcmeProvidersURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAcmeProvidersURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAcmeProvidersURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAcmeProvidersURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme_runtime/get_acme_status.go b/operations/acme_runtime/get_acme_status.go deleted file mode 100644 index ce81bba2..00000000 --- a/operations/acme_runtime/get_acme_status.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAcmeStatusHandlerFunc turns a function with the right signature into a get acme status handler -type GetAcmeStatusHandlerFunc func(GetAcmeStatusParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAcmeStatusHandlerFunc) Handle(params GetAcmeStatusParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAcmeStatusHandler interface for that can handle valid get acme status params -type GetAcmeStatusHandler interface { - Handle(GetAcmeStatusParams, interface{}) middleware.Responder -} - -// NewGetAcmeStatus creates a new http.Handler for the get acme status operation -func NewGetAcmeStatus(ctx *middleware.Context, handler GetAcmeStatusHandler) *GetAcmeStatus { - return &GetAcmeStatus{Context: ctx, Handler: handler} -} - -/* - GetAcmeStatus swagger:route GET /services/haproxy/runtime/acme AcmeRuntime getAcmeStatus - -# ACME Status - -Returns the status of each managed ACME certificate. -*/ -type GetAcmeStatus struct { - Context *middleware.Context - Handler GetAcmeStatusHandler -} - -func (o *GetAcmeStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAcmeStatusParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme_runtime/get_acme_status_parameters.go b/operations/acme_runtime/get_acme_status_parameters.go deleted file mode 100644 index 1ba7da24..00000000 --- a/operations/acme_runtime/get_acme_status_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAcmeStatusParams creates a new GetAcmeStatusParams object -// -// There are no default values defined in the spec. -func NewGetAcmeStatusParams() GetAcmeStatusParams { - - return GetAcmeStatusParams{} -} - -// GetAcmeStatusParams contains all the bound params for the get acme status operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAcmeStatus -type GetAcmeStatusParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAcmeStatusParams() beforehand. -func (o *GetAcmeStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/acme_runtime/get_acme_status_responses.go b/operations/acme_runtime/get_acme_status_responses.go deleted file mode 100644 index b574dcab..00000000 --- a/operations/acme_runtime/get_acme_status_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAcmeStatusOKCode is the HTTP code returned for type GetAcmeStatusOK -const GetAcmeStatusOKCode int = 200 - -/* -GetAcmeStatusOK Successful operation - -swagger:response getAcmeStatusOK -*/ -type GetAcmeStatusOK struct { - - /* - In: Body - */ - Payload models.AcmeStatus `json:"body,omitempty"` -} - -// NewGetAcmeStatusOK creates GetAcmeStatusOK with default headers values -func NewGetAcmeStatusOK() *GetAcmeStatusOK { - - return &GetAcmeStatusOK{} -} - -// WithPayload adds the payload to the get acme status o k response -func (o *GetAcmeStatusOK) WithPayload(payload models.AcmeStatus) *GetAcmeStatusOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme status o k response -func (o *GetAcmeStatusOK) SetPayload(payload models.AcmeStatus) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.AcmeStatus{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAcmeStatusNotFoundCode is the HTTP code returned for type GetAcmeStatusNotFound -const GetAcmeStatusNotFoundCode int = 404 - -/* -GetAcmeStatusNotFound The specified resource was not found - -swagger:response getAcmeStatusNotFound -*/ -type GetAcmeStatusNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAcmeStatusNotFound creates GetAcmeStatusNotFound with default headers values -func NewGetAcmeStatusNotFound() *GetAcmeStatusNotFound { - - return &GetAcmeStatusNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get acme status not found response -func (o *GetAcmeStatusNotFound) WithConfigurationVersion(configurationVersion string) *GetAcmeStatusNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme status not found response -func (o *GetAcmeStatusNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme status not found response -func (o *GetAcmeStatusNotFound) WithPayload(payload *models.Error) *GetAcmeStatusNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme status not found response -func (o *GetAcmeStatusNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeStatusNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAcmeStatusDefault General Error - -swagger:response getAcmeStatusDefault -*/ -type GetAcmeStatusDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAcmeStatusDefault creates GetAcmeStatusDefault with default headers values -func NewGetAcmeStatusDefault(code int) *GetAcmeStatusDefault { - if code <= 0 { - code = 500 - } - - return &GetAcmeStatusDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get acme status default response -func (o *GetAcmeStatusDefault) WithStatusCode(code int) *GetAcmeStatusDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get acme status default response -func (o *GetAcmeStatusDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get acme status default response -func (o *GetAcmeStatusDefault) WithConfigurationVersion(configurationVersion string) *GetAcmeStatusDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get acme status default response -func (o *GetAcmeStatusDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get acme status default response -func (o *GetAcmeStatusDefault) WithPayload(payload *models.Error) *GetAcmeStatusDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get acme status default response -func (o *GetAcmeStatusDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAcmeStatusDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme_runtime/get_acme_status_urlbuilder.go b/operations/acme_runtime/get_acme_status_urlbuilder.go deleted file mode 100644 index e3612f41..00000000 --- a/operations/acme_runtime/get_acme_status_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAcmeStatusURL generates an URL for the get acme status operation -type GetAcmeStatusURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeStatusURL) WithBasePath(bp string) *GetAcmeStatusURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAcmeStatusURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAcmeStatusURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acme" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAcmeStatusURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAcmeStatusURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAcmeStatusURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAcmeStatusURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAcmeStatusURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAcmeStatusURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/acme_runtime/renew_acme_certificate.go b/operations/acme_runtime/renew_acme_certificate.go deleted file mode 100644 index 318ee2de..00000000 --- a/operations/acme_runtime/renew_acme_certificate.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// RenewAcmeCertificateHandlerFunc turns a function with the right signature into a renew acme certificate handler -type RenewAcmeCertificateHandlerFunc func(RenewAcmeCertificateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn RenewAcmeCertificateHandlerFunc) Handle(params RenewAcmeCertificateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// RenewAcmeCertificateHandler interface for that can handle valid renew acme certificate params -type RenewAcmeCertificateHandler interface { - Handle(RenewAcmeCertificateParams, interface{}) middleware.Responder -} - -// NewRenewAcmeCertificate creates a new http.Handler for the renew acme certificate operation -func NewRenewAcmeCertificate(ctx *middleware.Context, handler RenewAcmeCertificateHandler) *RenewAcmeCertificate { - return &RenewAcmeCertificate{Context: ctx, Handler: handler} -} - -/* - RenewAcmeCertificate swagger:route PUT /services/haproxy/runtime/acme AcmeRuntime renewAcmeCertificate - -# Renew ACME certificate - -Force renewal of an ACME certificate. -*/ -type RenewAcmeCertificate struct { - Context *middleware.Context - Handler RenewAcmeCertificateHandler -} - -func (o *RenewAcmeCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRenewAcmeCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/acme_runtime/renew_acme_certificate_parameters.go b/operations/acme_runtime/renew_acme_certificate_parameters.go deleted file mode 100644 index 7502ab8f..00000000 --- a/operations/acme_runtime/renew_acme_certificate_parameters.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewRenewAcmeCertificateParams creates a new RenewAcmeCertificateParams object -// -// There are no default values defined in the spec. -func NewRenewAcmeCertificateParams() RenewAcmeCertificateParams { - - return RenewAcmeCertificateParams{} -} - -// RenewAcmeCertificateParams contains all the bound params for the renew acme certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters renewAcmeCertificate -type RenewAcmeCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate file name - Required: true - In: query - */ - Certificate string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewRenewAcmeCertificateParams() beforehand. -func (o *RenewAcmeCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCertificate, qhkCertificate, _ := qs.GetOK("certificate") - if err := o.bindCertificate(qCertificate, qhkCertificate, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertificate binds and validates parameter Certificate from query. -func (o *RenewAcmeCertificateParams) bindCertificate(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("certificate", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("certificate", "query", raw); err != nil { - return err - } - o.Certificate = raw - - return nil -} diff --git a/operations/acme_runtime/renew_acme_certificate_responses.go b/operations/acme_runtime/renew_acme_certificate_responses.go deleted file mode 100644 index 9796125e..00000000 --- a/operations/acme_runtime/renew_acme_certificate_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// RenewAcmeCertificateOKCode is the HTTP code returned for type RenewAcmeCertificateOK -const RenewAcmeCertificateOKCode int = 200 - -/* -RenewAcmeCertificateOK Operation started - -swagger:response renewAcmeCertificateOK -*/ -type RenewAcmeCertificateOK struct { -} - -// NewRenewAcmeCertificateOK creates RenewAcmeCertificateOK with default headers values -func NewRenewAcmeCertificateOK() *RenewAcmeCertificateOK { - - return &RenewAcmeCertificateOK{} -} - -// WriteResponse to the client -func (o *RenewAcmeCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -// RenewAcmeCertificateNotFoundCode is the HTTP code returned for type RenewAcmeCertificateNotFound -const RenewAcmeCertificateNotFoundCode int = 404 - -/* -RenewAcmeCertificateNotFound The specified resource was not found - -swagger:response renewAcmeCertificateNotFound -*/ -type RenewAcmeCertificateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewRenewAcmeCertificateNotFound creates RenewAcmeCertificateNotFound with default headers values -func NewRenewAcmeCertificateNotFound() *RenewAcmeCertificateNotFound { - - return &RenewAcmeCertificateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the renew acme certificate not found response -func (o *RenewAcmeCertificateNotFound) WithConfigurationVersion(configurationVersion string) *RenewAcmeCertificateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the renew acme certificate not found response -func (o *RenewAcmeCertificateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the renew acme certificate not found response -func (o *RenewAcmeCertificateNotFound) WithPayload(payload *models.Error) *RenewAcmeCertificateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the renew acme certificate not found response -func (o *RenewAcmeCertificateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RenewAcmeCertificateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -RenewAcmeCertificateDefault General Error - -swagger:response renewAcmeCertificateDefault -*/ -type RenewAcmeCertificateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewRenewAcmeCertificateDefault creates RenewAcmeCertificateDefault with default headers values -func NewRenewAcmeCertificateDefault(code int) *RenewAcmeCertificateDefault { - if code <= 0 { - code = 500 - } - - return &RenewAcmeCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) WithStatusCode(code int) *RenewAcmeCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) WithConfigurationVersion(configurationVersion string) *RenewAcmeCertificateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) WithPayload(payload *models.Error) *RenewAcmeCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the renew acme certificate default response -func (o *RenewAcmeCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RenewAcmeCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/acme_runtime/renew_acme_certificate_urlbuilder.go b/operations/acme_runtime/renew_acme_certificate_urlbuilder.go deleted file mode 100644 index 066aa985..00000000 --- a/operations/acme_runtime/renew_acme_certificate_urlbuilder.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package acme_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// RenewAcmeCertificateURL generates an URL for the renew acme certificate operation -type RenewAcmeCertificateURL struct { - Certificate string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *RenewAcmeCertificateURL) WithBasePath(bp string) *RenewAcmeCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *RenewAcmeCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RenewAcmeCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/acme" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - certificateQ := o.Certificate - if certificateQ != "" { - qs.Set("certificate", certificateQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *RenewAcmeCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *RenewAcmeCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RenewAcmeCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RenewAcmeCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RenewAcmeCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *RenewAcmeCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend/create_backend.go b/operations/backend/create_backend.go deleted file mode 100644 index 2079cfbd..00000000 --- a/operations/backend/create_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateBackendHandlerFunc turns a function with the right signature into a create backend handler -type CreateBackendHandlerFunc func(CreateBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBackendHandlerFunc) Handle(params CreateBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateBackendHandler interface for that can handle valid create backend params -type CreateBackendHandler interface { - Handle(CreateBackendParams, interface{}) middleware.Responder -} - -// NewCreateBackend creates a new http.Handler for the create backend operation -func NewCreateBackend(ctx *middleware.Context, handler CreateBackendHandler) *CreateBackend { - return &CreateBackend{Context: ctx, Handler: handler} -} - -/* - CreateBackend swagger:route POST /services/haproxy/configuration/backends Backend createBackend - -# Add a backend - -Adds a new backend to the configuration file. -*/ -type CreateBackend struct { - Context *middleware.Context - Handler CreateBackendHandler -} - -func (o *CreateBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend/create_backend_parameters.go b/operations/backend/create_backend_parameters.go deleted file mode 100644 index c6c88eb0..00000000 --- a/operations/backend/create_backend_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateBackendParams creates a new CreateBackendParams object -// with the default values initialized. -func NewCreateBackendParams() CreateBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateBackendParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateBackendParams contains all the bound params for the create backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createBackend -type CreateBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Backend - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateBackendParams() beforehand. -func (o *CreateBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Backend - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateBackendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend/create_backend_responses.go b/operations/backend/create_backend_responses.go deleted file mode 100644 index cb5bba2d..00000000 --- a/operations/backend/create_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateBackendCreatedCode is the HTTP code returned for type CreateBackendCreated -const CreateBackendCreatedCode int = 201 - -/* -CreateBackendCreated Backend created - -swagger:response createBackendCreated -*/ -type CreateBackendCreated struct { - - /* - In: Body - */ - Payload *models.Backend `json:"body,omitempty"` -} - -// NewCreateBackendCreated creates CreateBackendCreated with default headers values -func NewCreateBackendCreated() *CreateBackendCreated { - - return &CreateBackendCreated{} -} - -// WithPayload adds the payload to the create backend created response -func (o *CreateBackendCreated) WithPayload(payload *models.Backend) *CreateBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend created response -func (o *CreateBackendCreated) SetPayload(payload *models.Backend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendAcceptedCode is the HTTP code returned for type CreateBackendAccepted -const CreateBackendAcceptedCode int = 202 - -/* -CreateBackendAccepted Configuration change accepted and reload requested - -swagger:response createBackendAccepted -*/ -type CreateBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Backend `json:"body,omitempty"` -} - -// NewCreateBackendAccepted creates CreateBackendAccepted with default headers values -func NewCreateBackendAccepted() *CreateBackendAccepted { - - return &CreateBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create backend accepted response -func (o *CreateBackendAccepted) WithReloadID(reloadID string) *CreateBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create backend accepted response -func (o *CreateBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create backend accepted response -func (o *CreateBackendAccepted) WithPayload(payload *models.Backend) *CreateBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend accepted response -func (o *CreateBackendAccepted) SetPayload(payload *models.Backend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendBadRequestCode is the HTTP code returned for type CreateBackendBadRequest -const CreateBackendBadRequestCode int = 400 - -/* -CreateBackendBadRequest Bad request - -swagger:response createBackendBadRequest -*/ -type CreateBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendBadRequest creates CreateBackendBadRequest with default headers values -func NewCreateBackendBadRequest() *CreateBackendBadRequest { - - return &CreateBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create backend bad request response -func (o *CreateBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend bad request response -func (o *CreateBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend bad request response -func (o *CreateBackendBadRequest) WithPayload(payload *models.Error) *CreateBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend bad request response -func (o *CreateBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendConflictCode is the HTTP code returned for type CreateBackendConflict -const CreateBackendConflictCode int = 409 - -/* -CreateBackendConflict The specified resource already exists - -swagger:response createBackendConflict -*/ -type CreateBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendConflict creates CreateBackendConflict with default headers values -func NewCreateBackendConflict() *CreateBackendConflict { - - return &CreateBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create backend conflict response -func (o *CreateBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend conflict response -func (o *CreateBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend conflict response -func (o *CreateBackendConflict) WithPayload(payload *models.Error) *CreateBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend conflict response -func (o *CreateBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateBackendDefault General Error - -swagger:response createBackendDefault -*/ -type CreateBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendDefault creates CreateBackendDefault with default headers values -func NewCreateBackendDefault(code int) *CreateBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create backend default response -func (o *CreateBackendDefault) WithStatusCode(code int) *CreateBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create backend default response -func (o *CreateBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create backend default response -func (o *CreateBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend default response -func (o *CreateBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend default response -func (o *CreateBackendDefault) WithPayload(payload *models.Error) *CreateBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend default response -func (o *CreateBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend/create_backend_urlbuilder.go b/operations/backend/create_backend_urlbuilder.go deleted file mode 100644 index 19da06f0..00000000 --- a/operations/backend/create_backend_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateBackendURL generates an URL for the create backend operation -type CreateBackendURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBackendURL) WithBasePath(bp string) *CreateBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend/delete_backend.go b/operations/backend/delete_backend.go deleted file mode 100644 index 659304c2..00000000 --- a/operations/backend/delete_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteBackendHandlerFunc turns a function with the right signature into a delete backend handler -type DeleteBackendHandlerFunc func(DeleteBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBackendHandlerFunc) Handle(params DeleteBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteBackendHandler interface for that can handle valid delete backend params -type DeleteBackendHandler interface { - Handle(DeleteBackendParams, interface{}) middleware.Responder -} - -// NewDeleteBackend creates a new http.Handler for the delete backend operation -func NewDeleteBackend(ctx *middleware.Context, handler DeleteBackendHandler) *DeleteBackend { - return &DeleteBackend{Context: ctx, Handler: handler} -} - -/* - DeleteBackend swagger:route DELETE /services/haproxy/configuration/backends/{name} Backend deleteBackend - -# Delete a backend - -Deletes a backend from the configuration by it's name. -*/ -type DeleteBackend struct { - Context *middleware.Context - Handler DeleteBackendHandler -} - -func (o *DeleteBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend/delete_backend_parameters.go b/operations/backend/delete_backend_parameters.go deleted file mode 100644 index ceec14c8..00000000 --- a/operations/backend/delete_backend_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteBackendParams creates a new DeleteBackendParams object -// with the default values initialized. -func NewDeleteBackendParams() DeleteBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteBackendParams contains all the bound params for the delete backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteBackend -type DeleteBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Backend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteBackendParams() beforehand. -func (o *DeleteBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend/delete_backend_responses.go b/operations/backend/delete_backend_responses.go deleted file mode 100644 index b817aa42..00000000 --- a/operations/backend/delete_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteBackendAcceptedCode is the HTTP code returned for type DeleteBackendAccepted -const DeleteBackendAcceptedCode int = 202 - -/* -DeleteBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteBackendAccepted -*/ -type DeleteBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteBackendAccepted creates DeleteBackendAccepted with default headers values -func NewDeleteBackendAccepted() *DeleteBackendAccepted { - - return &DeleteBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete backend accepted response -func (o *DeleteBackendAccepted) WithReloadID(reloadID string) *DeleteBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete backend accepted response -func (o *DeleteBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteBackendNoContentCode is the HTTP code returned for type DeleteBackendNoContent -const DeleteBackendNoContentCode int = 204 - -/* -DeleteBackendNoContent Backend deleted - -swagger:response deleteBackendNoContent -*/ -type DeleteBackendNoContent struct { -} - -// NewDeleteBackendNoContent creates DeleteBackendNoContent with default headers values -func NewDeleteBackendNoContent() *DeleteBackendNoContent { - - return &DeleteBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteBackendNotFoundCode is the HTTP code returned for type DeleteBackendNotFound -const DeleteBackendNotFoundCode int = 404 - -/* -DeleteBackendNotFound The specified resource was not found - -swagger:response deleteBackendNotFound -*/ -type DeleteBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBackendNotFound creates DeleteBackendNotFound with default headers values -func NewDeleteBackendNotFound() *DeleteBackendNotFound { - - return &DeleteBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete backend not found response -func (o *DeleteBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete backend not found response -func (o *DeleteBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete backend not found response -func (o *DeleteBackendNotFound) WithPayload(payload *models.Error) *DeleteBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete backend not found response -func (o *DeleteBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteBackendDefault General Error - -swagger:response deleteBackendDefault -*/ -type DeleteBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBackendDefault creates DeleteBackendDefault with default headers values -func NewDeleteBackendDefault(code int) *DeleteBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete backend default response -func (o *DeleteBackendDefault) WithStatusCode(code int) *DeleteBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete backend default response -func (o *DeleteBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete backend default response -func (o *DeleteBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete backend default response -func (o *DeleteBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete backend default response -func (o *DeleteBackendDefault) WithPayload(payload *models.Error) *DeleteBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete backend default response -func (o *DeleteBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend/delete_backend_urlbuilder.go b/operations/backend/delete_backend_urlbuilder.go deleted file mode 100644 index 2765c360..00000000 --- a/operations/backend/delete_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteBackendURL generates an URL for the delete backend operation -type DeleteBackendURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBackendURL) WithBasePath(bp string) *DeleteBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend/get_backend.go b/operations/backend/get_backend.go deleted file mode 100644 index 4d056929..00000000 --- a/operations/backend/get_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBackendHandlerFunc turns a function with the right signature into a get backend handler -type GetBackendHandlerFunc func(GetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBackendHandlerFunc) Handle(params GetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBackendHandler interface for that can handle valid get backend params -type GetBackendHandler interface { - Handle(GetBackendParams, interface{}) middleware.Responder -} - -// NewGetBackend creates a new http.Handler for the get backend operation -func NewGetBackend(ctx *middleware.Context, handler GetBackendHandler) *GetBackend { - return &GetBackend{Context: ctx, Handler: handler} -} - -/* - GetBackend swagger:route GET /services/haproxy/configuration/backends/{name} Backend getBackend - -# Return a backend - -Returns one backend configuration by it's name. -*/ -type GetBackend struct { - Context *middleware.Context - Handler GetBackendHandler -} - -func (o *GetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend/get_backend_parameters.go b/operations/backend/get_backend_parameters.go deleted file mode 100644 index a213fd1d..00000000 --- a/operations/backend/get_backend_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetBackendParams creates a new GetBackendParams object -// with the default values initialized. -func NewGetBackendParams() GetBackendParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetBackendParams{ - FullSection: &fullSectionDefault, - } -} - -// GetBackendParams contains all the bound params for the get backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBackend -type GetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Backend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBackendParams() beforehand. -func (o *GetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetBackendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/backend/get_backend_responses.go b/operations/backend/get_backend_responses.go deleted file mode 100644 index 5357488b..00000000 --- a/operations/backend/get_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBackendOKCode is the HTTP code returned for type GetBackendOK -const GetBackendOKCode int = 200 - -/* -GetBackendOK Successful operation - -swagger:response getBackendOK -*/ -type GetBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Backend `json:"body,omitempty"` -} - -// NewGetBackendOK creates GetBackendOK with default headers values -func NewGetBackendOK() *GetBackendOK { - - return &GetBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backend o k response -func (o *GetBackendOK) WithConfigurationVersion(configurationVersion string) *GetBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend o k response -func (o *GetBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend o k response -func (o *GetBackendOK) WithPayload(payload *models.Backend) *GetBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend o k response -func (o *GetBackendOK) SetPayload(payload *models.Backend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetBackendNotFoundCode is the HTTP code returned for type GetBackendNotFound -const GetBackendNotFoundCode int = 404 - -/* -GetBackendNotFound The specified resource was not found - -swagger:response getBackendNotFound -*/ -type GetBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendNotFound creates GetBackendNotFound with default headers values -func NewGetBackendNotFound() *GetBackendNotFound { - - return &GetBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backend not found response -func (o *GetBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend not found response -func (o *GetBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend not found response -func (o *GetBackendNotFound) WithPayload(payload *models.Error) *GetBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend not found response -func (o *GetBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetBackendDefault General Error - -swagger:response getBackendDefault -*/ -type GetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendDefault creates GetBackendDefault with default headers values -func NewGetBackendDefault(code int) *GetBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get backend default response -func (o *GetBackendDefault) WithStatusCode(code int) *GetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get backend default response -func (o *GetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get backend default response -func (o *GetBackendDefault) WithConfigurationVersion(configurationVersion string) *GetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend default response -func (o *GetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend default response -func (o *GetBackendDefault) WithPayload(payload *models.Error) *GetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend default response -func (o *GetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend/get_backend_urlbuilder.go b/operations/backend/get_backend_urlbuilder.go deleted file mode 100644 index fde5203c..00000000 --- a/operations/backend/get_backend_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetBackendURL generates an URL for the get backend operation -type GetBackendURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendURL) WithBasePath(bp string) *GetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend/get_backends.go b/operations/backend/get_backends.go deleted file mode 100644 index 38532255..00000000 --- a/operations/backend/get_backends.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBackendsHandlerFunc turns a function with the right signature into a get backends handler -type GetBackendsHandlerFunc func(GetBackendsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBackendsHandlerFunc) Handle(params GetBackendsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBackendsHandler interface for that can handle valid get backends params -type GetBackendsHandler interface { - Handle(GetBackendsParams, interface{}) middleware.Responder -} - -// NewGetBackends creates a new http.Handler for the get backends operation -func NewGetBackends(ctx *middleware.Context, handler GetBackendsHandler) *GetBackends { - return &GetBackends{Context: ctx, Handler: handler} -} - -/* - GetBackends swagger:route GET /services/haproxy/configuration/backends Backend getBackends - -# Return an array of backends - -Returns an array of all configured backends. -*/ -type GetBackends struct { - Context *middleware.Context - Handler GetBackendsHandler -} - -func (o *GetBackends) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBackendsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend/get_backends_parameters.go b/operations/backend/get_backends_parameters.go deleted file mode 100644 index d1f0c0b5..00000000 --- a/operations/backend/get_backends_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetBackendsParams creates a new GetBackendsParams object -// with the default values initialized. -func NewGetBackendsParams() GetBackendsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetBackendsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetBackendsParams contains all the bound params for the get backends operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBackends -type GetBackendsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBackendsParams() beforehand. -func (o *GetBackendsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetBackendsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetBackendsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBackendsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/backend/get_backends_responses.go b/operations/backend/get_backends_responses.go deleted file mode 100644 index ffac299c..00000000 --- a/operations/backend/get_backends_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBackendsOKCode is the HTTP code returned for type GetBackendsOK -const GetBackendsOKCode int = 200 - -/* -GetBackendsOK Successful operation - -swagger:response getBackendsOK -*/ -type GetBackendsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Backends `json:"body,omitempty"` -} - -// NewGetBackendsOK creates GetBackendsOK with default headers values -func NewGetBackendsOK() *GetBackendsOK { - - return &GetBackendsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backends o k response -func (o *GetBackendsOK) WithConfigurationVersion(configurationVersion string) *GetBackendsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backends o k response -func (o *GetBackendsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backends o k response -func (o *GetBackendsOK) WithPayload(payload models.Backends) *GetBackendsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backends o k response -func (o *GetBackendsOK) SetPayload(payload models.Backends) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Backends{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetBackendsDefault General Error - -swagger:response getBackendsDefault -*/ -type GetBackendsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendsDefault creates GetBackendsDefault with default headers values -func NewGetBackendsDefault(code int) *GetBackendsDefault { - if code <= 0 { - code = 500 - } - - return &GetBackendsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get backends default response -func (o *GetBackendsDefault) WithStatusCode(code int) *GetBackendsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get backends default response -func (o *GetBackendsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get backends default response -func (o *GetBackendsDefault) WithConfigurationVersion(configurationVersion string) *GetBackendsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backends default response -func (o *GetBackendsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backends default response -func (o *GetBackendsDefault) WithPayload(payload *models.Error) *GetBackendsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backends default response -func (o *GetBackendsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend/get_backends_urlbuilder.go b/operations/backend/get_backends_urlbuilder.go deleted file mode 100644 index 437683ba..00000000 --- a/operations/backend/get_backends_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetBackendsURL generates an URL for the get backends operation -type GetBackendsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendsURL) WithBasePath(bp string) *GetBackendsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBackendsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBackendsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBackendsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBackendsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBackendsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBackendsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBackendsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend/replace_backend.go b/operations/backend/replace_backend.go deleted file mode 100644 index 40a06301..00000000 --- a/operations/backend/replace_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBackendHandlerFunc turns a function with the right signature into a replace backend handler -type ReplaceBackendHandlerFunc func(ReplaceBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBackendHandlerFunc) Handle(params ReplaceBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBackendHandler interface for that can handle valid replace backend params -type ReplaceBackendHandler interface { - Handle(ReplaceBackendParams, interface{}) middleware.Responder -} - -// NewReplaceBackend creates a new http.Handler for the replace backend operation -func NewReplaceBackend(ctx *middleware.Context, handler ReplaceBackendHandler) *ReplaceBackend { - return &ReplaceBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceBackend swagger:route PUT /services/haproxy/configuration/backends/{name} Backend replaceBackend - -# Replace a backend - -Replaces a backend configuration by it's name. -*/ -type ReplaceBackend struct { - Context *middleware.Context - Handler ReplaceBackendHandler -} - -func (o *ReplaceBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend/replace_backend_parameters.go b/operations/backend/replace_backend_parameters.go deleted file mode 100644 index fcaca396..00000000 --- a/operations/backend/replace_backend_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBackendParams creates a new ReplaceBackendParams object -// with the default values initialized. -func NewReplaceBackendParams() ReplaceBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceBackendParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceBackendParams contains all the bound params for the replace backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBackend -type ReplaceBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Backend - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Backend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBackendParams() beforehand. -func (o *ReplaceBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Backend - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceBackendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend/replace_backend_responses.go b/operations/backend/replace_backend_responses.go deleted file mode 100644 index 0758fc61..00000000 --- a/operations/backend/replace_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBackendOKCode is the HTTP code returned for type ReplaceBackendOK -const ReplaceBackendOKCode int = 200 - -/* -ReplaceBackendOK Backend replaced - -swagger:response replaceBackendOK -*/ -type ReplaceBackendOK struct { - - /* - In: Body - */ - Payload *models.Backend `json:"body,omitempty"` -} - -// NewReplaceBackendOK creates ReplaceBackendOK with default headers values -func NewReplaceBackendOK() *ReplaceBackendOK { - - return &ReplaceBackendOK{} -} - -// WithPayload adds the payload to the replace backend o k response -func (o *ReplaceBackendOK) WithPayload(payload *models.Backend) *ReplaceBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend o k response -func (o *ReplaceBackendOK) SetPayload(payload *models.Backend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendAcceptedCode is the HTTP code returned for type ReplaceBackendAccepted -const ReplaceBackendAcceptedCode int = 202 - -/* -ReplaceBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceBackendAccepted -*/ -type ReplaceBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Backend `json:"body,omitempty"` -} - -// NewReplaceBackendAccepted creates ReplaceBackendAccepted with default headers values -func NewReplaceBackendAccepted() *ReplaceBackendAccepted { - - return &ReplaceBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace backend accepted response -func (o *ReplaceBackendAccepted) WithReloadID(reloadID string) *ReplaceBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace backend accepted response -func (o *ReplaceBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace backend accepted response -func (o *ReplaceBackendAccepted) WithPayload(payload *models.Backend) *ReplaceBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend accepted response -func (o *ReplaceBackendAccepted) SetPayload(payload *models.Backend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendBadRequestCode is the HTTP code returned for type ReplaceBackendBadRequest -const ReplaceBackendBadRequestCode int = 400 - -/* -ReplaceBackendBadRequest Bad request - -swagger:response replaceBackendBadRequest -*/ -type ReplaceBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendBadRequest creates ReplaceBackendBadRequest with default headers values -func NewReplaceBackendBadRequest() *ReplaceBackendBadRequest { - - return &ReplaceBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend bad request response -func (o *ReplaceBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend bad request response -func (o *ReplaceBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend bad request response -func (o *ReplaceBackendBadRequest) WithPayload(payload *models.Error) *ReplaceBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend bad request response -func (o *ReplaceBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendNotFoundCode is the HTTP code returned for type ReplaceBackendNotFound -const ReplaceBackendNotFoundCode int = 404 - -/* -ReplaceBackendNotFound The specified resource was not found - -swagger:response replaceBackendNotFound -*/ -type ReplaceBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendNotFound creates ReplaceBackendNotFound with default headers values -func NewReplaceBackendNotFound() *ReplaceBackendNotFound { - - return &ReplaceBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend not found response -func (o *ReplaceBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend not found response -func (o *ReplaceBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend not found response -func (o *ReplaceBackendNotFound) WithPayload(payload *models.Error) *ReplaceBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend not found response -func (o *ReplaceBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBackendDefault General Error - -swagger:response replaceBackendDefault -*/ -type ReplaceBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendDefault creates ReplaceBackendDefault with default headers values -func NewReplaceBackendDefault(code int) *ReplaceBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace backend default response -func (o *ReplaceBackendDefault) WithStatusCode(code int) *ReplaceBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace backend default response -func (o *ReplaceBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend default response -func (o *ReplaceBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend default response -func (o *ReplaceBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend default response -func (o *ReplaceBackendDefault) WithPayload(payload *models.Error) *ReplaceBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend default response -func (o *ReplaceBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend/replace_backend_urlbuilder.go b/operations/backend/replace_backend_urlbuilder.go deleted file mode 100644 index 15a2b424..00000000 --- a/operations/backend/replace_backend_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBackendURL generates an URL for the replace backend operation -type ReplaceBackendURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendURL) WithBasePath(bp string) *ReplaceBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/create_backend_switching_rule.go b/operations/backend_switching_rule/create_backend_switching_rule.go deleted file mode 100644 index 802d0908..00000000 --- a/operations/backend_switching_rule/create_backend_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateBackendSwitchingRuleHandlerFunc turns a function with the right signature into a create backend switching rule handler -type CreateBackendSwitchingRuleHandlerFunc func(CreateBackendSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBackendSwitchingRuleHandlerFunc) Handle(params CreateBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateBackendSwitchingRuleHandler interface for that can handle valid create backend switching rule params -type CreateBackendSwitchingRuleHandler interface { - Handle(CreateBackendSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewCreateBackendSwitchingRule creates a new http.Handler for the create backend switching rule operation -func NewCreateBackendSwitchingRule(ctx *middleware.Context, handler CreateBackendSwitchingRuleHandler) *CreateBackendSwitchingRule { - return &CreateBackendSwitchingRule{Context: ctx, Handler: handler} -} - -/* - CreateBackendSwitchingRule swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index} BackendSwitchingRule createBackendSwitchingRule - -# Add a new Backend Switching Rule - -Adds a new Backend Switching Rule of the specified type in the specified frontend. -*/ -type CreateBackendSwitchingRule struct { - Context *middleware.Context - Handler CreateBackendSwitchingRuleHandler -} - -func (o *CreateBackendSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBackendSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/create_backend_switching_rule_parameters.go b/operations/backend_switching_rule/create_backend_switching_rule_parameters.go deleted file mode 100644 index 4c1370e7..00000000 --- a/operations/backend_switching_rule/create_backend_switching_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateBackendSwitchingRuleParams creates a new CreateBackendSwitchingRuleParams object -// with the default values initialized. -func NewCreateBackendSwitchingRuleParams() CreateBackendSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateBackendSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateBackendSwitchingRuleParams contains all the bound params for the create backend switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters createBackendSwitchingRule -type CreateBackendSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.BackendSwitchingRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateBackendSwitchingRuleParams() beforehand. -func (o *CreateBackendSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.BackendSwitchingRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateBackendSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBackendSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateBackendSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateBackendSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateBackendSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateBackendSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend_switching_rule/create_backend_switching_rule_responses.go b/operations/backend_switching_rule/create_backend_switching_rule_responses.go deleted file mode 100644 index 0acfc71c..00000000 --- a/operations/backend_switching_rule/create_backend_switching_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateBackendSwitchingRuleCreatedCode is the HTTP code returned for type CreateBackendSwitchingRuleCreated -const CreateBackendSwitchingRuleCreatedCode int = 201 - -/* -CreateBackendSwitchingRuleCreated Backend Switching Rule created - -swagger:response createBackendSwitchingRuleCreated -*/ -type CreateBackendSwitchingRuleCreated struct { - - /* - In: Body - */ - Payload *models.BackendSwitchingRule `json:"body,omitempty"` -} - -// NewCreateBackendSwitchingRuleCreated creates CreateBackendSwitchingRuleCreated with default headers values -func NewCreateBackendSwitchingRuleCreated() *CreateBackendSwitchingRuleCreated { - - return &CreateBackendSwitchingRuleCreated{} -} - -// WithPayload adds the payload to the create backend switching rule created response -func (o *CreateBackendSwitchingRuleCreated) WithPayload(payload *models.BackendSwitchingRule) *CreateBackendSwitchingRuleCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend switching rule created response -func (o *CreateBackendSwitchingRuleCreated) SetPayload(payload *models.BackendSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendSwitchingRuleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendSwitchingRuleAcceptedCode is the HTTP code returned for type CreateBackendSwitchingRuleAccepted -const CreateBackendSwitchingRuleAcceptedCode int = 202 - -/* -CreateBackendSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response createBackendSwitchingRuleAccepted -*/ -type CreateBackendSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.BackendSwitchingRule `json:"body,omitempty"` -} - -// NewCreateBackendSwitchingRuleAccepted creates CreateBackendSwitchingRuleAccepted with default headers values -func NewCreateBackendSwitchingRuleAccepted() *CreateBackendSwitchingRuleAccepted { - - return &CreateBackendSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the create backend switching rule accepted response -func (o *CreateBackendSwitchingRuleAccepted) WithReloadID(reloadID string) *CreateBackendSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create backend switching rule accepted response -func (o *CreateBackendSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create backend switching rule accepted response -func (o *CreateBackendSwitchingRuleAccepted) WithPayload(payload *models.BackendSwitchingRule) *CreateBackendSwitchingRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend switching rule accepted response -func (o *CreateBackendSwitchingRuleAccepted) SetPayload(payload *models.BackendSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendSwitchingRuleBadRequestCode is the HTTP code returned for type CreateBackendSwitchingRuleBadRequest -const CreateBackendSwitchingRuleBadRequestCode int = 400 - -/* -CreateBackendSwitchingRuleBadRequest Bad request - -swagger:response createBackendSwitchingRuleBadRequest -*/ -type CreateBackendSwitchingRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendSwitchingRuleBadRequest creates CreateBackendSwitchingRuleBadRequest with default headers values -func NewCreateBackendSwitchingRuleBadRequest() *CreateBackendSwitchingRuleBadRequest { - - return &CreateBackendSwitchingRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create backend switching rule bad request response -func (o *CreateBackendSwitchingRuleBadRequest) WithConfigurationVersion(configurationVersion string) *CreateBackendSwitchingRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend switching rule bad request response -func (o *CreateBackendSwitchingRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend switching rule bad request response -func (o *CreateBackendSwitchingRuleBadRequest) WithPayload(payload *models.Error) *CreateBackendSwitchingRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend switching rule bad request response -func (o *CreateBackendSwitchingRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendSwitchingRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBackendSwitchingRuleConflictCode is the HTTP code returned for type CreateBackendSwitchingRuleConflict -const CreateBackendSwitchingRuleConflictCode int = 409 - -/* -CreateBackendSwitchingRuleConflict The specified resource already exists - -swagger:response createBackendSwitchingRuleConflict -*/ -type CreateBackendSwitchingRuleConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendSwitchingRuleConflict creates CreateBackendSwitchingRuleConflict with default headers values -func NewCreateBackendSwitchingRuleConflict() *CreateBackendSwitchingRuleConflict { - - return &CreateBackendSwitchingRuleConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create backend switching rule conflict response -func (o *CreateBackendSwitchingRuleConflict) WithConfigurationVersion(configurationVersion string) *CreateBackendSwitchingRuleConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend switching rule conflict response -func (o *CreateBackendSwitchingRuleConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend switching rule conflict response -func (o *CreateBackendSwitchingRuleConflict) WithPayload(payload *models.Error) *CreateBackendSwitchingRuleConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend switching rule conflict response -func (o *CreateBackendSwitchingRuleConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendSwitchingRuleConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateBackendSwitchingRuleDefault General Error - -swagger:response createBackendSwitchingRuleDefault -*/ -type CreateBackendSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBackendSwitchingRuleDefault creates CreateBackendSwitchingRuleDefault with default headers values -func NewCreateBackendSwitchingRuleDefault(code int) *CreateBackendSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &CreateBackendSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) WithStatusCode(code int) *CreateBackendSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *CreateBackendSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) WithPayload(payload *models.Error) *CreateBackendSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create backend switching rule default response -func (o *CreateBackendSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBackendSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/create_backend_switching_rule_urlbuilder.go b/operations/backend_switching_rule/create_backend_switching_rule_urlbuilder.go deleted file mode 100644 index feda85b9..00000000 --- a/operations/backend_switching_rule/create_backend_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateBackendSwitchingRuleURL generates an URL for the create backend switching rule operation -type CreateBackendSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBackendSwitchingRuleURL) WithBasePath(bp string) *CreateBackendSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBackendSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBackendSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateBackendSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateBackendSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateBackendSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateBackendSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBackendSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBackendSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBackendSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateBackendSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/delete_backend_switching_rule.go b/operations/backend_switching_rule/delete_backend_switching_rule.go deleted file mode 100644 index c3b87edb..00000000 --- a/operations/backend_switching_rule/delete_backend_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteBackendSwitchingRuleHandlerFunc turns a function with the right signature into a delete backend switching rule handler -type DeleteBackendSwitchingRuleHandlerFunc func(DeleteBackendSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBackendSwitchingRuleHandlerFunc) Handle(params DeleteBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteBackendSwitchingRuleHandler interface for that can handle valid delete backend switching rule params -type DeleteBackendSwitchingRuleHandler interface { - Handle(DeleteBackendSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewDeleteBackendSwitchingRule creates a new http.Handler for the delete backend switching rule operation -func NewDeleteBackendSwitchingRule(ctx *middleware.Context, handler DeleteBackendSwitchingRuleHandler) *DeleteBackendSwitchingRule { - return &DeleteBackendSwitchingRule{Context: ctx, Handler: handler} -} - -/* - DeleteBackendSwitchingRule swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index} BackendSwitchingRule deleteBackendSwitchingRule - -# Delete a Backend Switching Rule - -Deletes a Backend Switching Rule configuration by it's index from the specified frontend. -*/ -type DeleteBackendSwitchingRule struct { - Context *middleware.Context - Handler DeleteBackendSwitchingRuleHandler -} - -func (o *DeleteBackendSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBackendSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/delete_backend_switching_rule_parameters.go b/operations/backend_switching_rule/delete_backend_switching_rule_parameters.go deleted file mode 100644 index 73c9dd82..00000000 --- a/operations/backend_switching_rule/delete_backend_switching_rule_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteBackendSwitchingRuleParams creates a new DeleteBackendSwitchingRuleParams object -// with the default values initialized. -func NewDeleteBackendSwitchingRuleParams() DeleteBackendSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteBackendSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteBackendSwitchingRuleParams contains all the bound params for the delete backend switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteBackendSwitchingRule -type DeleteBackendSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteBackendSwitchingRuleParams() beforehand. -func (o *DeleteBackendSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteBackendSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteBackendSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteBackendSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteBackendSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteBackendSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteBackendSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend_switching_rule/delete_backend_switching_rule_responses.go b/operations/backend_switching_rule/delete_backend_switching_rule_responses.go deleted file mode 100644 index c72d4038..00000000 --- a/operations/backend_switching_rule/delete_backend_switching_rule_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteBackendSwitchingRuleAcceptedCode is the HTTP code returned for type DeleteBackendSwitchingRuleAccepted -const DeleteBackendSwitchingRuleAcceptedCode int = 202 - -/* -DeleteBackendSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response deleteBackendSwitchingRuleAccepted -*/ -type DeleteBackendSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteBackendSwitchingRuleAccepted creates DeleteBackendSwitchingRuleAccepted with default headers values -func NewDeleteBackendSwitchingRuleAccepted() *DeleteBackendSwitchingRuleAccepted { - - return &DeleteBackendSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the delete backend switching rule accepted response -func (o *DeleteBackendSwitchingRuleAccepted) WithReloadID(reloadID string) *DeleteBackendSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete backend switching rule accepted response -func (o *DeleteBackendSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteBackendSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteBackendSwitchingRuleNoContentCode is the HTTP code returned for type DeleteBackendSwitchingRuleNoContent -const DeleteBackendSwitchingRuleNoContentCode int = 204 - -/* -DeleteBackendSwitchingRuleNoContent Backend Switching Rule deleted - -swagger:response deleteBackendSwitchingRuleNoContent -*/ -type DeleteBackendSwitchingRuleNoContent struct { -} - -// NewDeleteBackendSwitchingRuleNoContent creates DeleteBackendSwitchingRuleNoContent with default headers values -func NewDeleteBackendSwitchingRuleNoContent() *DeleteBackendSwitchingRuleNoContent { - - return &DeleteBackendSwitchingRuleNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBackendSwitchingRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteBackendSwitchingRuleNotFoundCode is the HTTP code returned for type DeleteBackendSwitchingRuleNotFound -const DeleteBackendSwitchingRuleNotFoundCode int = 404 - -/* -DeleteBackendSwitchingRuleNotFound The specified resource was not found - -swagger:response deleteBackendSwitchingRuleNotFound -*/ -type DeleteBackendSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBackendSwitchingRuleNotFound creates DeleteBackendSwitchingRuleNotFound with default headers values -func NewDeleteBackendSwitchingRuleNotFound() *DeleteBackendSwitchingRuleNotFound { - - return &DeleteBackendSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete backend switching rule not found response -func (o *DeleteBackendSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *DeleteBackendSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete backend switching rule not found response -func (o *DeleteBackendSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete backend switching rule not found response -func (o *DeleteBackendSwitchingRuleNotFound) WithPayload(payload *models.Error) *DeleteBackendSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete backend switching rule not found response -func (o *DeleteBackendSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBackendSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteBackendSwitchingRuleDefault General Error - -swagger:response deleteBackendSwitchingRuleDefault -*/ -type DeleteBackendSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBackendSwitchingRuleDefault creates DeleteBackendSwitchingRuleDefault with default headers values -func NewDeleteBackendSwitchingRuleDefault(code int) *DeleteBackendSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBackendSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) WithStatusCode(code int) *DeleteBackendSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *DeleteBackendSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) WithPayload(payload *models.Error) *DeleteBackendSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete backend switching rule default response -func (o *DeleteBackendSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBackendSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/delete_backend_switching_rule_urlbuilder.go b/operations/backend_switching_rule/delete_backend_switching_rule_urlbuilder.go deleted file mode 100644 index 048b6766..00000000 --- a/operations/backend_switching_rule/delete_backend_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteBackendSwitchingRuleURL generates an URL for the delete backend switching rule operation -type DeleteBackendSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBackendSwitchingRuleURL) WithBasePath(bp string) *DeleteBackendSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBackendSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBackendSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteBackendSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteBackendSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteBackendSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteBackendSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBackendSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBackendSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBackendSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteBackendSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/get_backend_switching_rule.go b/operations/backend_switching_rule/get_backend_switching_rule.go deleted file mode 100644 index 3afeafb0..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBackendSwitchingRuleHandlerFunc turns a function with the right signature into a get backend switching rule handler -type GetBackendSwitchingRuleHandlerFunc func(GetBackendSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBackendSwitchingRuleHandlerFunc) Handle(params GetBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBackendSwitchingRuleHandler interface for that can handle valid get backend switching rule params -type GetBackendSwitchingRuleHandler interface { - Handle(GetBackendSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewGetBackendSwitchingRule creates a new http.Handler for the get backend switching rule operation -func NewGetBackendSwitchingRule(ctx *middleware.Context, handler GetBackendSwitchingRuleHandler) *GetBackendSwitchingRule { - return &GetBackendSwitchingRule{Context: ctx, Handler: handler} -} - -/* - GetBackendSwitchingRule swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index} BackendSwitchingRule getBackendSwitchingRule - -# Return one Backend Switching Rule - -Returns one Backend Switching Rule configuration by it's index in the specified frontend. -*/ -type GetBackendSwitchingRule struct { - Context *middleware.Context - Handler GetBackendSwitchingRuleHandler -} - -func (o *GetBackendSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBackendSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/get_backend_switching_rule_parameters.go b/operations/backend_switching_rule/get_backend_switching_rule_parameters.go deleted file mode 100644 index d8b2f113..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rule_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetBackendSwitchingRuleParams creates a new GetBackendSwitchingRuleParams object -// -// There are no default values defined in the spec. -func NewGetBackendSwitchingRuleParams() GetBackendSwitchingRuleParams { - - return GetBackendSwitchingRuleParams{} -} - -// GetBackendSwitchingRuleParams contains all the bound params for the get backend switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBackendSwitchingRule -type GetBackendSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBackendSwitchingRuleParams() beforehand. -func (o *GetBackendSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetBackendSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetBackendSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBackendSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/backend_switching_rule/get_backend_switching_rule_responses.go b/operations/backend_switching_rule/get_backend_switching_rule_responses.go deleted file mode 100644 index e8f22a42..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rule_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBackendSwitchingRuleOKCode is the HTTP code returned for type GetBackendSwitchingRuleOK -const GetBackendSwitchingRuleOKCode int = 200 - -/* -GetBackendSwitchingRuleOK Successful operation - -swagger:response getBackendSwitchingRuleOK -*/ -type GetBackendSwitchingRuleOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.BackendSwitchingRule `json:"body,omitempty"` -} - -// NewGetBackendSwitchingRuleOK creates GetBackendSwitchingRuleOK with default headers values -func NewGetBackendSwitchingRuleOK() *GetBackendSwitchingRuleOK { - - return &GetBackendSwitchingRuleOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backend switching rule o k response -func (o *GetBackendSwitchingRuleOK) WithConfigurationVersion(configurationVersion string) *GetBackendSwitchingRuleOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend switching rule o k response -func (o *GetBackendSwitchingRuleOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend switching rule o k response -func (o *GetBackendSwitchingRuleOK) WithPayload(payload *models.BackendSwitchingRule) *GetBackendSwitchingRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend switching rule o k response -func (o *GetBackendSwitchingRuleOK) SetPayload(payload *models.BackendSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendSwitchingRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetBackendSwitchingRuleNotFoundCode is the HTTP code returned for type GetBackendSwitchingRuleNotFound -const GetBackendSwitchingRuleNotFoundCode int = 404 - -/* -GetBackendSwitchingRuleNotFound The specified resource was not found - -swagger:response getBackendSwitchingRuleNotFound -*/ -type GetBackendSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendSwitchingRuleNotFound creates GetBackendSwitchingRuleNotFound with default headers values -func NewGetBackendSwitchingRuleNotFound() *GetBackendSwitchingRuleNotFound { - - return &GetBackendSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backend switching rule not found response -func (o *GetBackendSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *GetBackendSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend switching rule not found response -func (o *GetBackendSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend switching rule not found response -func (o *GetBackendSwitchingRuleNotFound) WithPayload(payload *models.Error) *GetBackendSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend switching rule not found response -func (o *GetBackendSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetBackendSwitchingRuleDefault General Error - -swagger:response getBackendSwitchingRuleDefault -*/ -type GetBackendSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendSwitchingRuleDefault creates GetBackendSwitchingRuleDefault with default headers values -func NewGetBackendSwitchingRuleDefault(code int) *GetBackendSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &GetBackendSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) WithStatusCode(code int) *GetBackendSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *GetBackendSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) WithPayload(payload *models.Error) *GetBackendSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend switching rule default response -func (o *GetBackendSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/get_backend_switching_rule_urlbuilder.go b/operations/backend_switching_rule/get_backend_switching_rule_urlbuilder.go deleted file mode 100644 index 3f1ca69c..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rule_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetBackendSwitchingRuleURL generates an URL for the get backend switching rule operation -type GetBackendSwitchingRuleURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendSwitchingRuleURL) WithBasePath(bp string) *GetBackendSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBackendSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetBackendSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetBackendSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBackendSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBackendSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBackendSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBackendSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBackendSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBackendSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/get_backend_switching_rules.go b/operations/backend_switching_rule/get_backend_switching_rules.go deleted file mode 100644 index c5e3e987..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBackendSwitchingRulesHandlerFunc turns a function with the right signature into a get backend switching rules handler -type GetBackendSwitchingRulesHandlerFunc func(GetBackendSwitchingRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBackendSwitchingRulesHandlerFunc) Handle(params GetBackendSwitchingRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBackendSwitchingRulesHandler interface for that can handle valid get backend switching rules params -type GetBackendSwitchingRulesHandler interface { - Handle(GetBackendSwitchingRulesParams, interface{}) middleware.Responder -} - -// NewGetBackendSwitchingRules creates a new http.Handler for the get backend switching rules operation -func NewGetBackendSwitchingRules(ctx *middleware.Context, handler GetBackendSwitchingRulesHandler) *GetBackendSwitchingRules { - return &GetBackendSwitchingRules{Context: ctx, Handler: handler} -} - -/* - GetBackendSwitchingRules swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules BackendSwitchingRule getBackendSwitchingRules - -# Return an array of all Backend Switching Rules - -Returns all Backend Switching Rules that are configured in specified frontend. -*/ -type GetBackendSwitchingRules struct { - Context *middleware.Context - Handler GetBackendSwitchingRulesHandler -} - -func (o *GetBackendSwitchingRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBackendSwitchingRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/get_backend_switching_rules_parameters.go b/operations/backend_switching_rule/get_backend_switching_rules_parameters.go deleted file mode 100644 index a5a4c8ec..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rules_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetBackendSwitchingRulesParams creates a new GetBackendSwitchingRulesParams object -// -// There are no default values defined in the spec. -func NewGetBackendSwitchingRulesParams() GetBackendSwitchingRulesParams { - - return GetBackendSwitchingRulesParams{} -} - -// GetBackendSwitchingRulesParams contains all the bound params for the get backend switching rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBackendSwitchingRules -type GetBackendSwitchingRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBackendSwitchingRulesParams() beforehand. -func (o *GetBackendSwitchingRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetBackendSwitchingRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBackendSwitchingRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/backend_switching_rule/get_backend_switching_rules_responses.go b/operations/backend_switching_rule/get_backend_switching_rules_responses.go deleted file mode 100644 index 3dc60d0c..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rules_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBackendSwitchingRulesOKCode is the HTTP code returned for type GetBackendSwitchingRulesOK -const GetBackendSwitchingRulesOKCode int = 200 - -/* -GetBackendSwitchingRulesOK Successful operation - -swagger:response getBackendSwitchingRulesOK -*/ -type GetBackendSwitchingRulesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.BackendSwitchingRules `json:"body,omitempty"` -} - -// NewGetBackendSwitchingRulesOK creates GetBackendSwitchingRulesOK with default headers values -func NewGetBackendSwitchingRulesOK() *GetBackendSwitchingRulesOK { - - return &GetBackendSwitchingRulesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get backend switching rules o k response -func (o *GetBackendSwitchingRulesOK) WithConfigurationVersion(configurationVersion string) *GetBackendSwitchingRulesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend switching rules o k response -func (o *GetBackendSwitchingRulesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend switching rules o k response -func (o *GetBackendSwitchingRulesOK) WithPayload(payload models.BackendSwitchingRules) *GetBackendSwitchingRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend switching rules o k response -func (o *GetBackendSwitchingRulesOK) SetPayload(payload models.BackendSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendSwitchingRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.BackendSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetBackendSwitchingRulesDefault General Error - -swagger:response getBackendSwitchingRulesDefault -*/ -type GetBackendSwitchingRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBackendSwitchingRulesDefault creates GetBackendSwitchingRulesDefault with default headers values -func NewGetBackendSwitchingRulesDefault(code int) *GetBackendSwitchingRulesDefault { - if code <= 0 { - code = 500 - } - - return &GetBackendSwitchingRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) WithStatusCode(code int) *GetBackendSwitchingRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) WithConfigurationVersion(configurationVersion string) *GetBackendSwitchingRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) WithPayload(payload *models.Error) *GetBackendSwitchingRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get backend switching rules default response -func (o *GetBackendSwitchingRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBackendSwitchingRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/get_backend_switching_rules_urlbuilder.go b/operations/backend_switching_rule/get_backend_switching_rules_urlbuilder.go deleted file mode 100644 index 0337e805..00000000 --- a/operations/backend_switching_rule/get_backend_switching_rules_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetBackendSwitchingRulesURL generates an URL for the get backend switching rules operation -type GetBackendSwitchingRulesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendSwitchingRulesURL) WithBasePath(bp string) *GetBackendSwitchingRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBackendSwitchingRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBackendSwitchingRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetBackendSwitchingRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBackendSwitchingRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBackendSwitchingRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBackendSwitchingRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBackendSwitchingRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBackendSwitchingRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBackendSwitchingRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rule.go b/operations/backend_switching_rule/replace_backend_switching_rule.go deleted file mode 100644 index 60f532a7..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBackendSwitchingRuleHandlerFunc turns a function with the right signature into a replace backend switching rule handler -type ReplaceBackendSwitchingRuleHandlerFunc func(ReplaceBackendSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBackendSwitchingRuleHandlerFunc) Handle(params ReplaceBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBackendSwitchingRuleHandler interface for that can handle valid replace backend switching rule params -type ReplaceBackendSwitchingRuleHandler interface { - Handle(ReplaceBackendSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewReplaceBackendSwitchingRule creates a new http.Handler for the replace backend switching rule operation -func NewReplaceBackendSwitchingRule(ctx *middleware.Context, handler ReplaceBackendSwitchingRuleHandler) *ReplaceBackendSwitchingRule { - return &ReplaceBackendSwitchingRule{Context: ctx, Handler: handler} -} - -/* - ReplaceBackendSwitchingRule swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index} BackendSwitchingRule replaceBackendSwitchingRule - -# Replace a Backend Switching Rule - -Replaces a Backend Switching Rule configuration by it's index in the specified frontend. -*/ -type ReplaceBackendSwitchingRule struct { - Context *middleware.Context - Handler ReplaceBackendSwitchingRuleHandler -} - -func (o *ReplaceBackendSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBackendSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rule_parameters.go b/operations/backend_switching_rule/replace_backend_switching_rule_parameters.go deleted file mode 100644 index 6b471636..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBackendSwitchingRuleParams creates a new ReplaceBackendSwitchingRuleParams object -// with the default values initialized. -func NewReplaceBackendSwitchingRuleParams() ReplaceBackendSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceBackendSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceBackendSwitchingRuleParams contains all the bound params for the replace backend switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBackendSwitchingRule -type ReplaceBackendSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.BackendSwitchingRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBackendSwitchingRuleParams() beforehand. -func (o *ReplaceBackendSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.BackendSwitchingRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBackendSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBackendSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceBackendSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceBackendSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBackendSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBackendSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rule_responses.go b/operations/backend_switching_rule/replace_backend_switching_rule_responses.go deleted file mode 100644 index b88adc8c..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBackendSwitchingRuleOKCode is the HTTP code returned for type ReplaceBackendSwitchingRuleOK -const ReplaceBackendSwitchingRuleOKCode int = 200 - -/* -ReplaceBackendSwitchingRuleOK Backend Switching Rule replaced - -swagger:response replaceBackendSwitchingRuleOK -*/ -type ReplaceBackendSwitchingRuleOK struct { - - /* - In: Body - */ - Payload *models.BackendSwitchingRule `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRuleOK creates ReplaceBackendSwitchingRuleOK with default headers values -func NewReplaceBackendSwitchingRuleOK() *ReplaceBackendSwitchingRuleOK { - - return &ReplaceBackendSwitchingRuleOK{} -} - -// WithPayload adds the payload to the replace backend switching rule o k response -func (o *ReplaceBackendSwitchingRuleOK) WithPayload(payload *models.BackendSwitchingRule) *ReplaceBackendSwitchingRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rule o k response -func (o *ReplaceBackendSwitchingRuleOK) SetPayload(payload *models.BackendSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendSwitchingRuleAcceptedCode is the HTTP code returned for type ReplaceBackendSwitchingRuleAccepted -const ReplaceBackendSwitchingRuleAcceptedCode int = 202 - -/* -ReplaceBackendSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response replaceBackendSwitchingRuleAccepted -*/ -type ReplaceBackendSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.BackendSwitchingRule `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRuleAccepted creates ReplaceBackendSwitchingRuleAccepted with default headers values -func NewReplaceBackendSwitchingRuleAccepted() *ReplaceBackendSwitchingRuleAccepted { - - return &ReplaceBackendSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the replace backend switching rule accepted response -func (o *ReplaceBackendSwitchingRuleAccepted) WithReloadID(reloadID string) *ReplaceBackendSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace backend switching rule accepted response -func (o *ReplaceBackendSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace backend switching rule accepted response -func (o *ReplaceBackendSwitchingRuleAccepted) WithPayload(payload *models.BackendSwitchingRule) *ReplaceBackendSwitchingRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rule accepted response -func (o *ReplaceBackendSwitchingRuleAccepted) SetPayload(payload *models.BackendSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendSwitchingRuleBadRequestCode is the HTTP code returned for type ReplaceBackendSwitchingRuleBadRequest -const ReplaceBackendSwitchingRuleBadRequestCode int = 400 - -/* -ReplaceBackendSwitchingRuleBadRequest Bad request - -swagger:response replaceBackendSwitchingRuleBadRequest -*/ -type ReplaceBackendSwitchingRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRuleBadRequest creates ReplaceBackendSwitchingRuleBadRequest with default headers values -func NewReplaceBackendSwitchingRuleBadRequest() *ReplaceBackendSwitchingRuleBadRequest { - - return &ReplaceBackendSwitchingRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend switching rule bad request response -func (o *ReplaceBackendSwitchingRuleBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBackendSwitchingRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend switching rule bad request response -func (o *ReplaceBackendSwitchingRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend switching rule bad request response -func (o *ReplaceBackendSwitchingRuleBadRequest) WithPayload(payload *models.Error) *ReplaceBackendSwitchingRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rule bad request response -func (o *ReplaceBackendSwitchingRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBackendSwitchingRuleNotFoundCode is the HTTP code returned for type ReplaceBackendSwitchingRuleNotFound -const ReplaceBackendSwitchingRuleNotFoundCode int = 404 - -/* -ReplaceBackendSwitchingRuleNotFound The specified resource was not found - -swagger:response replaceBackendSwitchingRuleNotFound -*/ -type ReplaceBackendSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRuleNotFound creates ReplaceBackendSwitchingRuleNotFound with default headers values -func NewReplaceBackendSwitchingRuleNotFound() *ReplaceBackendSwitchingRuleNotFound { - - return &ReplaceBackendSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend switching rule not found response -func (o *ReplaceBackendSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceBackendSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend switching rule not found response -func (o *ReplaceBackendSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend switching rule not found response -func (o *ReplaceBackendSwitchingRuleNotFound) WithPayload(payload *models.Error) *ReplaceBackendSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rule not found response -func (o *ReplaceBackendSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBackendSwitchingRuleDefault General Error - -swagger:response replaceBackendSwitchingRuleDefault -*/ -type ReplaceBackendSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRuleDefault creates ReplaceBackendSwitchingRuleDefault with default headers values -func NewReplaceBackendSwitchingRuleDefault(code int) *ReplaceBackendSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBackendSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) WithStatusCode(code int) *ReplaceBackendSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBackendSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) WithPayload(payload *models.Error) *ReplaceBackendSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rule default response -func (o *ReplaceBackendSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rule_urlbuilder.go b/operations/backend_switching_rule/replace_backend_switching_rule_urlbuilder.go deleted file mode 100644 index efe93726..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBackendSwitchingRuleURL generates an URL for the replace backend switching rule operation -type ReplaceBackendSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendSwitchingRuleURL) WithBasePath(bp string) *ReplaceBackendSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBackendSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceBackendSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceBackendSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBackendSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBackendSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBackendSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBackendSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBackendSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBackendSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rules.go b/operations/backend_switching_rule/replace_backend_switching_rules.go deleted file mode 100644 index a21a71e4..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBackendSwitchingRulesHandlerFunc turns a function with the right signature into a replace backend switching rules handler -type ReplaceBackendSwitchingRulesHandlerFunc func(ReplaceBackendSwitchingRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBackendSwitchingRulesHandlerFunc) Handle(params ReplaceBackendSwitchingRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBackendSwitchingRulesHandler interface for that can handle valid replace backend switching rules params -type ReplaceBackendSwitchingRulesHandler interface { - Handle(ReplaceBackendSwitchingRulesParams, interface{}) middleware.Responder -} - -// NewReplaceBackendSwitchingRules creates a new http.Handler for the replace backend switching rules operation -func NewReplaceBackendSwitchingRules(ctx *middleware.Context, handler ReplaceBackendSwitchingRulesHandler) *ReplaceBackendSwitchingRules { - return &ReplaceBackendSwitchingRules{Context: ctx, Handler: handler} -} - -/* - ReplaceBackendSwitchingRules swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules BackendSwitchingRule replaceBackendSwitchingRules - -# Replace an Backend Switching Rule list - -Replaces a whole list of Backend Switching Rules with the list given in parameter -*/ -type ReplaceBackendSwitchingRules struct { - Context *middleware.Context - Handler ReplaceBackendSwitchingRulesHandler -} - -func (o *ReplaceBackendSwitchingRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBackendSwitchingRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rules_parameters.go b/operations/backend_switching_rule/replace_backend_switching_rules_parameters.go deleted file mode 100644 index 9904b2f2..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rules_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBackendSwitchingRulesParams creates a new ReplaceBackendSwitchingRulesParams object -// with the default values initialized. -func NewReplaceBackendSwitchingRulesParams() ReplaceBackendSwitchingRulesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceBackendSwitchingRulesParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceBackendSwitchingRulesParams contains all the bound params for the replace backend switching rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBackendSwitchingRules -type ReplaceBackendSwitchingRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.BackendSwitchingRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBackendSwitchingRulesParams() beforehand. -func (o *ReplaceBackendSwitchingRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.BackendSwitchingRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBackendSwitchingRulesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBackendSwitchingRulesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceBackendSwitchingRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBackendSwitchingRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBackendSwitchingRulesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rules_responses.go b/operations/backend_switching_rule/replace_backend_switching_rules_responses.go deleted file mode 100644 index c435561a..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rules_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBackendSwitchingRulesOKCode is the HTTP code returned for type ReplaceBackendSwitchingRulesOK -const ReplaceBackendSwitchingRulesOKCode int = 200 - -/* -ReplaceBackendSwitchingRulesOK All Backend Switching Rule lines replaced - -swagger:response replaceBackendSwitchingRulesOK -*/ -type ReplaceBackendSwitchingRulesOK struct { - - /* - In: Body - */ - Payload models.BackendSwitchingRules `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRulesOK creates ReplaceBackendSwitchingRulesOK with default headers values -func NewReplaceBackendSwitchingRulesOK() *ReplaceBackendSwitchingRulesOK { - - return &ReplaceBackendSwitchingRulesOK{} -} - -// WithPayload adds the payload to the replace backend switching rules o k response -func (o *ReplaceBackendSwitchingRulesOK) WithPayload(payload models.BackendSwitchingRules) *ReplaceBackendSwitchingRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rules o k response -func (o *ReplaceBackendSwitchingRulesOK) SetPayload(payload models.BackendSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.BackendSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceBackendSwitchingRulesAcceptedCode is the HTTP code returned for type ReplaceBackendSwitchingRulesAccepted -const ReplaceBackendSwitchingRulesAcceptedCode int = 202 - -/* -ReplaceBackendSwitchingRulesAccepted Configuration change accepted and reload requested - -swagger:response replaceBackendSwitchingRulesAccepted -*/ -type ReplaceBackendSwitchingRulesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.BackendSwitchingRules `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRulesAccepted creates ReplaceBackendSwitchingRulesAccepted with default headers values -func NewReplaceBackendSwitchingRulesAccepted() *ReplaceBackendSwitchingRulesAccepted { - - return &ReplaceBackendSwitchingRulesAccepted{} -} - -// WithReloadID adds the reloadId to the replace backend switching rules accepted response -func (o *ReplaceBackendSwitchingRulesAccepted) WithReloadID(reloadID string) *ReplaceBackendSwitchingRulesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace backend switching rules accepted response -func (o *ReplaceBackendSwitchingRulesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace backend switching rules accepted response -func (o *ReplaceBackendSwitchingRulesAccepted) WithPayload(payload models.BackendSwitchingRules) *ReplaceBackendSwitchingRulesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rules accepted response -func (o *ReplaceBackendSwitchingRulesAccepted) SetPayload(payload models.BackendSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRulesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.BackendSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceBackendSwitchingRulesBadRequestCode is the HTTP code returned for type ReplaceBackendSwitchingRulesBadRequest -const ReplaceBackendSwitchingRulesBadRequestCode int = 400 - -/* -ReplaceBackendSwitchingRulesBadRequest Bad request - -swagger:response replaceBackendSwitchingRulesBadRequest -*/ -type ReplaceBackendSwitchingRulesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRulesBadRequest creates ReplaceBackendSwitchingRulesBadRequest with default headers values -func NewReplaceBackendSwitchingRulesBadRequest() *ReplaceBackendSwitchingRulesBadRequest { - - return &ReplaceBackendSwitchingRulesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend switching rules bad request response -func (o *ReplaceBackendSwitchingRulesBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBackendSwitchingRulesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend switching rules bad request response -func (o *ReplaceBackendSwitchingRulesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend switching rules bad request response -func (o *ReplaceBackendSwitchingRulesBadRequest) WithPayload(payload *models.Error) *ReplaceBackendSwitchingRulesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rules bad request response -func (o *ReplaceBackendSwitchingRulesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRulesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBackendSwitchingRulesDefault General Error - -swagger:response replaceBackendSwitchingRulesDefault -*/ -type ReplaceBackendSwitchingRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBackendSwitchingRulesDefault creates ReplaceBackendSwitchingRulesDefault with default headers values -func NewReplaceBackendSwitchingRulesDefault(code int) *ReplaceBackendSwitchingRulesDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBackendSwitchingRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) WithStatusCode(code int) *ReplaceBackendSwitchingRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBackendSwitchingRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) WithPayload(payload *models.Error) *ReplaceBackendSwitchingRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace backend switching rules default response -func (o *ReplaceBackendSwitchingRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBackendSwitchingRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/backend_switching_rule/replace_backend_switching_rules_urlbuilder.go b/operations/backend_switching_rule/replace_backend_switching_rules_urlbuilder.go deleted file mode 100644 index aa88ed07..00000000 --- a/operations/backend_switching_rule/replace_backend_switching_rules_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package backend_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBackendSwitchingRulesURL generates an URL for the replace backend switching rules operation -type ReplaceBackendSwitchingRulesURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendSwitchingRulesURL) WithBasePath(bp string) *ReplaceBackendSwitchingRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBackendSwitchingRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBackendSwitchingRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceBackendSwitchingRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBackendSwitchingRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBackendSwitchingRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBackendSwitchingRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBackendSwitchingRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBackendSwitchingRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBackendSwitchingRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/create_bind_frontend.go b/operations/bind/create_bind_frontend.go deleted file mode 100644 index 0e2113cf..00000000 --- a/operations/bind/create_bind_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateBindFrontendHandlerFunc turns a function with the right signature into a create bind frontend handler -type CreateBindFrontendHandlerFunc func(CreateBindFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBindFrontendHandlerFunc) Handle(params CreateBindFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateBindFrontendHandler interface for that can handle valid create bind frontend params -type CreateBindFrontendHandler interface { - Handle(CreateBindFrontendParams, interface{}) middleware.Responder -} - -// NewCreateBindFrontend creates a new http.Handler for the create bind frontend operation -func NewCreateBindFrontend(ctx *middleware.Context, handler CreateBindFrontendHandler) *CreateBindFrontend { - return &CreateBindFrontend{Context: ctx, Handler: handler} -} - -/* - CreateBindFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/binds Bind createBindFrontend - -# Add a new bind - -Adds a new bind in the specified frontend in the configuration file. -*/ -type CreateBindFrontend struct { - Context *middleware.Context - Handler CreateBindFrontendHandler -} - -func (o *CreateBindFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBindFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/create_bind_frontend_parameters.go b/operations/bind/create_bind_frontend_parameters.go deleted file mode 100644 index c4859589..00000000 --- a/operations/bind/create_bind_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateBindFrontendParams creates a new CreateBindFrontendParams object -// with the default values initialized. -func NewCreateBindFrontendParams() CreateBindFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateBindFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateBindFrontendParams contains all the bound params for the create bind frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createBindFrontend -type CreateBindFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateBindFrontendParams() beforehand. -func (o *CreateBindFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateBindFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBindFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateBindFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateBindFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateBindFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/create_bind_frontend_responses.go b/operations/bind/create_bind_frontend_responses.go deleted file mode 100644 index c0eb36d8..00000000 --- a/operations/bind/create_bind_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateBindFrontendCreatedCode is the HTTP code returned for type CreateBindFrontendCreated -const CreateBindFrontendCreatedCode int = 201 - -/* -CreateBindFrontendCreated Bind created - -swagger:response createBindFrontendCreated -*/ -type CreateBindFrontendCreated struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindFrontendCreated creates CreateBindFrontendCreated with default headers values -func NewCreateBindFrontendCreated() *CreateBindFrontendCreated { - - return &CreateBindFrontendCreated{} -} - -// WithPayload adds the payload to the create bind frontend created response -func (o *CreateBindFrontendCreated) WithPayload(payload *models.Bind) *CreateBindFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind frontend created response -func (o *CreateBindFrontendCreated) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindFrontendAcceptedCode is the HTTP code returned for type CreateBindFrontendAccepted -const CreateBindFrontendAcceptedCode int = 202 - -/* -CreateBindFrontendAccepted Configuration change accepted and reload requested - -swagger:response createBindFrontendAccepted -*/ -type CreateBindFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindFrontendAccepted creates CreateBindFrontendAccepted with default headers values -func NewCreateBindFrontendAccepted() *CreateBindFrontendAccepted { - - return &CreateBindFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create bind frontend accepted response -func (o *CreateBindFrontendAccepted) WithReloadID(reloadID string) *CreateBindFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create bind frontend accepted response -func (o *CreateBindFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create bind frontend accepted response -func (o *CreateBindFrontendAccepted) WithPayload(payload *models.Bind) *CreateBindFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind frontend accepted response -func (o *CreateBindFrontendAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindFrontendBadRequestCode is the HTTP code returned for type CreateBindFrontendBadRequest -const CreateBindFrontendBadRequestCode int = 400 - -/* -CreateBindFrontendBadRequest Bad request - -swagger:response createBindFrontendBadRequest -*/ -type CreateBindFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindFrontendBadRequest creates CreateBindFrontendBadRequest with default headers values -func NewCreateBindFrontendBadRequest() *CreateBindFrontendBadRequest { - - return &CreateBindFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind frontend bad request response -func (o *CreateBindFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateBindFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind frontend bad request response -func (o *CreateBindFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind frontend bad request response -func (o *CreateBindFrontendBadRequest) WithPayload(payload *models.Error) *CreateBindFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind frontend bad request response -func (o *CreateBindFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindFrontendConflictCode is the HTTP code returned for type CreateBindFrontendConflict -const CreateBindFrontendConflictCode int = 409 - -/* -CreateBindFrontendConflict The specified resource already exists - -swagger:response createBindFrontendConflict -*/ -type CreateBindFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindFrontendConflict creates CreateBindFrontendConflict with default headers values -func NewCreateBindFrontendConflict() *CreateBindFrontendConflict { - - return &CreateBindFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind frontend conflict response -func (o *CreateBindFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateBindFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind frontend conflict response -func (o *CreateBindFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind frontend conflict response -func (o *CreateBindFrontendConflict) WithPayload(payload *models.Error) *CreateBindFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind frontend conflict response -func (o *CreateBindFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateBindFrontendDefault General Error - -swagger:response createBindFrontendDefault -*/ -type CreateBindFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindFrontendDefault creates CreateBindFrontendDefault with default headers values -func NewCreateBindFrontendDefault(code int) *CreateBindFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateBindFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create bind frontend default response -func (o *CreateBindFrontendDefault) WithStatusCode(code int) *CreateBindFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create bind frontend default response -func (o *CreateBindFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create bind frontend default response -func (o *CreateBindFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateBindFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind frontend default response -func (o *CreateBindFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind frontend default response -func (o *CreateBindFrontendDefault) WithPayload(payload *models.Error) *CreateBindFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind frontend default response -func (o *CreateBindFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/create_bind_frontend_urlbuilder.go b/operations/bind/create_bind_frontend_urlbuilder.go deleted file mode 100644 index 3077155a..00000000 --- a/operations/bind/create_bind_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateBindFrontendURL generates an URL for the create bind frontend operation -type CreateBindFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindFrontendURL) WithBasePath(bp string) *CreateBindFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBindFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateBindFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateBindFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateBindFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBindFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBindFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBindFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateBindFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/create_bind_log_forward.go b/operations/bind/create_bind_log_forward.go deleted file mode 100644 index 2c0acd4e..00000000 --- a/operations/bind/create_bind_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateBindLogForwardHandlerFunc turns a function with the right signature into a create bind log forward handler -type CreateBindLogForwardHandlerFunc func(CreateBindLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBindLogForwardHandlerFunc) Handle(params CreateBindLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateBindLogForwardHandler interface for that can handle valid create bind log forward params -type CreateBindLogForwardHandler interface { - Handle(CreateBindLogForwardParams, interface{}) middleware.Responder -} - -// NewCreateBindLogForward creates a new http.Handler for the create bind log forward operation -func NewCreateBindLogForward(ctx *middleware.Context, handler CreateBindLogForwardHandler) *CreateBindLogForward { - return &CreateBindLogForward{Context: ctx, Handler: handler} -} - -/* - CreateBindLogForward swagger:route POST /services/haproxy/configuration/log_forwards/{parent_name}/binds Bind createBindLogForward - -# Add a new bind - -Adds a new bind in the specified frontend in the configuration file. -*/ -type CreateBindLogForward struct { - Context *middleware.Context - Handler CreateBindLogForwardHandler -} - -func (o *CreateBindLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBindLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/create_bind_log_forward_parameters.go b/operations/bind/create_bind_log_forward_parameters.go deleted file mode 100644 index 17e1ee63..00000000 --- a/operations/bind/create_bind_log_forward_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateBindLogForwardParams creates a new CreateBindLogForwardParams object -// with the default values initialized. -func NewCreateBindLogForwardParams() CreateBindLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateBindLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateBindLogForwardParams contains all the bound params for the create bind log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters createBindLogForward -type CreateBindLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateBindLogForwardParams() beforehand. -func (o *CreateBindLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateBindLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBindLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateBindLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateBindLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateBindLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/create_bind_log_forward_responses.go b/operations/bind/create_bind_log_forward_responses.go deleted file mode 100644 index 49c97ba4..00000000 --- a/operations/bind/create_bind_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateBindLogForwardCreatedCode is the HTTP code returned for type CreateBindLogForwardCreated -const CreateBindLogForwardCreatedCode int = 201 - -/* -CreateBindLogForwardCreated Bind created - -swagger:response createBindLogForwardCreated -*/ -type CreateBindLogForwardCreated struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindLogForwardCreated creates CreateBindLogForwardCreated with default headers values -func NewCreateBindLogForwardCreated() *CreateBindLogForwardCreated { - - return &CreateBindLogForwardCreated{} -} - -// WithPayload adds the payload to the create bind log forward created response -func (o *CreateBindLogForwardCreated) WithPayload(payload *models.Bind) *CreateBindLogForwardCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind log forward created response -func (o *CreateBindLogForwardCreated) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindLogForwardCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindLogForwardAcceptedCode is the HTTP code returned for type CreateBindLogForwardAccepted -const CreateBindLogForwardAcceptedCode int = 202 - -/* -CreateBindLogForwardAccepted Configuration change accepted and reload requested - -swagger:response createBindLogForwardAccepted -*/ -type CreateBindLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindLogForwardAccepted creates CreateBindLogForwardAccepted with default headers values -func NewCreateBindLogForwardAccepted() *CreateBindLogForwardAccepted { - - return &CreateBindLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the create bind log forward accepted response -func (o *CreateBindLogForwardAccepted) WithReloadID(reloadID string) *CreateBindLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create bind log forward accepted response -func (o *CreateBindLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create bind log forward accepted response -func (o *CreateBindLogForwardAccepted) WithPayload(payload *models.Bind) *CreateBindLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind log forward accepted response -func (o *CreateBindLogForwardAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindLogForwardBadRequestCode is the HTTP code returned for type CreateBindLogForwardBadRequest -const CreateBindLogForwardBadRequestCode int = 400 - -/* -CreateBindLogForwardBadRequest Bad request - -swagger:response createBindLogForwardBadRequest -*/ -type CreateBindLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindLogForwardBadRequest creates CreateBindLogForwardBadRequest with default headers values -func NewCreateBindLogForwardBadRequest() *CreateBindLogForwardBadRequest { - - return &CreateBindLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind log forward bad request response -func (o *CreateBindLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *CreateBindLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind log forward bad request response -func (o *CreateBindLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind log forward bad request response -func (o *CreateBindLogForwardBadRequest) WithPayload(payload *models.Error) *CreateBindLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind log forward bad request response -func (o *CreateBindLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindLogForwardConflictCode is the HTTP code returned for type CreateBindLogForwardConflict -const CreateBindLogForwardConflictCode int = 409 - -/* -CreateBindLogForwardConflict The specified resource already exists - -swagger:response createBindLogForwardConflict -*/ -type CreateBindLogForwardConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindLogForwardConflict creates CreateBindLogForwardConflict with default headers values -func NewCreateBindLogForwardConflict() *CreateBindLogForwardConflict { - - return &CreateBindLogForwardConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind log forward conflict response -func (o *CreateBindLogForwardConflict) WithConfigurationVersion(configurationVersion string) *CreateBindLogForwardConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind log forward conflict response -func (o *CreateBindLogForwardConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind log forward conflict response -func (o *CreateBindLogForwardConflict) WithPayload(payload *models.Error) *CreateBindLogForwardConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind log forward conflict response -func (o *CreateBindLogForwardConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindLogForwardConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateBindLogForwardDefault General Error - -swagger:response createBindLogForwardDefault -*/ -type CreateBindLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindLogForwardDefault creates CreateBindLogForwardDefault with default headers values -func NewCreateBindLogForwardDefault(code int) *CreateBindLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &CreateBindLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create bind log forward default response -func (o *CreateBindLogForwardDefault) WithStatusCode(code int) *CreateBindLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create bind log forward default response -func (o *CreateBindLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create bind log forward default response -func (o *CreateBindLogForwardDefault) WithConfigurationVersion(configurationVersion string) *CreateBindLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind log forward default response -func (o *CreateBindLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind log forward default response -func (o *CreateBindLogForwardDefault) WithPayload(payload *models.Error) *CreateBindLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind log forward default response -func (o *CreateBindLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/create_bind_log_forward_urlbuilder.go b/operations/bind/create_bind_log_forward_urlbuilder.go deleted file mode 100644 index 23b55c70..00000000 --- a/operations/bind/create_bind_log_forward_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateBindLogForwardURL generates an URL for the create bind log forward operation -type CreateBindLogForwardURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindLogForwardURL) WithBasePath(bp string) *CreateBindLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBindLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateBindLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateBindLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateBindLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBindLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBindLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBindLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateBindLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/create_bind_peer.go b/operations/bind/create_bind_peer.go deleted file mode 100644 index e4dd4a47..00000000 --- a/operations/bind/create_bind_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateBindPeerHandlerFunc turns a function with the right signature into a create bind peer handler -type CreateBindPeerHandlerFunc func(CreateBindPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBindPeerHandlerFunc) Handle(params CreateBindPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateBindPeerHandler interface for that can handle valid create bind peer params -type CreateBindPeerHandler interface { - Handle(CreateBindPeerParams, interface{}) middleware.Responder -} - -// NewCreateBindPeer creates a new http.Handler for the create bind peer operation -func NewCreateBindPeer(ctx *middleware.Context, handler CreateBindPeerHandler) *CreateBindPeer { - return &CreateBindPeer{Context: ctx, Handler: handler} -} - -/* - CreateBindPeer swagger:route POST /services/haproxy/configuration/peers/{parent_name}/binds Bind createBindPeer - -# Add a new bind - -Adds a new bind in the specified frontend in the configuration file. -*/ -type CreateBindPeer struct { - Context *middleware.Context - Handler CreateBindPeerHandler -} - -func (o *CreateBindPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBindPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/create_bind_peer_parameters.go b/operations/bind/create_bind_peer_parameters.go deleted file mode 100644 index 34d1976c..00000000 --- a/operations/bind/create_bind_peer_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateBindPeerParams creates a new CreateBindPeerParams object -// with the default values initialized. -func NewCreateBindPeerParams() CreateBindPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateBindPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateBindPeerParams contains all the bound params for the create bind peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters createBindPeer -type CreateBindPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateBindPeerParams() beforehand. -func (o *CreateBindPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateBindPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateBindPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateBindPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateBindPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateBindPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/create_bind_peer_responses.go b/operations/bind/create_bind_peer_responses.go deleted file mode 100644 index 05e819df..00000000 --- a/operations/bind/create_bind_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateBindPeerCreatedCode is the HTTP code returned for type CreateBindPeerCreated -const CreateBindPeerCreatedCode int = 201 - -/* -CreateBindPeerCreated Bind created - -swagger:response createBindPeerCreated -*/ -type CreateBindPeerCreated struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindPeerCreated creates CreateBindPeerCreated with default headers values -func NewCreateBindPeerCreated() *CreateBindPeerCreated { - - return &CreateBindPeerCreated{} -} - -// WithPayload adds the payload to the create bind peer created response -func (o *CreateBindPeerCreated) WithPayload(payload *models.Bind) *CreateBindPeerCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind peer created response -func (o *CreateBindPeerCreated) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindPeerCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindPeerAcceptedCode is the HTTP code returned for type CreateBindPeerAccepted -const CreateBindPeerAcceptedCode int = 202 - -/* -CreateBindPeerAccepted Configuration change accepted and reload requested - -swagger:response createBindPeerAccepted -*/ -type CreateBindPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewCreateBindPeerAccepted creates CreateBindPeerAccepted with default headers values -func NewCreateBindPeerAccepted() *CreateBindPeerAccepted { - - return &CreateBindPeerAccepted{} -} - -// WithReloadID adds the reloadId to the create bind peer accepted response -func (o *CreateBindPeerAccepted) WithReloadID(reloadID string) *CreateBindPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create bind peer accepted response -func (o *CreateBindPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create bind peer accepted response -func (o *CreateBindPeerAccepted) WithPayload(payload *models.Bind) *CreateBindPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind peer accepted response -func (o *CreateBindPeerAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindPeerBadRequestCode is the HTTP code returned for type CreateBindPeerBadRequest -const CreateBindPeerBadRequestCode int = 400 - -/* -CreateBindPeerBadRequest Bad request - -swagger:response createBindPeerBadRequest -*/ -type CreateBindPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindPeerBadRequest creates CreateBindPeerBadRequest with default headers values -func NewCreateBindPeerBadRequest() *CreateBindPeerBadRequest { - - return &CreateBindPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind peer bad request response -func (o *CreateBindPeerBadRequest) WithConfigurationVersion(configurationVersion string) *CreateBindPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind peer bad request response -func (o *CreateBindPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind peer bad request response -func (o *CreateBindPeerBadRequest) WithPayload(payload *models.Error) *CreateBindPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind peer bad request response -func (o *CreateBindPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateBindPeerConflictCode is the HTTP code returned for type CreateBindPeerConflict -const CreateBindPeerConflictCode int = 409 - -/* -CreateBindPeerConflict The specified resource already exists - -swagger:response createBindPeerConflict -*/ -type CreateBindPeerConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindPeerConflict creates CreateBindPeerConflict with default headers values -func NewCreateBindPeerConflict() *CreateBindPeerConflict { - - return &CreateBindPeerConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create bind peer conflict response -func (o *CreateBindPeerConflict) WithConfigurationVersion(configurationVersion string) *CreateBindPeerConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind peer conflict response -func (o *CreateBindPeerConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind peer conflict response -func (o *CreateBindPeerConflict) WithPayload(payload *models.Error) *CreateBindPeerConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind peer conflict response -func (o *CreateBindPeerConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindPeerConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateBindPeerDefault General Error - -swagger:response createBindPeerDefault -*/ -type CreateBindPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateBindPeerDefault creates CreateBindPeerDefault with default headers values -func NewCreateBindPeerDefault(code int) *CreateBindPeerDefault { - if code <= 0 { - code = 500 - } - - return &CreateBindPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create bind peer default response -func (o *CreateBindPeerDefault) WithStatusCode(code int) *CreateBindPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create bind peer default response -func (o *CreateBindPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create bind peer default response -func (o *CreateBindPeerDefault) WithConfigurationVersion(configurationVersion string) *CreateBindPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create bind peer default response -func (o *CreateBindPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create bind peer default response -func (o *CreateBindPeerDefault) WithPayload(payload *models.Error) *CreateBindPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bind peer default response -func (o *CreateBindPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBindPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/create_bind_peer_urlbuilder.go b/operations/bind/create_bind_peer_urlbuilder.go deleted file mode 100644 index 76d4788a..00000000 --- a/operations/bind/create_bind_peer_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateBindPeerURL generates an URL for the create bind peer operation -type CreateBindPeerURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindPeerURL) WithBasePath(bp string) *CreateBindPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateBindPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBindPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateBindPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateBindPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateBindPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBindPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBindPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBindPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateBindPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/delete_bind_frontend.go b/operations/bind/delete_bind_frontend.go deleted file mode 100644 index aebef8c3..00000000 --- a/operations/bind/delete_bind_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteBindFrontendHandlerFunc turns a function with the right signature into a delete bind frontend handler -type DeleteBindFrontendHandlerFunc func(DeleteBindFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBindFrontendHandlerFunc) Handle(params DeleteBindFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteBindFrontendHandler interface for that can handle valid delete bind frontend params -type DeleteBindFrontendHandler interface { - Handle(DeleteBindFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteBindFrontend creates a new http.Handler for the delete bind frontend operation -func NewDeleteBindFrontend(ctx *middleware.Context, handler DeleteBindFrontendHandler) *DeleteBindFrontend { - return &DeleteBindFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteBindFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/binds/{name} Bind deleteBindFrontend - -# Delete a bind - -Deletes a bind configuration by it's name in the specified frontend. -*/ -type DeleteBindFrontend struct { - Context *middleware.Context - Handler DeleteBindFrontendHandler -} - -func (o *DeleteBindFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBindFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/delete_bind_frontend_parameters.go b/operations/bind/delete_bind_frontend_parameters.go deleted file mode 100644 index d50810b8..00000000 --- a/operations/bind/delete_bind_frontend_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteBindFrontendParams creates a new DeleteBindFrontendParams object -// with the default values initialized. -func NewDeleteBindFrontendParams() DeleteBindFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteBindFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteBindFrontendParams contains all the bound params for the delete bind frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteBindFrontend -type DeleteBindFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteBindFrontendParams() beforehand. -func (o *DeleteBindFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteBindFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteBindFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteBindFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteBindFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteBindFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteBindFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/delete_bind_frontend_responses.go b/operations/bind/delete_bind_frontend_responses.go deleted file mode 100644 index fb08da1f..00000000 --- a/operations/bind/delete_bind_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteBindFrontendAcceptedCode is the HTTP code returned for type DeleteBindFrontendAccepted -const DeleteBindFrontendAcceptedCode int = 202 - -/* -DeleteBindFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteBindFrontendAccepted -*/ -type DeleteBindFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteBindFrontendAccepted creates DeleteBindFrontendAccepted with default headers values -func NewDeleteBindFrontendAccepted() *DeleteBindFrontendAccepted { - - return &DeleteBindFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete bind frontend accepted response -func (o *DeleteBindFrontendAccepted) WithReloadID(reloadID string) *DeleteBindFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete bind frontend accepted response -func (o *DeleteBindFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteBindFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteBindFrontendNoContentCode is the HTTP code returned for type DeleteBindFrontendNoContent -const DeleteBindFrontendNoContentCode int = 204 - -/* -DeleteBindFrontendNoContent Bind deleted - -swagger:response deleteBindFrontendNoContent -*/ -type DeleteBindFrontendNoContent struct { -} - -// NewDeleteBindFrontendNoContent creates DeleteBindFrontendNoContent with default headers values -func NewDeleteBindFrontendNoContent() *DeleteBindFrontendNoContent { - - return &DeleteBindFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBindFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteBindFrontendNotFoundCode is the HTTP code returned for type DeleteBindFrontendNotFound -const DeleteBindFrontendNotFoundCode int = 404 - -/* -DeleteBindFrontendNotFound The specified resource was not found - -swagger:response deleteBindFrontendNotFound -*/ -type DeleteBindFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindFrontendNotFound creates DeleteBindFrontendNotFound with default headers values -func NewDeleteBindFrontendNotFound() *DeleteBindFrontendNotFound { - - return &DeleteBindFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind frontend not found response -func (o *DeleteBindFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteBindFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind frontend not found response -func (o *DeleteBindFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind frontend not found response -func (o *DeleteBindFrontendNotFound) WithPayload(payload *models.Error) *DeleteBindFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind frontend not found response -func (o *DeleteBindFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteBindFrontendDefault General Error - -swagger:response deleteBindFrontendDefault -*/ -type DeleteBindFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindFrontendDefault creates DeleteBindFrontendDefault with default headers values -func NewDeleteBindFrontendDefault(code int) *DeleteBindFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBindFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) WithStatusCode(code int) *DeleteBindFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteBindFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) WithPayload(payload *models.Error) *DeleteBindFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind frontend default response -func (o *DeleteBindFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/delete_bind_frontend_urlbuilder.go b/operations/bind/delete_bind_frontend_urlbuilder.go deleted file mode 100644 index 4a68f891..00000000 --- a/operations/bind/delete_bind_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteBindFrontendURL generates an URL for the delete bind frontend operation -type DeleteBindFrontendURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindFrontendURL) WithBasePath(bp string) *DeleteBindFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBindFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteBindFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteBindFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteBindFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteBindFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBindFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBindFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBindFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteBindFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/delete_bind_log_forward.go b/operations/bind/delete_bind_log_forward.go deleted file mode 100644 index 010b0328..00000000 --- a/operations/bind/delete_bind_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteBindLogForwardHandlerFunc turns a function with the right signature into a delete bind log forward handler -type DeleteBindLogForwardHandlerFunc func(DeleteBindLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBindLogForwardHandlerFunc) Handle(params DeleteBindLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteBindLogForwardHandler interface for that can handle valid delete bind log forward params -type DeleteBindLogForwardHandler interface { - Handle(DeleteBindLogForwardParams, interface{}) middleware.Responder -} - -// NewDeleteBindLogForward creates a new http.Handler for the delete bind log forward operation -func NewDeleteBindLogForward(ctx *middleware.Context, handler DeleteBindLogForwardHandler) *DeleteBindLogForward { - return &DeleteBindLogForward{Context: ctx, Handler: handler} -} - -/* - DeleteBindLogForward swagger:route DELETE /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name} Bind deleteBindLogForward - -# Delete a bind - -Deletes a bind configuration by it's name in the specified frontend. -*/ -type DeleteBindLogForward struct { - Context *middleware.Context - Handler DeleteBindLogForwardHandler -} - -func (o *DeleteBindLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBindLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/delete_bind_log_forward_parameters.go b/operations/bind/delete_bind_log_forward_parameters.go deleted file mode 100644 index 337ceb87..00000000 --- a/operations/bind/delete_bind_log_forward_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteBindLogForwardParams creates a new DeleteBindLogForwardParams object -// with the default values initialized. -func NewDeleteBindLogForwardParams() DeleteBindLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteBindLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteBindLogForwardParams contains all the bound params for the delete bind log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteBindLogForward -type DeleteBindLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteBindLogForwardParams() beforehand. -func (o *DeleteBindLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteBindLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteBindLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteBindLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteBindLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteBindLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteBindLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/delete_bind_log_forward_responses.go b/operations/bind/delete_bind_log_forward_responses.go deleted file mode 100644 index b9ebb576..00000000 --- a/operations/bind/delete_bind_log_forward_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteBindLogForwardAcceptedCode is the HTTP code returned for type DeleteBindLogForwardAccepted -const DeleteBindLogForwardAcceptedCode int = 202 - -/* -DeleteBindLogForwardAccepted Configuration change accepted and reload requested - -swagger:response deleteBindLogForwardAccepted -*/ -type DeleteBindLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteBindLogForwardAccepted creates DeleteBindLogForwardAccepted with default headers values -func NewDeleteBindLogForwardAccepted() *DeleteBindLogForwardAccepted { - - return &DeleteBindLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the delete bind log forward accepted response -func (o *DeleteBindLogForwardAccepted) WithReloadID(reloadID string) *DeleteBindLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete bind log forward accepted response -func (o *DeleteBindLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteBindLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteBindLogForwardNoContentCode is the HTTP code returned for type DeleteBindLogForwardNoContent -const DeleteBindLogForwardNoContentCode int = 204 - -/* -DeleteBindLogForwardNoContent Bind deleted - -swagger:response deleteBindLogForwardNoContent -*/ -type DeleteBindLogForwardNoContent struct { -} - -// NewDeleteBindLogForwardNoContent creates DeleteBindLogForwardNoContent with default headers values -func NewDeleteBindLogForwardNoContent() *DeleteBindLogForwardNoContent { - - return &DeleteBindLogForwardNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBindLogForwardNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteBindLogForwardNotFoundCode is the HTTP code returned for type DeleteBindLogForwardNotFound -const DeleteBindLogForwardNotFoundCode int = 404 - -/* -DeleteBindLogForwardNotFound The specified resource was not found - -swagger:response deleteBindLogForwardNotFound -*/ -type DeleteBindLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindLogForwardNotFound creates DeleteBindLogForwardNotFound with default headers values -func NewDeleteBindLogForwardNotFound() *DeleteBindLogForwardNotFound { - - return &DeleteBindLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind log forward not found response -func (o *DeleteBindLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *DeleteBindLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind log forward not found response -func (o *DeleteBindLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind log forward not found response -func (o *DeleteBindLogForwardNotFound) WithPayload(payload *models.Error) *DeleteBindLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind log forward not found response -func (o *DeleteBindLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteBindLogForwardDefault General Error - -swagger:response deleteBindLogForwardDefault -*/ -type DeleteBindLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindLogForwardDefault creates DeleteBindLogForwardDefault with default headers values -func NewDeleteBindLogForwardDefault(code int) *DeleteBindLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBindLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) WithStatusCode(code int) *DeleteBindLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) WithConfigurationVersion(configurationVersion string) *DeleteBindLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) WithPayload(payload *models.Error) *DeleteBindLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind log forward default response -func (o *DeleteBindLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/delete_bind_log_forward_urlbuilder.go b/operations/bind/delete_bind_log_forward_urlbuilder.go deleted file mode 100644 index b290caa2..00000000 --- a/operations/bind/delete_bind_log_forward_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteBindLogForwardURL generates an URL for the delete bind log forward operation -type DeleteBindLogForwardURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindLogForwardURL) WithBasePath(bp string) *DeleteBindLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBindLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteBindLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteBindLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteBindLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteBindLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBindLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBindLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBindLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteBindLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/delete_bind_peer.go b/operations/bind/delete_bind_peer.go deleted file mode 100644 index 1aac9921..00000000 --- a/operations/bind/delete_bind_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteBindPeerHandlerFunc turns a function with the right signature into a delete bind peer handler -type DeleteBindPeerHandlerFunc func(DeleteBindPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBindPeerHandlerFunc) Handle(params DeleteBindPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteBindPeerHandler interface for that can handle valid delete bind peer params -type DeleteBindPeerHandler interface { - Handle(DeleteBindPeerParams, interface{}) middleware.Responder -} - -// NewDeleteBindPeer creates a new http.Handler for the delete bind peer operation -func NewDeleteBindPeer(ctx *middleware.Context, handler DeleteBindPeerHandler) *DeleteBindPeer { - return &DeleteBindPeer{Context: ctx, Handler: handler} -} - -/* - DeleteBindPeer swagger:route DELETE /services/haproxy/configuration/peers/{parent_name}/binds/{name} Bind deleteBindPeer - -# Delete a bind - -Deletes a bind configuration by it's name in the specified frontend. -*/ -type DeleteBindPeer struct { - Context *middleware.Context - Handler DeleteBindPeerHandler -} - -func (o *DeleteBindPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBindPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/delete_bind_peer_parameters.go b/operations/bind/delete_bind_peer_parameters.go deleted file mode 100644 index 9bbfd248..00000000 --- a/operations/bind/delete_bind_peer_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteBindPeerParams creates a new DeleteBindPeerParams object -// with the default values initialized. -func NewDeleteBindPeerParams() DeleteBindPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteBindPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteBindPeerParams contains all the bound params for the delete bind peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteBindPeer -type DeleteBindPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteBindPeerParams() beforehand. -func (o *DeleteBindPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteBindPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteBindPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteBindPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteBindPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteBindPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteBindPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/delete_bind_peer_responses.go b/operations/bind/delete_bind_peer_responses.go deleted file mode 100644 index f438f5bf..00000000 --- a/operations/bind/delete_bind_peer_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteBindPeerAcceptedCode is the HTTP code returned for type DeleteBindPeerAccepted -const DeleteBindPeerAcceptedCode int = 202 - -/* -DeleteBindPeerAccepted Configuration change accepted and reload requested - -swagger:response deleteBindPeerAccepted -*/ -type DeleteBindPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteBindPeerAccepted creates DeleteBindPeerAccepted with default headers values -func NewDeleteBindPeerAccepted() *DeleteBindPeerAccepted { - - return &DeleteBindPeerAccepted{} -} - -// WithReloadID adds the reloadId to the delete bind peer accepted response -func (o *DeleteBindPeerAccepted) WithReloadID(reloadID string) *DeleteBindPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete bind peer accepted response -func (o *DeleteBindPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteBindPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteBindPeerNoContentCode is the HTTP code returned for type DeleteBindPeerNoContent -const DeleteBindPeerNoContentCode int = 204 - -/* -DeleteBindPeerNoContent Bind deleted - -swagger:response deleteBindPeerNoContent -*/ -type DeleteBindPeerNoContent struct { -} - -// NewDeleteBindPeerNoContent creates DeleteBindPeerNoContent with default headers values -func NewDeleteBindPeerNoContent() *DeleteBindPeerNoContent { - - return &DeleteBindPeerNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBindPeerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteBindPeerNotFoundCode is the HTTP code returned for type DeleteBindPeerNotFound -const DeleteBindPeerNotFoundCode int = 404 - -/* -DeleteBindPeerNotFound The specified resource was not found - -swagger:response deleteBindPeerNotFound -*/ -type DeleteBindPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindPeerNotFound creates DeleteBindPeerNotFound with default headers values -func NewDeleteBindPeerNotFound() *DeleteBindPeerNotFound { - - return &DeleteBindPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind peer not found response -func (o *DeleteBindPeerNotFound) WithConfigurationVersion(configurationVersion string) *DeleteBindPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind peer not found response -func (o *DeleteBindPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind peer not found response -func (o *DeleteBindPeerNotFound) WithPayload(payload *models.Error) *DeleteBindPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind peer not found response -func (o *DeleteBindPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteBindPeerDefault General Error - -swagger:response deleteBindPeerDefault -*/ -type DeleteBindPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteBindPeerDefault creates DeleteBindPeerDefault with default headers values -func NewDeleteBindPeerDefault(code int) *DeleteBindPeerDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBindPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bind peer default response -func (o *DeleteBindPeerDefault) WithStatusCode(code int) *DeleteBindPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bind peer default response -func (o *DeleteBindPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete bind peer default response -func (o *DeleteBindPeerDefault) WithConfigurationVersion(configurationVersion string) *DeleteBindPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete bind peer default response -func (o *DeleteBindPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete bind peer default response -func (o *DeleteBindPeerDefault) WithPayload(payload *models.Error) *DeleteBindPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bind peer default response -func (o *DeleteBindPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBindPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/delete_bind_peer_urlbuilder.go b/operations/bind/delete_bind_peer_urlbuilder.go deleted file mode 100644 index 4c5a0974..00000000 --- a/operations/bind/delete_bind_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteBindPeerURL generates an URL for the delete bind peer operation -type DeleteBindPeerURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindPeerURL) WithBasePath(bp string) *DeleteBindPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteBindPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBindPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteBindPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteBindPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteBindPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteBindPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBindPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBindPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBindPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteBindPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_all_bind_frontend.go b/operations/bind/get_all_bind_frontend.go deleted file mode 100644 index b9988724..00000000 --- a/operations/bind/get_all_bind_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllBindFrontendHandlerFunc turns a function with the right signature into a get all bind frontend handler -type GetAllBindFrontendHandlerFunc func(GetAllBindFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllBindFrontendHandlerFunc) Handle(params GetAllBindFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllBindFrontendHandler interface for that can handle valid get all bind frontend params -type GetAllBindFrontendHandler interface { - Handle(GetAllBindFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllBindFrontend creates a new http.Handler for the get all bind frontend operation -func NewGetAllBindFrontend(ctx *middleware.Context, handler GetAllBindFrontendHandler) *GetAllBindFrontend { - return &GetAllBindFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllBindFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/binds Bind getAllBindFrontend - -# Return an array of binds - -Returns an array of all binds that are configured in specified frontend. -*/ -type GetAllBindFrontend struct { - Context *middleware.Context - Handler GetAllBindFrontendHandler -} - -func (o *GetAllBindFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllBindFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_all_bind_frontend_parameters.go b/operations/bind/get_all_bind_frontend_parameters.go deleted file mode 100644 index 69fb9cde..00000000 --- a/operations/bind/get_all_bind_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllBindFrontendParams creates a new GetAllBindFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllBindFrontendParams() GetAllBindFrontendParams { - - return GetAllBindFrontendParams{} -} - -// GetAllBindFrontendParams contains all the bound params for the get all bind frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllBindFrontend -type GetAllBindFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllBindFrontendParams() beforehand. -func (o *GetAllBindFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllBindFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllBindFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_all_bind_frontend_responses.go b/operations/bind/get_all_bind_frontend_responses.go deleted file mode 100644 index 3b3e2098..00000000 --- a/operations/bind/get_all_bind_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllBindFrontendOKCode is the HTTP code returned for type GetAllBindFrontendOK -const GetAllBindFrontendOKCode int = 200 - -/* -GetAllBindFrontendOK Successful operation - -swagger:response getAllBindFrontendOK -*/ -type GetAllBindFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Binds `json:"body,omitempty"` -} - -// NewGetAllBindFrontendOK creates GetAllBindFrontendOK with default headers values -func NewGetAllBindFrontendOK() *GetAllBindFrontendOK { - - return &GetAllBindFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind frontend o k response -func (o *GetAllBindFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllBindFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind frontend o k response -func (o *GetAllBindFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind frontend o k response -func (o *GetAllBindFrontendOK) WithPayload(payload models.Binds) *GetAllBindFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind frontend o k response -func (o *GetAllBindFrontendOK) SetPayload(payload models.Binds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Binds{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllBindFrontendDefault General Error - -swagger:response getAllBindFrontendDefault -*/ -type GetAllBindFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllBindFrontendDefault creates GetAllBindFrontendDefault with default headers values -func NewGetAllBindFrontendDefault(code int) *GetAllBindFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllBindFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) WithStatusCode(code int) *GetAllBindFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllBindFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) WithPayload(payload *models.Error) *GetAllBindFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind frontend default response -func (o *GetAllBindFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_all_bind_frontend_urlbuilder.go b/operations/bind/get_all_bind_frontend_urlbuilder.go deleted file mode 100644 index 0e5b505d..00000000 --- a/operations/bind/get_all_bind_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllBindFrontendURL generates an URL for the get all bind frontend operation -type GetAllBindFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindFrontendURL) WithBasePath(bp string) *GetAllBindFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllBindFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllBindFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllBindFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllBindFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllBindFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllBindFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllBindFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllBindFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_all_bind_log_forward.go b/operations/bind/get_all_bind_log_forward.go deleted file mode 100644 index dd1c38f1..00000000 --- a/operations/bind/get_all_bind_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllBindLogForwardHandlerFunc turns a function with the right signature into a get all bind log forward handler -type GetAllBindLogForwardHandlerFunc func(GetAllBindLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllBindLogForwardHandlerFunc) Handle(params GetAllBindLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllBindLogForwardHandler interface for that can handle valid get all bind log forward params -type GetAllBindLogForwardHandler interface { - Handle(GetAllBindLogForwardParams, interface{}) middleware.Responder -} - -// NewGetAllBindLogForward creates a new http.Handler for the get all bind log forward operation -func NewGetAllBindLogForward(ctx *middleware.Context, handler GetAllBindLogForwardHandler) *GetAllBindLogForward { - return &GetAllBindLogForward{Context: ctx, Handler: handler} -} - -/* - GetAllBindLogForward swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/binds Bind getAllBindLogForward - -# Return an array of binds - -Returns an array of all binds that are configured in specified frontend. -*/ -type GetAllBindLogForward struct { - Context *middleware.Context - Handler GetAllBindLogForwardHandler -} - -func (o *GetAllBindLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllBindLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_all_bind_log_forward_parameters.go b/operations/bind/get_all_bind_log_forward_parameters.go deleted file mode 100644 index 1559a030..00000000 --- a/operations/bind/get_all_bind_log_forward_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllBindLogForwardParams creates a new GetAllBindLogForwardParams object -// -// There are no default values defined in the spec. -func NewGetAllBindLogForwardParams() GetAllBindLogForwardParams { - - return GetAllBindLogForwardParams{} -} - -// GetAllBindLogForwardParams contains all the bound params for the get all bind log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllBindLogForward -type GetAllBindLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllBindLogForwardParams() beforehand. -func (o *GetAllBindLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllBindLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllBindLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_all_bind_log_forward_responses.go b/operations/bind/get_all_bind_log_forward_responses.go deleted file mode 100644 index a878f46b..00000000 --- a/operations/bind/get_all_bind_log_forward_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllBindLogForwardOKCode is the HTTP code returned for type GetAllBindLogForwardOK -const GetAllBindLogForwardOKCode int = 200 - -/* -GetAllBindLogForwardOK Successful operation - -swagger:response getAllBindLogForwardOK -*/ -type GetAllBindLogForwardOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Binds `json:"body,omitempty"` -} - -// NewGetAllBindLogForwardOK creates GetAllBindLogForwardOK with default headers values -func NewGetAllBindLogForwardOK() *GetAllBindLogForwardOK { - - return &GetAllBindLogForwardOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind log forward o k response -func (o *GetAllBindLogForwardOK) WithConfigurationVersion(configurationVersion string) *GetAllBindLogForwardOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind log forward o k response -func (o *GetAllBindLogForwardOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind log forward o k response -func (o *GetAllBindLogForwardOK) WithPayload(payload models.Binds) *GetAllBindLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind log forward o k response -func (o *GetAllBindLogForwardOK) SetPayload(payload models.Binds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Binds{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllBindLogForwardDefault General Error - -swagger:response getAllBindLogForwardDefault -*/ -type GetAllBindLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllBindLogForwardDefault creates GetAllBindLogForwardDefault with default headers values -func NewGetAllBindLogForwardDefault(code int) *GetAllBindLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &GetAllBindLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) WithStatusCode(code int) *GetAllBindLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) WithConfigurationVersion(configurationVersion string) *GetAllBindLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) WithPayload(payload *models.Error) *GetAllBindLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind log forward default response -func (o *GetAllBindLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_all_bind_log_forward_urlbuilder.go b/operations/bind/get_all_bind_log_forward_urlbuilder.go deleted file mode 100644 index 41cf3525..00000000 --- a/operations/bind/get_all_bind_log_forward_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllBindLogForwardURL generates an URL for the get all bind log forward operation -type GetAllBindLogForwardURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindLogForwardURL) WithBasePath(bp string) *GetAllBindLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllBindLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllBindLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllBindLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllBindLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllBindLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllBindLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllBindLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllBindLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_all_bind_peer.go b/operations/bind/get_all_bind_peer.go deleted file mode 100644 index 86de2e09..00000000 --- a/operations/bind/get_all_bind_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllBindPeerHandlerFunc turns a function with the right signature into a get all bind peer handler -type GetAllBindPeerHandlerFunc func(GetAllBindPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllBindPeerHandlerFunc) Handle(params GetAllBindPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllBindPeerHandler interface for that can handle valid get all bind peer params -type GetAllBindPeerHandler interface { - Handle(GetAllBindPeerParams, interface{}) middleware.Responder -} - -// NewGetAllBindPeer creates a new http.Handler for the get all bind peer operation -func NewGetAllBindPeer(ctx *middleware.Context, handler GetAllBindPeerHandler) *GetAllBindPeer { - return &GetAllBindPeer{Context: ctx, Handler: handler} -} - -/* - GetAllBindPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/binds Bind getAllBindPeer - -# Return an array of binds - -Returns an array of all binds that are configured in specified frontend. -*/ -type GetAllBindPeer struct { - Context *middleware.Context - Handler GetAllBindPeerHandler -} - -func (o *GetAllBindPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllBindPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_all_bind_peer_parameters.go b/operations/bind/get_all_bind_peer_parameters.go deleted file mode 100644 index 38fedf4a..00000000 --- a/operations/bind/get_all_bind_peer_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllBindPeerParams creates a new GetAllBindPeerParams object -// -// There are no default values defined in the spec. -func NewGetAllBindPeerParams() GetAllBindPeerParams { - - return GetAllBindPeerParams{} -} - -// GetAllBindPeerParams contains all the bound params for the get all bind peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllBindPeer -type GetAllBindPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllBindPeerParams() beforehand. -func (o *GetAllBindPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllBindPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllBindPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_all_bind_peer_responses.go b/operations/bind/get_all_bind_peer_responses.go deleted file mode 100644 index 53f39b0e..00000000 --- a/operations/bind/get_all_bind_peer_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllBindPeerOKCode is the HTTP code returned for type GetAllBindPeerOK -const GetAllBindPeerOKCode int = 200 - -/* -GetAllBindPeerOK Successful operation - -swagger:response getAllBindPeerOK -*/ -type GetAllBindPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Binds `json:"body,omitempty"` -} - -// NewGetAllBindPeerOK creates GetAllBindPeerOK with default headers values -func NewGetAllBindPeerOK() *GetAllBindPeerOK { - - return &GetAllBindPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind peer o k response -func (o *GetAllBindPeerOK) WithConfigurationVersion(configurationVersion string) *GetAllBindPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind peer o k response -func (o *GetAllBindPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind peer o k response -func (o *GetAllBindPeerOK) WithPayload(payload models.Binds) *GetAllBindPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind peer o k response -func (o *GetAllBindPeerOK) SetPayload(payload models.Binds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Binds{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllBindPeerDefault General Error - -swagger:response getAllBindPeerDefault -*/ -type GetAllBindPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllBindPeerDefault creates GetAllBindPeerDefault with default headers values -func NewGetAllBindPeerDefault(code int) *GetAllBindPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetAllBindPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all bind peer default response -func (o *GetAllBindPeerDefault) WithStatusCode(code int) *GetAllBindPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all bind peer default response -func (o *GetAllBindPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all bind peer default response -func (o *GetAllBindPeerDefault) WithConfigurationVersion(configurationVersion string) *GetAllBindPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all bind peer default response -func (o *GetAllBindPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all bind peer default response -func (o *GetAllBindPeerDefault) WithPayload(payload *models.Error) *GetAllBindPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all bind peer default response -func (o *GetAllBindPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllBindPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_all_bind_peer_urlbuilder.go b/operations/bind/get_all_bind_peer_urlbuilder.go deleted file mode 100644 index 61b0ada7..00000000 --- a/operations/bind/get_all_bind_peer_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllBindPeerURL generates an URL for the get all bind peer operation -type GetAllBindPeerURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindPeerURL) WithBasePath(bp string) *GetAllBindPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllBindPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllBindPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllBindPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllBindPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllBindPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllBindPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllBindPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllBindPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllBindPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_bind_frontend.go b/operations/bind/get_bind_frontend.go deleted file mode 100644 index 1355753c..00000000 --- a/operations/bind/get_bind_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBindFrontendHandlerFunc turns a function with the right signature into a get bind frontend handler -type GetBindFrontendHandlerFunc func(GetBindFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBindFrontendHandlerFunc) Handle(params GetBindFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBindFrontendHandler interface for that can handle valid get bind frontend params -type GetBindFrontendHandler interface { - Handle(GetBindFrontendParams, interface{}) middleware.Responder -} - -// NewGetBindFrontend creates a new http.Handler for the get bind frontend operation -func NewGetBindFrontend(ctx *middleware.Context, handler GetBindFrontendHandler) *GetBindFrontend { - return &GetBindFrontend{Context: ctx, Handler: handler} -} - -/* - GetBindFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/binds/{name} Bind getBindFrontend - -# Return one bind - -Returns one bind configuration by it's name in the specified frontend. -*/ -type GetBindFrontend struct { - Context *middleware.Context - Handler GetBindFrontendHandler -} - -func (o *GetBindFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBindFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_bind_frontend_parameters.go b/operations/bind/get_bind_frontend_parameters.go deleted file mode 100644 index d321c349..00000000 --- a/operations/bind/get_bind_frontend_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetBindFrontendParams creates a new GetBindFrontendParams object -// -// There are no default values defined in the spec. -func NewGetBindFrontendParams() GetBindFrontendParams { - - return GetBindFrontendParams{} -} - -// GetBindFrontendParams contains all the bound params for the get bind frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBindFrontend -type GetBindFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBindFrontendParams() beforehand. -func (o *GetBindFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetBindFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetBindFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBindFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_bind_frontend_responses.go b/operations/bind/get_bind_frontend_responses.go deleted file mode 100644 index 43bd642e..00000000 --- a/operations/bind/get_bind_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBindFrontendOKCode is the HTTP code returned for type GetBindFrontendOK -const GetBindFrontendOKCode int = 200 - -/* -GetBindFrontendOK Successful operation - -swagger:response getBindFrontendOK -*/ -type GetBindFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewGetBindFrontendOK creates GetBindFrontendOK with default headers values -func NewGetBindFrontendOK() *GetBindFrontendOK { - - return &GetBindFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind frontend o k response -func (o *GetBindFrontendOK) WithConfigurationVersion(configurationVersion string) *GetBindFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind frontend o k response -func (o *GetBindFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind frontend o k response -func (o *GetBindFrontendOK) WithPayload(payload *models.Bind) *GetBindFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind frontend o k response -func (o *GetBindFrontendOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetBindFrontendNotFoundCode is the HTTP code returned for type GetBindFrontendNotFound -const GetBindFrontendNotFoundCode int = 404 - -/* -GetBindFrontendNotFound The specified resource already exists - -swagger:response getBindFrontendNotFound -*/ -type GetBindFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindFrontendNotFound creates GetBindFrontendNotFound with default headers values -func NewGetBindFrontendNotFound() *GetBindFrontendNotFound { - - return &GetBindFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind frontend not found response -func (o *GetBindFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetBindFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind frontend not found response -func (o *GetBindFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind frontend not found response -func (o *GetBindFrontendNotFound) WithPayload(payload *models.Error) *GetBindFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind frontend not found response -func (o *GetBindFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetBindFrontendDefault General Error - -swagger:response getBindFrontendDefault -*/ -type GetBindFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindFrontendDefault creates GetBindFrontendDefault with default headers values -func NewGetBindFrontendDefault(code int) *GetBindFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetBindFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bind frontend default response -func (o *GetBindFrontendDefault) WithStatusCode(code int) *GetBindFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bind frontend default response -func (o *GetBindFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get bind frontend default response -func (o *GetBindFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetBindFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind frontend default response -func (o *GetBindFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind frontend default response -func (o *GetBindFrontendDefault) WithPayload(payload *models.Error) *GetBindFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind frontend default response -func (o *GetBindFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_bind_frontend_urlbuilder.go b/operations/bind/get_bind_frontend_urlbuilder.go deleted file mode 100644 index 88e32580..00000000 --- a/operations/bind/get_bind_frontend_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetBindFrontendURL generates an URL for the get bind frontend operation -type GetBindFrontendURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindFrontendURL) WithBasePath(bp string) *GetBindFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBindFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetBindFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetBindFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBindFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBindFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBindFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBindFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBindFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBindFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_bind_log_forward.go b/operations/bind/get_bind_log_forward.go deleted file mode 100644 index e78f5cd8..00000000 --- a/operations/bind/get_bind_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBindLogForwardHandlerFunc turns a function with the right signature into a get bind log forward handler -type GetBindLogForwardHandlerFunc func(GetBindLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBindLogForwardHandlerFunc) Handle(params GetBindLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBindLogForwardHandler interface for that can handle valid get bind log forward params -type GetBindLogForwardHandler interface { - Handle(GetBindLogForwardParams, interface{}) middleware.Responder -} - -// NewGetBindLogForward creates a new http.Handler for the get bind log forward operation -func NewGetBindLogForward(ctx *middleware.Context, handler GetBindLogForwardHandler) *GetBindLogForward { - return &GetBindLogForward{Context: ctx, Handler: handler} -} - -/* - GetBindLogForward swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name} Bind getBindLogForward - -# Return one bind - -Returns one bind configuration by it's name in the specified frontend. -*/ -type GetBindLogForward struct { - Context *middleware.Context - Handler GetBindLogForwardHandler -} - -func (o *GetBindLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBindLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_bind_log_forward_parameters.go b/operations/bind/get_bind_log_forward_parameters.go deleted file mode 100644 index d3f4e63f..00000000 --- a/operations/bind/get_bind_log_forward_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetBindLogForwardParams creates a new GetBindLogForwardParams object -// -// There are no default values defined in the spec. -func NewGetBindLogForwardParams() GetBindLogForwardParams { - - return GetBindLogForwardParams{} -} - -// GetBindLogForwardParams contains all the bound params for the get bind log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBindLogForward -type GetBindLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBindLogForwardParams() beforehand. -func (o *GetBindLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetBindLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetBindLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBindLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_bind_log_forward_responses.go b/operations/bind/get_bind_log_forward_responses.go deleted file mode 100644 index a46d7085..00000000 --- a/operations/bind/get_bind_log_forward_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBindLogForwardOKCode is the HTTP code returned for type GetBindLogForwardOK -const GetBindLogForwardOKCode int = 200 - -/* -GetBindLogForwardOK Successful operation - -swagger:response getBindLogForwardOK -*/ -type GetBindLogForwardOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewGetBindLogForwardOK creates GetBindLogForwardOK with default headers values -func NewGetBindLogForwardOK() *GetBindLogForwardOK { - - return &GetBindLogForwardOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind log forward o k response -func (o *GetBindLogForwardOK) WithConfigurationVersion(configurationVersion string) *GetBindLogForwardOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind log forward o k response -func (o *GetBindLogForwardOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind log forward o k response -func (o *GetBindLogForwardOK) WithPayload(payload *models.Bind) *GetBindLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind log forward o k response -func (o *GetBindLogForwardOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetBindLogForwardNotFoundCode is the HTTP code returned for type GetBindLogForwardNotFound -const GetBindLogForwardNotFoundCode int = 404 - -/* -GetBindLogForwardNotFound The specified resource already exists - -swagger:response getBindLogForwardNotFound -*/ -type GetBindLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindLogForwardNotFound creates GetBindLogForwardNotFound with default headers values -func NewGetBindLogForwardNotFound() *GetBindLogForwardNotFound { - - return &GetBindLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind log forward not found response -func (o *GetBindLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *GetBindLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind log forward not found response -func (o *GetBindLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind log forward not found response -func (o *GetBindLogForwardNotFound) WithPayload(payload *models.Error) *GetBindLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind log forward not found response -func (o *GetBindLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetBindLogForwardDefault General Error - -swagger:response getBindLogForwardDefault -*/ -type GetBindLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindLogForwardDefault creates GetBindLogForwardDefault with default headers values -func NewGetBindLogForwardDefault(code int) *GetBindLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &GetBindLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bind log forward default response -func (o *GetBindLogForwardDefault) WithStatusCode(code int) *GetBindLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bind log forward default response -func (o *GetBindLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get bind log forward default response -func (o *GetBindLogForwardDefault) WithConfigurationVersion(configurationVersion string) *GetBindLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind log forward default response -func (o *GetBindLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind log forward default response -func (o *GetBindLogForwardDefault) WithPayload(payload *models.Error) *GetBindLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind log forward default response -func (o *GetBindLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_bind_log_forward_urlbuilder.go b/operations/bind/get_bind_log_forward_urlbuilder.go deleted file mode 100644 index b2434e90..00000000 --- a/operations/bind/get_bind_log_forward_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetBindLogForwardURL generates an URL for the get bind log forward operation -type GetBindLogForwardURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindLogForwardURL) WithBasePath(bp string) *GetBindLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBindLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetBindLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetBindLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBindLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBindLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBindLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBindLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBindLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBindLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/get_bind_peer.go b/operations/bind/get_bind_peer.go deleted file mode 100644 index 87011428..00000000 --- a/operations/bind/get_bind_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetBindPeerHandlerFunc turns a function with the right signature into a get bind peer handler -type GetBindPeerHandlerFunc func(GetBindPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBindPeerHandlerFunc) Handle(params GetBindPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetBindPeerHandler interface for that can handle valid get bind peer params -type GetBindPeerHandler interface { - Handle(GetBindPeerParams, interface{}) middleware.Responder -} - -// NewGetBindPeer creates a new http.Handler for the get bind peer operation -func NewGetBindPeer(ctx *middleware.Context, handler GetBindPeerHandler) *GetBindPeer { - return &GetBindPeer{Context: ctx, Handler: handler} -} - -/* - GetBindPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/binds/{name} Bind getBindPeer - -# Return one bind - -Returns one bind configuration by it's name in the specified frontend. -*/ -type GetBindPeer struct { - Context *middleware.Context - Handler GetBindPeerHandler -} - -func (o *GetBindPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBindPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/get_bind_peer_parameters.go b/operations/bind/get_bind_peer_parameters.go deleted file mode 100644 index 11b4d84d..00000000 --- a/operations/bind/get_bind_peer_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetBindPeerParams creates a new GetBindPeerParams object -// -// There are no default values defined in the spec. -func NewGetBindPeerParams() GetBindPeerParams { - - return GetBindPeerParams{} -} - -// GetBindPeerParams contains all the bound params for the get bind peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getBindPeer -type GetBindPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetBindPeerParams() beforehand. -func (o *GetBindPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetBindPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetBindPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetBindPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/bind/get_bind_peer_responses.go b/operations/bind/get_bind_peer_responses.go deleted file mode 100644 index f59d3ff5..00000000 --- a/operations/bind/get_bind_peer_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetBindPeerOKCode is the HTTP code returned for type GetBindPeerOK -const GetBindPeerOKCode int = 200 - -/* -GetBindPeerOK Successful operation - -swagger:response getBindPeerOK -*/ -type GetBindPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewGetBindPeerOK creates GetBindPeerOK with default headers values -func NewGetBindPeerOK() *GetBindPeerOK { - - return &GetBindPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind peer o k response -func (o *GetBindPeerOK) WithConfigurationVersion(configurationVersion string) *GetBindPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind peer o k response -func (o *GetBindPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind peer o k response -func (o *GetBindPeerOK) WithPayload(payload *models.Bind) *GetBindPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind peer o k response -func (o *GetBindPeerOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetBindPeerNotFoundCode is the HTTP code returned for type GetBindPeerNotFound -const GetBindPeerNotFoundCode int = 404 - -/* -GetBindPeerNotFound The specified resource already exists - -swagger:response getBindPeerNotFound -*/ -type GetBindPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindPeerNotFound creates GetBindPeerNotFound with default headers values -func NewGetBindPeerNotFound() *GetBindPeerNotFound { - - return &GetBindPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get bind peer not found response -func (o *GetBindPeerNotFound) WithConfigurationVersion(configurationVersion string) *GetBindPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind peer not found response -func (o *GetBindPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind peer not found response -func (o *GetBindPeerNotFound) WithPayload(payload *models.Error) *GetBindPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind peer not found response -func (o *GetBindPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetBindPeerDefault General Error - -swagger:response getBindPeerDefault -*/ -type GetBindPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetBindPeerDefault creates GetBindPeerDefault with default headers values -func NewGetBindPeerDefault(code int) *GetBindPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetBindPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bind peer default response -func (o *GetBindPeerDefault) WithStatusCode(code int) *GetBindPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bind peer default response -func (o *GetBindPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get bind peer default response -func (o *GetBindPeerDefault) WithConfigurationVersion(configurationVersion string) *GetBindPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get bind peer default response -func (o *GetBindPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get bind peer default response -func (o *GetBindPeerDefault) WithPayload(payload *models.Error) *GetBindPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bind peer default response -func (o *GetBindPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBindPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/get_bind_peer_urlbuilder.go b/operations/bind/get_bind_peer_urlbuilder.go deleted file mode 100644 index f57bb532..00000000 --- a/operations/bind/get_bind_peer_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetBindPeerURL generates an URL for the get bind peer operation -type GetBindPeerURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindPeerURL) WithBasePath(bp string) *GetBindPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetBindPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBindPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetBindPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetBindPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetBindPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetBindPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBindPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBindPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBindPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetBindPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/replace_bind_frontend.go b/operations/bind/replace_bind_frontend.go deleted file mode 100644 index 830f2452..00000000 --- a/operations/bind/replace_bind_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBindFrontendHandlerFunc turns a function with the right signature into a replace bind frontend handler -type ReplaceBindFrontendHandlerFunc func(ReplaceBindFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBindFrontendHandlerFunc) Handle(params ReplaceBindFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBindFrontendHandler interface for that can handle valid replace bind frontend params -type ReplaceBindFrontendHandler interface { - Handle(ReplaceBindFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceBindFrontend creates a new http.Handler for the replace bind frontend operation -func NewReplaceBindFrontend(ctx *middleware.Context, handler ReplaceBindFrontendHandler) *ReplaceBindFrontend { - return &ReplaceBindFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceBindFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/binds/{name} Bind replaceBindFrontend - -# Replace a bind - -Replaces a bind configuration by it's name in the specified frontend. -*/ -type ReplaceBindFrontend struct { - Context *middleware.Context - Handler ReplaceBindFrontendHandler -} - -func (o *ReplaceBindFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBindFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/replace_bind_frontend_parameters.go b/operations/bind/replace_bind_frontend_parameters.go deleted file mode 100644 index eae20d28..00000000 --- a/operations/bind/replace_bind_frontend_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBindFrontendParams creates a new ReplaceBindFrontendParams object -// with the default values initialized. -func NewReplaceBindFrontendParams() ReplaceBindFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceBindFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceBindFrontendParams contains all the bound params for the replace bind frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBindFrontend -type ReplaceBindFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBindFrontendParams() beforehand. -func (o *ReplaceBindFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBindFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBindFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceBindFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceBindFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBindFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBindFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/replace_bind_frontend_responses.go b/operations/bind/replace_bind_frontend_responses.go deleted file mode 100644 index 79b1489d..00000000 --- a/operations/bind/replace_bind_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBindFrontendOKCode is the HTTP code returned for type ReplaceBindFrontendOK -const ReplaceBindFrontendOKCode int = 200 - -/* -ReplaceBindFrontendOK Bind replaced - -swagger:response replaceBindFrontendOK -*/ -type ReplaceBindFrontendOK struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindFrontendOK creates ReplaceBindFrontendOK with default headers values -func NewReplaceBindFrontendOK() *ReplaceBindFrontendOK { - - return &ReplaceBindFrontendOK{} -} - -// WithPayload adds the payload to the replace bind frontend o k response -func (o *ReplaceBindFrontendOK) WithPayload(payload *models.Bind) *ReplaceBindFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind frontend o k response -func (o *ReplaceBindFrontendOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindFrontendAcceptedCode is the HTTP code returned for type ReplaceBindFrontendAccepted -const ReplaceBindFrontendAcceptedCode int = 202 - -/* -ReplaceBindFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceBindFrontendAccepted -*/ -type ReplaceBindFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindFrontendAccepted creates ReplaceBindFrontendAccepted with default headers values -func NewReplaceBindFrontendAccepted() *ReplaceBindFrontendAccepted { - - return &ReplaceBindFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace bind frontend accepted response -func (o *ReplaceBindFrontendAccepted) WithReloadID(reloadID string) *ReplaceBindFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace bind frontend accepted response -func (o *ReplaceBindFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace bind frontend accepted response -func (o *ReplaceBindFrontendAccepted) WithPayload(payload *models.Bind) *ReplaceBindFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind frontend accepted response -func (o *ReplaceBindFrontendAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindFrontendBadRequestCode is the HTTP code returned for type ReplaceBindFrontendBadRequest -const ReplaceBindFrontendBadRequestCode int = 400 - -/* -ReplaceBindFrontendBadRequest Bad request - -swagger:response replaceBindFrontendBadRequest -*/ -type ReplaceBindFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindFrontendBadRequest creates ReplaceBindFrontendBadRequest with default headers values -func NewReplaceBindFrontendBadRequest() *ReplaceBindFrontendBadRequest { - - return &ReplaceBindFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind frontend bad request response -func (o *ReplaceBindFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBindFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind frontend bad request response -func (o *ReplaceBindFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind frontend bad request response -func (o *ReplaceBindFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceBindFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind frontend bad request response -func (o *ReplaceBindFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindFrontendNotFoundCode is the HTTP code returned for type ReplaceBindFrontendNotFound -const ReplaceBindFrontendNotFoundCode int = 404 - -/* -ReplaceBindFrontendNotFound The specified resource was not found - -swagger:response replaceBindFrontendNotFound -*/ -type ReplaceBindFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindFrontendNotFound creates ReplaceBindFrontendNotFound with default headers values -func NewReplaceBindFrontendNotFound() *ReplaceBindFrontendNotFound { - - return &ReplaceBindFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind frontend not found response -func (o *ReplaceBindFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceBindFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind frontend not found response -func (o *ReplaceBindFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind frontend not found response -func (o *ReplaceBindFrontendNotFound) WithPayload(payload *models.Error) *ReplaceBindFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind frontend not found response -func (o *ReplaceBindFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBindFrontendDefault General Error - -swagger:response replaceBindFrontendDefault -*/ -type ReplaceBindFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindFrontendDefault creates ReplaceBindFrontendDefault with default headers values -func NewReplaceBindFrontendDefault(code int) *ReplaceBindFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBindFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) WithStatusCode(code int) *ReplaceBindFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBindFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) WithPayload(payload *models.Error) *ReplaceBindFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind frontend default response -func (o *ReplaceBindFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/replace_bind_frontend_urlbuilder.go b/operations/bind/replace_bind_frontend_urlbuilder.go deleted file mode 100644 index df71a4fa..00000000 --- a/operations/bind/replace_bind_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBindFrontendURL generates an URL for the replace bind frontend operation -type ReplaceBindFrontendURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindFrontendURL) WithBasePath(bp string) *ReplaceBindFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBindFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceBindFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceBindFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBindFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBindFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBindFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBindFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBindFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBindFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/replace_bind_log_forward.go b/operations/bind/replace_bind_log_forward.go deleted file mode 100644 index d982e5d9..00000000 --- a/operations/bind/replace_bind_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBindLogForwardHandlerFunc turns a function with the right signature into a replace bind log forward handler -type ReplaceBindLogForwardHandlerFunc func(ReplaceBindLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBindLogForwardHandlerFunc) Handle(params ReplaceBindLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBindLogForwardHandler interface for that can handle valid replace bind log forward params -type ReplaceBindLogForwardHandler interface { - Handle(ReplaceBindLogForwardParams, interface{}) middleware.Responder -} - -// NewReplaceBindLogForward creates a new http.Handler for the replace bind log forward operation -func NewReplaceBindLogForward(ctx *middleware.Context, handler ReplaceBindLogForwardHandler) *ReplaceBindLogForward { - return &ReplaceBindLogForward{Context: ctx, Handler: handler} -} - -/* - ReplaceBindLogForward swagger:route PUT /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name} Bind replaceBindLogForward - -# Replace a bind - -Replaces a bind configuration by it's name in the specified frontend. -*/ -type ReplaceBindLogForward struct { - Context *middleware.Context - Handler ReplaceBindLogForwardHandler -} - -func (o *ReplaceBindLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBindLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/replace_bind_log_forward_parameters.go b/operations/bind/replace_bind_log_forward_parameters.go deleted file mode 100644 index 1b0316bd..00000000 --- a/operations/bind/replace_bind_log_forward_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBindLogForwardParams creates a new ReplaceBindLogForwardParams object -// with the default values initialized. -func NewReplaceBindLogForwardParams() ReplaceBindLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceBindLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceBindLogForwardParams contains all the bound params for the replace bind log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBindLogForward -type ReplaceBindLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBindLogForwardParams() beforehand. -func (o *ReplaceBindLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBindLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBindLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceBindLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceBindLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBindLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBindLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/replace_bind_log_forward_responses.go b/operations/bind/replace_bind_log_forward_responses.go deleted file mode 100644 index d546e683..00000000 --- a/operations/bind/replace_bind_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBindLogForwardOKCode is the HTTP code returned for type ReplaceBindLogForwardOK -const ReplaceBindLogForwardOKCode int = 200 - -/* -ReplaceBindLogForwardOK Bind replaced - -swagger:response replaceBindLogForwardOK -*/ -type ReplaceBindLogForwardOK struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindLogForwardOK creates ReplaceBindLogForwardOK with default headers values -func NewReplaceBindLogForwardOK() *ReplaceBindLogForwardOK { - - return &ReplaceBindLogForwardOK{} -} - -// WithPayload adds the payload to the replace bind log forward o k response -func (o *ReplaceBindLogForwardOK) WithPayload(payload *models.Bind) *ReplaceBindLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind log forward o k response -func (o *ReplaceBindLogForwardOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindLogForwardAcceptedCode is the HTTP code returned for type ReplaceBindLogForwardAccepted -const ReplaceBindLogForwardAcceptedCode int = 202 - -/* -ReplaceBindLogForwardAccepted Configuration change accepted and reload requested - -swagger:response replaceBindLogForwardAccepted -*/ -type ReplaceBindLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindLogForwardAccepted creates ReplaceBindLogForwardAccepted with default headers values -func NewReplaceBindLogForwardAccepted() *ReplaceBindLogForwardAccepted { - - return &ReplaceBindLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the replace bind log forward accepted response -func (o *ReplaceBindLogForwardAccepted) WithReloadID(reloadID string) *ReplaceBindLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace bind log forward accepted response -func (o *ReplaceBindLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace bind log forward accepted response -func (o *ReplaceBindLogForwardAccepted) WithPayload(payload *models.Bind) *ReplaceBindLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind log forward accepted response -func (o *ReplaceBindLogForwardAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindLogForwardBadRequestCode is the HTTP code returned for type ReplaceBindLogForwardBadRequest -const ReplaceBindLogForwardBadRequestCode int = 400 - -/* -ReplaceBindLogForwardBadRequest Bad request - -swagger:response replaceBindLogForwardBadRequest -*/ -type ReplaceBindLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindLogForwardBadRequest creates ReplaceBindLogForwardBadRequest with default headers values -func NewReplaceBindLogForwardBadRequest() *ReplaceBindLogForwardBadRequest { - - return &ReplaceBindLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind log forward bad request response -func (o *ReplaceBindLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBindLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind log forward bad request response -func (o *ReplaceBindLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind log forward bad request response -func (o *ReplaceBindLogForwardBadRequest) WithPayload(payload *models.Error) *ReplaceBindLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind log forward bad request response -func (o *ReplaceBindLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindLogForwardNotFoundCode is the HTTP code returned for type ReplaceBindLogForwardNotFound -const ReplaceBindLogForwardNotFoundCode int = 404 - -/* -ReplaceBindLogForwardNotFound The specified resource was not found - -swagger:response replaceBindLogForwardNotFound -*/ -type ReplaceBindLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindLogForwardNotFound creates ReplaceBindLogForwardNotFound with default headers values -func NewReplaceBindLogForwardNotFound() *ReplaceBindLogForwardNotFound { - - return &ReplaceBindLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind log forward not found response -func (o *ReplaceBindLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceBindLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind log forward not found response -func (o *ReplaceBindLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind log forward not found response -func (o *ReplaceBindLogForwardNotFound) WithPayload(payload *models.Error) *ReplaceBindLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind log forward not found response -func (o *ReplaceBindLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBindLogForwardDefault General Error - -swagger:response replaceBindLogForwardDefault -*/ -type ReplaceBindLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindLogForwardDefault creates ReplaceBindLogForwardDefault with default headers values -func NewReplaceBindLogForwardDefault(code int) *ReplaceBindLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBindLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) WithStatusCode(code int) *ReplaceBindLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBindLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) WithPayload(payload *models.Error) *ReplaceBindLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind log forward default response -func (o *ReplaceBindLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/replace_bind_log_forward_urlbuilder.go b/operations/bind/replace_bind_log_forward_urlbuilder.go deleted file mode 100644 index 1f1b1572..00000000 --- a/operations/bind/replace_bind_log_forward_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBindLogForwardURL generates an URL for the replace bind log forward operation -type ReplaceBindLogForwardURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindLogForwardURL) WithBasePath(bp string) *ReplaceBindLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBindLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceBindLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceBindLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBindLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBindLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBindLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBindLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBindLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBindLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/bind/replace_bind_peer.go b/operations/bind/replace_bind_peer.go deleted file mode 100644 index 116c9bbe..00000000 --- a/operations/bind/replace_bind_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceBindPeerHandlerFunc turns a function with the right signature into a replace bind peer handler -type ReplaceBindPeerHandlerFunc func(ReplaceBindPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceBindPeerHandlerFunc) Handle(params ReplaceBindPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceBindPeerHandler interface for that can handle valid replace bind peer params -type ReplaceBindPeerHandler interface { - Handle(ReplaceBindPeerParams, interface{}) middleware.Responder -} - -// NewReplaceBindPeer creates a new http.Handler for the replace bind peer operation -func NewReplaceBindPeer(ctx *middleware.Context, handler ReplaceBindPeerHandler) *ReplaceBindPeer { - return &ReplaceBindPeer{Context: ctx, Handler: handler} -} - -/* - ReplaceBindPeer swagger:route PUT /services/haproxy/configuration/peers/{parent_name}/binds/{name} Bind replaceBindPeer - -# Replace a bind - -Replaces a bind configuration by it's name in the specified frontend. -*/ -type ReplaceBindPeer struct { - Context *middleware.Context - Handler ReplaceBindPeerHandler -} - -func (o *ReplaceBindPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceBindPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/bind/replace_bind_peer_parameters.go b/operations/bind/replace_bind_peer_parameters.go deleted file mode 100644 index 7553bdef..00000000 --- a/operations/bind/replace_bind_peer_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceBindPeerParams creates a new ReplaceBindPeerParams object -// with the default values initialized. -func NewReplaceBindPeerParams() ReplaceBindPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceBindPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceBindPeerParams contains all the bound params for the replace bind peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceBindPeer -type ReplaceBindPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Bind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceBindPeerParams() beforehand. -func (o *ReplaceBindPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Bind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceBindPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceBindPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceBindPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceBindPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceBindPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceBindPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/bind/replace_bind_peer_responses.go b/operations/bind/replace_bind_peer_responses.go deleted file mode 100644 index 28033d73..00000000 --- a/operations/bind/replace_bind_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceBindPeerOKCode is the HTTP code returned for type ReplaceBindPeerOK -const ReplaceBindPeerOKCode int = 200 - -/* -ReplaceBindPeerOK Bind replaced - -swagger:response replaceBindPeerOK -*/ -type ReplaceBindPeerOK struct { - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindPeerOK creates ReplaceBindPeerOK with default headers values -func NewReplaceBindPeerOK() *ReplaceBindPeerOK { - - return &ReplaceBindPeerOK{} -} - -// WithPayload adds the payload to the replace bind peer o k response -func (o *ReplaceBindPeerOK) WithPayload(payload *models.Bind) *ReplaceBindPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind peer o k response -func (o *ReplaceBindPeerOK) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindPeerAcceptedCode is the HTTP code returned for type ReplaceBindPeerAccepted -const ReplaceBindPeerAcceptedCode int = 202 - -/* -ReplaceBindPeerAccepted Configuration change accepted and reload requested - -swagger:response replaceBindPeerAccepted -*/ -type ReplaceBindPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Bind `json:"body,omitempty"` -} - -// NewReplaceBindPeerAccepted creates ReplaceBindPeerAccepted with default headers values -func NewReplaceBindPeerAccepted() *ReplaceBindPeerAccepted { - - return &ReplaceBindPeerAccepted{} -} - -// WithReloadID adds the reloadId to the replace bind peer accepted response -func (o *ReplaceBindPeerAccepted) WithReloadID(reloadID string) *ReplaceBindPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace bind peer accepted response -func (o *ReplaceBindPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace bind peer accepted response -func (o *ReplaceBindPeerAccepted) WithPayload(payload *models.Bind) *ReplaceBindPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind peer accepted response -func (o *ReplaceBindPeerAccepted) SetPayload(payload *models.Bind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindPeerBadRequestCode is the HTTP code returned for type ReplaceBindPeerBadRequest -const ReplaceBindPeerBadRequestCode int = 400 - -/* -ReplaceBindPeerBadRequest Bad request - -swagger:response replaceBindPeerBadRequest -*/ -type ReplaceBindPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindPeerBadRequest creates ReplaceBindPeerBadRequest with default headers values -func NewReplaceBindPeerBadRequest() *ReplaceBindPeerBadRequest { - - return &ReplaceBindPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind peer bad request response -func (o *ReplaceBindPeerBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceBindPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind peer bad request response -func (o *ReplaceBindPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind peer bad request response -func (o *ReplaceBindPeerBadRequest) WithPayload(payload *models.Error) *ReplaceBindPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind peer bad request response -func (o *ReplaceBindPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceBindPeerNotFoundCode is the HTTP code returned for type ReplaceBindPeerNotFound -const ReplaceBindPeerNotFoundCode int = 404 - -/* -ReplaceBindPeerNotFound The specified resource was not found - -swagger:response replaceBindPeerNotFound -*/ -type ReplaceBindPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindPeerNotFound creates ReplaceBindPeerNotFound with default headers values -func NewReplaceBindPeerNotFound() *ReplaceBindPeerNotFound { - - return &ReplaceBindPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind peer not found response -func (o *ReplaceBindPeerNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceBindPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind peer not found response -func (o *ReplaceBindPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind peer not found response -func (o *ReplaceBindPeerNotFound) WithPayload(payload *models.Error) *ReplaceBindPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind peer not found response -func (o *ReplaceBindPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceBindPeerDefault General Error - -swagger:response replaceBindPeerDefault -*/ -type ReplaceBindPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceBindPeerDefault creates ReplaceBindPeerDefault with default headers values -func NewReplaceBindPeerDefault(code int) *ReplaceBindPeerDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceBindPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace bind peer default response -func (o *ReplaceBindPeerDefault) WithStatusCode(code int) *ReplaceBindPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace bind peer default response -func (o *ReplaceBindPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace bind peer default response -func (o *ReplaceBindPeerDefault) WithConfigurationVersion(configurationVersion string) *ReplaceBindPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace bind peer default response -func (o *ReplaceBindPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace bind peer default response -func (o *ReplaceBindPeerDefault) WithPayload(payload *models.Error) *ReplaceBindPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace bind peer default response -func (o *ReplaceBindPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceBindPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/bind/replace_bind_peer_urlbuilder.go b/operations/bind/replace_bind_peer_urlbuilder.go deleted file mode 100644 index 23ada1d1..00000000 --- a/operations/bind/replace_bind_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceBindPeerURL generates an URL for the replace bind peer operation -type ReplaceBindPeerURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindPeerURL) WithBasePath(bp string) *ReplaceBindPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceBindPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceBindPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceBindPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceBindPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceBindPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceBindPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceBindPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceBindPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceBindPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceBindPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cache/create_cache.go b/operations/cache/create_cache.go deleted file mode 100644 index 41695bcd..00000000 --- a/operations/cache/create_cache.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCacheHandlerFunc turns a function with the right signature into a create cache handler -type CreateCacheHandlerFunc func(CreateCacheParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCacheHandlerFunc) Handle(params CreateCacheParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCacheHandler interface for that can handle valid create cache params -type CreateCacheHandler interface { - Handle(CreateCacheParams, interface{}) middleware.Responder -} - -// NewCreateCache creates a new http.Handler for the create cache operation -func NewCreateCache(ctx *middleware.Context, handler CreateCacheHandler) *CreateCache { - return &CreateCache{Context: ctx, Handler: handler} -} - -/* - CreateCache swagger:route POST /services/haproxy/configuration/caches Cache createCache - -# Add a cache - -Adds a new cache section to the configuration file. -*/ -type CreateCache struct { - Context *middleware.Context - Handler CreateCacheHandler -} - -func (o *CreateCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCacheParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cache/create_cache_parameters.go b/operations/cache/create_cache_parameters.go deleted file mode 100644 index 3f8ea385..00000000 --- a/operations/cache/create_cache_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateCacheParams creates a new CreateCacheParams object -// with the default values initialized. -func NewCreateCacheParams() CreateCacheParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateCacheParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateCacheParams contains all the bound params for the create cache operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCache -type CreateCacheParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Cache - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCacheParams() beforehand. -func (o *CreateCacheParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Cache - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateCacheParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateCacheParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateCacheParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateCacheParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cache/create_cache_responses.go b/operations/cache/create_cache_responses.go deleted file mode 100644 index 686ed55c..00000000 --- a/operations/cache/create_cache_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCacheCreatedCode is the HTTP code returned for type CreateCacheCreated -const CreateCacheCreatedCode int = 201 - -/* -CreateCacheCreated Cache created - -swagger:response createCacheCreated -*/ -type CreateCacheCreated struct { - - /* - In: Body - */ - Payload *models.Cache `json:"body,omitempty"` -} - -// NewCreateCacheCreated creates CreateCacheCreated with default headers values -func NewCreateCacheCreated() *CreateCacheCreated { - - return &CreateCacheCreated{} -} - -// WithPayload adds the payload to the create cache created response -func (o *CreateCacheCreated) WithPayload(payload *models.Cache) *CreateCacheCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cache created response -func (o *CreateCacheCreated) SetPayload(payload *models.Cache) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCacheCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCacheAcceptedCode is the HTTP code returned for type CreateCacheAccepted -const CreateCacheAcceptedCode int = 202 - -/* -CreateCacheAccepted Configuration change accepted and reload requested - -swagger:response createCacheAccepted -*/ -type CreateCacheAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Cache `json:"body,omitempty"` -} - -// NewCreateCacheAccepted creates CreateCacheAccepted with default headers values -func NewCreateCacheAccepted() *CreateCacheAccepted { - - return &CreateCacheAccepted{} -} - -// WithReloadID adds the reloadId to the create cache accepted response -func (o *CreateCacheAccepted) WithReloadID(reloadID string) *CreateCacheAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create cache accepted response -func (o *CreateCacheAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create cache accepted response -func (o *CreateCacheAccepted) WithPayload(payload *models.Cache) *CreateCacheAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cache accepted response -func (o *CreateCacheAccepted) SetPayload(payload *models.Cache) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCacheAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCacheBadRequestCode is the HTTP code returned for type CreateCacheBadRequest -const CreateCacheBadRequestCode int = 400 - -/* -CreateCacheBadRequest Bad request - -swagger:response createCacheBadRequest -*/ -type CreateCacheBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCacheBadRequest creates CreateCacheBadRequest with default headers values -func NewCreateCacheBadRequest() *CreateCacheBadRequest { - - return &CreateCacheBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create cache bad request response -func (o *CreateCacheBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCacheBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cache bad request response -func (o *CreateCacheBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cache bad request response -func (o *CreateCacheBadRequest) WithPayload(payload *models.Error) *CreateCacheBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cache bad request response -func (o *CreateCacheBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCacheBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCacheConflictCode is the HTTP code returned for type CreateCacheConflict -const CreateCacheConflictCode int = 409 - -/* -CreateCacheConflict The specified resource already exists - -swagger:response createCacheConflict -*/ -type CreateCacheConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCacheConflict creates CreateCacheConflict with default headers values -func NewCreateCacheConflict() *CreateCacheConflict { - - return &CreateCacheConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create cache conflict response -func (o *CreateCacheConflict) WithConfigurationVersion(configurationVersion string) *CreateCacheConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cache conflict response -func (o *CreateCacheConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cache conflict response -func (o *CreateCacheConflict) WithPayload(payload *models.Error) *CreateCacheConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cache conflict response -func (o *CreateCacheConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCacheConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCacheDefault General Error - -swagger:response createCacheDefault -*/ -type CreateCacheDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCacheDefault creates CreateCacheDefault with default headers values -func NewCreateCacheDefault(code int) *CreateCacheDefault { - if code <= 0 { - code = 500 - } - - return &CreateCacheDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create cache default response -func (o *CreateCacheDefault) WithStatusCode(code int) *CreateCacheDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create cache default response -func (o *CreateCacheDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create cache default response -func (o *CreateCacheDefault) WithConfigurationVersion(configurationVersion string) *CreateCacheDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cache default response -func (o *CreateCacheDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cache default response -func (o *CreateCacheDefault) WithPayload(payload *models.Error) *CreateCacheDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cache default response -func (o *CreateCacheDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCacheDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cache/create_cache_urlbuilder.go b/operations/cache/create_cache_urlbuilder.go deleted file mode 100644 index 01f68ecb..00000000 --- a/operations/cache/create_cache_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateCacheURL generates an URL for the create cache operation -type CreateCacheURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCacheURL) WithBasePath(bp string) *CreateCacheURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCacheURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCacheURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/caches" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCacheURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCacheURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCacheURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCacheURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCacheURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCacheURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cache/delete_cache.go b/operations/cache/delete_cache.go deleted file mode 100644 index e7e20427..00000000 --- a/operations/cache/delete_cache.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCacheHandlerFunc turns a function with the right signature into a delete cache handler -type DeleteCacheHandlerFunc func(DeleteCacheParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCacheHandlerFunc) Handle(params DeleteCacheParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCacheHandler interface for that can handle valid delete cache params -type DeleteCacheHandler interface { - Handle(DeleteCacheParams, interface{}) middleware.Responder -} - -// NewDeleteCache creates a new http.Handler for the delete cache operation -func NewDeleteCache(ctx *middleware.Context, handler DeleteCacheHandler) *DeleteCache { - return &DeleteCache{Context: ctx, Handler: handler} -} - -/* - DeleteCache swagger:route DELETE /services/haproxy/configuration/caches/{name} Cache deleteCache - -# Delete a cache - -Deletes a cache from the configuration by it's name. -*/ -type DeleteCache struct { - Context *middleware.Context - Handler DeleteCacheHandler -} - -func (o *DeleteCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCacheParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cache/delete_cache_parameters.go b/operations/cache/delete_cache_parameters.go deleted file mode 100644 index 1b2c886c..00000000 --- a/operations/cache/delete_cache_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteCacheParams creates a new DeleteCacheParams object -// with the default values initialized. -func NewDeleteCacheParams() DeleteCacheParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteCacheParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteCacheParams contains all the bound params for the delete cache operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCache -type DeleteCacheParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Cache name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCacheParams() beforehand. -func (o *DeleteCacheParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteCacheParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteCacheParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteCacheParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteCacheParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteCacheParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cache/delete_cache_responses.go b/operations/cache/delete_cache_responses.go deleted file mode 100644 index 77715b44..00000000 --- a/operations/cache/delete_cache_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCacheAcceptedCode is the HTTP code returned for type DeleteCacheAccepted -const DeleteCacheAcceptedCode int = 202 - -/* -DeleteCacheAccepted Configuration change accepted and reload requested - -swagger:response deleteCacheAccepted -*/ -type DeleteCacheAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteCacheAccepted creates DeleteCacheAccepted with default headers values -func NewDeleteCacheAccepted() *DeleteCacheAccepted { - - return &DeleteCacheAccepted{} -} - -// WithReloadID adds the reloadId to the delete cache accepted response -func (o *DeleteCacheAccepted) WithReloadID(reloadID string) *DeleteCacheAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete cache accepted response -func (o *DeleteCacheAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteCacheAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteCacheNoContentCode is the HTTP code returned for type DeleteCacheNoContent -const DeleteCacheNoContentCode int = 204 - -/* -DeleteCacheNoContent Cache deleted - -swagger:response deleteCacheNoContent -*/ -type DeleteCacheNoContent struct { -} - -// NewDeleteCacheNoContent creates DeleteCacheNoContent with default headers values -func NewDeleteCacheNoContent() *DeleteCacheNoContent { - - return &DeleteCacheNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCacheNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCacheNotFoundCode is the HTTP code returned for type DeleteCacheNotFound -const DeleteCacheNotFoundCode int = 404 - -/* -DeleteCacheNotFound The specified resource was not found - -swagger:response deleteCacheNotFound -*/ -type DeleteCacheNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCacheNotFound creates DeleteCacheNotFound with default headers values -func NewDeleteCacheNotFound() *DeleteCacheNotFound { - - return &DeleteCacheNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete cache not found response -func (o *DeleteCacheNotFound) WithConfigurationVersion(configurationVersion string) *DeleteCacheNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete cache not found response -func (o *DeleteCacheNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete cache not found response -func (o *DeleteCacheNotFound) WithPayload(payload *models.Error) *DeleteCacheNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete cache not found response -func (o *DeleteCacheNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCacheNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCacheDefault General Error - -swagger:response deleteCacheDefault -*/ -type DeleteCacheDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCacheDefault creates DeleteCacheDefault with default headers values -func NewDeleteCacheDefault(code int) *DeleteCacheDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCacheDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete cache default response -func (o *DeleteCacheDefault) WithStatusCode(code int) *DeleteCacheDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete cache default response -func (o *DeleteCacheDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete cache default response -func (o *DeleteCacheDefault) WithConfigurationVersion(configurationVersion string) *DeleteCacheDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete cache default response -func (o *DeleteCacheDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete cache default response -func (o *DeleteCacheDefault) WithPayload(payload *models.Error) *DeleteCacheDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete cache default response -func (o *DeleteCacheDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCacheDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cache/delete_cache_urlbuilder.go b/operations/cache/delete_cache_urlbuilder.go deleted file mode 100644 index 56cd0b00..00000000 --- a/operations/cache/delete_cache_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteCacheURL generates an URL for the delete cache operation -type DeleteCacheURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCacheURL) WithBasePath(bp string) *DeleteCacheURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCacheURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCacheURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/caches/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteCacheURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCacheURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCacheURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCacheURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCacheURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCacheURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCacheURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cache/get_cache.go b/operations/cache/get_cache.go deleted file mode 100644 index f346e65f..00000000 --- a/operations/cache/get_cache.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCacheHandlerFunc turns a function with the right signature into a get cache handler -type GetCacheHandlerFunc func(GetCacheParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCacheHandlerFunc) Handle(params GetCacheParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCacheHandler interface for that can handle valid get cache params -type GetCacheHandler interface { - Handle(GetCacheParams, interface{}) middleware.Responder -} - -// NewGetCache creates a new http.Handler for the get cache operation -func NewGetCache(ctx *middleware.Context, handler GetCacheHandler) *GetCache { - return &GetCache{Context: ctx, Handler: handler} -} - -/* - GetCache swagger:route GET /services/haproxy/configuration/caches/{name} Cache getCache - -# Return a cache - -Returns one cache section configuration by it's name. -*/ -type GetCache struct { - Context *middleware.Context - Handler GetCacheHandler -} - -func (o *GetCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCacheParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cache/get_cache_parameters.go b/operations/cache/get_cache_parameters.go deleted file mode 100644 index cfbc3690..00000000 --- a/operations/cache/get_cache_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCacheParams creates a new GetCacheParams object -// -// There are no default values defined in the spec. -func NewGetCacheParams() GetCacheParams { - - return GetCacheParams{} -} - -// GetCacheParams contains all the bound params for the get cache operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCache -type GetCacheParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Cache name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCacheParams() beforehand. -func (o *GetCacheParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCacheParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCacheParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/cache/get_cache_responses.go b/operations/cache/get_cache_responses.go deleted file mode 100644 index e9e3cd1f..00000000 --- a/operations/cache/get_cache_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCacheOKCode is the HTTP code returned for type GetCacheOK -const GetCacheOKCode int = 200 - -/* -GetCacheOK Successful operation - -swagger:response getCacheOK -*/ -type GetCacheOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Cache `json:"body,omitempty"` -} - -// NewGetCacheOK creates GetCacheOK with default headers values -func NewGetCacheOK() *GetCacheOK { - - return &GetCacheOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get cache o k response -func (o *GetCacheOK) WithConfigurationVersion(configurationVersion string) *GetCacheOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get cache o k response -func (o *GetCacheOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get cache o k response -func (o *GetCacheOK) WithPayload(payload *models.Cache) *GetCacheOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cache o k response -func (o *GetCacheOK) SetPayload(payload *models.Cache) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCacheOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetCacheNotFoundCode is the HTTP code returned for type GetCacheNotFound -const GetCacheNotFoundCode int = 404 - -/* -GetCacheNotFound The specified resource was not found - -swagger:response getCacheNotFound -*/ -type GetCacheNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCacheNotFound creates GetCacheNotFound with default headers values -func NewGetCacheNotFound() *GetCacheNotFound { - - return &GetCacheNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get cache not found response -func (o *GetCacheNotFound) WithConfigurationVersion(configurationVersion string) *GetCacheNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get cache not found response -func (o *GetCacheNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get cache not found response -func (o *GetCacheNotFound) WithPayload(payload *models.Error) *GetCacheNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cache not found response -func (o *GetCacheNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCacheNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCacheDefault General Error - -swagger:response getCacheDefault -*/ -type GetCacheDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCacheDefault creates GetCacheDefault with default headers values -func NewGetCacheDefault(code int) *GetCacheDefault { - if code <= 0 { - code = 500 - } - - return &GetCacheDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get cache default response -func (o *GetCacheDefault) WithStatusCode(code int) *GetCacheDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get cache default response -func (o *GetCacheDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get cache default response -func (o *GetCacheDefault) WithConfigurationVersion(configurationVersion string) *GetCacheDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get cache default response -func (o *GetCacheDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get cache default response -func (o *GetCacheDefault) WithPayload(payload *models.Error) *GetCacheDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cache default response -func (o *GetCacheDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCacheDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cache/get_cache_urlbuilder.go b/operations/cache/get_cache_urlbuilder.go deleted file mode 100644 index 17835358..00000000 --- a/operations/cache/get_cache_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetCacheURL generates an URL for the get cache operation -type GetCacheURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCacheURL) WithBasePath(bp string) *GetCacheURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCacheURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCacheURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/caches/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCacheURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCacheURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCacheURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCacheURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCacheURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCacheURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCacheURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cache/get_caches.go b/operations/cache/get_caches.go deleted file mode 100644 index 26746ee7..00000000 --- a/operations/cache/get_caches.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCachesHandlerFunc turns a function with the right signature into a get caches handler -type GetCachesHandlerFunc func(GetCachesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCachesHandlerFunc) Handle(params GetCachesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCachesHandler interface for that can handle valid get caches params -type GetCachesHandler interface { - Handle(GetCachesParams, interface{}) middleware.Responder -} - -// NewGetCaches creates a new http.Handler for the get caches operation -func NewGetCaches(ctx *middleware.Context, handler GetCachesHandler) *GetCaches { - return &GetCaches{Context: ctx, Handler: handler} -} - -/* - GetCaches swagger:route GET /services/haproxy/configuration/caches Cache getCaches - -# Return an array of caches - -Returns an array of all configured caches. -*/ -type GetCaches struct { - Context *middleware.Context - Handler GetCachesHandler -} - -func (o *GetCaches) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCachesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cache/get_caches_parameters.go b/operations/cache/get_caches_parameters.go deleted file mode 100644 index 8c542ca6..00000000 --- a/operations/cache/get_caches_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCachesParams creates a new GetCachesParams object -// -// There are no default values defined in the spec. -func NewGetCachesParams() GetCachesParams { - - return GetCachesParams{} -} - -// GetCachesParams contains all the bound params for the get caches operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCaches -type GetCachesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCachesParams() beforehand. -func (o *GetCachesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCachesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/cache/get_caches_responses.go b/operations/cache/get_caches_responses.go deleted file mode 100644 index 5854525f..00000000 --- a/operations/cache/get_caches_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCachesOKCode is the HTTP code returned for type GetCachesOK -const GetCachesOKCode int = 200 - -/* -GetCachesOK Successful operation - -swagger:response getCachesOK -*/ -type GetCachesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Caches `json:"body,omitempty"` -} - -// NewGetCachesOK creates GetCachesOK with default headers values -func NewGetCachesOK() *GetCachesOK { - - return &GetCachesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get caches o k response -func (o *GetCachesOK) WithConfigurationVersion(configurationVersion string) *GetCachesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get caches o k response -func (o *GetCachesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get caches o k response -func (o *GetCachesOK) WithPayload(payload models.Caches) *GetCachesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get caches o k response -func (o *GetCachesOK) SetPayload(payload models.Caches) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCachesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Caches{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetCachesDefault General Error - -swagger:response getCachesDefault -*/ -type GetCachesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCachesDefault creates GetCachesDefault with default headers values -func NewGetCachesDefault(code int) *GetCachesDefault { - if code <= 0 { - code = 500 - } - - return &GetCachesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get caches default response -func (o *GetCachesDefault) WithStatusCode(code int) *GetCachesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get caches default response -func (o *GetCachesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get caches default response -func (o *GetCachesDefault) WithConfigurationVersion(configurationVersion string) *GetCachesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get caches default response -func (o *GetCachesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get caches default response -func (o *GetCachesDefault) WithPayload(payload *models.Error) *GetCachesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get caches default response -func (o *GetCachesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCachesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cache/get_caches_urlbuilder.go b/operations/cache/get_caches_urlbuilder.go deleted file mode 100644 index a360a024..00000000 --- a/operations/cache/get_caches_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetCachesURL generates an URL for the get caches operation -type GetCachesURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCachesURL) WithBasePath(bp string) *GetCachesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCachesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCachesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/caches" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCachesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCachesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCachesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCachesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCachesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCachesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cache/replace_cache.go b/operations/cache/replace_cache.go deleted file mode 100644 index a0ecb4d2..00000000 --- a/operations/cache/replace_cache.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceCacheHandlerFunc turns a function with the right signature into a replace cache handler -type ReplaceCacheHandlerFunc func(ReplaceCacheParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceCacheHandlerFunc) Handle(params ReplaceCacheParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceCacheHandler interface for that can handle valid replace cache params -type ReplaceCacheHandler interface { - Handle(ReplaceCacheParams, interface{}) middleware.Responder -} - -// NewReplaceCache creates a new http.Handler for the replace cache operation -func NewReplaceCache(ctx *middleware.Context, handler ReplaceCacheHandler) *ReplaceCache { - return &ReplaceCache{Context: ctx, Handler: handler} -} - -/* - ReplaceCache swagger:route PUT /services/haproxy/configuration/caches/{name} Cache replaceCache - -# Replace a cache - -Replaces a cache configuration by it's name. -*/ -type ReplaceCache struct { - Context *middleware.Context - Handler ReplaceCacheHandler -} - -func (o *ReplaceCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceCacheParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cache/replace_cache_parameters.go b/operations/cache/replace_cache_parameters.go deleted file mode 100644 index 03b5ba7d..00000000 --- a/operations/cache/replace_cache_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceCacheParams creates a new ReplaceCacheParams object -// with the default values initialized. -func NewReplaceCacheParams() ReplaceCacheParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceCacheParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceCacheParams contains all the bound params for the replace cache operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceCache -type ReplaceCacheParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Cache - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Cache name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceCacheParams() beforehand. -func (o *ReplaceCacheParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Cache - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceCacheParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceCacheParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceCacheParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceCacheParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceCacheParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cache/replace_cache_responses.go b/operations/cache/replace_cache_responses.go deleted file mode 100644 index 1094146c..00000000 --- a/operations/cache/replace_cache_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceCacheOKCode is the HTTP code returned for type ReplaceCacheOK -const ReplaceCacheOKCode int = 200 - -/* -ReplaceCacheOK Cache replaced - -swagger:response replaceCacheOK -*/ -type ReplaceCacheOK struct { - - /* - In: Body - */ - Payload *models.Cache `json:"body,omitempty"` -} - -// NewReplaceCacheOK creates ReplaceCacheOK with default headers values -func NewReplaceCacheOK() *ReplaceCacheOK { - - return &ReplaceCacheOK{} -} - -// WithPayload adds the payload to the replace cache o k response -func (o *ReplaceCacheOK) WithPayload(payload *models.Cache) *ReplaceCacheOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cache o k response -func (o *ReplaceCacheOK) SetPayload(payload *models.Cache) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCacheOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCacheAcceptedCode is the HTTP code returned for type ReplaceCacheAccepted -const ReplaceCacheAcceptedCode int = 202 - -/* -ReplaceCacheAccepted Configuration change accepted and reload requested - -swagger:response replaceCacheAccepted -*/ -type ReplaceCacheAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Cache `json:"body,omitempty"` -} - -// NewReplaceCacheAccepted creates ReplaceCacheAccepted with default headers values -func NewReplaceCacheAccepted() *ReplaceCacheAccepted { - - return &ReplaceCacheAccepted{} -} - -// WithReloadID adds the reloadId to the replace cache accepted response -func (o *ReplaceCacheAccepted) WithReloadID(reloadID string) *ReplaceCacheAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace cache accepted response -func (o *ReplaceCacheAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace cache accepted response -func (o *ReplaceCacheAccepted) WithPayload(payload *models.Cache) *ReplaceCacheAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cache accepted response -func (o *ReplaceCacheAccepted) SetPayload(payload *models.Cache) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCacheAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCacheBadRequestCode is the HTTP code returned for type ReplaceCacheBadRequest -const ReplaceCacheBadRequestCode int = 400 - -/* -ReplaceCacheBadRequest Bad request - -swagger:response replaceCacheBadRequest -*/ -type ReplaceCacheBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCacheBadRequest creates ReplaceCacheBadRequest with default headers values -func NewReplaceCacheBadRequest() *ReplaceCacheBadRequest { - - return &ReplaceCacheBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace cache bad request response -func (o *ReplaceCacheBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceCacheBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace cache bad request response -func (o *ReplaceCacheBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace cache bad request response -func (o *ReplaceCacheBadRequest) WithPayload(payload *models.Error) *ReplaceCacheBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cache bad request response -func (o *ReplaceCacheBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCacheBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCacheNotFoundCode is the HTTP code returned for type ReplaceCacheNotFound -const ReplaceCacheNotFoundCode int = 404 - -/* -ReplaceCacheNotFound The specified resource was not found - -swagger:response replaceCacheNotFound -*/ -type ReplaceCacheNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCacheNotFound creates ReplaceCacheNotFound with default headers values -func NewReplaceCacheNotFound() *ReplaceCacheNotFound { - - return &ReplaceCacheNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace cache not found response -func (o *ReplaceCacheNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceCacheNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace cache not found response -func (o *ReplaceCacheNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace cache not found response -func (o *ReplaceCacheNotFound) WithPayload(payload *models.Error) *ReplaceCacheNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cache not found response -func (o *ReplaceCacheNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCacheNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceCacheDefault General Error - -swagger:response replaceCacheDefault -*/ -type ReplaceCacheDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCacheDefault creates ReplaceCacheDefault with default headers values -func NewReplaceCacheDefault(code int) *ReplaceCacheDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceCacheDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace cache default response -func (o *ReplaceCacheDefault) WithStatusCode(code int) *ReplaceCacheDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace cache default response -func (o *ReplaceCacheDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace cache default response -func (o *ReplaceCacheDefault) WithConfigurationVersion(configurationVersion string) *ReplaceCacheDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace cache default response -func (o *ReplaceCacheDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace cache default response -func (o *ReplaceCacheDefault) WithPayload(payload *models.Error) *ReplaceCacheDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cache default response -func (o *ReplaceCacheDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCacheDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cache/replace_cache_urlbuilder.go b/operations/cache/replace_cache_urlbuilder.go deleted file mode 100644 index 6de5bf8a..00000000 --- a/operations/cache/replace_cache_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cache - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceCacheURL generates an URL for the replace cache operation -type ReplaceCacheURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCacheURL) WithBasePath(bp string) *ReplaceCacheURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCacheURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceCacheURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/caches/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceCacheURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceCacheURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceCacheURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceCacheURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceCacheURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceCacheURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceCacheURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cluster/delete_cluster.go b/operations/cluster/delete_cluster.go deleted file mode 100644 index aa3555d0..00000000 --- a/operations/cluster/delete_cluster.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteClusterHandlerFunc turns a function with the right signature into a delete cluster handler -type DeleteClusterHandlerFunc func(DeleteClusterParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteClusterHandlerFunc) Handle(params DeleteClusterParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteClusterHandler interface for that can handle valid delete cluster params -type DeleteClusterHandler interface { - Handle(DeleteClusterParams, interface{}) middleware.Responder -} - -// NewDeleteCluster creates a new http.Handler for the delete cluster operation -func NewDeleteCluster(ctx *middleware.Context, handler DeleteClusterHandler) *DeleteCluster { - return &DeleteCluster{Context: ctx, Handler: handler} -} - -/* - DeleteCluster swagger:route DELETE /cluster Cluster deleteCluster - -# Delete cluster settings - -Delete cluster settings and move the node back to single mode -*/ -type DeleteCluster struct { - Context *middleware.Context - Handler DeleteClusterHandler -} - -func (o *DeleteCluster) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteClusterParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cluster/delete_cluster_parameters.go b/operations/cluster/delete_cluster_parameters.go deleted file mode 100644 index cad01e6d..00000000 --- a/operations/cluster/delete_cluster_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteClusterParams creates a new DeleteClusterParams object -// -// There are no default values defined in the spec. -func NewDeleteClusterParams() DeleteClusterParams { - - return DeleteClusterParams{} -} - -// DeleteClusterParams contains all the bound params for the delete cluster operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCluster -type DeleteClusterParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*In case of moving to single mode do we keep or clean configuration - In: query - */ - Configuration *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteClusterParams() beforehand. -func (o *DeleteClusterParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qConfiguration, qhkConfiguration, _ := qs.GetOK("configuration") - if err := o.bindConfiguration(qConfiguration, qhkConfiguration, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindConfiguration binds and validates parameter Configuration from query. -func (o *DeleteClusterParams) bindConfiguration(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Configuration = &raw - - if err := o.validateConfiguration(formats); err != nil { - return err - } - - return nil -} - -// validateConfiguration carries on validations for parameter Configuration -func (o *DeleteClusterParams) validateConfiguration(formats strfmt.Registry) error { - - if err := validate.EnumCase("configuration", "query", *o.Configuration, []interface{}{"keep"}, true); err != nil { - return err - } - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteClusterParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cluster/delete_cluster_responses.go b/operations/cluster/delete_cluster_responses.go deleted file mode 100644 index 582a1afc..00000000 --- a/operations/cluster/delete_cluster_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteClusterNoContentCode is the HTTP code returned for type DeleteClusterNoContent -const DeleteClusterNoContentCode int = 204 - -/* -DeleteClusterNoContent Cluster settings deleted and node moved to single mode - -swagger:response deleteClusterNoContent -*/ -type DeleteClusterNoContent struct { -} - -// NewDeleteClusterNoContent creates DeleteClusterNoContent with default headers values -func NewDeleteClusterNoContent() *DeleteClusterNoContent { - - return &DeleteClusterNoContent{} -} - -// WriteResponse to the client -func (o *DeleteClusterNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteClusterDefault General Error - -swagger:response deleteClusterDefault -*/ -type DeleteClusterDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteClusterDefault creates DeleteClusterDefault with default headers values -func NewDeleteClusterDefault(code int) *DeleteClusterDefault { - if code <= 0 { - code = 500 - } - - return &DeleteClusterDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete cluster default response -func (o *DeleteClusterDefault) WithStatusCode(code int) *DeleteClusterDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete cluster default response -func (o *DeleteClusterDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete cluster default response -func (o *DeleteClusterDefault) WithConfigurationVersion(configurationVersion string) *DeleteClusterDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete cluster default response -func (o *DeleteClusterDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete cluster default response -func (o *DeleteClusterDefault) WithPayload(payload *models.Error) *DeleteClusterDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete cluster default response -func (o *DeleteClusterDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteClusterDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cluster/delete_cluster_urlbuilder.go b/operations/cluster/delete_cluster_urlbuilder.go deleted file mode 100644 index 6294af0a..00000000 --- a/operations/cluster/delete_cluster_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// DeleteClusterURL generates an URL for the delete cluster operation -type DeleteClusterURL struct { - Configuration *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteClusterURL) WithBasePath(bp string) *DeleteClusterURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteClusterURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteClusterURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var configurationQ string - if o.Configuration != nil { - configurationQ = *o.Configuration - } - if configurationQ != "" { - qs.Set("configuration", configurationQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteClusterURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteClusterURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteClusterURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteClusterURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteClusterURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteClusterURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cluster/edit_cluster.go b/operations/cluster/edit_cluster.go deleted file mode 100644 index a5a79cfa..00000000 --- a/operations/cluster/edit_cluster.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// EditClusterHandlerFunc turns a function with the right signature into a edit cluster handler -type EditClusterHandlerFunc func(EditClusterParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditClusterHandlerFunc) Handle(params EditClusterParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// EditClusterHandler interface for that can handle valid edit cluster params -type EditClusterHandler interface { - Handle(EditClusterParams, interface{}) middleware.Responder -} - -// NewEditCluster creates a new http.Handler for the edit cluster operation -func NewEditCluster(ctx *middleware.Context, handler EditClusterHandler) *EditCluster { - return &EditCluster{Context: ctx, Handler: handler} -} - -/* - EditCluster swagger:route PUT /cluster Cluster editCluster - -# Edit cluster settings - -Edit cluster settings -*/ -type EditCluster struct { - Context *middleware.Context - Handler EditClusterHandler -} - -func (o *EditCluster) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditClusterParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cluster/edit_cluster_parameters.go b/operations/cluster/edit_cluster_parameters.go deleted file mode 100644 index 28a96c8f..00000000 --- a/operations/cluster/edit_cluster_parameters.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewEditClusterParams creates a new EditClusterParams object -// -// There are no default values defined in the spec. -func NewEditClusterParams() EditClusterParams { - - return EditClusterParams{} -} - -// EditClusterParams contains all the bound params for the edit cluster operation -// typically these are obtained from a http.Request -// -// swagger:parameters editCluster -type EditClusterParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ClusterSettings - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEditClusterParams() beforehand. -func (o *EditClusterParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ClusterSettings - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *EditClusterParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cluster/edit_cluster_responses.go b/operations/cluster/edit_cluster_responses.go deleted file mode 100644 index 9d370c0c..00000000 --- a/operations/cluster/edit_cluster_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// EditClusterOKCode is the HTTP code returned for type EditClusterOK -const EditClusterOKCode int = 200 - -/* -EditClusterOK Cluster settings changed - -swagger:response editClusterOK -*/ -type EditClusterOK struct { - - /* - In: Body - */ - Payload *models.ClusterSettings `json:"body,omitempty"` -} - -// NewEditClusterOK creates EditClusterOK with default headers values -func NewEditClusterOK() *EditClusterOK { - - return &EditClusterOK{} -} - -// WithPayload adds the payload to the edit cluster o k response -func (o *EditClusterOK) WithPayload(payload *models.ClusterSettings) *EditClusterOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit cluster o k response -func (o *EditClusterOK) SetPayload(payload *models.ClusterSettings) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditClusterOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditClusterBadRequestCode is the HTTP code returned for type EditClusterBadRequest -const EditClusterBadRequestCode int = 400 - -/* -EditClusterBadRequest Bad request - -swagger:response editClusterBadRequest -*/ -type EditClusterBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditClusterBadRequest creates EditClusterBadRequest with default headers values -func NewEditClusterBadRequest() *EditClusterBadRequest { - - return &EditClusterBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit cluster bad request response -func (o *EditClusterBadRequest) WithConfigurationVersion(configurationVersion string) *EditClusterBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit cluster bad request response -func (o *EditClusterBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit cluster bad request response -func (o *EditClusterBadRequest) WithPayload(payload *models.Error) *EditClusterBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit cluster bad request response -func (o *EditClusterBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditClusterBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -EditClusterDefault General Error - -swagger:response editClusterDefault -*/ -type EditClusterDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditClusterDefault creates EditClusterDefault with default headers values -func NewEditClusterDefault(code int) *EditClusterDefault { - if code <= 0 { - code = 500 - } - - return &EditClusterDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit cluster default response -func (o *EditClusterDefault) WithStatusCode(code int) *EditClusterDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit cluster default response -func (o *EditClusterDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the edit cluster default response -func (o *EditClusterDefault) WithConfigurationVersion(configurationVersion string) *EditClusterDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit cluster default response -func (o *EditClusterDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit cluster default response -func (o *EditClusterDefault) WithPayload(payload *models.Error) *EditClusterDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit cluster default response -func (o *EditClusterDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditClusterDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cluster/edit_cluster_urlbuilder.go b/operations/cluster/edit_cluster_urlbuilder.go deleted file mode 100644 index b85f0ccd..00000000 --- a/operations/cluster/edit_cluster_urlbuilder.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// EditClusterURL generates an URL for the edit cluster operation -type EditClusterURL struct { - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditClusterURL) WithBasePath(bp string) *EditClusterURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditClusterURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditClusterURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EditClusterURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EditClusterURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditClusterURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditClusterURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditClusterURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EditClusterURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cluster/get_cluster.go b/operations/cluster/get_cluster.go deleted file mode 100644 index a4f492c5..00000000 --- a/operations/cluster/get_cluster.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetClusterHandlerFunc turns a function with the right signature into a get cluster handler -type GetClusterHandlerFunc func(GetClusterParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetClusterHandlerFunc) Handle(params GetClusterParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetClusterHandler interface for that can handle valid get cluster params -type GetClusterHandler interface { - Handle(GetClusterParams, interface{}) middleware.Responder -} - -// NewGetCluster creates a new http.Handler for the get cluster operation -func NewGetCluster(ctx *middleware.Context, handler GetClusterHandler) *GetCluster { - return &GetCluster{Context: ctx, Handler: handler} -} - -/* - GetCluster swagger:route GET /cluster Cluster getCluster - -# Return cluster data - -Returns cluster data -*/ -type GetCluster struct { - Context *middleware.Context - Handler GetClusterHandler -} - -func (o *GetCluster) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetClusterParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cluster/get_cluster_parameters.go b/operations/cluster/get_cluster_parameters.go deleted file mode 100644 index 23140d85..00000000 --- a/operations/cluster/get_cluster_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetClusterParams creates a new GetClusterParams object -// -// There are no default values defined in the spec. -func NewGetClusterParams() GetClusterParams { - - return GetClusterParams{} -} - -// GetClusterParams contains all the bound params for the get cluster operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCluster -type GetClusterParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetClusterParams() beforehand. -func (o *GetClusterParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/cluster/get_cluster_responses.go b/operations/cluster/get_cluster_responses.go deleted file mode 100644 index 53ec66e0..00000000 --- a/operations/cluster/get_cluster_responses.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetClusterOKCode is the HTTP code returned for type GetClusterOK -const GetClusterOKCode int = 200 - -/* -GetClusterOK Success - -swagger:response getClusterOK -*/ -type GetClusterOK struct { - - /* - In: Body - */ - Payload *models.ClusterSettings `json:"body,omitempty"` -} - -// NewGetClusterOK creates GetClusterOK with default headers values -func NewGetClusterOK() *GetClusterOK { - - return &GetClusterOK{} -} - -// WithPayload adds the payload to the get cluster o k response -func (o *GetClusterOK) WithPayload(payload *models.ClusterSettings) *GetClusterOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cluster o k response -func (o *GetClusterOK) SetPayload(payload *models.ClusterSettings) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetClusterOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetClusterDefault General Error - -swagger:response getClusterDefault -*/ -type GetClusterDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetClusterDefault creates GetClusterDefault with default headers values -func NewGetClusterDefault(code int) *GetClusterDefault { - if code <= 0 { - code = 500 - } - - return &GetClusterDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get cluster default response -func (o *GetClusterDefault) WithStatusCode(code int) *GetClusterDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get cluster default response -func (o *GetClusterDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get cluster default response -func (o *GetClusterDefault) WithConfigurationVersion(configurationVersion string) *GetClusterDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get cluster default response -func (o *GetClusterDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get cluster default response -func (o *GetClusterDefault) WithPayload(payload *models.Error) *GetClusterDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cluster default response -func (o *GetClusterDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetClusterDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cluster/get_cluster_urlbuilder.go b/operations/cluster/get_cluster_urlbuilder.go deleted file mode 100644 index 4a708003..00000000 --- a/operations/cluster/get_cluster_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetClusterURL generates an URL for the get cluster operation -type GetClusterURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetClusterURL) WithBasePath(bp string) *GetClusterURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetClusterURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetClusterURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetClusterURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetClusterURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetClusterURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetClusterURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetClusterURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetClusterURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cluster/initiate_certificate_refresh.go b/operations/cluster/initiate_certificate_refresh.go deleted file mode 100644 index 316e0385..00000000 --- a/operations/cluster/initiate_certificate_refresh.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// InitiateCertificateRefreshHandlerFunc turns a function with the right signature into a initiate certificate refresh handler -type InitiateCertificateRefreshHandlerFunc func(InitiateCertificateRefreshParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn InitiateCertificateRefreshHandlerFunc) Handle(params InitiateCertificateRefreshParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// InitiateCertificateRefreshHandler interface for that can handle valid initiate certificate refresh params -type InitiateCertificateRefreshHandler interface { - Handle(InitiateCertificateRefreshParams, interface{}) middleware.Responder -} - -// NewInitiateCertificateRefresh creates a new http.Handler for the initiate certificate refresh operation -func NewInitiateCertificateRefresh(ctx *middleware.Context, handler InitiateCertificateRefreshHandler) *InitiateCertificateRefresh { - return &InitiateCertificateRefresh{Context: ctx, Handler: handler} -} - -/* - InitiateCertificateRefresh swagger:route POST /cluster/certificate Cluster initiateCertificateRefresh - -# Initiates a certificate refresh - -Initiates a certificate refresh -*/ -type InitiateCertificateRefresh struct { - Context *middleware.Context - Handler InitiateCertificateRefreshHandler -} - -func (o *InitiateCertificateRefresh) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewInitiateCertificateRefreshParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cluster/initiate_certificate_refresh_parameters.go b/operations/cluster/initiate_certificate_refresh_parameters.go deleted file mode 100644 index 56ce3dfd..00000000 --- a/operations/cluster/initiate_certificate_refresh_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewInitiateCertificateRefreshParams creates a new InitiateCertificateRefreshParams object -// -// There are no default values defined in the spec. -func NewInitiateCertificateRefreshParams() InitiateCertificateRefreshParams { - - return InitiateCertificateRefreshParams{} -} - -// InitiateCertificateRefreshParams contains all the bound params for the initiate certificate refresh operation -// typically these are obtained from a http.Request -// -// swagger:parameters initiateCertificateRefresh -type InitiateCertificateRefreshParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewInitiateCertificateRefreshParams() beforehand. -func (o *InitiateCertificateRefreshParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/cluster/initiate_certificate_refresh_responses.go b/operations/cluster/initiate_certificate_refresh_responses.go deleted file mode 100644 index 28d92fae..00000000 --- a/operations/cluster/initiate_certificate_refresh_responses.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// InitiateCertificateRefreshOKCode is the HTTP code returned for type InitiateCertificateRefreshOK -const InitiateCertificateRefreshOKCode int = 200 - -/* -InitiateCertificateRefreshOK refresh activated - -swagger:response initiateCertificateRefreshOK -*/ -type InitiateCertificateRefreshOK struct { -} - -// NewInitiateCertificateRefreshOK creates InitiateCertificateRefreshOK with default headers values -func NewInitiateCertificateRefreshOK() *InitiateCertificateRefreshOK { - - return &InitiateCertificateRefreshOK{} -} - -// WriteResponse to the client -func (o *InitiateCertificateRefreshOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -// InitiateCertificateRefreshForbiddenCode is the HTTP code returned for type InitiateCertificateRefreshForbidden -const InitiateCertificateRefreshForbiddenCode int = 403 - -/* -InitiateCertificateRefreshForbidden refresh not possible - -swagger:response initiateCertificateRefreshForbidden -*/ -type InitiateCertificateRefreshForbidden struct { -} - -// NewInitiateCertificateRefreshForbidden creates InitiateCertificateRefreshForbidden with default headers values -func NewInitiateCertificateRefreshForbidden() *InitiateCertificateRefreshForbidden { - - return &InitiateCertificateRefreshForbidden{} -} - -// WriteResponse to the client -func (o *InitiateCertificateRefreshForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(403) -} - -/* -InitiateCertificateRefreshDefault General Error - -swagger:response initiateCertificateRefreshDefault -*/ -type InitiateCertificateRefreshDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewInitiateCertificateRefreshDefault creates InitiateCertificateRefreshDefault with default headers values -func NewInitiateCertificateRefreshDefault(code int) *InitiateCertificateRefreshDefault { - if code <= 0 { - code = 500 - } - - return &InitiateCertificateRefreshDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) WithStatusCode(code int) *InitiateCertificateRefreshDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) WithConfigurationVersion(configurationVersion string) *InitiateCertificateRefreshDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) WithPayload(payload *models.Error) *InitiateCertificateRefreshDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the initiate certificate refresh default response -func (o *InitiateCertificateRefreshDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *InitiateCertificateRefreshDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cluster/initiate_certificate_refresh_urlbuilder.go b/operations/cluster/initiate_certificate_refresh_urlbuilder.go deleted file mode 100644 index 93abeec9..00000000 --- a/operations/cluster/initiate_certificate_refresh_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// InitiateCertificateRefreshURL generates an URL for the initiate certificate refresh operation -type InitiateCertificateRefreshURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *InitiateCertificateRefreshURL) WithBasePath(bp string) *InitiateCertificateRefreshURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *InitiateCertificateRefreshURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *InitiateCertificateRefreshURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster/certificate" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *InitiateCertificateRefreshURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *InitiateCertificateRefreshURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *InitiateCertificateRefreshURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on InitiateCertificateRefreshURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on InitiateCertificateRefreshURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *InitiateCertificateRefreshURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/cluster/post_cluster.go b/operations/cluster/post_cluster.go deleted file mode 100644 index 0bb5ec91..00000000 --- a/operations/cluster/post_cluster.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// PostClusterHandlerFunc turns a function with the right signature into a post cluster handler -type PostClusterHandlerFunc func(PostClusterParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn PostClusterHandlerFunc) Handle(params PostClusterParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// PostClusterHandler interface for that can handle valid post cluster params -type PostClusterHandler interface { - Handle(PostClusterParams, interface{}) middleware.Responder -} - -// NewPostCluster creates a new http.Handler for the post cluster operation -func NewPostCluster(ctx *middleware.Context, handler PostClusterHandler) *PostCluster { - return &PostCluster{Context: ctx, Handler: handler} -} - -/* - PostCluster swagger:route POST /cluster Cluster postCluster - -# Post cluster settings - -Post cluster settings -*/ -type PostCluster struct { - Context *middleware.Context - Handler PostClusterHandler -} - -func (o *PostCluster) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPostClusterParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/cluster/post_cluster_parameters.go b/operations/cluster/post_cluster_parameters.go deleted file mode 100644 index c52b7c8f..00000000 --- a/operations/cluster/post_cluster_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewPostClusterParams creates a new PostClusterParams object -// -// There are no default values defined in the spec. -func NewPostClusterParams() PostClusterParams { - - return PostClusterParams{} -} - -// PostClusterParams contains all the bound params for the post cluster operation -// typically these are obtained from a http.Request -// -// swagger:parameters postCluster -type PostClusterParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Force the advertised address when joining a cluster - In: query - */ - AdvertisedAddress *string - /*Force the advertised port when joining a cluster - Maximum: 65535 - Minimum: 1 - In: query - */ - AdvertisedPort *int64 - /*In case of moving to single mode do we keep or clean configuration - In: query - */ - Configuration *string - /* - Required: true - In: body - */ - Data *models.ClusterSettings - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewPostClusterParams() beforehand. -func (o *PostClusterParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qAdvertisedAddress, qhkAdvertisedAddress, _ := qs.GetOK("advertised_address") - if err := o.bindAdvertisedAddress(qAdvertisedAddress, qhkAdvertisedAddress, route.Formats); err != nil { - res = append(res, err) - } - - qAdvertisedPort, qhkAdvertisedPort, _ := qs.GetOK("advertised_port") - if err := o.bindAdvertisedPort(qAdvertisedPort, qhkAdvertisedPort, route.Formats); err != nil { - res = append(res, err) - } - - qConfiguration, qhkConfiguration, _ := qs.GetOK("configuration") - if err := o.bindConfiguration(qConfiguration, qhkConfiguration, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ClusterSettings - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindAdvertisedAddress binds and validates parameter AdvertisedAddress from query. -func (o *PostClusterParams) bindAdvertisedAddress(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.AdvertisedAddress = &raw - - return nil -} - -// bindAdvertisedPort binds and validates parameter AdvertisedPort from query. -func (o *PostClusterParams) bindAdvertisedPort(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("advertised_port", "query", "int64", raw) - } - o.AdvertisedPort = &value - - if err := o.validateAdvertisedPort(formats); err != nil { - return err - } - - return nil -} - -// validateAdvertisedPort carries on validations for parameter AdvertisedPort -func (o *PostClusterParams) validateAdvertisedPort(formats strfmt.Registry) error { - - if err := validate.MinimumInt("advertised_port", "query", *o.AdvertisedPort, 1, false); err != nil { - return err - } - - if err := validate.MaximumInt("advertised_port", "query", *o.AdvertisedPort, 65535, false); err != nil { - return err - } - - return nil -} - -// bindConfiguration binds and validates parameter Configuration from query. -func (o *PostClusterParams) bindConfiguration(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Configuration = &raw - - if err := o.validateConfiguration(formats); err != nil { - return err - } - - return nil -} - -// validateConfiguration carries on validations for parameter Configuration -func (o *PostClusterParams) validateConfiguration(formats strfmt.Registry) error { - - if err := validate.EnumCase("configuration", "query", *o.Configuration, []interface{}{"keep"}, true); err != nil { - return err - } - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *PostClusterParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/cluster/post_cluster_responses.go b/operations/cluster/post_cluster_responses.go deleted file mode 100644 index 0edf170e..00000000 --- a/operations/cluster/post_cluster_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// PostClusterOKCode is the HTTP code returned for type PostClusterOK -const PostClusterOKCode int = 200 - -/* -PostClusterOK Cluster settings changed - -swagger:response postClusterOK -*/ -type PostClusterOK struct { - - /* - In: Body - */ - Payload *models.ClusterSettings `json:"body,omitempty"` -} - -// NewPostClusterOK creates PostClusterOK with default headers values -func NewPostClusterOK() *PostClusterOK { - - return &PostClusterOK{} -} - -// WithPayload adds the payload to the post cluster o k response -func (o *PostClusterOK) WithPayload(payload *models.ClusterSettings) *PostClusterOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post cluster o k response -func (o *PostClusterOK) SetPayload(payload *models.ClusterSettings) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostClusterOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// PostClusterBadRequestCode is the HTTP code returned for type PostClusterBadRequest -const PostClusterBadRequestCode int = 400 - -/* -PostClusterBadRequest Bad request - -swagger:response postClusterBadRequest -*/ -type PostClusterBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostClusterBadRequest creates PostClusterBadRequest with default headers values -func NewPostClusterBadRequest() *PostClusterBadRequest { - - return &PostClusterBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the post cluster bad request response -func (o *PostClusterBadRequest) WithConfigurationVersion(configurationVersion string) *PostClusterBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post cluster bad request response -func (o *PostClusterBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post cluster bad request response -func (o *PostClusterBadRequest) WithPayload(payload *models.Error) *PostClusterBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post cluster bad request response -func (o *PostClusterBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostClusterBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -PostClusterDefault General Error - -swagger:response postClusterDefault -*/ -type PostClusterDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewPostClusterDefault creates PostClusterDefault with default headers values -func NewPostClusterDefault(code int) *PostClusterDefault { - if code <= 0 { - code = 500 - } - - return &PostClusterDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the post cluster default response -func (o *PostClusterDefault) WithStatusCode(code int) *PostClusterDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the post cluster default response -func (o *PostClusterDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the post cluster default response -func (o *PostClusterDefault) WithConfigurationVersion(configurationVersion string) *PostClusterDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post cluster default response -func (o *PostClusterDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post cluster default response -func (o *PostClusterDefault) WithPayload(payload *models.Error) *PostClusterDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post cluster default response -func (o *PostClusterDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostClusterDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/cluster/post_cluster_urlbuilder.go b/operations/cluster/post_cluster_urlbuilder.go deleted file mode 100644 index 004b0450..00000000 --- a/operations/cluster/post_cluster_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package cluster - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// PostClusterURL generates an URL for the post cluster operation -type PostClusterURL struct { - AdvertisedAddress *string - AdvertisedPort *int64 - Configuration *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostClusterURL) WithBasePath(bp string) *PostClusterURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostClusterURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PostClusterURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/cluster" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var advertisedAddressQ string - if o.AdvertisedAddress != nil { - advertisedAddressQ = *o.AdvertisedAddress - } - if advertisedAddressQ != "" { - qs.Set("advertised_address", advertisedAddressQ) - } - - var advertisedPortQ string - if o.AdvertisedPort != nil { - advertisedPortQ = swag.FormatInt64(*o.AdvertisedPort) - } - if advertisedPortQ != "" { - qs.Set("advertised_port", advertisedPortQ) - } - - var configurationQ string - if o.Configuration != nil { - configurationQ = *o.Configuration - } - if configurationQ != "" { - qs.Set("configuration", configurationQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PostClusterURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *PostClusterURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PostClusterURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PostClusterURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PostClusterURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *PostClusterURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/configuration/get_configuration_version.go b/operations/configuration/get_configuration_version.go deleted file mode 100644 index 8b4348e8..00000000 --- a/operations/configuration/get_configuration_version.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetConfigurationVersionHandlerFunc turns a function with the right signature into a get configuration version handler -type GetConfigurationVersionHandlerFunc func(GetConfigurationVersionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetConfigurationVersionHandlerFunc) Handle(params GetConfigurationVersionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetConfigurationVersionHandler interface for that can handle valid get configuration version params -type GetConfigurationVersionHandler interface { - Handle(GetConfigurationVersionParams, interface{}) middleware.Responder -} - -// NewGetConfigurationVersion creates a new http.Handler for the get configuration version operation -func NewGetConfigurationVersion(ctx *middleware.Context, handler GetConfigurationVersionHandler) *GetConfigurationVersion { - return &GetConfigurationVersion{Context: ctx, Handler: handler} -} - -/* - GetConfigurationVersion swagger:route GET /services/haproxy/configuration/version Configuration getConfigurationVersion - -# Return a configuration version - -Returns configuration version. -*/ -type GetConfigurationVersion struct { - Context *middleware.Context - Handler GetConfigurationVersionHandler -} - -func (o *GetConfigurationVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetConfigurationVersionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/configuration/get_configuration_version_parameters.go b/operations/configuration/get_configuration_version_parameters.go deleted file mode 100644 index a4204ba1..00000000 --- a/operations/configuration/get_configuration_version_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetConfigurationVersionParams creates a new GetConfigurationVersionParams object -// -// There are no default values defined in the spec. -func NewGetConfigurationVersionParams() GetConfigurationVersionParams { - - return GetConfigurationVersionParams{} -} - -// GetConfigurationVersionParams contains all the bound params for the get configuration version operation -// typically these are obtained from a http.Request -// -// swagger:parameters getConfigurationVersion -type GetConfigurationVersionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetConfigurationVersionParams() beforehand. -func (o *GetConfigurationVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetConfigurationVersionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/configuration/get_configuration_version_responses.go b/operations/configuration/get_configuration_version_responses.go deleted file mode 100644 index 6e9725b7..00000000 --- a/operations/configuration/get_configuration_version_responses.go +++ /dev/null @@ -1,220 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetConfigurationVersionOKCode is the HTTP code returned for type GetConfigurationVersionOK -const GetConfigurationVersionOKCode int = 200 - -/* -GetConfigurationVersionOK Configuration version - -swagger:response getConfigurationVersionOK -*/ -type GetConfigurationVersionOK struct { - - /* - In: Body - */ - Payload int64 `json:"body,omitempty"` -} - -// NewGetConfigurationVersionOK creates GetConfigurationVersionOK with default headers values -func NewGetConfigurationVersionOK() *GetConfigurationVersionOK { - - return &GetConfigurationVersionOK{} -} - -// WithPayload adds the payload to the get configuration version o k response -func (o *GetConfigurationVersionOK) WithPayload(payload int64) *GetConfigurationVersionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration version o k response -func (o *GetConfigurationVersionOK) SetPayload(payload int64) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationVersionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetConfigurationVersionNotFoundCode is the HTTP code returned for type GetConfigurationVersionNotFound -const GetConfigurationVersionNotFoundCode int = 404 - -/* -GetConfigurationVersionNotFound The specified resource was not found - -swagger:response getConfigurationVersionNotFound -*/ -type GetConfigurationVersionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConfigurationVersionNotFound creates GetConfigurationVersionNotFound with default headers values -func NewGetConfigurationVersionNotFound() *GetConfigurationVersionNotFound { - - return &GetConfigurationVersionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get configuration version not found response -func (o *GetConfigurationVersionNotFound) WithConfigurationVersion(configurationVersion string) *GetConfigurationVersionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get configuration version not found response -func (o *GetConfigurationVersionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get configuration version not found response -func (o *GetConfigurationVersionNotFound) WithPayload(payload *models.Error) *GetConfigurationVersionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration version not found response -func (o *GetConfigurationVersionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationVersionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetConfigurationVersionDefault General Error - -swagger:response getConfigurationVersionDefault -*/ -type GetConfigurationVersionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConfigurationVersionDefault creates GetConfigurationVersionDefault with default headers values -func NewGetConfigurationVersionDefault(code int) *GetConfigurationVersionDefault { - if code <= 0 { - code = 500 - } - - return &GetConfigurationVersionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get configuration version default response -func (o *GetConfigurationVersionDefault) WithStatusCode(code int) *GetConfigurationVersionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get configuration version default response -func (o *GetConfigurationVersionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get configuration version default response -func (o *GetConfigurationVersionDefault) WithConfigurationVersion(configurationVersion string) *GetConfigurationVersionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get configuration version default response -func (o *GetConfigurationVersionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get configuration version default response -func (o *GetConfigurationVersionDefault) WithPayload(payload *models.Error) *GetConfigurationVersionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration version default response -func (o *GetConfigurationVersionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/configuration/get_configuration_version_urlbuilder.go b/operations/configuration/get_configuration_version_urlbuilder.go deleted file mode 100644 index a05251d9..00000000 --- a/operations/configuration/get_configuration_version_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetConfigurationVersionURL generates an URL for the get configuration version operation -type GetConfigurationVersionURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConfigurationVersionURL) WithBasePath(bp string) *GetConfigurationVersionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConfigurationVersionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetConfigurationVersionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/version" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetConfigurationVersionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetConfigurationVersionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetConfigurationVersionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetConfigurationVersionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetConfigurationVersionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetConfigurationVersionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/configuration/get_h_a_proxy_configuration.go b/operations/configuration/get_h_a_proxy_configuration.go deleted file mode 100644 index 725e5fa1..00000000 --- a/operations/configuration/get_h_a_proxy_configuration.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHAProxyConfigurationHandlerFunc turns a function with the right signature into a get h a proxy configuration handler -type GetHAProxyConfigurationHandlerFunc func(GetHAProxyConfigurationParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHAProxyConfigurationHandlerFunc) Handle(params GetHAProxyConfigurationParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHAProxyConfigurationHandler interface for that can handle valid get h a proxy configuration params -type GetHAProxyConfigurationHandler interface { - Handle(GetHAProxyConfigurationParams, interface{}) middleware.Responder -} - -// NewGetHAProxyConfiguration creates a new http.Handler for the get h a proxy configuration operation -func NewGetHAProxyConfiguration(ctx *middleware.Context, handler GetHAProxyConfigurationHandler) *GetHAProxyConfiguration { - return &GetHAProxyConfiguration{Context: ctx, Handler: handler} -} - -/* - GetHAProxyConfiguration swagger:route GET /services/haproxy/configuration/raw Configuration getHAProxyConfiguration - -# Return HAProxy configuration - -Returns HAProxy configuration file in plain text -*/ -type GetHAProxyConfiguration struct { - Context *middleware.Context - Handler GetHAProxyConfigurationHandler -} - -func (o *GetHAProxyConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHAProxyConfigurationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/configuration/get_h_a_proxy_configuration_parameters.go b/operations/configuration/get_h_a_proxy_configuration_parameters.go deleted file mode 100644 index aefe2843..00000000 --- a/operations/configuration/get_h_a_proxy_configuration_parameters.go +++ /dev/null @@ -1,125 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHAProxyConfigurationParams creates a new GetHAProxyConfigurationParams object -// -// There are no default values defined in the spec. -func NewGetHAProxyConfigurationParams() GetHAProxyConfigurationParams { - - return GetHAProxyConfigurationParams{} -} - -// GetHAProxyConfigurationParams contains all the bound params for the get h a proxy configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHAProxyConfiguration -type GetHAProxyConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHAProxyConfigurationParams() beforehand. -func (o *GetHAProxyConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHAProxyConfigurationParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *GetHAProxyConfigurationParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/configuration/get_h_a_proxy_configuration_responses.go b/operations/configuration/get_h_a_proxy_configuration_responses.go deleted file mode 100644 index afc4fad5..00000000 --- a/operations/configuration/get_h_a_proxy_configuration_responses.go +++ /dev/null @@ -1,215 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" -) - -// GetHAProxyConfigurationOKCode is the HTTP code returned for type GetHAProxyConfigurationOK -const GetHAProxyConfigurationOKCode int = 200 - -/* -GetHAProxyConfigurationOK Operation successful - -swagger:response getHAProxyConfigurationOK -*/ -type GetHAProxyConfigurationOK struct { - /*Cluster configuration version - - */ - ClusterVersion string `json:"Cluster-Version"` - /*Configuration file md5 checksum - - */ - ConfigurationChecksum string `json:"Configuration-Checksum"` - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewGetHAProxyConfigurationOK creates GetHAProxyConfigurationOK with default headers values -func NewGetHAProxyConfigurationOK() *GetHAProxyConfigurationOK { - - return &GetHAProxyConfigurationOK{} -} - -// WithClusterVersion adds the clusterVersion to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) WithClusterVersion(clusterVersion string) *GetHAProxyConfigurationOK { - o.ClusterVersion = clusterVersion - return o -} - -// SetClusterVersion sets the clusterVersion to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) SetClusterVersion(clusterVersion string) { - o.ClusterVersion = clusterVersion -} - -// WithConfigurationChecksum adds the configurationChecksum to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) WithConfigurationChecksum(configurationChecksum string) *GetHAProxyConfigurationOK { - o.ConfigurationChecksum = configurationChecksum - return o -} - -// SetConfigurationChecksum sets the configurationChecksum to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) SetConfigurationChecksum(configurationChecksum string) { - o.ConfigurationChecksum = configurationChecksum -} - -// WithConfigurationVersion adds the configurationVersion to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) WithConfigurationVersion(configurationVersion string) *GetHAProxyConfigurationOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) WithPayload(payload string) *GetHAProxyConfigurationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get h a proxy configuration o k response -func (o *GetHAProxyConfigurationOK) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHAProxyConfigurationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Cluster-Version - - clusterVersion := o.ClusterVersion - if clusterVersion != "" { - rw.Header().Set("Cluster-Version", clusterVersion) - } - - // response header Configuration-Checksum - - configurationChecksum := o.ConfigurationChecksum - if configurationChecksum != "" { - rw.Header().Set("Configuration-Checksum", configurationChecksum) - } - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetHAProxyConfigurationDefault General Error - -swagger:response getHAProxyConfigurationDefault -*/ -type GetHAProxyConfigurationDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewGetHAProxyConfigurationDefault creates GetHAProxyConfigurationDefault with default headers values -func NewGetHAProxyConfigurationDefault(code int) *GetHAProxyConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &GetHAProxyConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) WithStatusCode(code int) *GetHAProxyConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) WithConfigurationVersion(configurationVersion string) *GetHAProxyConfigurationDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) WithPayload(payload string) *GetHAProxyConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get h a proxy configuration default response -func (o *GetHAProxyConfigurationDefault) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHAProxyConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} diff --git a/operations/configuration/get_h_a_proxy_configuration_urlbuilder.go b/operations/configuration/get_h_a_proxy_configuration_urlbuilder.go deleted file mode 100644 index bdb7fa95..00000000 --- a/operations/configuration/get_h_a_proxy_configuration_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetHAProxyConfigurationURL generates an URL for the get h a proxy configuration operation -type GetHAProxyConfigurationURL struct { - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHAProxyConfigurationURL) WithBasePath(bp string) *GetHAProxyConfigurationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHAProxyConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHAProxyConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/raw" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHAProxyConfigurationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHAProxyConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHAProxyConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHAProxyConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHAProxyConfigurationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHAProxyConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/configuration/post_h_a_proxy_configuration.go b/operations/configuration/post_h_a_proxy_configuration.go deleted file mode 100644 index 7e152972..00000000 --- a/operations/configuration/post_h_a_proxy_configuration.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// PostHAProxyConfigurationHandlerFunc turns a function with the right signature into a post h a proxy configuration handler -type PostHAProxyConfigurationHandlerFunc func(PostHAProxyConfigurationParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn PostHAProxyConfigurationHandlerFunc) Handle(params PostHAProxyConfigurationParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// PostHAProxyConfigurationHandler interface for that can handle valid post h a proxy configuration params -type PostHAProxyConfigurationHandler interface { - Handle(PostHAProxyConfigurationParams, interface{}) middleware.Responder -} - -// NewPostHAProxyConfiguration creates a new http.Handler for the post h a proxy configuration operation -func NewPostHAProxyConfiguration(ctx *middleware.Context, handler PostHAProxyConfigurationHandler) *PostHAProxyConfiguration { - return &PostHAProxyConfiguration{Context: ctx, Handler: handler} -} - -/* - PostHAProxyConfiguration swagger:route POST /services/haproxy/configuration/raw Configuration postHAProxyConfiguration - -# Push new haproxy configuration - -Push a new haproxy configuration file in plain text -*/ -type PostHAProxyConfiguration struct { - Context *middleware.Context - Handler PostHAProxyConfigurationHandler -} - -func (o *PostHAProxyConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPostHAProxyConfigurationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/configuration/post_h_a_proxy_configuration_parameters.go b/operations/configuration/post_h_a_proxy_configuration_parameters.go deleted file mode 100644 index 64eaef4b..00000000 --- a/operations/configuration/post_h_a_proxy_configuration_parameters.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewPostHAProxyConfigurationParams creates a new PostHAProxyConfigurationParams object -// with the default values initialized. -func NewPostHAProxyConfigurationParams() PostHAProxyConfigurationParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - onlyValidateDefault = bool(false) - skipReloadDefault = bool(false) - skipVersionDefault = bool(false) - ) - - return PostHAProxyConfigurationParams{ - ForceReload: &forceReloadDefault, - - OnlyValidate: &onlyValidateDefault, - - SkipReload: &skipReloadDefault, - - SkipVersion: &skipVersionDefault, - } -} - -// PostHAProxyConfigurationParams contains all the bound params for the post h a proxy configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters postHAProxyConfiguration -type PostHAProxyConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*List of Runtime API commands with parameters separated by ';' - In: header - */ - XRuntimeActions *string - /* - Required: true - In: body - */ - Data string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*If set, only validates configuration, without applying it - In: query - Default: false - */ - OnlyValidate *bool - /*If set, no reload will be initiated and runtime actions from X-Runtime-Actions will be applied - In: query - Default: false - */ - SkipReload *bool - /*If set, no version check will be done and the pushed config will be enforced - In: query - Default: false - */ - SkipVersion *bool - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewPostHAProxyConfigurationParams() beforehand. -func (o *PostHAProxyConfigurationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if err := o.bindXRuntimeActions(r.Header[http.CanonicalHeaderKey("X-Runtime-Actions")], true, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body string - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // no validation required on inline body - o.Data = body - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qOnlyValidate, qhkOnlyValidate, _ := qs.GetOK("only_validate") - if err := o.bindOnlyValidate(qOnlyValidate, qhkOnlyValidate, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - - qSkipVersion, qhkSkipVersion, _ := qs.GetOK("skip_version") - if err := o.bindSkipVersion(qSkipVersion, qhkSkipVersion, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindXRuntimeActions binds and validates parameter XRuntimeActions from header. -func (o *PostHAProxyConfigurationParams) bindXRuntimeActions(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.XRuntimeActions = &raw - - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *PostHAProxyConfigurationParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewPostHAProxyConfigurationParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindOnlyValidate binds and validates parameter OnlyValidate from query. -func (o *PostHAProxyConfigurationParams) bindOnlyValidate(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewPostHAProxyConfigurationParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("only_validate", "query", "bool", raw) - } - o.OnlyValidate = &value - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *PostHAProxyConfigurationParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewPostHAProxyConfigurationParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} - -// bindSkipVersion binds and validates parameter SkipVersion from query. -func (o *PostHAProxyConfigurationParams) bindSkipVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewPostHAProxyConfigurationParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_version", "query", "bool", raw) - } - o.SkipVersion = &value - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *PostHAProxyConfigurationParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/configuration/post_h_a_proxy_configuration_responses.go b/operations/configuration/post_h_a_proxy_configuration_responses.go deleted file mode 100644 index 8396d193..00000000 --- a/operations/configuration/post_h_a_proxy_configuration_responses.go +++ /dev/null @@ -1,411 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" -) - -// PostHAProxyConfigurationCreatedCode is the HTTP code returned for type PostHAProxyConfigurationCreated -const PostHAProxyConfigurationCreatedCode int = 201 - -/* -PostHAProxyConfigurationCreated New HAProxy configuration pushed - -swagger:response postHAProxyConfigurationCreated -*/ -type PostHAProxyConfigurationCreated struct { - /*Cluster configuration version - - */ - ClusterVersion string `json:"Cluster-Version"` - /*Configuration file md5 checksum - - */ - ConfigurationChecksum string `json:"Configuration-Checksum"` - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewPostHAProxyConfigurationCreated creates PostHAProxyConfigurationCreated with default headers values -func NewPostHAProxyConfigurationCreated() *PostHAProxyConfigurationCreated { - - return &PostHAProxyConfigurationCreated{} -} - -// WithClusterVersion adds the clusterVersion to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) WithClusterVersion(clusterVersion string) *PostHAProxyConfigurationCreated { - o.ClusterVersion = clusterVersion - return o -} - -// SetClusterVersion sets the clusterVersion to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) SetClusterVersion(clusterVersion string) { - o.ClusterVersion = clusterVersion -} - -// WithConfigurationChecksum adds the configurationChecksum to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) WithConfigurationChecksum(configurationChecksum string) *PostHAProxyConfigurationCreated { - o.ConfigurationChecksum = configurationChecksum - return o -} - -// SetConfigurationChecksum sets the configurationChecksum to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) SetConfigurationChecksum(configurationChecksum string) { - o.ConfigurationChecksum = configurationChecksum -} - -// WithConfigurationVersion adds the configurationVersion to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) WithConfigurationVersion(configurationVersion string) *PostHAProxyConfigurationCreated { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) WithPayload(payload string) *PostHAProxyConfigurationCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post h a proxy configuration created response -func (o *PostHAProxyConfigurationCreated) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostHAProxyConfigurationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Cluster-Version - - clusterVersion := o.ClusterVersion - if clusterVersion != "" { - rw.Header().Set("Cluster-Version", clusterVersion) - } - - // response header Configuration-Checksum - - configurationChecksum := o.ConfigurationChecksum - if configurationChecksum != "" { - rw.Header().Set("Configuration-Checksum", configurationChecksum) - } - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(201) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// PostHAProxyConfigurationAcceptedCode is the HTTP code returned for type PostHAProxyConfigurationAccepted -const PostHAProxyConfigurationAcceptedCode int = 202 - -/* -PostHAProxyConfigurationAccepted Configuration change accepted and reload requested - -swagger:response postHAProxyConfigurationAccepted -*/ -type PostHAProxyConfigurationAccepted struct { - /*Cluster configuration version - - */ - ClusterVersion string `json:"Cluster-Version"` - /*Configuration file md5 checksum - - */ - ConfigurationChecksum string `json:"Configuration-Checksum"` - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewPostHAProxyConfigurationAccepted creates PostHAProxyConfigurationAccepted with default headers values -func NewPostHAProxyConfigurationAccepted() *PostHAProxyConfigurationAccepted { - - return &PostHAProxyConfigurationAccepted{} -} - -// WithClusterVersion adds the clusterVersion to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) WithClusterVersion(clusterVersion string) *PostHAProxyConfigurationAccepted { - o.ClusterVersion = clusterVersion - return o -} - -// SetClusterVersion sets the clusterVersion to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) SetClusterVersion(clusterVersion string) { - o.ClusterVersion = clusterVersion -} - -// WithConfigurationChecksum adds the configurationChecksum to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) WithConfigurationChecksum(configurationChecksum string) *PostHAProxyConfigurationAccepted { - o.ConfigurationChecksum = configurationChecksum - return o -} - -// SetConfigurationChecksum sets the configurationChecksum to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) SetConfigurationChecksum(configurationChecksum string) { - o.ConfigurationChecksum = configurationChecksum -} - -// WithConfigurationVersion adds the configurationVersion to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) WithConfigurationVersion(configurationVersion string) *PostHAProxyConfigurationAccepted { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithReloadID adds the reloadId to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) WithReloadID(reloadID string) *PostHAProxyConfigurationAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) WithPayload(payload string) *PostHAProxyConfigurationAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post h a proxy configuration accepted response -func (o *PostHAProxyConfigurationAccepted) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostHAProxyConfigurationAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Cluster-Version - - clusterVersion := o.ClusterVersion - if clusterVersion != "" { - rw.Header().Set("Cluster-Version", clusterVersion) - } - - // response header Configuration-Checksum - - configurationChecksum := o.ConfigurationChecksum - if configurationChecksum != "" { - rw.Header().Set("Configuration-Checksum", configurationChecksum) - } - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// PostHAProxyConfigurationBadRequestCode is the HTTP code returned for type PostHAProxyConfigurationBadRequest -const PostHAProxyConfigurationBadRequestCode int = 400 - -/* -PostHAProxyConfigurationBadRequest Bad request - -swagger:response postHAProxyConfigurationBadRequest -*/ -type PostHAProxyConfigurationBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewPostHAProxyConfigurationBadRequest creates PostHAProxyConfigurationBadRequest with default headers values -func NewPostHAProxyConfigurationBadRequest() *PostHAProxyConfigurationBadRequest { - - return &PostHAProxyConfigurationBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the post h a proxy configuration bad request response -func (o *PostHAProxyConfigurationBadRequest) WithConfigurationVersion(configurationVersion string) *PostHAProxyConfigurationBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post h a proxy configuration bad request response -func (o *PostHAProxyConfigurationBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post h a proxy configuration bad request response -func (o *PostHAProxyConfigurationBadRequest) WithPayload(payload string) *PostHAProxyConfigurationBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post h a proxy configuration bad request response -func (o *PostHAProxyConfigurationBadRequest) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostHAProxyConfigurationBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -PostHAProxyConfigurationDefault General Error - -swagger:response postHAProxyConfigurationDefault -*/ -type PostHAProxyConfigurationDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewPostHAProxyConfigurationDefault creates PostHAProxyConfigurationDefault with default headers values -func NewPostHAProxyConfigurationDefault(code int) *PostHAProxyConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &PostHAProxyConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) WithStatusCode(code int) *PostHAProxyConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) WithConfigurationVersion(configurationVersion string) *PostHAProxyConfigurationDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) WithPayload(payload string) *PostHAProxyConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post h a proxy configuration default response -func (o *PostHAProxyConfigurationDefault) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostHAProxyConfigurationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} diff --git a/operations/configuration/post_h_a_proxy_configuration_urlbuilder.go b/operations/configuration/post_h_a_proxy_configuration_urlbuilder.go deleted file mode 100644 index 9dcbbe78..00000000 --- a/operations/configuration/post_h_a_proxy_configuration_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// PostHAProxyConfigurationURL generates an URL for the post h a proxy configuration operation -type PostHAProxyConfigurationURL struct { - ForceReload *bool - OnlyValidate *bool - SkipReload *bool - SkipVersion *bool - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostHAProxyConfigurationURL) WithBasePath(bp string) *PostHAProxyConfigurationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *PostHAProxyConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PostHAProxyConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/raw" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var onlyValidateQ string - if o.OnlyValidate != nil { - onlyValidateQ = swag.FormatBool(*o.OnlyValidate) - } - if onlyValidateQ != "" { - qs.Set("only_validate", onlyValidateQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - var skipVersionQ string - if o.SkipVersion != nil { - skipVersionQ = swag.FormatBool(*o.SkipVersion) - } - if skipVersionQ != "" { - qs.Set("skip_version", skipVersionQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PostHAProxyConfigurationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *PostHAProxyConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PostHAProxyConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PostHAProxyConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PostHAProxyConfigurationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *PostHAProxyConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_load/create_crt_load.go b/operations/crt_load/create_crt_load.go deleted file mode 100644 index 983a7b94..00000000 --- a/operations/crt_load/create_crt_load.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCrtLoadHandlerFunc turns a function with the right signature into a create crt load handler -type CreateCrtLoadHandlerFunc func(CreateCrtLoadParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCrtLoadHandlerFunc) Handle(params CreateCrtLoadParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCrtLoadHandler interface for that can handle valid create crt load params -type CreateCrtLoadHandler interface { - Handle(CreateCrtLoadParams, interface{}) middleware.Responder -} - -// NewCreateCrtLoad creates a new http.Handler for the create crt load operation -func NewCreateCrtLoad(ctx *middleware.Context, handler CreateCrtLoadHandler) *CreateCrtLoad { - return &CreateCrtLoad{Context: ctx, Handler: handler} -} - -/* - CreateCrtLoad swagger:route POST /services/haproxy/configuration/crt_loads CrtLoad createCrtLoad - -# Add a new certificate to load - -Adds a new load entry to the specified crt_store section in the configuration -*/ -type CreateCrtLoad struct { - Context *middleware.Context - Handler CreateCrtLoadHandler -} - -func (o *CreateCrtLoad) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCrtLoadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_load/create_crt_load_parameters.go b/operations/crt_load/create_crt_load_parameters.go deleted file mode 100644 index b42ab7c7..00000000 --- a/operations/crt_load/create_crt_load_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateCrtLoadParams creates a new CreateCrtLoadParams object -// with the default values initialized. -func NewCreateCrtLoadParams() CreateCrtLoadParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateCrtLoadParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateCrtLoadParams contains all the bound params for the create crt load operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCrtLoad -type CreateCrtLoadParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent crt_store section name - Required: true - In: query - */ - CrtStore string - /* - Required: true - In: body - */ - Data *models.CrtLoad - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCrtLoadParams() beforehand. -func (o *CreateCrtLoadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCrtStore, qhkCrtStore, _ := qs.GetOK("crt_store") - if err := o.bindCrtStore(qCrtStore, qhkCrtStore, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.CrtLoad - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCrtStore binds and validates parameter CrtStore from query. -func (o *CreateCrtLoadParams) bindCrtStore(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("crt_store", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("crt_store", "query", raw); err != nil { - return err - } - o.CrtStore = raw - - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateCrtLoadParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateCrtLoadParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateCrtLoadParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateCrtLoadParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_load/create_crt_load_responses.go b/operations/crt_load/create_crt_load_responses.go deleted file mode 100644 index 9645b637..00000000 --- a/operations/crt_load/create_crt_load_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCrtLoadCreatedCode is the HTTP code returned for type CreateCrtLoadCreated -const CreateCrtLoadCreatedCode int = 201 - -/* -CreateCrtLoadCreated Certificate load entry created - -swagger:response createCrtLoadCreated -*/ -type CreateCrtLoadCreated struct { - - /* - In: Body - */ - Payload *models.CrtLoad `json:"body,omitempty"` -} - -// NewCreateCrtLoadCreated creates CreateCrtLoadCreated with default headers values -func NewCreateCrtLoadCreated() *CreateCrtLoadCreated { - - return &CreateCrtLoadCreated{} -} - -// WithPayload adds the payload to the create crt load created response -func (o *CreateCrtLoadCreated) WithPayload(payload *models.CrtLoad) *CreateCrtLoadCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt load created response -func (o *CreateCrtLoadCreated) SetPayload(payload *models.CrtLoad) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtLoadCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtLoadAcceptedCode is the HTTP code returned for type CreateCrtLoadAccepted -const CreateCrtLoadAcceptedCode int = 202 - -/* -CreateCrtLoadAccepted Configuration change accepted and reload requested - -swagger:response createCrtLoadAccepted -*/ -type CreateCrtLoadAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.CrtLoad `json:"body,omitempty"` -} - -// NewCreateCrtLoadAccepted creates CreateCrtLoadAccepted with default headers values -func NewCreateCrtLoadAccepted() *CreateCrtLoadAccepted { - - return &CreateCrtLoadAccepted{} -} - -// WithReloadID adds the reloadId to the create crt load accepted response -func (o *CreateCrtLoadAccepted) WithReloadID(reloadID string) *CreateCrtLoadAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create crt load accepted response -func (o *CreateCrtLoadAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create crt load accepted response -func (o *CreateCrtLoadAccepted) WithPayload(payload *models.CrtLoad) *CreateCrtLoadAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt load accepted response -func (o *CreateCrtLoadAccepted) SetPayload(payload *models.CrtLoad) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtLoadAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtLoadBadRequestCode is the HTTP code returned for type CreateCrtLoadBadRequest -const CreateCrtLoadBadRequestCode int = 400 - -/* -CreateCrtLoadBadRequest Bad request - -swagger:response createCrtLoadBadRequest -*/ -type CreateCrtLoadBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtLoadBadRequest creates CreateCrtLoadBadRequest with default headers values -func NewCreateCrtLoadBadRequest() *CreateCrtLoadBadRequest { - - return &CreateCrtLoadBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crt load bad request response -func (o *CreateCrtLoadBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCrtLoadBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt load bad request response -func (o *CreateCrtLoadBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt load bad request response -func (o *CreateCrtLoadBadRequest) WithPayload(payload *models.Error) *CreateCrtLoadBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt load bad request response -func (o *CreateCrtLoadBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtLoadBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtLoadConflictCode is the HTTP code returned for type CreateCrtLoadConflict -const CreateCrtLoadConflictCode int = 409 - -/* -CreateCrtLoadConflict The specified resource already exists - -swagger:response createCrtLoadConflict -*/ -type CreateCrtLoadConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtLoadConflict creates CreateCrtLoadConflict with default headers values -func NewCreateCrtLoadConflict() *CreateCrtLoadConflict { - - return &CreateCrtLoadConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crt load conflict response -func (o *CreateCrtLoadConflict) WithConfigurationVersion(configurationVersion string) *CreateCrtLoadConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt load conflict response -func (o *CreateCrtLoadConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt load conflict response -func (o *CreateCrtLoadConflict) WithPayload(payload *models.Error) *CreateCrtLoadConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt load conflict response -func (o *CreateCrtLoadConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtLoadConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCrtLoadDefault General Error - -swagger:response createCrtLoadDefault -*/ -type CreateCrtLoadDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtLoadDefault creates CreateCrtLoadDefault with default headers values -func NewCreateCrtLoadDefault(code int) *CreateCrtLoadDefault { - if code <= 0 { - code = 500 - } - - return &CreateCrtLoadDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create crt load default response -func (o *CreateCrtLoadDefault) WithStatusCode(code int) *CreateCrtLoadDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create crt load default response -func (o *CreateCrtLoadDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create crt load default response -func (o *CreateCrtLoadDefault) WithConfigurationVersion(configurationVersion string) *CreateCrtLoadDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt load default response -func (o *CreateCrtLoadDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt load default response -func (o *CreateCrtLoadDefault) WithPayload(payload *models.Error) *CreateCrtLoadDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt load default response -func (o *CreateCrtLoadDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtLoadDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_load/create_crt_load_urlbuilder.go b/operations/crt_load/create_crt_load_urlbuilder.go deleted file mode 100644 index dd55a56d..00000000 --- a/operations/crt_load/create_crt_load_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateCrtLoadURL generates an URL for the create crt load operation -type CreateCrtLoadURL struct { - CrtStore string - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrtLoadURL) WithBasePath(bp string) *CreateCrtLoadURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrtLoadURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCrtLoadURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_loads" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - crtStoreQ := o.CrtStore - if crtStoreQ != "" { - qs.Set("crt_store", crtStoreQ) - } - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCrtLoadURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCrtLoadURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCrtLoadURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCrtLoadURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCrtLoadURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCrtLoadURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_load/delete_crt_load.go b/operations/crt_load/delete_crt_load.go deleted file mode 100644 index 9010ee78..00000000 --- a/operations/crt_load/delete_crt_load.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCrtLoadHandlerFunc turns a function with the right signature into a delete crt load handler -type DeleteCrtLoadHandlerFunc func(DeleteCrtLoadParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCrtLoadHandlerFunc) Handle(params DeleteCrtLoadParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCrtLoadHandler interface for that can handle valid delete crt load params -type DeleteCrtLoadHandler interface { - Handle(DeleteCrtLoadParams, interface{}) middleware.Responder -} - -// NewDeleteCrtLoad creates a new http.Handler for the delete crt load operation -func NewDeleteCrtLoad(ctx *middleware.Context, handler DeleteCrtLoadHandler) *DeleteCrtLoad { - return &DeleteCrtLoad{Context: ctx, Handler: handler} -} - -/* - DeleteCrtLoad swagger:route DELETE /services/haproxy/configuration/crt_loads/{certificate} CrtLoad deleteCrtLoad - -# Delete a certificate load entry - -Deletes a load entry by its certificate name in the specified crt_store section -*/ -type DeleteCrtLoad struct { - Context *middleware.Context - Handler DeleteCrtLoadHandler -} - -func (o *DeleteCrtLoad) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCrtLoadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_load/delete_crt_load_parameters.go b/operations/crt_load/delete_crt_load_parameters.go deleted file mode 100644 index 933bb82a..00000000 --- a/operations/crt_load/delete_crt_load_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteCrtLoadParams creates a new DeleteCrtLoadParams object -// with the default values initialized. -func NewDeleteCrtLoadParams() DeleteCrtLoadParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteCrtLoadParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteCrtLoadParams contains all the bound params for the delete crt load operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCrtLoad -type DeleteCrtLoadParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate filename - Required: true - In: path - */ - Certificate string - /*Parent crt_store section name - Required: true - In: query - */ - CrtStore string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCrtLoadParams() beforehand. -func (o *DeleteCrtLoadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rCertificate, rhkCertificate, _ := route.Params.GetOK("certificate") - if err := o.bindCertificate(rCertificate, rhkCertificate, route.Formats); err != nil { - res = append(res, err) - } - - qCrtStore, qhkCrtStore, _ := qs.GetOK("crt_store") - if err := o.bindCrtStore(qCrtStore, qhkCrtStore, route.Formats); err != nil { - res = append(res, err) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertificate binds and validates parameter Certificate from path. -func (o *DeleteCrtLoadParams) bindCertificate(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Certificate = raw - - return nil -} - -// bindCrtStore binds and validates parameter CrtStore from query. -func (o *DeleteCrtLoadParams) bindCrtStore(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("crt_store", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("crt_store", "query", raw); err != nil { - return err - } - o.CrtStore = raw - - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteCrtLoadParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteCrtLoadParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteCrtLoadParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteCrtLoadParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_load/delete_crt_load_responses.go b/operations/crt_load/delete_crt_load_responses.go deleted file mode 100644 index 20d62b59..00000000 --- a/operations/crt_load/delete_crt_load_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCrtLoadAcceptedCode is the HTTP code returned for type DeleteCrtLoadAccepted -const DeleteCrtLoadAcceptedCode int = 202 - -/* -DeleteCrtLoadAccepted Configuration change accepted and reload requested - -swagger:response deleteCrtLoadAccepted -*/ -type DeleteCrtLoadAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteCrtLoadAccepted creates DeleteCrtLoadAccepted with default headers values -func NewDeleteCrtLoadAccepted() *DeleteCrtLoadAccepted { - - return &DeleteCrtLoadAccepted{} -} - -// WithReloadID adds the reloadId to the delete crt load accepted response -func (o *DeleteCrtLoadAccepted) WithReloadID(reloadID string) *DeleteCrtLoadAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete crt load accepted response -func (o *DeleteCrtLoadAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteCrtLoadAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteCrtLoadNoContentCode is the HTTP code returned for type DeleteCrtLoadNoContent -const DeleteCrtLoadNoContentCode int = 204 - -/* -DeleteCrtLoadNoContent Certificate load entry deleted - -swagger:response deleteCrtLoadNoContent -*/ -type DeleteCrtLoadNoContent struct { -} - -// NewDeleteCrtLoadNoContent creates DeleteCrtLoadNoContent with default headers values -func NewDeleteCrtLoadNoContent() *DeleteCrtLoadNoContent { - - return &DeleteCrtLoadNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCrtLoadNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCrtLoadNotFoundCode is the HTTP code returned for type DeleteCrtLoadNotFound -const DeleteCrtLoadNotFoundCode int = 404 - -/* -DeleteCrtLoadNotFound The specified resource was not found - -swagger:response deleteCrtLoadNotFound -*/ -type DeleteCrtLoadNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtLoadNotFound creates DeleteCrtLoadNotFound with default headers values -func NewDeleteCrtLoadNotFound() *DeleteCrtLoadNotFound { - - return &DeleteCrtLoadNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt load not found response -func (o *DeleteCrtLoadNotFound) WithConfigurationVersion(configurationVersion string) *DeleteCrtLoadNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt load not found response -func (o *DeleteCrtLoadNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt load not found response -func (o *DeleteCrtLoadNotFound) WithPayload(payload *models.Error) *DeleteCrtLoadNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt load not found response -func (o *DeleteCrtLoadNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtLoadNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCrtLoadDefault General Error - -swagger:response deleteCrtLoadDefault -*/ -type DeleteCrtLoadDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtLoadDefault creates DeleteCrtLoadDefault with default headers values -func NewDeleteCrtLoadDefault(code int) *DeleteCrtLoadDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCrtLoadDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete crt load default response -func (o *DeleteCrtLoadDefault) WithStatusCode(code int) *DeleteCrtLoadDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete crt load default response -func (o *DeleteCrtLoadDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt load default response -func (o *DeleteCrtLoadDefault) WithConfigurationVersion(configurationVersion string) *DeleteCrtLoadDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt load default response -func (o *DeleteCrtLoadDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt load default response -func (o *DeleteCrtLoadDefault) WithPayload(payload *models.Error) *DeleteCrtLoadDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt load default response -func (o *DeleteCrtLoadDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtLoadDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_load/delete_crt_load_urlbuilder.go b/operations/crt_load/delete_crt_load_urlbuilder.go deleted file mode 100644 index a2f29b39..00000000 --- a/operations/crt_load/delete_crt_load_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteCrtLoadURL generates an URL for the delete crt load operation -type DeleteCrtLoadURL struct { - Certificate string - - CrtStore string - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtLoadURL) WithBasePath(bp string) *DeleteCrtLoadURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtLoadURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCrtLoadURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_loads/{certificate}" - - certificate := o.Certificate - if certificate != "" { - _path = strings.Replace(_path, "{certificate}", certificate, -1) - } else { - return nil, errors.New("certificate is required on DeleteCrtLoadURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - crtStoreQ := o.CrtStore - if crtStoreQ != "" { - qs.Set("crt_store", crtStoreQ) - } - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCrtLoadURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCrtLoadURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCrtLoadURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCrtLoadURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCrtLoadURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCrtLoadURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_load/get_crt_load.go b/operations/crt_load/get_crt_load.go deleted file mode 100644 index 8645a381..00000000 --- a/operations/crt_load/get_crt_load.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCrtLoadHandlerFunc turns a function with the right signature into a get crt load handler -type GetCrtLoadHandlerFunc func(GetCrtLoadParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCrtLoadHandlerFunc) Handle(params GetCrtLoadParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCrtLoadHandler interface for that can handle valid get crt load params -type GetCrtLoadHandler interface { - Handle(GetCrtLoadParams, interface{}) middleware.Responder -} - -// NewGetCrtLoad creates a new http.Handler for the get crt load operation -func NewGetCrtLoad(ctx *middleware.Context, handler GetCrtLoadHandler) *GetCrtLoad { - return &GetCrtLoad{Context: ctx, Handler: handler} -} - -/* - GetCrtLoad swagger:route GET /services/haproxy/configuration/crt_loads/{certificate} CrtLoad getCrtLoad - -# Return one certificate load entry - -Returns one load entry by its certificate name in the specified crt_store -*/ -type GetCrtLoad struct { - Context *middleware.Context - Handler GetCrtLoadHandler -} - -func (o *GetCrtLoad) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCrtLoadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_load/get_crt_load_parameters.go b/operations/crt_load/get_crt_load_parameters.go deleted file mode 100644 index 3f1e4603..00000000 --- a/operations/crt_load/get_crt_load_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetCrtLoadParams creates a new GetCrtLoadParams object -// -// There are no default values defined in the spec. -func NewGetCrtLoadParams() GetCrtLoadParams { - - return GetCrtLoadParams{} -} - -// GetCrtLoadParams contains all the bound params for the get crt load operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCrtLoad -type GetCrtLoadParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate filename - Required: true - In: path - */ - Certificate string - /*Parent crt_store name - Required: true - In: query - */ - CrtStore string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCrtLoadParams() beforehand. -func (o *GetCrtLoadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rCertificate, rhkCertificate, _ := route.Params.GetOK("certificate") - if err := o.bindCertificate(rCertificate, rhkCertificate, route.Formats); err != nil { - res = append(res, err) - } - - qCrtStore, qhkCrtStore, _ := qs.GetOK("crt_store") - if err := o.bindCrtStore(qCrtStore, qhkCrtStore, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertificate binds and validates parameter Certificate from path. -func (o *GetCrtLoadParams) bindCertificate(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Certificate = raw - - return nil -} - -// bindCrtStore binds and validates parameter CrtStore from query. -func (o *GetCrtLoadParams) bindCrtStore(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("crt_store", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("crt_store", "query", raw); err != nil { - return err - } - o.CrtStore = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCrtLoadParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/crt_load/get_crt_load_responses.go b/operations/crt_load/get_crt_load_responses.go deleted file mode 100644 index 5132111a..00000000 --- a/operations/crt_load/get_crt_load_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCrtLoadOKCode is the HTTP code returned for type GetCrtLoadOK -const GetCrtLoadOKCode int = 200 - -/* -GetCrtLoadOK Successful operation - -swagger:response getCrtLoadOK -*/ -type GetCrtLoadOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.CrtLoad `json:"body,omitempty"` -} - -// NewGetCrtLoadOK creates GetCrtLoadOK with default headers values -func NewGetCrtLoadOK() *GetCrtLoadOK { - - return &GetCrtLoadOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt load o k response -func (o *GetCrtLoadOK) WithConfigurationVersion(configurationVersion string) *GetCrtLoadOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt load o k response -func (o *GetCrtLoadOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt load o k response -func (o *GetCrtLoadOK) WithPayload(payload *models.CrtLoad) *GetCrtLoadOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt load o k response -func (o *GetCrtLoadOK) SetPayload(payload *models.CrtLoad) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtLoadOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetCrtLoadNotFoundCode is the HTTP code returned for type GetCrtLoadNotFound -const GetCrtLoadNotFoundCode int = 404 - -/* -GetCrtLoadNotFound The specified resource was not found - -swagger:response getCrtLoadNotFound -*/ -type GetCrtLoadNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtLoadNotFound creates GetCrtLoadNotFound with default headers values -func NewGetCrtLoadNotFound() *GetCrtLoadNotFound { - - return &GetCrtLoadNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt load not found response -func (o *GetCrtLoadNotFound) WithConfigurationVersion(configurationVersion string) *GetCrtLoadNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt load not found response -func (o *GetCrtLoadNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt load not found response -func (o *GetCrtLoadNotFound) WithPayload(payload *models.Error) *GetCrtLoadNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt load not found response -func (o *GetCrtLoadNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtLoadNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCrtLoadDefault General Error - -swagger:response getCrtLoadDefault -*/ -type GetCrtLoadDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtLoadDefault creates GetCrtLoadDefault with default headers values -func NewGetCrtLoadDefault(code int) *GetCrtLoadDefault { - if code <= 0 { - code = 500 - } - - return &GetCrtLoadDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get crt load default response -func (o *GetCrtLoadDefault) WithStatusCode(code int) *GetCrtLoadDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get crt load default response -func (o *GetCrtLoadDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get crt load default response -func (o *GetCrtLoadDefault) WithConfigurationVersion(configurationVersion string) *GetCrtLoadDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt load default response -func (o *GetCrtLoadDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt load default response -func (o *GetCrtLoadDefault) WithPayload(payload *models.Error) *GetCrtLoadDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt load default response -func (o *GetCrtLoadDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtLoadDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_load/get_crt_load_urlbuilder.go b/operations/crt_load/get_crt_load_urlbuilder.go deleted file mode 100644 index 85418e77..00000000 --- a/operations/crt_load/get_crt_load_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetCrtLoadURL generates an URL for the get crt load operation -type GetCrtLoadURL struct { - Certificate string - - CrtStore string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtLoadURL) WithBasePath(bp string) *GetCrtLoadURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtLoadURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCrtLoadURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_loads/{certificate}" - - certificate := o.Certificate - if certificate != "" { - _path = strings.Replace(_path, "{certificate}", certificate, -1) - } else { - return nil, errors.New("certificate is required on GetCrtLoadURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - crtStoreQ := o.CrtStore - if crtStoreQ != "" { - qs.Set("crt_store", crtStoreQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCrtLoadURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCrtLoadURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCrtLoadURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCrtLoadURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCrtLoadURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCrtLoadURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_load/get_crt_loads.go b/operations/crt_load/get_crt_loads.go deleted file mode 100644 index 92f750fe..00000000 --- a/operations/crt_load/get_crt_loads.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCrtLoadsHandlerFunc turns a function with the right signature into a get crt loads handler -type GetCrtLoadsHandlerFunc func(GetCrtLoadsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCrtLoadsHandlerFunc) Handle(params GetCrtLoadsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCrtLoadsHandler interface for that can handle valid get crt loads params -type GetCrtLoadsHandler interface { - Handle(GetCrtLoadsParams, interface{}) middleware.Responder -} - -// NewGetCrtLoads creates a new http.Handler for the get crt loads operation -func NewGetCrtLoads(ctx *middleware.Context, handler GetCrtLoadsHandler) *GetCrtLoads { - return &GetCrtLoads{Context: ctx, Handler: handler} -} - -/* - GetCrtLoads swagger:route GET /services/haproxy/configuration/crt_loads CrtLoad getCrtLoads - -# Return an array of loaded certificates - -Returns the list of loaded certificates from the specified crt_store -*/ -type GetCrtLoads struct { - Context *middleware.Context - Handler GetCrtLoadsHandler -} - -func (o *GetCrtLoads) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCrtLoadsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_load/get_crt_loads_parameters.go b/operations/crt_load/get_crt_loads_parameters.go deleted file mode 100644 index 8df3b42b..00000000 --- a/operations/crt_load/get_crt_loads_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetCrtLoadsParams creates a new GetCrtLoadsParams object -// -// There are no default values defined in the spec. -func NewGetCrtLoadsParams() GetCrtLoadsParams { - - return GetCrtLoadsParams{} -} - -// GetCrtLoadsParams contains all the bound params for the get crt loads operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCrtLoads -type GetCrtLoadsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent crt_store name - Required: true - In: query - */ - CrtStore string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCrtLoadsParams() beforehand. -func (o *GetCrtLoadsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCrtStore, qhkCrtStore, _ := qs.GetOK("crt_store") - if err := o.bindCrtStore(qCrtStore, qhkCrtStore, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCrtStore binds and validates parameter CrtStore from query. -func (o *GetCrtLoadsParams) bindCrtStore(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("crt_store", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("crt_store", "query", raw); err != nil { - return err - } - o.CrtStore = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCrtLoadsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/crt_load/get_crt_loads_responses.go b/operations/crt_load/get_crt_loads_responses.go deleted file mode 100644 index 6fa9cdb7..00000000 --- a/operations/crt_load/get_crt_loads_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCrtLoadsOKCode is the HTTP code returned for type GetCrtLoadsOK -const GetCrtLoadsOKCode int = 200 - -/* -GetCrtLoadsOK Successful operation - -swagger:response getCrtLoadsOK -*/ -type GetCrtLoadsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.CrtLoads `json:"body,omitempty"` -} - -// NewGetCrtLoadsOK creates GetCrtLoadsOK with default headers values -func NewGetCrtLoadsOK() *GetCrtLoadsOK { - - return &GetCrtLoadsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt loads o k response -func (o *GetCrtLoadsOK) WithConfigurationVersion(configurationVersion string) *GetCrtLoadsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt loads o k response -func (o *GetCrtLoadsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt loads o k response -func (o *GetCrtLoadsOK) WithPayload(payload models.CrtLoads) *GetCrtLoadsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt loads o k response -func (o *GetCrtLoadsOK) SetPayload(payload models.CrtLoads) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtLoadsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.CrtLoads{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetCrtLoadsDefault General Error - -swagger:response getCrtLoadsDefault -*/ -type GetCrtLoadsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtLoadsDefault creates GetCrtLoadsDefault with default headers values -func NewGetCrtLoadsDefault(code int) *GetCrtLoadsDefault { - if code <= 0 { - code = 500 - } - - return &GetCrtLoadsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get crt loads default response -func (o *GetCrtLoadsDefault) WithStatusCode(code int) *GetCrtLoadsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get crt loads default response -func (o *GetCrtLoadsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get crt loads default response -func (o *GetCrtLoadsDefault) WithConfigurationVersion(configurationVersion string) *GetCrtLoadsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt loads default response -func (o *GetCrtLoadsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt loads default response -func (o *GetCrtLoadsDefault) WithPayload(payload *models.Error) *GetCrtLoadsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt loads default response -func (o *GetCrtLoadsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtLoadsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_load/get_crt_loads_urlbuilder.go b/operations/crt_load/get_crt_loads_urlbuilder.go deleted file mode 100644 index d7d9dc24..00000000 --- a/operations/crt_load/get_crt_loads_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetCrtLoadsURL generates an URL for the get crt loads operation -type GetCrtLoadsURL struct { - CrtStore string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtLoadsURL) WithBasePath(bp string) *GetCrtLoadsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtLoadsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCrtLoadsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_loads" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - crtStoreQ := o.CrtStore - if crtStoreQ != "" { - qs.Set("crt_store", crtStoreQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCrtLoadsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCrtLoadsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCrtLoadsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCrtLoadsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCrtLoadsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCrtLoadsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_load/replace_crt_load.go b/operations/crt_load/replace_crt_load.go deleted file mode 100644 index 3947740f..00000000 --- a/operations/crt_load/replace_crt_load.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceCrtLoadHandlerFunc turns a function with the right signature into a replace crt load handler -type ReplaceCrtLoadHandlerFunc func(ReplaceCrtLoadParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceCrtLoadHandlerFunc) Handle(params ReplaceCrtLoadParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceCrtLoadHandler interface for that can handle valid replace crt load params -type ReplaceCrtLoadHandler interface { - Handle(ReplaceCrtLoadParams, interface{}) middleware.Responder -} - -// NewReplaceCrtLoad creates a new http.Handler for the replace crt load operation -func NewReplaceCrtLoad(ctx *middleware.Context, handler ReplaceCrtLoadHandler) *ReplaceCrtLoad { - return &ReplaceCrtLoad{Context: ctx, Handler: handler} -} - -/* - ReplaceCrtLoad swagger:route PUT /services/haproxy/configuration/crt_loads/{certificate} CrtLoad replaceCrtLoad - -# Replace a certificate load entry - -Replaces a load entry by its certificate name in the specified crt_store section -*/ -type ReplaceCrtLoad struct { - Context *middleware.Context - Handler ReplaceCrtLoadHandler -} - -func (o *ReplaceCrtLoad) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceCrtLoadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_load/replace_crt_load_parameters.go b/operations/crt_load/replace_crt_load_parameters.go deleted file mode 100644 index a02980b1..00000000 --- a/operations/crt_load/replace_crt_load_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceCrtLoadParams creates a new ReplaceCrtLoadParams object -// with the default values initialized. -func NewReplaceCrtLoadParams() ReplaceCrtLoadParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceCrtLoadParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceCrtLoadParams contains all the bound params for the replace crt load operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceCrtLoad -type ReplaceCrtLoadParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate filename - Required: true - In: path - */ - Certificate string - /*Parent crt_store section name - Required: true - In: query - */ - CrtStore string - /* - Required: true - In: body - */ - Data *models.CrtLoad - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceCrtLoadParams() beforehand. -func (o *ReplaceCrtLoadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rCertificate, rhkCertificate, _ := route.Params.GetOK("certificate") - if err := o.bindCertificate(rCertificate, rhkCertificate, route.Formats); err != nil { - res = append(res, err) - } - - qCrtStore, qhkCrtStore, _ := qs.GetOK("crt_store") - if err := o.bindCrtStore(qCrtStore, qhkCrtStore, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.CrtLoad - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertificate binds and validates parameter Certificate from path. -func (o *ReplaceCrtLoadParams) bindCertificate(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Certificate = raw - - return nil -} - -// bindCrtStore binds and validates parameter CrtStore from query. -func (o *ReplaceCrtLoadParams) bindCrtStore(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("crt_store", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("crt_store", "query", raw); err != nil { - return err - } - o.CrtStore = raw - - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceCrtLoadParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceCrtLoadParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceCrtLoadParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceCrtLoadParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_load/replace_crt_load_responses.go b/operations/crt_load/replace_crt_load_responses.go deleted file mode 100644 index 4c2674d2..00000000 --- a/operations/crt_load/replace_crt_load_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceCrtLoadOKCode is the HTTP code returned for type ReplaceCrtLoadOK -const ReplaceCrtLoadOKCode int = 200 - -/* -ReplaceCrtLoadOK Certificate load entry replaced - -swagger:response replaceCrtLoadOK -*/ -type ReplaceCrtLoadOK struct { - - /* - In: Body - */ - Payload *models.CrtLoad `json:"body,omitempty"` -} - -// NewReplaceCrtLoadOK creates ReplaceCrtLoadOK with default headers values -func NewReplaceCrtLoadOK() *ReplaceCrtLoadOK { - - return &ReplaceCrtLoadOK{} -} - -// WithPayload adds the payload to the replace crt load o k response -func (o *ReplaceCrtLoadOK) WithPayload(payload *models.CrtLoad) *ReplaceCrtLoadOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crt load o k response -func (o *ReplaceCrtLoadOK) SetPayload(payload *models.CrtLoad) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrtLoadOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCrtLoadAcceptedCode is the HTTP code returned for type ReplaceCrtLoadAccepted -const ReplaceCrtLoadAcceptedCode int = 202 - -/* -ReplaceCrtLoadAccepted Configuration change accepted and reload requested - -swagger:response replaceCrtLoadAccepted -*/ -type ReplaceCrtLoadAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.CrtLoad `json:"body,omitempty"` -} - -// NewReplaceCrtLoadAccepted creates ReplaceCrtLoadAccepted with default headers values -func NewReplaceCrtLoadAccepted() *ReplaceCrtLoadAccepted { - - return &ReplaceCrtLoadAccepted{} -} - -// WithReloadID adds the reloadId to the replace crt load accepted response -func (o *ReplaceCrtLoadAccepted) WithReloadID(reloadID string) *ReplaceCrtLoadAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace crt load accepted response -func (o *ReplaceCrtLoadAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace crt load accepted response -func (o *ReplaceCrtLoadAccepted) WithPayload(payload *models.CrtLoad) *ReplaceCrtLoadAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crt load accepted response -func (o *ReplaceCrtLoadAccepted) SetPayload(payload *models.CrtLoad) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrtLoadAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCrtLoadBadRequestCode is the HTTP code returned for type ReplaceCrtLoadBadRequest -const ReplaceCrtLoadBadRequestCode int = 400 - -/* -ReplaceCrtLoadBadRequest Bad request - -swagger:response replaceCrtLoadBadRequest -*/ -type ReplaceCrtLoadBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCrtLoadBadRequest creates ReplaceCrtLoadBadRequest with default headers values -func NewReplaceCrtLoadBadRequest() *ReplaceCrtLoadBadRequest { - - return &ReplaceCrtLoadBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace crt load bad request response -func (o *ReplaceCrtLoadBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceCrtLoadBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace crt load bad request response -func (o *ReplaceCrtLoadBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace crt load bad request response -func (o *ReplaceCrtLoadBadRequest) WithPayload(payload *models.Error) *ReplaceCrtLoadBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crt load bad request response -func (o *ReplaceCrtLoadBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrtLoadBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceCrtLoadNotFoundCode is the HTTP code returned for type ReplaceCrtLoadNotFound -const ReplaceCrtLoadNotFoundCode int = 404 - -/* -ReplaceCrtLoadNotFound The specified resource was not found - -swagger:response replaceCrtLoadNotFound -*/ -type ReplaceCrtLoadNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCrtLoadNotFound creates ReplaceCrtLoadNotFound with default headers values -func NewReplaceCrtLoadNotFound() *ReplaceCrtLoadNotFound { - - return &ReplaceCrtLoadNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace crt load not found response -func (o *ReplaceCrtLoadNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceCrtLoadNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace crt load not found response -func (o *ReplaceCrtLoadNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace crt load not found response -func (o *ReplaceCrtLoadNotFound) WithPayload(payload *models.Error) *ReplaceCrtLoadNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crt load not found response -func (o *ReplaceCrtLoadNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrtLoadNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceCrtLoadDefault General Error - -swagger:response replaceCrtLoadDefault -*/ -type ReplaceCrtLoadDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCrtLoadDefault creates ReplaceCrtLoadDefault with default headers values -func NewReplaceCrtLoadDefault(code int) *ReplaceCrtLoadDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceCrtLoadDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace crt load default response -func (o *ReplaceCrtLoadDefault) WithStatusCode(code int) *ReplaceCrtLoadDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace crt load default response -func (o *ReplaceCrtLoadDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace crt load default response -func (o *ReplaceCrtLoadDefault) WithConfigurationVersion(configurationVersion string) *ReplaceCrtLoadDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace crt load default response -func (o *ReplaceCrtLoadDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace crt load default response -func (o *ReplaceCrtLoadDefault) WithPayload(payload *models.Error) *ReplaceCrtLoadDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crt load default response -func (o *ReplaceCrtLoadDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrtLoadDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_load/replace_crt_load_urlbuilder.go b/operations/crt_load/replace_crt_load_urlbuilder.go deleted file mode 100644 index 8fbfad4b..00000000 --- a/operations/crt_load/replace_crt_load_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_load - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceCrtLoadURL generates an URL for the replace crt load operation -type ReplaceCrtLoadURL struct { - Certificate string - - CrtStore string - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCrtLoadURL) WithBasePath(bp string) *ReplaceCrtLoadURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCrtLoadURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceCrtLoadURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_loads/{certificate}" - - certificate := o.Certificate - if certificate != "" { - _path = strings.Replace(_path, "{certificate}", certificate, -1) - } else { - return nil, errors.New("certificate is required on ReplaceCrtLoadURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - crtStoreQ := o.CrtStore - if crtStoreQ != "" { - qs.Set("crt_store", crtStoreQ) - } - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceCrtLoadURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceCrtLoadURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceCrtLoadURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceCrtLoadURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceCrtLoadURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceCrtLoadURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_store/create_crt_store.go b/operations/crt_store/create_crt_store.go deleted file mode 100644 index f82d739c..00000000 --- a/operations/crt_store/create_crt_store.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCrtStoreHandlerFunc turns a function with the right signature into a create crt store handler -type CreateCrtStoreHandlerFunc func(CreateCrtStoreParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCrtStoreHandlerFunc) Handle(params CreateCrtStoreParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCrtStoreHandler interface for that can handle valid create crt store params -type CreateCrtStoreHandler interface { - Handle(CreateCrtStoreParams, interface{}) middleware.Responder -} - -// NewCreateCrtStore creates a new http.Handler for the create crt store operation -func NewCreateCrtStore(ctx *middleware.Context, handler CreateCrtStoreHandler) *CreateCrtStore { - return &CreateCrtStore{Context: ctx, Handler: handler} -} - -/* - CreateCrtStore swagger:route POST /services/haproxy/configuration/crt_stores CrtStore createCrtStore - -# Add a new Certificate Store - -Creates a new crt_store section -*/ -type CreateCrtStore struct { - Context *middleware.Context - Handler CreateCrtStoreHandler -} - -func (o *CreateCrtStore) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCrtStoreParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_store/create_crt_store_parameters.go b/operations/crt_store/create_crt_store_parameters.go deleted file mode 100644 index 74f66a48..00000000 --- a/operations/crt_store/create_crt_store_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateCrtStoreParams creates a new CreateCrtStoreParams object -// with the default values initialized. -func NewCreateCrtStoreParams() CreateCrtStoreParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateCrtStoreParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateCrtStoreParams contains all the bound params for the create crt store operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCrtStore -type CreateCrtStoreParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.CrtStore - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCrtStoreParams() beforehand. -func (o *CreateCrtStoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.CrtStore - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateCrtStoreParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateCrtStoreParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateCrtStoreParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateCrtStoreParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_store/create_crt_store_responses.go b/operations/crt_store/create_crt_store_responses.go deleted file mode 100644 index e24ec350..00000000 --- a/operations/crt_store/create_crt_store_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCrtStoreCreatedCode is the HTTP code returned for type CreateCrtStoreCreated -const CreateCrtStoreCreatedCode int = 201 - -/* -CreateCrtStoreCreated Certificate Store created - -swagger:response createCrtStoreCreated -*/ -type CreateCrtStoreCreated struct { - - /* - In: Body - */ - Payload *models.CrtStore `json:"body,omitempty"` -} - -// NewCreateCrtStoreCreated creates CreateCrtStoreCreated with default headers values -func NewCreateCrtStoreCreated() *CreateCrtStoreCreated { - - return &CreateCrtStoreCreated{} -} - -// WithPayload adds the payload to the create crt store created response -func (o *CreateCrtStoreCreated) WithPayload(payload *models.CrtStore) *CreateCrtStoreCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt store created response -func (o *CreateCrtStoreCreated) SetPayload(payload *models.CrtStore) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtStoreCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtStoreAcceptedCode is the HTTP code returned for type CreateCrtStoreAccepted -const CreateCrtStoreAcceptedCode int = 202 - -/* -CreateCrtStoreAccepted Configuration change accepted and reload requested - -swagger:response createCrtStoreAccepted -*/ -type CreateCrtStoreAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.CrtStore `json:"body,omitempty"` -} - -// NewCreateCrtStoreAccepted creates CreateCrtStoreAccepted with default headers values -func NewCreateCrtStoreAccepted() *CreateCrtStoreAccepted { - - return &CreateCrtStoreAccepted{} -} - -// WithReloadID adds the reloadId to the create crt store accepted response -func (o *CreateCrtStoreAccepted) WithReloadID(reloadID string) *CreateCrtStoreAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create crt store accepted response -func (o *CreateCrtStoreAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create crt store accepted response -func (o *CreateCrtStoreAccepted) WithPayload(payload *models.CrtStore) *CreateCrtStoreAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt store accepted response -func (o *CreateCrtStoreAccepted) SetPayload(payload *models.CrtStore) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtStoreAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtStoreBadRequestCode is the HTTP code returned for type CreateCrtStoreBadRequest -const CreateCrtStoreBadRequestCode int = 400 - -/* -CreateCrtStoreBadRequest Bad request - -swagger:response createCrtStoreBadRequest -*/ -type CreateCrtStoreBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtStoreBadRequest creates CreateCrtStoreBadRequest with default headers values -func NewCreateCrtStoreBadRequest() *CreateCrtStoreBadRequest { - - return &CreateCrtStoreBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crt store bad request response -func (o *CreateCrtStoreBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCrtStoreBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt store bad request response -func (o *CreateCrtStoreBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt store bad request response -func (o *CreateCrtStoreBadRequest) WithPayload(payload *models.Error) *CreateCrtStoreBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt store bad request response -func (o *CreateCrtStoreBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtStoreBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrtStoreConflictCode is the HTTP code returned for type CreateCrtStoreConflict -const CreateCrtStoreConflictCode int = 409 - -/* -CreateCrtStoreConflict The specified resource already exists - -swagger:response createCrtStoreConflict -*/ -type CreateCrtStoreConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtStoreConflict creates CreateCrtStoreConflict with default headers values -func NewCreateCrtStoreConflict() *CreateCrtStoreConflict { - - return &CreateCrtStoreConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crt store conflict response -func (o *CreateCrtStoreConflict) WithConfigurationVersion(configurationVersion string) *CreateCrtStoreConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt store conflict response -func (o *CreateCrtStoreConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt store conflict response -func (o *CreateCrtStoreConflict) WithPayload(payload *models.Error) *CreateCrtStoreConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt store conflict response -func (o *CreateCrtStoreConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtStoreConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCrtStoreDefault General Error - -swagger:response createCrtStoreDefault -*/ -type CreateCrtStoreDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrtStoreDefault creates CreateCrtStoreDefault with default headers values -func NewCreateCrtStoreDefault(code int) *CreateCrtStoreDefault { - if code <= 0 { - code = 500 - } - - return &CreateCrtStoreDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create crt store default response -func (o *CreateCrtStoreDefault) WithStatusCode(code int) *CreateCrtStoreDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create crt store default response -func (o *CreateCrtStoreDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create crt store default response -func (o *CreateCrtStoreDefault) WithConfigurationVersion(configurationVersion string) *CreateCrtStoreDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crt store default response -func (o *CreateCrtStoreDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crt store default response -func (o *CreateCrtStoreDefault) WithPayload(payload *models.Error) *CreateCrtStoreDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crt store default response -func (o *CreateCrtStoreDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrtStoreDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_store/create_crt_store_urlbuilder.go b/operations/crt_store/create_crt_store_urlbuilder.go deleted file mode 100644 index 1701a055..00000000 --- a/operations/crt_store/create_crt_store_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateCrtStoreURL generates an URL for the create crt store operation -type CreateCrtStoreURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrtStoreURL) WithBasePath(bp string) *CreateCrtStoreURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrtStoreURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCrtStoreURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_stores" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCrtStoreURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCrtStoreURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCrtStoreURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCrtStoreURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCrtStoreURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCrtStoreURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_store/delete_crt_store.go b/operations/crt_store/delete_crt_store.go deleted file mode 100644 index b2ce927a..00000000 --- a/operations/crt_store/delete_crt_store.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCrtStoreHandlerFunc turns a function with the right signature into a delete crt store handler -type DeleteCrtStoreHandlerFunc func(DeleteCrtStoreParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCrtStoreHandlerFunc) Handle(params DeleteCrtStoreParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCrtStoreHandler interface for that can handle valid delete crt store params -type DeleteCrtStoreHandler interface { - Handle(DeleteCrtStoreParams, interface{}) middleware.Responder -} - -// NewDeleteCrtStore creates a new http.Handler for the delete crt store operation -func NewDeleteCrtStore(ctx *middleware.Context, handler DeleteCrtStoreHandler) *DeleteCrtStore { - return &DeleteCrtStore{Context: ctx, Handler: handler} -} - -/* - DeleteCrtStore swagger:route DELETE /services/haproxy/configuration/crt_stores/{name} CrtStore deleteCrtStore - -# Delete a Certificate Store - -Deletes a crt_store section from the configuration -*/ -type DeleteCrtStore struct { - Context *middleware.Context - Handler DeleteCrtStoreHandler -} - -func (o *DeleteCrtStore) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCrtStoreParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_store/delete_crt_store_parameters.go b/operations/crt_store/delete_crt_store_parameters.go deleted file mode 100644 index 4d40a3a9..00000000 --- a/operations/crt_store/delete_crt_store_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteCrtStoreParams creates a new DeleteCrtStoreParams object -// with the default values initialized. -func NewDeleteCrtStoreParams() DeleteCrtStoreParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteCrtStoreParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteCrtStoreParams contains all the bound params for the delete crt store operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCrtStore -type DeleteCrtStoreParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*crt_store name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCrtStoreParams() beforehand. -func (o *DeleteCrtStoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteCrtStoreParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteCrtStoreParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteCrtStoreParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteCrtStoreParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteCrtStoreParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_store/delete_crt_store_responses.go b/operations/crt_store/delete_crt_store_responses.go deleted file mode 100644 index 8e70603f..00000000 --- a/operations/crt_store/delete_crt_store_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCrtStoreAcceptedCode is the HTTP code returned for type DeleteCrtStoreAccepted -const DeleteCrtStoreAcceptedCode int = 202 - -/* -DeleteCrtStoreAccepted Configuration change accepted and reload requested - -swagger:response deleteCrtStoreAccepted -*/ -type DeleteCrtStoreAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteCrtStoreAccepted creates DeleteCrtStoreAccepted with default headers values -func NewDeleteCrtStoreAccepted() *DeleteCrtStoreAccepted { - - return &DeleteCrtStoreAccepted{} -} - -// WithReloadID adds the reloadId to the delete crt store accepted response -func (o *DeleteCrtStoreAccepted) WithReloadID(reloadID string) *DeleteCrtStoreAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete crt store accepted response -func (o *DeleteCrtStoreAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteCrtStoreAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteCrtStoreNoContentCode is the HTTP code returned for type DeleteCrtStoreNoContent -const DeleteCrtStoreNoContentCode int = 204 - -/* -DeleteCrtStoreNoContent crt_store deleted - -swagger:response deleteCrtStoreNoContent -*/ -type DeleteCrtStoreNoContent struct { -} - -// NewDeleteCrtStoreNoContent creates DeleteCrtStoreNoContent with default headers values -func NewDeleteCrtStoreNoContent() *DeleteCrtStoreNoContent { - - return &DeleteCrtStoreNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCrtStoreNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCrtStoreNotFoundCode is the HTTP code returned for type DeleteCrtStoreNotFound -const DeleteCrtStoreNotFoundCode int = 404 - -/* -DeleteCrtStoreNotFound The specified resource was not found - -swagger:response deleteCrtStoreNotFound -*/ -type DeleteCrtStoreNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtStoreNotFound creates DeleteCrtStoreNotFound with default headers values -func NewDeleteCrtStoreNotFound() *DeleteCrtStoreNotFound { - - return &DeleteCrtStoreNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt store not found response -func (o *DeleteCrtStoreNotFound) WithConfigurationVersion(configurationVersion string) *DeleteCrtStoreNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt store not found response -func (o *DeleteCrtStoreNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt store not found response -func (o *DeleteCrtStoreNotFound) WithPayload(payload *models.Error) *DeleteCrtStoreNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt store not found response -func (o *DeleteCrtStoreNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtStoreNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCrtStoreDefault General Error - -swagger:response deleteCrtStoreDefault -*/ -type DeleteCrtStoreDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtStoreDefault creates DeleteCrtStoreDefault with default headers values -func NewDeleteCrtStoreDefault(code int) *DeleteCrtStoreDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCrtStoreDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete crt store default response -func (o *DeleteCrtStoreDefault) WithStatusCode(code int) *DeleteCrtStoreDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete crt store default response -func (o *DeleteCrtStoreDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt store default response -func (o *DeleteCrtStoreDefault) WithConfigurationVersion(configurationVersion string) *DeleteCrtStoreDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt store default response -func (o *DeleteCrtStoreDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt store default response -func (o *DeleteCrtStoreDefault) WithPayload(payload *models.Error) *DeleteCrtStoreDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt store default response -func (o *DeleteCrtStoreDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtStoreDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_store/delete_crt_store_urlbuilder.go b/operations/crt_store/delete_crt_store_urlbuilder.go deleted file mode 100644 index 907ce75d..00000000 --- a/operations/crt_store/delete_crt_store_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteCrtStoreURL generates an URL for the delete crt store operation -type DeleteCrtStoreURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtStoreURL) WithBasePath(bp string) *DeleteCrtStoreURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtStoreURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCrtStoreURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_stores/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteCrtStoreURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCrtStoreURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCrtStoreURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCrtStoreURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCrtStoreURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCrtStoreURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCrtStoreURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_store/edit_crt_store.go b/operations/crt_store/edit_crt_store.go deleted file mode 100644 index 13b0ca40..00000000 --- a/operations/crt_store/edit_crt_store.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// EditCrtStoreHandlerFunc turns a function with the right signature into a edit crt store handler -type EditCrtStoreHandlerFunc func(EditCrtStoreParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditCrtStoreHandlerFunc) Handle(params EditCrtStoreParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// EditCrtStoreHandler interface for that can handle valid edit crt store params -type EditCrtStoreHandler interface { - Handle(EditCrtStoreParams, interface{}) middleware.Responder -} - -// NewEditCrtStore creates a new http.Handler for the edit crt store operation -func NewEditCrtStore(ctx *middleware.Context, handler EditCrtStoreHandler) *EditCrtStore { - return &EditCrtStore{Context: ctx, Handler: handler} -} - -/* - EditCrtStore swagger:route PUT /services/haproxy/configuration/crt_stores/{name} CrtStore editCrtStore - -# Modify a Certificate Store - -Modifies a crt_store's configuration by its name -*/ -type EditCrtStore struct { - Context *middleware.Context - Handler EditCrtStoreHandler -} - -func (o *EditCrtStore) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditCrtStoreParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_store/edit_crt_store_parameters.go b/operations/crt_store/edit_crt_store_parameters.go deleted file mode 100644 index e1a6c098..00000000 --- a/operations/crt_store/edit_crt_store_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewEditCrtStoreParams creates a new EditCrtStoreParams object -// with the default values initialized. -func NewEditCrtStoreParams() EditCrtStoreParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return EditCrtStoreParams{ - ForceReload: &forceReloadDefault, - } -} - -// EditCrtStoreParams contains all the bound params for the edit crt store operation -// typically these are obtained from a http.Request -// -// swagger:parameters editCrtStore -type EditCrtStoreParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.CrtStore - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*crt_store name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEditCrtStoreParams() beforehand. -func (o *EditCrtStoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.CrtStore - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *EditCrtStoreParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewEditCrtStoreParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *EditCrtStoreParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *EditCrtStoreParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *EditCrtStoreParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/crt_store/edit_crt_store_responses.go b/operations/crt_store/edit_crt_store_responses.go deleted file mode 100644 index 65c094c2..00000000 --- a/operations/crt_store/edit_crt_store_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// EditCrtStoreOKCode is the HTTP code returned for type EditCrtStoreOK -const EditCrtStoreOKCode int = 200 - -/* -EditCrtStoreOK crt_store configuration updated - -swagger:response editCrtStoreOK -*/ -type EditCrtStoreOK struct { - - /* - In: Body - */ - Payload *models.CrtStore `json:"body,omitempty"` -} - -// NewEditCrtStoreOK creates EditCrtStoreOK with default headers values -func NewEditCrtStoreOK() *EditCrtStoreOK { - - return &EditCrtStoreOK{} -} - -// WithPayload adds the payload to the edit crt store o k response -func (o *EditCrtStoreOK) WithPayload(payload *models.CrtStore) *EditCrtStoreOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit crt store o k response -func (o *EditCrtStoreOK) SetPayload(payload *models.CrtStore) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditCrtStoreOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditCrtStoreAcceptedCode is the HTTP code returned for type EditCrtStoreAccepted -const EditCrtStoreAcceptedCode int = 202 - -/* -EditCrtStoreAccepted Configuration change accepted and reload requested - -swagger:response editCrtStoreAccepted -*/ -type EditCrtStoreAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.CrtStore `json:"body,omitempty"` -} - -// NewEditCrtStoreAccepted creates EditCrtStoreAccepted with default headers values -func NewEditCrtStoreAccepted() *EditCrtStoreAccepted { - - return &EditCrtStoreAccepted{} -} - -// WithReloadID adds the reloadId to the edit crt store accepted response -func (o *EditCrtStoreAccepted) WithReloadID(reloadID string) *EditCrtStoreAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the edit crt store accepted response -func (o *EditCrtStoreAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the edit crt store accepted response -func (o *EditCrtStoreAccepted) WithPayload(payload *models.CrtStore) *EditCrtStoreAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit crt store accepted response -func (o *EditCrtStoreAccepted) SetPayload(payload *models.CrtStore) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditCrtStoreAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditCrtStoreBadRequestCode is the HTTP code returned for type EditCrtStoreBadRequest -const EditCrtStoreBadRequestCode int = 400 - -/* -EditCrtStoreBadRequest Bad request - -swagger:response editCrtStoreBadRequest -*/ -type EditCrtStoreBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditCrtStoreBadRequest creates EditCrtStoreBadRequest with default headers values -func NewEditCrtStoreBadRequest() *EditCrtStoreBadRequest { - - return &EditCrtStoreBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit crt store bad request response -func (o *EditCrtStoreBadRequest) WithConfigurationVersion(configurationVersion string) *EditCrtStoreBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit crt store bad request response -func (o *EditCrtStoreBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit crt store bad request response -func (o *EditCrtStoreBadRequest) WithPayload(payload *models.Error) *EditCrtStoreBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit crt store bad request response -func (o *EditCrtStoreBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditCrtStoreBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditCrtStoreNotFoundCode is the HTTP code returned for type EditCrtStoreNotFound -const EditCrtStoreNotFoundCode int = 404 - -/* -EditCrtStoreNotFound The specified resource was not found - -swagger:response editCrtStoreNotFound -*/ -type EditCrtStoreNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditCrtStoreNotFound creates EditCrtStoreNotFound with default headers values -func NewEditCrtStoreNotFound() *EditCrtStoreNotFound { - - return &EditCrtStoreNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit crt store not found response -func (o *EditCrtStoreNotFound) WithConfigurationVersion(configurationVersion string) *EditCrtStoreNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit crt store not found response -func (o *EditCrtStoreNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit crt store not found response -func (o *EditCrtStoreNotFound) WithPayload(payload *models.Error) *EditCrtStoreNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit crt store not found response -func (o *EditCrtStoreNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditCrtStoreNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -EditCrtStoreDefault General Error - -swagger:response editCrtStoreDefault -*/ -type EditCrtStoreDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditCrtStoreDefault creates EditCrtStoreDefault with default headers values -func NewEditCrtStoreDefault(code int) *EditCrtStoreDefault { - if code <= 0 { - code = 500 - } - - return &EditCrtStoreDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit crt store default response -func (o *EditCrtStoreDefault) WithStatusCode(code int) *EditCrtStoreDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit crt store default response -func (o *EditCrtStoreDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the edit crt store default response -func (o *EditCrtStoreDefault) WithConfigurationVersion(configurationVersion string) *EditCrtStoreDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit crt store default response -func (o *EditCrtStoreDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit crt store default response -func (o *EditCrtStoreDefault) WithPayload(payload *models.Error) *EditCrtStoreDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit crt store default response -func (o *EditCrtStoreDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditCrtStoreDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_store/edit_crt_store_urlbuilder.go b/operations/crt_store/edit_crt_store_urlbuilder.go deleted file mode 100644 index bd409ac0..00000000 --- a/operations/crt_store/edit_crt_store_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// EditCrtStoreURL generates an URL for the edit crt store operation -type EditCrtStoreURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditCrtStoreURL) WithBasePath(bp string) *EditCrtStoreURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditCrtStoreURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditCrtStoreURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_stores/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on EditCrtStoreURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EditCrtStoreURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EditCrtStoreURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditCrtStoreURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditCrtStoreURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditCrtStoreURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EditCrtStoreURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_store/get_crt_store.go b/operations/crt_store/get_crt_store.go deleted file mode 100644 index fb4dfc78..00000000 --- a/operations/crt_store/get_crt_store.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCrtStoreHandlerFunc turns a function with the right signature into a get crt store handler -type GetCrtStoreHandlerFunc func(GetCrtStoreParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCrtStoreHandlerFunc) Handle(params GetCrtStoreParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCrtStoreHandler interface for that can handle valid get crt store params -type GetCrtStoreHandler interface { - Handle(GetCrtStoreParams, interface{}) middleware.Responder -} - -// NewGetCrtStore creates a new http.Handler for the get crt store operation -func NewGetCrtStore(ctx *middleware.Context, handler GetCrtStoreHandler) *GetCrtStore { - return &GetCrtStore{Context: ctx, Handler: handler} -} - -/* - GetCrtStore swagger:route GET /services/haproxy/configuration/crt_stores/{name} CrtStore getCrtStore - -# Return a Certificate Store - -Returns crt_store section by its name -*/ -type GetCrtStore struct { - Context *middleware.Context - Handler GetCrtStoreHandler -} - -func (o *GetCrtStore) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCrtStoreParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_store/get_crt_store_parameters.go b/operations/crt_store/get_crt_store_parameters.go deleted file mode 100644 index e24fe0b8..00000000 --- a/operations/crt_store/get_crt_store_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCrtStoreParams creates a new GetCrtStoreParams object -// -// There are no default values defined in the spec. -func NewGetCrtStoreParams() GetCrtStoreParams { - - return GetCrtStoreParams{} -} - -// GetCrtStoreParams contains all the bound params for the get crt store operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCrtStore -type GetCrtStoreParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*crt_store name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCrtStoreParams() beforehand. -func (o *GetCrtStoreParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCrtStoreParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCrtStoreParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/crt_store/get_crt_store_responses.go b/operations/crt_store/get_crt_store_responses.go deleted file mode 100644 index 12d0d7fc..00000000 --- a/operations/crt_store/get_crt_store_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCrtStoreOKCode is the HTTP code returned for type GetCrtStoreOK -const GetCrtStoreOKCode int = 200 - -/* -GetCrtStoreOK Successful operation - -swagger:response getCrtStoreOK -*/ -type GetCrtStoreOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.CrtStore `json:"body,omitempty"` -} - -// NewGetCrtStoreOK creates GetCrtStoreOK with default headers values -func NewGetCrtStoreOK() *GetCrtStoreOK { - - return &GetCrtStoreOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt store o k response -func (o *GetCrtStoreOK) WithConfigurationVersion(configurationVersion string) *GetCrtStoreOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt store o k response -func (o *GetCrtStoreOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt store o k response -func (o *GetCrtStoreOK) WithPayload(payload *models.CrtStore) *GetCrtStoreOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt store o k response -func (o *GetCrtStoreOK) SetPayload(payload *models.CrtStore) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtStoreOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetCrtStoreNotFoundCode is the HTTP code returned for type GetCrtStoreNotFound -const GetCrtStoreNotFoundCode int = 404 - -/* -GetCrtStoreNotFound The specified resource was not found - -swagger:response getCrtStoreNotFound -*/ -type GetCrtStoreNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtStoreNotFound creates GetCrtStoreNotFound with default headers values -func NewGetCrtStoreNotFound() *GetCrtStoreNotFound { - - return &GetCrtStoreNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt store not found response -func (o *GetCrtStoreNotFound) WithConfigurationVersion(configurationVersion string) *GetCrtStoreNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt store not found response -func (o *GetCrtStoreNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt store not found response -func (o *GetCrtStoreNotFound) WithPayload(payload *models.Error) *GetCrtStoreNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt store not found response -func (o *GetCrtStoreNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtStoreNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCrtStoreDefault General Error - -swagger:response getCrtStoreDefault -*/ -type GetCrtStoreDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtStoreDefault creates GetCrtStoreDefault with default headers values -func NewGetCrtStoreDefault(code int) *GetCrtStoreDefault { - if code <= 0 { - code = 500 - } - - return &GetCrtStoreDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get crt store default response -func (o *GetCrtStoreDefault) WithStatusCode(code int) *GetCrtStoreDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get crt store default response -func (o *GetCrtStoreDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get crt store default response -func (o *GetCrtStoreDefault) WithConfigurationVersion(configurationVersion string) *GetCrtStoreDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt store default response -func (o *GetCrtStoreDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt store default response -func (o *GetCrtStoreDefault) WithPayload(payload *models.Error) *GetCrtStoreDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt store default response -func (o *GetCrtStoreDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtStoreDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_store/get_crt_store_urlbuilder.go b/operations/crt_store/get_crt_store_urlbuilder.go deleted file mode 100644 index cbafc2db..00000000 --- a/operations/crt_store/get_crt_store_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetCrtStoreURL generates an URL for the get crt store operation -type GetCrtStoreURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtStoreURL) WithBasePath(bp string) *GetCrtStoreURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtStoreURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCrtStoreURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_stores/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCrtStoreURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCrtStoreURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCrtStoreURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCrtStoreURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCrtStoreURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCrtStoreURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCrtStoreURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/crt_store/get_crt_stores.go b/operations/crt_store/get_crt_stores.go deleted file mode 100644 index f6b4a47e..00000000 --- a/operations/crt_store/get_crt_stores.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCrtStoresHandlerFunc turns a function with the right signature into a get crt stores handler -type GetCrtStoresHandlerFunc func(GetCrtStoresParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCrtStoresHandlerFunc) Handle(params GetCrtStoresParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCrtStoresHandler interface for that can handle valid get crt stores params -type GetCrtStoresHandler interface { - Handle(GetCrtStoresParams, interface{}) middleware.Responder -} - -// NewGetCrtStores creates a new http.Handler for the get crt stores operation -func NewGetCrtStores(ctx *middleware.Context, handler GetCrtStoresHandler) *GetCrtStores { - return &GetCrtStores{Context: ctx, Handler: handler} -} - -/* - GetCrtStores swagger:route GET /services/haproxy/configuration/crt_stores CrtStore getCrtStores - -# Return all the Certificate Stores - -Returns an array of all the configured crt_store sections in HAProxy -*/ -type GetCrtStores struct { - Context *middleware.Context - Handler GetCrtStoresHandler -} - -func (o *GetCrtStores) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCrtStoresParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/crt_store/get_crt_stores_parameters.go b/operations/crt_store/get_crt_stores_parameters.go deleted file mode 100644 index 7a9fe822..00000000 --- a/operations/crt_store/get_crt_stores_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCrtStoresParams creates a new GetCrtStoresParams object -// -// There are no default values defined in the spec. -func NewGetCrtStoresParams() GetCrtStoresParams { - - return GetCrtStoresParams{} -} - -// GetCrtStoresParams contains all the bound params for the get crt stores operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCrtStores -type GetCrtStoresParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCrtStoresParams() beforehand. -func (o *GetCrtStoresParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetCrtStoresParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/crt_store/get_crt_stores_responses.go b/operations/crt_store/get_crt_stores_responses.go deleted file mode 100644 index 159f1bc8..00000000 --- a/operations/crt_store/get_crt_stores_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCrtStoresOKCode is the HTTP code returned for type GetCrtStoresOK -const GetCrtStoresOKCode int = 200 - -/* -GetCrtStoresOK Successful operation - -swagger:response getCrtStoresOK -*/ -type GetCrtStoresOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.CrtStores `json:"body,omitempty"` -} - -// NewGetCrtStoresOK creates GetCrtStoresOK with default headers values -func NewGetCrtStoresOK() *GetCrtStoresOK { - - return &GetCrtStoresOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crt stores o k response -func (o *GetCrtStoresOK) WithConfigurationVersion(configurationVersion string) *GetCrtStoresOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt stores o k response -func (o *GetCrtStoresOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt stores o k response -func (o *GetCrtStoresOK) WithPayload(payload models.CrtStores) *GetCrtStoresOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt stores o k response -func (o *GetCrtStoresOK) SetPayload(payload models.CrtStores) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtStoresOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.CrtStores{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetCrtStoresDefault General Error - -swagger:response getCrtStoresDefault -*/ -type GetCrtStoresDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrtStoresDefault creates GetCrtStoresDefault with default headers values -func NewGetCrtStoresDefault(code int) *GetCrtStoresDefault { - if code <= 0 { - code = 500 - } - - return &GetCrtStoresDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get crt stores default response -func (o *GetCrtStoresDefault) WithStatusCode(code int) *GetCrtStoresDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get crt stores default response -func (o *GetCrtStoresDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get crt stores default response -func (o *GetCrtStoresDefault) WithConfigurationVersion(configurationVersion string) *GetCrtStoresDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crt stores default response -func (o *GetCrtStoresDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crt stores default response -func (o *GetCrtStoresDefault) WithPayload(payload *models.Error) *GetCrtStoresDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crt stores default response -func (o *GetCrtStoresDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrtStoresDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/crt_store/get_crt_stores_urlbuilder.go b/operations/crt_store/get_crt_stores_urlbuilder.go deleted file mode 100644 index ab7c0f86..00000000 --- a/operations/crt_store/get_crt_stores_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package crt_store - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetCrtStoresURL generates an URL for the get crt stores operation -type GetCrtStoresURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtStoresURL) WithBasePath(bp string) *GetCrtStoresURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrtStoresURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCrtStoresURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/crt_stores" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCrtStoresURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCrtStoresURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCrtStoresURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCrtStoresURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCrtStoresURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCrtStoresURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/data_plane_api.go b/operations/data_plane_api.go deleted file mode 100644 index ab8ede94..00000000 --- a/operations/data_plane_api.go +++ /dev/null @@ -1,6976 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package operations - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "net/http" - "strings" - - "github.com/go-openapi/errors" - "github.com/go-openapi/loads" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/runtime/security" - "github.com/go-openapi/spec" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/dataplaneapi/operations/acl" - "github.com/haproxytech/dataplaneapi/operations/acl_runtime" - "github.com/haproxytech/dataplaneapi/operations/acme" - "github.com/haproxytech/dataplaneapi/operations/acme_runtime" - "github.com/haproxytech/dataplaneapi/operations/backend" - "github.com/haproxytech/dataplaneapi/operations/backend_switching_rule" - "github.com/haproxytech/dataplaneapi/operations/bind" - "github.com/haproxytech/dataplaneapi/operations/cache" - "github.com/haproxytech/dataplaneapi/operations/cluster" - "github.com/haproxytech/dataplaneapi/operations/configuration" - "github.com/haproxytech/dataplaneapi/operations/crt_load" - "github.com/haproxytech/dataplaneapi/operations/crt_store" - "github.com/haproxytech/dataplaneapi/operations/declare_capture" - "github.com/haproxytech/dataplaneapi/operations/defaults" - "github.com/haproxytech/dataplaneapi/operations/dgram_bind" - "github.com/haproxytech/dataplaneapi/operations/discovery" - "github.com/haproxytech/dataplaneapi/operations/fcgi_app" - "github.com/haproxytech/dataplaneapi/operations/filter" - "github.com/haproxytech/dataplaneapi/operations/frontend" - "github.com/haproxytech/dataplaneapi/operations/global" - "github.com/haproxytech/dataplaneapi/operations/group" - "github.com/haproxytech/dataplaneapi/operations/health" - "github.com/haproxytech/dataplaneapi/operations/http_after_response_rule" - "github.com/haproxytech/dataplaneapi/operations/http_check" - "github.com/haproxytech/dataplaneapi/operations/http_error_rule" - "github.com/haproxytech/dataplaneapi/operations/http_errors" - "github.com/haproxytech/dataplaneapi/operations/http_request_rule" - "github.com/haproxytech/dataplaneapi/operations/http_response_rule" - "github.com/haproxytech/dataplaneapi/operations/information" - "github.com/haproxytech/dataplaneapi/operations/log_forward" - "github.com/haproxytech/dataplaneapi/operations/log_profile" - "github.com/haproxytech/dataplaneapi/operations/log_target" - "github.com/haproxytech/dataplaneapi/operations/mailer_entry" - "github.com/haproxytech/dataplaneapi/operations/mailers" - "github.com/haproxytech/dataplaneapi/operations/maps" - "github.com/haproxytech/dataplaneapi/operations/nameserver" - "github.com/haproxytech/dataplaneapi/operations/peer" - "github.com/haproxytech/dataplaneapi/operations/peer_entry" - "github.com/haproxytech/dataplaneapi/operations/process_manager" - "github.com/haproxytech/dataplaneapi/operations/quic_initial_rule" - "github.com/haproxytech/dataplaneapi/operations/reloads" - "github.com/haproxytech/dataplaneapi/operations/resolver" - "github.com/haproxytech/dataplaneapi/operations/ring" - "github.com/haproxytech/dataplaneapi/operations/s_s_l_front_use" - "github.com/haproxytech/dataplaneapi/operations/s_s_l_runtime" - serverops "github.com/haproxytech/dataplaneapi/operations/server" - "github.com/haproxytech/dataplaneapi/operations/server_switching_rule" - "github.com/haproxytech/dataplaneapi/operations/server_template" - "github.com/haproxytech/dataplaneapi/operations/service_discovery" - "github.com/haproxytech/dataplaneapi/operations/sites" - "github.com/haproxytech/dataplaneapi/operations/specification" - "github.com/haproxytech/dataplaneapi/operations/specification_openapiv3" - "github.com/haproxytech/dataplaneapi/operations/spoe" - "github.com/haproxytech/dataplaneapi/operations/spoe_transactions" - "github.com/haproxytech/dataplaneapi/operations/stats" - "github.com/haproxytech/dataplaneapi/operations/stick_rule" - "github.com/haproxytech/dataplaneapi/operations/stick_table" - "github.com/haproxytech/dataplaneapi/operations/storage" - "github.com/haproxytech/dataplaneapi/operations/table" - "github.com/haproxytech/dataplaneapi/operations/tcp_check" - "github.com/haproxytech/dataplaneapi/operations/tcp_request_rule" - "github.com/haproxytech/dataplaneapi/operations/tcp_response_rule" - "github.com/haproxytech/dataplaneapi/operations/traces" - "github.com/haproxytech/dataplaneapi/operations/transactions" - "github.com/haproxytech/dataplaneapi/operations/user" - "github.com/haproxytech/dataplaneapi/operations/userlist" -) - -// NewDataPlaneAPI creates a new DataPlane instance -func NewDataPlaneAPI(spec *loads.Document) *DataPlaneAPI { - return &DataPlaneAPI{ - handlers: make(map[string]map[string]http.Handler), - formats: strfmt.Default, - defaultConsumes: "application/json", - defaultProduces: "application/json", - customConsumers: make(map[string]runtime.Consumer), - customProducers: make(map[string]runtime.Producer), - PreServerShutdown: func() {}, - ServerShutdown: func() {}, - spec: spec, - useSwaggerUI: false, - ServeError: errors.ServeError, - BasicAuthenticator: security.BasicAuth, - APIKeyAuthenticator: security.APIKeyAuth, - BearerAuthenticator: security.BearerAuth, - - JSONConsumer: runtime.JSONConsumer(), - MultipartformConsumer: runtime.DiscardConsumer, - TxtConsumer: runtime.TextConsumer(), - - BinProducer: runtime.ByteStreamProducer(), - JSONProducer: runtime.JSONProducer(), - TxtProducer: runtime.TextProducer(), - - StorageCreateStorageSSLCrtListEntryHandler: storage.CreateStorageSSLCrtListEntryHandlerFunc(func(params storage.CreateStorageSSLCrtListEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.CreateStorageSSLCrtListEntry has not yet been implemented") - }), - ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler: acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc(func(params acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesID has not yet been implemented") - }), - StorageDeleteStorageSSLCrtListEntryHandler: storage.DeleteStorageSSLCrtListEntryHandlerFunc(func(params storage.DeleteStorageSSLCrtListEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.DeleteStorageSSLCrtListEntry has not yet been implemented") - }), - ACLRuntimeGetServicesHaproxyRuntimeAclsHandler: acl_runtime.GetServicesHaproxyRuntimeAclsHandlerFunc(func(params acl_runtime.GetServicesHaproxyRuntimeAclsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.GetServicesHaproxyRuntimeAcls has not yet been implemented") - }), - ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler: acl_runtime.GetServicesHaproxyRuntimeAclsIDHandlerFunc(func(params acl_runtime.GetServicesHaproxyRuntimeAclsIDParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.GetServicesHaproxyRuntimeAclsID has not yet been implemented") - }), - ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler: acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc(func(params acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntries has not yet been implemented") - }), - ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler: acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandlerFunc(func(params acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesIDParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesID has not yet been implemented") - }), - StorageGetStorageSSLCrtListEntriesHandler: storage.GetStorageSSLCrtListEntriesHandlerFunc(func(params storage.GetStorageSSLCrtListEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetStorageSSLCrtListEntries has not yet been implemented") - }), - ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler: acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntriesHandlerFunc(func(params acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntries has not yet been implemented") - }), - SslRuntimeAddCaEntryHandler: s_s_l_runtime.AddCaEntryHandlerFunc(func(params s_s_l_runtime.AddCaEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.AddCaEntry has not yet been implemented") - }), - SslRuntimeAddCrtListEntryHandler: s_s_l_runtime.AddCrtListEntryHandlerFunc(func(params s_s_l_runtime.AddCrtListEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.AddCrtListEntry has not yet been implemented") - }), - DefaultsAddDefaultsSectionHandler: defaults.AddDefaultsSectionHandlerFunc(func(params defaults.AddDefaultsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.AddDefaultsSection has not yet been implemented") - }), - MapsAddMapEntryHandler: maps.AddMapEntryHandlerFunc(func(params maps.AddMapEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.AddMapEntry has not yet been implemented") - }), - ACLRuntimeAddPayloadRuntimeACLHandler: acl_runtime.AddPayloadRuntimeACLHandlerFunc(func(params acl_runtime.AddPayloadRuntimeACLParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl_runtime.AddPayloadRuntimeACL has not yet been implemented") - }), - MapsAddPayloadRuntimeMapHandler: maps.AddPayloadRuntimeMapHandlerFunc(func(params maps.AddPayloadRuntimeMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.AddPayloadRuntimeMap has not yet been implemented") - }), - ServerAddRuntimeServerHandler: serverops.AddRuntimeServerHandlerFunc(func(params serverops.AddRuntimeServerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.AddRuntimeServer has not yet been implemented") - }), - MapsClearRuntimeMapHandler: maps.ClearRuntimeMapHandlerFunc(func(params maps.ClearRuntimeMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.ClearRuntimeMap has not yet been implemented") - }), - SpoeTransactionsCommitSpoeTransactionHandler: spoe_transactions.CommitSpoeTransactionHandlerFunc(func(params spoe_transactions.CommitSpoeTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe_transactions.CommitSpoeTransaction has not yet been implemented") - }), - TransactionsCommitTransactionHandler: transactions.CommitTransactionHandlerFunc(func(params transactions.CommitTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation transactions.CommitTransaction has not yet been implemented") - }), - ServiceDiscoveryCreateAWSRegionHandler: service_discovery.CreateAWSRegionHandlerFunc(func(params service_discovery.CreateAWSRegionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.CreateAWSRegion has not yet been implemented") - }), - ACLCreateACLBackendHandler: acl.CreateACLBackendHandlerFunc(func(params acl.CreateACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.CreateACLBackend has not yet been implemented") - }), - ACLCreateACLDefaultsHandler: acl.CreateACLDefaultsHandlerFunc(func(params acl.CreateACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.CreateACLDefaults has not yet been implemented") - }), - ACLCreateACLFCGIAppHandler: acl.CreateACLFCGIAppHandlerFunc(func(params acl.CreateACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.CreateACLFCGIApp has not yet been implemented") - }), - ACLCreateACLFrontendHandler: acl.CreateACLFrontendHandlerFunc(func(params acl.CreateACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.CreateACLFrontend has not yet been implemented") - }), - AcmeCreateAcmeProviderHandler: acme.CreateAcmeProviderHandlerFunc(func(params acme.CreateAcmeProviderParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme.CreateAcmeProvider has not yet been implemented") - }), - BackendCreateBackendHandler: backend.CreateBackendHandlerFunc(func(params backend.CreateBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend.CreateBackend has not yet been implemented") - }), - BackendSwitchingRuleCreateBackendSwitchingRuleHandler: backend_switching_rule.CreateBackendSwitchingRuleHandlerFunc(func(params backend_switching_rule.CreateBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.CreateBackendSwitchingRule has not yet been implemented") - }), - BindCreateBindFrontendHandler: bind.CreateBindFrontendHandlerFunc(func(params bind.CreateBindFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.CreateBindFrontend has not yet been implemented") - }), - BindCreateBindLogForwardHandler: bind.CreateBindLogForwardHandlerFunc(func(params bind.CreateBindLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.CreateBindLogForward has not yet been implemented") - }), - BindCreateBindPeerHandler: bind.CreateBindPeerHandlerFunc(func(params bind.CreateBindPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.CreateBindPeer has not yet been implemented") - }), - SslRuntimeCreateCaFileHandler: s_s_l_runtime.CreateCaFileHandlerFunc(func(params s_s_l_runtime.CreateCaFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.CreateCaFile has not yet been implemented") - }), - CacheCreateCacheHandler: cache.CreateCacheHandlerFunc(func(params cache.CreateCacheParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cache.CreateCache has not yet been implemented") - }), - SslRuntimeCreateCertHandler: s_s_l_runtime.CreateCertHandlerFunc(func(params s_s_l_runtime.CreateCertParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.CreateCert has not yet been implemented") - }), - ServiceDiscoveryCreateConsulHandler: service_discovery.CreateConsulHandlerFunc(func(params service_discovery.CreateConsulParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.CreateConsul has not yet been implemented") - }), - SslRuntimeCreateCrlHandler: s_s_l_runtime.CreateCrlHandlerFunc(func(params s_s_l_runtime.CreateCrlParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.CreateCrl has not yet been implemented") - }), - CrtLoadCreateCrtLoadHandler: crt_load.CreateCrtLoadHandlerFunc(func(params crt_load.CreateCrtLoadParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_load.CreateCrtLoad has not yet been implemented") - }), - CrtStoreCreateCrtStoreHandler: crt_store.CreateCrtStoreHandlerFunc(func(params crt_store.CreateCrtStoreParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_store.CreateCrtStore has not yet been implemented") - }), - DeclareCaptureCreateDeclareCaptureHandler: declare_capture.CreateDeclareCaptureHandlerFunc(func(params declare_capture.CreateDeclareCaptureParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.CreateDeclareCapture has not yet been implemented") - }), - DefaultsCreateDefaultsSectionHandler: defaults.CreateDefaultsSectionHandlerFunc(func(params defaults.CreateDefaultsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.CreateDefaultsSection has not yet been implemented") - }), - DgramBindCreateDgramBindHandler: dgram_bind.CreateDgramBindHandlerFunc(func(params dgram_bind.CreateDgramBindParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation dgram_bind.CreateDgramBind has not yet been implemented") - }), - FCGIAppCreateFCGIAppHandler: fcgi_app.CreateFCGIAppHandlerFunc(func(params fcgi_app.CreateFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation fcgi_app.CreateFCGIApp has not yet been implemented") - }), - FilterCreateFilterBackendHandler: filter.CreateFilterBackendHandlerFunc(func(params filter.CreateFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.CreateFilterBackend has not yet been implemented") - }), - FilterCreateFilterFrontendHandler: filter.CreateFilterFrontendHandlerFunc(func(params filter.CreateFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.CreateFilterFrontend has not yet been implemented") - }), - FrontendCreateFrontendHandler: frontend.CreateFrontendHandlerFunc(func(params frontend.CreateFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation frontend.CreateFrontend has not yet been implemented") - }), - GroupCreateGroupHandler: group.CreateGroupHandlerFunc(func(params group.CreateGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation group.CreateGroup has not yet been implemented") - }), - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler: http_after_response_rule.CreateHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.CreateHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.CreateHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.CreateHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.CreateHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.CreateHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.CreateHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.CreateHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.CreateHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckCreateHTTPCheckBackendHandler: http_check.CreateHTTPCheckBackendHandlerFunc(func(params http_check.CreateHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.CreateHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckCreateHTTPCheckDefaultsHandler: http_check.CreateHTTPCheckDefaultsHandlerFunc(func(params http_check.CreateHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.CreateHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleCreateHTTPErrorRuleBackendHandler: http_error_rule.CreateHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.CreateHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.CreateHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler: http_error_rule.CreateHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.CreateHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.CreateHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler: http_error_rule.CreateHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.CreateHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.CreateHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPErrorsCreateHTTPErrorsSectionHandler: http_errors.CreateHTTPErrorsSectionHandlerFunc(func(params http_errors.CreateHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_errors.CreateHTTPErrorsSection has not yet been implemented") - }), - HTTPRequestRuleCreateHTTPRequestRuleBackendHandler: http_request_rule.CreateHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.CreateHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.CreateHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleCreateHTTPRequestRuleDefaultsHandler: http_request_rule.CreateHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.CreateHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.CreateHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler: http_request_rule.CreateHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.CreateHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.CreateHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleCreateHTTPResponseRuleBackendHandler: http_response_rule.CreateHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.CreateHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.CreateHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleCreateHTTPResponseRuleDefaultsHandler: http_response_rule.CreateHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.CreateHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.CreateHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler: http_response_rule.CreateHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.CreateHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.CreateHTTPResponseRuleFrontend has not yet been implemented") - }), - LogForwardCreateLogForwardHandler: log_forward.CreateLogForwardHandlerFunc(func(params log_forward.CreateLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_forward.CreateLogForward has not yet been implemented") - }), - LogProfileCreateLogProfileHandler: log_profile.CreateLogProfileHandlerFunc(func(params log_profile.CreateLogProfileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_profile.CreateLogProfile has not yet been implemented") - }), - LogTargetCreateLogTargetBackendHandler: log_target.CreateLogTargetBackendHandlerFunc(func(params log_target.CreateLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetBackend has not yet been implemented") - }), - LogTargetCreateLogTargetDefaultsHandler: log_target.CreateLogTargetDefaultsHandlerFunc(func(params log_target.CreateLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetDefaults has not yet been implemented") - }), - LogTargetCreateLogTargetFrontendHandler: log_target.CreateLogTargetFrontendHandlerFunc(func(params log_target.CreateLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetFrontend has not yet been implemented") - }), - LogTargetCreateLogTargetGlobalHandler: log_target.CreateLogTargetGlobalHandlerFunc(func(params log_target.CreateLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetGlobal has not yet been implemented") - }), - LogTargetCreateLogTargetLogForwardHandler: log_target.CreateLogTargetLogForwardHandlerFunc(func(params log_target.CreateLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetLogForward has not yet been implemented") - }), - LogTargetCreateLogTargetPeerHandler: log_target.CreateLogTargetPeerHandlerFunc(func(params log_target.CreateLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.CreateLogTargetPeer has not yet been implemented") - }), - MailerEntryCreateMailerEntryHandler: mailer_entry.CreateMailerEntryHandlerFunc(func(params mailer_entry.CreateMailerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailer_entry.CreateMailerEntry has not yet been implemented") - }), - MailersCreateMailersSectionHandler: mailers.CreateMailersSectionHandlerFunc(func(params mailers.CreateMailersSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailers.CreateMailersSection has not yet been implemented") - }), - NameserverCreateNameserverHandler: nameserver.CreateNameserverHandlerFunc(func(params nameserver.CreateNameserverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation nameserver.CreateNameserver has not yet been implemented") - }), - PeerCreatePeerHandler: peer.CreatePeerHandlerFunc(func(params peer.CreatePeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer.CreatePeer has not yet been implemented") - }), - PeerEntryCreatePeerEntryHandler: peer_entry.CreatePeerEntryHandlerFunc(func(params peer_entry.CreatePeerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer_entry.CreatePeerEntry has not yet been implemented") - }), - ProcessManagerCreateProgramHandler: process_manager.CreateProgramHandlerFunc(func(params process_manager.CreateProgramParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation process_manager.CreateProgram has not yet been implemented") - }), - QUICInitialRuleCreateQUICInitialRuleDefaultsHandler: quic_initial_rule.CreateQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.CreateQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.CreateQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleCreateQUICInitialRuleFrontendHandler: quic_initial_rule.CreateQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.CreateQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.CreateQUICInitialRuleFrontend has not yet been implemented") - }), - ResolverCreateResolverHandler: resolver.CreateResolverHandlerFunc(func(params resolver.CreateResolverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation resolver.CreateResolver has not yet been implemented") - }), - RingCreateRingHandler: ring.CreateRingHandlerFunc(func(params ring.CreateRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation ring.CreateRing has not yet been implemented") - }), - SslFrontUseCreateSSLFrontUseHandler: s_s_l_front_use.CreateSSLFrontUseHandlerFunc(func(params s_s_l_front_use.CreateSSLFrontUseParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_front_use.CreateSSLFrontUse has not yet been implemented") - }), - ServerCreateServerBackendHandler: serverops.CreateServerBackendHandlerFunc(func(params serverops.CreateServerBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.CreateServerBackend has not yet been implemented") - }), - ServerCreateServerPeerHandler: serverops.CreateServerPeerHandlerFunc(func(params serverops.CreateServerPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.CreateServerPeer has not yet been implemented") - }), - ServerCreateServerRingHandler: serverops.CreateServerRingHandlerFunc(func(params serverops.CreateServerRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.CreateServerRing has not yet been implemented") - }), - ServerSwitchingRuleCreateServerSwitchingRuleHandler: server_switching_rule.CreateServerSwitchingRuleHandlerFunc(func(params server_switching_rule.CreateServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.CreateServerSwitchingRule has not yet been implemented") - }), - ServerTemplateCreateServerTemplateHandler: server_template.CreateServerTemplateHandlerFunc(func(params server_template.CreateServerTemplateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_template.CreateServerTemplate has not yet been implemented") - }), - SitesCreateSiteHandler: sites.CreateSiteHandlerFunc(func(params sites.CreateSiteParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation sites.CreateSite has not yet been implemented") - }), - SpoeCreateSpoeHandler: spoe.CreateSpoeHandlerFunc(func(params spoe.CreateSpoeParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.CreateSpoe has not yet been implemented") - }), - SpoeCreateSpoeAgentHandler: spoe.CreateSpoeAgentHandlerFunc(func(params spoe.CreateSpoeAgentParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.CreateSpoeAgent has not yet been implemented") - }), - SpoeCreateSpoeGroupHandler: spoe.CreateSpoeGroupHandlerFunc(func(params spoe.CreateSpoeGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.CreateSpoeGroup has not yet been implemented") - }), - SpoeCreateSpoeMessageHandler: spoe.CreateSpoeMessageHandlerFunc(func(params spoe.CreateSpoeMessageParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.CreateSpoeMessage has not yet been implemented") - }), - SpoeCreateSpoeScopeHandler: spoe.CreateSpoeScopeHandlerFunc(func(params spoe.CreateSpoeScopeParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.CreateSpoeScope has not yet been implemented") - }), - StickRuleCreateStickRuleHandler: stick_rule.CreateStickRuleHandlerFunc(func(params stick_rule.CreateStickRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.CreateStickRule has not yet been implemented") - }), - StorageCreateStorageGeneralFileHandler: storage.CreateStorageGeneralFileHandlerFunc(func(params storage.CreateStorageGeneralFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.CreateStorageGeneralFile has not yet been implemented") - }), - StorageCreateStorageMapFileHandler: storage.CreateStorageMapFileHandlerFunc(func(params storage.CreateStorageMapFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.CreateStorageMapFile has not yet been implemented") - }), - StorageCreateStorageSSLCertificateHandler: storage.CreateStorageSSLCertificateHandlerFunc(func(params storage.CreateStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.CreateStorageSSLCertificate has not yet been implemented") - }), - StorageCreateStorageSSLCrtListFileHandler: storage.CreateStorageSSLCrtListFileHandlerFunc(func(params storage.CreateStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.CreateStorageSSLCrtListFile has not yet been implemented") - }), - TCPCheckCreateTCPCheckBackendHandler: tcp_check.CreateTCPCheckBackendHandlerFunc(func(params tcp_check.CreateTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.CreateTCPCheckBackend has not yet been implemented") - }), - TCPCheckCreateTCPCheckDefaultsHandler: tcp_check.CreateTCPCheckDefaultsHandlerFunc(func(params tcp_check.CreateTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.CreateTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleCreateTCPRequestRuleBackendHandler: tcp_request_rule.CreateTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.CreateTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.CreateTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleCreateTCPRequestRuleDefaultsHandler: tcp_request_rule.CreateTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.CreateTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.CreateTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleCreateTCPRequestRuleFrontendHandler: tcp_request_rule.CreateTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.CreateTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.CreateTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleCreateTCPResponseRuleBackendHandler: tcp_response_rule.CreateTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.CreateTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.CreateTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleCreateTCPResponseRuleDefaultsHandler: tcp_response_rule.CreateTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.CreateTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.CreateTCPResponseRuleDefaults has not yet been implemented") - }), - TableCreateTableHandler: table.CreateTableHandlerFunc(func(params table.CreateTableParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation table.CreateTable has not yet been implemented") - }), - TracesCreateTraceEntryHandler: traces.CreateTraceEntryHandlerFunc(func(params traces.CreateTraceEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.CreateTraceEntry has not yet been implemented") - }), - TracesCreateTracesHandler: traces.CreateTracesHandlerFunc(func(params traces.CreateTracesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.CreateTraces has not yet been implemented") - }), - UserCreateUserHandler: user.CreateUserHandlerFunc(func(params user.CreateUserParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation user.CreateUser has not yet been implemented") - }), - UserlistCreateUserlistHandler: userlist.CreateUserlistHandlerFunc(func(params userlist.CreateUserlistParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation userlist.CreateUserlist has not yet been implemented") - }), - ServiceDiscoveryDeleteAWSRegionHandler: service_discovery.DeleteAWSRegionHandlerFunc(func(params service_discovery.DeleteAWSRegionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.DeleteAWSRegion has not yet been implemented") - }), - ACLDeleteACLBackendHandler: acl.DeleteACLBackendHandlerFunc(func(params acl.DeleteACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.DeleteACLBackend has not yet been implemented") - }), - ACLDeleteACLDefaultsHandler: acl.DeleteACLDefaultsHandlerFunc(func(params acl.DeleteACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.DeleteACLDefaults has not yet been implemented") - }), - ACLDeleteACLFCGIAppHandler: acl.DeleteACLFCGIAppHandlerFunc(func(params acl.DeleteACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.DeleteACLFCGIApp has not yet been implemented") - }), - ACLDeleteACLFrontendHandler: acl.DeleteACLFrontendHandlerFunc(func(params acl.DeleteACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.DeleteACLFrontend has not yet been implemented") - }), - AcmeDeleteAcmeProviderHandler: acme.DeleteAcmeProviderHandlerFunc(func(params acme.DeleteAcmeProviderParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme.DeleteAcmeProvider has not yet been implemented") - }), - BackendDeleteBackendHandler: backend.DeleteBackendHandlerFunc(func(params backend.DeleteBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend.DeleteBackend has not yet been implemented") - }), - BackendSwitchingRuleDeleteBackendSwitchingRuleHandler: backend_switching_rule.DeleteBackendSwitchingRuleHandlerFunc(func(params backend_switching_rule.DeleteBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.DeleteBackendSwitchingRule has not yet been implemented") - }), - BindDeleteBindFrontendHandler: bind.DeleteBindFrontendHandlerFunc(func(params bind.DeleteBindFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.DeleteBindFrontend has not yet been implemented") - }), - BindDeleteBindLogForwardHandler: bind.DeleteBindLogForwardHandlerFunc(func(params bind.DeleteBindLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.DeleteBindLogForward has not yet been implemented") - }), - BindDeleteBindPeerHandler: bind.DeleteBindPeerHandlerFunc(func(params bind.DeleteBindPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.DeleteBindPeer has not yet been implemented") - }), - SslRuntimeDeleteCaFileHandler: s_s_l_runtime.DeleteCaFileHandlerFunc(func(params s_s_l_runtime.DeleteCaFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.DeleteCaFile has not yet been implemented") - }), - CacheDeleteCacheHandler: cache.DeleteCacheHandlerFunc(func(params cache.DeleteCacheParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cache.DeleteCache has not yet been implemented") - }), - SslRuntimeDeleteCertHandler: s_s_l_runtime.DeleteCertHandlerFunc(func(params s_s_l_runtime.DeleteCertParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.DeleteCert has not yet been implemented") - }), - ClusterDeleteClusterHandler: cluster.DeleteClusterHandlerFunc(func(params cluster.DeleteClusterParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cluster.DeleteCluster has not yet been implemented") - }), - ServiceDiscoveryDeleteConsulHandler: service_discovery.DeleteConsulHandlerFunc(func(params service_discovery.DeleteConsulParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.DeleteConsul has not yet been implemented") - }), - SslRuntimeDeleteCrlHandler: s_s_l_runtime.DeleteCrlHandlerFunc(func(params s_s_l_runtime.DeleteCrlParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.DeleteCrl has not yet been implemented") - }), - SslRuntimeDeleteCrtListEntryHandler: s_s_l_runtime.DeleteCrtListEntryHandlerFunc(func(params s_s_l_runtime.DeleteCrtListEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.DeleteCrtListEntry has not yet been implemented") - }), - CrtLoadDeleteCrtLoadHandler: crt_load.DeleteCrtLoadHandlerFunc(func(params crt_load.DeleteCrtLoadParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_load.DeleteCrtLoad has not yet been implemented") - }), - CrtStoreDeleteCrtStoreHandler: crt_store.DeleteCrtStoreHandlerFunc(func(params crt_store.DeleteCrtStoreParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_store.DeleteCrtStore has not yet been implemented") - }), - DeclareCaptureDeleteDeclareCaptureHandler: declare_capture.DeleteDeclareCaptureHandlerFunc(func(params declare_capture.DeleteDeclareCaptureParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.DeleteDeclareCapture has not yet been implemented") - }), - DefaultsDeleteDefaultsSectionHandler: defaults.DeleteDefaultsSectionHandlerFunc(func(params defaults.DeleteDefaultsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.DeleteDefaultsSection has not yet been implemented") - }), - DgramBindDeleteDgramBindHandler: dgram_bind.DeleteDgramBindHandlerFunc(func(params dgram_bind.DeleteDgramBindParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation dgram_bind.DeleteDgramBind has not yet been implemented") - }), - FCGIAppDeleteFCGIAppHandler: fcgi_app.DeleteFCGIAppHandlerFunc(func(params fcgi_app.DeleteFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation fcgi_app.DeleteFCGIApp has not yet been implemented") - }), - FilterDeleteFilterBackendHandler: filter.DeleteFilterBackendHandlerFunc(func(params filter.DeleteFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.DeleteFilterBackend has not yet been implemented") - }), - FilterDeleteFilterFrontendHandler: filter.DeleteFilterFrontendHandlerFunc(func(params filter.DeleteFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.DeleteFilterFrontend has not yet been implemented") - }), - FrontendDeleteFrontendHandler: frontend.DeleteFrontendHandlerFunc(func(params frontend.DeleteFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation frontend.DeleteFrontend has not yet been implemented") - }), - GroupDeleteGroupHandler: group.DeleteGroupHandlerFunc(func(params group.DeleteGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation group.DeleteGroup has not yet been implemented") - }), - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler: http_after_response_rule.DeleteHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.DeleteHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.DeleteHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.DeleteHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.DeleteHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.DeleteHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.DeleteHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.DeleteHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.DeleteHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckDeleteHTTPCheckBackendHandler: http_check.DeleteHTTPCheckBackendHandlerFunc(func(params http_check.DeleteHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.DeleteHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckDeleteHTTPCheckDefaultsHandler: http_check.DeleteHTTPCheckDefaultsHandlerFunc(func(params http_check.DeleteHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.DeleteHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler: http_error_rule.DeleteHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.DeleteHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.DeleteHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler: http_error_rule.DeleteHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.DeleteHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.DeleteHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler: http_error_rule.DeleteHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.DeleteHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.DeleteHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPErrorsDeleteHTTPErrorsSectionHandler: http_errors.DeleteHTTPErrorsSectionHandlerFunc(func(params http_errors.DeleteHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_errors.DeleteHTTPErrorsSection has not yet been implemented") - }), - HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler: http_request_rule.DeleteHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.DeleteHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.DeleteHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleDeleteHTTPRequestRuleDefaultsHandler: http_request_rule.DeleteHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.DeleteHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.DeleteHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler: http_request_rule.DeleteHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.DeleteHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.DeleteHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler: http_response_rule.DeleteHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.DeleteHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.DeleteHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleDeleteHTTPResponseRuleDefaultsHandler: http_response_rule.DeleteHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.DeleteHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.DeleteHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler: http_response_rule.DeleteHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.DeleteHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.DeleteHTTPResponseRuleFrontend has not yet been implemented") - }), - LogForwardDeleteLogForwardHandler: log_forward.DeleteLogForwardHandlerFunc(func(params log_forward.DeleteLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_forward.DeleteLogForward has not yet been implemented") - }), - LogProfileDeleteLogProfileHandler: log_profile.DeleteLogProfileHandlerFunc(func(params log_profile.DeleteLogProfileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_profile.DeleteLogProfile has not yet been implemented") - }), - LogTargetDeleteLogTargetBackendHandler: log_target.DeleteLogTargetBackendHandlerFunc(func(params log_target.DeleteLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetBackend has not yet been implemented") - }), - LogTargetDeleteLogTargetDefaultsHandler: log_target.DeleteLogTargetDefaultsHandlerFunc(func(params log_target.DeleteLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetDefaults has not yet been implemented") - }), - LogTargetDeleteLogTargetFrontendHandler: log_target.DeleteLogTargetFrontendHandlerFunc(func(params log_target.DeleteLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetFrontend has not yet been implemented") - }), - LogTargetDeleteLogTargetGlobalHandler: log_target.DeleteLogTargetGlobalHandlerFunc(func(params log_target.DeleteLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetGlobal has not yet been implemented") - }), - LogTargetDeleteLogTargetLogForwardHandler: log_target.DeleteLogTargetLogForwardHandlerFunc(func(params log_target.DeleteLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetLogForward has not yet been implemented") - }), - LogTargetDeleteLogTargetPeerHandler: log_target.DeleteLogTargetPeerHandlerFunc(func(params log_target.DeleteLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.DeleteLogTargetPeer has not yet been implemented") - }), - MailerEntryDeleteMailerEntryHandler: mailer_entry.DeleteMailerEntryHandlerFunc(func(params mailer_entry.DeleteMailerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailer_entry.DeleteMailerEntry has not yet been implemented") - }), - MailersDeleteMailersSectionHandler: mailers.DeleteMailersSectionHandlerFunc(func(params mailers.DeleteMailersSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailers.DeleteMailersSection has not yet been implemented") - }), - NameserverDeleteNameserverHandler: nameserver.DeleteNameserverHandlerFunc(func(params nameserver.DeleteNameserverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation nameserver.DeleteNameserver has not yet been implemented") - }), - PeerDeletePeerHandler: peer.DeletePeerHandlerFunc(func(params peer.DeletePeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer.DeletePeer has not yet been implemented") - }), - PeerEntryDeletePeerEntryHandler: peer_entry.DeletePeerEntryHandlerFunc(func(params peer_entry.DeletePeerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer_entry.DeletePeerEntry has not yet been implemented") - }), - ProcessManagerDeleteProgramHandler: process_manager.DeleteProgramHandlerFunc(func(params process_manager.DeleteProgramParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation process_manager.DeleteProgram has not yet been implemented") - }), - QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler: quic_initial_rule.DeleteQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.DeleteQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.DeleteQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleDeleteQUICInitialRuleFrontendHandler: quic_initial_rule.DeleteQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.DeleteQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.DeleteQUICInitialRuleFrontend has not yet been implemented") - }), - ResolverDeleteResolverHandler: resolver.DeleteResolverHandlerFunc(func(params resolver.DeleteResolverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation resolver.DeleteResolver has not yet been implemented") - }), - RingDeleteRingHandler: ring.DeleteRingHandlerFunc(func(params ring.DeleteRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation ring.DeleteRing has not yet been implemented") - }), - MapsDeleteRuntimeMapEntryHandler: maps.DeleteRuntimeMapEntryHandlerFunc(func(params maps.DeleteRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.DeleteRuntimeMapEntry has not yet been implemented") - }), - ServerDeleteRuntimeServerHandler: serverops.DeleteRuntimeServerHandlerFunc(func(params serverops.DeleteRuntimeServerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.DeleteRuntimeServer has not yet been implemented") - }), - SslFrontUseDeleteSSLFrontUseHandler: s_s_l_front_use.DeleteSSLFrontUseHandlerFunc(func(params s_s_l_front_use.DeleteSSLFrontUseParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_front_use.DeleteSSLFrontUse has not yet been implemented") - }), - ServerDeleteServerBackendHandler: serverops.DeleteServerBackendHandlerFunc(func(params serverops.DeleteServerBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.DeleteServerBackend has not yet been implemented") - }), - ServerDeleteServerPeerHandler: serverops.DeleteServerPeerHandlerFunc(func(params serverops.DeleteServerPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.DeleteServerPeer has not yet been implemented") - }), - ServerDeleteServerRingHandler: serverops.DeleteServerRingHandlerFunc(func(params serverops.DeleteServerRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.DeleteServerRing has not yet been implemented") - }), - ServerSwitchingRuleDeleteServerSwitchingRuleHandler: server_switching_rule.DeleteServerSwitchingRuleHandlerFunc(func(params server_switching_rule.DeleteServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.DeleteServerSwitchingRule has not yet been implemented") - }), - ServerTemplateDeleteServerTemplateHandler: server_template.DeleteServerTemplateHandlerFunc(func(params server_template.DeleteServerTemplateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_template.DeleteServerTemplate has not yet been implemented") - }), - SitesDeleteSiteHandler: sites.DeleteSiteHandlerFunc(func(params sites.DeleteSiteParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation sites.DeleteSite has not yet been implemented") - }), - SpoeDeleteSpoeAgentHandler: spoe.DeleteSpoeAgentHandlerFunc(func(params spoe.DeleteSpoeAgentParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.DeleteSpoeAgent has not yet been implemented") - }), - SpoeDeleteSpoeFileHandler: spoe.DeleteSpoeFileHandlerFunc(func(params spoe.DeleteSpoeFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.DeleteSpoeFile has not yet been implemented") - }), - SpoeDeleteSpoeGroupHandler: spoe.DeleteSpoeGroupHandlerFunc(func(params spoe.DeleteSpoeGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.DeleteSpoeGroup has not yet been implemented") - }), - SpoeDeleteSpoeMessageHandler: spoe.DeleteSpoeMessageHandlerFunc(func(params spoe.DeleteSpoeMessageParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.DeleteSpoeMessage has not yet been implemented") - }), - SpoeDeleteSpoeScopeHandler: spoe.DeleteSpoeScopeHandlerFunc(func(params spoe.DeleteSpoeScopeParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.DeleteSpoeScope has not yet been implemented") - }), - SpoeTransactionsDeleteSpoeTransactionHandler: spoe_transactions.DeleteSpoeTransactionHandlerFunc(func(params spoe_transactions.DeleteSpoeTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe_transactions.DeleteSpoeTransaction has not yet been implemented") - }), - StickRuleDeleteStickRuleHandler: stick_rule.DeleteStickRuleHandlerFunc(func(params stick_rule.DeleteStickRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.DeleteStickRule has not yet been implemented") - }), - StorageDeleteStorageGeneralFileHandler: storage.DeleteStorageGeneralFileHandlerFunc(func(params storage.DeleteStorageGeneralFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.DeleteStorageGeneralFile has not yet been implemented") - }), - StorageDeleteStorageMapHandler: storage.DeleteStorageMapHandlerFunc(func(params storage.DeleteStorageMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.DeleteStorageMap has not yet been implemented") - }), - StorageDeleteStorageSSLCertificateHandler: storage.DeleteStorageSSLCertificateHandlerFunc(func(params storage.DeleteStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.DeleteStorageSSLCertificate has not yet been implemented") - }), - StorageDeleteStorageSSLCrtListFileHandler: storage.DeleteStorageSSLCrtListFileHandlerFunc(func(params storage.DeleteStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.DeleteStorageSSLCrtListFile has not yet been implemented") - }), - TCPCheckDeleteTCPCheckBackendHandler: tcp_check.DeleteTCPCheckBackendHandlerFunc(func(params tcp_check.DeleteTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.DeleteTCPCheckBackend has not yet been implemented") - }), - TCPCheckDeleteTCPCheckDefaultsHandler: tcp_check.DeleteTCPCheckDefaultsHandlerFunc(func(params tcp_check.DeleteTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.DeleteTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleDeleteTCPRequestRuleBackendHandler: tcp_request_rule.DeleteTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.DeleteTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.DeleteTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleDeleteTCPRequestRuleDefaultsHandler: tcp_request_rule.DeleteTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.DeleteTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.DeleteTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleDeleteTCPRequestRuleFrontendHandler: tcp_request_rule.DeleteTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.DeleteTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.DeleteTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleDeleteTCPResponseRuleBackendHandler: tcp_response_rule.DeleteTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.DeleteTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.DeleteTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleDeleteTCPResponseRuleDefaultsHandler: tcp_response_rule.DeleteTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.DeleteTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.DeleteTCPResponseRuleDefaults has not yet been implemented") - }), - TableDeleteTableHandler: table.DeleteTableHandlerFunc(func(params table.DeleteTableParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation table.DeleteTable has not yet been implemented") - }), - TracesDeleteTraceEntryHandler: traces.DeleteTraceEntryHandlerFunc(func(params traces.DeleteTraceEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.DeleteTraceEntry has not yet been implemented") - }), - TracesDeleteTracesHandler: traces.DeleteTracesHandlerFunc(func(params traces.DeleteTracesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.DeleteTraces has not yet been implemented") - }), - TransactionsDeleteTransactionHandler: transactions.DeleteTransactionHandlerFunc(func(params transactions.DeleteTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation transactions.DeleteTransaction has not yet been implemented") - }), - UserDeleteUserHandler: user.DeleteUserHandlerFunc(func(params user.DeleteUserParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation user.DeleteUser has not yet been implemented") - }), - UserlistDeleteUserlistHandler: userlist.DeleteUserlistHandlerFunc(func(params userlist.DeleteUserlistParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation userlist.DeleteUserlist has not yet been implemented") - }), - AcmeEditAcmeProviderHandler: acme.EditAcmeProviderHandlerFunc(func(params acme.EditAcmeProviderParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme.EditAcmeProvider has not yet been implemented") - }), - ClusterEditClusterHandler: cluster.EditClusterHandlerFunc(func(params cluster.EditClusterParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cluster.EditCluster has not yet been implemented") - }), - CrtStoreEditCrtStoreHandler: crt_store.EditCrtStoreHandlerFunc(func(params crt_store.EditCrtStoreParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_store.EditCrtStore has not yet been implemented") - }), - LogProfileEditLogProfileHandler: log_profile.EditLogProfileHandlerFunc(func(params log_profile.EditLogProfileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_profile.EditLogProfile has not yet been implemented") - }), - MailersEditMailersSectionHandler: mailers.EditMailersSectionHandlerFunc(func(params mailers.EditMailersSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailers.EditMailersSection has not yet been implemented") - }), - DiscoveryGetAPIEndpointsHandler: discovery.GetAPIEndpointsHandlerFunc(func(params discovery.GetAPIEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetAPIEndpoints has not yet been implemented") - }), - ServiceDiscoveryGetAWSRegionHandler: service_discovery.GetAWSRegionHandlerFunc(func(params service_discovery.GetAWSRegionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.GetAWSRegion has not yet been implemented") - }), - ServiceDiscoveryGetAWSRegionsHandler: service_discovery.GetAWSRegionsHandlerFunc(func(params service_discovery.GetAWSRegionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.GetAWSRegions has not yet been implemented") - }), - ACLGetACLBackendHandler: acl.GetACLBackendHandlerFunc(func(params acl.GetACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetACLBackend has not yet been implemented") - }), - ACLGetACLDefaultsHandler: acl.GetACLDefaultsHandlerFunc(func(params acl.GetACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetACLDefaults has not yet been implemented") - }), - ACLGetACLFCGIAppHandler: acl.GetACLFCGIAppHandlerFunc(func(params acl.GetACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetACLFCGIApp has not yet been implemented") - }), - ACLGetACLFrontendHandler: acl.GetACLFrontendHandlerFunc(func(params acl.GetACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetACLFrontend has not yet been implemented") - }), - AcmeGetAcmeProviderHandler: acme.GetAcmeProviderHandlerFunc(func(params acme.GetAcmeProviderParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme.GetAcmeProvider has not yet been implemented") - }), - AcmeGetAcmeProvidersHandler: acme.GetAcmeProvidersHandlerFunc(func(params acme.GetAcmeProvidersParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme.GetAcmeProviders has not yet been implemented") - }), - AcmeRuntimeGetAcmeStatusHandler: acme_runtime.GetAcmeStatusHandlerFunc(func(params acme_runtime.GetAcmeStatusParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme_runtime.GetAcmeStatus has not yet been implemented") - }), - ACLGetAllACLBackendHandler: acl.GetAllACLBackendHandlerFunc(func(params acl.GetAllACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetAllACLBackend has not yet been implemented") - }), - ACLGetAllACLDefaultsHandler: acl.GetAllACLDefaultsHandlerFunc(func(params acl.GetAllACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetAllACLDefaults has not yet been implemented") - }), - ACLGetAllACLFCGIAppHandler: acl.GetAllACLFCGIAppHandlerFunc(func(params acl.GetAllACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetAllACLFCGIApp has not yet been implemented") - }), - ACLGetAllACLFrontendHandler: acl.GetAllACLFrontendHandlerFunc(func(params acl.GetAllACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.GetAllACLFrontend has not yet been implemented") - }), - BindGetAllBindFrontendHandler: bind.GetAllBindFrontendHandlerFunc(func(params bind.GetAllBindFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetAllBindFrontend has not yet been implemented") - }), - BindGetAllBindLogForwardHandler: bind.GetAllBindLogForwardHandlerFunc(func(params bind.GetAllBindLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetAllBindLogForward has not yet been implemented") - }), - BindGetAllBindPeerHandler: bind.GetAllBindPeerHandlerFunc(func(params bind.GetAllBindPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetAllBindPeer has not yet been implemented") - }), - SslRuntimeGetAllCaFilesHandler: s_s_l_runtime.GetAllCaFilesHandlerFunc(func(params s_s_l_runtime.GetAllCaFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetAllCaFiles has not yet been implemented") - }), - SslRuntimeGetAllCertsHandler: s_s_l_runtime.GetAllCertsHandlerFunc(func(params s_s_l_runtime.GetAllCertsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetAllCerts has not yet been implemented") - }), - SslRuntimeGetAllCrlHandler: s_s_l_runtime.GetAllCrlHandlerFunc(func(params s_s_l_runtime.GetAllCrlParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetAllCrl has not yet been implemented") - }), - SslRuntimeGetAllCrtListEntriesHandler: s_s_l_runtime.GetAllCrtListEntriesHandlerFunc(func(params s_s_l_runtime.GetAllCrtListEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetAllCrtListEntries has not yet been implemented") - }), - SslRuntimeGetAllCrtListsHandler: s_s_l_runtime.GetAllCrtListsHandlerFunc(func(params s_s_l_runtime.GetAllCrtListsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetAllCrtLists has not yet been implemented") - }), - FilterGetAllFilterBackendHandler: filter.GetAllFilterBackendHandlerFunc(func(params filter.GetAllFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.GetAllFilterBackend has not yet been implemented") - }), - FilterGetAllFilterFrontendHandler: filter.GetAllFilterFrontendHandlerFunc(func(params filter.GetAllFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.GetAllFilterFrontend has not yet been implemented") - }), - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler: http_after_response_rule.GetAllHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.GetAllHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetAllHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.GetAllHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.GetAllHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetAllHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.GetAllHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.GetAllHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetAllHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckGetAllHTTPCheckBackendHandler: http_check.GetAllHTTPCheckBackendHandlerFunc(func(params http_check.GetAllHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.GetAllHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckGetAllHTTPCheckDefaultsHandler: http_check.GetAllHTTPCheckDefaultsHandlerFunc(func(params http_check.GetAllHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.GetAllHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler: http_error_rule.GetAllHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.GetAllHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetAllHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler: http_error_rule.GetAllHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.GetAllHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetAllHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler: http_error_rule.GetAllHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.GetAllHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetAllHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler: http_request_rule.GetAllHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.GetAllHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetAllHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleGetAllHTTPRequestRuleDefaultsHandler: http_request_rule.GetAllHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.GetAllHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetAllHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler: http_request_rule.GetAllHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.GetAllHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetAllHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler: http_response_rule.GetAllHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.GetAllHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetAllHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleGetAllHTTPResponseRuleDefaultsHandler: http_response_rule.GetAllHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.GetAllHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetAllHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler: http_response_rule.GetAllHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.GetAllHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetAllHTTPResponseRuleFrontend has not yet been implemented") - }), - LogTargetGetAllLogTargetBackendHandler: log_target.GetAllLogTargetBackendHandlerFunc(func(params log_target.GetAllLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetBackend has not yet been implemented") - }), - LogTargetGetAllLogTargetDefaultsHandler: log_target.GetAllLogTargetDefaultsHandlerFunc(func(params log_target.GetAllLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetDefaults has not yet been implemented") - }), - LogTargetGetAllLogTargetFrontendHandler: log_target.GetAllLogTargetFrontendHandlerFunc(func(params log_target.GetAllLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetFrontend has not yet been implemented") - }), - LogTargetGetAllLogTargetGlobalHandler: log_target.GetAllLogTargetGlobalHandlerFunc(func(params log_target.GetAllLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetGlobal has not yet been implemented") - }), - LogTargetGetAllLogTargetLogForwardHandler: log_target.GetAllLogTargetLogForwardHandlerFunc(func(params log_target.GetAllLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetLogForward has not yet been implemented") - }), - LogTargetGetAllLogTargetPeerHandler: log_target.GetAllLogTargetPeerHandlerFunc(func(params log_target.GetAllLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetAllLogTargetPeer has not yet been implemented") - }), - QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler: quic_initial_rule.GetAllQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.GetAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.GetAllQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleGetAllQUICInitialRuleFrontendHandler: quic_initial_rule.GetAllQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.GetAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.GetAllQUICInitialRuleFrontend has not yet been implemented") - }), - MapsGetAllRuntimeMapFilesHandler: maps.GetAllRuntimeMapFilesHandlerFunc(func(params maps.GetAllRuntimeMapFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.GetAllRuntimeMapFiles has not yet been implemented") - }), - ServerGetAllRuntimeServerHandler: serverops.GetAllRuntimeServerHandlerFunc(func(params serverops.GetAllRuntimeServerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetAllRuntimeServer has not yet been implemented") - }), - SslFrontUseGetAllSSLFrontUsesHandler: s_s_l_front_use.GetAllSSLFrontUsesHandlerFunc(func(params s_s_l_front_use.GetAllSSLFrontUsesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_front_use.GetAllSSLFrontUses has not yet been implemented") - }), - ServerGetAllServerBackendHandler: serverops.GetAllServerBackendHandlerFunc(func(params serverops.GetAllServerBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetAllServerBackend has not yet been implemented") - }), - ServerGetAllServerPeerHandler: serverops.GetAllServerPeerHandlerFunc(func(params serverops.GetAllServerPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetAllServerPeer has not yet been implemented") - }), - ServerGetAllServerRingHandler: serverops.GetAllServerRingHandlerFunc(func(params serverops.GetAllServerRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetAllServerRing has not yet been implemented") - }), - SpoeGetAllSpoeAgentHandler: spoe.GetAllSpoeAgentHandlerFunc(func(params spoe.GetAllSpoeAgentParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetAllSpoeAgent has not yet been implemented") - }), - SpoeGetAllSpoeFilesHandler: spoe.GetAllSpoeFilesHandlerFunc(func(params spoe.GetAllSpoeFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetAllSpoeFiles has not yet been implemented") - }), - SpoeGetAllSpoeGroupHandler: spoe.GetAllSpoeGroupHandlerFunc(func(params spoe.GetAllSpoeGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetAllSpoeGroup has not yet been implemented") - }), - SpoeGetAllSpoeMessageHandler: spoe.GetAllSpoeMessageHandlerFunc(func(params spoe.GetAllSpoeMessageParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetAllSpoeMessage has not yet been implemented") - }), - SpoeGetAllSpoeScopeHandler: spoe.GetAllSpoeScopeHandlerFunc(func(params spoe.GetAllSpoeScopeParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetAllSpoeScope has not yet been implemented") - }), - SpoeTransactionsGetAllSpoeTransactionHandler: spoe_transactions.GetAllSpoeTransactionHandlerFunc(func(params spoe_transactions.GetAllSpoeTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe_transactions.GetAllSpoeTransaction has not yet been implemented") - }), - StorageGetAllStorageGeneralFilesHandler: storage.GetAllStorageGeneralFilesHandlerFunc(func(params storage.GetAllStorageGeneralFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetAllStorageGeneralFiles has not yet been implemented") - }), - StorageGetAllStorageMapFilesHandler: storage.GetAllStorageMapFilesHandlerFunc(func(params storage.GetAllStorageMapFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetAllStorageMapFiles has not yet been implemented") - }), - StorageGetAllStorageSSLCertificatesHandler: storage.GetAllStorageSSLCertificatesHandlerFunc(func(params storage.GetAllStorageSSLCertificatesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetAllStorageSSLCertificates has not yet been implemented") - }), - StorageGetAllStorageSSLCrtListFilesHandler: storage.GetAllStorageSSLCrtListFilesHandlerFunc(func(params storage.GetAllStorageSSLCrtListFilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetAllStorageSSLCrtListFiles has not yet been implemented") - }), - TCPCheckGetAllTCPCheckBackendHandler: tcp_check.GetAllTCPCheckBackendHandlerFunc(func(params tcp_check.GetAllTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.GetAllTCPCheckBackend has not yet been implemented") - }), - TCPCheckGetAllTCPCheckDefaultsHandler: tcp_check.GetAllTCPCheckDefaultsHandlerFunc(func(params tcp_check.GetAllTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.GetAllTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleGetAllTCPRequestRuleBackendHandler: tcp_request_rule.GetAllTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.GetAllTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetAllTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleGetAllTCPRequestRuleDefaultsHandler: tcp_request_rule.GetAllTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.GetAllTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetAllTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleGetAllTCPRequestRuleFrontendHandler: tcp_request_rule.GetAllTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.GetAllTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetAllTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleGetAllTCPResponseRuleBackendHandler: tcp_response_rule.GetAllTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.GetAllTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.GetAllTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleGetAllTCPResponseRuleDefaultsHandler: tcp_response_rule.GetAllTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.GetAllTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.GetAllTCPResponseRuleDefaults has not yet been implemented") - }), - BackendGetBackendHandler: backend.GetBackendHandlerFunc(func(params backend.GetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend.GetBackend has not yet been implemented") - }), - BackendSwitchingRuleGetBackendSwitchingRuleHandler: backend_switching_rule.GetBackendSwitchingRuleHandlerFunc(func(params backend_switching_rule.GetBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.GetBackendSwitchingRule has not yet been implemented") - }), - BackendSwitchingRuleGetBackendSwitchingRulesHandler: backend_switching_rule.GetBackendSwitchingRulesHandlerFunc(func(params backend_switching_rule.GetBackendSwitchingRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.GetBackendSwitchingRules has not yet been implemented") - }), - BackendGetBackendsHandler: backend.GetBackendsHandlerFunc(func(params backend.GetBackendsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend.GetBackends has not yet been implemented") - }), - BindGetBindFrontendHandler: bind.GetBindFrontendHandlerFunc(func(params bind.GetBindFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetBindFrontend has not yet been implemented") - }), - BindGetBindLogForwardHandler: bind.GetBindLogForwardHandlerFunc(func(params bind.GetBindLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetBindLogForward has not yet been implemented") - }), - BindGetBindPeerHandler: bind.GetBindPeerHandlerFunc(func(params bind.GetBindPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.GetBindPeer has not yet been implemented") - }), - SslRuntimeGetCaEntryHandler: s_s_l_runtime.GetCaEntryHandlerFunc(func(params s_s_l_runtime.GetCaEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetCaEntry has not yet been implemented") - }), - SslRuntimeGetCaFileHandler: s_s_l_runtime.GetCaFileHandlerFunc(func(params s_s_l_runtime.GetCaFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetCaFile has not yet been implemented") - }), - CacheGetCacheHandler: cache.GetCacheHandlerFunc(func(params cache.GetCacheParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cache.GetCache has not yet been implemented") - }), - CacheGetCachesHandler: cache.GetCachesHandlerFunc(func(params cache.GetCachesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cache.GetCaches has not yet been implemented") - }), - SslRuntimeGetCertHandler: s_s_l_runtime.GetCertHandlerFunc(func(params s_s_l_runtime.GetCertParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetCert has not yet been implemented") - }), - ClusterGetClusterHandler: cluster.GetClusterHandlerFunc(func(params cluster.GetClusterParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cluster.GetCluster has not yet been implemented") - }), - DiscoveryGetConfigurationEndpointsHandler: discovery.GetConfigurationEndpointsHandlerFunc(func(params discovery.GetConfigurationEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetConfigurationEndpoints has not yet been implemented") - }), - ConfigurationGetConfigurationVersionHandler: configuration.GetConfigurationVersionHandlerFunc(func(params configuration.GetConfigurationVersionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation configuration.GetConfigurationVersion has not yet been implemented") - }), - ServiceDiscoveryGetConsulHandler: service_discovery.GetConsulHandlerFunc(func(params service_discovery.GetConsulParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.GetConsul has not yet been implemented") - }), - ServiceDiscoveryGetConsulsHandler: service_discovery.GetConsulsHandlerFunc(func(params service_discovery.GetConsulsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.GetConsuls has not yet been implemented") - }), - SslRuntimeGetCrlHandler: s_s_l_runtime.GetCrlHandlerFunc(func(params s_s_l_runtime.GetCrlParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.GetCrl has not yet been implemented") - }), - CrtLoadGetCrtLoadHandler: crt_load.GetCrtLoadHandlerFunc(func(params crt_load.GetCrtLoadParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_load.GetCrtLoad has not yet been implemented") - }), - CrtLoadGetCrtLoadsHandler: crt_load.GetCrtLoadsHandlerFunc(func(params crt_load.GetCrtLoadsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_load.GetCrtLoads has not yet been implemented") - }), - CrtStoreGetCrtStoreHandler: crt_store.GetCrtStoreHandlerFunc(func(params crt_store.GetCrtStoreParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_store.GetCrtStore has not yet been implemented") - }), - CrtStoreGetCrtStoresHandler: crt_store.GetCrtStoresHandlerFunc(func(params crt_store.GetCrtStoresParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_store.GetCrtStores has not yet been implemented") - }), - DeclareCaptureGetDeclareCaptureHandler: declare_capture.GetDeclareCaptureHandlerFunc(func(params declare_capture.GetDeclareCaptureParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.GetDeclareCapture has not yet been implemented") - }), - DeclareCaptureGetDeclareCapturesHandler: declare_capture.GetDeclareCapturesHandlerFunc(func(params declare_capture.GetDeclareCapturesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.GetDeclareCaptures has not yet been implemented") - }), - DefaultsGetDefaultsSectionHandler: defaults.GetDefaultsSectionHandlerFunc(func(params defaults.GetDefaultsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.GetDefaultsSection has not yet been implemented") - }), - DefaultsGetDefaultsSectionsHandler: defaults.GetDefaultsSectionsHandlerFunc(func(params defaults.GetDefaultsSectionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.GetDefaultsSections has not yet been implemented") - }), - DgramBindGetDgramBindHandler: dgram_bind.GetDgramBindHandlerFunc(func(params dgram_bind.GetDgramBindParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation dgram_bind.GetDgramBind has not yet been implemented") - }), - DgramBindGetDgramBindsHandler: dgram_bind.GetDgramBindsHandlerFunc(func(params dgram_bind.GetDgramBindsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation dgram_bind.GetDgramBinds has not yet been implemented") - }), - FCGIAppGetFCGIAppHandler: fcgi_app.GetFCGIAppHandlerFunc(func(params fcgi_app.GetFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation fcgi_app.GetFCGIApp has not yet been implemented") - }), - FCGIAppGetFCGIAppsHandler: fcgi_app.GetFCGIAppsHandlerFunc(func(params fcgi_app.GetFCGIAppsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation fcgi_app.GetFCGIApps has not yet been implemented") - }), - FilterGetFilterBackendHandler: filter.GetFilterBackendHandlerFunc(func(params filter.GetFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.GetFilterBackend has not yet been implemented") - }), - FilterGetFilterFrontendHandler: filter.GetFilterFrontendHandlerFunc(func(params filter.GetFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.GetFilterFrontend has not yet been implemented") - }), - FrontendGetFrontendHandler: frontend.GetFrontendHandlerFunc(func(params frontend.GetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation frontend.GetFrontend has not yet been implemented") - }), - FrontendGetFrontendsHandler: frontend.GetFrontendsHandlerFunc(func(params frontend.GetFrontendsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation frontend.GetFrontends has not yet been implemented") - }), - GlobalGetGlobalHandler: global.GetGlobalHandlerFunc(func(params global.GetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation global.GetGlobal has not yet been implemented") - }), - GroupGetGroupHandler: group.GetGroupHandlerFunc(func(params group.GetGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation group.GetGroup has not yet been implemented") - }), - GroupGetGroupsHandler: group.GetGroupsHandlerFunc(func(params group.GetGroupsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation group.GetGroups has not yet been implemented") - }), - ConfigurationGetHAProxyConfigurationHandler: configuration.GetHAProxyConfigurationHandlerFunc(func(params configuration.GetHAProxyConfigurationParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation configuration.GetHAProxyConfiguration has not yet been implemented") - }), - HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler: http_after_response_rule.GetHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.GetHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleGetHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.GetHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.GetHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.GetHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.GetHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.GetHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckGetHTTPCheckBackendHandler: http_check.GetHTTPCheckBackendHandlerFunc(func(params http_check.GetHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.GetHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckGetHTTPCheckDefaultsHandler: http_check.GetHTTPCheckDefaultsHandlerFunc(func(params http_check.GetHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.GetHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleGetHTTPErrorRuleBackendHandler: http_error_rule.GetHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.GetHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler: http_error_rule.GetHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.GetHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleGetHTTPErrorRuleFrontendHandler: http_error_rule.GetHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.GetHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.GetHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPErrorsGetHTTPErrorsSectionHandler: http_errors.GetHTTPErrorsSectionHandlerFunc(func(params http_errors.GetHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_errors.GetHTTPErrorsSection has not yet been implemented") - }), - HTTPErrorsGetHTTPErrorsSectionsHandler: http_errors.GetHTTPErrorsSectionsHandlerFunc(func(params http_errors.GetHTTPErrorsSectionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_errors.GetHTTPErrorsSections has not yet been implemented") - }), - HTTPRequestRuleGetHTTPRequestRuleBackendHandler: http_request_rule.GetHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.GetHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleGetHTTPRequestRuleDefaultsHandler: http_request_rule.GetHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.GetHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleGetHTTPRequestRuleFrontendHandler: http_request_rule.GetHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.GetHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.GetHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleGetHTTPResponseRuleBackendHandler: http_response_rule.GetHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.GetHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleGetHTTPResponseRuleDefaultsHandler: http_response_rule.GetHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.GetHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleGetHTTPResponseRuleFrontendHandler: http_response_rule.GetHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.GetHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.GetHTTPResponseRuleFrontend has not yet been implemented") - }), - DiscoveryGetHaproxyEndpointsHandler: discovery.GetHaproxyEndpointsHandlerFunc(func(params discovery.GetHaproxyEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetHaproxyEndpoints has not yet been implemented") - }), - InformationGetHaproxyProcessInfoHandler: information.GetHaproxyProcessInfoHandlerFunc(func(params information.GetHaproxyProcessInfoParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation information.GetHaproxyProcessInfo has not yet been implemented") - }), - HealthGetHealthHandler: health.GetHealthHandlerFunc(func(params health.GetHealthParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation health.GetHealth has not yet been implemented") - }), - InformationGetInfoHandler: information.GetInfoHandlerFunc(func(params information.GetInfoParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation information.GetInfo has not yet been implemented") - }), - LogForwardGetLogForwardHandler: log_forward.GetLogForwardHandlerFunc(func(params log_forward.GetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_forward.GetLogForward has not yet been implemented") - }), - LogForwardGetLogForwardsHandler: log_forward.GetLogForwardsHandlerFunc(func(params log_forward.GetLogForwardsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_forward.GetLogForwards has not yet been implemented") - }), - LogProfileGetLogProfileHandler: log_profile.GetLogProfileHandlerFunc(func(params log_profile.GetLogProfileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_profile.GetLogProfile has not yet been implemented") - }), - LogProfileGetLogProfilesHandler: log_profile.GetLogProfilesHandlerFunc(func(params log_profile.GetLogProfilesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_profile.GetLogProfiles has not yet been implemented") - }), - LogTargetGetLogTargetBackendHandler: log_target.GetLogTargetBackendHandlerFunc(func(params log_target.GetLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetBackend has not yet been implemented") - }), - LogTargetGetLogTargetDefaultsHandler: log_target.GetLogTargetDefaultsHandlerFunc(func(params log_target.GetLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetDefaults has not yet been implemented") - }), - LogTargetGetLogTargetFrontendHandler: log_target.GetLogTargetFrontendHandlerFunc(func(params log_target.GetLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetFrontend has not yet been implemented") - }), - LogTargetGetLogTargetGlobalHandler: log_target.GetLogTargetGlobalHandlerFunc(func(params log_target.GetLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetGlobal has not yet been implemented") - }), - LogTargetGetLogTargetLogForwardHandler: log_target.GetLogTargetLogForwardHandlerFunc(func(params log_target.GetLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetLogForward has not yet been implemented") - }), - LogTargetGetLogTargetPeerHandler: log_target.GetLogTargetPeerHandlerFunc(func(params log_target.GetLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.GetLogTargetPeer has not yet been implemented") - }), - MailerEntryGetMailerEntriesHandler: mailer_entry.GetMailerEntriesHandlerFunc(func(params mailer_entry.GetMailerEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailer_entry.GetMailerEntries has not yet been implemented") - }), - MailerEntryGetMailerEntryHandler: mailer_entry.GetMailerEntryHandlerFunc(func(params mailer_entry.GetMailerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailer_entry.GetMailerEntry has not yet been implemented") - }), - MailersGetMailersSectionHandler: mailers.GetMailersSectionHandlerFunc(func(params mailers.GetMailersSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailers.GetMailersSection has not yet been implemented") - }), - MailersGetMailersSectionsHandler: mailers.GetMailersSectionsHandlerFunc(func(params mailers.GetMailersSectionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailers.GetMailersSections has not yet been implemented") - }), - NameserverGetNameserverHandler: nameserver.GetNameserverHandlerFunc(func(params nameserver.GetNameserverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation nameserver.GetNameserver has not yet been implemented") - }), - NameserverGetNameserversHandler: nameserver.GetNameserversHandlerFunc(func(params nameserver.GetNameserversParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation nameserver.GetNameservers has not yet been implemented") - }), - MapsGetOneRuntimeMapHandler: maps.GetOneRuntimeMapHandlerFunc(func(params maps.GetOneRuntimeMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.GetOneRuntimeMap has not yet been implemented") - }), - SpoeGetOneSpoeFileHandler: spoe.GetOneSpoeFileHandlerFunc(func(params spoe.GetOneSpoeFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetOneSpoeFile has not yet been implemented") - }), - StorageGetOneStorageGeneralFileHandler: storage.GetOneStorageGeneralFileHandlerFunc(func(params storage.GetOneStorageGeneralFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetOneStorageGeneralFile has not yet been implemented") - }), - StorageGetOneStorageMapHandler: storage.GetOneStorageMapHandlerFunc(func(params storage.GetOneStorageMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetOneStorageMap has not yet been implemented") - }), - StorageGetOneStorageSSLCertificateHandler: storage.GetOneStorageSSLCertificateHandlerFunc(func(params storage.GetOneStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetOneStorageSSLCertificate has not yet been implemented") - }), - StorageGetOneStorageSSLCrtListFileHandler: storage.GetOneStorageSSLCrtListFileHandlerFunc(func(params storage.GetOneStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.GetOneStorageSSLCrtListFile has not yet been implemented") - }), - SpecificationOpenapiv3GetOpenapiv3SpecificationHandler: specification_openapiv3.GetOpenapiv3SpecificationHandlerFunc(func(params specification_openapiv3.GetOpenapiv3SpecificationParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation specification_openapiv3.GetOpenapiv3Specification has not yet been implemented") - }), - PeerEntryGetPeerEntriesHandler: peer_entry.GetPeerEntriesHandlerFunc(func(params peer_entry.GetPeerEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer_entry.GetPeerEntries has not yet been implemented") - }), - PeerEntryGetPeerEntryHandler: peer_entry.GetPeerEntryHandlerFunc(func(params peer_entry.GetPeerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer_entry.GetPeerEntry has not yet been implemented") - }), - PeerGetPeerSectionHandler: peer.GetPeerSectionHandlerFunc(func(params peer.GetPeerSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer.GetPeerSection has not yet been implemented") - }), - PeerGetPeerSectionsHandler: peer.GetPeerSectionsHandlerFunc(func(params peer.GetPeerSectionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer.GetPeerSections has not yet been implemented") - }), - ProcessManagerGetProgramHandler: process_manager.GetProgramHandlerFunc(func(params process_manager.GetProgramParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation process_manager.GetProgram has not yet been implemented") - }), - ProcessManagerGetProgramsHandler: process_manager.GetProgramsHandlerFunc(func(params process_manager.GetProgramsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation process_manager.GetPrograms has not yet been implemented") - }), - QUICInitialRuleGetQUICInitialRuleDefaultsHandler: quic_initial_rule.GetQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.GetQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.GetQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleGetQUICInitialRuleFrontendHandler: quic_initial_rule.GetQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.GetQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.GetQUICInitialRuleFrontend has not yet been implemented") - }), - ReloadsGetReloadHandler: reloads.GetReloadHandlerFunc(func(params reloads.GetReloadParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation reloads.GetReload has not yet been implemented") - }), - ReloadsGetReloadsHandler: reloads.GetReloadsHandlerFunc(func(params reloads.GetReloadsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation reloads.GetReloads has not yet been implemented") - }), - ResolverGetResolverHandler: resolver.GetResolverHandlerFunc(func(params resolver.GetResolverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation resolver.GetResolver has not yet been implemented") - }), - ResolverGetResolversHandler: resolver.GetResolversHandlerFunc(func(params resolver.GetResolversParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation resolver.GetResolvers has not yet been implemented") - }), - RingGetRingHandler: ring.GetRingHandlerFunc(func(params ring.GetRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation ring.GetRing has not yet been implemented") - }), - RingGetRingsHandler: ring.GetRingsHandlerFunc(func(params ring.GetRingsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation ring.GetRings has not yet been implemented") - }), - DiscoveryGetRuntimeEndpointsHandler: discovery.GetRuntimeEndpointsHandlerFunc(func(params discovery.GetRuntimeEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetRuntimeEndpoints has not yet been implemented") - }), - MapsGetRuntimeMapEntryHandler: maps.GetRuntimeMapEntryHandlerFunc(func(params maps.GetRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.GetRuntimeMapEntry has not yet been implemented") - }), - ServerGetRuntimeServerHandler: serverops.GetRuntimeServerHandlerFunc(func(params serverops.GetRuntimeServerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetRuntimeServer has not yet been implemented") - }), - SslFrontUseGetSSLFrontUseHandler: s_s_l_front_use.GetSSLFrontUseHandlerFunc(func(params s_s_l_front_use.GetSSLFrontUseParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_front_use.GetSSLFrontUse has not yet been implemented") - }), - ServerGetServerBackendHandler: serverops.GetServerBackendHandlerFunc(func(params serverops.GetServerBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetServerBackend has not yet been implemented") - }), - ServerGetServerPeerHandler: serverops.GetServerPeerHandlerFunc(func(params serverops.GetServerPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetServerPeer has not yet been implemented") - }), - ServerGetServerRingHandler: serverops.GetServerRingHandlerFunc(func(params serverops.GetServerRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.GetServerRing has not yet been implemented") - }), - ServerSwitchingRuleGetServerSwitchingRuleHandler: server_switching_rule.GetServerSwitchingRuleHandlerFunc(func(params server_switching_rule.GetServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.GetServerSwitchingRule has not yet been implemented") - }), - ServerSwitchingRuleGetServerSwitchingRulesHandler: server_switching_rule.GetServerSwitchingRulesHandlerFunc(func(params server_switching_rule.GetServerSwitchingRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.GetServerSwitchingRules has not yet been implemented") - }), - ServerTemplateGetServerTemplateHandler: server_template.GetServerTemplateHandlerFunc(func(params server_template.GetServerTemplateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_template.GetServerTemplate has not yet been implemented") - }), - ServerTemplateGetServerTemplatesHandler: server_template.GetServerTemplatesHandlerFunc(func(params server_template.GetServerTemplatesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_template.GetServerTemplates has not yet been implemented") - }), - DiscoveryGetServicesEndpointsHandler: discovery.GetServicesEndpointsHandlerFunc(func(params discovery.GetServicesEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetServicesEndpoints has not yet been implemented") - }), - SitesGetSiteHandler: sites.GetSiteHandlerFunc(func(params sites.GetSiteParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation sites.GetSite has not yet been implemented") - }), - SitesGetSitesHandler: sites.GetSitesHandlerFunc(func(params sites.GetSitesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation sites.GetSites has not yet been implemented") - }), - SpecificationGetSpecificationHandler: specification.GetSpecificationHandlerFunc(func(params specification.GetSpecificationParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation specification.GetSpecification has not yet been implemented") - }), - SpoeGetSpoeAgentHandler: spoe.GetSpoeAgentHandlerFunc(func(params spoe.GetSpoeAgentParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetSpoeAgent has not yet been implemented") - }), - SpoeGetSpoeConfigurationVersionHandler: spoe.GetSpoeConfigurationVersionHandlerFunc(func(params spoe.GetSpoeConfigurationVersionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetSpoeConfigurationVersion has not yet been implemented") - }), - DiscoveryGetSpoeEndpointsHandler: discovery.GetSpoeEndpointsHandlerFunc(func(params discovery.GetSpoeEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetSpoeEndpoints has not yet been implemented") - }), - SpoeGetSpoeGroupHandler: spoe.GetSpoeGroupHandlerFunc(func(params spoe.GetSpoeGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetSpoeGroup has not yet been implemented") - }), - SpoeGetSpoeMessageHandler: spoe.GetSpoeMessageHandlerFunc(func(params spoe.GetSpoeMessageParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetSpoeMessage has not yet been implemented") - }), - SpoeGetSpoeScopeHandler: spoe.GetSpoeScopeHandlerFunc(func(params spoe.GetSpoeScopeParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.GetSpoeScope has not yet been implemented") - }), - SpoeTransactionsGetSpoeTransactionHandler: spoe_transactions.GetSpoeTransactionHandlerFunc(func(params spoe_transactions.GetSpoeTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe_transactions.GetSpoeTransaction has not yet been implemented") - }), - StatsGetStatsHandler: stats.GetStatsHandlerFunc(func(params stats.GetStatsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stats.GetStats has not yet been implemented") - }), - DiscoveryGetStatsEndpointsHandler: discovery.GetStatsEndpointsHandlerFunc(func(params discovery.GetStatsEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetStatsEndpoints has not yet been implemented") - }), - StickRuleGetStickRuleHandler: stick_rule.GetStickRuleHandlerFunc(func(params stick_rule.GetStickRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.GetStickRule has not yet been implemented") - }), - StickRuleGetStickRulesHandler: stick_rule.GetStickRulesHandlerFunc(func(params stick_rule.GetStickRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.GetStickRules has not yet been implemented") - }), - StickTableGetStickTableHandler: stick_table.GetStickTableHandlerFunc(func(params stick_table.GetStickTableParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_table.GetStickTable has not yet been implemented") - }), - StickTableGetStickTableEntriesHandler: stick_table.GetStickTableEntriesHandlerFunc(func(params stick_table.GetStickTableEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_table.GetStickTableEntries has not yet been implemented") - }), - StickTableGetStickTablesHandler: stick_table.GetStickTablesHandlerFunc(func(params stick_table.GetStickTablesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_table.GetStickTables has not yet been implemented") - }), - DiscoveryGetStorageEndpointsHandler: discovery.GetStorageEndpointsHandlerFunc(func(params discovery.GetStorageEndpointsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation discovery.GetStorageEndpoints has not yet been implemented") - }), - TCPCheckGetTCPCheckBackendHandler: tcp_check.GetTCPCheckBackendHandlerFunc(func(params tcp_check.GetTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.GetTCPCheckBackend has not yet been implemented") - }), - TCPCheckGetTCPCheckDefaultsHandler: tcp_check.GetTCPCheckDefaultsHandlerFunc(func(params tcp_check.GetTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.GetTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleGetTCPRequestRuleBackendHandler: tcp_request_rule.GetTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.GetTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleGetTCPRequestRuleDefaultsHandler: tcp_request_rule.GetTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.GetTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleGetTCPRequestRuleFrontendHandler: tcp_request_rule.GetTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.GetTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.GetTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleGetTCPResponseRuleBackendHandler: tcp_response_rule.GetTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.GetTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.GetTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleGetTCPResponseRuleDefaultsHandler: tcp_response_rule.GetTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.GetTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.GetTCPResponseRuleDefaults has not yet been implemented") - }), - TableGetTableHandler: table.GetTableHandlerFunc(func(params table.GetTableParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation table.GetTable has not yet been implemented") - }), - TableGetTablesHandler: table.GetTablesHandlerFunc(func(params table.GetTablesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation table.GetTables has not yet been implemented") - }), - TracesGetTracesHandler: traces.GetTracesHandlerFunc(func(params traces.GetTracesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.GetTraces has not yet been implemented") - }), - TransactionsGetTransactionHandler: transactions.GetTransactionHandlerFunc(func(params transactions.GetTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation transactions.GetTransaction has not yet been implemented") - }), - TransactionsGetTransactionsHandler: transactions.GetTransactionsHandlerFunc(func(params transactions.GetTransactionsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation transactions.GetTransactions has not yet been implemented") - }), - UserGetUserHandler: user.GetUserHandlerFunc(func(params user.GetUserParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation user.GetUser has not yet been implemented") - }), - UserlistGetUserlistHandler: userlist.GetUserlistHandlerFunc(func(params userlist.GetUserlistParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation userlist.GetUserlist has not yet been implemented") - }), - UserlistGetUserlistsHandler: userlist.GetUserlistsHandlerFunc(func(params userlist.GetUserlistsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation userlist.GetUserlists has not yet been implemented") - }), - UserGetUsersHandler: user.GetUsersHandlerFunc(func(params user.GetUsersParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation user.GetUsers has not yet been implemented") - }), - ClusterInitiateCertificateRefreshHandler: cluster.InitiateCertificateRefreshHandlerFunc(func(params cluster.InitiateCertificateRefreshParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cluster.InitiateCertificateRefresh has not yet been implemented") - }), - ClusterPostClusterHandler: cluster.PostClusterHandlerFunc(func(params cluster.PostClusterParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cluster.PostCluster has not yet been implemented") - }), - ConfigurationPostHAProxyConfigurationHandler: configuration.PostHAProxyConfigurationHandlerFunc(func(params configuration.PostHAProxyConfigurationParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation configuration.PostHAProxyConfiguration has not yet been implemented") - }), - AcmeRuntimeRenewAcmeCertificateHandler: acme_runtime.RenewAcmeCertificateHandlerFunc(func(params acme_runtime.RenewAcmeCertificateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acme_runtime.RenewAcmeCertificate has not yet been implemented") - }), - ServiceDiscoveryReplaceAWSRegionHandler: service_discovery.ReplaceAWSRegionHandlerFunc(func(params service_discovery.ReplaceAWSRegionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.ReplaceAWSRegion has not yet been implemented") - }), - ACLReplaceACLBackendHandler: acl.ReplaceACLBackendHandlerFunc(func(params acl.ReplaceACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceACLBackend has not yet been implemented") - }), - ACLReplaceACLDefaultsHandler: acl.ReplaceACLDefaultsHandlerFunc(func(params acl.ReplaceACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceACLDefaults has not yet been implemented") - }), - ACLReplaceACLFCGIAppHandler: acl.ReplaceACLFCGIAppHandlerFunc(func(params acl.ReplaceACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceACLFCGIApp has not yet been implemented") - }), - ACLReplaceACLFrontendHandler: acl.ReplaceACLFrontendHandlerFunc(func(params acl.ReplaceACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceACLFrontend has not yet been implemented") - }), - ACLReplaceAllACLBackendHandler: acl.ReplaceAllACLBackendHandlerFunc(func(params acl.ReplaceAllACLBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceAllACLBackend has not yet been implemented") - }), - ACLReplaceAllACLDefaultsHandler: acl.ReplaceAllACLDefaultsHandlerFunc(func(params acl.ReplaceAllACLDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceAllACLDefaults has not yet been implemented") - }), - ACLReplaceAllACLFCGIAppHandler: acl.ReplaceAllACLFCGIAppHandlerFunc(func(params acl.ReplaceAllACLFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceAllACLFCGIApp has not yet been implemented") - }), - ACLReplaceAllACLFrontendHandler: acl.ReplaceAllACLFrontendHandlerFunc(func(params acl.ReplaceAllACLFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation acl.ReplaceAllACLFrontend has not yet been implemented") - }), - FilterReplaceAllFilterBackendHandler: filter.ReplaceAllFilterBackendHandlerFunc(func(params filter.ReplaceAllFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.ReplaceAllFilterBackend has not yet been implemented") - }), - FilterReplaceAllFilterFrontendHandler: filter.ReplaceAllFilterFrontendHandlerFunc(func(params filter.ReplaceAllFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.ReplaceAllFilterFrontend has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler: http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckReplaceAllHTTPCheckBackendHandler: http_check.ReplaceAllHTTPCheckBackendHandlerFunc(func(params http_check.ReplaceAllHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.ReplaceAllHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckReplaceAllHTTPCheckDefaultsHandler: http_check.ReplaceAllHTTPCheckDefaultsHandlerFunc(func(params http_check.ReplaceAllHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.ReplaceAllHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler: http_error_rule.ReplaceAllHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.ReplaceAllHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceAllHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler: http_error_rule.ReplaceAllHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.ReplaceAllHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceAllHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler: http_error_rule.ReplaceAllHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.ReplaceAllHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceAllHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler: http_request_rule.ReplaceAllHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.ReplaceAllHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceAllHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleReplaceAllHTTPRequestRuleDefaultsHandler: http_request_rule.ReplaceAllHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.ReplaceAllHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceAllHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler: http_request_rule.ReplaceAllHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.ReplaceAllHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceAllHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler: http_response_rule.ReplaceAllHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.ReplaceAllHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceAllHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleReplaceAllHTTPResponseRuleDefaultsHandler: http_response_rule.ReplaceAllHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.ReplaceAllHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceAllHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler: http_response_rule.ReplaceAllHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.ReplaceAllHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceAllHTTPResponseRuleFrontend has not yet been implemented") - }), - LogTargetReplaceAllLogTargetBackendHandler: log_target.ReplaceAllLogTargetBackendHandlerFunc(func(params log_target.ReplaceAllLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetBackend has not yet been implemented") - }), - LogTargetReplaceAllLogTargetDefaultsHandler: log_target.ReplaceAllLogTargetDefaultsHandlerFunc(func(params log_target.ReplaceAllLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetDefaults has not yet been implemented") - }), - LogTargetReplaceAllLogTargetFrontendHandler: log_target.ReplaceAllLogTargetFrontendHandlerFunc(func(params log_target.ReplaceAllLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetFrontend has not yet been implemented") - }), - LogTargetReplaceAllLogTargetGlobalHandler: log_target.ReplaceAllLogTargetGlobalHandlerFunc(func(params log_target.ReplaceAllLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetGlobal has not yet been implemented") - }), - LogTargetReplaceAllLogTargetLogForwardHandler: log_target.ReplaceAllLogTargetLogForwardHandlerFunc(func(params log_target.ReplaceAllLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetLogForward has not yet been implemented") - }), - LogTargetReplaceAllLogTargetPeerHandler: log_target.ReplaceAllLogTargetPeerHandlerFunc(func(params log_target.ReplaceAllLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceAllLogTargetPeer has not yet been implemented") - }), - QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler: quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.ReplaceAllQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler: quic_initial_rule.ReplaceAllQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.ReplaceAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.ReplaceAllQUICInitialRuleFrontend has not yet been implemented") - }), - TCPCheckReplaceAllTCPCheckBackendHandler: tcp_check.ReplaceAllTCPCheckBackendHandlerFunc(func(params tcp_check.ReplaceAllTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.ReplaceAllTCPCheckBackend has not yet been implemented") - }), - TCPCheckReplaceAllTCPCheckDefaultsHandler: tcp_check.ReplaceAllTCPCheckDefaultsHandlerFunc(func(params tcp_check.ReplaceAllTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.ReplaceAllTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler: tcp_request_rule.ReplaceAllTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.ReplaceAllTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceAllTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleReplaceAllTCPRequestRuleDefaultsHandler: tcp_request_rule.ReplaceAllTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.ReplaceAllTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceAllTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler: tcp_request_rule.ReplaceAllTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.ReplaceAllTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceAllTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler: tcp_response_rule.ReplaceAllTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.ReplaceAllTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.ReplaceAllTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleReplaceAllTCPResponseRuleDefaultsHandler: tcp_response_rule.ReplaceAllTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.ReplaceAllTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.ReplaceAllTCPResponseRuleDefaults has not yet been implemented") - }), - BackendReplaceBackendHandler: backend.ReplaceBackendHandlerFunc(func(params backend.ReplaceBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend.ReplaceBackend has not yet been implemented") - }), - BackendSwitchingRuleReplaceBackendSwitchingRuleHandler: backend_switching_rule.ReplaceBackendSwitchingRuleHandlerFunc(func(params backend_switching_rule.ReplaceBackendSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.ReplaceBackendSwitchingRule has not yet been implemented") - }), - BackendSwitchingRuleReplaceBackendSwitchingRulesHandler: backend_switching_rule.ReplaceBackendSwitchingRulesHandlerFunc(func(params backend_switching_rule.ReplaceBackendSwitchingRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation backend_switching_rule.ReplaceBackendSwitchingRules has not yet been implemented") - }), - BindReplaceBindFrontendHandler: bind.ReplaceBindFrontendHandlerFunc(func(params bind.ReplaceBindFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.ReplaceBindFrontend has not yet been implemented") - }), - BindReplaceBindLogForwardHandler: bind.ReplaceBindLogForwardHandlerFunc(func(params bind.ReplaceBindLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.ReplaceBindLogForward has not yet been implemented") - }), - BindReplaceBindPeerHandler: bind.ReplaceBindPeerHandlerFunc(func(params bind.ReplaceBindPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation bind.ReplaceBindPeer has not yet been implemented") - }), - CacheReplaceCacheHandler: cache.ReplaceCacheHandlerFunc(func(params cache.ReplaceCacheParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation cache.ReplaceCache has not yet been implemented") - }), - SslRuntimeReplaceCertHandler: s_s_l_runtime.ReplaceCertHandlerFunc(func(params s_s_l_runtime.ReplaceCertParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.ReplaceCert has not yet been implemented") - }), - ServiceDiscoveryReplaceConsulHandler: service_discovery.ReplaceConsulHandlerFunc(func(params service_discovery.ReplaceConsulParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation service_discovery.ReplaceConsul has not yet been implemented") - }), - SslRuntimeReplaceCrlHandler: s_s_l_runtime.ReplaceCrlHandlerFunc(func(params s_s_l_runtime.ReplaceCrlParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.ReplaceCrl has not yet been implemented") - }), - CrtLoadReplaceCrtLoadHandler: crt_load.ReplaceCrtLoadHandlerFunc(func(params crt_load.ReplaceCrtLoadParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation crt_load.ReplaceCrtLoad has not yet been implemented") - }), - DeclareCaptureReplaceDeclareCaptureHandler: declare_capture.ReplaceDeclareCaptureHandlerFunc(func(params declare_capture.ReplaceDeclareCaptureParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.ReplaceDeclareCapture has not yet been implemented") - }), - DeclareCaptureReplaceDeclareCapturesHandler: declare_capture.ReplaceDeclareCapturesHandlerFunc(func(params declare_capture.ReplaceDeclareCapturesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation declare_capture.ReplaceDeclareCaptures has not yet been implemented") - }), - DefaultsReplaceDefaultsSectionHandler: defaults.ReplaceDefaultsSectionHandlerFunc(func(params defaults.ReplaceDefaultsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation defaults.ReplaceDefaultsSection has not yet been implemented") - }), - DgramBindReplaceDgramBindHandler: dgram_bind.ReplaceDgramBindHandlerFunc(func(params dgram_bind.ReplaceDgramBindParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation dgram_bind.ReplaceDgramBind has not yet been implemented") - }), - FCGIAppReplaceFCGIAppHandler: fcgi_app.ReplaceFCGIAppHandlerFunc(func(params fcgi_app.ReplaceFCGIAppParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation fcgi_app.ReplaceFCGIApp has not yet been implemented") - }), - FilterReplaceFilterBackendHandler: filter.ReplaceFilterBackendHandlerFunc(func(params filter.ReplaceFilterBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.ReplaceFilterBackend has not yet been implemented") - }), - FilterReplaceFilterFrontendHandler: filter.ReplaceFilterFrontendHandlerFunc(func(params filter.ReplaceFilterFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation filter.ReplaceFilterFrontend has not yet been implemented") - }), - FrontendReplaceFrontendHandler: frontend.ReplaceFrontendHandlerFunc(func(params frontend.ReplaceFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation frontend.ReplaceFrontend has not yet been implemented") - }), - GlobalReplaceGlobalHandler: global.ReplaceGlobalHandlerFunc(func(params global.ReplaceGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation global.ReplaceGlobal has not yet been implemented") - }), - GroupReplaceGroupHandler: group.ReplaceGroupHandlerFunc(func(params group.ReplaceGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation group.ReplaceGroup has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler: http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendHandlerFunc(func(params http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceHTTPAfterResponseRuleBackend has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleDefaultsHandler: http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaultsHandlerFunc(func(params http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaults has not yet been implemented") - }), - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler: http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontendHandlerFunc(func(params http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontend has not yet been implemented") - }), - HTTPCheckReplaceHTTPCheckBackendHandler: http_check.ReplaceHTTPCheckBackendHandlerFunc(func(params http_check.ReplaceHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.ReplaceHTTPCheckBackend has not yet been implemented") - }), - HTTPCheckReplaceHTTPCheckDefaultsHandler: http_check.ReplaceHTTPCheckDefaultsHandlerFunc(func(params http_check.ReplaceHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_check.ReplaceHTTPCheckDefaults has not yet been implemented") - }), - HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler: http_error_rule.ReplaceHTTPErrorRuleBackendHandlerFunc(func(params http_error_rule.ReplaceHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceHTTPErrorRuleBackend has not yet been implemented") - }), - HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler: http_error_rule.ReplaceHTTPErrorRuleDefaultsHandlerFunc(func(params http_error_rule.ReplaceHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceHTTPErrorRuleDefaults has not yet been implemented") - }), - HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler: http_error_rule.ReplaceHTTPErrorRuleFrontendHandlerFunc(func(params http_error_rule.ReplaceHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_error_rule.ReplaceHTTPErrorRuleFrontend has not yet been implemented") - }), - HTTPErrorsReplaceHTTPErrorsSectionHandler: http_errors.ReplaceHTTPErrorsSectionHandlerFunc(func(params http_errors.ReplaceHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_errors.ReplaceHTTPErrorsSection has not yet been implemented") - }), - HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler: http_request_rule.ReplaceHTTPRequestRuleBackendHandlerFunc(func(params http_request_rule.ReplaceHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceHTTPRequestRuleBackend has not yet been implemented") - }), - HTTPRequestRuleReplaceHTTPRequestRuleDefaultsHandler: http_request_rule.ReplaceHTTPRequestRuleDefaultsHandlerFunc(func(params http_request_rule.ReplaceHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceHTTPRequestRuleDefaults has not yet been implemented") - }), - HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler: http_request_rule.ReplaceHTTPRequestRuleFrontendHandlerFunc(func(params http_request_rule.ReplaceHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_request_rule.ReplaceHTTPRequestRuleFrontend has not yet been implemented") - }), - HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler: http_response_rule.ReplaceHTTPResponseRuleBackendHandlerFunc(func(params http_response_rule.ReplaceHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceHTTPResponseRuleBackend has not yet been implemented") - }), - HTTPResponseRuleReplaceHTTPResponseRuleDefaultsHandler: http_response_rule.ReplaceHTTPResponseRuleDefaultsHandlerFunc(func(params http_response_rule.ReplaceHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceHTTPResponseRuleDefaults has not yet been implemented") - }), - HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler: http_response_rule.ReplaceHTTPResponseRuleFrontendHandlerFunc(func(params http_response_rule.ReplaceHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation http_response_rule.ReplaceHTTPResponseRuleFrontend has not yet been implemented") - }), - LogForwardReplaceLogForwardHandler: log_forward.ReplaceLogForwardHandlerFunc(func(params log_forward.ReplaceLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_forward.ReplaceLogForward has not yet been implemented") - }), - LogTargetReplaceLogTargetBackendHandler: log_target.ReplaceLogTargetBackendHandlerFunc(func(params log_target.ReplaceLogTargetBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetBackend has not yet been implemented") - }), - LogTargetReplaceLogTargetDefaultsHandler: log_target.ReplaceLogTargetDefaultsHandlerFunc(func(params log_target.ReplaceLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetDefaults has not yet been implemented") - }), - LogTargetReplaceLogTargetFrontendHandler: log_target.ReplaceLogTargetFrontendHandlerFunc(func(params log_target.ReplaceLogTargetFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetFrontend has not yet been implemented") - }), - LogTargetReplaceLogTargetGlobalHandler: log_target.ReplaceLogTargetGlobalHandlerFunc(func(params log_target.ReplaceLogTargetGlobalParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetGlobal has not yet been implemented") - }), - LogTargetReplaceLogTargetLogForwardHandler: log_target.ReplaceLogTargetLogForwardHandlerFunc(func(params log_target.ReplaceLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetLogForward has not yet been implemented") - }), - LogTargetReplaceLogTargetPeerHandler: log_target.ReplaceLogTargetPeerHandlerFunc(func(params log_target.ReplaceLogTargetPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation log_target.ReplaceLogTargetPeer has not yet been implemented") - }), - MailerEntryReplaceMailerEntryHandler: mailer_entry.ReplaceMailerEntryHandlerFunc(func(params mailer_entry.ReplaceMailerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation mailer_entry.ReplaceMailerEntry has not yet been implemented") - }), - NameserverReplaceNameserverHandler: nameserver.ReplaceNameserverHandlerFunc(func(params nameserver.ReplaceNameserverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation nameserver.ReplaceNameserver has not yet been implemented") - }), - PeerEntryReplacePeerEntryHandler: peer_entry.ReplacePeerEntryHandlerFunc(func(params peer_entry.ReplacePeerEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation peer_entry.ReplacePeerEntry has not yet been implemented") - }), - ProcessManagerReplaceProgramHandler: process_manager.ReplaceProgramHandlerFunc(func(params process_manager.ReplaceProgramParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation process_manager.ReplaceProgram has not yet been implemented") - }), - QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler: quic_initial_rule.ReplaceQUICInitialRuleDefaultsHandlerFunc(func(params quic_initial_rule.ReplaceQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.ReplaceQUICInitialRuleDefaults has not yet been implemented") - }), - QUICInitialRuleReplaceQUICInitialRuleFrontendHandler: quic_initial_rule.ReplaceQUICInitialRuleFrontendHandlerFunc(func(params quic_initial_rule.ReplaceQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation quic_initial_rule.ReplaceQUICInitialRuleFrontend has not yet been implemented") - }), - ResolverReplaceResolverHandler: resolver.ReplaceResolverHandlerFunc(func(params resolver.ReplaceResolverParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation resolver.ReplaceResolver has not yet been implemented") - }), - RingReplaceRingHandler: ring.ReplaceRingHandlerFunc(func(params ring.ReplaceRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation ring.ReplaceRing has not yet been implemented") - }), - MapsReplaceRuntimeMapEntryHandler: maps.ReplaceRuntimeMapEntryHandlerFunc(func(params maps.ReplaceRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.ReplaceRuntimeMapEntry has not yet been implemented") - }), - ServerReplaceRuntimeServerHandler: serverops.ReplaceRuntimeServerHandlerFunc(func(params serverops.ReplaceRuntimeServerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.ReplaceRuntimeServer has not yet been implemented") - }), - SslFrontUseReplaceSSLFrontUseHandler: s_s_l_front_use.ReplaceSSLFrontUseHandlerFunc(func(params s_s_l_front_use.ReplaceSSLFrontUseParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_front_use.ReplaceSSLFrontUse has not yet been implemented") - }), - ServerReplaceServerBackendHandler: serverops.ReplaceServerBackendHandlerFunc(func(params serverops.ReplaceServerBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.ReplaceServerBackend has not yet been implemented") - }), - ServerReplaceServerPeerHandler: serverops.ReplaceServerPeerHandlerFunc(func(params serverops.ReplaceServerPeerParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.ReplaceServerPeer has not yet been implemented") - }), - ServerReplaceServerRingHandler: serverops.ReplaceServerRingHandlerFunc(func(params serverops.ReplaceServerRingParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server.ReplaceServerRing has not yet been implemented") - }), - ServerSwitchingRuleReplaceServerSwitchingRuleHandler: server_switching_rule.ReplaceServerSwitchingRuleHandlerFunc(func(params server_switching_rule.ReplaceServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.ReplaceServerSwitchingRule has not yet been implemented") - }), - ServerSwitchingRuleReplaceServerSwitchingRulesHandler: server_switching_rule.ReplaceServerSwitchingRulesHandlerFunc(func(params server_switching_rule.ReplaceServerSwitchingRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_switching_rule.ReplaceServerSwitchingRules has not yet been implemented") - }), - ServerTemplateReplaceServerTemplateHandler: server_template.ReplaceServerTemplateHandlerFunc(func(params server_template.ReplaceServerTemplateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation server_template.ReplaceServerTemplate has not yet been implemented") - }), - SitesReplaceSiteHandler: sites.ReplaceSiteHandlerFunc(func(params sites.ReplaceSiteParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation sites.ReplaceSite has not yet been implemented") - }), - SpoeReplaceSpoeAgentHandler: spoe.ReplaceSpoeAgentHandlerFunc(func(params spoe.ReplaceSpoeAgentParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.ReplaceSpoeAgent has not yet been implemented") - }), - SpoeReplaceSpoeGroupHandler: spoe.ReplaceSpoeGroupHandlerFunc(func(params spoe.ReplaceSpoeGroupParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.ReplaceSpoeGroup has not yet been implemented") - }), - SpoeReplaceSpoeMessageHandler: spoe.ReplaceSpoeMessageHandlerFunc(func(params spoe.ReplaceSpoeMessageParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe.ReplaceSpoeMessage has not yet been implemented") - }), - StickRuleReplaceStickRuleHandler: stick_rule.ReplaceStickRuleHandlerFunc(func(params stick_rule.ReplaceStickRuleParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.ReplaceStickRule has not yet been implemented") - }), - StickRuleReplaceStickRulesHandler: stick_rule.ReplaceStickRulesHandlerFunc(func(params stick_rule.ReplaceStickRulesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_rule.ReplaceStickRules has not yet been implemented") - }), - StorageReplaceStorageGeneralFileHandler: storage.ReplaceStorageGeneralFileHandlerFunc(func(params storage.ReplaceStorageGeneralFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.ReplaceStorageGeneralFile has not yet been implemented") - }), - StorageReplaceStorageMapFileHandler: storage.ReplaceStorageMapFileHandlerFunc(func(params storage.ReplaceStorageMapFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.ReplaceStorageMapFile has not yet been implemented") - }), - StorageReplaceStorageSSLCertificateHandler: storage.ReplaceStorageSSLCertificateHandlerFunc(func(params storage.ReplaceStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.ReplaceStorageSSLCertificate has not yet been implemented") - }), - StorageReplaceStorageSSLCrtListFileHandler: storage.ReplaceStorageSSLCrtListFileHandlerFunc(func(params storage.ReplaceStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation storage.ReplaceStorageSSLCrtListFile has not yet been implemented") - }), - TCPCheckReplaceTCPCheckBackendHandler: tcp_check.ReplaceTCPCheckBackendHandlerFunc(func(params tcp_check.ReplaceTCPCheckBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.ReplaceTCPCheckBackend has not yet been implemented") - }), - TCPCheckReplaceTCPCheckDefaultsHandler: tcp_check.ReplaceTCPCheckDefaultsHandlerFunc(func(params tcp_check.ReplaceTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_check.ReplaceTCPCheckDefaults has not yet been implemented") - }), - TCPRequestRuleReplaceTCPRequestRuleBackendHandler: tcp_request_rule.ReplaceTCPRequestRuleBackendHandlerFunc(func(params tcp_request_rule.ReplaceTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceTCPRequestRuleBackend has not yet been implemented") - }), - TCPRequestRuleReplaceTCPRequestRuleDefaultsHandler: tcp_request_rule.ReplaceTCPRequestRuleDefaultsHandlerFunc(func(params tcp_request_rule.ReplaceTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceTCPRequestRuleDefaults has not yet been implemented") - }), - TCPRequestRuleReplaceTCPRequestRuleFrontendHandler: tcp_request_rule.ReplaceTCPRequestRuleFrontendHandlerFunc(func(params tcp_request_rule.ReplaceTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_request_rule.ReplaceTCPRequestRuleFrontend has not yet been implemented") - }), - TCPResponseRuleReplaceTCPResponseRuleBackendHandler: tcp_response_rule.ReplaceTCPResponseRuleBackendHandlerFunc(func(params tcp_response_rule.ReplaceTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.ReplaceTCPResponseRuleBackend has not yet been implemented") - }), - TCPResponseRuleReplaceTCPResponseRuleDefaultsHandler: tcp_response_rule.ReplaceTCPResponseRuleDefaultsHandlerFunc(func(params tcp_response_rule.ReplaceTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation tcp_response_rule.ReplaceTCPResponseRuleDefaults has not yet been implemented") - }), - TableReplaceTableHandler: table.ReplaceTableHandlerFunc(func(params table.ReplaceTableParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation table.ReplaceTable has not yet been implemented") - }), - TracesReplaceTracesHandler: traces.ReplaceTracesHandlerFunc(func(params traces.ReplaceTracesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation traces.ReplaceTraces has not yet been implemented") - }), - UserReplaceUserHandler: user.ReplaceUserHandlerFunc(func(params user.ReplaceUserParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation user.ReplaceUser has not yet been implemented") - }), - SslRuntimeSetCaFileHandler: s_s_l_runtime.SetCaFileHandlerFunc(func(params s_s_l_runtime.SetCaFileParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation s_s_l_runtime.SetCaFile has not yet been implemented") - }), - StickTableSetStickTableEntriesHandler: stick_table.SetStickTableEntriesHandlerFunc(func(params stick_table.SetStickTableEntriesParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation stick_table.SetStickTableEntries has not yet been implemented") - }), - MapsShowRuntimeMapHandler: maps.ShowRuntimeMapHandlerFunc(func(params maps.ShowRuntimeMapParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation maps.ShowRuntimeMap has not yet been implemented") - }), - SpoeTransactionsStartSpoeTransactionHandler: spoe_transactions.StartSpoeTransactionHandlerFunc(func(params spoe_transactions.StartSpoeTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation spoe_transactions.StartSpoeTransaction has not yet been implemented") - }), - TransactionsStartTransactionHandler: transactions.StartTransactionHandlerFunc(func(params transactions.StartTransactionParams, principal interface{}) middleware.Responder { - return middleware.NotImplemented("operation transactions.StartTransaction has not yet been implemented") - }), - - // Applies when the Authorization header is set with the Basic scheme - BasicAuthAuth: func(user string, pass string) (interface{}, error) { - return nil, errors.NotImplemented("basic auth (basic_auth) has not yet been implemented") - }, - // default authorizer is authorized meaning no requests are blocked - APIAuthorizer: security.Authorized(), - } -} - -/* -DataPlaneAPI API for editing and managing haproxy instances. Provides process information, configuration management, -haproxy stats and logs. -*/ -type DataPlaneAPI struct { - spec *loads.Document - context *middleware.Context - handlers map[string]map[string]http.Handler - formats strfmt.Registry - customConsumers map[string]runtime.Consumer - customProducers map[string]runtime.Producer - defaultConsumes string - defaultProduces string - Middleware func(middleware.Builder) http.Handler - useSwaggerUI bool - - // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator - - // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator - - // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. - // It has a default implementation in the security package, however you can replace it for your particular usage. - BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator - - // JSONConsumer registers a consumer for the following mime types: - // - application/json - JSONConsumer runtime.Consumer - // MultipartformConsumer registers a consumer for the following mime types: - // - multipart/form-data - MultipartformConsumer runtime.Consumer - // TxtConsumer registers a consumer for the following mime types: - // - text/plain - TxtConsumer runtime.Consumer - - // BinProducer registers a producer for the following mime types: - // - application/octet-stream - BinProducer runtime.Producer - // JSONProducer registers a producer for the following mime types: - // - application/json - JSONProducer runtime.Producer - // TxtProducer registers a producer for the following mime types: - // - text/plain - TxtProducer runtime.Producer - - // BasicAuthAuth registers a function that takes username and password and returns a principal - // it performs authentication with basic auth - BasicAuthAuth func(string, string) (interface{}, error) - - // APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal - APIAuthorizer runtime.Authorizer - - // StorageCreateStorageSSLCrtListEntryHandler sets the operation handler for the create storage s s l crt list entry operation - StorageCreateStorageSSLCrtListEntryHandler storage.CreateStorageSSLCrtListEntryHandler - // ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler sets the operation handler for the delete services haproxy runtime acls parent name entries ID operation - ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler - // StorageDeleteStorageSSLCrtListEntryHandler sets the operation handler for the delete storage s s l crt list entry operation - StorageDeleteStorageSSLCrtListEntryHandler storage.DeleteStorageSSLCrtListEntryHandler - // ACLRuntimeGetServicesHaproxyRuntimeAclsHandler sets the operation handler for the get services haproxy runtime acls operation - ACLRuntimeGetServicesHaproxyRuntimeAclsHandler acl_runtime.GetServicesHaproxyRuntimeAclsHandler - // ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler sets the operation handler for the get services haproxy runtime acls ID operation - ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler acl_runtime.GetServicesHaproxyRuntimeAclsIDHandler - // ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler sets the operation handler for the get services haproxy runtime acls parent name entries operation - ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesHandler - // ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler sets the operation handler for the get services haproxy runtime acls parent name entries ID operation - ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler - // StorageGetStorageSSLCrtListEntriesHandler sets the operation handler for the get storage s s l crt list entries operation - StorageGetStorageSSLCrtListEntriesHandler storage.GetStorageSSLCrtListEntriesHandler - // ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler sets the operation handler for the post services haproxy runtime acls parent name entries operation - ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntriesHandler - // SslRuntimeAddCaEntryHandler sets the operation handler for the add ca entry operation - SslRuntimeAddCaEntryHandler s_s_l_runtime.AddCaEntryHandler - // SslRuntimeAddCrtListEntryHandler sets the operation handler for the add crt list entry operation - SslRuntimeAddCrtListEntryHandler s_s_l_runtime.AddCrtListEntryHandler - // DefaultsAddDefaultsSectionHandler sets the operation handler for the add defaults section operation - DefaultsAddDefaultsSectionHandler defaults.AddDefaultsSectionHandler - // MapsAddMapEntryHandler sets the operation handler for the add map entry operation - MapsAddMapEntryHandler maps.AddMapEntryHandler - // ACLRuntimeAddPayloadRuntimeACLHandler sets the operation handler for the add payload runtime ACL operation - ACLRuntimeAddPayloadRuntimeACLHandler acl_runtime.AddPayloadRuntimeACLHandler - // MapsAddPayloadRuntimeMapHandler sets the operation handler for the add payload runtime map operation - MapsAddPayloadRuntimeMapHandler maps.AddPayloadRuntimeMapHandler - // ServerAddRuntimeServerHandler sets the operation handler for the add runtime server operation - ServerAddRuntimeServerHandler serverops.AddRuntimeServerHandler - // MapsClearRuntimeMapHandler sets the operation handler for the clear runtime map operation - MapsClearRuntimeMapHandler maps.ClearRuntimeMapHandler - // SpoeTransactionsCommitSpoeTransactionHandler sets the operation handler for the commit spoe transaction operation - SpoeTransactionsCommitSpoeTransactionHandler spoe_transactions.CommitSpoeTransactionHandler - // TransactionsCommitTransactionHandler sets the operation handler for the commit transaction operation - TransactionsCommitTransactionHandler transactions.CommitTransactionHandler - // ServiceDiscoveryCreateAWSRegionHandler sets the operation handler for the create a w s region operation - ServiceDiscoveryCreateAWSRegionHandler service_discovery.CreateAWSRegionHandler - // ACLCreateACLBackendHandler sets the operation handler for the create Acl backend operation - ACLCreateACLBackendHandler acl.CreateACLBackendHandler - // ACLCreateACLDefaultsHandler sets the operation handler for the create Acl defaults operation - ACLCreateACLDefaultsHandler acl.CreateACLDefaultsHandler - // ACLCreateACLFCGIAppHandler sets the operation handler for the create Acl FCGI app operation - ACLCreateACLFCGIAppHandler acl.CreateACLFCGIAppHandler - // ACLCreateACLFrontendHandler sets the operation handler for the create Acl frontend operation - ACLCreateACLFrontendHandler acl.CreateACLFrontendHandler - // AcmeCreateAcmeProviderHandler sets the operation handler for the create acme provider operation - AcmeCreateAcmeProviderHandler acme.CreateAcmeProviderHandler - // BackendCreateBackendHandler sets the operation handler for the create backend operation - BackendCreateBackendHandler backend.CreateBackendHandler - // BackendSwitchingRuleCreateBackendSwitchingRuleHandler sets the operation handler for the create backend switching rule operation - BackendSwitchingRuleCreateBackendSwitchingRuleHandler backend_switching_rule.CreateBackendSwitchingRuleHandler - // BindCreateBindFrontendHandler sets the operation handler for the create bind frontend operation - BindCreateBindFrontendHandler bind.CreateBindFrontendHandler - // BindCreateBindLogForwardHandler sets the operation handler for the create bind log forward operation - BindCreateBindLogForwardHandler bind.CreateBindLogForwardHandler - // BindCreateBindPeerHandler sets the operation handler for the create bind peer operation - BindCreateBindPeerHandler bind.CreateBindPeerHandler - // SslRuntimeCreateCaFileHandler sets the operation handler for the create ca file operation - SslRuntimeCreateCaFileHandler s_s_l_runtime.CreateCaFileHandler - // CacheCreateCacheHandler sets the operation handler for the create cache operation - CacheCreateCacheHandler cache.CreateCacheHandler - // SslRuntimeCreateCertHandler sets the operation handler for the create cert operation - SslRuntimeCreateCertHandler s_s_l_runtime.CreateCertHandler - // ServiceDiscoveryCreateConsulHandler sets the operation handler for the create consul operation - ServiceDiscoveryCreateConsulHandler service_discovery.CreateConsulHandler - // SslRuntimeCreateCrlHandler sets the operation handler for the create crl operation - SslRuntimeCreateCrlHandler s_s_l_runtime.CreateCrlHandler - // CrtLoadCreateCrtLoadHandler sets the operation handler for the create crt load operation - CrtLoadCreateCrtLoadHandler crt_load.CreateCrtLoadHandler - // CrtStoreCreateCrtStoreHandler sets the operation handler for the create crt store operation - CrtStoreCreateCrtStoreHandler crt_store.CreateCrtStoreHandler - // DeclareCaptureCreateDeclareCaptureHandler sets the operation handler for the create declare capture operation - DeclareCaptureCreateDeclareCaptureHandler declare_capture.CreateDeclareCaptureHandler - // DefaultsCreateDefaultsSectionHandler sets the operation handler for the create defaults section operation - DefaultsCreateDefaultsSectionHandler defaults.CreateDefaultsSectionHandler - // DgramBindCreateDgramBindHandler sets the operation handler for the create dgram bind operation - DgramBindCreateDgramBindHandler dgram_bind.CreateDgramBindHandler - // FCGIAppCreateFCGIAppHandler sets the operation handler for the create FCGI app operation - FCGIAppCreateFCGIAppHandler fcgi_app.CreateFCGIAppHandler - // FilterCreateFilterBackendHandler sets the operation handler for the create filter backend operation - FilterCreateFilterBackendHandler filter.CreateFilterBackendHandler - // FilterCreateFilterFrontendHandler sets the operation handler for the create filter frontend operation - FilterCreateFilterFrontendHandler filter.CreateFilterFrontendHandler - // FrontendCreateFrontendHandler sets the operation handler for the create frontend operation - FrontendCreateFrontendHandler frontend.CreateFrontendHandler - // GroupCreateGroupHandler sets the operation handler for the create group operation - GroupCreateGroupHandler group.CreateGroupHandler - // HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler sets the operation handler for the create HTTP after response rule backend operation - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler http_after_response_rule.CreateHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleCreateHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the create HTTP after response rule defaults operation - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.CreateHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler sets the operation handler for the create HTTP after response rule frontend operation - HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler http_after_response_rule.CreateHTTPAfterResponseRuleFrontendHandler - // HTTPCheckCreateHTTPCheckBackendHandler sets the operation handler for the create HTTP check backend operation - HTTPCheckCreateHTTPCheckBackendHandler http_check.CreateHTTPCheckBackendHandler - // HTTPCheckCreateHTTPCheckDefaultsHandler sets the operation handler for the create HTTP check defaults operation - HTTPCheckCreateHTTPCheckDefaultsHandler http_check.CreateHTTPCheckDefaultsHandler - // HTTPErrorRuleCreateHTTPErrorRuleBackendHandler sets the operation handler for the create HTTP error rule backend operation - HTTPErrorRuleCreateHTTPErrorRuleBackendHandler http_error_rule.CreateHTTPErrorRuleBackendHandler - // HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler sets the operation handler for the create HTTP error rule defaults operation - HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler http_error_rule.CreateHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler sets the operation handler for the create HTTP error rule frontend operation - HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler http_error_rule.CreateHTTPErrorRuleFrontendHandler - // HTTPErrorsCreateHTTPErrorsSectionHandler sets the operation handler for the create HTTP errors section operation - HTTPErrorsCreateHTTPErrorsSectionHandler http_errors.CreateHTTPErrorsSectionHandler - // HTTPRequestRuleCreateHTTPRequestRuleBackendHandler sets the operation handler for the create HTTP request rule backend operation - HTTPRequestRuleCreateHTTPRequestRuleBackendHandler http_request_rule.CreateHTTPRequestRuleBackendHandler - // HTTPRequestRuleCreateHTTPRequestRuleDefaultsHandler sets the operation handler for the create HTTP request rule defaults operation - HTTPRequestRuleCreateHTTPRequestRuleDefaultsHandler http_request_rule.CreateHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler sets the operation handler for the create HTTP request rule frontend operation - HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler http_request_rule.CreateHTTPRequestRuleFrontendHandler - // HTTPResponseRuleCreateHTTPResponseRuleBackendHandler sets the operation handler for the create HTTP response rule backend operation - HTTPResponseRuleCreateHTTPResponseRuleBackendHandler http_response_rule.CreateHTTPResponseRuleBackendHandler - // HTTPResponseRuleCreateHTTPResponseRuleDefaultsHandler sets the operation handler for the create HTTP response rule defaults operation - HTTPResponseRuleCreateHTTPResponseRuleDefaultsHandler http_response_rule.CreateHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler sets the operation handler for the create HTTP response rule frontend operation - HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler http_response_rule.CreateHTTPResponseRuleFrontendHandler - // LogForwardCreateLogForwardHandler sets the operation handler for the create log forward operation - LogForwardCreateLogForwardHandler log_forward.CreateLogForwardHandler - // LogProfileCreateLogProfileHandler sets the operation handler for the create log profile operation - LogProfileCreateLogProfileHandler log_profile.CreateLogProfileHandler - // LogTargetCreateLogTargetBackendHandler sets the operation handler for the create log target backend operation - LogTargetCreateLogTargetBackendHandler log_target.CreateLogTargetBackendHandler - // LogTargetCreateLogTargetDefaultsHandler sets the operation handler for the create log target defaults operation - LogTargetCreateLogTargetDefaultsHandler log_target.CreateLogTargetDefaultsHandler - // LogTargetCreateLogTargetFrontendHandler sets the operation handler for the create log target frontend operation - LogTargetCreateLogTargetFrontendHandler log_target.CreateLogTargetFrontendHandler - // LogTargetCreateLogTargetGlobalHandler sets the operation handler for the create log target global operation - LogTargetCreateLogTargetGlobalHandler log_target.CreateLogTargetGlobalHandler - // LogTargetCreateLogTargetLogForwardHandler sets the operation handler for the create log target log forward operation - LogTargetCreateLogTargetLogForwardHandler log_target.CreateLogTargetLogForwardHandler - // LogTargetCreateLogTargetPeerHandler sets the operation handler for the create log target peer operation - LogTargetCreateLogTargetPeerHandler log_target.CreateLogTargetPeerHandler - // MailerEntryCreateMailerEntryHandler sets the operation handler for the create mailer entry operation - MailerEntryCreateMailerEntryHandler mailer_entry.CreateMailerEntryHandler - // MailersCreateMailersSectionHandler sets the operation handler for the create mailers section operation - MailersCreateMailersSectionHandler mailers.CreateMailersSectionHandler - // NameserverCreateNameserverHandler sets the operation handler for the create nameserver operation - NameserverCreateNameserverHandler nameserver.CreateNameserverHandler - // PeerCreatePeerHandler sets the operation handler for the create peer operation - PeerCreatePeerHandler peer.CreatePeerHandler - // PeerEntryCreatePeerEntryHandler sets the operation handler for the create peer entry operation - PeerEntryCreatePeerEntryHandler peer_entry.CreatePeerEntryHandler - // ProcessManagerCreateProgramHandler sets the operation handler for the create program operation - ProcessManagerCreateProgramHandler process_manager.CreateProgramHandler - // QUICInitialRuleCreateQUICInitialRuleDefaultsHandler sets the operation handler for the create QUIC initial rule defaults operation - QUICInitialRuleCreateQUICInitialRuleDefaultsHandler quic_initial_rule.CreateQUICInitialRuleDefaultsHandler - // QUICInitialRuleCreateQUICInitialRuleFrontendHandler sets the operation handler for the create QUIC initial rule frontend operation - QUICInitialRuleCreateQUICInitialRuleFrontendHandler quic_initial_rule.CreateQUICInitialRuleFrontendHandler - // ResolverCreateResolverHandler sets the operation handler for the create resolver operation - ResolverCreateResolverHandler resolver.CreateResolverHandler - // RingCreateRingHandler sets the operation handler for the create ring operation - RingCreateRingHandler ring.CreateRingHandler - // SslFrontUseCreateSSLFrontUseHandler sets the operation handler for the create s s l front use operation - SslFrontUseCreateSSLFrontUseHandler s_s_l_front_use.CreateSSLFrontUseHandler - // ServerCreateServerBackendHandler sets the operation handler for the create server backend operation - ServerCreateServerBackendHandler serverops.CreateServerBackendHandler - // ServerCreateServerPeerHandler sets the operation handler for the create server peer operation - ServerCreateServerPeerHandler serverops.CreateServerPeerHandler - // ServerCreateServerRingHandler sets the operation handler for the create server ring operation - ServerCreateServerRingHandler serverops.CreateServerRingHandler - // ServerSwitchingRuleCreateServerSwitchingRuleHandler sets the operation handler for the create server switching rule operation - ServerSwitchingRuleCreateServerSwitchingRuleHandler server_switching_rule.CreateServerSwitchingRuleHandler - // ServerTemplateCreateServerTemplateHandler sets the operation handler for the create server template operation - ServerTemplateCreateServerTemplateHandler server_template.CreateServerTemplateHandler - // SitesCreateSiteHandler sets the operation handler for the create site operation - SitesCreateSiteHandler sites.CreateSiteHandler - // SpoeCreateSpoeHandler sets the operation handler for the create spoe operation - SpoeCreateSpoeHandler spoe.CreateSpoeHandler - // SpoeCreateSpoeAgentHandler sets the operation handler for the create spoe agent operation - SpoeCreateSpoeAgentHandler spoe.CreateSpoeAgentHandler - // SpoeCreateSpoeGroupHandler sets the operation handler for the create spoe group operation - SpoeCreateSpoeGroupHandler spoe.CreateSpoeGroupHandler - // SpoeCreateSpoeMessageHandler sets the operation handler for the create spoe message operation - SpoeCreateSpoeMessageHandler spoe.CreateSpoeMessageHandler - // SpoeCreateSpoeScopeHandler sets the operation handler for the create spoe scope operation - SpoeCreateSpoeScopeHandler spoe.CreateSpoeScopeHandler - // StickRuleCreateStickRuleHandler sets the operation handler for the create stick rule operation - StickRuleCreateStickRuleHandler stick_rule.CreateStickRuleHandler - // StorageCreateStorageGeneralFileHandler sets the operation handler for the create storage general file operation - StorageCreateStorageGeneralFileHandler storage.CreateStorageGeneralFileHandler - // StorageCreateStorageMapFileHandler sets the operation handler for the create storage map file operation - StorageCreateStorageMapFileHandler storage.CreateStorageMapFileHandler - // StorageCreateStorageSSLCertificateHandler sets the operation handler for the create storage s s l certificate operation - StorageCreateStorageSSLCertificateHandler storage.CreateStorageSSLCertificateHandler - // StorageCreateStorageSSLCrtListFileHandler sets the operation handler for the create storage s s l crt list file operation - StorageCreateStorageSSLCrtListFileHandler storage.CreateStorageSSLCrtListFileHandler - // TCPCheckCreateTCPCheckBackendHandler sets the operation handler for the create TCP check backend operation - TCPCheckCreateTCPCheckBackendHandler tcp_check.CreateTCPCheckBackendHandler - // TCPCheckCreateTCPCheckDefaultsHandler sets the operation handler for the create TCP check defaults operation - TCPCheckCreateTCPCheckDefaultsHandler tcp_check.CreateTCPCheckDefaultsHandler - // TCPRequestRuleCreateTCPRequestRuleBackendHandler sets the operation handler for the create TCP request rule backend operation - TCPRequestRuleCreateTCPRequestRuleBackendHandler tcp_request_rule.CreateTCPRequestRuleBackendHandler - // TCPRequestRuleCreateTCPRequestRuleDefaultsHandler sets the operation handler for the create TCP request rule defaults operation - TCPRequestRuleCreateTCPRequestRuleDefaultsHandler tcp_request_rule.CreateTCPRequestRuleDefaultsHandler - // TCPRequestRuleCreateTCPRequestRuleFrontendHandler sets the operation handler for the create TCP request rule frontend operation - TCPRequestRuleCreateTCPRequestRuleFrontendHandler tcp_request_rule.CreateTCPRequestRuleFrontendHandler - // TCPResponseRuleCreateTCPResponseRuleBackendHandler sets the operation handler for the create TCP response rule backend operation - TCPResponseRuleCreateTCPResponseRuleBackendHandler tcp_response_rule.CreateTCPResponseRuleBackendHandler - // TCPResponseRuleCreateTCPResponseRuleDefaultsHandler sets the operation handler for the create TCP response rule defaults operation - TCPResponseRuleCreateTCPResponseRuleDefaultsHandler tcp_response_rule.CreateTCPResponseRuleDefaultsHandler - // TableCreateTableHandler sets the operation handler for the create table operation - TableCreateTableHandler table.CreateTableHandler - // TracesCreateTraceEntryHandler sets the operation handler for the create trace entry operation - TracesCreateTraceEntryHandler traces.CreateTraceEntryHandler - // TracesCreateTracesHandler sets the operation handler for the create traces operation - TracesCreateTracesHandler traces.CreateTracesHandler - // UserCreateUserHandler sets the operation handler for the create user operation - UserCreateUserHandler user.CreateUserHandler - // UserlistCreateUserlistHandler sets the operation handler for the create userlist operation - UserlistCreateUserlistHandler userlist.CreateUserlistHandler - // ServiceDiscoveryDeleteAWSRegionHandler sets the operation handler for the delete a w s region operation - ServiceDiscoveryDeleteAWSRegionHandler service_discovery.DeleteAWSRegionHandler - // ACLDeleteACLBackendHandler sets the operation handler for the delete Acl backend operation - ACLDeleteACLBackendHandler acl.DeleteACLBackendHandler - // ACLDeleteACLDefaultsHandler sets the operation handler for the delete Acl defaults operation - ACLDeleteACLDefaultsHandler acl.DeleteACLDefaultsHandler - // ACLDeleteACLFCGIAppHandler sets the operation handler for the delete Acl FCGI app operation - ACLDeleteACLFCGIAppHandler acl.DeleteACLFCGIAppHandler - // ACLDeleteACLFrontendHandler sets the operation handler for the delete Acl frontend operation - ACLDeleteACLFrontendHandler acl.DeleteACLFrontendHandler - // AcmeDeleteAcmeProviderHandler sets the operation handler for the delete acme provider operation - AcmeDeleteAcmeProviderHandler acme.DeleteAcmeProviderHandler - // BackendDeleteBackendHandler sets the operation handler for the delete backend operation - BackendDeleteBackendHandler backend.DeleteBackendHandler - // BackendSwitchingRuleDeleteBackendSwitchingRuleHandler sets the operation handler for the delete backend switching rule operation - BackendSwitchingRuleDeleteBackendSwitchingRuleHandler backend_switching_rule.DeleteBackendSwitchingRuleHandler - // BindDeleteBindFrontendHandler sets the operation handler for the delete bind frontend operation - BindDeleteBindFrontendHandler bind.DeleteBindFrontendHandler - // BindDeleteBindLogForwardHandler sets the operation handler for the delete bind log forward operation - BindDeleteBindLogForwardHandler bind.DeleteBindLogForwardHandler - // BindDeleteBindPeerHandler sets the operation handler for the delete bind peer operation - BindDeleteBindPeerHandler bind.DeleteBindPeerHandler - // SslRuntimeDeleteCaFileHandler sets the operation handler for the delete ca file operation - SslRuntimeDeleteCaFileHandler s_s_l_runtime.DeleteCaFileHandler - // CacheDeleteCacheHandler sets the operation handler for the delete cache operation - CacheDeleteCacheHandler cache.DeleteCacheHandler - // SslRuntimeDeleteCertHandler sets the operation handler for the delete cert operation - SslRuntimeDeleteCertHandler s_s_l_runtime.DeleteCertHandler - // ClusterDeleteClusterHandler sets the operation handler for the delete cluster operation - ClusterDeleteClusterHandler cluster.DeleteClusterHandler - // ServiceDiscoveryDeleteConsulHandler sets the operation handler for the delete consul operation - ServiceDiscoveryDeleteConsulHandler service_discovery.DeleteConsulHandler - // SslRuntimeDeleteCrlHandler sets the operation handler for the delete crl operation - SslRuntimeDeleteCrlHandler s_s_l_runtime.DeleteCrlHandler - // SslRuntimeDeleteCrtListEntryHandler sets the operation handler for the delete crt list entry operation - SslRuntimeDeleteCrtListEntryHandler s_s_l_runtime.DeleteCrtListEntryHandler - // CrtLoadDeleteCrtLoadHandler sets the operation handler for the delete crt load operation - CrtLoadDeleteCrtLoadHandler crt_load.DeleteCrtLoadHandler - // CrtStoreDeleteCrtStoreHandler sets the operation handler for the delete crt store operation - CrtStoreDeleteCrtStoreHandler crt_store.DeleteCrtStoreHandler - // DeclareCaptureDeleteDeclareCaptureHandler sets the operation handler for the delete declare capture operation - DeclareCaptureDeleteDeclareCaptureHandler declare_capture.DeleteDeclareCaptureHandler - // DefaultsDeleteDefaultsSectionHandler sets the operation handler for the delete defaults section operation - DefaultsDeleteDefaultsSectionHandler defaults.DeleteDefaultsSectionHandler - // DgramBindDeleteDgramBindHandler sets the operation handler for the delete dgram bind operation - DgramBindDeleteDgramBindHandler dgram_bind.DeleteDgramBindHandler - // FCGIAppDeleteFCGIAppHandler sets the operation handler for the delete FCGI app operation - FCGIAppDeleteFCGIAppHandler fcgi_app.DeleteFCGIAppHandler - // FilterDeleteFilterBackendHandler sets the operation handler for the delete filter backend operation - FilterDeleteFilterBackendHandler filter.DeleteFilterBackendHandler - // FilterDeleteFilterFrontendHandler sets the operation handler for the delete filter frontend operation - FilterDeleteFilterFrontendHandler filter.DeleteFilterFrontendHandler - // FrontendDeleteFrontendHandler sets the operation handler for the delete frontend operation - FrontendDeleteFrontendHandler frontend.DeleteFrontendHandler - // GroupDeleteGroupHandler sets the operation handler for the delete group operation - GroupDeleteGroupHandler group.DeleteGroupHandler - // HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler sets the operation handler for the delete HTTP after response rule backend operation - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler http_after_response_rule.DeleteHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the delete HTTP after response rule defaults operation - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.DeleteHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler sets the operation handler for the delete HTTP after response rule frontend operation - HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler http_after_response_rule.DeleteHTTPAfterResponseRuleFrontendHandler - // HTTPCheckDeleteHTTPCheckBackendHandler sets the operation handler for the delete HTTP check backend operation - HTTPCheckDeleteHTTPCheckBackendHandler http_check.DeleteHTTPCheckBackendHandler - // HTTPCheckDeleteHTTPCheckDefaultsHandler sets the operation handler for the delete HTTP check defaults operation - HTTPCheckDeleteHTTPCheckDefaultsHandler http_check.DeleteHTTPCheckDefaultsHandler - // HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler sets the operation handler for the delete HTTP error rule backend operation - HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler http_error_rule.DeleteHTTPErrorRuleBackendHandler - // HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler sets the operation handler for the delete HTTP error rule defaults operation - HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler http_error_rule.DeleteHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler sets the operation handler for the delete HTTP error rule frontend operation - HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler http_error_rule.DeleteHTTPErrorRuleFrontendHandler - // HTTPErrorsDeleteHTTPErrorsSectionHandler sets the operation handler for the delete HTTP errors section operation - HTTPErrorsDeleteHTTPErrorsSectionHandler http_errors.DeleteHTTPErrorsSectionHandler - // HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler sets the operation handler for the delete HTTP request rule backend operation - HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler http_request_rule.DeleteHTTPRequestRuleBackendHandler - // HTTPRequestRuleDeleteHTTPRequestRuleDefaultsHandler sets the operation handler for the delete HTTP request rule defaults operation - HTTPRequestRuleDeleteHTTPRequestRuleDefaultsHandler http_request_rule.DeleteHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler sets the operation handler for the delete HTTP request rule frontend operation - HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler http_request_rule.DeleteHTTPRequestRuleFrontendHandler - // HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler sets the operation handler for the delete HTTP response rule backend operation - HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler http_response_rule.DeleteHTTPResponseRuleBackendHandler - // HTTPResponseRuleDeleteHTTPResponseRuleDefaultsHandler sets the operation handler for the delete HTTP response rule defaults operation - HTTPResponseRuleDeleteHTTPResponseRuleDefaultsHandler http_response_rule.DeleteHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler sets the operation handler for the delete HTTP response rule frontend operation - HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler http_response_rule.DeleteHTTPResponseRuleFrontendHandler - // LogForwardDeleteLogForwardHandler sets the operation handler for the delete log forward operation - LogForwardDeleteLogForwardHandler log_forward.DeleteLogForwardHandler - // LogProfileDeleteLogProfileHandler sets the operation handler for the delete log profile operation - LogProfileDeleteLogProfileHandler log_profile.DeleteLogProfileHandler - // LogTargetDeleteLogTargetBackendHandler sets the operation handler for the delete log target backend operation - LogTargetDeleteLogTargetBackendHandler log_target.DeleteLogTargetBackendHandler - // LogTargetDeleteLogTargetDefaultsHandler sets the operation handler for the delete log target defaults operation - LogTargetDeleteLogTargetDefaultsHandler log_target.DeleteLogTargetDefaultsHandler - // LogTargetDeleteLogTargetFrontendHandler sets the operation handler for the delete log target frontend operation - LogTargetDeleteLogTargetFrontendHandler log_target.DeleteLogTargetFrontendHandler - // LogTargetDeleteLogTargetGlobalHandler sets the operation handler for the delete log target global operation - LogTargetDeleteLogTargetGlobalHandler log_target.DeleteLogTargetGlobalHandler - // LogTargetDeleteLogTargetLogForwardHandler sets the operation handler for the delete log target log forward operation - LogTargetDeleteLogTargetLogForwardHandler log_target.DeleteLogTargetLogForwardHandler - // LogTargetDeleteLogTargetPeerHandler sets the operation handler for the delete log target peer operation - LogTargetDeleteLogTargetPeerHandler log_target.DeleteLogTargetPeerHandler - // MailerEntryDeleteMailerEntryHandler sets the operation handler for the delete mailer entry operation - MailerEntryDeleteMailerEntryHandler mailer_entry.DeleteMailerEntryHandler - // MailersDeleteMailersSectionHandler sets the operation handler for the delete mailers section operation - MailersDeleteMailersSectionHandler mailers.DeleteMailersSectionHandler - // NameserverDeleteNameserverHandler sets the operation handler for the delete nameserver operation - NameserverDeleteNameserverHandler nameserver.DeleteNameserverHandler - // PeerDeletePeerHandler sets the operation handler for the delete peer operation - PeerDeletePeerHandler peer.DeletePeerHandler - // PeerEntryDeletePeerEntryHandler sets the operation handler for the delete peer entry operation - PeerEntryDeletePeerEntryHandler peer_entry.DeletePeerEntryHandler - // ProcessManagerDeleteProgramHandler sets the operation handler for the delete program operation - ProcessManagerDeleteProgramHandler process_manager.DeleteProgramHandler - // QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler sets the operation handler for the delete QUIC initial rule defaults operation - QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler quic_initial_rule.DeleteQUICInitialRuleDefaultsHandler - // QUICInitialRuleDeleteQUICInitialRuleFrontendHandler sets the operation handler for the delete QUIC initial rule frontend operation - QUICInitialRuleDeleteQUICInitialRuleFrontendHandler quic_initial_rule.DeleteQUICInitialRuleFrontendHandler - // ResolverDeleteResolverHandler sets the operation handler for the delete resolver operation - ResolverDeleteResolverHandler resolver.DeleteResolverHandler - // RingDeleteRingHandler sets the operation handler for the delete ring operation - RingDeleteRingHandler ring.DeleteRingHandler - // MapsDeleteRuntimeMapEntryHandler sets the operation handler for the delete runtime map entry operation - MapsDeleteRuntimeMapEntryHandler maps.DeleteRuntimeMapEntryHandler - // ServerDeleteRuntimeServerHandler sets the operation handler for the delete runtime server operation - ServerDeleteRuntimeServerHandler serverops.DeleteRuntimeServerHandler - // SslFrontUseDeleteSSLFrontUseHandler sets the operation handler for the delete s s l front use operation - SslFrontUseDeleteSSLFrontUseHandler s_s_l_front_use.DeleteSSLFrontUseHandler - // ServerDeleteServerBackendHandler sets the operation handler for the delete server backend operation - ServerDeleteServerBackendHandler serverops.DeleteServerBackendHandler - // ServerDeleteServerPeerHandler sets the operation handler for the delete server peer operation - ServerDeleteServerPeerHandler serverops.DeleteServerPeerHandler - // ServerDeleteServerRingHandler sets the operation handler for the delete server ring operation - ServerDeleteServerRingHandler serverops.DeleteServerRingHandler - // ServerSwitchingRuleDeleteServerSwitchingRuleHandler sets the operation handler for the delete server switching rule operation - ServerSwitchingRuleDeleteServerSwitchingRuleHandler server_switching_rule.DeleteServerSwitchingRuleHandler - // ServerTemplateDeleteServerTemplateHandler sets the operation handler for the delete server template operation - ServerTemplateDeleteServerTemplateHandler server_template.DeleteServerTemplateHandler - // SitesDeleteSiteHandler sets the operation handler for the delete site operation - SitesDeleteSiteHandler sites.DeleteSiteHandler - // SpoeDeleteSpoeAgentHandler sets the operation handler for the delete spoe agent operation - SpoeDeleteSpoeAgentHandler spoe.DeleteSpoeAgentHandler - // SpoeDeleteSpoeFileHandler sets the operation handler for the delete spoe file operation - SpoeDeleteSpoeFileHandler spoe.DeleteSpoeFileHandler - // SpoeDeleteSpoeGroupHandler sets the operation handler for the delete spoe group operation - SpoeDeleteSpoeGroupHandler spoe.DeleteSpoeGroupHandler - // SpoeDeleteSpoeMessageHandler sets the operation handler for the delete spoe message operation - SpoeDeleteSpoeMessageHandler spoe.DeleteSpoeMessageHandler - // SpoeDeleteSpoeScopeHandler sets the operation handler for the delete spoe scope operation - SpoeDeleteSpoeScopeHandler spoe.DeleteSpoeScopeHandler - // SpoeTransactionsDeleteSpoeTransactionHandler sets the operation handler for the delete spoe transaction operation - SpoeTransactionsDeleteSpoeTransactionHandler spoe_transactions.DeleteSpoeTransactionHandler - // StickRuleDeleteStickRuleHandler sets the operation handler for the delete stick rule operation - StickRuleDeleteStickRuleHandler stick_rule.DeleteStickRuleHandler - // StorageDeleteStorageGeneralFileHandler sets the operation handler for the delete storage general file operation - StorageDeleteStorageGeneralFileHandler storage.DeleteStorageGeneralFileHandler - // StorageDeleteStorageMapHandler sets the operation handler for the delete storage map operation - StorageDeleteStorageMapHandler storage.DeleteStorageMapHandler - // StorageDeleteStorageSSLCertificateHandler sets the operation handler for the delete storage s s l certificate operation - StorageDeleteStorageSSLCertificateHandler storage.DeleteStorageSSLCertificateHandler - // StorageDeleteStorageSSLCrtListFileHandler sets the operation handler for the delete storage s s l crt list file operation - StorageDeleteStorageSSLCrtListFileHandler storage.DeleteStorageSSLCrtListFileHandler - // TCPCheckDeleteTCPCheckBackendHandler sets the operation handler for the delete TCP check backend operation - TCPCheckDeleteTCPCheckBackendHandler tcp_check.DeleteTCPCheckBackendHandler - // TCPCheckDeleteTCPCheckDefaultsHandler sets the operation handler for the delete TCP check defaults operation - TCPCheckDeleteTCPCheckDefaultsHandler tcp_check.DeleteTCPCheckDefaultsHandler - // TCPRequestRuleDeleteTCPRequestRuleBackendHandler sets the operation handler for the delete TCP request rule backend operation - TCPRequestRuleDeleteTCPRequestRuleBackendHandler tcp_request_rule.DeleteTCPRequestRuleBackendHandler - // TCPRequestRuleDeleteTCPRequestRuleDefaultsHandler sets the operation handler for the delete TCP request rule defaults operation - TCPRequestRuleDeleteTCPRequestRuleDefaultsHandler tcp_request_rule.DeleteTCPRequestRuleDefaultsHandler - // TCPRequestRuleDeleteTCPRequestRuleFrontendHandler sets the operation handler for the delete TCP request rule frontend operation - TCPRequestRuleDeleteTCPRequestRuleFrontendHandler tcp_request_rule.DeleteTCPRequestRuleFrontendHandler - // TCPResponseRuleDeleteTCPResponseRuleBackendHandler sets the operation handler for the delete TCP response rule backend operation - TCPResponseRuleDeleteTCPResponseRuleBackendHandler tcp_response_rule.DeleteTCPResponseRuleBackendHandler - // TCPResponseRuleDeleteTCPResponseRuleDefaultsHandler sets the operation handler for the delete TCP response rule defaults operation - TCPResponseRuleDeleteTCPResponseRuleDefaultsHandler tcp_response_rule.DeleteTCPResponseRuleDefaultsHandler - // TableDeleteTableHandler sets the operation handler for the delete table operation - TableDeleteTableHandler table.DeleteTableHandler - // TracesDeleteTraceEntryHandler sets the operation handler for the delete trace entry operation - TracesDeleteTraceEntryHandler traces.DeleteTraceEntryHandler - // TracesDeleteTracesHandler sets the operation handler for the delete traces operation - TracesDeleteTracesHandler traces.DeleteTracesHandler - // TransactionsDeleteTransactionHandler sets the operation handler for the delete transaction operation - TransactionsDeleteTransactionHandler transactions.DeleteTransactionHandler - // UserDeleteUserHandler sets the operation handler for the delete user operation - UserDeleteUserHandler user.DeleteUserHandler - // UserlistDeleteUserlistHandler sets the operation handler for the delete userlist operation - UserlistDeleteUserlistHandler userlist.DeleteUserlistHandler - // AcmeEditAcmeProviderHandler sets the operation handler for the edit acme provider operation - AcmeEditAcmeProviderHandler acme.EditAcmeProviderHandler - // ClusterEditClusterHandler sets the operation handler for the edit cluster operation - ClusterEditClusterHandler cluster.EditClusterHandler - // CrtStoreEditCrtStoreHandler sets the operation handler for the edit crt store operation - CrtStoreEditCrtStoreHandler crt_store.EditCrtStoreHandler - // LogProfileEditLogProfileHandler sets the operation handler for the edit log profile operation - LogProfileEditLogProfileHandler log_profile.EditLogProfileHandler - // MailersEditMailersSectionHandler sets the operation handler for the edit mailers section operation - MailersEditMailersSectionHandler mailers.EditMailersSectionHandler - // DiscoveryGetAPIEndpointsHandler sets the operation handler for the get API endpoints operation - DiscoveryGetAPIEndpointsHandler discovery.GetAPIEndpointsHandler - // ServiceDiscoveryGetAWSRegionHandler sets the operation handler for the get a w s region operation - ServiceDiscoveryGetAWSRegionHandler service_discovery.GetAWSRegionHandler - // ServiceDiscoveryGetAWSRegionsHandler sets the operation handler for the get a w s regions operation - ServiceDiscoveryGetAWSRegionsHandler service_discovery.GetAWSRegionsHandler - // ACLGetACLBackendHandler sets the operation handler for the get Acl backend operation - ACLGetACLBackendHandler acl.GetACLBackendHandler - // ACLGetACLDefaultsHandler sets the operation handler for the get Acl defaults operation - ACLGetACLDefaultsHandler acl.GetACLDefaultsHandler - // ACLGetACLFCGIAppHandler sets the operation handler for the get Acl FCGI app operation - ACLGetACLFCGIAppHandler acl.GetACLFCGIAppHandler - // ACLGetACLFrontendHandler sets the operation handler for the get Acl frontend operation - ACLGetACLFrontendHandler acl.GetACLFrontendHandler - // AcmeGetAcmeProviderHandler sets the operation handler for the get acme provider operation - AcmeGetAcmeProviderHandler acme.GetAcmeProviderHandler - // AcmeGetAcmeProvidersHandler sets the operation handler for the get acme providers operation - AcmeGetAcmeProvidersHandler acme.GetAcmeProvidersHandler - // AcmeRuntimeGetAcmeStatusHandler sets the operation handler for the get acme status operation - AcmeRuntimeGetAcmeStatusHandler acme_runtime.GetAcmeStatusHandler - // ACLGetAllACLBackendHandler sets the operation handler for the get all Acl backend operation - ACLGetAllACLBackendHandler acl.GetAllACLBackendHandler - // ACLGetAllACLDefaultsHandler sets the operation handler for the get all Acl defaults operation - ACLGetAllACLDefaultsHandler acl.GetAllACLDefaultsHandler - // ACLGetAllACLFCGIAppHandler sets the operation handler for the get all Acl FCGI app operation - ACLGetAllACLFCGIAppHandler acl.GetAllACLFCGIAppHandler - // ACLGetAllACLFrontendHandler sets the operation handler for the get all Acl frontend operation - ACLGetAllACLFrontendHandler acl.GetAllACLFrontendHandler - // BindGetAllBindFrontendHandler sets the operation handler for the get all bind frontend operation - BindGetAllBindFrontendHandler bind.GetAllBindFrontendHandler - // BindGetAllBindLogForwardHandler sets the operation handler for the get all bind log forward operation - BindGetAllBindLogForwardHandler bind.GetAllBindLogForwardHandler - // BindGetAllBindPeerHandler sets the operation handler for the get all bind peer operation - BindGetAllBindPeerHandler bind.GetAllBindPeerHandler - // SslRuntimeGetAllCaFilesHandler sets the operation handler for the get all ca files operation - SslRuntimeGetAllCaFilesHandler s_s_l_runtime.GetAllCaFilesHandler - // SslRuntimeGetAllCertsHandler sets the operation handler for the get all certs operation - SslRuntimeGetAllCertsHandler s_s_l_runtime.GetAllCertsHandler - // SslRuntimeGetAllCrlHandler sets the operation handler for the get all crl operation - SslRuntimeGetAllCrlHandler s_s_l_runtime.GetAllCrlHandler - // SslRuntimeGetAllCrtListEntriesHandler sets the operation handler for the get all crt list entries operation - SslRuntimeGetAllCrtListEntriesHandler s_s_l_runtime.GetAllCrtListEntriesHandler - // SslRuntimeGetAllCrtListsHandler sets the operation handler for the get all crt lists operation - SslRuntimeGetAllCrtListsHandler s_s_l_runtime.GetAllCrtListsHandler - // FilterGetAllFilterBackendHandler sets the operation handler for the get all filter backend operation - FilterGetAllFilterBackendHandler filter.GetAllFilterBackendHandler - // FilterGetAllFilterFrontendHandler sets the operation handler for the get all filter frontend operation - FilterGetAllFilterFrontendHandler filter.GetAllFilterFrontendHandler - // HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler sets the operation handler for the get all HTTP after response rule backend operation - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler http_after_response_rule.GetAllHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the get all HTTP after response rule defaults operation - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.GetAllHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler sets the operation handler for the get all HTTP after response rule frontend operation - HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler http_after_response_rule.GetAllHTTPAfterResponseRuleFrontendHandler - // HTTPCheckGetAllHTTPCheckBackendHandler sets the operation handler for the get all HTTP check backend operation - HTTPCheckGetAllHTTPCheckBackendHandler http_check.GetAllHTTPCheckBackendHandler - // HTTPCheckGetAllHTTPCheckDefaultsHandler sets the operation handler for the get all HTTP check defaults operation - HTTPCheckGetAllHTTPCheckDefaultsHandler http_check.GetAllHTTPCheckDefaultsHandler - // HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler sets the operation handler for the get all HTTP error rule backend operation - HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler http_error_rule.GetAllHTTPErrorRuleBackendHandler - // HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler sets the operation handler for the get all HTTP error rule defaults operation - HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler http_error_rule.GetAllHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler sets the operation handler for the get all HTTP error rule frontend operation - HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler http_error_rule.GetAllHTTPErrorRuleFrontendHandler - // HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler sets the operation handler for the get all HTTP request rule backend operation - HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler http_request_rule.GetAllHTTPRequestRuleBackendHandler - // HTTPRequestRuleGetAllHTTPRequestRuleDefaultsHandler sets the operation handler for the get all HTTP request rule defaults operation - HTTPRequestRuleGetAllHTTPRequestRuleDefaultsHandler http_request_rule.GetAllHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler sets the operation handler for the get all HTTP request rule frontend operation - HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler http_request_rule.GetAllHTTPRequestRuleFrontendHandler - // HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler sets the operation handler for the get all HTTP response rule backend operation - HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler http_response_rule.GetAllHTTPResponseRuleBackendHandler - // HTTPResponseRuleGetAllHTTPResponseRuleDefaultsHandler sets the operation handler for the get all HTTP response rule defaults operation - HTTPResponseRuleGetAllHTTPResponseRuleDefaultsHandler http_response_rule.GetAllHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler sets the operation handler for the get all HTTP response rule frontend operation - HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler http_response_rule.GetAllHTTPResponseRuleFrontendHandler - // LogTargetGetAllLogTargetBackendHandler sets the operation handler for the get all log target backend operation - LogTargetGetAllLogTargetBackendHandler log_target.GetAllLogTargetBackendHandler - // LogTargetGetAllLogTargetDefaultsHandler sets the operation handler for the get all log target defaults operation - LogTargetGetAllLogTargetDefaultsHandler log_target.GetAllLogTargetDefaultsHandler - // LogTargetGetAllLogTargetFrontendHandler sets the operation handler for the get all log target frontend operation - LogTargetGetAllLogTargetFrontendHandler log_target.GetAllLogTargetFrontendHandler - // LogTargetGetAllLogTargetGlobalHandler sets the operation handler for the get all log target global operation - LogTargetGetAllLogTargetGlobalHandler log_target.GetAllLogTargetGlobalHandler - // LogTargetGetAllLogTargetLogForwardHandler sets the operation handler for the get all log target log forward operation - LogTargetGetAllLogTargetLogForwardHandler log_target.GetAllLogTargetLogForwardHandler - // LogTargetGetAllLogTargetPeerHandler sets the operation handler for the get all log target peer operation - LogTargetGetAllLogTargetPeerHandler log_target.GetAllLogTargetPeerHandler - // QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler sets the operation handler for the get all QUIC initial rule defaults operation - QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler quic_initial_rule.GetAllQUICInitialRuleDefaultsHandler - // QUICInitialRuleGetAllQUICInitialRuleFrontendHandler sets the operation handler for the get all QUIC initial rule frontend operation - QUICInitialRuleGetAllQUICInitialRuleFrontendHandler quic_initial_rule.GetAllQUICInitialRuleFrontendHandler - // MapsGetAllRuntimeMapFilesHandler sets the operation handler for the get all runtime map files operation - MapsGetAllRuntimeMapFilesHandler maps.GetAllRuntimeMapFilesHandler - // ServerGetAllRuntimeServerHandler sets the operation handler for the get all runtime server operation - ServerGetAllRuntimeServerHandler serverops.GetAllRuntimeServerHandler - // SslFrontUseGetAllSSLFrontUsesHandler sets the operation handler for the get all s s l front uses operation - SslFrontUseGetAllSSLFrontUsesHandler s_s_l_front_use.GetAllSSLFrontUsesHandler - // ServerGetAllServerBackendHandler sets the operation handler for the get all server backend operation - ServerGetAllServerBackendHandler serverops.GetAllServerBackendHandler - // ServerGetAllServerPeerHandler sets the operation handler for the get all server peer operation - ServerGetAllServerPeerHandler serverops.GetAllServerPeerHandler - // ServerGetAllServerRingHandler sets the operation handler for the get all server ring operation - ServerGetAllServerRingHandler serverops.GetAllServerRingHandler - // SpoeGetAllSpoeAgentHandler sets the operation handler for the get all spoe agent operation - SpoeGetAllSpoeAgentHandler spoe.GetAllSpoeAgentHandler - // SpoeGetAllSpoeFilesHandler sets the operation handler for the get all spoe files operation - SpoeGetAllSpoeFilesHandler spoe.GetAllSpoeFilesHandler - // SpoeGetAllSpoeGroupHandler sets the operation handler for the get all spoe group operation - SpoeGetAllSpoeGroupHandler spoe.GetAllSpoeGroupHandler - // SpoeGetAllSpoeMessageHandler sets the operation handler for the get all spoe message operation - SpoeGetAllSpoeMessageHandler spoe.GetAllSpoeMessageHandler - // SpoeGetAllSpoeScopeHandler sets the operation handler for the get all spoe scope operation - SpoeGetAllSpoeScopeHandler spoe.GetAllSpoeScopeHandler - // SpoeTransactionsGetAllSpoeTransactionHandler sets the operation handler for the get all spoe transaction operation - SpoeTransactionsGetAllSpoeTransactionHandler spoe_transactions.GetAllSpoeTransactionHandler - // StorageGetAllStorageGeneralFilesHandler sets the operation handler for the get all storage general files operation - StorageGetAllStorageGeneralFilesHandler storage.GetAllStorageGeneralFilesHandler - // StorageGetAllStorageMapFilesHandler sets the operation handler for the get all storage map files operation - StorageGetAllStorageMapFilesHandler storage.GetAllStorageMapFilesHandler - // StorageGetAllStorageSSLCertificatesHandler sets the operation handler for the get all storage s s l certificates operation - StorageGetAllStorageSSLCertificatesHandler storage.GetAllStorageSSLCertificatesHandler - // StorageGetAllStorageSSLCrtListFilesHandler sets the operation handler for the get all storage s s l crt list files operation - StorageGetAllStorageSSLCrtListFilesHandler storage.GetAllStorageSSLCrtListFilesHandler - // TCPCheckGetAllTCPCheckBackendHandler sets the operation handler for the get all TCP check backend operation - TCPCheckGetAllTCPCheckBackendHandler tcp_check.GetAllTCPCheckBackendHandler - // TCPCheckGetAllTCPCheckDefaultsHandler sets the operation handler for the get all TCP check defaults operation - TCPCheckGetAllTCPCheckDefaultsHandler tcp_check.GetAllTCPCheckDefaultsHandler - // TCPRequestRuleGetAllTCPRequestRuleBackendHandler sets the operation handler for the get all TCP request rule backend operation - TCPRequestRuleGetAllTCPRequestRuleBackendHandler tcp_request_rule.GetAllTCPRequestRuleBackendHandler - // TCPRequestRuleGetAllTCPRequestRuleDefaultsHandler sets the operation handler for the get all TCP request rule defaults operation - TCPRequestRuleGetAllTCPRequestRuleDefaultsHandler tcp_request_rule.GetAllTCPRequestRuleDefaultsHandler - // TCPRequestRuleGetAllTCPRequestRuleFrontendHandler sets the operation handler for the get all TCP request rule frontend operation - TCPRequestRuleGetAllTCPRequestRuleFrontendHandler tcp_request_rule.GetAllTCPRequestRuleFrontendHandler - // TCPResponseRuleGetAllTCPResponseRuleBackendHandler sets the operation handler for the get all TCP response rule backend operation - TCPResponseRuleGetAllTCPResponseRuleBackendHandler tcp_response_rule.GetAllTCPResponseRuleBackendHandler - // TCPResponseRuleGetAllTCPResponseRuleDefaultsHandler sets the operation handler for the get all TCP response rule defaults operation - TCPResponseRuleGetAllTCPResponseRuleDefaultsHandler tcp_response_rule.GetAllTCPResponseRuleDefaultsHandler - // BackendGetBackendHandler sets the operation handler for the get backend operation - BackendGetBackendHandler backend.GetBackendHandler - // BackendSwitchingRuleGetBackendSwitchingRuleHandler sets the operation handler for the get backend switching rule operation - BackendSwitchingRuleGetBackendSwitchingRuleHandler backend_switching_rule.GetBackendSwitchingRuleHandler - // BackendSwitchingRuleGetBackendSwitchingRulesHandler sets the operation handler for the get backend switching rules operation - BackendSwitchingRuleGetBackendSwitchingRulesHandler backend_switching_rule.GetBackendSwitchingRulesHandler - // BackendGetBackendsHandler sets the operation handler for the get backends operation - BackendGetBackendsHandler backend.GetBackendsHandler - // BindGetBindFrontendHandler sets the operation handler for the get bind frontend operation - BindGetBindFrontendHandler bind.GetBindFrontendHandler - // BindGetBindLogForwardHandler sets the operation handler for the get bind log forward operation - BindGetBindLogForwardHandler bind.GetBindLogForwardHandler - // BindGetBindPeerHandler sets the operation handler for the get bind peer operation - BindGetBindPeerHandler bind.GetBindPeerHandler - // SslRuntimeGetCaEntryHandler sets the operation handler for the get ca entry operation - SslRuntimeGetCaEntryHandler s_s_l_runtime.GetCaEntryHandler - // SslRuntimeGetCaFileHandler sets the operation handler for the get ca file operation - SslRuntimeGetCaFileHandler s_s_l_runtime.GetCaFileHandler - // CacheGetCacheHandler sets the operation handler for the get cache operation - CacheGetCacheHandler cache.GetCacheHandler - // CacheGetCachesHandler sets the operation handler for the get caches operation - CacheGetCachesHandler cache.GetCachesHandler - // SslRuntimeGetCertHandler sets the operation handler for the get cert operation - SslRuntimeGetCertHandler s_s_l_runtime.GetCertHandler - // ClusterGetClusterHandler sets the operation handler for the get cluster operation - ClusterGetClusterHandler cluster.GetClusterHandler - // DiscoveryGetConfigurationEndpointsHandler sets the operation handler for the get configuration endpoints operation - DiscoveryGetConfigurationEndpointsHandler discovery.GetConfigurationEndpointsHandler - // ConfigurationGetConfigurationVersionHandler sets the operation handler for the get configuration version operation - ConfigurationGetConfigurationVersionHandler configuration.GetConfigurationVersionHandler - // ServiceDiscoveryGetConsulHandler sets the operation handler for the get consul operation - ServiceDiscoveryGetConsulHandler service_discovery.GetConsulHandler - // ServiceDiscoveryGetConsulsHandler sets the operation handler for the get consuls operation - ServiceDiscoveryGetConsulsHandler service_discovery.GetConsulsHandler - // SslRuntimeGetCrlHandler sets the operation handler for the get crl operation - SslRuntimeGetCrlHandler s_s_l_runtime.GetCrlHandler - // CrtLoadGetCrtLoadHandler sets the operation handler for the get crt load operation - CrtLoadGetCrtLoadHandler crt_load.GetCrtLoadHandler - // CrtLoadGetCrtLoadsHandler sets the operation handler for the get crt loads operation - CrtLoadGetCrtLoadsHandler crt_load.GetCrtLoadsHandler - // CrtStoreGetCrtStoreHandler sets the operation handler for the get crt store operation - CrtStoreGetCrtStoreHandler crt_store.GetCrtStoreHandler - // CrtStoreGetCrtStoresHandler sets the operation handler for the get crt stores operation - CrtStoreGetCrtStoresHandler crt_store.GetCrtStoresHandler - // DeclareCaptureGetDeclareCaptureHandler sets the operation handler for the get declare capture operation - DeclareCaptureGetDeclareCaptureHandler declare_capture.GetDeclareCaptureHandler - // DeclareCaptureGetDeclareCapturesHandler sets the operation handler for the get declare captures operation - DeclareCaptureGetDeclareCapturesHandler declare_capture.GetDeclareCapturesHandler - // DefaultsGetDefaultsSectionHandler sets the operation handler for the get defaults section operation - DefaultsGetDefaultsSectionHandler defaults.GetDefaultsSectionHandler - // DefaultsGetDefaultsSectionsHandler sets the operation handler for the get defaults sections operation - DefaultsGetDefaultsSectionsHandler defaults.GetDefaultsSectionsHandler - // DgramBindGetDgramBindHandler sets the operation handler for the get dgram bind operation - DgramBindGetDgramBindHandler dgram_bind.GetDgramBindHandler - // DgramBindGetDgramBindsHandler sets the operation handler for the get dgram binds operation - DgramBindGetDgramBindsHandler dgram_bind.GetDgramBindsHandler - // FCGIAppGetFCGIAppHandler sets the operation handler for the get FCGI app operation - FCGIAppGetFCGIAppHandler fcgi_app.GetFCGIAppHandler - // FCGIAppGetFCGIAppsHandler sets the operation handler for the get FCGI apps operation - FCGIAppGetFCGIAppsHandler fcgi_app.GetFCGIAppsHandler - // FilterGetFilterBackendHandler sets the operation handler for the get filter backend operation - FilterGetFilterBackendHandler filter.GetFilterBackendHandler - // FilterGetFilterFrontendHandler sets the operation handler for the get filter frontend operation - FilterGetFilterFrontendHandler filter.GetFilterFrontendHandler - // FrontendGetFrontendHandler sets the operation handler for the get frontend operation - FrontendGetFrontendHandler frontend.GetFrontendHandler - // FrontendGetFrontendsHandler sets the operation handler for the get frontends operation - FrontendGetFrontendsHandler frontend.GetFrontendsHandler - // GlobalGetGlobalHandler sets the operation handler for the get global operation - GlobalGetGlobalHandler global.GetGlobalHandler - // GroupGetGroupHandler sets the operation handler for the get group operation - GroupGetGroupHandler group.GetGroupHandler - // GroupGetGroupsHandler sets the operation handler for the get groups operation - GroupGetGroupsHandler group.GetGroupsHandler - // ConfigurationGetHAProxyConfigurationHandler sets the operation handler for the get h a proxy configuration operation - ConfigurationGetHAProxyConfigurationHandler configuration.GetHAProxyConfigurationHandler - // HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler sets the operation handler for the get HTTP after response rule backend operation - HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler http_after_response_rule.GetHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleGetHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the get HTTP after response rule defaults operation - HTTPAfterResponseRuleGetHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.GetHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler sets the operation handler for the get HTTP after response rule frontend operation - HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler http_after_response_rule.GetHTTPAfterResponseRuleFrontendHandler - // HTTPCheckGetHTTPCheckBackendHandler sets the operation handler for the get HTTP check backend operation - HTTPCheckGetHTTPCheckBackendHandler http_check.GetHTTPCheckBackendHandler - // HTTPCheckGetHTTPCheckDefaultsHandler sets the operation handler for the get HTTP check defaults operation - HTTPCheckGetHTTPCheckDefaultsHandler http_check.GetHTTPCheckDefaultsHandler - // HTTPErrorRuleGetHTTPErrorRuleBackendHandler sets the operation handler for the get HTTP error rule backend operation - HTTPErrorRuleGetHTTPErrorRuleBackendHandler http_error_rule.GetHTTPErrorRuleBackendHandler - // HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler sets the operation handler for the get HTTP error rule defaults operation - HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler http_error_rule.GetHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleGetHTTPErrorRuleFrontendHandler sets the operation handler for the get HTTP error rule frontend operation - HTTPErrorRuleGetHTTPErrorRuleFrontendHandler http_error_rule.GetHTTPErrorRuleFrontendHandler - // HTTPErrorsGetHTTPErrorsSectionHandler sets the operation handler for the get HTTP errors section operation - HTTPErrorsGetHTTPErrorsSectionHandler http_errors.GetHTTPErrorsSectionHandler - // HTTPErrorsGetHTTPErrorsSectionsHandler sets the operation handler for the get HTTP errors sections operation - HTTPErrorsGetHTTPErrorsSectionsHandler http_errors.GetHTTPErrorsSectionsHandler - // HTTPRequestRuleGetHTTPRequestRuleBackendHandler sets the operation handler for the get HTTP request rule backend operation - HTTPRequestRuleGetHTTPRequestRuleBackendHandler http_request_rule.GetHTTPRequestRuleBackendHandler - // HTTPRequestRuleGetHTTPRequestRuleDefaultsHandler sets the operation handler for the get HTTP request rule defaults operation - HTTPRequestRuleGetHTTPRequestRuleDefaultsHandler http_request_rule.GetHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleGetHTTPRequestRuleFrontendHandler sets the operation handler for the get HTTP request rule frontend operation - HTTPRequestRuleGetHTTPRequestRuleFrontendHandler http_request_rule.GetHTTPRequestRuleFrontendHandler - // HTTPResponseRuleGetHTTPResponseRuleBackendHandler sets the operation handler for the get HTTP response rule backend operation - HTTPResponseRuleGetHTTPResponseRuleBackendHandler http_response_rule.GetHTTPResponseRuleBackendHandler - // HTTPResponseRuleGetHTTPResponseRuleDefaultsHandler sets the operation handler for the get HTTP response rule defaults operation - HTTPResponseRuleGetHTTPResponseRuleDefaultsHandler http_response_rule.GetHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleGetHTTPResponseRuleFrontendHandler sets the operation handler for the get HTTP response rule frontend operation - HTTPResponseRuleGetHTTPResponseRuleFrontendHandler http_response_rule.GetHTTPResponseRuleFrontendHandler - // DiscoveryGetHaproxyEndpointsHandler sets the operation handler for the get haproxy endpoints operation - DiscoveryGetHaproxyEndpointsHandler discovery.GetHaproxyEndpointsHandler - // InformationGetHaproxyProcessInfoHandler sets the operation handler for the get haproxy process info operation - InformationGetHaproxyProcessInfoHandler information.GetHaproxyProcessInfoHandler - // HealthGetHealthHandler sets the operation handler for the get health operation - HealthGetHealthHandler health.GetHealthHandler - // InformationGetInfoHandler sets the operation handler for the get info operation - InformationGetInfoHandler information.GetInfoHandler - // LogForwardGetLogForwardHandler sets the operation handler for the get log forward operation - LogForwardGetLogForwardHandler log_forward.GetLogForwardHandler - // LogForwardGetLogForwardsHandler sets the operation handler for the get log forwards operation - LogForwardGetLogForwardsHandler log_forward.GetLogForwardsHandler - // LogProfileGetLogProfileHandler sets the operation handler for the get log profile operation - LogProfileGetLogProfileHandler log_profile.GetLogProfileHandler - // LogProfileGetLogProfilesHandler sets the operation handler for the get log profiles operation - LogProfileGetLogProfilesHandler log_profile.GetLogProfilesHandler - // LogTargetGetLogTargetBackendHandler sets the operation handler for the get log target backend operation - LogTargetGetLogTargetBackendHandler log_target.GetLogTargetBackendHandler - // LogTargetGetLogTargetDefaultsHandler sets the operation handler for the get log target defaults operation - LogTargetGetLogTargetDefaultsHandler log_target.GetLogTargetDefaultsHandler - // LogTargetGetLogTargetFrontendHandler sets the operation handler for the get log target frontend operation - LogTargetGetLogTargetFrontendHandler log_target.GetLogTargetFrontendHandler - // LogTargetGetLogTargetGlobalHandler sets the operation handler for the get log target global operation - LogTargetGetLogTargetGlobalHandler log_target.GetLogTargetGlobalHandler - // LogTargetGetLogTargetLogForwardHandler sets the operation handler for the get log target log forward operation - LogTargetGetLogTargetLogForwardHandler log_target.GetLogTargetLogForwardHandler - // LogTargetGetLogTargetPeerHandler sets the operation handler for the get log target peer operation - LogTargetGetLogTargetPeerHandler log_target.GetLogTargetPeerHandler - // MailerEntryGetMailerEntriesHandler sets the operation handler for the get mailer entries operation - MailerEntryGetMailerEntriesHandler mailer_entry.GetMailerEntriesHandler - // MailerEntryGetMailerEntryHandler sets the operation handler for the get mailer entry operation - MailerEntryGetMailerEntryHandler mailer_entry.GetMailerEntryHandler - // MailersGetMailersSectionHandler sets the operation handler for the get mailers section operation - MailersGetMailersSectionHandler mailers.GetMailersSectionHandler - // MailersGetMailersSectionsHandler sets the operation handler for the get mailers sections operation - MailersGetMailersSectionsHandler mailers.GetMailersSectionsHandler - // NameserverGetNameserverHandler sets the operation handler for the get nameserver operation - NameserverGetNameserverHandler nameserver.GetNameserverHandler - // NameserverGetNameserversHandler sets the operation handler for the get nameservers operation - NameserverGetNameserversHandler nameserver.GetNameserversHandler - // MapsGetOneRuntimeMapHandler sets the operation handler for the get one runtime map operation - MapsGetOneRuntimeMapHandler maps.GetOneRuntimeMapHandler - // SpoeGetOneSpoeFileHandler sets the operation handler for the get one spoe file operation - SpoeGetOneSpoeFileHandler spoe.GetOneSpoeFileHandler - // StorageGetOneStorageGeneralFileHandler sets the operation handler for the get one storage general file operation - StorageGetOneStorageGeneralFileHandler storage.GetOneStorageGeneralFileHandler - // StorageGetOneStorageMapHandler sets the operation handler for the get one storage map operation - StorageGetOneStorageMapHandler storage.GetOneStorageMapHandler - // StorageGetOneStorageSSLCertificateHandler sets the operation handler for the get one storage s s l certificate operation - StorageGetOneStorageSSLCertificateHandler storage.GetOneStorageSSLCertificateHandler - // StorageGetOneStorageSSLCrtListFileHandler sets the operation handler for the get one storage s s l crt list file operation - StorageGetOneStorageSSLCrtListFileHandler storage.GetOneStorageSSLCrtListFileHandler - // SpecificationOpenapiv3GetOpenapiv3SpecificationHandler sets the operation handler for the get openapiv3 specification operation - SpecificationOpenapiv3GetOpenapiv3SpecificationHandler specification_openapiv3.GetOpenapiv3SpecificationHandler - // PeerEntryGetPeerEntriesHandler sets the operation handler for the get peer entries operation - PeerEntryGetPeerEntriesHandler peer_entry.GetPeerEntriesHandler - // PeerEntryGetPeerEntryHandler sets the operation handler for the get peer entry operation - PeerEntryGetPeerEntryHandler peer_entry.GetPeerEntryHandler - // PeerGetPeerSectionHandler sets the operation handler for the get peer section operation - PeerGetPeerSectionHandler peer.GetPeerSectionHandler - // PeerGetPeerSectionsHandler sets the operation handler for the get peer sections operation - PeerGetPeerSectionsHandler peer.GetPeerSectionsHandler - // ProcessManagerGetProgramHandler sets the operation handler for the get program operation - ProcessManagerGetProgramHandler process_manager.GetProgramHandler - // ProcessManagerGetProgramsHandler sets the operation handler for the get programs operation - ProcessManagerGetProgramsHandler process_manager.GetProgramsHandler - // QUICInitialRuleGetQUICInitialRuleDefaultsHandler sets the operation handler for the get QUIC initial rule defaults operation - QUICInitialRuleGetQUICInitialRuleDefaultsHandler quic_initial_rule.GetQUICInitialRuleDefaultsHandler - // QUICInitialRuleGetQUICInitialRuleFrontendHandler sets the operation handler for the get QUIC initial rule frontend operation - QUICInitialRuleGetQUICInitialRuleFrontendHandler quic_initial_rule.GetQUICInitialRuleFrontendHandler - // ReloadsGetReloadHandler sets the operation handler for the get reload operation - ReloadsGetReloadHandler reloads.GetReloadHandler - // ReloadsGetReloadsHandler sets the operation handler for the get reloads operation - ReloadsGetReloadsHandler reloads.GetReloadsHandler - // ResolverGetResolverHandler sets the operation handler for the get resolver operation - ResolverGetResolverHandler resolver.GetResolverHandler - // ResolverGetResolversHandler sets the operation handler for the get resolvers operation - ResolverGetResolversHandler resolver.GetResolversHandler - // RingGetRingHandler sets the operation handler for the get ring operation - RingGetRingHandler ring.GetRingHandler - // RingGetRingsHandler sets the operation handler for the get rings operation - RingGetRingsHandler ring.GetRingsHandler - // DiscoveryGetRuntimeEndpointsHandler sets the operation handler for the get runtime endpoints operation - DiscoveryGetRuntimeEndpointsHandler discovery.GetRuntimeEndpointsHandler - // MapsGetRuntimeMapEntryHandler sets the operation handler for the get runtime map entry operation - MapsGetRuntimeMapEntryHandler maps.GetRuntimeMapEntryHandler - // ServerGetRuntimeServerHandler sets the operation handler for the get runtime server operation - ServerGetRuntimeServerHandler serverops.GetRuntimeServerHandler - // SslFrontUseGetSSLFrontUseHandler sets the operation handler for the get s s l front use operation - SslFrontUseGetSSLFrontUseHandler s_s_l_front_use.GetSSLFrontUseHandler - // ServerGetServerBackendHandler sets the operation handler for the get server backend operation - ServerGetServerBackendHandler serverops.GetServerBackendHandler - // ServerGetServerPeerHandler sets the operation handler for the get server peer operation - ServerGetServerPeerHandler serverops.GetServerPeerHandler - // ServerGetServerRingHandler sets the operation handler for the get server ring operation - ServerGetServerRingHandler serverops.GetServerRingHandler - // ServerSwitchingRuleGetServerSwitchingRuleHandler sets the operation handler for the get server switching rule operation - ServerSwitchingRuleGetServerSwitchingRuleHandler server_switching_rule.GetServerSwitchingRuleHandler - // ServerSwitchingRuleGetServerSwitchingRulesHandler sets the operation handler for the get server switching rules operation - ServerSwitchingRuleGetServerSwitchingRulesHandler server_switching_rule.GetServerSwitchingRulesHandler - // ServerTemplateGetServerTemplateHandler sets the operation handler for the get server template operation - ServerTemplateGetServerTemplateHandler server_template.GetServerTemplateHandler - // ServerTemplateGetServerTemplatesHandler sets the operation handler for the get server templates operation - ServerTemplateGetServerTemplatesHandler server_template.GetServerTemplatesHandler - // DiscoveryGetServicesEndpointsHandler sets the operation handler for the get services endpoints operation - DiscoveryGetServicesEndpointsHandler discovery.GetServicesEndpointsHandler - // SitesGetSiteHandler sets the operation handler for the get site operation - SitesGetSiteHandler sites.GetSiteHandler - // SitesGetSitesHandler sets the operation handler for the get sites operation - SitesGetSitesHandler sites.GetSitesHandler - // SpecificationGetSpecificationHandler sets the operation handler for the get specification operation - SpecificationGetSpecificationHandler specification.GetSpecificationHandler - // SpoeGetSpoeAgentHandler sets the operation handler for the get spoe agent operation - SpoeGetSpoeAgentHandler spoe.GetSpoeAgentHandler - // SpoeGetSpoeConfigurationVersionHandler sets the operation handler for the get spoe configuration version operation - SpoeGetSpoeConfigurationVersionHandler spoe.GetSpoeConfigurationVersionHandler - // DiscoveryGetSpoeEndpointsHandler sets the operation handler for the get spoe endpoints operation - DiscoveryGetSpoeEndpointsHandler discovery.GetSpoeEndpointsHandler - // SpoeGetSpoeGroupHandler sets the operation handler for the get spoe group operation - SpoeGetSpoeGroupHandler spoe.GetSpoeGroupHandler - // SpoeGetSpoeMessageHandler sets the operation handler for the get spoe message operation - SpoeGetSpoeMessageHandler spoe.GetSpoeMessageHandler - // SpoeGetSpoeScopeHandler sets the operation handler for the get spoe scope operation - SpoeGetSpoeScopeHandler spoe.GetSpoeScopeHandler - // SpoeTransactionsGetSpoeTransactionHandler sets the operation handler for the get spoe transaction operation - SpoeTransactionsGetSpoeTransactionHandler spoe_transactions.GetSpoeTransactionHandler - // StatsGetStatsHandler sets the operation handler for the get stats operation - StatsGetStatsHandler stats.GetStatsHandler - // DiscoveryGetStatsEndpointsHandler sets the operation handler for the get stats endpoints operation - DiscoveryGetStatsEndpointsHandler discovery.GetStatsEndpointsHandler - // StickRuleGetStickRuleHandler sets the operation handler for the get stick rule operation - StickRuleGetStickRuleHandler stick_rule.GetStickRuleHandler - // StickRuleGetStickRulesHandler sets the operation handler for the get stick rules operation - StickRuleGetStickRulesHandler stick_rule.GetStickRulesHandler - // StickTableGetStickTableHandler sets the operation handler for the get stick table operation - StickTableGetStickTableHandler stick_table.GetStickTableHandler - // StickTableGetStickTableEntriesHandler sets the operation handler for the get stick table entries operation - StickTableGetStickTableEntriesHandler stick_table.GetStickTableEntriesHandler - // StickTableGetStickTablesHandler sets the operation handler for the get stick tables operation - StickTableGetStickTablesHandler stick_table.GetStickTablesHandler - // DiscoveryGetStorageEndpointsHandler sets the operation handler for the get storage endpoints operation - DiscoveryGetStorageEndpointsHandler discovery.GetStorageEndpointsHandler - // TCPCheckGetTCPCheckBackendHandler sets the operation handler for the get TCP check backend operation - TCPCheckGetTCPCheckBackendHandler tcp_check.GetTCPCheckBackendHandler - // TCPCheckGetTCPCheckDefaultsHandler sets the operation handler for the get TCP check defaults operation - TCPCheckGetTCPCheckDefaultsHandler tcp_check.GetTCPCheckDefaultsHandler - // TCPRequestRuleGetTCPRequestRuleBackendHandler sets the operation handler for the get TCP request rule backend operation - TCPRequestRuleGetTCPRequestRuleBackendHandler tcp_request_rule.GetTCPRequestRuleBackendHandler - // TCPRequestRuleGetTCPRequestRuleDefaultsHandler sets the operation handler for the get TCP request rule defaults operation - TCPRequestRuleGetTCPRequestRuleDefaultsHandler tcp_request_rule.GetTCPRequestRuleDefaultsHandler - // TCPRequestRuleGetTCPRequestRuleFrontendHandler sets the operation handler for the get TCP request rule frontend operation - TCPRequestRuleGetTCPRequestRuleFrontendHandler tcp_request_rule.GetTCPRequestRuleFrontendHandler - // TCPResponseRuleGetTCPResponseRuleBackendHandler sets the operation handler for the get TCP response rule backend operation - TCPResponseRuleGetTCPResponseRuleBackendHandler tcp_response_rule.GetTCPResponseRuleBackendHandler - // TCPResponseRuleGetTCPResponseRuleDefaultsHandler sets the operation handler for the get TCP response rule defaults operation - TCPResponseRuleGetTCPResponseRuleDefaultsHandler tcp_response_rule.GetTCPResponseRuleDefaultsHandler - // TableGetTableHandler sets the operation handler for the get table operation - TableGetTableHandler table.GetTableHandler - // TableGetTablesHandler sets the operation handler for the get tables operation - TableGetTablesHandler table.GetTablesHandler - // TracesGetTracesHandler sets the operation handler for the get traces operation - TracesGetTracesHandler traces.GetTracesHandler - // TransactionsGetTransactionHandler sets the operation handler for the get transaction operation - TransactionsGetTransactionHandler transactions.GetTransactionHandler - // TransactionsGetTransactionsHandler sets the operation handler for the get transactions operation - TransactionsGetTransactionsHandler transactions.GetTransactionsHandler - // UserGetUserHandler sets the operation handler for the get user operation - UserGetUserHandler user.GetUserHandler - // UserlistGetUserlistHandler sets the operation handler for the get userlist operation - UserlistGetUserlistHandler userlist.GetUserlistHandler - // UserlistGetUserlistsHandler sets the operation handler for the get userlists operation - UserlistGetUserlistsHandler userlist.GetUserlistsHandler - // UserGetUsersHandler sets the operation handler for the get users operation - UserGetUsersHandler user.GetUsersHandler - // ClusterInitiateCertificateRefreshHandler sets the operation handler for the initiate certificate refresh operation - ClusterInitiateCertificateRefreshHandler cluster.InitiateCertificateRefreshHandler - // ClusterPostClusterHandler sets the operation handler for the post cluster operation - ClusterPostClusterHandler cluster.PostClusterHandler - // ConfigurationPostHAProxyConfigurationHandler sets the operation handler for the post h a proxy configuration operation - ConfigurationPostHAProxyConfigurationHandler configuration.PostHAProxyConfigurationHandler - // AcmeRuntimeRenewAcmeCertificateHandler sets the operation handler for the renew acme certificate operation - AcmeRuntimeRenewAcmeCertificateHandler acme_runtime.RenewAcmeCertificateHandler - // ServiceDiscoveryReplaceAWSRegionHandler sets the operation handler for the replace a w s region operation - ServiceDiscoveryReplaceAWSRegionHandler service_discovery.ReplaceAWSRegionHandler - // ACLReplaceACLBackendHandler sets the operation handler for the replace Acl backend operation - ACLReplaceACLBackendHandler acl.ReplaceACLBackendHandler - // ACLReplaceACLDefaultsHandler sets the operation handler for the replace Acl defaults operation - ACLReplaceACLDefaultsHandler acl.ReplaceACLDefaultsHandler - // ACLReplaceACLFCGIAppHandler sets the operation handler for the replace Acl FCGI app operation - ACLReplaceACLFCGIAppHandler acl.ReplaceACLFCGIAppHandler - // ACLReplaceACLFrontendHandler sets the operation handler for the replace Acl frontend operation - ACLReplaceACLFrontendHandler acl.ReplaceACLFrontendHandler - // ACLReplaceAllACLBackendHandler sets the operation handler for the replace all Acl backend operation - ACLReplaceAllACLBackendHandler acl.ReplaceAllACLBackendHandler - // ACLReplaceAllACLDefaultsHandler sets the operation handler for the replace all Acl defaults operation - ACLReplaceAllACLDefaultsHandler acl.ReplaceAllACLDefaultsHandler - // ACLReplaceAllACLFCGIAppHandler sets the operation handler for the replace all Acl FCGI app operation - ACLReplaceAllACLFCGIAppHandler acl.ReplaceAllACLFCGIAppHandler - // ACLReplaceAllACLFrontendHandler sets the operation handler for the replace all Acl frontend operation - ACLReplaceAllACLFrontendHandler acl.ReplaceAllACLFrontendHandler - // FilterReplaceAllFilterBackendHandler sets the operation handler for the replace all filter backend operation - FilterReplaceAllFilterBackendHandler filter.ReplaceAllFilterBackendHandler - // FilterReplaceAllFilterFrontendHandler sets the operation handler for the replace all filter frontend operation - FilterReplaceAllFilterFrontendHandler filter.ReplaceAllFilterFrontendHandler - // HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler sets the operation handler for the replace all HTTP after response rule backend operation - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the replace all HTTP after response rule defaults operation - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler sets the operation handler for the replace all HTTP after response rule frontend operation - HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontendHandler - // HTTPCheckReplaceAllHTTPCheckBackendHandler sets the operation handler for the replace all HTTP check backend operation - HTTPCheckReplaceAllHTTPCheckBackendHandler http_check.ReplaceAllHTTPCheckBackendHandler - // HTTPCheckReplaceAllHTTPCheckDefaultsHandler sets the operation handler for the replace all HTTP check defaults operation - HTTPCheckReplaceAllHTTPCheckDefaultsHandler http_check.ReplaceAllHTTPCheckDefaultsHandler - // HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler sets the operation handler for the replace all HTTP error rule backend operation - HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler http_error_rule.ReplaceAllHTTPErrorRuleBackendHandler - // HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler sets the operation handler for the replace all HTTP error rule defaults operation - HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler http_error_rule.ReplaceAllHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler sets the operation handler for the replace all HTTP error rule frontend operation - HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler http_error_rule.ReplaceAllHTTPErrorRuleFrontendHandler - // HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler sets the operation handler for the replace all HTTP request rule backend operation - HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler http_request_rule.ReplaceAllHTTPRequestRuleBackendHandler - // HTTPRequestRuleReplaceAllHTTPRequestRuleDefaultsHandler sets the operation handler for the replace all HTTP request rule defaults operation - HTTPRequestRuleReplaceAllHTTPRequestRuleDefaultsHandler http_request_rule.ReplaceAllHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler sets the operation handler for the replace all HTTP request rule frontend operation - HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler http_request_rule.ReplaceAllHTTPRequestRuleFrontendHandler - // HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler sets the operation handler for the replace all HTTP response rule backend operation - HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler http_response_rule.ReplaceAllHTTPResponseRuleBackendHandler - // HTTPResponseRuleReplaceAllHTTPResponseRuleDefaultsHandler sets the operation handler for the replace all HTTP response rule defaults operation - HTTPResponseRuleReplaceAllHTTPResponseRuleDefaultsHandler http_response_rule.ReplaceAllHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler sets the operation handler for the replace all HTTP response rule frontend operation - HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler http_response_rule.ReplaceAllHTTPResponseRuleFrontendHandler - // LogTargetReplaceAllLogTargetBackendHandler sets the operation handler for the replace all log target backend operation - LogTargetReplaceAllLogTargetBackendHandler log_target.ReplaceAllLogTargetBackendHandler - // LogTargetReplaceAllLogTargetDefaultsHandler sets the operation handler for the replace all log target defaults operation - LogTargetReplaceAllLogTargetDefaultsHandler log_target.ReplaceAllLogTargetDefaultsHandler - // LogTargetReplaceAllLogTargetFrontendHandler sets the operation handler for the replace all log target frontend operation - LogTargetReplaceAllLogTargetFrontendHandler log_target.ReplaceAllLogTargetFrontendHandler - // LogTargetReplaceAllLogTargetGlobalHandler sets the operation handler for the replace all log target global operation - LogTargetReplaceAllLogTargetGlobalHandler log_target.ReplaceAllLogTargetGlobalHandler - // LogTargetReplaceAllLogTargetLogForwardHandler sets the operation handler for the replace all log target log forward operation - LogTargetReplaceAllLogTargetLogForwardHandler log_target.ReplaceAllLogTargetLogForwardHandler - // LogTargetReplaceAllLogTargetPeerHandler sets the operation handler for the replace all log target peer operation - LogTargetReplaceAllLogTargetPeerHandler log_target.ReplaceAllLogTargetPeerHandler - // QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler sets the operation handler for the replace all QUIC initial rule defaults operation - QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsHandler - // QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler sets the operation handler for the replace all QUIC initial rule frontend operation - QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler quic_initial_rule.ReplaceAllQUICInitialRuleFrontendHandler - // TCPCheckReplaceAllTCPCheckBackendHandler sets the operation handler for the replace all TCP check backend operation - TCPCheckReplaceAllTCPCheckBackendHandler tcp_check.ReplaceAllTCPCheckBackendHandler - // TCPCheckReplaceAllTCPCheckDefaultsHandler sets the operation handler for the replace all TCP check defaults operation - TCPCheckReplaceAllTCPCheckDefaultsHandler tcp_check.ReplaceAllTCPCheckDefaultsHandler - // TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler sets the operation handler for the replace all TCP request rule backend operation - TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler tcp_request_rule.ReplaceAllTCPRequestRuleBackendHandler - // TCPRequestRuleReplaceAllTCPRequestRuleDefaultsHandler sets the operation handler for the replace all TCP request rule defaults operation - TCPRequestRuleReplaceAllTCPRequestRuleDefaultsHandler tcp_request_rule.ReplaceAllTCPRequestRuleDefaultsHandler - // TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler sets the operation handler for the replace all TCP request rule frontend operation - TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler tcp_request_rule.ReplaceAllTCPRequestRuleFrontendHandler - // TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler sets the operation handler for the replace all TCP response rule backend operation - TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler tcp_response_rule.ReplaceAllTCPResponseRuleBackendHandler - // TCPResponseRuleReplaceAllTCPResponseRuleDefaultsHandler sets the operation handler for the replace all TCP response rule defaults operation - TCPResponseRuleReplaceAllTCPResponseRuleDefaultsHandler tcp_response_rule.ReplaceAllTCPResponseRuleDefaultsHandler - // BackendReplaceBackendHandler sets the operation handler for the replace backend operation - BackendReplaceBackendHandler backend.ReplaceBackendHandler - // BackendSwitchingRuleReplaceBackendSwitchingRuleHandler sets the operation handler for the replace backend switching rule operation - BackendSwitchingRuleReplaceBackendSwitchingRuleHandler backend_switching_rule.ReplaceBackendSwitchingRuleHandler - // BackendSwitchingRuleReplaceBackendSwitchingRulesHandler sets the operation handler for the replace backend switching rules operation - BackendSwitchingRuleReplaceBackendSwitchingRulesHandler backend_switching_rule.ReplaceBackendSwitchingRulesHandler - // BindReplaceBindFrontendHandler sets the operation handler for the replace bind frontend operation - BindReplaceBindFrontendHandler bind.ReplaceBindFrontendHandler - // BindReplaceBindLogForwardHandler sets the operation handler for the replace bind log forward operation - BindReplaceBindLogForwardHandler bind.ReplaceBindLogForwardHandler - // BindReplaceBindPeerHandler sets the operation handler for the replace bind peer operation - BindReplaceBindPeerHandler bind.ReplaceBindPeerHandler - // CacheReplaceCacheHandler sets the operation handler for the replace cache operation - CacheReplaceCacheHandler cache.ReplaceCacheHandler - // SslRuntimeReplaceCertHandler sets the operation handler for the replace cert operation - SslRuntimeReplaceCertHandler s_s_l_runtime.ReplaceCertHandler - // ServiceDiscoveryReplaceConsulHandler sets the operation handler for the replace consul operation - ServiceDiscoveryReplaceConsulHandler service_discovery.ReplaceConsulHandler - // SslRuntimeReplaceCrlHandler sets the operation handler for the replace crl operation - SslRuntimeReplaceCrlHandler s_s_l_runtime.ReplaceCrlHandler - // CrtLoadReplaceCrtLoadHandler sets the operation handler for the replace crt load operation - CrtLoadReplaceCrtLoadHandler crt_load.ReplaceCrtLoadHandler - // DeclareCaptureReplaceDeclareCaptureHandler sets the operation handler for the replace declare capture operation - DeclareCaptureReplaceDeclareCaptureHandler declare_capture.ReplaceDeclareCaptureHandler - // DeclareCaptureReplaceDeclareCapturesHandler sets the operation handler for the replace declare captures operation - DeclareCaptureReplaceDeclareCapturesHandler declare_capture.ReplaceDeclareCapturesHandler - // DefaultsReplaceDefaultsSectionHandler sets the operation handler for the replace defaults section operation - DefaultsReplaceDefaultsSectionHandler defaults.ReplaceDefaultsSectionHandler - // DgramBindReplaceDgramBindHandler sets the operation handler for the replace dgram bind operation - DgramBindReplaceDgramBindHandler dgram_bind.ReplaceDgramBindHandler - // FCGIAppReplaceFCGIAppHandler sets the operation handler for the replace FCGI app operation - FCGIAppReplaceFCGIAppHandler fcgi_app.ReplaceFCGIAppHandler - // FilterReplaceFilterBackendHandler sets the operation handler for the replace filter backend operation - FilterReplaceFilterBackendHandler filter.ReplaceFilterBackendHandler - // FilterReplaceFilterFrontendHandler sets the operation handler for the replace filter frontend operation - FilterReplaceFilterFrontendHandler filter.ReplaceFilterFrontendHandler - // FrontendReplaceFrontendHandler sets the operation handler for the replace frontend operation - FrontendReplaceFrontendHandler frontend.ReplaceFrontendHandler - // GlobalReplaceGlobalHandler sets the operation handler for the replace global operation - GlobalReplaceGlobalHandler global.ReplaceGlobalHandler - // GroupReplaceGroupHandler sets the operation handler for the replace group operation - GroupReplaceGroupHandler group.ReplaceGroupHandler - // HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler sets the operation handler for the replace HTTP after response rule backend operation - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendHandler - // HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleDefaultsHandler sets the operation handler for the replace HTTP after response rule defaults operation - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleDefaultsHandler http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaultsHandler - // HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler sets the operation handler for the replace HTTP after response rule frontend operation - HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontendHandler - // HTTPCheckReplaceHTTPCheckBackendHandler sets the operation handler for the replace HTTP check backend operation - HTTPCheckReplaceHTTPCheckBackendHandler http_check.ReplaceHTTPCheckBackendHandler - // HTTPCheckReplaceHTTPCheckDefaultsHandler sets the operation handler for the replace HTTP check defaults operation - HTTPCheckReplaceHTTPCheckDefaultsHandler http_check.ReplaceHTTPCheckDefaultsHandler - // HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler sets the operation handler for the replace HTTP error rule backend operation - HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler http_error_rule.ReplaceHTTPErrorRuleBackendHandler - // HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler sets the operation handler for the replace HTTP error rule defaults operation - HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler http_error_rule.ReplaceHTTPErrorRuleDefaultsHandler - // HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler sets the operation handler for the replace HTTP error rule frontend operation - HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler http_error_rule.ReplaceHTTPErrorRuleFrontendHandler - // HTTPErrorsReplaceHTTPErrorsSectionHandler sets the operation handler for the replace HTTP errors section operation - HTTPErrorsReplaceHTTPErrorsSectionHandler http_errors.ReplaceHTTPErrorsSectionHandler - // HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler sets the operation handler for the replace HTTP request rule backend operation - HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler http_request_rule.ReplaceHTTPRequestRuleBackendHandler - // HTTPRequestRuleReplaceHTTPRequestRuleDefaultsHandler sets the operation handler for the replace HTTP request rule defaults operation - HTTPRequestRuleReplaceHTTPRequestRuleDefaultsHandler http_request_rule.ReplaceHTTPRequestRuleDefaultsHandler - // HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler sets the operation handler for the replace HTTP request rule frontend operation - HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler http_request_rule.ReplaceHTTPRequestRuleFrontendHandler - // HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler sets the operation handler for the replace HTTP response rule backend operation - HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler http_response_rule.ReplaceHTTPResponseRuleBackendHandler - // HTTPResponseRuleReplaceHTTPResponseRuleDefaultsHandler sets the operation handler for the replace HTTP response rule defaults operation - HTTPResponseRuleReplaceHTTPResponseRuleDefaultsHandler http_response_rule.ReplaceHTTPResponseRuleDefaultsHandler - // HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler sets the operation handler for the replace HTTP response rule frontend operation - HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler http_response_rule.ReplaceHTTPResponseRuleFrontendHandler - // LogForwardReplaceLogForwardHandler sets the operation handler for the replace log forward operation - LogForwardReplaceLogForwardHandler log_forward.ReplaceLogForwardHandler - // LogTargetReplaceLogTargetBackendHandler sets the operation handler for the replace log target backend operation - LogTargetReplaceLogTargetBackendHandler log_target.ReplaceLogTargetBackendHandler - // LogTargetReplaceLogTargetDefaultsHandler sets the operation handler for the replace log target defaults operation - LogTargetReplaceLogTargetDefaultsHandler log_target.ReplaceLogTargetDefaultsHandler - // LogTargetReplaceLogTargetFrontendHandler sets the operation handler for the replace log target frontend operation - LogTargetReplaceLogTargetFrontendHandler log_target.ReplaceLogTargetFrontendHandler - // LogTargetReplaceLogTargetGlobalHandler sets the operation handler for the replace log target global operation - LogTargetReplaceLogTargetGlobalHandler log_target.ReplaceLogTargetGlobalHandler - // LogTargetReplaceLogTargetLogForwardHandler sets the operation handler for the replace log target log forward operation - LogTargetReplaceLogTargetLogForwardHandler log_target.ReplaceLogTargetLogForwardHandler - // LogTargetReplaceLogTargetPeerHandler sets the operation handler for the replace log target peer operation - LogTargetReplaceLogTargetPeerHandler log_target.ReplaceLogTargetPeerHandler - // MailerEntryReplaceMailerEntryHandler sets the operation handler for the replace mailer entry operation - MailerEntryReplaceMailerEntryHandler mailer_entry.ReplaceMailerEntryHandler - // NameserverReplaceNameserverHandler sets the operation handler for the replace nameserver operation - NameserverReplaceNameserverHandler nameserver.ReplaceNameserverHandler - // PeerEntryReplacePeerEntryHandler sets the operation handler for the replace peer entry operation - PeerEntryReplacePeerEntryHandler peer_entry.ReplacePeerEntryHandler - // ProcessManagerReplaceProgramHandler sets the operation handler for the replace program operation - ProcessManagerReplaceProgramHandler process_manager.ReplaceProgramHandler - // QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler sets the operation handler for the replace QUIC initial rule defaults operation - QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler quic_initial_rule.ReplaceQUICInitialRuleDefaultsHandler - // QUICInitialRuleReplaceQUICInitialRuleFrontendHandler sets the operation handler for the replace QUIC initial rule frontend operation - QUICInitialRuleReplaceQUICInitialRuleFrontendHandler quic_initial_rule.ReplaceQUICInitialRuleFrontendHandler - // ResolverReplaceResolverHandler sets the operation handler for the replace resolver operation - ResolverReplaceResolverHandler resolver.ReplaceResolverHandler - // RingReplaceRingHandler sets the operation handler for the replace ring operation - RingReplaceRingHandler ring.ReplaceRingHandler - // MapsReplaceRuntimeMapEntryHandler sets the operation handler for the replace runtime map entry operation - MapsReplaceRuntimeMapEntryHandler maps.ReplaceRuntimeMapEntryHandler - // ServerReplaceRuntimeServerHandler sets the operation handler for the replace runtime server operation - ServerReplaceRuntimeServerHandler serverops.ReplaceRuntimeServerHandler - // SslFrontUseReplaceSSLFrontUseHandler sets the operation handler for the replace s s l front use operation - SslFrontUseReplaceSSLFrontUseHandler s_s_l_front_use.ReplaceSSLFrontUseHandler - // ServerReplaceServerBackendHandler sets the operation handler for the replace server backend operation - ServerReplaceServerBackendHandler serverops.ReplaceServerBackendHandler - // ServerReplaceServerPeerHandler sets the operation handler for the replace server peer operation - ServerReplaceServerPeerHandler serverops.ReplaceServerPeerHandler - // ServerReplaceServerRingHandler sets the operation handler for the replace server ring operation - ServerReplaceServerRingHandler serverops.ReplaceServerRingHandler - // ServerSwitchingRuleReplaceServerSwitchingRuleHandler sets the operation handler for the replace server switching rule operation - ServerSwitchingRuleReplaceServerSwitchingRuleHandler server_switching_rule.ReplaceServerSwitchingRuleHandler - // ServerSwitchingRuleReplaceServerSwitchingRulesHandler sets the operation handler for the replace server switching rules operation - ServerSwitchingRuleReplaceServerSwitchingRulesHandler server_switching_rule.ReplaceServerSwitchingRulesHandler - // ServerTemplateReplaceServerTemplateHandler sets the operation handler for the replace server template operation - ServerTemplateReplaceServerTemplateHandler server_template.ReplaceServerTemplateHandler - // SitesReplaceSiteHandler sets the operation handler for the replace site operation - SitesReplaceSiteHandler sites.ReplaceSiteHandler - // SpoeReplaceSpoeAgentHandler sets the operation handler for the replace spoe agent operation - SpoeReplaceSpoeAgentHandler spoe.ReplaceSpoeAgentHandler - // SpoeReplaceSpoeGroupHandler sets the operation handler for the replace spoe group operation - SpoeReplaceSpoeGroupHandler spoe.ReplaceSpoeGroupHandler - // SpoeReplaceSpoeMessageHandler sets the operation handler for the replace spoe message operation - SpoeReplaceSpoeMessageHandler spoe.ReplaceSpoeMessageHandler - // StickRuleReplaceStickRuleHandler sets the operation handler for the replace stick rule operation - StickRuleReplaceStickRuleHandler stick_rule.ReplaceStickRuleHandler - // StickRuleReplaceStickRulesHandler sets the operation handler for the replace stick rules operation - StickRuleReplaceStickRulesHandler stick_rule.ReplaceStickRulesHandler - // StorageReplaceStorageGeneralFileHandler sets the operation handler for the replace storage general file operation - StorageReplaceStorageGeneralFileHandler storage.ReplaceStorageGeneralFileHandler - // StorageReplaceStorageMapFileHandler sets the operation handler for the replace storage map file operation - StorageReplaceStorageMapFileHandler storage.ReplaceStorageMapFileHandler - // StorageReplaceStorageSSLCertificateHandler sets the operation handler for the replace storage s s l certificate operation - StorageReplaceStorageSSLCertificateHandler storage.ReplaceStorageSSLCertificateHandler - // StorageReplaceStorageSSLCrtListFileHandler sets the operation handler for the replace storage s s l crt list file operation - StorageReplaceStorageSSLCrtListFileHandler storage.ReplaceStorageSSLCrtListFileHandler - // TCPCheckReplaceTCPCheckBackendHandler sets the operation handler for the replace TCP check backend operation - TCPCheckReplaceTCPCheckBackendHandler tcp_check.ReplaceTCPCheckBackendHandler - // TCPCheckReplaceTCPCheckDefaultsHandler sets the operation handler for the replace TCP check defaults operation - TCPCheckReplaceTCPCheckDefaultsHandler tcp_check.ReplaceTCPCheckDefaultsHandler - // TCPRequestRuleReplaceTCPRequestRuleBackendHandler sets the operation handler for the replace TCP request rule backend operation - TCPRequestRuleReplaceTCPRequestRuleBackendHandler tcp_request_rule.ReplaceTCPRequestRuleBackendHandler - // TCPRequestRuleReplaceTCPRequestRuleDefaultsHandler sets the operation handler for the replace TCP request rule defaults operation - TCPRequestRuleReplaceTCPRequestRuleDefaultsHandler tcp_request_rule.ReplaceTCPRequestRuleDefaultsHandler - // TCPRequestRuleReplaceTCPRequestRuleFrontendHandler sets the operation handler for the replace TCP request rule frontend operation - TCPRequestRuleReplaceTCPRequestRuleFrontendHandler tcp_request_rule.ReplaceTCPRequestRuleFrontendHandler - // TCPResponseRuleReplaceTCPResponseRuleBackendHandler sets the operation handler for the replace TCP response rule backend operation - TCPResponseRuleReplaceTCPResponseRuleBackendHandler tcp_response_rule.ReplaceTCPResponseRuleBackendHandler - // TCPResponseRuleReplaceTCPResponseRuleDefaultsHandler sets the operation handler for the replace TCP response rule defaults operation - TCPResponseRuleReplaceTCPResponseRuleDefaultsHandler tcp_response_rule.ReplaceTCPResponseRuleDefaultsHandler - // TableReplaceTableHandler sets the operation handler for the replace table operation - TableReplaceTableHandler table.ReplaceTableHandler - // TracesReplaceTracesHandler sets the operation handler for the replace traces operation - TracesReplaceTracesHandler traces.ReplaceTracesHandler - // UserReplaceUserHandler sets the operation handler for the replace user operation - UserReplaceUserHandler user.ReplaceUserHandler - // SslRuntimeSetCaFileHandler sets the operation handler for the set ca file operation - SslRuntimeSetCaFileHandler s_s_l_runtime.SetCaFileHandler - // StickTableSetStickTableEntriesHandler sets the operation handler for the set stick table entries operation - StickTableSetStickTableEntriesHandler stick_table.SetStickTableEntriesHandler - // MapsShowRuntimeMapHandler sets the operation handler for the show runtime map operation - MapsShowRuntimeMapHandler maps.ShowRuntimeMapHandler - // SpoeTransactionsStartSpoeTransactionHandler sets the operation handler for the start spoe transaction operation - SpoeTransactionsStartSpoeTransactionHandler spoe_transactions.StartSpoeTransactionHandler - // TransactionsStartTransactionHandler sets the operation handler for the start transaction operation - TransactionsStartTransactionHandler transactions.StartTransactionHandler - - // ServeError is called when an error is received, there is a default handler - // but you can set your own with this - ServeError func(http.ResponseWriter, *http.Request, error) - - // PreServerShutdown is called before the HTTP(S) server is shutdown - // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic - PreServerShutdown func() - - // ServerShutdown is called when the HTTP(S) server is shut down and done - // handling all active connections and does not accept connections any more - ServerShutdown func() - - // Custom command line argument groups with their descriptions - CommandLineOptionsGroups []swag.CommandLineOptionsGroup - - // User defined logger function. - Logger func(string, ...interface{}) -} - -// UseRedoc for documentation at /docs -func (o *DataPlaneAPI) UseRedoc() { - o.useSwaggerUI = false -} - -// UseSwaggerUI for documentation at /docs -func (o *DataPlaneAPI) UseSwaggerUI() { - o.useSwaggerUI = true -} - -// SetDefaultProduces sets the default produces media type -func (o *DataPlaneAPI) SetDefaultProduces(mediaType string) { - o.defaultProduces = mediaType -} - -// SetDefaultConsumes returns the default consumes media type -func (o *DataPlaneAPI) SetDefaultConsumes(mediaType string) { - o.defaultConsumes = mediaType -} - -// SetSpec sets a spec that will be served for the clients. -func (o *DataPlaneAPI) SetSpec(spec *loads.Document) { - o.spec = spec -} - -// DefaultProduces returns the default produces media type -func (o *DataPlaneAPI) DefaultProduces() string { - return o.defaultProduces -} - -// DefaultConsumes returns the default consumes media type -func (o *DataPlaneAPI) DefaultConsumes() string { - return o.defaultConsumes -} - -// Formats returns the registered string formats -func (o *DataPlaneAPI) Formats() strfmt.Registry { - return o.formats -} - -// RegisterFormat registers a custom format validator -func (o *DataPlaneAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { - o.formats.Add(name, format, validator) -} - -// Validate validates the registrations in the DataPlaneAPI -func (o *DataPlaneAPI) Validate() error { - var unregistered []string - - if o.JSONConsumer == nil { - unregistered = append(unregistered, "JSONConsumer") - } - if o.MultipartformConsumer == nil { - unregistered = append(unregistered, "MultipartformConsumer") - } - if o.TxtConsumer == nil { - unregistered = append(unregistered, "TxtConsumer") - } - - if o.BinProducer == nil { - unregistered = append(unregistered, "BinProducer") - } - if o.JSONProducer == nil { - unregistered = append(unregistered, "JSONProducer") - } - if o.TxtProducer == nil { - unregistered = append(unregistered, "TxtProducer") - } - - if o.BasicAuthAuth == nil { - unregistered = append(unregistered, "BasicAuthAuth") - } - - if o.StorageCreateStorageSSLCrtListEntryHandler == nil { - unregistered = append(unregistered, "storage.CreateStorageSSLCrtListEntryHandler") - } - if o.ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler == nil { - unregistered = append(unregistered, "acl_runtime.DeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler") - } - if o.StorageDeleteStorageSSLCrtListEntryHandler == nil { - unregistered = append(unregistered, "storage.DeleteStorageSSLCrtListEntryHandler") - } - if o.ACLRuntimeGetServicesHaproxyRuntimeAclsHandler == nil { - unregistered = append(unregistered, "acl_runtime.GetServicesHaproxyRuntimeAclsHandler") - } - if o.ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler == nil { - unregistered = append(unregistered, "acl_runtime.GetServicesHaproxyRuntimeAclsIDHandler") - } - if o.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler == nil { - unregistered = append(unregistered, "acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesHandler") - } - if o.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler == nil { - unregistered = append(unregistered, "acl_runtime.GetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler") - } - if o.StorageGetStorageSSLCrtListEntriesHandler == nil { - unregistered = append(unregistered, "storage.GetStorageSSLCrtListEntriesHandler") - } - if o.ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler == nil { - unregistered = append(unregistered, "acl_runtime.PostServicesHaproxyRuntimeAclsParentNameEntriesHandler") - } - if o.SslRuntimeAddCaEntryHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.AddCaEntryHandler") - } - if o.SslRuntimeAddCrtListEntryHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.AddCrtListEntryHandler") - } - if o.DefaultsAddDefaultsSectionHandler == nil { - unregistered = append(unregistered, "defaults.AddDefaultsSectionHandler") - } - if o.MapsAddMapEntryHandler == nil { - unregistered = append(unregistered, "maps.AddMapEntryHandler") - } - if o.ACLRuntimeAddPayloadRuntimeACLHandler == nil { - unregistered = append(unregistered, "acl_runtime.AddPayloadRuntimeACLHandler") - } - if o.MapsAddPayloadRuntimeMapHandler == nil { - unregistered = append(unregistered, "maps.AddPayloadRuntimeMapHandler") - } - if o.ServerAddRuntimeServerHandler == nil { - unregistered = append(unregistered, "server.AddRuntimeServerHandler") - } - if o.MapsClearRuntimeMapHandler == nil { - unregistered = append(unregistered, "maps.ClearRuntimeMapHandler") - } - if o.SpoeTransactionsCommitSpoeTransactionHandler == nil { - unregistered = append(unregistered, "spoe_transactions.CommitSpoeTransactionHandler") - } - if o.TransactionsCommitTransactionHandler == nil { - unregistered = append(unregistered, "transactions.CommitTransactionHandler") - } - if o.ServiceDiscoveryCreateAWSRegionHandler == nil { - unregistered = append(unregistered, "service_discovery.CreateAWSRegionHandler") - } - if o.ACLCreateACLBackendHandler == nil { - unregistered = append(unregistered, "acl.CreateACLBackendHandler") - } - if o.ACLCreateACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.CreateACLDefaultsHandler") - } - if o.ACLCreateACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.CreateACLFCGIAppHandler") - } - if o.ACLCreateACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.CreateACLFrontendHandler") - } - if o.AcmeCreateAcmeProviderHandler == nil { - unregistered = append(unregistered, "acme.CreateAcmeProviderHandler") - } - if o.BackendCreateBackendHandler == nil { - unregistered = append(unregistered, "backend.CreateBackendHandler") - } - if o.BackendSwitchingRuleCreateBackendSwitchingRuleHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.CreateBackendSwitchingRuleHandler") - } - if o.BindCreateBindFrontendHandler == nil { - unregistered = append(unregistered, "bind.CreateBindFrontendHandler") - } - if o.BindCreateBindLogForwardHandler == nil { - unregistered = append(unregistered, "bind.CreateBindLogForwardHandler") - } - if o.BindCreateBindPeerHandler == nil { - unregistered = append(unregistered, "bind.CreateBindPeerHandler") - } - if o.SslRuntimeCreateCaFileHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.CreateCaFileHandler") - } - if o.CacheCreateCacheHandler == nil { - unregistered = append(unregistered, "cache.CreateCacheHandler") - } - if o.SslRuntimeCreateCertHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.CreateCertHandler") - } - if o.ServiceDiscoveryCreateConsulHandler == nil { - unregistered = append(unregistered, "service_discovery.CreateConsulHandler") - } - if o.SslRuntimeCreateCrlHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.CreateCrlHandler") - } - if o.CrtLoadCreateCrtLoadHandler == nil { - unregistered = append(unregistered, "crt_load.CreateCrtLoadHandler") - } - if o.CrtStoreCreateCrtStoreHandler == nil { - unregistered = append(unregistered, "crt_store.CreateCrtStoreHandler") - } - if o.DeclareCaptureCreateDeclareCaptureHandler == nil { - unregistered = append(unregistered, "declare_capture.CreateDeclareCaptureHandler") - } - if o.DefaultsCreateDefaultsSectionHandler == nil { - unregistered = append(unregistered, "defaults.CreateDefaultsSectionHandler") - } - if o.DgramBindCreateDgramBindHandler == nil { - unregistered = append(unregistered, "dgram_bind.CreateDgramBindHandler") - } - if o.FCGIAppCreateFCGIAppHandler == nil { - unregistered = append(unregistered, "fcgi_app.CreateFCGIAppHandler") - } - if o.FilterCreateFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.CreateFilterBackendHandler") - } - if o.FilterCreateFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.CreateFilterFrontendHandler") - } - if o.FrontendCreateFrontendHandler == nil { - unregistered = append(unregistered, "frontend.CreateFrontendHandler") - } - if o.GroupCreateGroupHandler == nil { - unregistered = append(unregistered, "group.CreateGroupHandler") - } - if o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.CreateHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.CreateHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.CreateHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckCreateHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.CreateHTTPCheckBackendHandler") - } - if o.HTTPCheckCreateHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.CreateHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleCreateHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.CreateHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.CreateHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.CreateHTTPErrorRuleFrontendHandler") - } - if o.HTTPErrorsCreateHTTPErrorsSectionHandler == nil { - unregistered = append(unregistered, "http_errors.CreateHTTPErrorsSectionHandler") - } - if o.HTTPRequestRuleCreateHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.CreateHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleCreateHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.CreateHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.CreateHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleCreateHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.CreateHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleCreateHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.CreateHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.CreateHTTPResponseRuleFrontendHandler") - } - if o.LogForwardCreateLogForwardHandler == nil { - unregistered = append(unregistered, "log_forward.CreateLogForwardHandler") - } - if o.LogProfileCreateLogProfileHandler == nil { - unregistered = append(unregistered, "log_profile.CreateLogProfileHandler") - } - if o.LogTargetCreateLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetBackendHandler") - } - if o.LogTargetCreateLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetDefaultsHandler") - } - if o.LogTargetCreateLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetFrontendHandler") - } - if o.LogTargetCreateLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetGlobalHandler") - } - if o.LogTargetCreateLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetLogForwardHandler") - } - if o.LogTargetCreateLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.CreateLogTargetPeerHandler") - } - if o.MailerEntryCreateMailerEntryHandler == nil { - unregistered = append(unregistered, "mailer_entry.CreateMailerEntryHandler") - } - if o.MailersCreateMailersSectionHandler == nil { - unregistered = append(unregistered, "mailers.CreateMailersSectionHandler") - } - if o.NameserverCreateNameserverHandler == nil { - unregistered = append(unregistered, "nameserver.CreateNameserverHandler") - } - if o.PeerCreatePeerHandler == nil { - unregistered = append(unregistered, "peer.CreatePeerHandler") - } - if o.PeerEntryCreatePeerEntryHandler == nil { - unregistered = append(unregistered, "peer_entry.CreatePeerEntryHandler") - } - if o.ProcessManagerCreateProgramHandler == nil { - unregistered = append(unregistered, "process_manager.CreateProgramHandler") - } - if o.QUICInitialRuleCreateQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.CreateQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleCreateQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.CreateQUICInitialRuleFrontendHandler") - } - if o.ResolverCreateResolverHandler == nil { - unregistered = append(unregistered, "resolver.CreateResolverHandler") - } - if o.RingCreateRingHandler == nil { - unregistered = append(unregistered, "ring.CreateRingHandler") - } - if o.SslFrontUseCreateSSLFrontUseHandler == nil { - unregistered = append(unregistered, "s_s_l_front_use.CreateSSLFrontUseHandler") - } - if o.ServerCreateServerBackendHandler == nil { - unregistered = append(unregistered, "server.CreateServerBackendHandler") - } - if o.ServerCreateServerPeerHandler == nil { - unregistered = append(unregistered, "server.CreateServerPeerHandler") - } - if o.ServerCreateServerRingHandler == nil { - unregistered = append(unregistered, "server.CreateServerRingHandler") - } - if o.ServerSwitchingRuleCreateServerSwitchingRuleHandler == nil { - unregistered = append(unregistered, "server_switching_rule.CreateServerSwitchingRuleHandler") - } - if o.ServerTemplateCreateServerTemplateHandler == nil { - unregistered = append(unregistered, "server_template.CreateServerTemplateHandler") - } - if o.SitesCreateSiteHandler == nil { - unregistered = append(unregistered, "sites.CreateSiteHandler") - } - if o.SpoeCreateSpoeHandler == nil { - unregistered = append(unregistered, "spoe.CreateSpoeHandler") - } - if o.SpoeCreateSpoeAgentHandler == nil { - unregistered = append(unregistered, "spoe.CreateSpoeAgentHandler") - } - if o.SpoeCreateSpoeGroupHandler == nil { - unregistered = append(unregistered, "spoe.CreateSpoeGroupHandler") - } - if o.SpoeCreateSpoeMessageHandler == nil { - unregistered = append(unregistered, "spoe.CreateSpoeMessageHandler") - } - if o.SpoeCreateSpoeScopeHandler == nil { - unregistered = append(unregistered, "spoe.CreateSpoeScopeHandler") - } - if o.StickRuleCreateStickRuleHandler == nil { - unregistered = append(unregistered, "stick_rule.CreateStickRuleHandler") - } - if o.StorageCreateStorageGeneralFileHandler == nil { - unregistered = append(unregistered, "storage.CreateStorageGeneralFileHandler") - } - if o.StorageCreateStorageMapFileHandler == nil { - unregistered = append(unregistered, "storage.CreateStorageMapFileHandler") - } - if o.StorageCreateStorageSSLCertificateHandler == nil { - unregistered = append(unregistered, "storage.CreateStorageSSLCertificateHandler") - } - if o.StorageCreateStorageSSLCrtListFileHandler == nil { - unregistered = append(unregistered, "storage.CreateStorageSSLCrtListFileHandler") - } - if o.TCPCheckCreateTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.CreateTCPCheckBackendHandler") - } - if o.TCPCheckCreateTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.CreateTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleCreateTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.CreateTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleCreateTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.CreateTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleCreateTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.CreateTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleCreateTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.CreateTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleCreateTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.CreateTCPResponseRuleDefaultsHandler") - } - if o.TableCreateTableHandler == nil { - unregistered = append(unregistered, "table.CreateTableHandler") - } - if o.TracesCreateTraceEntryHandler == nil { - unregistered = append(unregistered, "traces.CreateTraceEntryHandler") - } - if o.TracesCreateTracesHandler == nil { - unregistered = append(unregistered, "traces.CreateTracesHandler") - } - if o.UserCreateUserHandler == nil { - unregistered = append(unregistered, "user.CreateUserHandler") - } - if o.UserlistCreateUserlistHandler == nil { - unregistered = append(unregistered, "userlist.CreateUserlistHandler") - } - if o.ServiceDiscoveryDeleteAWSRegionHandler == nil { - unregistered = append(unregistered, "service_discovery.DeleteAWSRegionHandler") - } - if o.ACLDeleteACLBackendHandler == nil { - unregistered = append(unregistered, "acl.DeleteACLBackendHandler") - } - if o.ACLDeleteACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.DeleteACLDefaultsHandler") - } - if o.ACLDeleteACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.DeleteACLFCGIAppHandler") - } - if o.ACLDeleteACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.DeleteACLFrontendHandler") - } - if o.AcmeDeleteAcmeProviderHandler == nil { - unregistered = append(unregistered, "acme.DeleteAcmeProviderHandler") - } - if o.BackendDeleteBackendHandler == nil { - unregistered = append(unregistered, "backend.DeleteBackendHandler") - } - if o.BackendSwitchingRuleDeleteBackendSwitchingRuleHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.DeleteBackendSwitchingRuleHandler") - } - if o.BindDeleteBindFrontendHandler == nil { - unregistered = append(unregistered, "bind.DeleteBindFrontendHandler") - } - if o.BindDeleteBindLogForwardHandler == nil { - unregistered = append(unregistered, "bind.DeleteBindLogForwardHandler") - } - if o.BindDeleteBindPeerHandler == nil { - unregistered = append(unregistered, "bind.DeleteBindPeerHandler") - } - if o.SslRuntimeDeleteCaFileHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.DeleteCaFileHandler") - } - if o.CacheDeleteCacheHandler == nil { - unregistered = append(unregistered, "cache.DeleteCacheHandler") - } - if o.SslRuntimeDeleteCertHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.DeleteCertHandler") - } - if o.ClusterDeleteClusterHandler == nil { - unregistered = append(unregistered, "cluster.DeleteClusterHandler") - } - if o.ServiceDiscoveryDeleteConsulHandler == nil { - unregistered = append(unregistered, "service_discovery.DeleteConsulHandler") - } - if o.SslRuntimeDeleteCrlHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.DeleteCrlHandler") - } - if o.SslRuntimeDeleteCrtListEntryHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.DeleteCrtListEntryHandler") - } - if o.CrtLoadDeleteCrtLoadHandler == nil { - unregistered = append(unregistered, "crt_load.DeleteCrtLoadHandler") - } - if o.CrtStoreDeleteCrtStoreHandler == nil { - unregistered = append(unregistered, "crt_store.DeleteCrtStoreHandler") - } - if o.DeclareCaptureDeleteDeclareCaptureHandler == nil { - unregistered = append(unregistered, "declare_capture.DeleteDeclareCaptureHandler") - } - if o.DefaultsDeleteDefaultsSectionHandler == nil { - unregistered = append(unregistered, "defaults.DeleteDefaultsSectionHandler") - } - if o.DgramBindDeleteDgramBindHandler == nil { - unregistered = append(unregistered, "dgram_bind.DeleteDgramBindHandler") - } - if o.FCGIAppDeleteFCGIAppHandler == nil { - unregistered = append(unregistered, "fcgi_app.DeleteFCGIAppHandler") - } - if o.FilterDeleteFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.DeleteFilterBackendHandler") - } - if o.FilterDeleteFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.DeleteFilterFrontendHandler") - } - if o.FrontendDeleteFrontendHandler == nil { - unregistered = append(unregistered, "frontend.DeleteFrontendHandler") - } - if o.GroupDeleteGroupHandler == nil { - unregistered = append(unregistered, "group.DeleteGroupHandler") - } - if o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.DeleteHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.DeleteHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.DeleteHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckDeleteHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.DeleteHTTPCheckBackendHandler") - } - if o.HTTPCheckDeleteHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.DeleteHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.DeleteHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.DeleteHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.DeleteHTTPErrorRuleFrontendHandler") - } - if o.HTTPErrorsDeleteHTTPErrorsSectionHandler == nil { - unregistered = append(unregistered, "http_errors.DeleteHTTPErrorsSectionHandler") - } - if o.HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.DeleteHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleDeleteHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.DeleteHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.DeleteHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.DeleteHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleDeleteHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.DeleteHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.DeleteHTTPResponseRuleFrontendHandler") - } - if o.LogForwardDeleteLogForwardHandler == nil { - unregistered = append(unregistered, "log_forward.DeleteLogForwardHandler") - } - if o.LogProfileDeleteLogProfileHandler == nil { - unregistered = append(unregistered, "log_profile.DeleteLogProfileHandler") - } - if o.LogTargetDeleteLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetBackendHandler") - } - if o.LogTargetDeleteLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetDefaultsHandler") - } - if o.LogTargetDeleteLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetFrontendHandler") - } - if o.LogTargetDeleteLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetGlobalHandler") - } - if o.LogTargetDeleteLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetLogForwardHandler") - } - if o.LogTargetDeleteLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.DeleteLogTargetPeerHandler") - } - if o.MailerEntryDeleteMailerEntryHandler == nil { - unregistered = append(unregistered, "mailer_entry.DeleteMailerEntryHandler") - } - if o.MailersDeleteMailersSectionHandler == nil { - unregistered = append(unregistered, "mailers.DeleteMailersSectionHandler") - } - if o.NameserverDeleteNameserverHandler == nil { - unregistered = append(unregistered, "nameserver.DeleteNameserverHandler") - } - if o.PeerDeletePeerHandler == nil { - unregistered = append(unregistered, "peer.DeletePeerHandler") - } - if o.PeerEntryDeletePeerEntryHandler == nil { - unregistered = append(unregistered, "peer_entry.DeletePeerEntryHandler") - } - if o.ProcessManagerDeleteProgramHandler == nil { - unregistered = append(unregistered, "process_manager.DeleteProgramHandler") - } - if o.QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.DeleteQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleDeleteQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.DeleteQUICInitialRuleFrontendHandler") - } - if o.ResolverDeleteResolverHandler == nil { - unregistered = append(unregistered, "resolver.DeleteResolverHandler") - } - if o.RingDeleteRingHandler == nil { - unregistered = append(unregistered, "ring.DeleteRingHandler") - } - if o.MapsDeleteRuntimeMapEntryHandler == nil { - unregistered = append(unregistered, "maps.DeleteRuntimeMapEntryHandler") - } - if o.ServerDeleteRuntimeServerHandler == nil { - unregistered = append(unregistered, "server.DeleteRuntimeServerHandler") - } - if o.SslFrontUseDeleteSSLFrontUseHandler == nil { - unregistered = append(unregistered, "s_s_l_front_use.DeleteSSLFrontUseHandler") - } - if o.ServerDeleteServerBackendHandler == nil { - unregistered = append(unregistered, "server.DeleteServerBackendHandler") - } - if o.ServerDeleteServerPeerHandler == nil { - unregistered = append(unregistered, "server.DeleteServerPeerHandler") - } - if o.ServerDeleteServerRingHandler == nil { - unregistered = append(unregistered, "server.DeleteServerRingHandler") - } - if o.ServerSwitchingRuleDeleteServerSwitchingRuleHandler == nil { - unregistered = append(unregistered, "server_switching_rule.DeleteServerSwitchingRuleHandler") - } - if o.ServerTemplateDeleteServerTemplateHandler == nil { - unregistered = append(unregistered, "server_template.DeleteServerTemplateHandler") - } - if o.SitesDeleteSiteHandler == nil { - unregistered = append(unregistered, "sites.DeleteSiteHandler") - } - if o.SpoeDeleteSpoeAgentHandler == nil { - unregistered = append(unregistered, "spoe.DeleteSpoeAgentHandler") - } - if o.SpoeDeleteSpoeFileHandler == nil { - unregistered = append(unregistered, "spoe.DeleteSpoeFileHandler") - } - if o.SpoeDeleteSpoeGroupHandler == nil { - unregistered = append(unregistered, "spoe.DeleteSpoeGroupHandler") - } - if o.SpoeDeleteSpoeMessageHandler == nil { - unregistered = append(unregistered, "spoe.DeleteSpoeMessageHandler") - } - if o.SpoeDeleteSpoeScopeHandler == nil { - unregistered = append(unregistered, "spoe.DeleteSpoeScopeHandler") - } - if o.SpoeTransactionsDeleteSpoeTransactionHandler == nil { - unregistered = append(unregistered, "spoe_transactions.DeleteSpoeTransactionHandler") - } - if o.StickRuleDeleteStickRuleHandler == nil { - unregistered = append(unregistered, "stick_rule.DeleteStickRuleHandler") - } - if o.StorageDeleteStorageGeneralFileHandler == nil { - unregistered = append(unregistered, "storage.DeleteStorageGeneralFileHandler") - } - if o.StorageDeleteStorageMapHandler == nil { - unregistered = append(unregistered, "storage.DeleteStorageMapHandler") - } - if o.StorageDeleteStorageSSLCertificateHandler == nil { - unregistered = append(unregistered, "storage.DeleteStorageSSLCertificateHandler") - } - if o.StorageDeleteStorageSSLCrtListFileHandler == nil { - unregistered = append(unregistered, "storage.DeleteStorageSSLCrtListFileHandler") - } - if o.TCPCheckDeleteTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.DeleteTCPCheckBackendHandler") - } - if o.TCPCheckDeleteTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.DeleteTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleDeleteTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.DeleteTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleDeleteTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.DeleteTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleDeleteTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.DeleteTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleDeleteTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.DeleteTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleDeleteTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.DeleteTCPResponseRuleDefaultsHandler") - } - if o.TableDeleteTableHandler == nil { - unregistered = append(unregistered, "table.DeleteTableHandler") - } - if o.TracesDeleteTraceEntryHandler == nil { - unregistered = append(unregistered, "traces.DeleteTraceEntryHandler") - } - if o.TracesDeleteTracesHandler == nil { - unregistered = append(unregistered, "traces.DeleteTracesHandler") - } - if o.TransactionsDeleteTransactionHandler == nil { - unregistered = append(unregistered, "transactions.DeleteTransactionHandler") - } - if o.UserDeleteUserHandler == nil { - unregistered = append(unregistered, "user.DeleteUserHandler") - } - if o.UserlistDeleteUserlistHandler == nil { - unregistered = append(unregistered, "userlist.DeleteUserlistHandler") - } - if o.AcmeEditAcmeProviderHandler == nil { - unregistered = append(unregistered, "acme.EditAcmeProviderHandler") - } - if o.ClusterEditClusterHandler == nil { - unregistered = append(unregistered, "cluster.EditClusterHandler") - } - if o.CrtStoreEditCrtStoreHandler == nil { - unregistered = append(unregistered, "crt_store.EditCrtStoreHandler") - } - if o.LogProfileEditLogProfileHandler == nil { - unregistered = append(unregistered, "log_profile.EditLogProfileHandler") - } - if o.MailersEditMailersSectionHandler == nil { - unregistered = append(unregistered, "mailers.EditMailersSectionHandler") - } - if o.DiscoveryGetAPIEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetAPIEndpointsHandler") - } - if o.ServiceDiscoveryGetAWSRegionHandler == nil { - unregistered = append(unregistered, "service_discovery.GetAWSRegionHandler") - } - if o.ServiceDiscoveryGetAWSRegionsHandler == nil { - unregistered = append(unregistered, "service_discovery.GetAWSRegionsHandler") - } - if o.ACLGetACLBackendHandler == nil { - unregistered = append(unregistered, "acl.GetACLBackendHandler") - } - if o.ACLGetACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.GetACLDefaultsHandler") - } - if o.ACLGetACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.GetACLFCGIAppHandler") - } - if o.ACLGetACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.GetACLFrontendHandler") - } - if o.AcmeGetAcmeProviderHandler == nil { - unregistered = append(unregistered, "acme.GetAcmeProviderHandler") - } - if o.AcmeGetAcmeProvidersHandler == nil { - unregistered = append(unregistered, "acme.GetAcmeProvidersHandler") - } - if o.AcmeRuntimeGetAcmeStatusHandler == nil { - unregistered = append(unregistered, "acme_runtime.GetAcmeStatusHandler") - } - if o.ACLGetAllACLBackendHandler == nil { - unregistered = append(unregistered, "acl.GetAllACLBackendHandler") - } - if o.ACLGetAllACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.GetAllACLDefaultsHandler") - } - if o.ACLGetAllACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.GetAllACLFCGIAppHandler") - } - if o.ACLGetAllACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.GetAllACLFrontendHandler") - } - if o.BindGetAllBindFrontendHandler == nil { - unregistered = append(unregistered, "bind.GetAllBindFrontendHandler") - } - if o.BindGetAllBindLogForwardHandler == nil { - unregistered = append(unregistered, "bind.GetAllBindLogForwardHandler") - } - if o.BindGetAllBindPeerHandler == nil { - unregistered = append(unregistered, "bind.GetAllBindPeerHandler") - } - if o.SslRuntimeGetAllCaFilesHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetAllCaFilesHandler") - } - if o.SslRuntimeGetAllCertsHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetAllCertsHandler") - } - if o.SslRuntimeGetAllCrlHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetAllCrlHandler") - } - if o.SslRuntimeGetAllCrtListEntriesHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetAllCrtListEntriesHandler") - } - if o.SslRuntimeGetAllCrtListsHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetAllCrtListsHandler") - } - if o.FilterGetAllFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.GetAllFilterBackendHandler") - } - if o.FilterGetAllFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.GetAllFilterFrontendHandler") - } - if o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetAllHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetAllHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetAllHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckGetAllHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.GetAllHTTPCheckBackendHandler") - } - if o.HTTPCheckGetAllHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.GetAllHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetAllHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetAllHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetAllHTTPErrorRuleFrontendHandler") - } - if o.HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetAllHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleGetAllHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetAllHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetAllHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetAllHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleGetAllHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetAllHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetAllHTTPResponseRuleFrontendHandler") - } - if o.LogTargetGetAllLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetBackendHandler") - } - if o.LogTargetGetAllLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetDefaultsHandler") - } - if o.LogTargetGetAllLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetFrontendHandler") - } - if o.LogTargetGetAllLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetGlobalHandler") - } - if o.LogTargetGetAllLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetLogForwardHandler") - } - if o.LogTargetGetAllLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.GetAllLogTargetPeerHandler") - } - if o.QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.GetAllQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleGetAllQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.GetAllQUICInitialRuleFrontendHandler") - } - if o.MapsGetAllRuntimeMapFilesHandler == nil { - unregistered = append(unregistered, "maps.GetAllRuntimeMapFilesHandler") - } - if o.ServerGetAllRuntimeServerHandler == nil { - unregistered = append(unregistered, "server.GetAllRuntimeServerHandler") - } - if o.SslFrontUseGetAllSSLFrontUsesHandler == nil { - unregistered = append(unregistered, "s_s_l_front_use.GetAllSSLFrontUsesHandler") - } - if o.ServerGetAllServerBackendHandler == nil { - unregistered = append(unregistered, "server.GetAllServerBackendHandler") - } - if o.ServerGetAllServerPeerHandler == nil { - unregistered = append(unregistered, "server.GetAllServerPeerHandler") - } - if o.ServerGetAllServerRingHandler == nil { - unregistered = append(unregistered, "server.GetAllServerRingHandler") - } - if o.SpoeGetAllSpoeAgentHandler == nil { - unregistered = append(unregistered, "spoe.GetAllSpoeAgentHandler") - } - if o.SpoeGetAllSpoeFilesHandler == nil { - unregistered = append(unregistered, "spoe.GetAllSpoeFilesHandler") - } - if o.SpoeGetAllSpoeGroupHandler == nil { - unregistered = append(unregistered, "spoe.GetAllSpoeGroupHandler") - } - if o.SpoeGetAllSpoeMessageHandler == nil { - unregistered = append(unregistered, "spoe.GetAllSpoeMessageHandler") - } - if o.SpoeGetAllSpoeScopeHandler == nil { - unregistered = append(unregistered, "spoe.GetAllSpoeScopeHandler") - } - if o.SpoeTransactionsGetAllSpoeTransactionHandler == nil { - unregistered = append(unregistered, "spoe_transactions.GetAllSpoeTransactionHandler") - } - if o.StorageGetAllStorageGeneralFilesHandler == nil { - unregistered = append(unregistered, "storage.GetAllStorageGeneralFilesHandler") - } - if o.StorageGetAllStorageMapFilesHandler == nil { - unregistered = append(unregistered, "storage.GetAllStorageMapFilesHandler") - } - if o.StorageGetAllStorageSSLCertificatesHandler == nil { - unregistered = append(unregistered, "storage.GetAllStorageSSLCertificatesHandler") - } - if o.StorageGetAllStorageSSLCrtListFilesHandler == nil { - unregistered = append(unregistered, "storage.GetAllStorageSSLCrtListFilesHandler") - } - if o.TCPCheckGetAllTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.GetAllTCPCheckBackendHandler") - } - if o.TCPCheckGetAllTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.GetAllTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleGetAllTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetAllTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleGetAllTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetAllTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleGetAllTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetAllTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleGetAllTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.GetAllTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleGetAllTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.GetAllTCPResponseRuleDefaultsHandler") - } - if o.BackendGetBackendHandler == nil { - unregistered = append(unregistered, "backend.GetBackendHandler") - } - if o.BackendSwitchingRuleGetBackendSwitchingRuleHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.GetBackendSwitchingRuleHandler") - } - if o.BackendSwitchingRuleGetBackendSwitchingRulesHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.GetBackendSwitchingRulesHandler") - } - if o.BackendGetBackendsHandler == nil { - unregistered = append(unregistered, "backend.GetBackendsHandler") - } - if o.BindGetBindFrontendHandler == nil { - unregistered = append(unregistered, "bind.GetBindFrontendHandler") - } - if o.BindGetBindLogForwardHandler == nil { - unregistered = append(unregistered, "bind.GetBindLogForwardHandler") - } - if o.BindGetBindPeerHandler == nil { - unregistered = append(unregistered, "bind.GetBindPeerHandler") - } - if o.SslRuntimeGetCaEntryHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetCaEntryHandler") - } - if o.SslRuntimeGetCaFileHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetCaFileHandler") - } - if o.CacheGetCacheHandler == nil { - unregistered = append(unregistered, "cache.GetCacheHandler") - } - if o.CacheGetCachesHandler == nil { - unregistered = append(unregistered, "cache.GetCachesHandler") - } - if o.SslRuntimeGetCertHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetCertHandler") - } - if o.ClusterGetClusterHandler == nil { - unregistered = append(unregistered, "cluster.GetClusterHandler") - } - if o.DiscoveryGetConfigurationEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetConfigurationEndpointsHandler") - } - if o.ConfigurationGetConfigurationVersionHandler == nil { - unregistered = append(unregistered, "configuration.GetConfigurationVersionHandler") - } - if o.ServiceDiscoveryGetConsulHandler == nil { - unregistered = append(unregistered, "service_discovery.GetConsulHandler") - } - if o.ServiceDiscoveryGetConsulsHandler == nil { - unregistered = append(unregistered, "service_discovery.GetConsulsHandler") - } - if o.SslRuntimeGetCrlHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.GetCrlHandler") - } - if o.CrtLoadGetCrtLoadHandler == nil { - unregistered = append(unregistered, "crt_load.GetCrtLoadHandler") - } - if o.CrtLoadGetCrtLoadsHandler == nil { - unregistered = append(unregistered, "crt_load.GetCrtLoadsHandler") - } - if o.CrtStoreGetCrtStoreHandler == nil { - unregistered = append(unregistered, "crt_store.GetCrtStoreHandler") - } - if o.CrtStoreGetCrtStoresHandler == nil { - unregistered = append(unregistered, "crt_store.GetCrtStoresHandler") - } - if o.DeclareCaptureGetDeclareCaptureHandler == nil { - unregistered = append(unregistered, "declare_capture.GetDeclareCaptureHandler") - } - if o.DeclareCaptureGetDeclareCapturesHandler == nil { - unregistered = append(unregistered, "declare_capture.GetDeclareCapturesHandler") - } - if o.DefaultsGetDefaultsSectionHandler == nil { - unregistered = append(unregistered, "defaults.GetDefaultsSectionHandler") - } - if o.DefaultsGetDefaultsSectionsHandler == nil { - unregistered = append(unregistered, "defaults.GetDefaultsSectionsHandler") - } - if o.DgramBindGetDgramBindHandler == nil { - unregistered = append(unregistered, "dgram_bind.GetDgramBindHandler") - } - if o.DgramBindGetDgramBindsHandler == nil { - unregistered = append(unregistered, "dgram_bind.GetDgramBindsHandler") - } - if o.FCGIAppGetFCGIAppHandler == nil { - unregistered = append(unregistered, "fcgi_app.GetFCGIAppHandler") - } - if o.FCGIAppGetFCGIAppsHandler == nil { - unregistered = append(unregistered, "fcgi_app.GetFCGIAppsHandler") - } - if o.FilterGetFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.GetFilterBackendHandler") - } - if o.FilterGetFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.GetFilterFrontendHandler") - } - if o.FrontendGetFrontendHandler == nil { - unregistered = append(unregistered, "frontend.GetFrontendHandler") - } - if o.FrontendGetFrontendsHandler == nil { - unregistered = append(unregistered, "frontend.GetFrontendsHandler") - } - if o.GlobalGetGlobalHandler == nil { - unregistered = append(unregistered, "global.GetGlobalHandler") - } - if o.GroupGetGroupHandler == nil { - unregistered = append(unregistered, "group.GetGroupHandler") - } - if o.GroupGetGroupsHandler == nil { - unregistered = append(unregistered, "group.GetGroupsHandler") - } - if o.ConfigurationGetHAProxyConfigurationHandler == nil { - unregistered = append(unregistered, "configuration.GetHAProxyConfigurationHandler") - } - if o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.GetHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckGetHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.GetHTTPCheckBackendHandler") - } - if o.HTTPCheckGetHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.GetHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleGetHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleGetHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.GetHTTPErrorRuleFrontendHandler") - } - if o.HTTPErrorsGetHTTPErrorsSectionHandler == nil { - unregistered = append(unregistered, "http_errors.GetHTTPErrorsSectionHandler") - } - if o.HTTPErrorsGetHTTPErrorsSectionsHandler == nil { - unregistered = append(unregistered, "http_errors.GetHTTPErrorsSectionsHandler") - } - if o.HTTPRequestRuleGetHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleGetHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleGetHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.GetHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleGetHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleGetHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleGetHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.GetHTTPResponseRuleFrontendHandler") - } - if o.DiscoveryGetHaproxyEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetHaproxyEndpointsHandler") - } - if o.InformationGetHaproxyProcessInfoHandler == nil { - unregistered = append(unregistered, "information.GetHaproxyProcessInfoHandler") - } - if o.HealthGetHealthHandler == nil { - unregistered = append(unregistered, "health.GetHealthHandler") - } - if o.InformationGetInfoHandler == nil { - unregistered = append(unregistered, "information.GetInfoHandler") - } - if o.LogForwardGetLogForwardHandler == nil { - unregistered = append(unregistered, "log_forward.GetLogForwardHandler") - } - if o.LogForwardGetLogForwardsHandler == nil { - unregistered = append(unregistered, "log_forward.GetLogForwardsHandler") - } - if o.LogProfileGetLogProfileHandler == nil { - unregistered = append(unregistered, "log_profile.GetLogProfileHandler") - } - if o.LogProfileGetLogProfilesHandler == nil { - unregistered = append(unregistered, "log_profile.GetLogProfilesHandler") - } - if o.LogTargetGetLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetBackendHandler") - } - if o.LogTargetGetLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetDefaultsHandler") - } - if o.LogTargetGetLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetFrontendHandler") - } - if o.LogTargetGetLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetGlobalHandler") - } - if o.LogTargetGetLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetLogForwardHandler") - } - if o.LogTargetGetLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.GetLogTargetPeerHandler") - } - if o.MailerEntryGetMailerEntriesHandler == nil { - unregistered = append(unregistered, "mailer_entry.GetMailerEntriesHandler") - } - if o.MailerEntryGetMailerEntryHandler == nil { - unregistered = append(unregistered, "mailer_entry.GetMailerEntryHandler") - } - if o.MailersGetMailersSectionHandler == nil { - unregistered = append(unregistered, "mailers.GetMailersSectionHandler") - } - if o.MailersGetMailersSectionsHandler == nil { - unregistered = append(unregistered, "mailers.GetMailersSectionsHandler") - } - if o.NameserverGetNameserverHandler == nil { - unregistered = append(unregistered, "nameserver.GetNameserverHandler") - } - if o.NameserverGetNameserversHandler == nil { - unregistered = append(unregistered, "nameserver.GetNameserversHandler") - } - if o.MapsGetOneRuntimeMapHandler == nil { - unregistered = append(unregistered, "maps.GetOneRuntimeMapHandler") - } - if o.SpoeGetOneSpoeFileHandler == nil { - unregistered = append(unregistered, "spoe.GetOneSpoeFileHandler") - } - if o.StorageGetOneStorageGeneralFileHandler == nil { - unregistered = append(unregistered, "storage.GetOneStorageGeneralFileHandler") - } - if o.StorageGetOneStorageMapHandler == nil { - unregistered = append(unregistered, "storage.GetOneStorageMapHandler") - } - if o.StorageGetOneStorageSSLCertificateHandler == nil { - unregistered = append(unregistered, "storage.GetOneStorageSSLCertificateHandler") - } - if o.StorageGetOneStorageSSLCrtListFileHandler == nil { - unregistered = append(unregistered, "storage.GetOneStorageSSLCrtListFileHandler") - } - if o.SpecificationOpenapiv3GetOpenapiv3SpecificationHandler == nil { - unregistered = append(unregistered, "specification_openapiv3.GetOpenapiv3SpecificationHandler") - } - if o.PeerEntryGetPeerEntriesHandler == nil { - unregistered = append(unregistered, "peer_entry.GetPeerEntriesHandler") - } - if o.PeerEntryGetPeerEntryHandler == nil { - unregistered = append(unregistered, "peer_entry.GetPeerEntryHandler") - } - if o.PeerGetPeerSectionHandler == nil { - unregistered = append(unregistered, "peer.GetPeerSectionHandler") - } - if o.PeerGetPeerSectionsHandler == nil { - unregistered = append(unregistered, "peer.GetPeerSectionsHandler") - } - if o.ProcessManagerGetProgramHandler == nil { - unregistered = append(unregistered, "process_manager.GetProgramHandler") - } - if o.ProcessManagerGetProgramsHandler == nil { - unregistered = append(unregistered, "process_manager.GetProgramsHandler") - } - if o.QUICInitialRuleGetQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.GetQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleGetQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.GetQUICInitialRuleFrontendHandler") - } - if o.ReloadsGetReloadHandler == nil { - unregistered = append(unregistered, "reloads.GetReloadHandler") - } - if o.ReloadsGetReloadsHandler == nil { - unregistered = append(unregistered, "reloads.GetReloadsHandler") - } - if o.ResolverGetResolverHandler == nil { - unregistered = append(unregistered, "resolver.GetResolverHandler") - } - if o.ResolverGetResolversHandler == nil { - unregistered = append(unregistered, "resolver.GetResolversHandler") - } - if o.RingGetRingHandler == nil { - unregistered = append(unregistered, "ring.GetRingHandler") - } - if o.RingGetRingsHandler == nil { - unregistered = append(unregistered, "ring.GetRingsHandler") - } - if o.DiscoveryGetRuntimeEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetRuntimeEndpointsHandler") - } - if o.MapsGetRuntimeMapEntryHandler == nil { - unregistered = append(unregistered, "maps.GetRuntimeMapEntryHandler") - } - if o.ServerGetRuntimeServerHandler == nil { - unregistered = append(unregistered, "server.GetRuntimeServerHandler") - } - if o.SslFrontUseGetSSLFrontUseHandler == nil { - unregistered = append(unregistered, "s_s_l_front_use.GetSSLFrontUseHandler") - } - if o.ServerGetServerBackendHandler == nil { - unregistered = append(unregistered, "server.GetServerBackendHandler") - } - if o.ServerGetServerPeerHandler == nil { - unregistered = append(unregistered, "server.GetServerPeerHandler") - } - if o.ServerGetServerRingHandler == nil { - unregistered = append(unregistered, "server.GetServerRingHandler") - } - if o.ServerSwitchingRuleGetServerSwitchingRuleHandler == nil { - unregistered = append(unregistered, "server_switching_rule.GetServerSwitchingRuleHandler") - } - if o.ServerSwitchingRuleGetServerSwitchingRulesHandler == nil { - unregistered = append(unregistered, "server_switching_rule.GetServerSwitchingRulesHandler") - } - if o.ServerTemplateGetServerTemplateHandler == nil { - unregistered = append(unregistered, "server_template.GetServerTemplateHandler") - } - if o.ServerTemplateGetServerTemplatesHandler == nil { - unregistered = append(unregistered, "server_template.GetServerTemplatesHandler") - } - if o.DiscoveryGetServicesEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetServicesEndpointsHandler") - } - if o.SitesGetSiteHandler == nil { - unregistered = append(unregistered, "sites.GetSiteHandler") - } - if o.SitesGetSitesHandler == nil { - unregistered = append(unregistered, "sites.GetSitesHandler") - } - if o.SpecificationGetSpecificationHandler == nil { - unregistered = append(unregistered, "specification.GetSpecificationHandler") - } - if o.SpoeGetSpoeAgentHandler == nil { - unregistered = append(unregistered, "spoe.GetSpoeAgentHandler") - } - if o.SpoeGetSpoeConfigurationVersionHandler == nil { - unregistered = append(unregistered, "spoe.GetSpoeConfigurationVersionHandler") - } - if o.DiscoveryGetSpoeEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetSpoeEndpointsHandler") - } - if o.SpoeGetSpoeGroupHandler == nil { - unregistered = append(unregistered, "spoe.GetSpoeGroupHandler") - } - if o.SpoeGetSpoeMessageHandler == nil { - unregistered = append(unregistered, "spoe.GetSpoeMessageHandler") - } - if o.SpoeGetSpoeScopeHandler == nil { - unregistered = append(unregistered, "spoe.GetSpoeScopeHandler") - } - if o.SpoeTransactionsGetSpoeTransactionHandler == nil { - unregistered = append(unregistered, "spoe_transactions.GetSpoeTransactionHandler") - } - if o.StatsGetStatsHandler == nil { - unregistered = append(unregistered, "stats.GetStatsHandler") - } - if o.DiscoveryGetStatsEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetStatsEndpointsHandler") - } - if o.StickRuleGetStickRuleHandler == nil { - unregistered = append(unregistered, "stick_rule.GetStickRuleHandler") - } - if o.StickRuleGetStickRulesHandler == nil { - unregistered = append(unregistered, "stick_rule.GetStickRulesHandler") - } - if o.StickTableGetStickTableHandler == nil { - unregistered = append(unregistered, "stick_table.GetStickTableHandler") - } - if o.StickTableGetStickTableEntriesHandler == nil { - unregistered = append(unregistered, "stick_table.GetStickTableEntriesHandler") - } - if o.StickTableGetStickTablesHandler == nil { - unregistered = append(unregistered, "stick_table.GetStickTablesHandler") - } - if o.DiscoveryGetStorageEndpointsHandler == nil { - unregistered = append(unregistered, "discovery.GetStorageEndpointsHandler") - } - if o.TCPCheckGetTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.GetTCPCheckBackendHandler") - } - if o.TCPCheckGetTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.GetTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleGetTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleGetTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleGetTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.GetTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleGetTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.GetTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleGetTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.GetTCPResponseRuleDefaultsHandler") - } - if o.TableGetTableHandler == nil { - unregistered = append(unregistered, "table.GetTableHandler") - } - if o.TableGetTablesHandler == nil { - unregistered = append(unregistered, "table.GetTablesHandler") - } - if o.TracesGetTracesHandler == nil { - unregistered = append(unregistered, "traces.GetTracesHandler") - } - if o.TransactionsGetTransactionHandler == nil { - unregistered = append(unregistered, "transactions.GetTransactionHandler") - } - if o.TransactionsGetTransactionsHandler == nil { - unregistered = append(unregistered, "transactions.GetTransactionsHandler") - } - if o.UserGetUserHandler == nil { - unregistered = append(unregistered, "user.GetUserHandler") - } - if o.UserlistGetUserlistHandler == nil { - unregistered = append(unregistered, "userlist.GetUserlistHandler") - } - if o.UserlistGetUserlistsHandler == nil { - unregistered = append(unregistered, "userlist.GetUserlistsHandler") - } - if o.UserGetUsersHandler == nil { - unregistered = append(unregistered, "user.GetUsersHandler") - } - if o.ClusterInitiateCertificateRefreshHandler == nil { - unregistered = append(unregistered, "cluster.InitiateCertificateRefreshHandler") - } - if o.ClusterPostClusterHandler == nil { - unregistered = append(unregistered, "cluster.PostClusterHandler") - } - if o.ConfigurationPostHAProxyConfigurationHandler == nil { - unregistered = append(unregistered, "configuration.PostHAProxyConfigurationHandler") - } - if o.AcmeRuntimeRenewAcmeCertificateHandler == nil { - unregistered = append(unregistered, "acme_runtime.RenewAcmeCertificateHandler") - } - if o.ServiceDiscoveryReplaceAWSRegionHandler == nil { - unregistered = append(unregistered, "service_discovery.ReplaceAWSRegionHandler") - } - if o.ACLReplaceACLBackendHandler == nil { - unregistered = append(unregistered, "acl.ReplaceACLBackendHandler") - } - if o.ACLReplaceACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.ReplaceACLDefaultsHandler") - } - if o.ACLReplaceACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.ReplaceACLFCGIAppHandler") - } - if o.ACLReplaceACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.ReplaceACLFrontendHandler") - } - if o.ACLReplaceAllACLBackendHandler == nil { - unregistered = append(unregistered, "acl.ReplaceAllACLBackendHandler") - } - if o.ACLReplaceAllACLDefaultsHandler == nil { - unregistered = append(unregistered, "acl.ReplaceAllACLDefaultsHandler") - } - if o.ACLReplaceAllACLFCGIAppHandler == nil { - unregistered = append(unregistered, "acl.ReplaceAllACLFCGIAppHandler") - } - if o.ACLReplaceAllACLFrontendHandler == nil { - unregistered = append(unregistered, "acl.ReplaceAllACLFrontendHandler") - } - if o.FilterReplaceAllFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.ReplaceAllFilterBackendHandler") - } - if o.FilterReplaceAllFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.ReplaceAllFilterFrontendHandler") - } - if o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceAllHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceAllHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceAllHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckReplaceAllHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.ReplaceAllHTTPCheckBackendHandler") - } - if o.HTTPCheckReplaceAllHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.ReplaceAllHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceAllHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceAllHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceAllHTTPErrorRuleFrontendHandler") - } - if o.HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceAllHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleReplaceAllHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceAllHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceAllHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceAllHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleReplaceAllHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceAllHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceAllHTTPResponseRuleFrontendHandler") - } - if o.LogTargetReplaceAllLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetBackendHandler") - } - if o.LogTargetReplaceAllLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetDefaultsHandler") - } - if o.LogTargetReplaceAllLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetFrontendHandler") - } - if o.LogTargetReplaceAllLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetGlobalHandler") - } - if o.LogTargetReplaceAllLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetLogForwardHandler") - } - if o.LogTargetReplaceAllLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceAllLogTargetPeerHandler") - } - if o.QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.ReplaceAllQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.ReplaceAllQUICInitialRuleFrontendHandler") - } - if o.TCPCheckReplaceAllTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.ReplaceAllTCPCheckBackendHandler") - } - if o.TCPCheckReplaceAllTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.ReplaceAllTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceAllTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleReplaceAllTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceAllTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceAllTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.ReplaceAllTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleReplaceAllTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.ReplaceAllTCPResponseRuleDefaultsHandler") - } - if o.BackendReplaceBackendHandler == nil { - unregistered = append(unregistered, "backend.ReplaceBackendHandler") - } - if o.BackendSwitchingRuleReplaceBackendSwitchingRuleHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.ReplaceBackendSwitchingRuleHandler") - } - if o.BackendSwitchingRuleReplaceBackendSwitchingRulesHandler == nil { - unregistered = append(unregistered, "backend_switching_rule.ReplaceBackendSwitchingRulesHandler") - } - if o.BindReplaceBindFrontendHandler == nil { - unregistered = append(unregistered, "bind.ReplaceBindFrontendHandler") - } - if o.BindReplaceBindLogForwardHandler == nil { - unregistered = append(unregistered, "bind.ReplaceBindLogForwardHandler") - } - if o.BindReplaceBindPeerHandler == nil { - unregistered = append(unregistered, "bind.ReplaceBindPeerHandler") - } - if o.CacheReplaceCacheHandler == nil { - unregistered = append(unregistered, "cache.ReplaceCacheHandler") - } - if o.SslRuntimeReplaceCertHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.ReplaceCertHandler") - } - if o.ServiceDiscoveryReplaceConsulHandler == nil { - unregistered = append(unregistered, "service_discovery.ReplaceConsulHandler") - } - if o.SslRuntimeReplaceCrlHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.ReplaceCrlHandler") - } - if o.CrtLoadReplaceCrtLoadHandler == nil { - unregistered = append(unregistered, "crt_load.ReplaceCrtLoadHandler") - } - if o.DeclareCaptureReplaceDeclareCaptureHandler == nil { - unregistered = append(unregistered, "declare_capture.ReplaceDeclareCaptureHandler") - } - if o.DeclareCaptureReplaceDeclareCapturesHandler == nil { - unregistered = append(unregistered, "declare_capture.ReplaceDeclareCapturesHandler") - } - if o.DefaultsReplaceDefaultsSectionHandler == nil { - unregistered = append(unregistered, "defaults.ReplaceDefaultsSectionHandler") - } - if o.DgramBindReplaceDgramBindHandler == nil { - unregistered = append(unregistered, "dgram_bind.ReplaceDgramBindHandler") - } - if o.FCGIAppReplaceFCGIAppHandler == nil { - unregistered = append(unregistered, "fcgi_app.ReplaceFCGIAppHandler") - } - if o.FilterReplaceFilterBackendHandler == nil { - unregistered = append(unregistered, "filter.ReplaceFilterBackendHandler") - } - if o.FilterReplaceFilterFrontendHandler == nil { - unregistered = append(unregistered, "filter.ReplaceFilterFrontendHandler") - } - if o.FrontendReplaceFrontendHandler == nil { - unregistered = append(unregistered, "frontend.ReplaceFrontendHandler") - } - if o.GlobalReplaceGlobalHandler == nil { - unregistered = append(unregistered, "global.ReplaceGlobalHandler") - } - if o.GroupReplaceGroupHandler == nil { - unregistered = append(unregistered, "group.ReplaceGroupHandler") - } - if o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceHTTPAfterResponseRuleBackendHandler") - } - if o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceHTTPAfterResponseRuleDefaultsHandler") - } - if o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_after_response_rule.ReplaceHTTPAfterResponseRuleFrontendHandler") - } - if o.HTTPCheckReplaceHTTPCheckBackendHandler == nil { - unregistered = append(unregistered, "http_check.ReplaceHTTPCheckBackendHandler") - } - if o.HTTPCheckReplaceHTTPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "http_check.ReplaceHTTPCheckDefaultsHandler") - } - if o.HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceHTTPErrorRuleBackendHandler") - } - if o.HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceHTTPErrorRuleDefaultsHandler") - } - if o.HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_error_rule.ReplaceHTTPErrorRuleFrontendHandler") - } - if o.HTTPErrorsReplaceHTTPErrorsSectionHandler == nil { - unregistered = append(unregistered, "http_errors.ReplaceHTTPErrorsSectionHandler") - } - if o.HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceHTTPRequestRuleBackendHandler") - } - if o.HTTPRequestRuleReplaceHTTPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceHTTPRequestRuleDefaultsHandler") - } - if o.HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_request_rule.ReplaceHTTPRequestRuleFrontendHandler") - } - if o.HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceHTTPResponseRuleBackendHandler") - } - if o.HTTPResponseRuleReplaceHTTPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceHTTPResponseRuleDefaultsHandler") - } - if o.HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler == nil { - unregistered = append(unregistered, "http_response_rule.ReplaceHTTPResponseRuleFrontendHandler") - } - if o.LogForwardReplaceLogForwardHandler == nil { - unregistered = append(unregistered, "log_forward.ReplaceLogForwardHandler") - } - if o.LogTargetReplaceLogTargetBackendHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetBackendHandler") - } - if o.LogTargetReplaceLogTargetDefaultsHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetDefaultsHandler") - } - if o.LogTargetReplaceLogTargetFrontendHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetFrontendHandler") - } - if o.LogTargetReplaceLogTargetGlobalHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetGlobalHandler") - } - if o.LogTargetReplaceLogTargetLogForwardHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetLogForwardHandler") - } - if o.LogTargetReplaceLogTargetPeerHandler == nil { - unregistered = append(unregistered, "log_target.ReplaceLogTargetPeerHandler") - } - if o.MailerEntryReplaceMailerEntryHandler == nil { - unregistered = append(unregistered, "mailer_entry.ReplaceMailerEntryHandler") - } - if o.NameserverReplaceNameserverHandler == nil { - unregistered = append(unregistered, "nameserver.ReplaceNameserverHandler") - } - if o.PeerEntryReplacePeerEntryHandler == nil { - unregistered = append(unregistered, "peer_entry.ReplacePeerEntryHandler") - } - if o.ProcessManagerReplaceProgramHandler == nil { - unregistered = append(unregistered, "process_manager.ReplaceProgramHandler") - } - if o.QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.ReplaceQUICInitialRuleDefaultsHandler") - } - if o.QUICInitialRuleReplaceQUICInitialRuleFrontendHandler == nil { - unregistered = append(unregistered, "quic_initial_rule.ReplaceQUICInitialRuleFrontendHandler") - } - if o.ResolverReplaceResolverHandler == nil { - unregistered = append(unregistered, "resolver.ReplaceResolverHandler") - } - if o.RingReplaceRingHandler == nil { - unregistered = append(unregistered, "ring.ReplaceRingHandler") - } - if o.MapsReplaceRuntimeMapEntryHandler == nil { - unregistered = append(unregistered, "maps.ReplaceRuntimeMapEntryHandler") - } - if o.ServerReplaceRuntimeServerHandler == nil { - unregistered = append(unregistered, "server.ReplaceRuntimeServerHandler") - } - if o.SslFrontUseReplaceSSLFrontUseHandler == nil { - unregistered = append(unregistered, "s_s_l_front_use.ReplaceSSLFrontUseHandler") - } - if o.ServerReplaceServerBackendHandler == nil { - unregistered = append(unregistered, "server.ReplaceServerBackendHandler") - } - if o.ServerReplaceServerPeerHandler == nil { - unregistered = append(unregistered, "server.ReplaceServerPeerHandler") - } - if o.ServerReplaceServerRingHandler == nil { - unregistered = append(unregistered, "server.ReplaceServerRingHandler") - } - if o.ServerSwitchingRuleReplaceServerSwitchingRuleHandler == nil { - unregistered = append(unregistered, "server_switching_rule.ReplaceServerSwitchingRuleHandler") - } - if o.ServerSwitchingRuleReplaceServerSwitchingRulesHandler == nil { - unregistered = append(unregistered, "server_switching_rule.ReplaceServerSwitchingRulesHandler") - } - if o.ServerTemplateReplaceServerTemplateHandler == nil { - unregistered = append(unregistered, "server_template.ReplaceServerTemplateHandler") - } - if o.SitesReplaceSiteHandler == nil { - unregistered = append(unregistered, "sites.ReplaceSiteHandler") - } - if o.SpoeReplaceSpoeAgentHandler == nil { - unregistered = append(unregistered, "spoe.ReplaceSpoeAgentHandler") - } - if o.SpoeReplaceSpoeGroupHandler == nil { - unregistered = append(unregistered, "spoe.ReplaceSpoeGroupHandler") - } - if o.SpoeReplaceSpoeMessageHandler == nil { - unregistered = append(unregistered, "spoe.ReplaceSpoeMessageHandler") - } - if o.StickRuleReplaceStickRuleHandler == nil { - unregistered = append(unregistered, "stick_rule.ReplaceStickRuleHandler") - } - if o.StickRuleReplaceStickRulesHandler == nil { - unregistered = append(unregistered, "stick_rule.ReplaceStickRulesHandler") - } - if o.StorageReplaceStorageGeneralFileHandler == nil { - unregistered = append(unregistered, "storage.ReplaceStorageGeneralFileHandler") - } - if o.StorageReplaceStorageMapFileHandler == nil { - unregistered = append(unregistered, "storage.ReplaceStorageMapFileHandler") - } - if o.StorageReplaceStorageSSLCertificateHandler == nil { - unregistered = append(unregistered, "storage.ReplaceStorageSSLCertificateHandler") - } - if o.StorageReplaceStorageSSLCrtListFileHandler == nil { - unregistered = append(unregistered, "storage.ReplaceStorageSSLCrtListFileHandler") - } - if o.TCPCheckReplaceTCPCheckBackendHandler == nil { - unregistered = append(unregistered, "tcp_check.ReplaceTCPCheckBackendHandler") - } - if o.TCPCheckReplaceTCPCheckDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_check.ReplaceTCPCheckDefaultsHandler") - } - if o.TCPRequestRuleReplaceTCPRequestRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceTCPRequestRuleBackendHandler") - } - if o.TCPRequestRuleReplaceTCPRequestRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceTCPRequestRuleDefaultsHandler") - } - if o.TCPRequestRuleReplaceTCPRequestRuleFrontendHandler == nil { - unregistered = append(unregistered, "tcp_request_rule.ReplaceTCPRequestRuleFrontendHandler") - } - if o.TCPResponseRuleReplaceTCPResponseRuleBackendHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.ReplaceTCPResponseRuleBackendHandler") - } - if o.TCPResponseRuleReplaceTCPResponseRuleDefaultsHandler == nil { - unregistered = append(unregistered, "tcp_response_rule.ReplaceTCPResponseRuleDefaultsHandler") - } - if o.TableReplaceTableHandler == nil { - unregistered = append(unregistered, "table.ReplaceTableHandler") - } - if o.TracesReplaceTracesHandler == nil { - unregistered = append(unregistered, "traces.ReplaceTracesHandler") - } - if o.UserReplaceUserHandler == nil { - unregistered = append(unregistered, "user.ReplaceUserHandler") - } - if o.SslRuntimeSetCaFileHandler == nil { - unregistered = append(unregistered, "s_s_l_runtime.SetCaFileHandler") - } - if o.StickTableSetStickTableEntriesHandler == nil { - unregistered = append(unregistered, "stick_table.SetStickTableEntriesHandler") - } - if o.MapsShowRuntimeMapHandler == nil { - unregistered = append(unregistered, "maps.ShowRuntimeMapHandler") - } - if o.SpoeTransactionsStartSpoeTransactionHandler == nil { - unregistered = append(unregistered, "spoe_transactions.StartSpoeTransactionHandler") - } - if o.TransactionsStartTransactionHandler == nil { - unregistered = append(unregistered, "transactions.StartTransactionHandler") - } - - if len(unregistered) > 0 { - return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) - } - - return nil -} - -// ServeErrorFor gets a error handler for a given operation id -func (o *DataPlaneAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { - return o.ServeError -} - -// AuthenticatorsFor gets the authenticators for the specified security schemes -func (o *DataPlaneAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { - result := make(map[string]runtime.Authenticator) - for name := range schemes { - switch name { - case "basic_auth": - result[name] = o.BasicAuthenticator(o.BasicAuthAuth) - - } - } - return result -} - -// Authorizer returns the registered authorizer -func (o *DataPlaneAPI) Authorizer() runtime.Authorizer { - return o.APIAuthorizer -} - -// ConsumersFor gets the consumers for the specified media types. -// MIME type parameters are ignored here. -func (o *DataPlaneAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { - result := make(map[string]runtime.Consumer, len(mediaTypes)) - for _, mt := range mediaTypes { - switch mt { - case "application/json": - result["application/json"] = o.JSONConsumer - case "multipart/form-data": - result["multipart/form-data"] = o.MultipartformConsumer - case "text/plain": - result["text/plain"] = o.TxtConsumer - } - - if c, ok := o.customConsumers[mt]; ok { - result[mt] = c - } - } - return result -} - -// ProducersFor gets the producers for the specified media types. -// MIME type parameters are ignored here. -func (o *DataPlaneAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { - result := make(map[string]runtime.Producer, len(mediaTypes)) - for _, mt := range mediaTypes { - switch mt { - case "application/octet-stream": - result["application/octet-stream"] = o.BinProducer - case "application/json": - result["application/json"] = o.JSONProducer - case "text/plain": - result["text/plain"] = o.TxtProducer - } - - if p, ok := o.customProducers[mt]; ok { - result[mt] = p - } - } - return result -} - -// HandlerFor gets a http.Handler for the provided operation method and path -func (o *DataPlaneAPI) HandlerFor(method, path string) (http.Handler, bool) { - if o.handlers == nil { - return nil, false - } - um := strings.ToUpper(method) - if _, ok := o.handlers[um]; !ok { - return nil, false - } - if path == "/" { - path = "" - } - h, ok := o.handlers[um][path] - return h, ok -} - -// Context returns the middleware context for the data plane API -func (o *DataPlaneAPI) Context() *middleware.Context { - if o.context == nil { - o.context = middleware.NewRoutableContext(o.spec, o, nil) - } - - return o.context -} - -func (o *DataPlaneAPI) initHandlerCache() { - o.Context() // don't care about the result, just that the initialization happened - if o.handlers == nil { - o.handlers = make(map[string]map[string]http.Handler) - } - - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/storage/ssl_crt_lists/{name}/entries"] = storage.NewCreateStorageSSLCrtListEntry(o.context, o.StorageCreateStorageSSLCrtListEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/acls/{parent_name}/entries/{id}"] = acl_runtime.NewDeleteServicesHaproxyRuntimeAclsParentNameEntriesID(o.context, o.ACLRuntimeDeleteServicesHaproxyRuntimeAclsParentNameEntriesIDHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/storage/ssl_crt_lists/{name}/entries"] = storage.NewDeleteStorageSSLCrtListEntry(o.context, o.StorageDeleteStorageSSLCrtListEntryHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/acls"] = acl_runtime.NewGetServicesHaproxyRuntimeAcls(o.context, o.ACLRuntimeGetServicesHaproxyRuntimeAclsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/acls/{id}"] = acl_runtime.NewGetServicesHaproxyRuntimeAclsID(o.context, o.ACLRuntimeGetServicesHaproxyRuntimeAclsIDHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/acls/{parent_name}/entries"] = acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntries(o.context, o.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/acls/{parent_name}/entries/{id}"] = acl_runtime.NewGetServicesHaproxyRuntimeAclsParentNameEntriesID(o.context, o.ACLRuntimeGetServicesHaproxyRuntimeAclsParentNameEntriesIDHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/ssl_crt_lists/{name}/entries"] = storage.NewGetStorageSSLCrtListEntries(o.context, o.StorageGetStorageSSLCrtListEntriesHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/acls/{parent_name}/entries"] = acl_runtime.NewPostServicesHaproxyRuntimeAclsParentNameEntries(o.context, o.ACLRuntimePostServicesHaproxyRuntimeAclsParentNameEntriesHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/ssl_ca_files/{name}/entries"] = s_s_l_runtime.NewAddCaEntry(o.context, o.SslRuntimeAddCaEntryHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/ssl_crt_lists/entries"] = s_s_l_runtime.NewAddCrtListEntry(o.context, o.SslRuntimeAddCrtListEntryHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults"] = defaults.NewAddDefaultsSection(o.context, o.DefaultsAddDefaultsSectionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/maps/{parent_name}/entries"] = maps.NewAddMapEntry(o.context, o.MapsAddMapEntryHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/acls/{parent_name}/entries"] = acl_runtime.NewAddPayloadRuntimeACL(o.context, o.ACLRuntimeAddPayloadRuntimeACLHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/maps/{name}"] = maps.NewAddPayloadRuntimeMap(o.context, o.MapsAddPayloadRuntimeMapHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/backends/{parent_name}/servers"] = serverops.NewAddRuntimeServer(o.context, o.ServerAddRuntimeServerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/maps/{name}"] = maps.NewClearRuntimeMap(o.context, o.MapsClearRuntimeMapHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}"] = spoe_transactions.NewCommitSpoeTransaction(o.context, o.SpoeTransactionsCommitSpoeTransactionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/transactions/{id}"] = transactions.NewCommitTransaction(o.context, o.TransactionsCommitTransactionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/service_discovery/aws"] = service_discovery.NewCreateAWSRegion(o.context, o.ServiceDiscoveryCreateAWSRegionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/acls/{index}"] = acl.NewCreateACLBackend(o.context, o.ACLCreateACLBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/acls/{index}"] = acl.NewCreateACLDefaults(o.context, o.ACLCreateACLDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}"] = acl.NewCreateACLFCGIApp(o.context, o.ACLCreateACLFCGIAppHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/acls/{index}"] = acl.NewCreateACLFrontend(o.context, o.ACLCreateACLFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/acme"] = acme.NewCreateAcmeProvider(o.context, o.AcmeCreateAcmeProviderHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends"] = backend.NewCreateBackend(o.context, o.BackendCreateBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}"] = backend_switching_rule.NewCreateBackendSwitchingRule(o.context, o.BackendSwitchingRuleCreateBackendSwitchingRuleHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/binds"] = bind.NewCreateBindFrontend(o.context, o.BindCreateBindFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/log_forwards/{parent_name}/binds"] = bind.NewCreateBindLogForward(o.context, o.BindCreateBindLogForwardHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peers/{parent_name}/binds"] = bind.NewCreateBindPeer(o.context, o.BindCreateBindPeerHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/ssl_ca_files"] = s_s_l_runtime.NewCreateCaFile(o.context, o.SslRuntimeCreateCaFileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/caches"] = cache.NewCreateCache(o.context, o.CacheCreateCacheHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/ssl_certs"] = s_s_l_runtime.NewCreateCert(o.context, o.SslRuntimeCreateCertHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/service_discovery/consul"] = service_discovery.NewCreateConsul(o.context, o.ServiceDiscoveryCreateConsulHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/ssl_crl_files"] = s_s_l_runtime.NewCreateCrl(o.context, o.SslRuntimeCreateCrlHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/crt_loads"] = crt_load.NewCreateCrtLoad(o.context, o.CrtLoadCreateCrtLoadHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/crt_stores"] = crt_store.NewCreateCrtStore(o.context, o.CrtStoreCreateCrtStoreHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/captures/{index}"] = declare_capture.NewCreateDeclareCapture(o.context, o.DeclareCaptureCreateDeclareCaptureHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults"] = defaults.NewCreateDefaultsSection(o.context, o.DefaultsCreateDefaultsSectionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds"] = dgram_bind.NewCreateDgramBind(o.context, o.DgramBindCreateDgramBindHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/fcgi_apps"] = fcgi_app.NewCreateFCGIApp(o.context, o.FCGIAppCreateFCGIAppHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/filters/{index}"] = filter.NewCreateFilterBackend(o.context, o.FilterCreateFilterBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/filters/{index}"] = filter.NewCreateFilterFrontend(o.context, o.FilterCreateFilterFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends"] = frontend.NewCreateFrontend(o.context, o.FrontendCreateFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/groups"] = group.NewCreateGroup(o.context, o.GroupCreateGroupHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewCreateHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewCreateHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewCreateHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleCreateHTTPAfterResponseRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}"] = http_check.NewCreateHTTPCheckBackend(o.context, o.HTTPCheckCreateHTTPCheckBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}"] = http_check.NewCreateHTTPCheckDefaults(o.context, o.HTTPCheckCreateHTTPCheckDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewCreateHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleCreateHTTPErrorRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewCreateHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleCreateHTTPErrorRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewCreateHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleCreateHTTPErrorRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/http_errors_sections"] = http_errors.NewCreateHTTPErrorsSection(o.context, o.HTTPErrorsCreateHTTPErrorsSectionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewCreateHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleCreateHTTPRequestRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewCreateHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleCreateHTTPRequestRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewCreateHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleCreateHTTPRequestRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewCreateHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleCreateHTTPResponseRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewCreateHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleCreateHTTPResponseRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewCreateHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleCreateHTTPResponseRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/log_forwards"] = log_forward.NewCreateLogForward(o.context, o.LogForwardCreateLogForwardHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/log_profiles"] = log_profile.NewCreateLogProfile(o.context, o.LogProfileCreateLogProfileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}"] = log_target.NewCreateLogTargetBackend(o.context, o.LogTargetCreateLogTargetBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}"] = log_target.NewCreateLogTargetDefaults(o.context, o.LogTargetCreateLogTargetDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}"] = log_target.NewCreateLogTargetFrontend(o.context, o.LogTargetCreateLogTargetFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/global/log_targets/{index}"] = log_target.NewCreateLogTargetGlobal(o.context, o.LogTargetCreateLogTargetGlobalHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}"] = log_target.NewCreateLogTargetLogForward(o.context, o.LogTargetCreateLogTargetLogForwardHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}"] = log_target.NewCreateLogTargetPeer(o.context, o.LogTargetCreateLogTargetPeerHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/mailer_entries"] = mailer_entry.NewCreateMailerEntry(o.context, o.MailerEntryCreateMailerEntryHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/mailers_section"] = mailers.NewCreateMailersSection(o.context, o.MailersCreateMailersSectionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/nameservers"] = nameserver.NewCreateNameserver(o.context, o.NameserverCreateNameserverHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peer_section"] = peer.NewCreatePeer(o.context, o.PeerCreatePeerHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peer_entries"] = peer_entry.NewCreatePeerEntry(o.context, o.PeerEntryCreatePeerEntryHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/programs"] = process_manager.NewCreateProgram(o.context, o.ProcessManagerCreateProgramHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewCreateQUICInitialRuleDefaults(o.context, o.QUICInitialRuleCreateQUICInitialRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewCreateQUICInitialRuleFrontend(o.context, o.QUICInitialRuleCreateQUICInitialRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/resolvers"] = resolver.NewCreateResolver(o.context, o.ResolverCreateResolverHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/rings"] = ring.NewCreateRing(o.context, o.RingCreateRingHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses"] = s_s_l_front_use.NewCreateSSLFrontUse(o.context, o.SslFrontUseCreateSSLFrontUseHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/servers"] = serverops.NewCreateServerBackend(o.context, o.ServerCreateServerBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peers/{parent_name}/servers"] = serverops.NewCreateServerPeer(o.context, o.ServerCreateServerPeerHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/rings/{parent_name}/servers"] = serverops.NewCreateServerRing(o.context, o.ServerCreateServerRingHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}"] = server_switching_rule.NewCreateServerSwitchingRule(o.context, o.ServerSwitchingRuleCreateServerSwitchingRuleHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/server_templates"] = server_template.NewCreateServerTemplate(o.context, o.ServerTemplateCreateServerTemplateHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/sites"] = sites.NewCreateSite(o.context, o.SitesCreateSiteHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files"] = spoe.NewCreateSpoe(o.context, o.SpoeCreateSpoeHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents"] = spoe.NewCreateSpoeAgent(o.context, o.SpoeCreateSpoeAgentHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups"] = spoe.NewCreateSpoeGroup(o.context, o.SpoeCreateSpoeGroupHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages"] = spoe.NewCreateSpoeMessage(o.context, o.SpoeCreateSpoeMessageHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes"] = spoe.NewCreateSpoeScope(o.context, o.SpoeCreateSpoeScopeHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}"] = stick_rule.NewCreateStickRule(o.context, o.StickRuleCreateStickRuleHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/storage/general"] = storage.NewCreateStorageGeneralFile(o.context, o.StorageCreateStorageGeneralFileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/storage/maps"] = storage.NewCreateStorageMapFile(o.context, o.StorageCreateStorageMapFileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/storage/ssl_certificates"] = storage.NewCreateStorageSSLCertificate(o.context, o.StorageCreateStorageSSLCertificateHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/storage/ssl_crt_lists"] = storage.NewCreateStorageSSLCrtListFile(o.context, o.StorageCreateStorageSSLCrtListFileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}"] = tcp_check.NewCreateTCPCheckBackend(o.context, o.TCPCheckCreateTCPCheckBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}"] = tcp_check.NewCreateTCPCheckDefaults(o.context, o.TCPCheckCreateTCPCheckDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewCreateTCPRequestRuleBackend(o.context, o.TCPRequestRuleCreateTCPRequestRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewCreateTCPRequestRuleDefaults(o.context, o.TCPRequestRuleCreateTCPRequestRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewCreateTCPRequestRuleFrontend(o.context, o.TCPRequestRuleCreateTCPRequestRuleFrontendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewCreateTCPResponseRuleBackend(o.context, o.TCPResponseRuleCreateTCPResponseRuleBackendHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewCreateTCPResponseRuleDefaults(o.context, o.TCPResponseRuleCreateTCPResponseRuleDefaultsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/peers/{parent_name}/tables"] = table.NewCreateTable(o.context, o.TableCreateTableHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/traces/entries"] = traces.NewCreateTraceEntry(o.context, o.TracesCreateTraceEntryHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/traces"] = traces.NewCreateTraces(o.context, o.TracesCreateTracesHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/users"] = user.NewCreateUser(o.context, o.UserCreateUserHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/userlists"] = userlist.NewCreateUserlist(o.context, o.UserlistCreateUserlistHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/service_discovery/aws/{id}"] = service_discovery.NewDeleteAWSRegion(o.context, o.ServiceDiscoveryDeleteAWSRegionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/acls/{index}"] = acl.NewDeleteACLBackend(o.context, o.ACLDeleteACLBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/acls/{index}"] = acl.NewDeleteACLDefaults(o.context, o.ACLDeleteACLDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}"] = acl.NewDeleteACLFCGIApp(o.context, o.ACLDeleteACLFCGIAppHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/acls/{index}"] = acl.NewDeleteACLFrontend(o.context, o.ACLDeleteACLFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/acme/{name}"] = acme.NewDeleteAcmeProvider(o.context, o.AcmeDeleteAcmeProviderHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{name}"] = backend.NewDeleteBackend(o.context, o.BackendDeleteBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}"] = backend_switching_rule.NewDeleteBackendSwitchingRule(o.context, o.BackendSwitchingRuleDeleteBackendSwitchingRuleHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/binds/{name}"] = bind.NewDeleteBindFrontend(o.context, o.BindDeleteBindFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}"] = bind.NewDeleteBindLogForward(o.context, o.BindDeleteBindLogForwardHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peers/{parent_name}/binds/{name}"] = bind.NewDeleteBindPeer(o.context, o.BindDeleteBindPeerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/ssl_ca_files/{name}"] = s_s_l_runtime.NewDeleteCaFile(o.context, o.SslRuntimeDeleteCaFileHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/caches/{name}"] = cache.NewDeleteCache(o.context, o.CacheDeleteCacheHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/ssl_certs/{name}"] = s_s_l_runtime.NewDeleteCert(o.context, o.SslRuntimeDeleteCertHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/cluster"] = cluster.NewDeleteCluster(o.context, o.ClusterDeleteClusterHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/service_discovery/consul/{id}"] = service_discovery.NewDeleteConsul(o.context, o.ServiceDiscoveryDeleteConsulHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/ssl_crl_files/{name}"] = s_s_l_runtime.NewDeleteCrl(o.context, o.SslRuntimeDeleteCrlHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/ssl_crt_lists/entries"] = s_s_l_runtime.NewDeleteCrtListEntry(o.context, o.SslRuntimeDeleteCrtListEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/crt_loads/{certificate}"] = crt_load.NewDeleteCrtLoad(o.context, o.CrtLoadDeleteCrtLoadHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/crt_stores/{name}"] = crt_store.NewDeleteCrtStore(o.context, o.CrtStoreDeleteCrtStoreHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/captures/{index}"] = declare_capture.NewDeleteDeclareCapture(o.context, o.DeclareCaptureDeleteDeclareCaptureHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{name}"] = defaults.NewDeleteDefaultsSection(o.context, o.DefaultsDeleteDefaultsSectionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}"] = dgram_bind.NewDeleteDgramBind(o.context, o.DgramBindDeleteDgramBindHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/fcgi_apps/{name}"] = fcgi_app.NewDeleteFCGIApp(o.context, o.FCGIAppDeleteFCGIAppHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/filters/{index}"] = filter.NewDeleteFilterBackend(o.context, o.FilterDeleteFilterBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/filters/{index}"] = filter.NewDeleteFilterFrontend(o.context, o.FilterDeleteFilterFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{name}"] = frontend.NewDeleteFrontend(o.context, o.FrontendDeleteFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/groups/{name}"] = group.NewDeleteGroup(o.context, o.GroupDeleteGroupHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewDeleteHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewDeleteHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewDeleteHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleDeleteHTTPAfterResponseRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}"] = http_check.NewDeleteHTTPCheckBackend(o.context, o.HTTPCheckDeleteHTTPCheckBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}"] = http_check.NewDeleteHTTPCheckDefaults(o.context, o.HTTPCheckDeleteHTTPCheckDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewDeleteHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleDeleteHTTPErrorRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewDeleteHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleDeleteHTTPErrorRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewDeleteHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleDeleteHTTPErrorRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/http_errors_sections/{name}"] = http_errors.NewDeleteHTTPErrorsSection(o.context, o.HTTPErrorsDeleteHTTPErrorsSectionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewDeleteHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleDeleteHTTPRequestRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewDeleteHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleDeleteHTTPRequestRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewDeleteHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleDeleteHTTPRequestRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewDeleteHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleDeleteHTTPResponseRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewDeleteHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleDeleteHTTPResponseRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewDeleteHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleDeleteHTTPResponseRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/log_forwards/{name}"] = log_forward.NewDeleteLogForward(o.context, o.LogForwardDeleteLogForwardHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/log_profiles/{name}"] = log_profile.NewDeleteLogProfile(o.context, o.LogProfileDeleteLogProfileHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}"] = log_target.NewDeleteLogTargetBackend(o.context, o.LogTargetDeleteLogTargetBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}"] = log_target.NewDeleteLogTargetDefaults(o.context, o.LogTargetDeleteLogTargetDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}"] = log_target.NewDeleteLogTargetFrontend(o.context, o.LogTargetDeleteLogTargetFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/global/log_targets/{index}"] = log_target.NewDeleteLogTargetGlobal(o.context, o.LogTargetDeleteLogTargetGlobalHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}"] = log_target.NewDeleteLogTargetLogForward(o.context, o.LogTargetDeleteLogTargetLogForwardHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}"] = log_target.NewDeleteLogTargetPeer(o.context, o.LogTargetDeleteLogTargetPeerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/mailer_entries/{name}"] = mailer_entry.NewDeleteMailerEntry(o.context, o.MailerEntryDeleteMailerEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/mailers_section/{name}"] = mailers.NewDeleteMailersSection(o.context, o.MailersDeleteMailersSectionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/nameservers/{name}"] = nameserver.NewDeleteNameserver(o.context, o.NameserverDeleteNameserverHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peer_section/{name}"] = peer.NewDeletePeer(o.context, o.PeerDeletePeerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peer_entries/{name}"] = peer_entry.NewDeletePeerEntry(o.context, o.PeerEntryDeletePeerEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/programs/{name}"] = process_manager.NewDeleteProgram(o.context, o.ProcessManagerDeleteProgramHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewDeleteQUICInitialRuleDefaults(o.context, o.QUICInitialRuleDeleteQUICInitialRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewDeleteQUICInitialRuleFrontend(o.context, o.QUICInitialRuleDeleteQUICInitialRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/resolvers/{name}"] = resolver.NewDeleteResolver(o.context, o.ResolverDeleteResolverHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/rings/{name}"] = ring.NewDeleteRing(o.context, o.RingDeleteRingHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/maps/{parent_name}/entries/{id}"] = maps.NewDeleteRuntimeMapEntry(o.context, o.MapsDeleteRuntimeMapEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/runtime/backends/{parent_name}/servers/{name}"] = serverops.NewDeleteRuntimeServer(o.context, o.ServerDeleteRuntimeServerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}"] = s_s_l_front_use.NewDeleteSSLFrontUse(o.context, o.SslFrontUseDeleteSSLFrontUseHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/servers/{name}"] = serverops.NewDeleteServerBackend(o.context, o.ServerDeleteServerBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peers/{parent_name}/servers/{name}"] = serverops.NewDeleteServerPeer(o.context, o.ServerDeleteServerPeerHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/rings/{parent_name}/servers/{name}"] = serverops.NewDeleteServerRing(o.context, o.ServerDeleteServerRingHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}"] = server_switching_rule.NewDeleteServerSwitchingRule(o.context, o.ServerSwitchingRuleDeleteServerSwitchingRuleHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}"] = server_template.NewDeleteServerTemplate(o.context, o.ServerTemplateDeleteServerTemplateHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/sites/{name}"] = sites.NewDeleteSite(o.context, o.SitesDeleteSiteHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}"] = spoe.NewDeleteSpoeAgent(o.context, o.SpoeDeleteSpoeAgentHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{name}"] = spoe.NewDeleteSpoeFile(o.context, o.SpoeDeleteSpoeFileHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}"] = spoe.NewDeleteSpoeGroup(o.context, o.SpoeDeleteSpoeGroupHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}"] = spoe.NewDeleteSpoeMessage(o.context, o.SpoeDeleteSpoeMessageHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}"] = spoe.NewDeleteSpoeScope(o.context, o.SpoeDeleteSpoeScopeHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}"] = spoe_transactions.NewDeleteSpoeTransaction(o.context, o.SpoeTransactionsDeleteSpoeTransactionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}"] = stick_rule.NewDeleteStickRule(o.context, o.StickRuleDeleteStickRuleHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/storage/general/{name}"] = storage.NewDeleteStorageGeneralFile(o.context, o.StorageDeleteStorageGeneralFileHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/storage/maps/{name}"] = storage.NewDeleteStorageMap(o.context, o.StorageDeleteStorageMapHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/storage/ssl_certificates/{name}"] = storage.NewDeleteStorageSSLCertificate(o.context, o.StorageDeleteStorageSSLCertificateHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/storage/ssl_crt_lists/{name}"] = storage.NewDeleteStorageSSLCrtListFile(o.context, o.StorageDeleteStorageSSLCrtListFileHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}"] = tcp_check.NewDeleteTCPCheckBackend(o.context, o.TCPCheckDeleteTCPCheckBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}"] = tcp_check.NewDeleteTCPCheckDefaults(o.context, o.TCPCheckDeleteTCPCheckDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewDeleteTCPRequestRuleBackend(o.context, o.TCPRequestRuleDeleteTCPRequestRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewDeleteTCPRequestRuleDefaults(o.context, o.TCPRequestRuleDeleteTCPRequestRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewDeleteTCPRequestRuleFrontend(o.context, o.TCPRequestRuleDeleteTCPRequestRuleFrontendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewDeleteTCPResponseRuleBackend(o.context, o.TCPResponseRuleDeleteTCPResponseRuleBackendHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewDeleteTCPResponseRuleDefaults(o.context, o.TCPResponseRuleDeleteTCPResponseRuleDefaultsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/peers/{parent_name}/tables/{name}"] = table.NewDeleteTable(o.context, o.TableDeleteTableHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/traces/entries"] = traces.NewDeleteTraceEntry(o.context, o.TracesDeleteTraceEntryHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/traces"] = traces.NewDeleteTraces(o.context, o.TracesDeleteTracesHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/transactions/{id}"] = transactions.NewDeleteTransaction(o.context, o.TransactionsDeleteTransactionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/users/{username}"] = user.NewDeleteUser(o.context, o.UserDeleteUserHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/services/haproxy/configuration/userlists/{name}"] = userlist.NewDeleteUserlist(o.context, o.UserlistDeleteUserlistHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/acme/{name}"] = acme.NewEditAcmeProvider(o.context, o.AcmeEditAcmeProviderHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/cluster"] = cluster.NewEditCluster(o.context, o.ClusterEditClusterHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/crt_stores/{name}"] = crt_store.NewEditCrtStore(o.context, o.CrtStoreEditCrtStoreHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_profiles/{name}"] = log_profile.NewEditLogProfile(o.context, o.LogProfileEditLogProfileHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/mailers_section/{name}"] = mailers.NewEditMailersSection(o.context, o.MailersEditMailersSectionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"][""] = discovery.NewGetAPIEndpoints(o.context, o.DiscoveryGetAPIEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service_discovery/aws/{id}"] = service_discovery.NewGetAWSRegion(o.context, o.ServiceDiscoveryGetAWSRegionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service_discovery/aws"] = service_discovery.NewGetAWSRegions(o.context, o.ServiceDiscoveryGetAWSRegionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/acls/{index}"] = acl.NewGetACLBackend(o.context, o.ACLGetACLBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/acls/{index}"] = acl.NewGetACLDefaults(o.context, o.ACLGetACLDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}"] = acl.NewGetACLFCGIApp(o.context, o.ACLGetACLFCGIAppHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/acls/{index}"] = acl.NewGetACLFrontend(o.context, o.ACLGetACLFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/acme/{name}"] = acme.NewGetAcmeProvider(o.context, o.AcmeGetAcmeProviderHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/acme"] = acme.NewGetAcmeProviders(o.context, o.AcmeGetAcmeProvidersHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/acme"] = acme_runtime.NewGetAcmeStatus(o.context, o.AcmeRuntimeGetAcmeStatusHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/acls"] = acl.NewGetAllACLBackend(o.context, o.ACLGetAllACLBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/acls"] = acl.NewGetAllACLDefaults(o.context, o.ACLGetAllACLDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls"] = acl.NewGetAllACLFCGIApp(o.context, o.ACLGetAllACLFCGIAppHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/acls"] = acl.NewGetAllACLFrontend(o.context, o.ACLGetAllACLFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/binds"] = bind.NewGetAllBindFrontend(o.context, o.BindGetAllBindFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/binds"] = bind.NewGetAllBindLogForward(o.context, o.BindGetAllBindLogForwardHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/binds"] = bind.NewGetAllBindPeer(o.context, o.BindGetAllBindPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_ca_files"] = s_s_l_runtime.NewGetAllCaFiles(o.context, o.SslRuntimeGetAllCaFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_certs"] = s_s_l_runtime.NewGetAllCerts(o.context, o.SslRuntimeGetAllCertsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_crl_files"] = s_s_l_runtime.NewGetAllCrl(o.context, o.SslRuntimeGetAllCrlHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_crt_lists/entries"] = s_s_l_runtime.NewGetAllCrtListEntries(o.context, o.SslRuntimeGetAllCrtListEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_crt_lists"] = s_s_l_runtime.NewGetAllCrtLists(o.context, o.SslRuntimeGetAllCrtListsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/filters"] = filter.NewGetAllFilterBackend(o.context, o.FilterGetAllFilterBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/filters"] = filter.NewGetAllFilterFrontend(o.context, o.FilterGetAllFilterFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewGetAllHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewGetAllHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewGetAllHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleGetAllHTTPAfterResponseRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_checks"] = http_check.NewGetAllHTTPCheckBackend(o.context, o.HTTPCheckGetAllHTTPCheckBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks"] = http_check.NewGetAllHTTPCheckDefaults(o.context, o.HTTPCheckGetAllHTTPCheckDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules"] = http_error_rule.NewGetAllHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleGetAllHTTPErrorRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules"] = http_error_rule.NewGetAllHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleGetAllHTTPErrorRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules"] = http_error_rule.NewGetAllHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleGetAllHTTPErrorRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules"] = http_request_rule.NewGetAllHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleGetAllHTTPRequestRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules"] = http_request_rule.NewGetAllHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleGetAllHTTPRequestRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules"] = http_request_rule.NewGetAllHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleGetAllHTTPRequestRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules"] = http_response_rule.NewGetAllHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleGetAllHTTPResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules"] = http_response_rule.NewGetAllHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleGetAllHTTPResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules"] = http_response_rule.NewGetAllHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleGetAllHTTPResponseRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/log_targets"] = log_target.NewGetAllLogTargetBackend(o.context, o.LogTargetGetAllLogTargetBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets"] = log_target.NewGetAllLogTargetDefaults(o.context, o.LogTargetGetAllLogTargetDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets"] = log_target.NewGetAllLogTargetFrontend(o.context, o.LogTargetGetAllLogTargetFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/global/log_targets"] = log_target.NewGetAllLogTargetGlobal(o.context, o.LogTargetGetAllLogTargetGlobalHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets"] = log_target.NewGetAllLogTargetLogForward(o.context, o.LogTargetGetAllLogTargetLogForwardHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/log_targets"] = log_target.NewGetAllLogTargetPeer(o.context, o.LogTargetGetAllLogTargetPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules"] = quic_initial_rule.NewGetAllQUICInitialRuleDefaults(o.context, o.QUICInitialRuleGetAllQUICInitialRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules"] = quic_initial_rule.NewGetAllQUICInitialRuleFrontend(o.context, o.QUICInitialRuleGetAllQUICInitialRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/maps"] = maps.NewGetAllRuntimeMapFiles(o.context, o.MapsGetAllRuntimeMapFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/backends/{parent_name}/servers"] = serverops.NewGetAllRuntimeServer(o.context, o.ServerGetAllRuntimeServerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses"] = s_s_l_front_use.NewGetAllSSLFrontUses(o.context, o.SslFrontUseGetAllSSLFrontUsesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/servers"] = serverops.NewGetAllServerBackend(o.context, o.ServerGetAllServerBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/servers"] = serverops.NewGetAllServerPeer(o.context, o.ServerGetAllServerPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/rings/{parent_name}/servers"] = serverops.NewGetAllServerRing(o.context, o.ServerGetAllServerRingHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents"] = spoe.NewGetAllSpoeAgent(o.context, o.SpoeGetAllSpoeAgentHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files"] = spoe.NewGetAllSpoeFiles(o.context, o.SpoeGetAllSpoeFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups"] = spoe.NewGetAllSpoeGroup(o.context, o.SpoeGetAllSpoeGroupHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages"] = spoe.NewGetAllSpoeMessage(o.context, o.SpoeGetAllSpoeMessageHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes"] = spoe.NewGetAllSpoeScope(o.context, o.SpoeGetAllSpoeScopeHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/transactions"] = spoe_transactions.NewGetAllSpoeTransaction(o.context, o.SpoeTransactionsGetAllSpoeTransactionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/general"] = storage.NewGetAllStorageGeneralFiles(o.context, o.StorageGetAllStorageGeneralFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/maps"] = storage.NewGetAllStorageMapFiles(o.context, o.StorageGetAllStorageMapFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/ssl_certificates"] = storage.NewGetAllStorageSSLCertificates(o.context, o.StorageGetAllStorageSSLCertificatesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/ssl_crt_lists"] = storage.NewGetAllStorageSSLCrtListFiles(o.context, o.StorageGetAllStorageSSLCrtListFilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks"] = tcp_check.NewGetAllTCPCheckBackend(o.context, o.TCPCheckGetAllTCPCheckBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks"] = tcp_check.NewGetAllTCPCheckDefaults(o.context, o.TCPCheckGetAllTCPCheckDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewGetAllTCPRequestRuleBackend(o.context, o.TCPRequestRuleGetAllTCPRequestRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewGetAllTCPRequestRuleDefaults(o.context, o.TCPRequestRuleGetAllTCPRequestRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewGetAllTCPRequestRuleFrontend(o.context, o.TCPRequestRuleGetAllTCPRequestRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules"] = tcp_response_rule.NewGetAllTCPResponseRuleBackend(o.context, o.TCPResponseRuleGetAllTCPResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules"] = tcp_response_rule.NewGetAllTCPResponseRuleDefaults(o.context, o.TCPResponseRuleGetAllTCPResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{name}"] = backend.NewGetBackend(o.context, o.BackendGetBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}"] = backend_switching_rule.NewGetBackendSwitchingRule(o.context, o.BackendSwitchingRuleGetBackendSwitchingRuleHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules"] = backend_switching_rule.NewGetBackendSwitchingRules(o.context, o.BackendSwitchingRuleGetBackendSwitchingRulesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends"] = backend.NewGetBackends(o.context, o.BackendGetBackendsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/binds/{name}"] = bind.NewGetBindFrontend(o.context, o.BindGetBindFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}"] = bind.NewGetBindLogForward(o.context, o.BindGetBindLogForwardHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/binds/{name}"] = bind.NewGetBindPeer(o.context, o.BindGetBindPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}"] = s_s_l_runtime.NewGetCaEntry(o.context, o.SslRuntimeGetCaEntryHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_ca_files/{name}"] = s_s_l_runtime.NewGetCaFile(o.context, o.SslRuntimeGetCaFileHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/caches/{name}"] = cache.NewGetCache(o.context, o.CacheGetCacheHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/caches"] = cache.NewGetCaches(o.context, o.CacheGetCachesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_certs/{name}"] = s_s_l_runtime.NewGetCert(o.context, o.SslRuntimeGetCertHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/cluster"] = cluster.NewGetCluster(o.context, o.ClusterGetClusterHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration"] = discovery.NewGetConfigurationEndpoints(o.context, o.DiscoveryGetConfigurationEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/version"] = configuration.NewGetConfigurationVersion(o.context, o.ConfigurationGetConfigurationVersionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service_discovery/consul/{id}"] = service_discovery.NewGetConsul(o.context, o.ServiceDiscoveryGetConsulHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service_discovery/consul"] = service_discovery.NewGetConsuls(o.context, o.ServiceDiscoveryGetConsulsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/ssl_crl_files/{name}"] = s_s_l_runtime.NewGetCrl(o.context, o.SslRuntimeGetCrlHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/crt_loads/{certificate}"] = crt_load.NewGetCrtLoad(o.context, o.CrtLoadGetCrtLoadHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/crt_loads"] = crt_load.NewGetCrtLoads(o.context, o.CrtLoadGetCrtLoadsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/crt_stores/{name}"] = crt_store.NewGetCrtStore(o.context, o.CrtStoreGetCrtStoreHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/crt_stores"] = crt_store.NewGetCrtStores(o.context, o.CrtStoreGetCrtStoresHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/captures/{index}"] = declare_capture.NewGetDeclareCapture(o.context, o.DeclareCaptureGetDeclareCaptureHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/captures"] = declare_capture.NewGetDeclareCaptures(o.context, o.DeclareCaptureGetDeclareCapturesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{name}"] = defaults.NewGetDefaultsSection(o.context, o.DefaultsGetDefaultsSectionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults"] = defaults.NewGetDefaultsSections(o.context, o.DefaultsGetDefaultsSectionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}"] = dgram_bind.NewGetDgramBind(o.context, o.DgramBindGetDgramBindHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds"] = dgram_bind.NewGetDgramBinds(o.context, o.DgramBindGetDgramBindsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/fcgi_apps/{name}"] = fcgi_app.NewGetFCGIApp(o.context, o.FCGIAppGetFCGIAppHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/fcgi_apps"] = fcgi_app.NewGetFCGIApps(o.context, o.FCGIAppGetFCGIAppsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/filters/{index}"] = filter.NewGetFilterBackend(o.context, o.FilterGetFilterBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/filters/{index}"] = filter.NewGetFilterFrontend(o.context, o.FilterGetFilterFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{name}"] = frontend.NewGetFrontend(o.context, o.FrontendGetFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends"] = frontend.NewGetFrontends(o.context, o.FrontendGetFrontendsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/global"] = global.NewGetGlobal(o.context, o.GlobalGetGlobalHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/groups/{name}"] = group.NewGetGroup(o.context, o.GroupGetGroupHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/groups"] = group.NewGetGroups(o.context, o.GroupGetGroupsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/raw"] = configuration.NewGetHAProxyConfiguration(o.context, o.ConfigurationGetHAProxyConfigurationHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewGetHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewGetHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewGetHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleGetHTTPAfterResponseRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}"] = http_check.NewGetHTTPCheckBackend(o.context, o.HTTPCheckGetHTTPCheckBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}"] = http_check.NewGetHTTPCheckDefaults(o.context, o.HTTPCheckGetHTTPCheckDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewGetHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleGetHTTPErrorRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewGetHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleGetHTTPErrorRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewGetHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleGetHTTPErrorRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/http_errors_sections/{name}"] = http_errors.NewGetHTTPErrorsSection(o.context, o.HTTPErrorsGetHTTPErrorsSectionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/http_errors_sections"] = http_errors.NewGetHTTPErrorsSections(o.context, o.HTTPErrorsGetHTTPErrorsSectionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewGetHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleGetHTTPRequestRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewGetHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleGetHTTPRequestRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewGetHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleGetHTTPRequestRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewGetHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleGetHTTPResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewGetHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleGetHTTPResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewGetHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleGetHTTPResponseRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy"] = discovery.NewGetHaproxyEndpoints(o.context, o.DiscoveryGetHaproxyEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/info"] = information.NewGetHaproxyProcessInfo(o.context, o.InformationGetHaproxyProcessInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/health"] = health.NewGetHealth(o.context, o.HealthGetHealthHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/info"] = information.NewGetInfo(o.context, o.InformationGetInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{name}"] = log_forward.NewGetLogForward(o.context, o.LogForwardGetLogForwardHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards"] = log_forward.NewGetLogForwards(o.context, o.LogForwardGetLogForwardsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_profiles/{name}"] = log_profile.NewGetLogProfile(o.context, o.LogProfileGetLogProfileHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_profiles"] = log_profile.NewGetLogProfiles(o.context, o.LogProfileGetLogProfilesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}"] = log_target.NewGetLogTargetBackend(o.context, o.LogTargetGetLogTargetBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}"] = log_target.NewGetLogTargetDefaults(o.context, o.LogTargetGetLogTargetDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}"] = log_target.NewGetLogTargetFrontend(o.context, o.LogTargetGetLogTargetFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/global/log_targets/{index}"] = log_target.NewGetLogTargetGlobal(o.context, o.LogTargetGetLogTargetGlobalHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}"] = log_target.NewGetLogTargetLogForward(o.context, o.LogTargetGetLogTargetLogForwardHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}"] = log_target.NewGetLogTargetPeer(o.context, o.LogTargetGetLogTargetPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/mailer_entries"] = mailer_entry.NewGetMailerEntries(o.context, o.MailerEntryGetMailerEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/mailer_entries/{name}"] = mailer_entry.NewGetMailerEntry(o.context, o.MailerEntryGetMailerEntryHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/mailers_section/{name}"] = mailers.NewGetMailersSection(o.context, o.MailersGetMailersSectionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/mailers_section"] = mailers.NewGetMailersSections(o.context, o.MailersGetMailersSectionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/nameservers/{name}"] = nameserver.NewGetNameserver(o.context, o.NameserverGetNameserverHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/nameservers"] = nameserver.NewGetNameservers(o.context, o.NameserverGetNameserversHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/maps/{name}"] = maps.NewGetOneRuntimeMap(o.context, o.MapsGetOneRuntimeMapHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{name}"] = spoe.NewGetOneSpoeFile(o.context, o.SpoeGetOneSpoeFileHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/general/{name}"] = storage.NewGetOneStorageGeneralFile(o.context, o.StorageGetOneStorageGeneralFileHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/maps/{name}"] = storage.NewGetOneStorageMap(o.context, o.StorageGetOneStorageMapHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/ssl_certificates/{name}"] = storage.NewGetOneStorageSSLCertificate(o.context, o.StorageGetOneStorageSSLCertificateHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage/ssl_crt_lists/{name}"] = storage.NewGetOneStorageSSLCrtListFile(o.context, o.StorageGetOneStorageSSLCrtListFileHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/specification_openapiv3"] = specification_openapiv3.NewGetOpenapiv3Specification(o.context, o.SpecificationOpenapiv3GetOpenapiv3SpecificationHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peer_entries"] = peer_entry.NewGetPeerEntries(o.context, o.PeerEntryGetPeerEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peer_entries/{name}"] = peer_entry.NewGetPeerEntry(o.context, o.PeerEntryGetPeerEntryHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peer_section/{name}"] = peer.NewGetPeerSection(o.context, o.PeerGetPeerSectionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peer_section"] = peer.NewGetPeerSections(o.context, o.PeerGetPeerSectionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/programs/{name}"] = process_manager.NewGetProgram(o.context, o.ProcessManagerGetProgramHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/programs"] = process_manager.NewGetPrograms(o.context, o.ProcessManagerGetProgramsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewGetQUICInitialRuleDefaults(o.context, o.QUICInitialRuleGetQUICInitialRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewGetQUICInitialRuleFrontend(o.context, o.QUICInitialRuleGetQUICInitialRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/reloads/{id}"] = reloads.NewGetReload(o.context, o.ReloadsGetReloadHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/reloads"] = reloads.NewGetReloads(o.context, o.ReloadsGetReloadsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/resolvers/{name}"] = resolver.NewGetResolver(o.context, o.ResolverGetResolverHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/resolvers"] = resolver.NewGetResolvers(o.context, o.ResolverGetResolversHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/rings/{name}"] = ring.NewGetRing(o.context, o.RingGetRingHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/rings"] = ring.NewGetRings(o.context, o.RingGetRingsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime"] = discovery.NewGetRuntimeEndpoints(o.context, o.DiscoveryGetRuntimeEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/maps/{parent_name}/entries/{id}"] = maps.NewGetRuntimeMapEntry(o.context, o.MapsGetRuntimeMapEntryHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/backends/{parent_name}/servers/{name}"] = serverops.NewGetRuntimeServer(o.context, o.ServerGetRuntimeServerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}"] = s_s_l_front_use.NewGetSSLFrontUse(o.context, o.SslFrontUseGetSSLFrontUseHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/servers/{name}"] = serverops.NewGetServerBackend(o.context, o.ServerGetServerBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/servers/{name}"] = serverops.NewGetServerPeer(o.context, o.ServerGetServerPeerHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/rings/{parent_name}/servers/{name}"] = serverops.NewGetServerRing(o.context, o.ServerGetServerRingHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}"] = server_switching_rule.NewGetServerSwitchingRule(o.context, o.ServerSwitchingRuleGetServerSwitchingRuleHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules"] = server_switching_rule.NewGetServerSwitchingRules(o.context, o.ServerSwitchingRuleGetServerSwitchingRulesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}"] = server_template.NewGetServerTemplate(o.context, o.ServerTemplateGetServerTemplateHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/server_templates"] = server_template.NewGetServerTemplates(o.context, o.ServerTemplateGetServerTemplatesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services"] = discovery.NewGetServicesEndpoints(o.context, o.DiscoveryGetServicesEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/sites/{name}"] = sites.NewGetSite(o.context, o.SitesGetSiteHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/sites"] = sites.NewGetSites(o.context, o.SitesGetSitesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/specification"] = specification.NewGetSpecification(o.context, o.SpecificationGetSpecificationHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}"] = spoe.NewGetSpoeAgent(o.context, o.SpoeGetSpoeAgentHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/{parent_name}/version"] = spoe.NewGetSpoeConfigurationVersion(o.context, o.SpoeGetSpoeConfigurationVersionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe"] = discovery.NewGetSpoeEndpoints(o.context, o.DiscoveryGetSpoeEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}"] = spoe.NewGetSpoeGroup(o.context, o.SpoeGetSpoeGroupHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}"] = spoe.NewGetSpoeMessage(o.context, o.SpoeGetSpoeMessageHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}"] = spoe.NewGetSpoeScope(o.context, o.SpoeGetSpoeScopeHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}"] = spoe_transactions.NewGetSpoeTransaction(o.context, o.SpoeTransactionsGetSpoeTransactionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/stats/native"] = stats.NewGetStats(o.context, o.StatsGetStatsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/stats"] = discovery.NewGetStatsEndpoints(o.context, o.DiscoveryGetStatsEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}"] = stick_rule.NewGetStickRule(o.context, o.StickRuleGetStickRuleHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules"] = stick_rule.NewGetStickRules(o.context, o.StickRuleGetStickRulesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/stick_tables/{name}"] = stick_table.NewGetStickTable(o.context, o.StickTableGetStickTableHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/stick_tables/{parent_name}/entries"] = stick_table.NewGetStickTableEntries(o.context, o.StickTableGetStickTableEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/stick_tables"] = stick_table.NewGetStickTables(o.context, o.StickTableGetStickTablesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/storage"] = discovery.NewGetStorageEndpoints(o.context, o.DiscoveryGetStorageEndpointsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}"] = tcp_check.NewGetTCPCheckBackend(o.context, o.TCPCheckGetTCPCheckBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}"] = tcp_check.NewGetTCPCheckDefaults(o.context, o.TCPCheckGetTCPCheckDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewGetTCPRequestRuleBackend(o.context, o.TCPRequestRuleGetTCPRequestRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewGetTCPRequestRuleDefaults(o.context, o.TCPRequestRuleGetTCPRequestRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewGetTCPRequestRuleFrontend(o.context, o.TCPRequestRuleGetTCPRequestRuleFrontendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewGetTCPResponseRuleBackend(o.context, o.TCPResponseRuleGetTCPResponseRuleBackendHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewGetTCPResponseRuleDefaults(o.context, o.TCPResponseRuleGetTCPResponseRuleDefaultsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/tables/{name}"] = table.NewGetTable(o.context, o.TableGetTableHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/peers/{parent_name}/tables"] = table.NewGetTables(o.context, o.TableGetTablesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/traces"] = traces.NewGetTraces(o.context, o.TracesGetTracesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/transactions/{id}"] = transactions.NewGetTransaction(o.context, o.TransactionsGetTransactionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/transactions"] = transactions.NewGetTransactions(o.context, o.TransactionsGetTransactionsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/users/{username}"] = user.NewGetUser(o.context, o.UserGetUserHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/userlists/{name}"] = userlist.NewGetUserlist(o.context, o.UserlistGetUserlistHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/userlists"] = userlist.NewGetUserlists(o.context, o.UserlistGetUserlistsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/configuration/users"] = user.NewGetUsers(o.context, o.UserGetUsersHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/cluster/certificate"] = cluster.NewInitiateCertificateRefresh(o.context, o.ClusterInitiateCertificateRefreshHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/cluster"] = cluster.NewPostCluster(o.context, o.ClusterPostClusterHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/configuration/raw"] = configuration.NewPostHAProxyConfiguration(o.context, o.ConfigurationPostHAProxyConfigurationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/acme"] = acme_runtime.NewRenewAcmeCertificate(o.context, o.AcmeRuntimeRenewAcmeCertificateHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/service_discovery/aws/{id}"] = service_discovery.NewReplaceAWSRegion(o.context, o.ServiceDiscoveryReplaceAWSRegionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/acls/{index}"] = acl.NewReplaceACLBackend(o.context, o.ACLReplaceACLBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/acls/{index}"] = acl.NewReplaceACLDefaults(o.context, o.ACLReplaceACLDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}"] = acl.NewReplaceACLFCGIApp(o.context, o.ACLReplaceACLFCGIAppHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/acls/{index}"] = acl.NewReplaceACLFrontend(o.context, o.ACLReplaceACLFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/acls"] = acl.NewReplaceAllACLBackend(o.context, o.ACLReplaceAllACLBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/acls"] = acl.NewReplaceAllACLDefaults(o.context, o.ACLReplaceAllACLDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/fcgi_apps/{parent_name}/acls"] = acl.NewReplaceAllACLFCGIApp(o.context, o.ACLReplaceAllACLFCGIAppHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/acls"] = acl.NewReplaceAllACLFrontend(o.context, o.ACLReplaceAllACLFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/filters"] = filter.NewReplaceAllFilterBackend(o.context, o.FilterReplaceAllFilterBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/filters"] = filter.NewReplaceAllFilterFrontend(o.context, o.FilterReplaceAllFilterFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules"] = http_after_response_rule.NewReplaceAllHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleReplaceAllHTTPAfterResponseRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_checks"] = http_check.NewReplaceAllHTTPCheckBackend(o.context, o.HTTPCheckReplaceAllHTTPCheckBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks"] = http_check.NewReplaceAllHTTPCheckDefaults(o.context, o.HTTPCheckReplaceAllHTTPCheckDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules"] = http_error_rule.NewReplaceAllHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleReplaceAllHTTPErrorRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules"] = http_error_rule.NewReplaceAllHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleReplaceAllHTTPErrorRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules"] = http_error_rule.NewReplaceAllHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleReplaceAllHTTPErrorRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules"] = http_request_rule.NewReplaceAllHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleReplaceAllHTTPRequestRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules"] = http_request_rule.NewReplaceAllHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleReplaceAllHTTPRequestRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules"] = http_request_rule.NewReplaceAllHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleReplaceAllHTTPRequestRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules"] = http_response_rule.NewReplaceAllHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleReplaceAllHTTPResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules"] = http_response_rule.NewReplaceAllHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleReplaceAllHTTPResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules"] = http_response_rule.NewReplaceAllHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleReplaceAllHTTPResponseRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/log_targets"] = log_target.NewReplaceAllLogTargetBackend(o.context, o.LogTargetReplaceAllLogTargetBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets"] = log_target.NewReplaceAllLogTargetDefaults(o.context, o.LogTargetReplaceAllLogTargetDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets"] = log_target.NewReplaceAllLogTargetFrontend(o.context, o.LogTargetReplaceAllLogTargetFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/global/log_targets"] = log_target.NewReplaceAllLogTargetGlobal(o.context, o.LogTargetReplaceAllLogTargetGlobalHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets"] = log_target.NewReplaceAllLogTargetLogForward(o.context, o.LogTargetReplaceAllLogTargetLogForwardHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peers/{parent_name}/log_targets"] = log_target.NewReplaceAllLogTargetPeer(o.context, o.LogTargetReplaceAllLogTargetPeerHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules"] = quic_initial_rule.NewReplaceAllQUICInitialRuleDefaults(o.context, o.QUICInitialRuleReplaceAllQUICInitialRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules"] = quic_initial_rule.NewReplaceAllQUICInitialRuleFrontend(o.context, o.QUICInitialRuleReplaceAllQUICInitialRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks"] = tcp_check.NewReplaceAllTCPCheckBackend(o.context, o.TCPCheckReplaceAllTCPCheckBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks"] = tcp_check.NewReplaceAllTCPCheckDefaults(o.context, o.TCPCheckReplaceAllTCPCheckDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewReplaceAllTCPRequestRuleBackend(o.context, o.TCPRequestRuleReplaceAllTCPRequestRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewReplaceAllTCPRequestRuleDefaults(o.context, o.TCPRequestRuleReplaceAllTCPRequestRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules"] = tcp_request_rule.NewReplaceAllTCPRequestRuleFrontend(o.context, o.TCPRequestRuleReplaceAllTCPRequestRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules"] = tcp_response_rule.NewReplaceAllTCPResponseRuleBackend(o.context, o.TCPResponseRuleReplaceAllTCPResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules"] = tcp_response_rule.NewReplaceAllTCPResponseRuleDefaults(o.context, o.TCPResponseRuleReplaceAllTCPResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{name}"] = backend.NewReplaceBackend(o.context, o.BackendReplaceBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}"] = backend_switching_rule.NewReplaceBackendSwitchingRule(o.context, o.BackendSwitchingRuleReplaceBackendSwitchingRuleHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules"] = backend_switching_rule.NewReplaceBackendSwitchingRules(o.context, o.BackendSwitchingRuleReplaceBackendSwitchingRulesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/binds/{name}"] = bind.NewReplaceBindFrontend(o.context, o.BindReplaceBindFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}"] = bind.NewReplaceBindLogForward(o.context, o.BindReplaceBindLogForwardHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peers/{parent_name}/binds/{name}"] = bind.NewReplaceBindPeer(o.context, o.BindReplaceBindPeerHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/caches/{name}"] = cache.NewReplaceCache(o.context, o.CacheReplaceCacheHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/ssl_certs/{name}"] = s_s_l_runtime.NewReplaceCert(o.context, o.SslRuntimeReplaceCertHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/service_discovery/consul/{id}"] = service_discovery.NewReplaceConsul(o.context, o.ServiceDiscoveryReplaceConsulHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/ssl_crl_files/{name}"] = s_s_l_runtime.NewReplaceCrl(o.context, o.SslRuntimeReplaceCrlHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/crt_loads/{certificate}"] = crt_load.NewReplaceCrtLoad(o.context, o.CrtLoadReplaceCrtLoadHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/captures/{index}"] = declare_capture.NewReplaceDeclareCapture(o.context, o.DeclareCaptureReplaceDeclareCaptureHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/captures"] = declare_capture.NewReplaceDeclareCaptures(o.context, o.DeclareCaptureReplaceDeclareCapturesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{name}"] = defaults.NewReplaceDefaultsSection(o.context, o.DefaultsReplaceDefaultsSectionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}"] = dgram_bind.NewReplaceDgramBind(o.context, o.DgramBindReplaceDgramBindHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/fcgi_apps/{name}"] = fcgi_app.NewReplaceFCGIApp(o.context, o.FCGIAppReplaceFCGIAppHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/filters/{index}"] = filter.NewReplaceFilterBackend(o.context, o.FilterReplaceFilterBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/filters/{index}"] = filter.NewReplaceFilterFrontend(o.context, o.FilterReplaceFilterFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{name}"] = frontend.NewReplaceFrontend(o.context, o.FrontendReplaceFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/global"] = global.NewReplaceGlobal(o.context, o.GlobalReplaceGlobalHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/groups/{name}"] = group.NewReplaceGroup(o.context, o.GroupReplaceGroupHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewReplaceHTTPAfterResponseRuleBackend(o.context, o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewReplaceHTTPAfterResponseRuleDefaults(o.context, o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}"] = http_after_response_rule.NewReplaceHTTPAfterResponseRuleFrontend(o.context, o.HTTPAfterResponseRuleReplaceHTTPAfterResponseRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}"] = http_check.NewReplaceHTTPCheckBackend(o.context, o.HTTPCheckReplaceHTTPCheckBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}"] = http_check.NewReplaceHTTPCheckDefaults(o.context, o.HTTPCheckReplaceHTTPCheckDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewReplaceHTTPErrorRuleBackend(o.context, o.HTTPErrorRuleReplaceHTTPErrorRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewReplaceHTTPErrorRuleDefaults(o.context, o.HTTPErrorRuleReplaceHTTPErrorRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}"] = http_error_rule.NewReplaceHTTPErrorRuleFrontend(o.context, o.HTTPErrorRuleReplaceHTTPErrorRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/http_errors_sections/{name}"] = http_errors.NewReplaceHTTPErrorsSection(o.context, o.HTTPErrorsReplaceHTTPErrorsSectionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewReplaceHTTPRequestRuleBackend(o.context, o.HTTPRequestRuleReplaceHTTPRequestRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewReplaceHTTPRequestRuleDefaults(o.context, o.HTTPRequestRuleReplaceHTTPRequestRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}"] = http_request_rule.NewReplaceHTTPRequestRuleFrontend(o.context, o.HTTPRequestRuleReplaceHTTPRequestRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewReplaceHTTPResponseRuleBackend(o.context, o.HTTPResponseRuleReplaceHTTPResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewReplaceHTTPResponseRuleDefaults(o.context, o.HTTPResponseRuleReplaceHTTPResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}"] = http_response_rule.NewReplaceHTTPResponseRuleFrontend(o.context, o.HTTPResponseRuleReplaceHTTPResponseRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_forwards/{name}"] = log_forward.NewReplaceLogForward(o.context, o.LogForwardReplaceLogForwardHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}"] = log_target.NewReplaceLogTargetBackend(o.context, o.LogTargetReplaceLogTargetBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}"] = log_target.NewReplaceLogTargetDefaults(o.context, o.LogTargetReplaceLogTargetDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}"] = log_target.NewReplaceLogTargetFrontend(o.context, o.LogTargetReplaceLogTargetFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/global/log_targets/{index}"] = log_target.NewReplaceLogTargetGlobal(o.context, o.LogTargetReplaceLogTargetGlobalHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}"] = log_target.NewReplaceLogTargetLogForward(o.context, o.LogTargetReplaceLogTargetLogForwardHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}"] = log_target.NewReplaceLogTargetPeer(o.context, o.LogTargetReplaceLogTargetPeerHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/mailer_entries/{name}"] = mailer_entry.NewReplaceMailerEntry(o.context, o.MailerEntryReplaceMailerEntryHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/nameservers/{name}"] = nameserver.NewReplaceNameserver(o.context, o.NameserverReplaceNameserverHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peer_entries/{name}"] = peer_entry.NewReplacePeerEntry(o.context, o.PeerEntryReplacePeerEntryHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/programs/{name}"] = process_manager.NewReplaceProgram(o.context, o.ProcessManagerReplaceProgramHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewReplaceQUICInitialRuleDefaults(o.context, o.QUICInitialRuleReplaceQUICInitialRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}"] = quic_initial_rule.NewReplaceQUICInitialRuleFrontend(o.context, o.QUICInitialRuleReplaceQUICInitialRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/resolvers/{name}"] = resolver.NewReplaceResolver(o.context, o.ResolverReplaceResolverHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/rings/{name}"] = ring.NewReplaceRing(o.context, o.RingReplaceRingHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/maps/{parent_name}/entries/{id}"] = maps.NewReplaceRuntimeMapEntry(o.context, o.MapsReplaceRuntimeMapEntryHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/backends/{parent_name}/servers/{name}"] = serverops.NewReplaceRuntimeServer(o.context, o.ServerReplaceRuntimeServerHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}"] = s_s_l_front_use.NewReplaceSSLFrontUse(o.context, o.SslFrontUseReplaceSSLFrontUseHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/servers/{name}"] = serverops.NewReplaceServerBackend(o.context, o.ServerReplaceServerBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peers/{parent_name}/servers/{name}"] = serverops.NewReplaceServerPeer(o.context, o.ServerReplaceServerPeerHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/rings/{parent_name}/servers/{name}"] = serverops.NewReplaceServerRing(o.context, o.ServerReplaceServerRingHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}"] = server_switching_rule.NewReplaceServerSwitchingRule(o.context, o.ServerSwitchingRuleReplaceServerSwitchingRuleHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/server_switching_rules"] = server_switching_rule.NewReplaceServerSwitchingRules(o.context, o.ServerSwitchingRuleReplaceServerSwitchingRulesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}"] = server_template.NewReplaceServerTemplate(o.context, o.ServerTemplateReplaceServerTemplateHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/sites/{name}"] = sites.NewReplaceSite(o.context, o.SitesReplaceSiteHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}"] = spoe.NewReplaceSpoeAgent(o.context, o.SpoeReplaceSpoeAgentHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}"] = spoe.NewReplaceSpoeGroup(o.context, o.SpoeReplaceSpoeGroupHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}"] = spoe.NewReplaceSpoeMessage(o.context, o.SpoeReplaceSpoeMessageHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}"] = stick_rule.NewReplaceStickRule(o.context, o.StickRuleReplaceStickRuleHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/stick_rules"] = stick_rule.NewReplaceStickRules(o.context, o.StickRuleReplaceStickRulesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/storage/general/{name}"] = storage.NewReplaceStorageGeneralFile(o.context, o.StorageReplaceStorageGeneralFileHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/storage/maps/{name}"] = storage.NewReplaceStorageMapFile(o.context, o.StorageReplaceStorageMapFileHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/storage/ssl_certificates/{name}"] = storage.NewReplaceStorageSSLCertificate(o.context, o.StorageReplaceStorageSSLCertificateHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/storage/ssl_crt_lists/{name}"] = storage.NewReplaceStorageSSLCrtListFile(o.context, o.StorageReplaceStorageSSLCrtListFileHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}"] = tcp_check.NewReplaceTCPCheckBackend(o.context, o.TCPCheckReplaceTCPCheckBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}"] = tcp_check.NewReplaceTCPCheckDefaults(o.context, o.TCPCheckReplaceTCPCheckDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewReplaceTCPRequestRuleBackend(o.context, o.TCPRequestRuleReplaceTCPRequestRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewReplaceTCPRequestRuleDefaults(o.context, o.TCPRequestRuleReplaceTCPRequestRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}"] = tcp_request_rule.NewReplaceTCPRequestRuleFrontend(o.context, o.TCPRequestRuleReplaceTCPRequestRuleFrontendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewReplaceTCPResponseRuleBackend(o.context, o.TCPResponseRuleReplaceTCPResponseRuleBackendHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}"] = tcp_response_rule.NewReplaceTCPResponseRuleDefaults(o.context, o.TCPResponseRuleReplaceTCPResponseRuleDefaultsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/peers/{parent_name}/tables/{name}"] = table.NewReplaceTable(o.context, o.TableReplaceTableHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/traces"] = traces.NewReplaceTraces(o.context, o.TracesReplaceTracesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/configuration/users/{username}"] = user.NewReplaceUser(o.context, o.UserReplaceUserHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/services/haproxy/runtime/ssl_ca_files/{name}"] = s_s_l_runtime.NewSetCaFile(o.context, o.SslRuntimeSetCaFileHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/runtime/stick_tables/{parent_name}/entries"] = stick_table.NewSetStickTableEntries(o.context, o.StickTableSetStickTableEntriesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/services/haproxy/runtime/maps/{parent_name}/entries"] = maps.NewShowRuntimeMap(o.context, o.MapsShowRuntimeMapHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/spoe/spoe_files/{parent_name}/transactions"] = spoe_transactions.NewStartSpoeTransaction(o.context, o.SpoeTransactionsStartSpoeTransactionHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/services/haproxy/transactions"] = transactions.NewStartTransaction(o.context, o.TransactionsStartTransactionHandler) -} - -// Serve creates a http handler to serve the API over HTTP -// can be used directly in http.ListenAndServe(":8000", api.Serve(nil)) -func (o *DataPlaneAPI) Serve(builder middleware.Builder) http.Handler { - o.Init() - - if o.Middleware != nil { - return o.Middleware(builder) - } - if o.useSwaggerUI { - return o.context.APIHandlerSwaggerUI(builder) - } - return o.context.APIHandler(builder) -} - -// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit -func (o *DataPlaneAPI) Init() { - if len(o.handlers) == 0 { - o.initHandlerCache() - } -} - -// RegisterConsumer allows you to add (or override) a consumer for a media type. -func (o *DataPlaneAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) { - o.customConsumers[mediaType] = consumer -} - -// RegisterProducer allows you to add (or override) a producer for a media type. -func (o *DataPlaneAPI) RegisterProducer(mediaType string, producer runtime.Producer) { - o.customProducers[mediaType] = producer -} - -// AddMiddlewareFor adds a http middleware to existing handler -func (o *DataPlaneAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) { - um := strings.ToUpper(method) - if path == "/" { - path = "" - } - o.Init() - if h, ok := o.handlers[um][path]; ok { - o.handlers[um][path] = builder(h) - } -} diff --git a/operations/declare_capture/create_declare_capture.go b/operations/declare_capture/create_declare_capture.go deleted file mode 100644 index a3bd8724..00000000 --- a/operations/declare_capture/create_declare_capture.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateDeclareCaptureHandlerFunc turns a function with the right signature into a create declare capture handler -type CreateDeclareCaptureHandlerFunc func(CreateDeclareCaptureParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateDeclareCaptureHandlerFunc) Handle(params CreateDeclareCaptureParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateDeclareCaptureHandler interface for that can handle valid create declare capture params -type CreateDeclareCaptureHandler interface { - Handle(CreateDeclareCaptureParams, interface{}) middleware.Responder -} - -// NewCreateDeclareCapture creates a new http.Handler for the create declare capture operation -func NewCreateDeclareCapture(ctx *middleware.Context, handler CreateDeclareCaptureHandler) *CreateDeclareCapture { - return &CreateDeclareCapture{Context: ctx, Handler: handler} -} - -/* - CreateDeclareCapture swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/captures/{index} DeclareCapture createDeclareCapture - -# Add a new declare capture - -Adds a new declare capture in the specified frontend in the configuration file. -*/ -type CreateDeclareCapture struct { - Context *middleware.Context - Handler CreateDeclareCaptureHandler -} - -func (o *CreateDeclareCapture) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateDeclareCaptureParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/create_declare_capture_parameters.go b/operations/declare_capture/create_declare_capture_parameters.go deleted file mode 100644 index b0a4af84..00000000 --- a/operations/declare_capture/create_declare_capture_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateDeclareCaptureParams creates a new CreateDeclareCaptureParams object -// with the default values initialized. -func NewCreateDeclareCaptureParams() CreateDeclareCaptureParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateDeclareCaptureParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateDeclareCaptureParams contains all the bound params for the create declare capture operation -// typically these are obtained from a http.Request -// -// swagger:parameters createDeclareCapture -type CreateDeclareCaptureParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Capture - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Declare Capture Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateDeclareCaptureParams() beforehand. -func (o *CreateDeclareCaptureParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Capture - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateDeclareCaptureParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateDeclareCaptureParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateDeclareCaptureParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateDeclareCaptureParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateDeclareCaptureParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateDeclareCaptureParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/declare_capture/create_declare_capture_responses.go b/operations/declare_capture/create_declare_capture_responses.go deleted file mode 100644 index 841fc063..00000000 --- a/operations/declare_capture/create_declare_capture_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateDeclareCaptureCreatedCode is the HTTP code returned for type CreateDeclareCaptureCreated -const CreateDeclareCaptureCreatedCode int = 201 - -/* -CreateDeclareCaptureCreated Declare capture created - -swagger:response createDeclareCaptureCreated -*/ -type CreateDeclareCaptureCreated struct { - - /* - In: Body - */ - Payload *models.Capture `json:"body,omitempty"` -} - -// NewCreateDeclareCaptureCreated creates CreateDeclareCaptureCreated with default headers values -func NewCreateDeclareCaptureCreated() *CreateDeclareCaptureCreated { - - return &CreateDeclareCaptureCreated{} -} - -// WithPayload adds the payload to the create declare capture created response -func (o *CreateDeclareCaptureCreated) WithPayload(payload *models.Capture) *CreateDeclareCaptureCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create declare capture created response -func (o *CreateDeclareCaptureCreated) SetPayload(payload *models.Capture) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDeclareCaptureCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDeclareCaptureAcceptedCode is the HTTP code returned for type CreateDeclareCaptureAccepted -const CreateDeclareCaptureAcceptedCode int = 202 - -/* -CreateDeclareCaptureAccepted Configuration change accepted and reload requested - -swagger:response createDeclareCaptureAccepted -*/ -type CreateDeclareCaptureAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Capture `json:"body,omitempty"` -} - -// NewCreateDeclareCaptureAccepted creates CreateDeclareCaptureAccepted with default headers values -func NewCreateDeclareCaptureAccepted() *CreateDeclareCaptureAccepted { - - return &CreateDeclareCaptureAccepted{} -} - -// WithReloadID adds the reloadId to the create declare capture accepted response -func (o *CreateDeclareCaptureAccepted) WithReloadID(reloadID string) *CreateDeclareCaptureAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create declare capture accepted response -func (o *CreateDeclareCaptureAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create declare capture accepted response -func (o *CreateDeclareCaptureAccepted) WithPayload(payload *models.Capture) *CreateDeclareCaptureAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create declare capture accepted response -func (o *CreateDeclareCaptureAccepted) SetPayload(payload *models.Capture) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDeclareCaptureAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDeclareCaptureBadRequestCode is the HTTP code returned for type CreateDeclareCaptureBadRequest -const CreateDeclareCaptureBadRequestCode int = 400 - -/* -CreateDeclareCaptureBadRequest Bad request - -swagger:response createDeclareCaptureBadRequest -*/ -type CreateDeclareCaptureBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDeclareCaptureBadRequest creates CreateDeclareCaptureBadRequest with default headers values -func NewCreateDeclareCaptureBadRequest() *CreateDeclareCaptureBadRequest { - - return &CreateDeclareCaptureBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create declare capture bad request response -func (o *CreateDeclareCaptureBadRequest) WithConfigurationVersion(configurationVersion string) *CreateDeclareCaptureBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create declare capture bad request response -func (o *CreateDeclareCaptureBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create declare capture bad request response -func (o *CreateDeclareCaptureBadRequest) WithPayload(payload *models.Error) *CreateDeclareCaptureBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create declare capture bad request response -func (o *CreateDeclareCaptureBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDeclareCaptureBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDeclareCaptureConflictCode is the HTTP code returned for type CreateDeclareCaptureConflict -const CreateDeclareCaptureConflictCode int = 409 - -/* -CreateDeclareCaptureConflict The specified resource already exists - -swagger:response createDeclareCaptureConflict -*/ -type CreateDeclareCaptureConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDeclareCaptureConflict creates CreateDeclareCaptureConflict with default headers values -func NewCreateDeclareCaptureConflict() *CreateDeclareCaptureConflict { - - return &CreateDeclareCaptureConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create declare capture conflict response -func (o *CreateDeclareCaptureConflict) WithConfigurationVersion(configurationVersion string) *CreateDeclareCaptureConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create declare capture conflict response -func (o *CreateDeclareCaptureConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create declare capture conflict response -func (o *CreateDeclareCaptureConflict) WithPayload(payload *models.Error) *CreateDeclareCaptureConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create declare capture conflict response -func (o *CreateDeclareCaptureConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDeclareCaptureConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateDeclareCaptureDefault General Error - -swagger:response createDeclareCaptureDefault -*/ -type CreateDeclareCaptureDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDeclareCaptureDefault creates CreateDeclareCaptureDefault with default headers values -func NewCreateDeclareCaptureDefault(code int) *CreateDeclareCaptureDefault { - if code <= 0 { - code = 500 - } - - return &CreateDeclareCaptureDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create declare capture default response -func (o *CreateDeclareCaptureDefault) WithStatusCode(code int) *CreateDeclareCaptureDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create declare capture default response -func (o *CreateDeclareCaptureDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create declare capture default response -func (o *CreateDeclareCaptureDefault) WithConfigurationVersion(configurationVersion string) *CreateDeclareCaptureDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create declare capture default response -func (o *CreateDeclareCaptureDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create declare capture default response -func (o *CreateDeclareCaptureDefault) WithPayload(payload *models.Error) *CreateDeclareCaptureDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create declare capture default response -func (o *CreateDeclareCaptureDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDeclareCaptureDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/create_declare_capture_urlbuilder.go b/operations/declare_capture/create_declare_capture_urlbuilder.go deleted file mode 100644 index 175519d4..00000000 --- a/operations/declare_capture/create_declare_capture_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateDeclareCaptureURL generates an URL for the create declare capture operation -type CreateDeclareCaptureURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDeclareCaptureURL) WithBasePath(bp string) *CreateDeclareCaptureURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDeclareCaptureURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateDeclareCaptureURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateDeclareCaptureURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateDeclareCaptureURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateDeclareCaptureURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateDeclareCaptureURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateDeclareCaptureURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateDeclareCaptureURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateDeclareCaptureURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateDeclareCaptureURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/declare_capture/delete_declare_capture.go b/operations/declare_capture/delete_declare_capture.go deleted file mode 100644 index 027c2950..00000000 --- a/operations/declare_capture/delete_declare_capture.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteDeclareCaptureHandlerFunc turns a function with the right signature into a delete declare capture handler -type DeleteDeclareCaptureHandlerFunc func(DeleteDeclareCaptureParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteDeclareCaptureHandlerFunc) Handle(params DeleteDeclareCaptureParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteDeclareCaptureHandler interface for that can handle valid delete declare capture params -type DeleteDeclareCaptureHandler interface { - Handle(DeleteDeclareCaptureParams, interface{}) middleware.Responder -} - -// NewDeleteDeclareCapture creates a new http.Handler for the delete declare capture operation -func NewDeleteDeclareCapture(ctx *middleware.Context, handler DeleteDeclareCaptureHandler) *DeleteDeclareCapture { - return &DeleteDeclareCapture{Context: ctx, Handler: handler} -} - -/* - DeleteDeclareCapture swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/captures/{index} DeclareCapture deleteDeclareCapture - -# Delete a declare capture - -Deletes a declare capture configuration by it's index in the specified frontend. -*/ -type DeleteDeclareCapture struct { - Context *middleware.Context - Handler DeleteDeclareCaptureHandler -} - -func (o *DeleteDeclareCapture) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteDeclareCaptureParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/delete_declare_capture_parameters.go b/operations/declare_capture/delete_declare_capture_parameters.go deleted file mode 100644 index 979440dc..00000000 --- a/operations/declare_capture/delete_declare_capture_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteDeclareCaptureParams creates a new DeleteDeclareCaptureParams object -// with the default values initialized. -func NewDeleteDeclareCaptureParams() DeleteDeclareCaptureParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteDeclareCaptureParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteDeclareCaptureParams contains all the bound params for the delete declare capture operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteDeclareCapture -type DeleteDeclareCaptureParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Declare Capture Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteDeclareCaptureParams() beforehand. -func (o *DeleteDeclareCaptureParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteDeclareCaptureParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteDeclareCaptureParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteDeclareCaptureParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteDeclareCaptureParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteDeclareCaptureParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteDeclareCaptureParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/declare_capture/delete_declare_capture_responses.go b/operations/declare_capture/delete_declare_capture_responses.go deleted file mode 100644 index 4a152d6f..00000000 --- a/operations/declare_capture/delete_declare_capture_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteDeclareCaptureAcceptedCode is the HTTP code returned for type DeleteDeclareCaptureAccepted -const DeleteDeclareCaptureAcceptedCode int = 202 - -/* -DeleteDeclareCaptureAccepted Configuration change accepted and reload requested - -swagger:response deleteDeclareCaptureAccepted -*/ -type DeleteDeclareCaptureAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteDeclareCaptureAccepted creates DeleteDeclareCaptureAccepted with default headers values -func NewDeleteDeclareCaptureAccepted() *DeleteDeclareCaptureAccepted { - - return &DeleteDeclareCaptureAccepted{} -} - -// WithReloadID adds the reloadId to the delete declare capture accepted response -func (o *DeleteDeclareCaptureAccepted) WithReloadID(reloadID string) *DeleteDeclareCaptureAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete declare capture accepted response -func (o *DeleteDeclareCaptureAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteDeclareCaptureAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteDeclareCaptureNoContentCode is the HTTP code returned for type DeleteDeclareCaptureNoContent -const DeleteDeclareCaptureNoContentCode int = 204 - -/* -DeleteDeclareCaptureNoContent Declare Capture deleted - -swagger:response deleteDeclareCaptureNoContent -*/ -type DeleteDeclareCaptureNoContent struct { -} - -// NewDeleteDeclareCaptureNoContent creates DeleteDeclareCaptureNoContent with default headers values -func NewDeleteDeclareCaptureNoContent() *DeleteDeclareCaptureNoContent { - - return &DeleteDeclareCaptureNoContent{} -} - -// WriteResponse to the client -func (o *DeleteDeclareCaptureNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteDeclareCaptureNotFoundCode is the HTTP code returned for type DeleteDeclareCaptureNotFound -const DeleteDeclareCaptureNotFoundCode int = 404 - -/* -DeleteDeclareCaptureNotFound The specified resource was not found - -swagger:response deleteDeclareCaptureNotFound -*/ -type DeleteDeclareCaptureNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDeclareCaptureNotFound creates DeleteDeclareCaptureNotFound with default headers values -func NewDeleteDeclareCaptureNotFound() *DeleteDeclareCaptureNotFound { - - return &DeleteDeclareCaptureNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete declare capture not found response -func (o *DeleteDeclareCaptureNotFound) WithConfigurationVersion(configurationVersion string) *DeleteDeclareCaptureNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete declare capture not found response -func (o *DeleteDeclareCaptureNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete declare capture not found response -func (o *DeleteDeclareCaptureNotFound) WithPayload(payload *models.Error) *DeleteDeclareCaptureNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete declare capture not found response -func (o *DeleteDeclareCaptureNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDeclareCaptureNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteDeclareCaptureDefault General Error - -swagger:response deleteDeclareCaptureDefault -*/ -type DeleteDeclareCaptureDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDeclareCaptureDefault creates DeleteDeclareCaptureDefault with default headers values -func NewDeleteDeclareCaptureDefault(code int) *DeleteDeclareCaptureDefault { - if code <= 0 { - code = 500 - } - - return &DeleteDeclareCaptureDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) WithStatusCode(code int) *DeleteDeclareCaptureDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) WithConfigurationVersion(configurationVersion string) *DeleteDeclareCaptureDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) WithPayload(payload *models.Error) *DeleteDeclareCaptureDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete declare capture default response -func (o *DeleteDeclareCaptureDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDeclareCaptureDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/delete_declare_capture_urlbuilder.go b/operations/declare_capture/delete_declare_capture_urlbuilder.go deleted file mode 100644 index d5b5f04b..00000000 --- a/operations/declare_capture/delete_declare_capture_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteDeclareCaptureURL generates an URL for the delete declare capture operation -type DeleteDeclareCaptureURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDeclareCaptureURL) WithBasePath(bp string) *DeleteDeclareCaptureURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDeclareCaptureURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteDeclareCaptureURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteDeclareCaptureURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteDeclareCaptureURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteDeclareCaptureURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteDeclareCaptureURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteDeclareCaptureURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteDeclareCaptureURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteDeclareCaptureURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteDeclareCaptureURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/declare_capture/get_declare_capture.go b/operations/declare_capture/get_declare_capture.go deleted file mode 100644 index 48e28980..00000000 --- a/operations/declare_capture/get_declare_capture.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDeclareCaptureHandlerFunc turns a function with the right signature into a get declare capture handler -type GetDeclareCaptureHandlerFunc func(GetDeclareCaptureParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDeclareCaptureHandlerFunc) Handle(params GetDeclareCaptureParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDeclareCaptureHandler interface for that can handle valid get declare capture params -type GetDeclareCaptureHandler interface { - Handle(GetDeclareCaptureParams, interface{}) middleware.Responder -} - -// NewGetDeclareCapture creates a new http.Handler for the get declare capture operation -func NewGetDeclareCapture(ctx *middleware.Context, handler GetDeclareCaptureHandler) *GetDeclareCapture { - return &GetDeclareCapture{Context: ctx, Handler: handler} -} - -/* - GetDeclareCapture swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/captures/{index} DeclareCapture getDeclareCapture - -# Return one declare capture - -Returns one declare capture configuration by it's index in the specified frontend. -*/ -type GetDeclareCapture struct { - Context *middleware.Context - Handler GetDeclareCaptureHandler -} - -func (o *GetDeclareCapture) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDeclareCaptureParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/get_declare_capture_parameters.go b/operations/declare_capture/get_declare_capture_parameters.go deleted file mode 100644 index 02c47cc4..00000000 --- a/operations/declare_capture/get_declare_capture_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetDeclareCaptureParams creates a new GetDeclareCaptureParams object -// -// There are no default values defined in the spec. -func NewGetDeclareCaptureParams() GetDeclareCaptureParams { - - return GetDeclareCaptureParams{} -} - -// GetDeclareCaptureParams contains all the bound params for the get declare capture operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDeclareCapture -type GetDeclareCaptureParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Declare Capture Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDeclareCaptureParams() beforehand. -func (o *GetDeclareCaptureParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetDeclareCaptureParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetDeclareCaptureParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDeclareCaptureParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/declare_capture/get_declare_capture_responses.go b/operations/declare_capture/get_declare_capture_responses.go deleted file mode 100644 index c9b61754..00000000 --- a/operations/declare_capture/get_declare_capture_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDeclareCaptureOKCode is the HTTP code returned for type GetDeclareCaptureOK -const GetDeclareCaptureOKCode int = 200 - -/* -GetDeclareCaptureOK Successful operation - -swagger:response getDeclareCaptureOK -*/ -type GetDeclareCaptureOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Capture `json:"body,omitempty"` -} - -// NewGetDeclareCaptureOK creates GetDeclareCaptureOK with default headers values -func NewGetDeclareCaptureOK() *GetDeclareCaptureOK { - - return &GetDeclareCaptureOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get declare capture o k response -func (o *GetDeclareCaptureOK) WithConfigurationVersion(configurationVersion string) *GetDeclareCaptureOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get declare capture o k response -func (o *GetDeclareCaptureOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get declare capture o k response -func (o *GetDeclareCaptureOK) WithPayload(payload *models.Capture) *GetDeclareCaptureOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get declare capture o k response -func (o *GetDeclareCaptureOK) SetPayload(payload *models.Capture) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDeclareCaptureOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetDeclareCaptureNotFoundCode is the HTTP code returned for type GetDeclareCaptureNotFound -const GetDeclareCaptureNotFoundCode int = 404 - -/* -GetDeclareCaptureNotFound The specified resource already exists - -swagger:response getDeclareCaptureNotFound -*/ -type GetDeclareCaptureNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDeclareCaptureNotFound creates GetDeclareCaptureNotFound with default headers values -func NewGetDeclareCaptureNotFound() *GetDeclareCaptureNotFound { - - return &GetDeclareCaptureNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get declare capture not found response -func (o *GetDeclareCaptureNotFound) WithConfigurationVersion(configurationVersion string) *GetDeclareCaptureNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get declare capture not found response -func (o *GetDeclareCaptureNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get declare capture not found response -func (o *GetDeclareCaptureNotFound) WithPayload(payload *models.Error) *GetDeclareCaptureNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get declare capture not found response -func (o *GetDeclareCaptureNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDeclareCaptureNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetDeclareCaptureDefault General Error - -swagger:response getDeclareCaptureDefault -*/ -type GetDeclareCaptureDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDeclareCaptureDefault creates GetDeclareCaptureDefault with default headers values -func NewGetDeclareCaptureDefault(code int) *GetDeclareCaptureDefault { - if code <= 0 { - code = 500 - } - - return &GetDeclareCaptureDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get declare capture default response -func (o *GetDeclareCaptureDefault) WithStatusCode(code int) *GetDeclareCaptureDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get declare capture default response -func (o *GetDeclareCaptureDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get declare capture default response -func (o *GetDeclareCaptureDefault) WithConfigurationVersion(configurationVersion string) *GetDeclareCaptureDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get declare capture default response -func (o *GetDeclareCaptureDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get declare capture default response -func (o *GetDeclareCaptureDefault) WithPayload(payload *models.Error) *GetDeclareCaptureDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get declare capture default response -func (o *GetDeclareCaptureDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDeclareCaptureDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/get_declare_capture_urlbuilder.go b/operations/declare_capture/get_declare_capture_urlbuilder.go deleted file mode 100644 index 85686ae1..00000000 --- a/operations/declare_capture/get_declare_capture_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetDeclareCaptureURL generates an URL for the get declare capture operation -type GetDeclareCaptureURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDeclareCaptureURL) WithBasePath(bp string) *GetDeclareCaptureURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDeclareCaptureURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDeclareCaptureURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetDeclareCaptureURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetDeclareCaptureURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDeclareCaptureURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDeclareCaptureURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDeclareCaptureURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDeclareCaptureURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDeclareCaptureURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDeclareCaptureURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/declare_capture/get_declare_captures.go b/operations/declare_capture/get_declare_captures.go deleted file mode 100644 index ebf64077..00000000 --- a/operations/declare_capture/get_declare_captures.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDeclareCapturesHandlerFunc turns a function with the right signature into a get declare captures handler -type GetDeclareCapturesHandlerFunc func(GetDeclareCapturesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDeclareCapturesHandlerFunc) Handle(params GetDeclareCapturesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDeclareCapturesHandler interface for that can handle valid get declare captures params -type GetDeclareCapturesHandler interface { - Handle(GetDeclareCapturesParams, interface{}) middleware.Responder -} - -// NewGetDeclareCaptures creates a new http.Handler for the get declare captures operation -func NewGetDeclareCaptures(ctx *middleware.Context, handler GetDeclareCapturesHandler) *GetDeclareCaptures { - return &GetDeclareCaptures{Context: ctx, Handler: handler} -} - -/* - GetDeclareCaptures swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/captures DeclareCapture getDeclareCaptures - -# Return an array of declare captures - -Returns an array of all declare capture records that are configured in specified frontend. -*/ -type GetDeclareCaptures struct { - Context *middleware.Context - Handler GetDeclareCapturesHandler -} - -func (o *GetDeclareCaptures) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDeclareCapturesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/get_declare_captures_parameters.go b/operations/declare_capture/get_declare_captures_parameters.go deleted file mode 100644 index dbc989fe..00000000 --- a/operations/declare_capture/get_declare_captures_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetDeclareCapturesParams creates a new GetDeclareCapturesParams object -// -// There are no default values defined in the spec. -func NewGetDeclareCapturesParams() GetDeclareCapturesParams { - - return GetDeclareCapturesParams{} -} - -// GetDeclareCapturesParams contains all the bound params for the get declare captures operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDeclareCaptures -type GetDeclareCapturesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDeclareCapturesParams() beforehand. -func (o *GetDeclareCapturesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetDeclareCapturesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDeclareCapturesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/declare_capture/get_declare_captures_responses.go b/operations/declare_capture/get_declare_captures_responses.go deleted file mode 100644 index a0c364fb..00000000 --- a/operations/declare_capture/get_declare_captures_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDeclareCapturesOKCode is the HTTP code returned for type GetDeclareCapturesOK -const GetDeclareCapturesOKCode int = 200 - -/* -GetDeclareCapturesOK Successful operation - -swagger:response getDeclareCapturesOK -*/ -type GetDeclareCapturesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Captures `json:"body,omitempty"` -} - -// NewGetDeclareCapturesOK creates GetDeclareCapturesOK with default headers values -func NewGetDeclareCapturesOK() *GetDeclareCapturesOK { - - return &GetDeclareCapturesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get declare captures o k response -func (o *GetDeclareCapturesOK) WithConfigurationVersion(configurationVersion string) *GetDeclareCapturesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get declare captures o k response -func (o *GetDeclareCapturesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get declare captures o k response -func (o *GetDeclareCapturesOK) WithPayload(payload models.Captures) *GetDeclareCapturesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get declare captures o k response -func (o *GetDeclareCapturesOK) SetPayload(payload models.Captures) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDeclareCapturesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Captures{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetDeclareCapturesDefault General Error - -swagger:response getDeclareCapturesDefault -*/ -type GetDeclareCapturesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDeclareCapturesDefault creates GetDeclareCapturesDefault with default headers values -func NewGetDeclareCapturesDefault(code int) *GetDeclareCapturesDefault { - if code <= 0 { - code = 500 - } - - return &GetDeclareCapturesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get declare captures default response -func (o *GetDeclareCapturesDefault) WithStatusCode(code int) *GetDeclareCapturesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get declare captures default response -func (o *GetDeclareCapturesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get declare captures default response -func (o *GetDeclareCapturesDefault) WithConfigurationVersion(configurationVersion string) *GetDeclareCapturesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get declare captures default response -func (o *GetDeclareCapturesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get declare captures default response -func (o *GetDeclareCapturesDefault) WithPayload(payload *models.Error) *GetDeclareCapturesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get declare captures default response -func (o *GetDeclareCapturesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDeclareCapturesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/get_declare_captures_urlbuilder.go b/operations/declare_capture/get_declare_captures_urlbuilder.go deleted file mode 100644 index c624130c..00000000 --- a/operations/declare_capture/get_declare_captures_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetDeclareCapturesURL generates an URL for the get declare captures operation -type GetDeclareCapturesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDeclareCapturesURL) WithBasePath(bp string) *GetDeclareCapturesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDeclareCapturesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDeclareCapturesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetDeclareCapturesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDeclareCapturesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDeclareCapturesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDeclareCapturesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDeclareCapturesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDeclareCapturesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDeclareCapturesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/declare_capture/replace_declare_capture.go b/operations/declare_capture/replace_declare_capture.go deleted file mode 100644 index b62cc249..00000000 --- a/operations/declare_capture/replace_declare_capture.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceDeclareCaptureHandlerFunc turns a function with the right signature into a replace declare capture handler -type ReplaceDeclareCaptureHandlerFunc func(ReplaceDeclareCaptureParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceDeclareCaptureHandlerFunc) Handle(params ReplaceDeclareCaptureParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceDeclareCaptureHandler interface for that can handle valid replace declare capture params -type ReplaceDeclareCaptureHandler interface { - Handle(ReplaceDeclareCaptureParams, interface{}) middleware.Responder -} - -// NewReplaceDeclareCapture creates a new http.Handler for the replace declare capture operation -func NewReplaceDeclareCapture(ctx *middleware.Context, handler ReplaceDeclareCaptureHandler) *ReplaceDeclareCapture { - return &ReplaceDeclareCapture{Context: ctx, Handler: handler} -} - -/* - ReplaceDeclareCapture swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/captures/{index} DeclareCapture replaceDeclareCapture - -# Replace a declare capture - -Replaces a declare capture configuration by it's index in the specified frontend. -*/ -type ReplaceDeclareCapture struct { - Context *middleware.Context - Handler ReplaceDeclareCaptureHandler -} - -func (o *ReplaceDeclareCapture) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceDeclareCaptureParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/replace_declare_capture_parameters.go b/operations/declare_capture/replace_declare_capture_parameters.go deleted file mode 100644 index 604e683c..00000000 --- a/operations/declare_capture/replace_declare_capture_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceDeclareCaptureParams creates a new ReplaceDeclareCaptureParams object -// with the default values initialized. -func NewReplaceDeclareCaptureParams() ReplaceDeclareCaptureParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceDeclareCaptureParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceDeclareCaptureParams contains all the bound params for the replace declare capture operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceDeclareCapture -type ReplaceDeclareCaptureParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Capture - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Declare Capture Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceDeclareCaptureParams() beforehand. -func (o *ReplaceDeclareCaptureParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Capture - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceDeclareCaptureParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceDeclareCaptureParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceDeclareCaptureParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceDeclareCaptureParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceDeclareCaptureParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceDeclareCaptureParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/declare_capture/replace_declare_capture_responses.go b/operations/declare_capture/replace_declare_capture_responses.go deleted file mode 100644 index d1ac1438..00000000 --- a/operations/declare_capture/replace_declare_capture_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceDeclareCaptureOKCode is the HTTP code returned for type ReplaceDeclareCaptureOK -const ReplaceDeclareCaptureOKCode int = 200 - -/* -ReplaceDeclareCaptureOK Declare Capture replaced - -swagger:response replaceDeclareCaptureOK -*/ -type ReplaceDeclareCaptureOK struct { - - /* - In: Body - */ - Payload *models.Capture `json:"body,omitempty"` -} - -// NewReplaceDeclareCaptureOK creates ReplaceDeclareCaptureOK with default headers values -func NewReplaceDeclareCaptureOK() *ReplaceDeclareCaptureOK { - - return &ReplaceDeclareCaptureOK{} -} - -// WithPayload adds the payload to the replace declare capture o k response -func (o *ReplaceDeclareCaptureOK) WithPayload(payload *models.Capture) *ReplaceDeclareCaptureOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare capture o k response -func (o *ReplaceDeclareCaptureOK) SetPayload(payload *models.Capture) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCaptureOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDeclareCaptureAcceptedCode is the HTTP code returned for type ReplaceDeclareCaptureAccepted -const ReplaceDeclareCaptureAcceptedCode int = 202 - -/* -ReplaceDeclareCaptureAccepted Configuration change accepted and reload requested - -swagger:response replaceDeclareCaptureAccepted -*/ -type ReplaceDeclareCaptureAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Capture `json:"body,omitempty"` -} - -// NewReplaceDeclareCaptureAccepted creates ReplaceDeclareCaptureAccepted with default headers values -func NewReplaceDeclareCaptureAccepted() *ReplaceDeclareCaptureAccepted { - - return &ReplaceDeclareCaptureAccepted{} -} - -// WithReloadID adds the reloadId to the replace declare capture accepted response -func (o *ReplaceDeclareCaptureAccepted) WithReloadID(reloadID string) *ReplaceDeclareCaptureAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace declare capture accepted response -func (o *ReplaceDeclareCaptureAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace declare capture accepted response -func (o *ReplaceDeclareCaptureAccepted) WithPayload(payload *models.Capture) *ReplaceDeclareCaptureAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare capture accepted response -func (o *ReplaceDeclareCaptureAccepted) SetPayload(payload *models.Capture) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCaptureAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDeclareCaptureBadRequestCode is the HTTP code returned for type ReplaceDeclareCaptureBadRequest -const ReplaceDeclareCaptureBadRequestCode int = 400 - -/* -ReplaceDeclareCaptureBadRequest Bad request - -swagger:response replaceDeclareCaptureBadRequest -*/ -type ReplaceDeclareCaptureBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDeclareCaptureBadRequest creates ReplaceDeclareCaptureBadRequest with default headers values -func NewReplaceDeclareCaptureBadRequest() *ReplaceDeclareCaptureBadRequest { - - return &ReplaceDeclareCaptureBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace declare capture bad request response -func (o *ReplaceDeclareCaptureBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceDeclareCaptureBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace declare capture bad request response -func (o *ReplaceDeclareCaptureBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace declare capture bad request response -func (o *ReplaceDeclareCaptureBadRequest) WithPayload(payload *models.Error) *ReplaceDeclareCaptureBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare capture bad request response -func (o *ReplaceDeclareCaptureBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCaptureBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDeclareCaptureNotFoundCode is the HTTP code returned for type ReplaceDeclareCaptureNotFound -const ReplaceDeclareCaptureNotFoundCode int = 404 - -/* -ReplaceDeclareCaptureNotFound The specified resource was not found - -swagger:response replaceDeclareCaptureNotFound -*/ -type ReplaceDeclareCaptureNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDeclareCaptureNotFound creates ReplaceDeclareCaptureNotFound with default headers values -func NewReplaceDeclareCaptureNotFound() *ReplaceDeclareCaptureNotFound { - - return &ReplaceDeclareCaptureNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace declare capture not found response -func (o *ReplaceDeclareCaptureNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceDeclareCaptureNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace declare capture not found response -func (o *ReplaceDeclareCaptureNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace declare capture not found response -func (o *ReplaceDeclareCaptureNotFound) WithPayload(payload *models.Error) *ReplaceDeclareCaptureNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare capture not found response -func (o *ReplaceDeclareCaptureNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCaptureNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceDeclareCaptureDefault General Error - -swagger:response replaceDeclareCaptureDefault -*/ -type ReplaceDeclareCaptureDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDeclareCaptureDefault creates ReplaceDeclareCaptureDefault with default headers values -func NewReplaceDeclareCaptureDefault(code int) *ReplaceDeclareCaptureDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceDeclareCaptureDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) WithStatusCode(code int) *ReplaceDeclareCaptureDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) WithConfigurationVersion(configurationVersion string) *ReplaceDeclareCaptureDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) WithPayload(payload *models.Error) *ReplaceDeclareCaptureDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare capture default response -func (o *ReplaceDeclareCaptureDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCaptureDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/replace_declare_capture_urlbuilder.go b/operations/declare_capture/replace_declare_capture_urlbuilder.go deleted file mode 100644 index cca389da..00000000 --- a/operations/declare_capture/replace_declare_capture_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceDeclareCaptureURL generates an URL for the replace declare capture operation -type ReplaceDeclareCaptureURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDeclareCaptureURL) WithBasePath(bp string) *ReplaceDeclareCaptureURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDeclareCaptureURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceDeclareCaptureURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceDeclareCaptureURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceDeclareCaptureURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceDeclareCaptureURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceDeclareCaptureURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceDeclareCaptureURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceDeclareCaptureURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceDeclareCaptureURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceDeclareCaptureURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/declare_capture/replace_declare_captures.go b/operations/declare_capture/replace_declare_captures.go deleted file mode 100644 index 2d9d4240..00000000 --- a/operations/declare_capture/replace_declare_captures.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceDeclareCapturesHandlerFunc turns a function with the right signature into a replace declare captures handler -type ReplaceDeclareCapturesHandlerFunc func(ReplaceDeclareCapturesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceDeclareCapturesHandlerFunc) Handle(params ReplaceDeclareCapturesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceDeclareCapturesHandler interface for that can handle valid replace declare captures params -type ReplaceDeclareCapturesHandler interface { - Handle(ReplaceDeclareCapturesParams, interface{}) middleware.Responder -} - -// NewReplaceDeclareCaptures creates a new http.Handler for the replace declare captures operation -func NewReplaceDeclareCaptures(ctx *middleware.Context, handler ReplaceDeclareCapturesHandler) *ReplaceDeclareCaptures { - return &ReplaceDeclareCaptures{Context: ctx, Handler: handler} -} - -/* - ReplaceDeclareCaptures swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/captures DeclareCapture replaceDeclareCaptures - -# Replace a declare capture list - -Replaces a whole list of declare capture with the list given in parameter -*/ -type ReplaceDeclareCaptures struct { - Context *middleware.Context - Handler ReplaceDeclareCapturesHandler -} - -func (o *ReplaceDeclareCaptures) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceDeclareCapturesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/declare_capture/replace_declare_captures_parameters.go b/operations/declare_capture/replace_declare_captures_parameters.go deleted file mode 100644 index 2db19806..00000000 --- a/operations/declare_capture/replace_declare_captures_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceDeclareCapturesParams creates a new ReplaceDeclareCapturesParams object -// with the default values initialized. -func NewReplaceDeclareCapturesParams() ReplaceDeclareCapturesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceDeclareCapturesParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceDeclareCapturesParams contains all the bound params for the replace declare captures operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceDeclareCaptures -type ReplaceDeclareCapturesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Captures - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceDeclareCapturesParams() beforehand. -func (o *ReplaceDeclareCapturesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Captures - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceDeclareCapturesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceDeclareCapturesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceDeclareCapturesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceDeclareCapturesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceDeclareCapturesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/declare_capture/replace_declare_captures_responses.go b/operations/declare_capture/replace_declare_captures_responses.go deleted file mode 100644 index fd1a58ba..00000000 --- a/operations/declare_capture/replace_declare_captures_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceDeclareCapturesOKCode is the HTTP code returned for type ReplaceDeclareCapturesOK -const ReplaceDeclareCapturesOKCode int = 200 - -/* -ReplaceDeclareCapturesOK All Declare capture lines replaced - -swagger:response replaceDeclareCapturesOK -*/ -type ReplaceDeclareCapturesOK struct { - - /* - In: Body - */ - Payload models.Captures `json:"body,omitempty"` -} - -// NewReplaceDeclareCapturesOK creates ReplaceDeclareCapturesOK with default headers values -func NewReplaceDeclareCapturesOK() *ReplaceDeclareCapturesOK { - - return &ReplaceDeclareCapturesOK{} -} - -// WithPayload adds the payload to the replace declare captures o k response -func (o *ReplaceDeclareCapturesOK) WithPayload(payload models.Captures) *ReplaceDeclareCapturesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare captures o k response -func (o *ReplaceDeclareCapturesOK) SetPayload(payload models.Captures) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCapturesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Captures{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceDeclareCapturesAcceptedCode is the HTTP code returned for type ReplaceDeclareCapturesAccepted -const ReplaceDeclareCapturesAcceptedCode int = 202 - -/* -ReplaceDeclareCapturesAccepted Configuration change accepted and reload requested - -swagger:response replaceDeclareCapturesAccepted -*/ -type ReplaceDeclareCapturesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Captures `json:"body,omitempty"` -} - -// NewReplaceDeclareCapturesAccepted creates ReplaceDeclareCapturesAccepted with default headers values -func NewReplaceDeclareCapturesAccepted() *ReplaceDeclareCapturesAccepted { - - return &ReplaceDeclareCapturesAccepted{} -} - -// WithReloadID adds the reloadId to the replace declare captures accepted response -func (o *ReplaceDeclareCapturesAccepted) WithReloadID(reloadID string) *ReplaceDeclareCapturesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace declare captures accepted response -func (o *ReplaceDeclareCapturesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace declare captures accepted response -func (o *ReplaceDeclareCapturesAccepted) WithPayload(payload models.Captures) *ReplaceDeclareCapturesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare captures accepted response -func (o *ReplaceDeclareCapturesAccepted) SetPayload(payload models.Captures) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCapturesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Captures{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceDeclareCapturesBadRequestCode is the HTTP code returned for type ReplaceDeclareCapturesBadRequest -const ReplaceDeclareCapturesBadRequestCode int = 400 - -/* -ReplaceDeclareCapturesBadRequest Bad request - -swagger:response replaceDeclareCapturesBadRequest -*/ -type ReplaceDeclareCapturesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDeclareCapturesBadRequest creates ReplaceDeclareCapturesBadRequest with default headers values -func NewReplaceDeclareCapturesBadRequest() *ReplaceDeclareCapturesBadRequest { - - return &ReplaceDeclareCapturesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace declare captures bad request response -func (o *ReplaceDeclareCapturesBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceDeclareCapturesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace declare captures bad request response -func (o *ReplaceDeclareCapturesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace declare captures bad request response -func (o *ReplaceDeclareCapturesBadRequest) WithPayload(payload *models.Error) *ReplaceDeclareCapturesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare captures bad request response -func (o *ReplaceDeclareCapturesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCapturesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceDeclareCapturesDefault General Error - -swagger:response replaceDeclareCapturesDefault -*/ -type ReplaceDeclareCapturesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDeclareCapturesDefault creates ReplaceDeclareCapturesDefault with default headers values -func NewReplaceDeclareCapturesDefault(code int) *ReplaceDeclareCapturesDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceDeclareCapturesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) WithStatusCode(code int) *ReplaceDeclareCapturesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) WithConfigurationVersion(configurationVersion string) *ReplaceDeclareCapturesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) WithPayload(payload *models.Error) *ReplaceDeclareCapturesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace declare captures default response -func (o *ReplaceDeclareCapturesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDeclareCapturesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/declare_capture/replace_declare_captures_urlbuilder.go b/operations/declare_capture/replace_declare_captures_urlbuilder.go deleted file mode 100644 index 06df03ee..00000000 --- a/operations/declare_capture/replace_declare_captures_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package declare_capture - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceDeclareCapturesURL generates an URL for the replace declare captures operation -type ReplaceDeclareCapturesURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDeclareCapturesURL) WithBasePath(bp string) *ReplaceDeclareCapturesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDeclareCapturesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceDeclareCapturesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/captures" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceDeclareCapturesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceDeclareCapturesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceDeclareCapturesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceDeclareCapturesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceDeclareCapturesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceDeclareCapturesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceDeclareCapturesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/add_defaults_section.go b/operations/defaults/add_defaults_section.go deleted file mode 100644 index 702bb888..00000000 --- a/operations/defaults/add_defaults_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddDefaultsSectionHandlerFunc turns a function with the right signature into a add defaults section handler -type AddDefaultsSectionHandlerFunc func(AddDefaultsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddDefaultsSectionHandlerFunc) Handle(params AddDefaultsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddDefaultsSectionHandler interface for that can handle valid add defaults section params -type AddDefaultsSectionHandler interface { - Handle(AddDefaultsSectionParams, interface{}) middleware.Responder -} - -// NewAddDefaultsSection creates a new http.Handler for the add defaults section operation -func NewAddDefaultsSection(ctx *middleware.Context, handler AddDefaultsSectionHandler) *AddDefaultsSection { - return &AddDefaultsSection{Context: ctx, Handler: handler} -} - -/* - AddDefaultsSection swagger:route POST /services/haproxy/configuration/defaults Defaults addDefaultsSection - -# Add a defaults section - -Adds a new defaults section to the configuration file. -*/ -type AddDefaultsSection struct { - Context *middleware.Context - Handler AddDefaultsSectionHandler -} - -func (o *AddDefaultsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddDefaultsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/add_defaults_section_parameters.go b/operations/defaults/add_defaults_section_parameters.go deleted file mode 100644 index a3f83bab..00000000 --- a/operations/defaults/add_defaults_section_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddDefaultsSectionParams creates a new AddDefaultsSectionParams object -// with the default values initialized. -func NewAddDefaultsSectionParams() AddDefaultsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return AddDefaultsSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// AddDefaultsSectionParams contains all the bound params for the add defaults section operation -// typically these are obtained from a http.Request -// -// swagger:parameters addDefaultsSection -type AddDefaultsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Defaults - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddDefaultsSectionParams() beforehand. -func (o *AddDefaultsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Defaults - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *AddDefaultsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewAddDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *AddDefaultsSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewAddDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *AddDefaultsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *AddDefaultsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/defaults/add_defaults_section_responses.go b/operations/defaults/add_defaults_section_responses.go deleted file mode 100644 index bd305e43..00000000 --- a/operations/defaults/add_defaults_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddDefaultsSectionCreatedCode is the HTTP code returned for type AddDefaultsSectionCreated -const AddDefaultsSectionCreatedCode int = 201 - -/* -AddDefaultsSectionCreated Defaults created - -swagger:response addDefaultsSectionCreated -*/ -type AddDefaultsSectionCreated struct { - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewAddDefaultsSectionCreated creates AddDefaultsSectionCreated with default headers values -func NewAddDefaultsSectionCreated() *AddDefaultsSectionCreated { - - return &AddDefaultsSectionCreated{} -} - -// WithPayload adds the payload to the add defaults section created response -func (o *AddDefaultsSectionCreated) WithPayload(payload *models.Defaults) *AddDefaultsSectionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add defaults section created response -func (o *AddDefaultsSectionCreated) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddDefaultsSectionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddDefaultsSectionAcceptedCode is the HTTP code returned for type AddDefaultsSectionAccepted -const AddDefaultsSectionAcceptedCode int = 202 - -/* -AddDefaultsSectionAccepted Configuration change accepted and reload requested - -swagger:response addDefaultsSectionAccepted -*/ -type AddDefaultsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewAddDefaultsSectionAccepted creates AddDefaultsSectionAccepted with default headers values -func NewAddDefaultsSectionAccepted() *AddDefaultsSectionAccepted { - - return &AddDefaultsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the add defaults section accepted response -func (o *AddDefaultsSectionAccepted) WithReloadID(reloadID string) *AddDefaultsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the add defaults section accepted response -func (o *AddDefaultsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the add defaults section accepted response -func (o *AddDefaultsSectionAccepted) WithPayload(payload *models.Defaults) *AddDefaultsSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add defaults section accepted response -func (o *AddDefaultsSectionAccepted) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddDefaultsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddDefaultsSectionBadRequestCode is the HTTP code returned for type AddDefaultsSectionBadRequest -const AddDefaultsSectionBadRequestCode int = 400 - -/* -AddDefaultsSectionBadRequest Bad request - -swagger:response addDefaultsSectionBadRequest -*/ -type AddDefaultsSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddDefaultsSectionBadRequest creates AddDefaultsSectionBadRequest with default headers values -func NewAddDefaultsSectionBadRequest() *AddDefaultsSectionBadRequest { - - return &AddDefaultsSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add defaults section bad request response -func (o *AddDefaultsSectionBadRequest) WithConfigurationVersion(configurationVersion string) *AddDefaultsSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add defaults section bad request response -func (o *AddDefaultsSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add defaults section bad request response -func (o *AddDefaultsSectionBadRequest) WithPayload(payload *models.Error) *AddDefaultsSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add defaults section bad request response -func (o *AddDefaultsSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddDefaultsSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddDefaultsSectionConflictCode is the HTTP code returned for type AddDefaultsSectionConflict -const AddDefaultsSectionConflictCode int = 409 - -/* -AddDefaultsSectionConflict The specified resource already exists - -swagger:response addDefaultsSectionConflict -*/ -type AddDefaultsSectionConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddDefaultsSectionConflict creates AddDefaultsSectionConflict with default headers values -func NewAddDefaultsSectionConflict() *AddDefaultsSectionConflict { - - return &AddDefaultsSectionConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the add defaults section conflict response -func (o *AddDefaultsSectionConflict) WithConfigurationVersion(configurationVersion string) *AddDefaultsSectionConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add defaults section conflict response -func (o *AddDefaultsSectionConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add defaults section conflict response -func (o *AddDefaultsSectionConflict) WithPayload(payload *models.Error) *AddDefaultsSectionConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add defaults section conflict response -func (o *AddDefaultsSectionConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddDefaultsSectionConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddDefaultsSectionDefault General Error - -swagger:response addDefaultsSectionDefault -*/ -type AddDefaultsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddDefaultsSectionDefault creates AddDefaultsSectionDefault with default headers values -func NewAddDefaultsSectionDefault(code int) *AddDefaultsSectionDefault { - if code <= 0 { - code = 500 - } - - return &AddDefaultsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add defaults section default response -func (o *AddDefaultsSectionDefault) WithStatusCode(code int) *AddDefaultsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add defaults section default response -func (o *AddDefaultsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add defaults section default response -func (o *AddDefaultsSectionDefault) WithConfigurationVersion(configurationVersion string) *AddDefaultsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add defaults section default response -func (o *AddDefaultsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add defaults section default response -func (o *AddDefaultsSectionDefault) WithPayload(payload *models.Error) *AddDefaultsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add defaults section default response -func (o *AddDefaultsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddDefaultsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/add_defaults_section_urlbuilder.go b/operations/defaults/add_defaults_section_urlbuilder.go deleted file mode 100644 index a009af3f..00000000 --- a/operations/defaults/add_defaults_section_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// AddDefaultsSectionURL generates an URL for the add defaults section operation -type AddDefaultsSectionURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddDefaultsSectionURL) WithBasePath(bp string) *AddDefaultsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddDefaultsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddDefaultsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddDefaultsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddDefaultsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddDefaultsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddDefaultsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddDefaultsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddDefaultsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/create_defaults_section.go b/operations/defaults/create_defaults_section.go deleted file mode 100644 index 0d5e7d2c..00000000 --- a/operations/defaults/create_defaults_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateDefaultsSectionHandlerFunc turns a function with the right signature into a create defaults section handler -type CreateDefaultsSectionHandlerFunc func(CreateDefaultsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateDefaultsSectionHandlerFunc) Handle(params CreateDefaultsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateDefaultsSectionHandler interface for that can handle valid create defaults section params -type CreateDefaultsSectionHandler interface { - Handle(CreateDefaultsSectionParams, interface{}) middleware.Responder -} - -// NewCreateDefaultsSection creates a new http.Handler for the create defaults section operation -func NewCreateDefaultsSection(ctx *middleware.Context, handler CreateDefaultsSectionHandler) *CreateDefaultsSection { - return &CreateDefaultsSection{Context: ctx, Handler: handler} -} - -/* - CreateDefaultsSection swagger:route PUT /services/haproxy/configuration/defaults Defaults createDefaultsSection - -# Add a defaults section - -Adds a new defaults section to the configuration file. -*/ -type CreateDefaultsSection struct { - Context *middleware.Context - Handler CreateDefaultsSectionHandler -} - -func (o *CreateDefaultsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateDefaultsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/create_defaults_section_parameters.go b/operations/defaults/create_defaults_section_parameters.go deleted file mode 100644 index 05718477..00000000 --- a/operations/defaults/create_defaults_section_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateDefaultsSectionParams creates a new CreateDefaultsSectionParams object -// with the default values initialized. -func NewCreateDefaultsSectionParams() CreateDefaultsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateDefaultsSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateDefaultsSectionParams contains all the bound params for the create defaults section operation -// typically these are obtained from a http.Request -// -// swagger:parameters createDefaultsSection -type CreateDefaultsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Defaults - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateDefaultsSectionParams() beforehand. -func (o *CreateDefaultsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Defaults - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateDefaultsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateDefaultsSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateDefaultsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateDefaultsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/defaults/create_defaults_section_responses.go b/operations/defaults/create_defaults_section_responses.go deleted file mode 100644 index f85a5208..00000000 --- a/operations/defaults/create_defaults_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateDefaultsSectionCreatedCode is the HTTP code returned for type CreateDefaultsSectionCreated -const CreateDefaultsSectionCreatedCode int = 201 - -/* -CreateDefaultsSectionCreated Defaults created - -swagger:response createDefaultsSectionCreated -*/ -type CreateDefaultsSectionCreated struct { - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewCreateDefaultsSectionCreated creates CreateDefaultsSectionCreated with default headers values -func NewCreateDefaultsSectionCreated() *CreateDefaultsSectionCreated { - - return &CreateDefaultsSectionCreated{} -} - -// WithPayload adds the payload to the create defaults section created response -func (o *CreateDefaultsSectionCreated) WithPayload(payload *models.Defaults) *CreateDefaultsSectionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create defaults section created response -func (o *CreateDefaultsSectionCreated) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDefaultsSectionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDefaultsSectionAcceptedCode is the HTTP code returned for type CreateDefaultsSectionAccepted -const CreateDefaultsSectionAcceptedCode int = 202 - -/* -CreateDefaultsSectionAccepted Configuration change accepted and reload requested - -swagger:response createDefaultsSectionAccepted -*/ -type CreateDefaultsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewCreateDefaultsSectionAccepted creates CreateDefaultsSectionAccepted with default headers values -func NewCreateDefaultsSectionAccepted() *CreateDefaultsSectionAccepted { - - return &CreateDefaultsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the create defaults section accepted response -func (o *CreateDefaultsSectionAccepted) WithReloadID(reloadID string) *CreateDefaultsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create defaults section accepted response -func (o *CreateDefaultsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create defaults section accepted response -func (o *CreateDefaultsSectionAccepted) WithPayload(payload *models.Defaults) *CreateDefaultsSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create defaults section accepted response -func (o *CreateDefaultsSectionAccepted) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDefaultsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDefaultsSectionBadRequestCode is the HTTP code returned for type CreateDefaultsSectionBadRequest -const CreateDefaultsSectionBadRequestCode int = 400 - -/* -CreateDefaultsSectionBadRequest Bad request - -swagger:response createDefaultsSectionBadRequest -*/ -type CreateDefaultsSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDefaultsSectionBadRequest creates CreateDefaultsSectionBadRequest with default headers values -func NewCreateDefaultsSectionBadRequest() *CreateDefaultsSectionBadRequest { - - return &CreateDefaultsSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create defaults section bad request response -func (o *CreateDefaultsSectionBadRequest) WithConfigurationVersion(configurationVersion string) *CreateDefaultsSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create defaults section bad request response -func (o *CreateDefaultsSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create defaults section bad request response -func (o *CreateDefaultsSectionBadRequest) WithPayload(payload *models.Error) *CreateDefaultsSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create defaults section bad request response -func (o *CreateDefaultsSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDefaultsSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDefaultsSectionConflictCode is the HTTP code returned for type CreateDefaultsSectionConflict -const CreateDefaultsSectionConflictCode int = 409 - -/* -CreateDefaultsSectionConflict The specified resource already exists - -swagger:response createDefaultsSectionConflict -*/ -type CreateDefaultsSectionConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDefaultsSectionConflict creates CreateDefaultsSectionConflict with default headers values -func NewCreateDefaultsSectionConflict() *CreateDefaultsSectionConflict { - - return &CreateDefaultsSectionConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create defaults section conflict response -func (o *CreateDefaultsSectionConflict) WithConfigurationVersion(configurationVersion string) *CreateDefaultsSectionConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create defaults section conflict response -func (o *CreateDefaultsSectionConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create defaults section conflict response -func (o *CreateDefaultsSectionConflict) WithPayload(payload *models.Error) *CreateDefaultsSectionConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create defaults section conflict response -func (o *CreateDefaultsSectionConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDefaultsSectionConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateDefaultsSectionDefault General Error - -swagger:response createDefaultsSectionDefault -*/ -type CreateDefaultsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDefaultsSectionDefault creates CreateDefaultsSectionDefault with default headers values -func NewCreateDefaultsSectionDefault(code int) *CreateDefaultsSectionDefault { - if code <= 0 { - code = 500 - } - - return &CreateDefaultsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create defaults section default response -func (o *CreateDefaultsSectionDefault) WithStatusCode(code int) *CreateDefaultsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create defaults section default response -func (o *CreateDefaultsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create defaults section default response -func (o *CreateDefaultsSectionDefault) WithConfigurationVersion(configurationVersion string) *CreateDefaultsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create defaults section default response -func (o *CreateDefaultsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create defaults section default response -func (o *CreateDefaultsSectionDefault) WithPayload(payload *models.Error) *CreateDefaultsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create defaults section default response -func (o *CreateDefaultsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDefaultsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/create_defaults_section_urlbuilder.go b/operations/defaults/create_defaults_section_urlbuilder.go deleted file mode 100644 index 99035a38..00000000 --- a/operations/defaults/create_defaults_section_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateDefaultsSectionURL generates an URL for the create defaults section operation -type CreateDefaultsSectionURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDefaultsSectionURL) WithBasePath(bp string) *CreateDefaultsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDefaultsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateDefaultsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateDefaultsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateDefaultsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateDefaultsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateDefaultsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateDefaultsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateDefaultsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/delete_defaults_section.go b/operations/defaults/delete_defaults_section.go deleted file mode 100644 index f1485974..00000000 --- a/operations/defaults/delete_defaults_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteDefaultsSectionHandlerFunc turns a function with the right signature into a delete defaults section handler -type DeleteDefaultsSectionHandlerFunc func(DeleteDefaultsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteDefaultsSectionHandlerFunc) Handle(params DeleteDefaultsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteDefaultsSectionHandler interface for that can handle valid delete defaults section params -type DeleteDefaultsSectionHandler interface { - Handle(DeleteDefaultsSectionParams, interface{}) middleware.Responder -} - -// NewDeleteDefaultsSection creates a new http.Handler for the delete defaults section operation -func NewDeleteDefaultsSection(ctx *middleware.Context, handler DeleteDefaultsSectionHandler) *DeleteDefaultsSection { - return &DeleteDefaultsSection{Context: ctx, Handler: handler} -} - -/* - DeleteDefaultsSection swagger:route DELETE /services/haproxy/configuration/defaults/{name} Defaults deleteDefaultsSection - -# Delete a defaults section - -Deletes a defaults section from the configuration by it's name. -*/ -type DeleteDefaultsSection struct { - Context *middleware.Context - Handler DeleteDefaultsSectionHandler -} - -func (o *DeleteDefaultsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteDefaultsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/delete_defaults_section_parameters.go b/operations/defaults/delete_defaults_section_parameters.go deleted file mode 100644 index 31ea92e1..00000000 --- a/operations/defaults/delete_defaults_section_parameters.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteDefaultsSectionParams creates a new DeleteDefaultsSectionParams object -// with the default values initialized. -func NewDeleteDefaultsSectionParams() DeleteDefaultsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return DeleteDefaultsSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// DeleteDefaultsSectionParams contains all the bound params for the delete defaults section operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteDefaultsSection -type DeleteDefaultsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Defaults name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteDefaultsSectionParams() beforehand. -func (o *DeleteDefaultsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteDefaultsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *DeleteDefaultsSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteDefaultsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteDefaultsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteDefaultsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/defaults/delete_defaults_section_responses.go b/operations/defaults/delete_defaults_section_responses.go deleted file mode 100644 index 21ca320f..00000000 --- a/operations/defaults/delete_defaults_section_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteDefaultsSectionAcceptedCode is the HTTP code returned for type DeleteDefaultsSectionAccepted -const DeleteDefaultsSectionAcceptedCode int = 202 - -/* -DeleteDefaultsSectionAccepted Configuration change accepted and reload requested - -swagger:response deleteDefaultsSectionAccepted -*/ -type DeleteDefaultsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteDefaultsSectionAccepted creates DeleteDefaultsSectionAccepted with default headers values -func NewDeleteDefaultsSectionAccepted() *DeleteDefaultsSectionAccepted { - - return &DeleteDefaultsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the delete defaults section accepted response -func (o *DeleteDefaultsSectionAccepted) WithReloadID(reloadID string) *DeleteDefaultsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete defaults section accepted response -func (o *DeleteDefaultsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteDefaultsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteDefaultsSectionNoContentCode is the HTTP code returned for type DeleteDefaultsSectionNoContent -const DeleteDefaultsSectionNoContentCode int = 204 - -/* -DeleteDefaultsSectionNoContent Defaults section deleted - -swagger:response deleteDefaultsSectionNoContent -*/ -type DeleteDefaultsSectionNoContent struct { -} - -// NewDeleteDefaultsSectionNoContent creates DeleteDefaultsSectionNoContent with default headers values -func NewDeleteDefaultsSectionNoContent() *DeleteDefaultsSectionNoContent { - - return &DeleteDefaultsSectionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteDefaultsSectionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteDefaultsSectionNotFoundCode is the HTTP code returned for type DeleteDefaultsSectionNotFound -const DeleteDefaultsSectionNotFoundCode int = 404 - -/* -DeleteDefaultsSectionNotFound The specified resource was not found - -swagger:response deleteDefaultsSectionNotFound -*/ -type DeleteDefaultsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDefaultsSectionNotFound creates DeleteDefaultsSectionNotFound with default headers values -func NewDeleteDefaultsSectionNotFound() *DeleteDefaultsSectionNotFound { - - return &DeleteDefaultsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete defaults section not found response -func (o *DeleteDefaultsSectionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteDefaultsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete defaults section not found response -func (o *DeleteDefaultsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete defaults section not found response -func (o *DeleteDefaultsSectionNotFound) WithPayload(payload *models.Error) *DeleteDefaultsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete defaults section not found response -func (o *DeleteDefaultsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDefaultsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteDefaultsSectionDefault General Error - -swagger:response deleteDefaultsSectionDefault -*/ -type DeleteDefaultsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDefaultsSectionDefault creates DeleteDefaultsSectionDefault with default headers values -func NewDeleteDefaultsSectionDefault(code int) *DeleteDefaultsSectionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteDefaultsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) WithStatusCode(code int) *DeleteDefaultsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) WithConfigurationVersion(configurationVersion string) *DeleteDefaultsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) WithPayload(payload *models.Error) *DeleteDefaultsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete defaults section default response -func (o *DeleteDefaultsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDefaultsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/delete_defaults_section_urlbuilder.go b/operations/defaults/delete_defaults_section_urlbuilder.go deleted file mode 100644 index c2752125..00000000 --- a/operations/defaults/delete_defaults_section_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteDefaultsSectionURL generates an URL for the delete defaults section operation -type DeleteDefaultsSectionURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDefaultsSectionURL) WithBasePath(bp string) *DeleteDefaultsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDefaultsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteDefaultsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteDefaultsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteDefaultsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteDefaultsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteDefaultsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteDefaultsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteDefaultsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteDefaultsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/get_defaults_section.go b/operations/defaults/get_defaults_section.go deleted file mode 100644 index aa1776c9..00000000 --- a/operations/defaults/get_defaults_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDefaultsSectionHandlerFunc turns a function with the right signature into a get defaults section handler -type GetDefaultsSectionHandlerFunc func(GetDefaultsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDefaultsSectionHandlerFunc) Handle(params GetDefaultsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDefaultsSectionHandler interface for that can handle valid get defaults section params -type GetDefaultsSectionHandler interface { - Handle(GetDefaultsSectionParams, interface{}) middleware.Responder -} - -// NewGetDefaultsSection creates a new http.Handler for the get defaults section operation -func NewGetDefaultsSection(ctx *middleware.Context, handler GetDefaultsSectionHandler) *GetDefaultsSection { - return &GetDefaultsSection{Context: ctx, Handler: handler} -} - -/* - GetDefaultsSection swagger:route GET /services/haproxy/configuration/defaults/{name} Defaults getDefaultsSection - -# Return a defaults section - -Returns one defaults section configuration by it's name. -*/ -type GetDefaultsSection struct { - Context *middleware.Context - Handler GetDefaultsSectionHandler -} - -func (o *GetDefaultsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDefaultsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/get_defaults_section_parameters.go b/operations/defaults/get_defaults_section_parameters.go deleted file mode 100644 index 558d776b..00000000 --- a/operations/defaults/get_defaults_section_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetDefaultsSectionParams creates a new GetDefaultsSectionParams object -// with the default values initialized. -func NewGetDefaultsSectionParams() GetDefaultsSectionParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetDefaultsSectionParams{ - FullSection: &fullSectionDefault, - } -} - -// GetDefaultsSectionParams contains all the bound params for the get defaults section operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDefaultsSection -type GetDefaultsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Defaults name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDefaultsSectionParams() beforehand. -func (o *GetDefaultsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetDefaultsSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetDefaultsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDefaultsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/defaults/get_defaults_section_responses.go b/operations/defaults/get_defaults_section_responses.go deleted file mode 100644 index 2a17f2de..00000000 --- a/operations/defaults/get_defaults_section_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDefaultsSectionOKCode is the HTTP code returned for type GetDefaultsSectionOK -const GetDefaultsSectionOKCode int = 200 - -/* -GetDefaultsSectionOK Successful operation - -swagger:response getDefaultsSectionOK -*/ -type GetDefaultsSectionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewGetDefaultsSectionOK creates GetDefaultsSectionOK with default headers values -func NewGetDefaultsSectionOK() *GetDefaultsSectionOK { - - return &GetDefaultsSectionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get defaults section o k response -func (o *GetDefaultsSectionOK) WithConfigurationVersion(configurationVersion string) *GetDefaultsSectionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get defaults section o k response -func (o *GetDefaultsSectionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get defaults section o k response -func (o *GetDefaultsSectionOK) WithPayload(payload *models.Defaults) *GetDefaultsSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get defaults section o k response -func (o *GetDefaultsSectionOK) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDefaultsSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetDefaultsSectionNotFoundCode is the HTTP code returned for type GetDefaultsSectionNotFound -const GetDefaultsSectionNotFoundCode int = 404 - -/* -GetDefaultsSectionNotFound The specified resource was not found - -swagger:response getDefaultsSectionNotFound -*/ -type GetDefaultsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDefaultsSectionNotFound creates GetDefaultsSectionNotFound with default headers values -func NewGetDefaultsSectionNotFound() *GetDefaultsSectionNotFound { - - return &GetDefaultsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get defaults section not found response -func (o *GetDefaultsSectionNotFound) WithConfigurationVersion(configurationVersion string) *GetDefaultsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get defaults section not found response -func (o *GetDefaultsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get defaults section not found response -func (o *GetDefaultsSectionNotFound) WithPayload(payload *models.Error) *GetDefaultsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get defaults section not found response -func (o *GetDefaultsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDefaultsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetDefaultsSectionDefault General Error - -swagger:response getDefaultsSectionDefault -*/ -type GetDefaultsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDefaultsSectionDefault creates GetDefaultsSectionDefault with default headers values -func NewGetDefaultsSectionDefault(code int) *GetDefaultsSectionDefault { - if code <= 0 { - code = 500 - } - - return &GetDefaultsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get defaults section default response -func (o *GetDefaultsSectionDefault) WithStatusCode(code int) *GetDefaultsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get defaults section default response -func (o *GetDefaultsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get defaults section default response -func (o *GetDefaultsSectionDefault) WithConfigurationVersion(configurationVersion string) *GetDefaultsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get defaults section default response -func (o *GetDefaultsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get defaults section default response -func (o *GetDefaultsSectionDefault) WithPayload(payload *models.Error) *GetDefaultsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get defaults section default response -func (o *GetDefaultsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDefaultsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/get_defaults_section_urlbuilder.go b/operations/defaults/get_defaults_section_urlbuilder.go deleted file mode 100644 index dc1c8061..00000000 --- a/operations/defaults/get_defaults_section_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetDefaultsSectionURL generates an URL for the get defaults section operation -type GetDefaultsSectionURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDefaultsSectionURL) WithBasePath(bp string) *GetDefaultsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDefaultsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDefaultsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetDefaultsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDefaultsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDefaultsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDefaultsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDefaultsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDefaultsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDefaultsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/get_defaults_sections.go b/operations/defaults/get_defaults_sections.go deleted file mode 100644 index d95270f7..00000000 --- a/operations/defaults/get_defaults_sections.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDefaultsSectionsHandlerFunc turns a function with the right signature into a get defaults sections handler -type GetDefaultsSectionsHandlerFunc func(GetDefaultsSectionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDefaultsSectionsHandlerFunc) Handle(params GetDefaultsSectionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDefaultsSectionsHandler interface for that can handle valid get defaults sections params -type GetDefaultsSectionsHandler interface { - Handle(GetDefaultsSectionsParams, interface{}) middleware.Responder -} - -// NewGetDefaultsSections creates a new http.Handler for the get defaults sections operation -func NewGetDefaultsSections(ctx *middleware.Context, handler GetDefaultsSectionsHandler) *GetDefaultsSections { - return &GetDefaultsSections{Context: ctx, Handler: handler} -} - -/* - GetDefaultsSections swagger:route GET /services/haproxy/configuration/defaults Defaults getDefaultsSections - -# Return an array of defaults - -Returns an array of all configured defaults. -*/ -type GetDefaultsSections struct { - Context *middleware.Context - Handler GetDefaultsSectionsHandler -} - -func (o *GetDefaultsSections) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDefaultsSectionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/get_defaults_sections_parameters.go b/operations/defaults/get_defaults_sections_parameters.go deleted file mode 100644 index b585c236..00000000 --- a/operations/defaults/get_defaults_sections_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetDefaultsSectionsParams creates a new GetDefaultsSectionsParams object -// with the default values initialized. -func NewGetDefaultsSectionsParams() GetDefaultsSectionsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetDefaultsSectionsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetDefaultsSectionsParams contains all the bound params for the get defaults sections operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDefaultsSections -type GetDefaultsSectionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDefaultsSectionsParams() beforehand. -func (o *GetDefaultsSectionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetDefaultsSectionsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetDefaultsSectionsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDefaultsSectionsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/defaults/get_defaults_sections_responses.go b/operations/defaults/get_defaults_sections_responses.go deleted file mode 100644 index c245db02..00000000 --- a/operations/defaults/get_defaults_sections_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDefaultsSectionsOKCode is the HTTP code returned for type GetDefaultsSectionsOK -const GetDefaultsSectionsOKCode int = 200 - -/* -GetDefaultsSectionsOK Successful operation - -swagger:response getDefaultsSectionsOK -*/ -type GetDefaultsSectionsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.DefaultsSections `json:"body,omitempty"` -} - -// NewGetDefaultsSectionsOK creates GetDefaultsSectionsOK with default headers values -func NewGetDefaultsSectionsOK() *GetDefaultsSectionsOK { - - return &GetDefaultsSectionsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get defaults sections o k response -func (o *GetDefaultsSectionsOK) WithConfigurationVersion(configurationVersion string) *GetDefaultsSectionsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get defaults sections o k response -func (o *GetDefaultsSectionsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get defaults sections o k response -func (o *GetDefaultsSectionsOK) WithPayload(payload models.DefaultsSections) *GetDefaultsSectionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get defaults sections o k response -func (o *GetDefaultsSectionsOK) SetPayload(payload models.DefaultsSections) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDefaultsSectionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.DefaultsSections{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetDefaultsSectionsDefault General Error - -swagger:response getDefaultsSectionsDefault -*/ -type GetDefaultsSectionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDefaultsSectionsDefault creates GetDefaultsSectionsDefault with default headers values -func NewGetDefaultsSectionsDefault(code int) *GetDefaultsSectionsDefault { - if code <= 0 { - code = 500 - } - - return &GetDefaultsSectionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) WithStatusCode(code int) *GetDefaultsSectionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) WithConfigurationVersion(configurationVersion string) *GetDefaultsSectionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) WithPayload(payload *models.Error) *GetDefaultsSectionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get defaults sections default response -func (o *GetDefaultsSectionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDefaultsSectionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/get_defaults_sections_urlbuilder.go b/operations/defaults/get_defaults_sections_urlbuilder.go deleted file mode 100644 index 702a1dbf..00000000 --- a/operations/defaults/get_defaults_sections_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetDefaultsSectionsURL generates an URL for the get defaults sections operation -type GetDefaultsSectionsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDefaultsSectionsURL) WithBasePath(bp string) *GetDefaultsSectionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDefaultsSectionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDefaultsSectionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDefaultsSectionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDefaultsSectionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDefaultsSectionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDefaultsSectionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDefaultsSectionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDefaultsSectionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/defaults/replace_defaults_section.go b/operations/defaults/replace_defaults_section.go deleted file mode 100644 index ec7746d2..00000000 --- a/operations/defaults/replace_defaults_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceDefaultsSectionHandlerFunc turns a function with the right signature into a replace defaults section handler -type ReplaceDefaultsSectionHandlerFunc func(ReplaceDefaultsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceDefaultsSectionHandlerFunc) Handle(params ReplaceDefaultsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceDefaultsSectionHandler interface for that can handle valid replace defaults section params -type ReplaceDefaultsSectionHandler interface { - Handle(ReplaceDefaultsSectionParams, interface{}) middleware.Responder -} - -// NewReplaceDefaultsSection creates a new http.Handler for the replace defaults section operation -func NewReplaceDefaultsSection(ctx *middleware.Context, handler ReplaceDefaultsSectionHandler) *ReplaceDefaultsSection { - return &ReplaceDefaultsSection{Context: ctx, Handler: handler} -} - -/* - ReplaceDefaultsSection swagger:route PUT /services/haproxy/configuration/defaults/{name} Defaults replaceDefaultsSection - -# Replace a defatults section - -Replaces a defatults section configuration by it's name. -*/ -type ReplaceDefaultsSection struct { - Context *middleware.Context - Handler ReplaceDefaultsSectionHandler -} - -func (o *ReplaceDefaultsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceDefaultsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/defaults/replace_defaults_section_parameters.go b/operations/defaults/replace_defaults_section_parameters.go deleted file mode 100644 index 3f94df48..00000000 --- a/operations/defaults/replace_defaults_section_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceDefaultsSectionParams creates a new ReplaceDefaultsSectionParams object -// with the default values initialized. -func NewReplaceDefaultsSectionParams() ReplaceDefaultsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceDefaultsSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceDefaultsSectionParams contains all the bound params for the replace defaults section operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceDefaultsSection -type ReplaceDefaultsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Defaults - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Defaults name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceDefaultsSectionParams() beforehand. -func (o *ReplaceDefaultsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Defaults - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceDefaultsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceDefaultsSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceDefaultsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceDefaultsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceDefaultsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceDefaultsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/defaults/replace_defaults_section_responses.go b/operations/defaults/replace_defaults_section_responses.go deleted file mode 100644 index 7a9538a5..00000000 --- a/operations/defaults/replace_defaults_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceDefaultsSectionOKCode is the HTTP code returned for type ReplaceDefaultsSectionOK -const ReplaceDefaultsSectionOKCode int = 200 - -/* -ReplaceDefaultsSectionOK Defaults section replaced - -swagger:response replaceDefaultsSectionOK -*/ -type ReplaceDefaultsSectionOK struct { - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewReplaceDefaultsSectionOK creates ReplaceDefaultsSectionOK with default headers values -func NewReplaceDefaultsSectionOK() *ReplaceDefaultsSectionOK { - - return &ReplaceDefaultsSectionOK{} -} - -// WithPayload adds the payload to the replace defaults section o k response -func (o *ReplaceDefaultsSectionOK) WithPayload(payload *models.Defaults) *ReplaceDefaultsSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace defaults section o k response -func (o *ReplaceDefaultsSectionOK) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDefaultsSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDefaultsSectionAcceptedCode is the HTTP code returned for type ReplaceDefaultsSectionAccepted -const ReplaceDefaultsSectionAcceptedCode int = 202 - -/* -ReplaceDefaultsSectionAccepted Configuration change accepted and reload requested - -swagger:response replaceDefaultsSectionAccepted -*/ -type ReplaceDefaultsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Defaults `json:"body,omitempty"` -} - -// NewReplaceDefaultsSectionAccepted creates ReplaceDefaultsSectionAccepted with default headers values -func NewReplaceDefaultsSectionAccepted() *ReplaceDefaultsSectionAccepted { - - return &ReplaceDefaultsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the replace defaults section accepted response -func (o *ReplaceDefaultsSectionAccepted) WithReloadID(reloadID string) *ReplaceDefaultsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace defaults section accepted response -func (o *ReplaceDefaultsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace defaults section accepted response -func (o *ReplaceDefaultsSectionAccepted) WithPayload(payload *models.Defaults) *ReplaceDefaultsSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace defaults section accepted response -func (o *ReplaceDefaultsSectionAccepted) SetPayload(payload *models.Defaults) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDefaultsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDefaultsSectionBadRequestCode is the HTTP code returned for type ReplaceDefaultsSectionBadRequest -const ReplaceDefaultsSectionBadRequestCode int = 400 - -/* -ReplaceDefaultsSectionBadRequest Bad request - -swagger:response replaceDefaultsSectionBadRequest -*/ -type ReplaceDefaultsSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDefaultsSectionBadRequest creates ReplaceDefaultsSectionBadRequest with default headers values -func NewReplaceDefaultsSectionBadRequest() *ReplaceDefaultsSectionBadRequest { - - return &ReplaceDefaultsSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace defaults section bad request response -func (o *ReplaceDefaultsSectionBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceDefaultsSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace defaults section bad request response -func (o *ReplaceDefaultsSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace defaults section bad request response -func (o *ReplaceDefaultsSectionBadRequest) WithPayload(payload *models.Error) *ReplaceDefaultsSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace defaults section bad request response -func (o *ReplaceDefaultsSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDefaultsSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDefaultsSectionNotFoundCode is the HTTP code returned for type ReplaceDefaultsSectionNotFound -const ReplaceDefaultsSectionNotFoundCode int = 404 - -/* -ReplaceDefaultsSectionNotFound The specified resource was not found - -swagger:response replaceDefaultsSectionNotFound -*/ -type ReplaceDefaultsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDefaultsSectionNotFound creates ReplaceDefaultsSectionNotFound with default headers values -func NewReplaceDefaultsSectionNotFound() *ReplaceDefaultsSectionNotFound { - - return &ReplaceDefaultsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace defaults section not found response -func (o *ReplaceDefaultsSectionNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceDefaultsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace defaults section not found response -func (o *ReplaceDefaultsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace defaults section not found response -func (o *ReplaceDefaultsSectionNotFound) WithPayload(payload *models.Error) *ReplaceDefaultsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace defaults section not found response -func (o *ReplaceDefaultsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDefaultsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceDefaultsSectionDefault General Error - -swagger:response replaceDefaultsSectionDefault -*/ -type ReplaceDefaultsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDefaultsSectionDefault creates ReplaceDefaultsSectionDefault with default headers values -func NewReplaceDefaultsSectionDefault(code int) *ReplaceDefaultsSectionDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceDefaultsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) WithStatusCode(code int) *ReplaceDefaultsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) WithConfigurationVersion(configurationVersion string) *ReplaceDefaultsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) WithPayload(payload *models.Error) *ReplaceDefaultsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace defaults section default response -func (o *ReplaceDefaultsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDefaultsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/defaults/replace_defaults_section_urlbuilder.go b/operations/defaults/replace_defaults_section_urlbuilder.go deleted file mode 100644 index 4ab7eada..00000000 --- a/operations/defaults/replace_defaults_section_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package defaults - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceDefaultsSectionURL generates an URL for the replace defaults section operation -type ReplaceDefaultsSectionURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDefaultsSectionURL) WithBasePath(bp string) *ReplaceDefaultsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDefaultsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceDefaultsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceDefaultsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceDefaultsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceDefaultsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceDefaultsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceDefaultsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceDefaultsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceDefaultsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/dgram_bind/create_dgram_bind.go b/operations/dgram_bind/create_dgram_bind.go deleted file mode 100644 index fec65b11..00000000 --- a/operations/dgram_bind/create_dgram_bind.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateDgramBindHandlerFunc turns a function with the right signature into a create dgram bind handler -type CreateDgramBindHandlerFunc func(CreateDgramBindParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateDgramBindHandlerFunc) Handle(params CreateDgramBindParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateDgramBindHandler interface for that can handle valid create dgram bind params -type CreateDgramBindHandler interface { - Handle(CreateDgramBindParams, interface{}) middleware.Responder -} - -// NewCreateDgramBind creates a new http.Handler for the create dgram bind operation -func NewCreateDgramBind(ctx *middleware.Context, handler CreateDgramBindHandler) *CreateDgramBind { - return &CreateDgramBind{Context: ctx, Handler: handler} -} - -/* - CreateDgramBind swagger:route POST /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds DgramBind createDgramBind - -# Add a new dgram bind - -Adds a new dgram bind in the specified log forward in the configuration file. -*/ -type CreateDgramBind struct { - Context *middleware.Context - Handler CreateDgramBindHandler -} - -func (o *CreateDgramBind) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateDgramBindParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/dgram_bind/create_dgram_bind_parameters.go b/operations/dgram_bind/create_dgram_bind_parameters.go deleted file mode 100644 index 2678b1e1..00000000 --- a/operations/dgram_bind/create_dgram_bind_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateDgramBindParams creates a new CreateDgramBindParams object -// with the default values initialized. -func NewCreateDgramBindParams() CreateDgramBindParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateDgramBindParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateDgramBindParams contains all the bound params for the create dgram bind operation -// typically these are obtained from a http.Request -// -// swagger:parameters createDgramBind -type CreateDgramBindParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.DgramBind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateDgramBindParams() beforehand. -func (o *CreateDgramBindParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.DgramBind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateDgramBindParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateDgramBindParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateDgramBindParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateDgramBindParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateDgramBindParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/dgram_bind/create_dgram_bind_responses.go b/operations/dgram_bind/create_dgram_bind_responses.go deleted file mode 100644 index b6940f41..00000000 --- a/operations/dgram_bind/create_dgram_bind_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateDgramBindCreatedCode is the HTTP code returned for type CreateDgramBindCreated -const CreateDgramBindCreatedCode int = 201 - -/* -CreateDgramBindCreated Bind created - -swagger:response createDgramBindCreated -*/ -type CreateDgramBindCreated struct { - - /* - In: Body - */ - Payload *models.DgramBind `json:"body,omitempty"` -} - -// NewCreateDgramBindCreated creates CreateDgramBindCreated with default headers values -func NewCreateDgramBindCreated() *CreateDgramBindCreated { - - return &CreateDgramBindCreated{} -} - -// WithPayload adds the payload to the create dgram bind created response -func (o *CreateDgramBindCreated) WithPayload(payload *models.DgramBind) *CreateDgramBindCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create dgram bind created response -func (o *CreateDgramBindCreated) SetPayload(payload *models.DgramBind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDgramBindCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDgramBindAcceptedCode is the HTTP code returned for type CreateDgramBindAccepted -const CreateDgramBindAcceptedCode int = 202 - -/* -CreateDgramBindAccepted Configuration change accepted and reload requested - -swagger:response createDgramBindAccepted -*/ -type CreateDgramBindAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.DgramBind `json:"body,omitempty"` -} - -// NewCreateDgramBindAccepted creates CreateDgramBindAccepted with default headers values -func NewCreateDgramBindAccepted() *CreateDgramBindAccepted { - - return &CreateDgramBindAccepted{} -} - -// WithReloadID adds the reloadId to the create dgram bind accepted response -func (o *CreateDgramBindAccepted) WithReloadID(reloadID string) *CreateDgramBindAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create dgram bind accepted response -func (o *CreateDgramBindAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create dgram bind accepted response -func (o *CreateDgramBindAccepted) WithPayload(payload *models.DgramBind) *CreateDgramBindAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create dgram bind accepted response -func (o *CreateDgramBindAccepted) SetPayload(payload *models.DgramBind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDgramBindAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDgramBindBadRequestCode is the HTTP code returned for type CreateDgramBindBadRequest -const CreateDgramBindBadRequestCode int = 400 - -/* -CreateDgramBindBadRequest Bad request - -swagger:response createDgramBindBadRequest -*/ -type CreateDgramBindBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDgramBindBadRequest creates CreateDgramBindBadRequest with default headers values -func NewCreateDgramBindBadRequest() *CreateDgramBindBadRequest { - - return &CreateDgramBindBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create dgram bind bad request response -func (o *CreateDgramBindBadRequest) WithConfigurationVersion(configurationVersion string) *CreateDgramBindBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create dgram bind bad request response -func (o *CreateDgramBindBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create dgram bind bad request response -func (o *CreateDgramBindBadRequest) WithPayload(payload *models.Error) *CreateDgramBindBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create dgram bind bad request response -func (o *CreateDgramBindBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDgramBindBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateDgramBindConflictCode is the HTTP code returned for type CreateDgramBindConflict -const CreateDgramBindConflictCode int = 409 - -/* -CreateDgramBindConflict The specified resource already exists - -swagger:response createDgramBindConflict -*/ -type CreateDgramBindConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDgramBindConflict creates CreateDgramBindConflict with default headers values -func NewCreateDgramBindConflict() *CreateDgramBindConflict { - - return &CreateDgramBindConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create dgram bind conflict response -func (o *CreateDgramBindConflict) WithConfigurationVersion(configurationVersion string) *CreateDgramBindConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create dgram bind conflict response -func (o *CreateDgramBindConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create dgram bind conflict response -func (o *CreateDgramBindConflict) WithPayload(payload *models.Error) *CreateDgramBindConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create dgram bind conflict response -func (o *CreateDgramBindConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDgramBindConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateDgramBindDefault General Error - -swagger:response createDgramBindDefault -*/ -type CreateDgramBindDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateDgramBindDefault creates CreateDgramBindDefault with default headers values -func NewCreateDgramBindDefault(code int) *CreateDgramBindDefault { - if code <= 0 { - code = 500 - } - - return &CreateDgramBindDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create dgram bind default response -func (o *CreateDgramBindDefault) WithStatusCode(code int) *CreateDgramBindDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create dgram bind default response -func (o *CreateDgramBindDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create dgram bind default response -func (o *CreateDgramBindDefault) WithConfigurationVersion(configurationVersion string) *CreateDgramBindDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create dgram bind default response -func (o *CreateDgramBindDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create dgram bind default response -func (o *CreateDgramBindDefault) WithPayload(payload *models.Error) *CreateDgramBindDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create dgram bind default response -func (o *CreateDgramBindDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateDgramBindDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/dgram_bind/create_dgram_bind_urlbuilder.go b/operations/dgram_bind/create_dgram_bind_urlbuilder.go deleted file mode 100644 index 3a37b653..00000000 --- a/operations/dgram_bind/create_dgram_bind_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateDgramBindURL generates an URL for the create dgram bind operation -type CreateDgramBindURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDgramBindURL) WithBasePath(bp string) *CreateDgramBindURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateDgramBindURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateDgramBindURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateDgramBindURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateDgramBindURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateDgramBindURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateDgramBindURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateDgramBindURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateDgramBindURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateDgramBindURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/dgram_bind/delete_dgram_bind.go b/operations/dgram_bind/delete_dgram_bind.go deleted file mode 100644 index fa96f4cb..00000000 --- a/operations/dgram_bind/delete_dgram_bind.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteDgramBindHandlerFunc turns a function with the right signature into a delete dgram bind handler -type DeleteDgramBindHandlerFunc func(DeleteDgramBindParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteDgramBindHandlerFunc) Handle(params DeleteDgramBindParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteDgramBindHandler interface for that can handle valid delete dgram bind params -type DeleteDgramBindHandler interface { - Handle(DeleteDgramBindParams, interface{}) middleware.Responder -} - -// NewDeleteDgramBind creates a new http.Handler for the delete dgram bind operation -func NewDeleteDgramBind(ctx *middleware.Context, handler DeleteDgramBindHandler) *DeleteDgramBind { - return &DeleteDgramBind{Context: ctx, Handler: handler} -} - -/* - DeleteDgramBind swagger:route DELETE /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name} DgramBind deleteDgramBind - -# Delete a dgram bind - -Deletes a dgram bind configuration by it's name in the specified log forward. -*/ -type DeleteDgramBind struct { - Context *middleware.Context - Handler DeleteDgramBindHandler -} - -func (o *DeleteDgramBind) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteDgramBindParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/dgram_bind/delete_dgram_bind_parameters.go b/operations/dgram_bind/delete_dgram_bind_parameters.go deleted file mode 100644 index b3995061..00000000 --- a/operations/dgram_bind/delete_dgram_bind_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteDgramBindParams creates a new DeleteDgramBindParams object -// with the default values initialized. -func NewDeleteDgramBindParams() DeleteDgramBindParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteDgramBindParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteDgramBindParams contains all the bound params for the delete dgram bind operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteDgramBind -type DeleteDgramBindParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteDgramBindParams() beforehand. -func (o *DeleteDgramBindParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteDgramBindParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteDgramBindParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteDgramBindParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteDgramBindParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteDgramBindParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteDgramBindParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/dgram_bind/delete_dgram_bind_responses.go b/operations/dgram_bind/delete_dgram_bind_responses.go deleted file mode 100644 index 5ae6f89f..00000000 --- a/operations/dgram_bind/delete_dgram_bind_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteDgramBindAcceptedCode is the HTTP code returned for type DeleteDgramBindAccepted -const DeleteDgramBindAcceptedCode int = 202 - -/* -DeleteDgramBindAccepted Configuration change accepted and reload requested - -swagger:response deleteDgramBindAccepted -*/ -type DeleteDgramBindAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteDgramBindAccepted creates DeleteDgramBindAccepted with default headers values -func NewDeleteDgramBindAccepted() *DeleteDgramBindAccepted { - - return &DeleteDgramBindAccepted{} -} - -// WithReloadID adds the reloadId to the delete dgram bind accepted response -func (o *DeleteDgramBindAccepted) WithReloadID(reloadID string) *DeleteDgramBindAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete dgram bind accepted response -func (o *DeleteDgramBindAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteDgramBindAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteDgramBindNoContentCode is the HTTP code returned for type DeleteDgramBindNoContent -const DeleteDgramBindNoContentCode int = 204 - -/* -DeleteDgramBindNoContent Bind deleted - -swagger:response deleteDgramBindNoContent -*/ -type DeleteDgramBindNoContent struct { -} - -// NewDeleteDgramBindNoContent creates DeleteDgramBindNoContent with default headers values -func NewDeleteDgramBindNoContent() *DeleteDgramBindNoContent { - - return &DeleteDgramBindNoContent{} -} - -// WriteResponse to the client -func (o *DeleteDgramBindNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteDgramBindNotFoundCode is the HTTP code returned for type DeleteDgramBindNotFound -const DeleteDgramBindNotFoundCode int = 404 - -/* -DeleteDgramBindNotFound The specified resource was not found - -swagger:response deleteDgramBindNotFound -*/ -type DeleteDgramBindNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDgramBindNotFound creates DeleteDgramBindNotFound with default headers values -func NewDeleteDgramBindNotFound() *DeleteDgramBindNotFound { - - return &DeleteDgramBindNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete dgram bind not found response -func (o *DeleteDgramBindNotFound) WithConfigurationVersion(configurationVersion string) *DeleteDgramBindNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete dgram bind not found response -func (o *DeleteDgramBindNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete dgram bind not found response -func (o *DeleteDgramBindNotFound) WithPayload(payload *models.Error) *DeleteDgramBindNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete dgram bind not found response -func (o *DeleteDgramBindNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDgramBindNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteDgramBindDefault General Error - -swagger:response deleteDgramBindDefault -*/ -type DeleteDgramBindDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteDgramBindDefault creates DeleteDgramBindDefault with default headers values -func NewDeleteDgramBindDefault(code int) *DeleteDgramBindDefault { - if code <= 0 { - code = 500 - } - - return &DeleteDgramBindDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete dgram bind default response -func (o *DeleteDgramBindDefault) WithStatusCode(code int) *DeleteDgramBindDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete dgram bind default response -func (o *DeleteDgramBindDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete dgram bind default response -func (o *DeleteDgramBindDefault) WithConfigurationVersion(configurationVersion string) *DeleteDgramBindDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete dgram bind default response -func (o *DeleteDgramBindDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete dgram bind default response -func (o *DeleteDgramBindDefault) WithPayload(payload *models.Error) *DeleteDgramBindDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete dgram bind default response -func (o *DeleteDgramBindDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteDgramBindDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/dgram_bind/delete_dgram_bind_urlbuilder.go b/operations/dgram_bind/delete_dgram_bind_urlbuilder.go deleted file mode 100644 index 564e18bd..00000000 --- a/operations/dgram_bind/delete_dgram_bind_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteDgramBindURL generates an URL for the delete dgram bind operation -type DeleteDgramBindURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDgramBindURL) WithBasePath(bp string) *DeleteDgramBindURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteDgramBindURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteDgramBindURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteDgramBindURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteDgramBindURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteDgramBindURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteDgramBindURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteDgramBindURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteDgramBindURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteDgramBindURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteDgramBindURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/dgram_bind/get_dgram_bind.go b/operations/dgram_bind/get_dgram_bind.go deleted file mode 100644 index deabe3c3..00000000 --- a/operations/dgram_bind/get_dgram_bind.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDgramBindHandlerFunc turns a function with the right signature into a get dgram bind handler -type GetDgramBindHandlerFunc func(GetDgramBindParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDgramBindHandlerFunc) Handle(params GetDgramBindParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDgramBindHandler interface for that can handle valid get dgram bind params -type GetDgramBindHandler interface { - Handle(GetDgramBindParams, interface{}) middleware.Responder -} - -// NewGetDgramBind creates a new http.Handler for the get dgram bind operation -func NewGetDgramBind(ctx *middleware.Context, handler GetDgramBindHandler) *GetDgramBind { - return &GetDgramBind{Context: ctx, Handler: handler} -} - -/* - GetDgramBind swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name} DgramBind getDgramBind - -# Return one dgram bind - -Returns one dgram bind configuration by it's name in the specified log forward. -*/ -type GetDgramBind struct { - Context *middleware.Context - Handler GetDgramBindHandler -} - -func (o *GetDgramBind) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDgramBindParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/dgram_bind/get_dgram_bind_parameters.go b/operations/dgram_bind/get_dgram_bind_parameters.go deleted file mode 100644 index 4355ac22..00000000 --- a/operations/dgram_bind/get_dgram_bind_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetDgramBindParams creates a new GetDgramBindParams object -// -// There are no default values defined in the spec. -func NewGetDgramBindParams() GetDgramBindParams { - - return GetDgramBindParams{} -} - -// GetDgramBindParams contains all the bound params for the get dgram bind operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDgramBind -type GetDgramBindParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDgramBindParams() beforehand. -func (o *GetDgramBindParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetDgramBindParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetDgramBindParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDgramBindParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/dgram_bind/get_dgram_bind_responses.go b/operations/dgram_bind/get_dgram_bind_responses.go deleted file mode 100644 index 054a8b97..00000000 --- a/operations/dgram_bind/get_dgram_bind_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDgramBindOKCode is the HTTP code returned for type GetDgramBindOK -const GetDgramBindOKCode int = 200 - -/* -GetDgramBindOK Successful operation - -swagger:response getDgramBindOK -*/ -type GetDgramBindOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.DgramBind `json:"body,omitempty"` -} - -// NewGetDgramBindOK creates GetDgramBindOK with default headers values -func NewGetDgramBindOK() *GetDgramBindOK { - - return &GetDgramBindOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get dgram bind o k response -func (o *GetDgramBindOK) WithConfigurationVersion(configurationVersion string) *GetDgramBindOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get dgram bind o k response -func (o *GetDgramBindOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get dgram bind o k response -func (o *GetDgramBindOK) WithPayload(payload *models.DgramBind) *GetDgramBindOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get dgram bind o k response -func (o *GetDgramBindOK) SetPayload(payload *models.DgramBind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDgramBindOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetDgramBindNotFoundCode is the HTTP code returned for type GetDgramBindNotFound -const GetDgramBindNotFoundCode int = 404 - -/* -GetDgramBindNotFound The specified resource already exists - -swagger:response getDgramBindNotFound -*/ -type GetDgramBindNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDgramBindNotFound creates GetDgramBindNotFound with default headers values -func NewGetDgramBindNotFound() *GetDgramBindNotFound { - - return &GetDgramBindNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get dgram bind not found response -func (o *GetDgramBindNotFound) WithConfigurationVersion(configurationVersion string) *GetDgramBindNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get dgram bind not found response -func (o *GetDgramBindNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get dgram bind not found response -func (o *GetDgramBindNotFound) WithPayload(payload *models.Error) *GetDgramBindNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get dgram bind not found response -func (o *GetDgramBindNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDgramBindNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetDgramBindDefault General Error - -swagger:response getDgramBindDefault -*/ -type GetDgramBindDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDgramBindDefault creates GetDgramBindDefault with default headers values -func NewGetDgramBindDefault(code int) *GetDgramBindDefault { - if code <= 0 { - code = 500 - } - - return &GetDgramBindDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get dgram bind default response -func (o *GetDgramBindDefault) WithStatusCode(code int) *GetDgramBindDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get dgram bind default response -func (o *GetDgramBindDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get dgram bind default response -func (o *GetDgramBindDefault) WithConfigurationVersion(configurationVersion string) *GetDgramBindDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get dgram bind default response -func (o *GetDgramBindDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get dgram bind default response -func (o *GetDgramBindDefault) WithPayload(payload *models.Error) *GetDgramBindDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get dgram bind default response -func (o *GetDgramBindDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDgramBindDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/dgram_bind/get_dgram_bind_urlbuilder.go b/operations/dgram_bind/get_dgram_bind_urlbuilder.go deleted file mode 100644 index a252994c..00000000 --- a/operations/dgram_bind/get_dgram_bind_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetDgramBindURL generates an URL for the get dgram bind operation -type GetDgramBindURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDgramBindURL) WithBasePath(bp string) *GetDgramBindURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDgramBindURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDgramBindURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetDgramBindURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetDgramBindURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDgramBindURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDgramBindURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDgramBindURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDgramBindURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDgramBindURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDgramBindURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/dgram_bind/get_dgram_binds.go b/operations/dgram_bind/get_dgram_binds.go deleted file mode 100644 index ada78ead..00000000 --- a/operations/dgram_bind/get_dgram_binds.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetDgramBindsHandlerFunc turns a function with the right signature into a get dgram binds handler -type GetDgramBindsHandlerFunc func(GetDgramBindsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetDgramBindsHandlerFunc) Handle(params GetDgramBindsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetDgramBindsHandler interface for that can handle valid get dgram binds params -type GetDgramBindsHandler interface { - Handle(GetDgramBindsParams, interface{}) middleware.Responder -} - -// NewGetDgramBinds creates a new http.Handler for the get dgram binds operation -func NewGetDgramBinds(ctx *middleware.Context, handler GetDgramBindsHandler) *GetDgramBinds { - return &GetDgramBinds{Context: ctx, Handler: handler} -} - -/* - GetDgramBinds swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds DgramBind getDgramBinds - -# Return an array of dgram binds - -Returns an array of all dgram binds that are configured in specified log forward. -*/ -type GetDgramBinds struct { - Context *middleware.Context - Handler GetDgramBindsHandler -} - -func (o *GetDgramBinds) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetDgramBindsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/dgram_bind/get_dgram_binds_parameters.go b/operations/dgram_bind/get_dgram_binds_parameters.go deleted file mode 100644 index c37006e9..00000000 --- a/operations/dgram_bind/get_dgram_binds_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetDgramBindsParams creates a new GetDgramBindsParams object -// -// There are no default values defined in the spec. -func NewGetDgramBindsParams() GetDgramBindsParams { - - return GetDgramBindsParams{} -} - -// GetDgramBindsParams contains all the bound params for the get dgram binds operation -// typically these are obtained from a http.Request -// -// swagger:parameters getDgramBinds -type GetDgramBindsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetDgramBindsParams() beforehand. -func (o *GetDgramBindsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetDgramBindsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetDgramBindsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/dgram_bind/get_dgram_binds_responses.go b/operations/dgram_bind/get_dgram_binds_responses.go deleted file mode 100644 index 093978b7..00000000 --- a/operations/dgram_bind/get_dgram_binds_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetDgramBindsOKCode is the HTTP code returned for type GetDgramBindsOK -const GetDgramBindsOKCode int = 200 - -/* -GetDgramBindsOK Successful operation - -swagger:response getDgramBindsOK -*/ -type GetDgramBindsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.DgramBinds `json:"body,omitempty"` -} - -// NewGetDgramBindsOK creates GetDgramBindsOK with default headers values -func NewGetDgramBindsOK() *GetDgramBindsOK { - - return &GetDgramBindsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get dgram binds o k response -func (o *GetDgramBindsOK) WithConfigurationVersion(configurationVersion string) *GetDgramBindsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get dgram binds o k response -func (o *GetDgramBindsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get dgram binds o k response -func (o *GetDgramBindsOK) WithPayload(payload models.DgramBinds) *GetDgramBindsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get dgram binds o k response -func (o *GetDgramBindsOK) SetPayload(payload models.DgramBinds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDgramBindsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.DgramBinds{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetDgramBindsDefault General Error - -swagger:response getDgramBindsDefault -*/ -type GetDgramBindsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetDgramBindsDefault creates GetDgramBindsDefault with default headers values -func NewGetDgramBindsDefault(code int) *GetDgramBindsDefault { - if code <= 0 { - code = 500 - } - - return &GetDgramBindsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get dgram binds default response -func (o *GetDgramBindsDefault) WithStatusCode(code int) *GetDgramBindsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get dgram binds default response -func (o *GetDgramBindsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get dgram binds default response -func (o *GetDgramBindsDefault) WithConfigurationVersion(configurationVersion string) *GetDgramBindsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get dgram binds default response -func (o *GetDgramBindsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get dgram binds default response -func (o *GetDgramBindsDefault) WithPayload(payload *models.Error) *GetDgramBindsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get dgram binds default response -func (o *GetDgramBindsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetDgramBindsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/dgram_bind/get_dgram_binds_urlbuilder.go b/operations/dgram_bind/get_dgram_binds_urlbuilder.go deleted file mode 100644 index 755add34..00000000 --- a/operations/dgram_bind/get_dgram_binds_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetDgramBindsURL generates an URL for the get dgram binds operation -type GetDgramBindsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDgramBindsURL) WithBasePath(bp string) *GetDgramBindsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetDgramBindsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetDgramBindsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetDgramBindsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetDgramBindsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetDgramBindsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetDgramBindsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetDgramBindsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetDgramBindsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetDgramBindsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/dgram_bind/replace_dgram_bind.go b/operations/dgram_bind/replace_dgram_bind.go deleted file mode 100644 index 1a5f14ad..00000000 --- a/operations/dgram_bind/replace_dgram_bind.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceDgramBindHandlerFunc turns a function with the right signature into a replace dgram bind handler -type ReplaceDgramBindHandlerFunc func(ReplaceDgramBindParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceDgramBindHandlerFunc) Handle(params ReplaceDgramBindParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceDgramBindHandler interface for that can handle valid replace dgram bind params -type ReplaceDgramBindHandler interface { - Handle(ReplaceDgramBindParams, interface{}) middleware.Responder -} - -// NewReplaceDgramBind creates a new http.Handler for the replace dgram bind operation -func NewReplaceDgramBind(ctx *middleware.Context, handler ReplaceDgramBindHandler) *ReplaceDgramBind { - return &ReplaceDgramBind{Context: ctx, Handler: handler} -} - -/* - ReplaceDgramBind swagger:route PUT /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name} DgramBind replaceDgramBind - -# Replace a dgram bind - -Replaces a dgram bind configuration by it's name in the specified log forward. -*/ -type ReplaceDgramBind struct { - Context *middleware.Context - Handler ReplaceDgramBindHandler -} - -func (o *ReplaceDgramBind) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceDgramBindParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/dgram_bind/replace_dgram_bind_parameters.go b/operations/dgram_bind/replace_dgram_bind_parameters.go deleted file mode 100644 index 3f05f62b..00000000 --- a/operations/dgram_bind/replace_dgram_bind_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceDgramBindParams creates a new ReplaceDgramBindParams object -// with the default values initialized. -func NewReplaceDgramBindParams() ReplaceDgramBindParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceDgramBindParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceDgramBindParams contains all the bound params for the replace dgram bind operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceDgramBind -type ReplaceDgramBindParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.DgramBind - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Bind name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceDgramBindParams() beforehand. -func (o *ReplaceDgramBindParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.DgramBind - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceDgramBindParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceDgramBindParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceDgramBindParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceDgramBindParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceDgramBindParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceDgramBindParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/dgram_bind/replace_dgram_bind_responses.go b/operations/dgram_bind/replace_dgram_bind_responses.go deleted file mode 100644 index ecef4fe6..00000000 --- a/operations/dgram_bind/replace_dgram_bind_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceDgramBindOKCode is the HTTP code returned for type ReplaceDgramBindOK -const ReplaceDgramBindOKCode int = 200 - -/* -ReplaceDgramBindOK Bind replaced - -swagger:response replaceDgramBindOK -*/ -type ReplaceDgramBindOK struct { - - /* - In: Body - */ - Payload *models.DgramBind `json:"body,omitempty"` -} - -// NewReplaceDgramBindOK creates ReplaceDgramBindOK with default headers values -func NewReplaceDgramBindOK() *ReplaceDgramBindOK { - - return &ReplaceDgramBindOK{} -} - -// WithPayload adds the payload to the replace dgram bind o k response -func (o *ReplaceDgramBindOK) WithPayload(payload *models.DgramBind) *ReplaceDgramBindOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace dgram bind o k response -func (o *ReplaceDgramBindOK) SetPayload(payload *models.DgramBind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDgramBindOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDgramBindAcceptedCode is the HTTP code returned for type ReplaceDgramBindAccepted -const ReplaceDgramBindAcceptedCode int = 202 - -/* -ReplaceDgramBindAccepted Configuration change accepted and reload requested - -swagger:response replaceDgramBindAccepted -*/ -type ReplaceDgramBindAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.DgramBind `json:"body,omitempty"` -} - -// NewReplaceDgramBindAccepted creates ReplaceDgramBindAccepted with default headers values -func NewReplaceDgramBindAccepted() *ReplaceDgramBindAccepted { - - return &ReplaceDgramBindAccepted{} -} - -// WithReloadID adds the reloadId to the replace dgram bind accepted response -func (o *ReplaceDgramBindAccepted) WithReloadID(reloadID string) *ReplaceDgramBindAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace dgram bind accepted response -func (o *ReplaceDgramBindAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace dgram bind accepted response -func (o *ReplaceDgramBindAccepted) WithPayload(payload *models.DgramBind) *ReplaceDgramBindAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace dgram bind accepted response -func (o *ReplaceDgramBindAccepted) SetPayload(payload *models.DgramBind) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDgramBindAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDgramBindBadRequestCode is the HTTP code returned for type ReplaceDgramBindBadRequest -const ReplaceDgramBindBadRequestCode int = 400 - -/* -ReplaceDgramBindBadRequest Bad request - -swagger:response replaceDgramBindBadRequest -*/ -type ReplaceDgramBindBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDgramBindBadRequest creates ReplaceDgramBindBadRequest with default headers values -func NewReplaceDgramBindBadRequest() *ReplaceDgramBindBadRequest { - - return &ReplaceDgramBindBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace dgram bind bad request response -func (o *ReplaceDgramBindBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceDgramBindBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace dgram bind bad request response -func (o *ReplaceDgramBindBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace dgram bind bad request response -func (o *ReplaceDgramBindBadRequest) WithPayload(payload *models.Error) *ReplaceDgramBindBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace dgram bind bad request response -func (o *ReplaceDgramBindBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDgramBindBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceDgramBindNotFoundCode is the HTTP code returned for type ReplaceDgramBindNotFound -const ReplaceDgramBindNotFoundCode int = 404 - -/* -ReplaceDgramBindNotFound The specified resource was not found - -swagger:response replaceDgramBindNotFound -*/ -type ReplaceDgramBindNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDgramBindNotFound creates ReplaceDgramBindNotFound with default headers values -func NewReplaceDgramBindNotFound() *ReplaceDgramBindNotFound { - - return &ReplaceDgramBindNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace dgram bind not found response -func (o *ReplaceDgramBindNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceDgramBindNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace dgram bind not found response -func (o *ReplaceDgramBindNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace dgram bind not found response -func (o *ReplaceDgramBindNotFound) WithPayload(payload *models.Error) *ReplaceDgramBindNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace dgram bind not found response -func (o *ReplaceDgramBindNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDgramBindNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceDgramBindDefault General Error - -swagger:response replaceDgramBindDefault -*/ -type ReplaceDgramBindDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceDgramBindDefault creates ReplaceDgramBindDefault with default headers values -func NewReplaceDgramBindDefault(code int) *ReplaceDgramBindDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceDgramBindDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) WithStatusCode(code int) *ReplaceDgramBindDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) WithConfigurationVersion(configurationVersion string) *ReplaceDgramBindDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) WithPayload(payload *models.Error) *ReplaceDgramBindDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace dgram bind default response -func (o *ReplaceDgramBindDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceDgramBindDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/dgram_bind/replace_dgram_bind_urlbuilder.go b/operations/dgram_bind/replace_dgram_bind_urlbuilder.go deleted file mode 100644 index e36bd84e..00000000 --- a/operations/dgram_bind/replace_dgram_bind_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package dgram_bind - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceDgramBindURL generates an URL for the replace dgram bind operation -type ReplaceDgramBindURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDgramBindURL) WithBasePath(bp string) *ReplaceDgramBindURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceDgramBindURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceDgramBindURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceDgramBindURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceDgramBindURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceDgramBindURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceDgramBindURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceDgramBindURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceDgramBindURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceDgramBindURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceDgramBindURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_api_endpoints.go b/operations/discovery/get_api_endpoints.go deleted file mode 100644 index 117baf47..00000000 --- a/operations/discovery/get_api_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAPIEndpointsHandlerFunc turns a function with the right signature into a get API endpoints handler -type GetAPIEndpointsHandlerFunc func(GetAPIEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAPIEndpointsHandlerFunc) Handle(params GetAPIEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAPIEndpointsHandler interface for that can handle valid get API endpoints params -type GetAPIEndpointsHandler interface { - Handle(GetAPIEndpointsParams, interface{}) middleware.Responder -} - -// NewGetAPIEndpoints creates a new http.Handler for the get API endpoints operation -func NewGetAPIEndpoints(ctx *middleware.Context, handler GetAPIEndpointsHandler) *GetAPIEndpoints { - return &GetAPIEndpoints{Context: ctx, Handler: handler} -} - -/* - GetAPIEndpoints swagger:route GET / Discovery getApiEndpoints - -# Return list of root endpoints - -Returns a list of root endpoints. -*/ -type GetAPIEndpoints struct { - Context *middleware.Context - Handler GetAPIEndpointsHandler -} - -func (o *GetAPIEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAPIEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_api_endpoints_parameters.go b/operations/discovery/get_api_endpoints_parameters.go deleted file mode 100644 index c5f9f3f0..00000000 --- a/operations/discovery/get_api_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAPIEndpointsParams creates a new GetAPIEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetAPIEndpointsParams() GetAPIEndpointsParams { - - return GetAPIEndpointsParams{} -} - -// GetAPIEndpointsParams contains all the bound params for the get API endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAPIEndpoints -type GetAPIEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAPIEndpointsParams() beforehand. -func (o *GetAPIEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_api_endpoints_responses.go b/operations/discovery/get_api_endpoints_responses.go deleted file mode 100644 index ed226ca5..00000000 --- a/operations/discovery/get_api_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAPIEndpointsOKCode is the HTTP code returned for type GetAPIEndpointsOK -const GetAPIEndpointsOKCode int = 200 - -/* -GetAPIEndpointsOK Success - -swagger:response getApiEndpointsOK -*/ -type GetAPIEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetAPIEndpointsOK creates GetAPIEndpointsOK with default headers values -func NewGetAPIEndpointsOK() *GetAPIEndpointsOK { - - return &GetAPIEndpointsOK{} -} - -// WithPayload adds the payload to the get Api endpoints o k response -func (o *GetAPIEndpointsOK) WithPayload(payload models.Endpoints) *GetAPIEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Api endpoints o k response -func (o *GetAPIEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAPIEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAPIEndpointsDefault General Error - -swagger:response getApiEndpointsDefault -*/ -type GetAPIEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAPIEndpointsDefault creates GetAPIEndpointsDefault with default headers values -func NewGetAPIEndpointsDefault(code int) *GetAPIEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetAPIEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get API endpoints default response -func (o *GetAPIEndpointsDefault) WithStatusCode(code int) *GetAPIEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get API endpoints default response -func (o *GetAPIEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get API endpoints default response -func (o *GetAPIEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetAPIEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get API endpoints default response -func (o *GetAPIEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get API endpoints default response -func (o *GetAPIEndpointsDefault) WithPayload(payload *models.Error) *GetAPIEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get API endpoints default response -func (o *GetAPIEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAPIEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_api_endpoints_urlbuilder.go b/operations/discovery/get_api_endpoints_urlbuilder.go deleted file mode 100644 index 8eb7185d..00000000 --- a/operations/discovery/get_api_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAPIEndpointsURL generates an URL for the get API endpoints operation -type GetAPIEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAPIEndpointsURL) WithBasePath(bp string) *GetAPIEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAPIEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAPIEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAPIEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAPIEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAPIEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAPIEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAPIEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAPIEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_configuration_endpoints.go b/operations/discovery/get_configuration_endpoints.go deleted file mode 100644 index c42a7ea9..00000000 --- a/operations/discovery/get_configuration_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetConfigurationEndpointsHandlerFunc turns a function with the right signature into a get configuration endpoints handler -type GetConfigurationEndpointsHandlerFunc func(GetConfigurationEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetConfigurationEndpointsHandlerFunc) Handle(params GetConfigurationEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetConfigurationEndpointsHandler interface for that can handle valid get configuration endpoints params -type GetConfigurationEndpointsHandler interface { - Handle(GetConfigurationEndpointsParams, interface{}) middleware.Responder -} - -// NewGetConfigurationEndpoints creates a new http.Handler for the get configuration endpoints operation -func NewGetConfigurationEndpoints(ctx *middleware.Context, handler GetConfigurationEndpointsHandler) *GetConfigurationEndpoints { - return &GetConfigurationEndpoints{Context: ctx, Handler: handler} -} - -/* - GetConfigurationEndpoints swagger:route GET /services/haproxy/configuration Discovery getConfigurationEndpoints - -# Return list of HAProxy advanced configuration endpoints - -Returns a list of endpoints to be used for advanced configuration of HAProxy objects. -*/ -type GetConfigurationEndpoints struct { - Context *middleware.Context - Handler GetConfigurationEndpointsHandler -} - -func (o *GetConfigurationEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetConfigurationEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_configuration_endpoints_parameters.go b/operations/discovery/get_configuration_endpoints_parameters.go deleted file mode 100644 index 2b0231fd..00000000 --- a/operations/discovery/get_configuration_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetConfigurationEndpointsParams creates a new GetConfigurationEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetConfigurationEndpointsParams() GetConfigurationEndpointsParams { - - return GetConfigurationEndpointsParams{} -} - -// GetConfigurationEndpointsParams contains all the bound params for the get configuration endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getConfigurationEndpoints -type GetConfigurationEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetConfigurationEndpointsParams() beforehand. -func (o *GetConfigurationEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_configuration_endpoints_responses.go b/operations/discovery/get_configuration_endpoints_responses.go deleted file mode 100644 index be13edba..00000000 --- a/operations/discovery/get_configuration_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetConfigurationEndpointsOKCode is the HTTP code returned for type GetConfigurationEndpointsOK -const GetConfigurationEndpointsOKCode int = 200 - -/* -GetConfigurationEndpointsOK Success - -swagger:response getConfigurationEndpointsOK -*/ -type GetConfigurationEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetConfigurationEndpointsOK creates GetConfigurationEndpointsOK with default headers values -func NewGetConfigurationEndpointsOK() *GetConfigurationEndpointsOK { - - return &GetConfigurationEndpointsOK{} -} - -// WithPayload adds the payload to the get configuration endpoints o k response -func (o *GetConfigurationEndpointsOK) WithPayload(payload models.Endpoints) *GetConfigurationEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration endpoints o k response -func (o *GetConfigurationEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetConfigurationEndpointsDefault General Error - -swagger:response getConfigurationEndpointsDefault -*/ -type GetConfigurationEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConfigurationEndpointsDefault creates GetConfigurationEndpointsDefault with default headers values -func NewGetConfigurationEndpointsDefault(code int) *GetConfigurationEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetConfigurationEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) WithStatusCode(code int) *GetConfigurationEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetConfigurationEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) WithPayload(payload *models.Error) *GetConfigurationEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration endpoints default response -func (o *GetConfigurationEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_configuration_endpoints_urlbuilder.go b/operations/discovery/get_configuration_endpoints_urlbuilder.go deleted file mode 100644 index 4791a8fc..00000000 --- a/operations/discovery/get_configuration_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetConfigurationEndpointsURL generates an URL for the get configuration endpoints operation -type GetConfigurationEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConfigurationEndpointsURL) WithBasePath(bp string) *GetConfigurationEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConfigurationEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetConfigurationEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetConfigurationEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetConfigurationEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetConfigurationEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetConfigurationEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetConfigurationEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetConfigurationEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_haproxy_endpoints.go b/operations/discovery/get_haproxy_endpoints.go deleted file mode 100644 index 390df601..00000000 --- a/operations/discovery/get_haproxy_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHaproxyEndpointsHandlerFunc turns a function with the right signature into a get haproxy endpoints handler -type GetHaproxyEndpointsHandlerFunc func(GetHaproxyEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHaproxyEndpointsHandlerFunc) Handle(params GetHaproxyEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHaproxyEndpointsHandler interface for that can handle valid get haproxy endpoints params -type GetHaproxyEndpointsHandler interface { - Handle(GetHaproxyEndpointsParams, interface{}) middleware.Responder -} - -// NewGetHaproxyEndpoints creates a new http.Handler for the get haproxy endpoints operation -func NewGetHaproxyEndpoints(ctx *middleware.Context, handler GetHaproxyEndpointsHandler) *GetHaproxyEndpoints { - return &GetHaproxyEndpoints{Context: ctx, Handler: handler} -} - -/* - GetHaproxyEndpoints swagger:route GET /services/haproxy Discovery getHaproxyEndpoints - -# Return list of HAProxy related endpoints - -Returns a list of HAProxy related endpoints. -*/ -type GetHaproxyEndpoints struct { - Context *middleware.Context - Handler GetHaproxyEndpointsHandler -} - -func (o *GetHaproxyEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHaproxyEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_haproxy_endpoints_parameters.go b/operations/discovery/get_haproxy_endpoints_parameters.go deleted file mode 100644 index 0147ae1c..00000000 --- a/operations/discovery/get_haproxy_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetHaproxyEndpointsParams creates a new GetHaproxyEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetHaproxyEndpointsParams() GetHaproxyEndpointsParams { - - return GetHaproxyEndpointsParams{} -} - -// GetHaproxyEndpointsParams contains all the bound params for the get haproxy endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHaproxyEndpoints -type GetHaproxyEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHaproxyEndpointsParams() beforehand. -func (o *GetHaproxyEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_haproxy_endpoints_responses.go b/operations/discovery/get_haproxy_endpoints_responses.go deleted file mode 100644 index d499bb4c..00000000 --- a/operations/discovery/get_haproxy_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHaproxyEndpointsOKCode is the HTTP code returned for type GetHaproxyEndpointsOK -const GetHaproxyEndpointsOKCode int = 200 - -/* -GetHaproxyEndpointsOK Success - -swagger:response getHaproxyEndpointsOK -*/ -type GetHaproxyEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetHaproxyEndpointsOK creates GetHaproxyEndpointsOK with default headers values -func NewGetHaproxyEndpointsOK() *GetHaproxyEndpointsOK { - - return &GetHaproxyEndpointsOK{} -} - -// WithPayload adds the payload to the get haproxy endpoints o k response -func (o *GetHaproxyEndpointsOK) WithPayload(payload models.Endpoints) *GetHaproxyEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get haproxy endpoints o k response -func (o *GetHaproxyEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHaproxyEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetHaproxyEndpointsDefault General Error - -swagger:response getHaproxyEndpointsDefault -*/ -type GetHaproxyEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHaproxyEndpointsDefault creates GetHaproxyEndpointsDefault with default headers values -func NewGetHaproxyEndpointsDefault(code int) *GetHaproxyEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetHaproxyEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) WithStatusCode(code int) *GetHaproxyEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetHaproxyEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) WithPayload(payload *models.Error) *GetHaproxyEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get haproxy endpoints default response -func (o *GetHaproxyEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHaproxyEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_haproxy_endpoints_urlbuilder.go b/operations/discovery/get_haproxy_endpoints_urlbuilder.go deleted file mode 100644 index 1939b95a..00000000 --- a/operations/discovery/get_haproxy_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetHaproxyEndpointsURL generates an URL for the get haproxy endpoints operation -type GetHaproxyEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHaproxyEndpointsURL) WithBasePath(bp string) *GetHaproxyEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHaproxyEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHaproxyEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHaproxyEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHaproxyEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHaproxyEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHaproxyEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHaproxyEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHaproxyEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_runtime_endpoints.go b/operations/discovery/get_runtime_endpoints.go deleted file mode 100644 index 06d6abbf..00000000 --- a/operations/discovery/get_runtime_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetRuntimeEndpointsHandlerFunc turns a function with the right signature into a get runtime endpoints handler -type GetRuntimeEndpointsHandlerFunc func(GetRuntimeEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetRuntimeEndpointsHandlerFunc) Handle(params GetRuntimeEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetRuntimeEndpointsHandler interface for that can handle valid get runtime endpoints params -type GetRuntimeEndpointsHandler interface { - Handle(GetRuntimeEndpointsParams, interface{}) middleware.Responder -} - -// NewGetRuntimeEndpoints creates a new http.Handler for the get runtime endpoints operation -func NewGetRuntimeEndpoints(ctx *middleware.Context, handler GetRuntimeEndpointsHandler) *GetRuntimeEndpoints { - return &GetRuntimeEndpoints{Context: ctx, Handler: handler} -} - -/* - GetRuntimeEndpoints swagger:route GET /services/haproxy/runtime Discovery getRuntimeEndpoints - -# Return list of HAProxy advanced runtime endpoints - -Returns a list of endpoints to be used for advanced runtime settings of HAProxy objects. -*/ -type GetRuntimeEndpoints struct { - Context *middleware.Context - Handler GetRuntimeEndpointsHandler -} - -func (o *GetRuntimeEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetRuntimeEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_runtime_endpoints_parameters.go b/operations/discovery/get_runtime_endpoints_parameters.go deleted file mode 100644 index 15baaed8..00000000 --- a/operations/discovery/get_runtime_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetRuntimeEndpointsParams creates a new GetRuntimeEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetRuntimeEndpointsParams() GetRuntimeEndpointsParams { - - return GetRuntimeEndpointsParams{} -} - -// GetRuntimeEndpointsParams contains all the bound params for the get runtime endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getRuntimeEndpoints -type GetRuntimeEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetRuntimeEndpointsParams() beforehand. -func (o *GetRuntimeEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_runtime_endpoints_responses.go b/operations/discovery/get_runtime_endpoints_responses.go deleted file mode 100644 index 1c2c95f5..00000000 --- a/operations/discovery/get_runtime_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetRuntimeEndpointsOKCode is the HTTP code returned for type GetRuntimeEndpointsOK -const GetRuntimeEndpointsOKCode int = 200 - -/* -GetRuntimeEndpointsOK Success - -swagger:response getRuntimeEndpointsOK -*/ -type GetRuntimeEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetRuntimeEndpointsOK creates GetRuntimeEndpointsOK with default headers values -func NewGetRuntimeEndpointsOK() *GetRuntimeEndpointsOK { - - return &GetRuntimeEndpointsOK{} -} - -// WithPayload adds the payload to the get runtime endpoints o k response -func (o *GetRuntimeEndpointsOK) WithPayload(payload models.Endpoints) *GetRuntimeEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime endpoints o k response -func (o *GetRuntimeEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetRuntimeEndpointsDefault General Error - -swagger:response getRuntimeEndpointsDefault -*/ -type GetRuntimeEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRuntimeEndpointsDefault creates GetRuntimeEndpointsDefault with default headers values -func NewGetRuntimeEndpointsDefault(code int) *GetRuntimeEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetRuntimeEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) WithStatusCode(code int) *GetRuntimeEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetRuntimeEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) WithPayload(payload *models.Error) *GetRuntimeEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime endpoints default response -func (o *GetRuntimeEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_runtime_endpoints_urlbuilder.go b/operations/discovery/get_runtime_endpoints_urlbuilder.go deleted file mode 100644 index e5f0f245..00000000 --- a/operations/discovery/get_runtime_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetRuntimeEndpointsURL generates an URL for the get runtime endpoints operation -type GetRuntimeEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeEndpointsURL) WithBasePath(bp string) *GetRuntimeEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetRuntimeEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetRuntimeEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetRuntimeEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetRuntimeEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetRuntimeEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetRuntimeEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetRuntimeEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_services_endpoints.go b/operations/discovery/get_services_endpoints.go deleted file mode 100644 index cbd8f1b9..00000000 --- a/operations/discovery/get_services_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServicesEndpointsHandlerFunc turns a function with the right signature into a get services endpoints handler -type GetServicesEndpointsHandlerFunc func(GetServicesEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServicesEndpointsHandlerFunc) Handle(params GetServicesEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServicesEndpointsHandler interface for that can handle valid get services endpoints params -type GetServicesEndpointsHandler interface { - Handle(GetServicesEndpointsParams, interface{}) middleware.Responder -} - -// NewGetServicesEndpoints creates a new http.Handler for the get services endpoints operation -func NewGetServicesEndpoints(ctx *middleware.Context, handler GetServicesEndpointsHandler) *GetServicesEndpoints { - return &GetServicesEndpoints{Context: ctx, Handler: handler} -} - -/* - GetServicesEndpoints swagger:route GET /services Discovery getServicesEndpoints - -# Return list of service endpoints - -Returns a list of API managed services endpoints. -*/ -type GetServicesEndpoints struct { - Context *middleware.Context - Handler GetServicesEndpointsHandler -} - -func (o *GetServicesEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServicesEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_services_endpoints_parameters.go b/operations/discovery/get_services_endpoints_parameters.go deleted file mode 100644 index 8ac7f3ea..00000000 --- a/operations/discovery/get_services_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetServicesEndpointsParams creates a new GetServicesEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetServicesEndpointsParams() GetServicesEndpointsParams { - - return GetServicesEndpointsParams{} -} - -// GetServicesEndpointsParams contains all the bound params for the get services endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServicesEndpoints -type GetServicesEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServicesEndpointsParams() beforehand. -func (o *GetServicesEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_services_endpoints_responses.go b/operations/discovery/get_services_endpoints_responses.go deleted file mode 100644 index e3f06036..00000000 --- a/operations/discovery/get_services_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServicesEndpointsOKCode is the HTTP code returned for type GetServicesEndpointsOK -const GetServicesEndpointsOKCode int = 200 - -/* -GetServicesEndpointsOK Success - -swagger:response getServicesEndpointsOK -*/ -type GetServicesEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetServicesEndpointsOK creates GetServicesEndpointsOK with default headers values -func NewGetServicesEndpointsOK() *GetServicesEndpointsOK { - - return &GetServicesEndpointsOK{} -} - -// WithPayload adds the payload to the get services endpoints o k response -func (o *GetServicesEndpointsOK) WithPayload(payload models.Endpoints) *GetServicesEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services endpoints o k response -func (o *GetServicesEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetServicesEndpointsDefault General Error - -swagger:response getServicesEndpointsDefault -*/ -type GetServicesEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServicesEndpointsDefault creates GetServicesEndpointsDefault with default headers values -func NewGetServicesEndpointsDefault(code int) *GetServicesEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetServicesEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get services endpoints default response -func (o *GetServicesEndpointsDefault) WithStatusCode(code int) *GetServicesEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get services endpoints default response -func (o *GetServicesEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get services endpoints default response -func (o *GetServicesEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetServicesEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get services endpoints default response -func (o *GetServicesEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get services endpoints default response -func (o *GetServicesEndpointsDefault) WithPayload(payload *models.Error) *GetServicesEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get services endpoints default response -func (o *GetServicesEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServicesEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_services_endpoints_urlbuilder.go b/operations/discovery/get_services_endpoints_urlbuilder.go deleted file mode 100644 index b9066f9a..00000000 --- a/operations/discovery/get_services_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetServicesEndpointsURL generates an URL for the get services endpoints operation -type GetServicesEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesEndpointsURL) WithBasePath(bp string) *GetServicesEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServicesEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServicesEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServicesEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServicesEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServicesEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServicesEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServicesEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServicesEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_spoe_endpoints.go b/operations/discovery/get_spoe_endpoints.go deleted file mode 100644 index 3164494e..00000000 --- a/operations/discovery/get_spoe_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeEndpointsHandlerFunc turns a function with the right signature into a get spoe endpoints handler -type GetSpoeEndpointsHandlerFunc func(GetSpoeEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeEndpointsHandlerFunc) Handle(params GetSpoeEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeEndpointsHandler interface for that can handle valid get spoe endpoints params -type GetSpoeEndpointsHandler interface { - Handle(GetSpoeEndpointsParams, interface{}) middleware.Responder -} - -// NewGetSpoeEndpoints creates a new http.Handler for the get spoe endpoints operation -func NewGetSpoeEndpoints(ctx *middleware.Context, handler GetSpoeEndpointsHandler) *GetSpoeEndpoints { - return &GetSpoeEndpoints{Context: ctx, Handler: handler} -} - -/* - GetSpoeEndpoints swagger:route GET /services/haproxy/spoe Discovery getSpoeEndpoints - -# Return list of HAProxy SPOE endpoints - -Returns a list of endpoints to be used for SPOE settings of HAProxy. -*/ -type GetSpoeEndpoints struct { - Context *middleware.Context - Handler GetSpoeEndpointsHandler -} - -func (o *GetSpoeEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_spoe_endpoints_parameters.go b/operations/discovery/get_spoe_endpoints_parameters.go deleted file mode 100644 index 85fb9fe6..00000000 --- a/operations/discovery/get_spoe_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetSpoeEndpointsParams creates a new GetSpoeEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetSpoeEndpointsParams() GetSpoeEndpointsParams { - - return GetSpoeEndpointsParams{} -} - -// GetSpoeEndpointsParams contains all the bound params for the get spoe endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeEndpoints -type GetSpoeEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeEndpointsParams() beforehand. -func (o *GetSpoeEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_spoe_endpoints_responses.go b/operations/discovery/get_spoe_endpoints_responses.go deleted file mode 100644 index 93249c5a..00000000 --- a/operations/discovery/get_spoe_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeEndpointsOKCode is the HTTP code returned for type GetSpoeEndpointsOK -const GetSpoeEndpointsOKCode int = 200 - -/* -GetSpoeEndpointsOK Success - -swagger:response getSpoeEndpointsOK -*/ -type GetSpoeEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetSpoeEndpointsOK creates GetSpoeEndpointsOK with default headers values -func NewGetSpoeEndpointsOK() *GetSpoeEndpointsOK { - - return &GetSpoeEndpointsOK{} -} - -// WithPayload adds the payload to the get spoe endpoints o k response -func (o *GetSpoeEndpointsOK) WithPayload(payload models.Endpoints) *GetSpoeEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe endpoints o k response -func (o *GetSpoeEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetSpoeEndpointsDefault General Error - -swagger:response getSpoeEndpointsDefault -*/ -type GetSpoeEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeEndpointsDefault creates GetSpoeEndpointsDefault with default headers values -func NewGetSpoeEndpointsDefault(code int) *GetSpoeEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) WithStatusCode(code int) *GetSpoeEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) WithPayload(payload *models.Error) *GetSpoeEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe endpoints default response -func (o *GetSpoeEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_spoe_endpoints_urlbuilder.go b/operations/discovery/get_spoe_endpoints_urlbuilder.go deleted file mode 100644 index 5f805734..00000000 --- a/operations/discovery/get_spoe_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetSpoeEndpointsURL generates an URL for the get spoe endpoints operation -type GetSpoeEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeEndpointsURL) WithBasePath(bp string) *GetSpoeEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_stats_endpoints.go b/operations/discovery/get_stats_endpoints.go deleted file mode 100644 index 4751b343..00000000 --- a/operations/discovery/get_stats_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStatsEndpointsHandlerFunc turns a function with the right signature into a get stats endpoints handler -type GetStatsEndpointsHandlerFunc func(GetStatsEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStatsEndpointsHandlerFunc) Handle(params GetStatsEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStatsEndpointsHandler interface for that can handle valid get stats endpoints params -type GetStatsEndpointsHandler interface { - Handle(GetStatsEndpointsParams, interface{}) middleware.Responder -} - -// NewGetStatsEndpoints creates a new http.Handler for the get stats endpoints operation -func NewGetStatsEndpoints(ctx *middleware.Context, handler GetStatsEndpointsHandler) *GetStatsEndpoints { - return &GetStatsEndpoints{Context: ctx, Handler: handler} -} - -/* - GetStatsEndpoints swagger:route GET /services/haproxy/stats Discovery getStatsEndpoints - -# Return list of HAProxy stats endpoints - -Returns a list of HAProxy stats endpoints. -*/ -type GetStatsEndpoints struct { - Context *middleware.Context - Handler GetStatsEndpointsHandler -} - -func (o *GetStatsEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStatsEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_stats_endpoints_parameters.go b/operations/discovery/get_stats_endpoints_parameters.go deleted file mode 100644 index d0d1a583..00000000 --- a/operations/discovery/get_stats_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetStatsEndpointsParams creates a new GetStatsEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetStatsEndpointsParams() GetStatsEndpointsParams { - - return GetStatsEndpointsParams{} -} - -// GetStatsEndpointsParams contains all the bound params for the get stats endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStatsEndpoints -type GetStatsEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStatsEndpointsParams() beforehand. -func (o *GetStatsEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_stats_endpoints_responses.go b/operations/discovery/get_stats_endpoints_responses.go deleted file mode 100644 index 2a6c2cf2..00000000 --- a/operations/discovery/get_stats_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStatsEndpointsOKCode is the HTTP code returned for type GetStatsEndpointsOK -const GetStatsEndpointsOKCode int = 200 - -/* -GetStatsEndpointsOK Success - -swagger:response getStatsEndpointsOK -*/ -type GetStatsEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetStatsEndpointsOK creates GetStatsEndpointsOK with default headers values -func NewGetStatsEndpointsOK() *GetStatsEndpointsOK { - - return &GetStatsEndpointsOK{} -} - -// WithPayload adds the payload to the get stats endpoints o k response -func (o *GetStatsEndpointsOK) WithPayload(payload models.Endpoints) *GetStatsEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stats endpoints o k response -func (o *GetStatsEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatsEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetStatsEndpointsDefault General Error - -swagger:response getStatsEndpointsDefault -*/ -type GetStatsEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStatsEndpointsDefault creates GetStatsEndpointsDefault with default headers values -func NewGetStatsEndpointsDefault(code int) *GetStatsEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetStatsEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) WithStatusCode(code int) *GetStatsEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetStatsEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) WithPayload(payload *models.Error) *GetStatsEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stats endpoints default response -func (o *GetStatsEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatsEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_stats_endpoints_urlbuilder.go b/operations/discovery/get_stats_endpoints_urlbuilder.go deleted file mode 100644 index 0cc2e4b8..00000000 --- a/operations/discovery/get_stats_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetStatsEndpointsURL generates an URL for the get stats endpoints operation -type GetStatsEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStatsEndpointsURL) WithBasePath(bp string) *GetStatsEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStatsEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStatsEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/stats" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStatsEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStatsEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStatsEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStatsEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStatsEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStatsEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/discovery/get_storage_endpoints.go b/operations/discovery/get_storage_endpoints.go deleted file mode 100644 index 2ce054a7..00000000 --- a/operations/discovery/get_storage_endpoints.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStorageEndpointsHandlerFunc turns a function with the right signature into a get storage endpoints handler -type GetStorageEndpointsHandlerFunc func(GetStorageEndpointsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStorageEndpointsHandlerFunc) Handle(params GetStorageEndpointsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStorageEndpointsHandler interface for that can handle valid get storage endpoints params -type GetStorageEndpointsHandler interface { - Handle(GetStorageEndpointsParams, interface{}) middleware.Responder -} - -// NewGetStorageEndpoints creates a new http.Handler for the get storage endpoints operation -func NewGetStorageEndpoints(ctx *middleware.Context, handler GetStorageEndpointsHandler) *GetStorageEndpoints { - return &GetStorageEndpoints{Context: ctx, Handler: handler} -} - -/* - GetStorageEndpoints swagger:route GET /services/haproxy/storage Discovery getStorageEndpoints - -# Return list of HAProxy storage endpoints - -Returns a list of endpoints that use HAProxy storage for persistency, e.g. maps, ssl certificates... -*/ -type GetStorageEndpoints struct { - Context *middleware.Context - Handler GetStorageEndpointsHandler -} - -func (o *GetStorageEndpoints) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStorageEndpointsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/discovery/get_storage_endpoints_parameters.go b/operations/discovery/get_storage_endpoints_parameters.go deleted file mode 100644 index b021624a..00000000 --- a/operations/discovery/get_storage_endpoints_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetStorageEndpointsParams creates a new GetStorageEndpointsParams object -// -// There are no default values defined in the spec. -func NewGetStorageEndpointsParams() GetStorageEndpointsParams { - - return GetStorageEndpointsParams{} -} - -// GetStorageEndpointsParams contains all the bound params for the get storage endpoints operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStorageEndpoints -type GetStorageEndpointsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStorageEndpointsParams() beforehand. -func (o *GetStorageEndpointsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/discovery/get_storage_endpoints_responses.go b/operations/discovery/get_storage_endpoints_responses.go deleted file mode 100644 index ca13cf00..00000000 --- a/operations/discovery/get_storage_endpoints_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStorageEndpointsOKCode is the HTTP code returned for type GetStorageEndpointsOK -const GetStorageEndpointsOKCode int = 200 - -/* -GetStorageEndpointsOK Success - -swagger:response getStorageEndpointsOK -*/ -type GetStorageEndpointsOK struct { - - /* - In: Body - */ - Payload models.Endpoints `json:"body,omitempty"` -} - -// NewGetStorageEndpointsOK creates GetStorageEndpointsOK with default headers values -func NewGetStorageEndpointsOK() *GetStorageEndpointsOK { - - return &GetStorageEndpointsOK{} -} - -// WithPayload adds the payload to the get storage endpoints o k response -func (o *GetStorageEndpointsOK) WithPayload(payload models.Endpoints) *GetStorageEndpointsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get storage endpoints o k response -func (o *GetStorageEndpointsOK) SetPayload(payload models.Endpoints) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStorageEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Endpoints{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetStorageEndpointsDefault General Error - -swagger:response getStorageEndpointsDefault -*/ -type GetStorageEndpointsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStorageEndpointsDefault creates GetStorageEndpointsDefault with default headers values -func NewGetStorageEndpointsDefault(code int) *GetStorageEndpointsDefault { - if code <= 0 { - code = 500 - } - - return &GetStorageEndpointsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) WithStatusCode(code int) *GetStorageEndpointsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) WithConfigurationVersion(configurationVersion string) *GetStorageEndpointsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) WithPayload(payload *models.Error) *GetStorageEndpointsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get storage endpoints default response -func (o *GetStorageEndpointsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStorageEndpointsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/discovery/get_storage_endpoints_urlbuilder.go b/operations/discovery/get_storage_endpoints_urlbuilder.go deleted file mode 100644 index 8112dd05..00000000 --- a/operations/discovery/get_storage_endpoints_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetStorageEndpointsURL generates an URL for the get storage endpoints operation -type GetStorageEndpointsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStorageEndpointsURL) WithBasePath(bp string) *GetStorageEndpointsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStorageEndpointsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStorageEndpointsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStorageEndpointsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStorageEndpointsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStorageEndpointsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStorageEndpointsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStorageEndpointsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStorageEndpointsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/fcgi_app/create_fcgi_app.go b/operations/fcgi_app/create_fcgi_app.go deleted file mode 100644 index f0517a80..00000000 --- a/operations/fcgi_app/create_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateFCGIAppHandlerFunc turns a function with the right signature into a create FCGI app handler -type CreateFCGIAppHandlerFunc func(CreateFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateFCGIAppHandlerFunc) Handle(params CreateFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateFCGIAppHandler interface for that can handle valid create FCGI app params -type CreateFCGIAppHandler interface { - Handle(CreateFCGIAppParams, interface{}) middleware.Responder -} - -// NewCreateFCGIApp creates a new http.Handler for the create FCGI app operation -func NewCreateFCGIApp(ctx *middleware.Context, handler CreateFCGIAppHandler) *CreateFCGIApp { - return &CreateFCGIApp{Context: ctx, Handler: handler} -} - -/* - CreateFCGIApp swagger:route POST /services/haproxy/configuration/fcgi_apps FCGIApp createFcgiApp - -# Add an FCGI app - -Adds a new FCGI application to the configuration file. -*/ -type CreateFCGIApp struct { - Context *middleware.Context - Handler CreateFCGIAppHandler -} - -func (o *CreateFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/fcgi_app/create_fcgi_app_parameters.go b/operations/fcgi_app/create_fcgi_app_parameters.go deleted file mode 100644 index 5147e6a4..00000000 --- a/operations/fcgi_app/create_fcgi_app_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateFCGIAppParams creates a new CreateFCGIAppParams object -// with the default values initialized. -func NewCreateFCGIAppParams() CreateFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateFCGIAppParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateFCGIAppParams contains all the bound params for the create FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters createFCGIApp -type CreateFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.FCGIApp - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateFCGIAppParams() beforehand. -func (o *CreateFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.FCGIApp - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateFCGIAppParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/fcgi_app/create_fcgi_app_responses.go b/operations/fcgi_app/create_fcgi_app_responses.go deleted file mode 100644 index 6ad3f307..00000000 --- a/operations/fcgi_app/create_fcgi_app_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateFCGIAppCreatedCode is the HTTP code returned for type CreateFCGIAppCreated -const CreateFCGIAppCreatedCode int = 201 - -/* -CreateFCGIAppCreated Application created - -swagger:response createFcgiAppCreated -*/ -type CreateFCGIAppCreated struct { - - /* - In: Body - */ - Payload *models.FCGIApp `json:"body,omitempty"` -} - -// NewCreateFCGIAppCreated creates CreateFCGIAppCreated with default headers values -func NewCreateFCGIAppCreated() *CreateFCGIAppCreated { - - return &CreateFCGIAppCreated{} -} - -// WithPayload adds the payload to the create Fcgi app created response -func (o *CreateFCGIAppCreated) WithPayload(payload *models.FCGIApp) *CreateFCGIAppCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Fcgi app created response -func (o *CreateFCGIAppCreated) SetPayload(payload *models.FCGIApp) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFCGIAppCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFCGIAppAcceptedCode is the HTTP code returned for type CreateFCGIAppAccepted -const CreateFCGIAppAcceptedCode int = 202 - -/* -CreateFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response createFcgiAppAccepted -*/ -type CreateFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.FCGIApp `json:"body,omitempty"` -} - -// NewCreateFCGIAppAccepted creates CreateFCGIAppAccepted with default headers values -func NewCreateFCGIAppAccepted() *CreateFCGIAppAccepted { - - return &CreateFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the create Fcgi app accepted response -func (o *CreateFCGIAppAccepted) WithReloadID(reloadID string) *CreateFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Fcgi app accepted response -func (o *CreateFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Fcgi app accepted response -func (o *CreateFCGIAppAccepted) WithPayload(payload *models.FCGIApp) *CreateFCGIAppAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Fcgi app accepted response -func (o *CreateFCGIAppAccepted) SetPayload(payload *models.FCGIApp) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFCGIAppBadRequestCode is the HTTP code returned for type CreateFCGIAppBadRequest -const CreateFCGIAppBadRequestCode int = 400 - -/* -CreateFCGIAppBadRequest Bad request - -swagger:response createFcgiAppBadRequest -*/ -type CreateFCGIAppBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFCGIAppBadRequest creates CreateFCGIAppBadRequest with default headers values -func NewCreateFCGIAppBadRequest() *CreateFCGIAppBadRequest { - - return &CreateFCGIAppBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Fcgi app bad request response -func (o *CreateFCGIAppBadRequest) WithConfigurationVersion(configurationVersion string) *CreateFCGIAppBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Fcgi app bad request response -func (o *CreateFCGIAppBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Fcgi app bad request response -func (o *CreateFCGIAppBadRequest) WithPayload(payload *models.Error) *CreateFCGIAppBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Fcgi app bad request response -func (o *CreateFCGIAppBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFCGIAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFCGIAppConflictCode is the HTTP code returned for type CreateFCGIAppConflict -const CreateFCGIAppConflictCode int = 409 - -/* -CreateFCGIAppConflict The specified resource already exists - -swagger:response createFcgiAppConflict -*/ -type CreateFCGIAppConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFCGIAppConflict creates CreateFCGIAppConflict with default headers values -func NewCreateFCGIAppConflict() *CreateFCGIAppConflict { - - return &CreateFCGIAppConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Fcgi app conflict response -func (o *CreateFCGIAppConflict) WithConfigurationVersion(configurationVersion string) *CreateFCGIAppConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Fcgi app conflict response -func (o *CreateFCGIAppConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Fcgi app conflict response -func (o *CreateFCGIAppConflict) WithPayload(payload *models.Error) *CreateFCGIAppConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Fcgi app conflict response -func (o *CreateFCGIAppConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFCGIAppConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateFCGIAppDefault General Error - -swagger:response createFcgiAppDefault -*/ -type CreateFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFCGIAppDefault creates CreateFCGIAppDefault with default headers values -func NewCreateFCGIAppDefault(code int) *CreateFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &CreateFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create FCGI app default response -func (o *CreateFCGIAppDefault) WithStatusCode(code int) *CreateFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create FCGI app default response -func (o *CreateFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create FCGI app default response -func (o *CreateFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *CreateFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create FCGI app default response -func (o *CreateFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create FCGI app default response -func (o *CreateFCGIAppDefault) WithPayload(payload *models.Error) *CreateFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create FCGI app default response -func (o *CreateFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/fcgi_app/create_fcgi_app_urlbuilder.go b/operations/fcgi_app/create_fcgi_app_urlbuilder.go deleted file mode 100644 index bdf719eb..00000000 --- a/operations/fcgi_app/create_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateFCGIAppURL generates an URL for the create FCGI app operation -type CreateFCGIAppURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFCGIAppURL) WithBasePath(bp string) *CreateFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/fcgi_app/delete_fcgi_app.go b/operations/fcgi_app/delete_fcgi_app.go deleted file mode 100644 index 40f54672..00000000 --- a/operations/fcgi_app/delete_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteFCGIAppHandlerFunc turns a function with the right signature into a delete FCGI app handler -type DeleteFCGIAppHandlerFunc func(DeleteFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteFCGIAppHandlerFunc) Handle(params DeleteFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteFCGIAppHandler interface for that can handle valid delete FCGI app params -type DeleteFCGIAppHandler interface { - Handle(DeleteFCGIAppParams, interface{}) middleware.Responder -} - -// NewDeleteFCGIApp creates a new http.Handler for the delete FCGI app operation -func NewDeleteFCGIApp(ctx *middleware.Context, handler DeleteFCGIAppHandler) *DeleteFCGIApp { - return &DeleteFCGIApp{Context: ctx, Handler: handler} -} - -/* - DeleteFCGIApp swagger:route DELETE /services/haproxy/configuration/fcgi_apps/{name} FCGIApp deleteFcgiApp - -# Delete an FCGI app - -Deletes an FCGI application from the configuration by its name. -*/ -type DeleteFCGIApp struct { - Context *middleware.Context - Handler DeleteFCGIAppHandler -} - -func (o *DeleteFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/fcgi_app/delete_fcgi_app_parameters.go b/operations/fcgi_app/delete_fcgi_app_parameters.go deleted file mode 100644 index 035598f3..00000000 --- a/operations/fcgi_app/delete_fcgi_app_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteFCGIAppParams creates a new DeleteFCGIAppParams object -// with the default values initialized. -func NewDeleteFCGIAppParams() DeleteFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteFCGIAppParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteFCGIAppParams contains all the bound params for the delete FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteFCGIApp -type DeleteFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Application name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteFCGIAppParams() beforehand. -func (o *DeleteFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteFCGIAppParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/fcgi_app/delete_fcgi_app_responses.go b/operations/fcgi_app/delete_fcgi_app_responses.go deleted file mode 100644 index ead0a628..00000000 --- a/operations/fcgi_app/delete_fcgi_app_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteFCGIAppAcceptedCode is the HTTP code returned for type DeleteFCGIAppAccepted -const DeleteFCGIAppAcceptedCode int = 202 - -/* -DeleteFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response deleteFcgiAppAccepted -*/ -type DeleteFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteFCGIAppAccepted creates DeleteFCGIAppAccepted with default headers values -func NewDeleteFCGIAppAccepted() *DeleteFCGIAppAccepted { - - return &DeleteFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the delete Fcgi app accepted response -func (o *DeleteFCGIAppAccepted) WithReloadID(reloadID string) *DeleteFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Fcgi app accepted response -func (o *DeleteFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteFCGIAppNoContentCode is the HTTP code returned for type DeleteFCGIAppNoContent -const DeleteFCGIAppNoContentCode int = 204 - -/* -DeleteFCGIAppNoContent Application deleted - -swagger:response deleteFcgiAppNoContent -*/ -type DeleteFCGIAppNoContent struct { -} - -// NewDeleteFCGIAppNoContent creates DeleteFCGIAppNoContent with default headers values -func NewDeleteFCGIAppNoContent() *DeleteFCGIAppNoContent { - - return &DeleteFCGIAppNoContent{} -} - -// WriteResponse to the client -func (o *DeleteFCGIAppNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteFCGIAppNotFoundCode is the HTTP code returned for type DeleteFCGIAppNotFound -const DeleteFCGIAppNotFoundCode int = 404 - -/* -DeleteFCGIAppNotFound The specified resource was not found - -swagger:response deleteFcgiAppNotFound -*/ -type DeleteFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFCGIAppNotFound creates DeleteFCGIAppNotFound with default headers values -func NewDeleteFCGIAppNotFound() *DeleteFCGIAppNotFound { - - return &DeleteFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Fcgi app not found response -func (o *DeleteFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *DeleteFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Fcgi app not found response -func (o *DeleteFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Fcgi app not found response -func (o *DeleteFCGIAppNotFound) WithPayload(payload *models.Error) *DeleteFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Fcgi app not found response -func (o *DeleteFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteFCGIAppDefault General Error - -swagger:response deleteFcgiAppDefault -*/ -type DeleteFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFCGIAppDefault creates DeleteFCGIAppDefault with default headers values -func NewDeleteFCGIAppDefault(code int) *DeleteFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &DeleteFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) WithStatusCode(code int) *DeleteFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *DeleteFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) WithPayload(payload *models.Error) *DeleteFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete FCGI app default response -func (o *DeleteFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/fcgi_app/delete_fcgi_app_urlbuilder.go b/operations/fcgi_app/delete_fcgi_app_urlbuilder.go deleted file mode 100644 index 1ac44748..00000000 --- a/operations/fcgi_app/delete_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteFCGIAppURL generates an URL for the delete FCGI app operation -type DeleteFCGIAppURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFCGIAppURL) WithBasePath(bp string) *DeleteFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/fcgi_app/get_fcgi_app.go b/operations/fcgi_app/get_fcgi_app.go deleted file mode 100644 index 0c0a4101..00000000 --- a/operations/fcgi_app/get_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFCGIAppHandlerFunc turns a function with the right signature into a get FCGI app handler -type GetFCGIAppHandlerFunc func(GetFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFCGIAppHandlerFunc) Handle(params GetFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFCGIAppHandler interface for that can handle valid get FCGI app params -type GetFCGIAppHandler interface { - Handle(GetFCGIAppParams, interface{}) middleware.Responder -} - -// NewGetFCGIApp creates a new http.Handler for the get FCGI app operation -func NewGetFCGIApp(ctx *middleware.Context, handler GetFCGIAppHandler) *GetFCGIApp { - return &GetFCGIApp{Context: ctx, Handler: handler} -} - -/* - GetFCGIApp swagger:route GET /services/haproxy/configuration/fcgi_apps/{name} FCGIApp getFcgiApp - -# Return a FCGI app - -Returns one FCGI application configuration by its name. -*/ -type GetFCGIApp struct { - Context *middleware.Context - Handler GetFCGIAppHandler -} - -func (o *GetFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/fcgi_app/get_fcgi_app_parameters.go b/operations/fcgi_app/get_fcgi_app_parameters.go deleted file mode 100644 index e04470f3..00000000 --- a/operations/fcgi_app/get_fcgi_app_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFCGIAppParams creates a new GetFCGIAppParams object -// with the default values initialized. -func NewGetFCGIAppParams() GetFCGIAppParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetFCGIAppParams{ - FullSection: &fullSectionDefault, - } -} - -// GetFCGIAppParams contains all the bound params for the get FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFCGIApp -type GetFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Application name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFCGIAppParams() beforehand. -func (o *GetFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetFCGIAppParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetFCGIAppParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/fcgi_app/get_fcgi_app_responses.go b/operations/fcgi_app/get_fcgi_app_responses.go deleted file mode 100644 index ff276a56..00000000 --- a/operations/fcgi_app/get_fcgi_app_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFCGIAppOKCode is the HTTP code returned for type GetFCGIAppOK -const GetFCGIAppOKCode int = 200 - -/* -GetFCGIAppOK Successful operation - -swagger:response getFcgiAppOK -*/ -type GetFCGIAppOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.FCGIApp `json:"body,omitempty"` -} - -// NewGetFCGIAppOK creates GetFCGIAppOK with default headers values -func NewGetFCGIAppOK() *GetFCGIAppOK { - - return &GetFCGIAppOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Fcgi app o k response -func (o *GetFCGIAppOK) WithConfigurationVersion(configurationVersion string) *GetFCGIAppOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Fcgi app o k response -func (o *GetFCGIAppOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Fcgi app o k response -func (o *GetFCGIAppOK) WithPayload(payload *models.FCGIApp) *GetFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Fcgi app o k response -func (o *GetFCGIAppOK) SetPayload(payload *models.FCGIApp) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetFCGIAppNotFoundCode is the HTTP code returned for type GetFCGIAppNotFound -const GetFCGIAppNotFoundCode int = 404 - -/* -GetFCGIAppNotFound The specified resource was not found - -swagger:response getFcgiAppNotFound -*/ -type GetFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFCGIAppNotFound creates GetFCGIAppNotFound with default headers values -func NewGetFCGIAppNotFound() *GetFCGIAppNotFound { - - return &GetFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Fcgi app not found response -func (o *GetFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *GetFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Fcgi app not found response -func (o *GetFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Fcgi app not found response -func (o *GetFCGIAppNotFound) WithPayload(payload *models.Error) *GetFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Fcgi app not found response -func (o *GetFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetFCGIAppDefault General Error - -swagger:response getFcgiAppDefault -*/ -type GetFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFCGIAppDefault creates GetFCGIAppDefault with default headers values -func NewGetFCGIAppDefault(code int) *GetFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &GetFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get FCGI app default response -func (o *GetFCGIAppDefault) WithStatusCode(code int) *GetFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get FCGI app default response -func (o *GetFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get FCGI app default response -func (o *GetFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *GetFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get FCGI app default response -func (o *GetFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get FCGI app default response -func (o *GetFCGIAppDefault) WithPayload(payload *models.Error) *GetFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get FCGI app default response -func (o *GetFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/fcgi_app/get_fcgi_app_urlbuilder.go b/operations/fcgi_app/get_fcgi_app_urlbuilder.go deleted file mode 100644 index c5eef7a5..00000000 --- a/operations/fcgi_app/get_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetFCGIAppURL generates an URL for the get FCGI app operation -type GetFCGIAppURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFCGIAppURL) WithBasePath(bp string) *GetFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/fcgi_app/get_fcgi_apps.go b/operations/fcgi_app/get_fcgi_apps.go deleted file mode 100644 index ada779c4..00000000 --- a/operations/fcgi_app/get_fcgi_apps.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFCGIAppsHandlerFunc turns a function with the right signature into a get FCGI apps handler -type GetFCGIAppsHandlerFunc func(GetFCGIAppsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFCGIAppsHandlerFunc) Handle(params GetFCGIAppsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFCGIAppsHandler interface for that can handle valid get FCGI apps params -type GetFCGIAppsHandler interface { - Handle(GetFCGIAppsParams, interface{}) middleware.Responder -} - -// NewGetFCGIApps creates a new http.Handler for the get FCGI apps operation -func NewGetFCGIApps(ctx *middleware.Context, handler GetFCGIAppsHandler) *GetFCGIApps { - return &GetFCGIApps{Context: ctx, Handler: handler} -} - -/* - GetFCGIApps swagger:route GET /services/haproxy/configuration/fcgi_apps FCGIApp getFcgiApps - -# Return an array of FCGI apps - -Returns an array of all configured FCGI applications. -*/ -type GetFCGIApps struct { - Context *middleware.Context - Handler GetFCGIAppsHandler -} - -func (o *GetFCGIApps) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFCGIAppsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/fcgi_app/get_fcgi_apps_parameters.go b/operations/fcgi_app/get_fcgi_apps_parameters.go deleted file mode 100644 index f3f88f39..00000000 --- a/operations/fcgi_app/get_fcgi_apps_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFCGIAppsParams creates a new GetFCGIAppsParams object -// with the default values initialized. -func NewGetFCGIAppsParams() GetFCGIAppsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetFCGIAppsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetFCGIAppsParams contains all the bound params for the get FCGI apps operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFCGIApps -type GetFCGIAppsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFCGIAppsParams() beforehand. -func (o *GetFCGIAppsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetFCGIAppsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetFCGIAppsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFCGIAppsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/fcgi_app/get_fcgi_apps_responses.go b/operations/fcgi_app/get_fcgi_apps_responses.go deleted file mode 100644 index 18ed9ac2..00000000 --- a/operations/fcgi_app/get_fcgi_apps_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFCGIAppsOKCode is the HTTP code returned for type GetFCGIAppsOK -const GetFCGIAppsOKCode int = 200 - -/* -GetFCGIAppsOK Successful operation - -swagger:response getFcgiAppsOK -*/ -type GetFCGIAppsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.FCGIApps `json:"body,omitempty"` -} - -// NewGetFCGIAppsOK creates GetFCGIAppsOK with default headers values -func NewGetFCGIAppsOK() *GetFCGIAppsOK { - - return &GetFCGIAppsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Fcgi apps o k response -func (o *GetFCGIAppsOK) WithConfigurationVersion(configurationVersion string) *GetFCGIAppsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Fcgi apps o k response -func (o *GetFCGIAppsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Fcgi apps o k response -func (o *GetFCGIAppsOK) WithPayload(payload models.FCGIApps) *GetFCGIAppsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Fcgi apps o k response -func (o *GetFCGIAppsOK) SetPayload(payload models.FCGIApps) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFCGIAppsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.FCGIApps{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetFCGIAppsDefault General Error - -swagger:response getFcgiAppsDefault -*/ -type GetFCGIAppsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFCGIAppsDefault creates GetFCGIAppsDefault with default headers values -func NewGetFCGIAppsDefault(code int) *GetFCGIAppsDefault { - if code <= 0 { - code = 500 - } - - return &GetFCGIAppsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get FCGI apps default response -func (o *GetFCGIAppsDefault) WithStatusCode(code int) *GetFCGIAppsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get FCGI apps default response -func (o *GetFCGIAppsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get FCGI apps default response -func (o *GetFCGIAppsDefault) WithConfigurationVersion(configurationVersion string) *GetFCGIAppsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get FCGI apps default response -func (o *GetFCGIAppsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get FCGI apps default response -func (o *GetFCGIAppsDefault) WithPayload(payload *models.Error) *GetFCGIAppsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get FCGI apps default response -func (o *GetFCGIAppsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFCGIAppsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/fcgi_app/get_fcgi_apps_urlbuilder.go b/operations/fcgi_app/get_fcgi_apps_urlbuilder.go deleted file mode 100644 index 95afd49b..00000000 --- a/operations/fcgi_app/get_fcgi_apps_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetFCGIAppsURL generates an URL for the get FCGI apps operation -type GetFCGIAppsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFCGIAppsURL) WithBasePath(bp string) *GetFCGIAppsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFCGIAppsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFCGIAppsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFCGIAppsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFCGIAppsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFCGIAppsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFCGIAppsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFCGIAppsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFCGIAppsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/fcgi_app/replace_fcgi_app.go b/operations/fcgi_app/replace_fcgi_app.go deleted file mode 100644 index d93bd787..00000000 --- a/operations/fcgi_app/replace_fcgi_app.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceFCGIAppHandlerFunc turns a function with the right signature into a replace FCGI app handler -type ReplaceFCGIAppHandlerFunc func(ReplaceFCGIAppParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceFCGIAppHandlerFunc) Handle(params ReplaceFCGIAppParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceFCGIAppHandler interface for that can handle valid replace FCGI app params -type ReplaceFCGIAppHandler interface { - Handle(ReplaceFCGIAppParams, interface{}) middleware.Responder -} - -// NewReplaceFCGIApp creates a new http.Handler for the replace FCGI app operation -func NewReplaceFCGIApp(ctx *middleware.Context, handler ReplaceFCGIAppHandler) *ReplaceFCGIApp { - return &ReplaceFCGIApp{Context: ctx, Handler: handler} -} - -/* - ReplaceFCGIApp swagger:route PUT /services/haproxy/configuration/fcgi_apps/{name} FCGIApp replaceFcgiApp - -# Replace a FCGI app - -Replaces a FCGI application configuration by its name. -*/ -type ReplaceFCGIApp struct { - Context *middleware.Context - Handler ReplaceFCGIAppHandler -} - -func (o *ReplaceFCGIApp) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceFCGIAppParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/fcgi_app/replace_fcgi_app_parameters.go b/operations/fcgi_app/replace_fcgi_app_parameters.go deleted file mode 100644 index a0b1896e..00000000 --- a/operations/fcgi_app/replace_fcgi_app_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceFCGIAppParams creates a new ReplaceFCGIAppParams object -// with the default values initialized. -func NewReplaceFCGIAppParams() ReplaceFCGIAppParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceFCGIAppParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceFCGIAppParams contains all the bound params for the replace FCGI app operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceFCGIApp -type ReplaceFCGIAppParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.FCGIApp - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Application name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceFCGIAppParams() beforehand. -func (o *ReplaceFCGIAppParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.FCGIApp - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceFCGIAppParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceFCGIAppParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFCGIAppParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceFCGIAppParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceFCGIAppParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceFCGIAppParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/fcgi_app/replace_fcgi_app_responses.go b/operations/fcgi_app/replace_fcgi_app_responses.go deleted file mode 100644 index 3f62ff5a..00000000 --- a/operations/fcgi_app/replace_fcgi_app_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceFCGIAppOKCode is the HTTP code returned for type ReplaceFCGIAppOK -const ReplaceFCGIAppOKCode int = 200 - -/* -ReplaceFCGIAppOK Application replaced - -swagger:response replaceFcgiAppOK -*/ -type ReplaceFCGIAppOK struct { - - /* - In: Body - */ - Payload *models.FCGIApp `json:"body,omitempty"` -} - -// NewReplaceFCGIAppOK creates ReplaceFCGIAppOK with default headers values -func NewReplaceFCGIAppOK() *ReplaceFCGIAppOK { - - return &ReplaceFCGIAppOK{} -} - -// WithPayload adds the payload to the replace Fcgi app o k response -func (o *ReplaceFCGIAppOK) WithPayload(payload *models.FCGIApp) *ReplaceFCGIAppOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Fcgi app o k response -func (o *ReplaceFCGIAppOK) SetPayload(payload *models.FCGIApp) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFCGIAppOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFCGIAppAcceptedCode is the HTTP code returned for type ReplaceFCGIAppAccepted -const ReplaceFCGIAppAcceptedCode int = 202 - -/* -ReplaceFCGIAppAccepted Configuration change accepted and reload requested - -swagger:response replaceFcgiAppAccepted -*/ -type ReplaceFCGIAppAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.FCGIApp `json:"body,omitempty"` -} - -// NewReplaceFCGIAppAccepted creates ReplaceFCGIAppAccepted with default headers values -func NewReplaceFCGIAppAccepted() *ReplaceFCGIAppAccepted { - - return &ReplaceFCGIAppAccepted{} -} - -// WithReloadID adds the reloadId to the replace Fcgi app accepted response -func (o *ReplaceFCGIAppAccepted) WithReloadID(reloadID string) *ReplaceFCGIAppAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Fcgi app accepted response -func (o *ReplaceFCGIAppAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Fcgi app accepted response -func (o *ReplaceFCGIAppAccepted) WithPayload(payload *models.FCGIApp) *ReplaceFCGIAppAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Fcgi app accepted response -func (o *ReplaceFCGIAppAccepted) SetPayload(payload *models.FCGIApp) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFCGIAppAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFCGIAppBadRequestCode is the HTTP code returned for type ReplaceFCGIAppBadRequest -const ReplaceFCGIAppBadRequestCode int = 400 - -/* -ReplaceFCGIAppBadRequest Bad request - -swagger:response replaceFcgiAppBadRequest -*/ -type ReplaceFCGIAppBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFCGIAppBadRequest creates ReplaceFCGIAppBadRequest with default headers values -func NewReplaceFCGIAppBadRequest() *ReplaceFCGIAppBadRequest { - - return &ReplaceFCGIAppBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Fcgi app bad request response -func (o *ReplaceFCGIAppBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceFCGIAppBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Fcgi app bad request response -func (o *ReplaceFCGIAppBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Fcgi app bad request response -func (o *ReplaceFCGIAppBadRequest) WithPayload(payload *models.Error) *ReplaceFCGIAppBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Fcgi app bad request response -func (o *ReplaceFCGIAppBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFCGIAppBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFCGIAppNotFoundCode is the HTTP code returned for type ReplaceFCGIAppNotFound -const ReplaceFCGIAppNotFoundCode int = 404 - -/* -ReplaceFCGIAppNotFound The specified resource was not found - -swagger:response replaceFcgiAppNotFound -*/ -type ReplaceFCGIAppNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFCGIAppNotFound creates ReplaceFCGIAppNotFound with default headers values -func NewReplaceFCGIAppNotFound() *ReplaceFCGIAppNotFound { - - return &ReplaceFCGIAppNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Fcgi app not found response -func (o *ReplaceFCGIAppNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceFCGIAppNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Fcgi app not found response -func (o *ReplaceFCGIAppNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Fcgi app not found response -func (o *ReplaceFCGIAppNotFound) WithPayload(payload *models.Error) *ReplaceFCGIAppNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Fcgi app not found response -func (o *ReplaceFCGIAppNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFCGIAppNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceFCGIAppDefault General Error - -swagger:response replaceFcgiAppDefault -*/ -type ReplaceFCGIAppDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFCGIAppDefault creates ReplaceFCGIAppDefault with default headers values -func NewReplaceFCGIAppDefault(code int) *ReplaceFCGIAppDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceFCGIAppDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) WithStatusCode(code int) *ReplaceFCGIAppDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) WithConfigurationVersion(configurationVersion string) *ReplaceFCGIAppDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) WithPayload(payload *models.Error) *ReplaceFCGIAppDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace FCGI app default response -func (o *ReplaceFCGIAppDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFCGIAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/fcgi_app/replace_fcgi_app_urlbuilder.go b/operations/fcgi_app/replace_fcgi_app_urlbuilder.go deleted file mode 100644 index 78a2e412..00000000 --- a/operations/fcgi_app/replace_fcgi_app_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package fcgi_app - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceFCGIAppURL generates an URL for the replace FCGI app operation -type ReplaceFCGIAppURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFCGIAppURL) WithBasePath(bp string) *ReplaceFCGIAppURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFCGIAppURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceFCGIAppURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/fcgi_apps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceFCGIAppURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceFCGIAppURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceFCGIAppURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceFCGIAppURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceFCGIAppURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceFCGIAppURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceFCGIAppURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/create_filter_backend.go b/operations/filter/create_filter_backend.go deleted file mode 100644 index adebc3fa..00000000 --- a/operations/filter/create_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateFilterBackendHandlerFunc turns a function with the right signature into a create filter backend handler -type CreateFilterBackendHandlerFunc func(CreateFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateFilterBackendHandlerFunc) Handle(params CreateFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateFilterBackendHandler interface for that can handle valid create filter backend params -type CreateFilterBackendHandler interface { - Handle(CreateFilterBackendParams, interface{}) middleware.Responder -} - -// NewCreateFilterBackend creates a new http.Handler for the create filter backend operation -func NewCreateFilterBackend(ctx *middleware.Context, handler CreateFilterBackendHandler) *CreateFilterBackend { - return &CreateFilterBackend{Context: ctx, Handler: handler} -} - -/* - CreateFilterBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/filters/{index} Filter createFilterBackend - -# Add a new Filter - -Adds a new Filter of the specified type in the specified parent. -*/ -type CreateFilterBackend struct { - Context *middleware.Context - Handler CreateFilterBackendHandler -} - -func (o *CreateFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/create_filter_backend_parameters.go b/operations/filter/create_filter_backend_parameters.go deleted file mode 100644 index 0e0f6d25..00000000 --- a/operations/filter/create_filter_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateFilterBackendParams creates a new CreateFilterBackendParams object -// with the default values initialized. -func NewCreateFilterBackendParams() CreateFilterBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateFilterBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateFilterBackendParams contains all the bound params for the create filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createFilterBackend -type CreateFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Filter - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateFilterBackendParams() beforehand. -func (o *CreateFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filter - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateFilterBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFilterBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateFilterBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateFilterBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/create_filter_backend_responses.go b/operations/filter/create_filter_backend_responses.go deleted file mode 100644 index ddf6426d..00000000 --- a/operations/filter/create_filter_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateFilterBackendCreatedCode is the HTTP code returned for type CreateFilterBackendCreated -const CreateFilterBackendCreatedCode int = 201 - -/* -CreateFilterBackendCreated Filter created - -swagger:response createFilterBackendCreated -*/ -type CreateFilterBackendCreated struct { - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewCreateFilterBackendCreated creates CreateFilterBackendCreated with default headers values -func NewCreateFilterBackendCreated() *CreateFilterBackendCreated { - - return &CreateFilterBackendCreated{} -} - -// WithPayload adds the payload to the create filter backend created response -func (o *CreateFilterBackendCreated) WithPayload(payload *models.Filter) *CreateFilterBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter backend created response -func (o *CreateFilterBackendCreated) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterBackendAcceptedCode is the HTTP code returned for type CreateFilterBackendAccepted -const CreateFilterBackendAcceptedCode int = 202 - -/* -CreateFilterBackendAccepted Configuration change accepted and reload requested - -swagger:response createFilterBackendAccepted -*/ -type CreateFilterBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewCreateFilterBackendAccepted creates CreateFilterBackendAccepted with default headers values -func NewCreateFilterBackendAccepted() *CreateFilterBackendAccepted { - - return &CreateFilterBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create filter backend accepted response -func (o *CreateFilterBackendAccepted) WithReloadID(reloadID string) *CreateFilterBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create filter backend accepted response -func (o *CreateFilterBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create filter backend accepted response -func (o *CreateFilterBackendAccepted) WithPayload(payload *models.Filter) *CreateFilterBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter backend accepted response -func (o *CreateFilterBackendAccepted) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterBackendBadRequestCode is the HTTP code returned for type CreateFilterBackendBadRequest -const CreateFilterBackendBadRequestCode int = 400 - -/* -CreateFilterBackendBadRequest Bad request - -swagger:response createFilterBackendBadRequest -*/ -type CreateFilterBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterBackendBadRequest creates CreateFilterBackendBadRequest with default headers values -func NewCreateFilterBackendBadRequest() *CreateFilterBackendBadRequest { - - return &CreateFilterBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create filter backend bad request response -func (o *CreateFilterBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateFilterBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter backend bad request response -func (o *CreateFilterBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter backend bad request response -func (o *CreateFilterBackendBadRequest) WithPayload(payload *models.Error) *CreateFilterBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter backend bad request response -func (o *CreateFilterBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterBackendConflictCode is the HTTP code returned for type CreateFilterBackendConflict -const CreateFilterBackendConflictCode int = 409 - -/* -CreateFilterBackendConflict The specified resource already exists - -swagger:response createFilterBackendConflict -*/ -type CreateFilterBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterBackendConflict creates CreateFilterBackendConflict with default headers values -func NewCreateFilterBackendConflict() *CreateFilterBackendConflict { - - return &CreateFilterBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create filter backend conflict response -func (o *CreateFilterBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateFilterBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter backend conflict response -func (o *CreateFilterBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter backend conflict response -func (o *CreateFilterBackendConflict) WithPayload(payload *models.Error) *CreateFilterBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter backend conflict response -func (o *CreateFilterBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateFilterBackendDefault General Error - -swagger:response createFilterBackendDefault -*/ -type CreateFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterBackendDefault creates CreateFilterBackendDefault with default headers values -func NewCreateFilterBackendDefault(code int) *CreateFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create filter backend default response -func (o *CreateFilterBackendDefault) WithStatusCode(code int) *CreateFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create filter backend default response -func (o *CreateFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create filter backend default response -func (o *CreateFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter backend default response -func (o *CreateFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter backend default response -func (o *CreateFilterBackendDefault) WithPayload(payload *models.Error) *CreateFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter backend default response -func (o *CreateFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/create_filter_backend_urlbuilder.go b/operations/filter/create_filter_backend_urlbuilder.go deleted file mode 100644 index f7cfbb93..00000000 --- a/operations/filter/create_filter_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateFilterBackendURL generates an URL for the create filter backend operation -type CreateFilterBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFilterBackendURL) WithBasePath(bp string) *CreateFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateFilterBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/create_filter_frontend.go b/operations/filter/create_filter_frontend.go deleted file mode 100644 index 7a707a4a..00000000 --- a/operations/filter/create_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateFilterFrontendHandlerFunc turns a function with the right signature into a create filter frontend handler -type CreateFilterFrontendHandlerFunc func(CreateFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateFilterFrontendHandlerFunc) Handle(params CreateFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateFilterFrontendHandler interface for that can handle valid create filter frontend params -type CreateFilterFrontendHandler interface { - Handle(CreateFilterFrontendParams, interface{}) middleware.Responder -} - -// NewCreateFilterFrontend creates a new http.Handler for the create filter frontend operation -func NewCreateFilterFrontend(ctx *middleware.Context, handler CreateFilterFrontendHandler) *CreateFilterFrontend { - return &CreateFilterFrontend{Context: ctx, Handler: handler} -} - -/* - CreateFilterFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/filters/{index} Filter createFilterFrontend - -# Add a new Filter - -Adds a new Filter of the specified type in the specified parent. -*/ -type CreateFilterFrontend struct { - Context *middleware.Context - Handler CreateFilterFrontendHandler -} - -func (o *CreateFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/create_filter_frontend_parameters.go b/operations/filter/create_filter_frontend_parameters.go deleted file mode 100644 index f81af086..00000000 --- a/operations/filter/create_filter_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateFilterFrontendParams creates a new CreateFilterFrontendParams object -// with the default values initialized. -func NewCreateFilterFrontendParams() CreateFilterFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateFilterFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateFilterFrontendParams contains all the bound params for the create filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createFilterFrontend -type CreateFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Filter - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateFilterFrontendParams() beforehand. -func (o *CreateFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filter - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateFilterFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFilterFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateFilterFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateFilterFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/create_filter_frontend_responses.go b/operations/filter/create_filter_frontend_responses.go deleted file mode 100644 index 5e21d253..00000000 --- a/operations/filter/create_filter_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateFilterFrontendCreatedCode is the HTTP code returned for type CreateFilterFrontendCreated -const CreateFilterFrontendCreatedCode int = 201 - -/* -CreateFilterFrontendCreated Filter created - -swagger:response createFilterFrontendCreated -*/ -type CreateFilterFrontendCreated struct { - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewCreateFilterFrontendCreated creates CreateFilterFrontendCreated with default headers values -func NewCreateFilterFrontendCreated() *CreateFilterFrontendCreated { - - return &CreateFilterFrontendCreated{} -} - -// WithPayload adds the payload to the create filter frontend created response -func (o *CreateFilterFrontendCreated) WithPayload(payload *models.Filter) *CreateFilterFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter frontend created response -func (o *CreateFilterFrontendCreated) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterFrontendAcceptedCode is the HTTP code returned for type CreateFilterFrontendAccepted -const CreateFilterFrontendAcceptedCode int = 202 - -/* -CreateFilterFrontendAccepted Configuration change accepted and reload requested - -swagger:response createFilterFrontendAccepted -*/ -type CreateFilterFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewCreateFilterFrontendAccepted creates CreateFilterFrontendAccepted with default headers values -func NewCreateFilterFrontendAccepted() *CreateFilterFrontendAccepted { - - return &CreateFilterFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create filter frontend accepted response -func (o *CreateFilterFrontendAccepted) WithReloadID(reloadID string) *CreateFilterFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create filter frontend accepted response -func (o *CreateFilterFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create filter frontend accepted response -func (o *CreateFilterFrontendAccepted) WithPayload(payload *models.Filter) *CreateFilterFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter frontend accepted response -func (o *CreateFilterFrontendAccepted) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterFrontendBadRequestCode is the HTTP code returned for type CreateFilterFrontendBadRequest -const CreateFilterFrontendBadRequestCode int = 400 - -/* -CreateFilterFrontendBadRequest Bad request - -swagger:response createFilterFrontendBadRequest -*/ -type CreateFilterFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterFrontendBadRequest creates CreateFilterFrontendBadRequest with default headers values -func NewCreateFilterFrontendBadRequest() *CreateFilterFrontendBadRequest { - - return &CreateFilterFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create filter frontend bad request response -func (o *CreateFilterFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateFilterFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter frontend bad request response -func (o *CreateFilterFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter frontend bad request response -func (o *CreateFilterFrontendBadRequest) WithPayload(payload *models.Error) *CreateFilterFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter frontend bad request response -func (o *CreateFilterFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFilterFrontendConflictCode is the HTTP code returned for type CreateFilterFrontendConflict -const CreateFilterFrontendConflictCode int = 409 - -/* -CreateFilterFrontendConflict The specified resource already exists - -swagger:response createFilterFrontendConflict -*/ -type CreateFilterFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterFrontendConflict creates CreateFilterFrontendConflict with default headers values -func NewCreateFilterFrontendConflict() *CreateFilterFrontendConflict { - - return &CreateFilterFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create filter frontend conflict response -func (o *CreateFilterFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateFilterFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter frontend conflict response -func (o *CreateFilterFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter frontend conflict response -func (o *CreateFilterFrontendConflict) WithPayload(payload *models.Error) *CreateFilterFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter frontend conflict response -func (o *CreateFilterFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateFilterFrontendDefault General Error - -swagger:response createFilterFrontendDefault -*/ -type CreateFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFilterFrontendDefault creates CreateFilterFrontendDefault with default headers values -func NewCreateFilterFrontendDefault(code int) *CreateFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create filter frontend default response -func (o *CreateFilterFrontendDefault) WithStatusCode(code int) *CreateFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create filter frontend default response -func (o *CreateFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create filter frontend default response -func (o *CreateFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create filter frontend default response -func (o *CreateFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create filter frontend default response -func (o *CreateFilterFrontendDefault) WithPayload(payload *models.Error) *CreateFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create filter frontend default response -func (o *CreateFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/create_filter_frontend_urlbuilder.go b/operations/filter/create_filter_frontend_urlbuilder.go deleted file mode 100644 index 5e0fdc3a..00000000 --- a/operations/filter/create_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateFilterFrontendURL generates an URL for the create filter frontend operation -type CreateFilterFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFilterFrontendURL) WithBasePath(bp string) *CreateFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateFilterFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/delete_filter_backend.go b/operations/filter/delete_filter_backend.go deleted file mode 100644 index c374c467..00000000 --- a/operations/filter/delete_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteFilterBackendHandlerFunc turns a function with the right signature into a delete filter backend handler -type DeleteFilterBackendHandlerFunc func(DeleteFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteFilterBackendHandlerFunc) Handle(params DeleteFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteFilterBackendHandler interface for that can handle valid delete filter backend params -type DeleteFilterBackendHandler interface { - Handle(DeleteFilterBackendParams, interface{}) middleware.Responder -} - -// NewDeleteFilterBackend creates a new http.Handler for the delete filter backend operation -func NewDeleteFilterBackend(ctx *middleware.Context, handler DeleteFilterBackendHandler) *DeleteFilterBackend { - return &DeleteFilterBackend{Context: ctx, Handler: handler} -} - -/* - DeleteFilterBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/filters/{index} Filter deleteFilterBackend - -# Delete a Filter - -Deletes a Filter configuration by it's index from the specified parent. -*/ -type DeleteFilterBackend struct { - Context *middleware.Context - Handler DeleteFilterBackendHandler -} - -func (o *DeleteFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/delete_filter_backend_parameters.go b/operations/filter/delete_filter_backend_parameters.go deleted file mode 100644 index 28e77f9d..00000000 --- a/operations/filter/delete_filter_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteFilterBackendParams creates a new DeleteFilterBackendParams object -// with the default values initialized. -func NewDeleteFilterBackendParams() DeleteFilterBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteFilterBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteFilterBackendParams contains all the bound params for the delete filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteFilterBackend -type DeleteFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteFilterBackendParams() beforehand. -func (o *DeleteFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteFilterBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteFilterBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteFilterBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteFilterBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/delete_filter_backend_responses.go b/operations/filter/delete_filter_backend_responses.go deleted file mode 100644 index 59ba86df..00000000 --- a/operations/filter/delete_filter_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteFilterBackendAcceptedCode is the HTTP code returned for type DeleteFilterBackendAccepted -const DeleteFilterBackendAcceptedCode int = 202 - -/* -DeleteFilterBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteFilterBackendAccepted -*/ -type DeleteFilterBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteFilterBackendAccepted creates DeleteFilterBackendAccepted with default headers values -func NewDeleteFilterBackendAccepted() *DeleteFilterBackendAccepted { - - return &DeleteFilterBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete filter backend accepted response -func (o *DeleteFilterBackendAccepted) WithReloadID(reloadID string) *DeleteFilterBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete filter backend accepted response -func (o *DeleteFilterBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteFilterBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteFilterBackendNoContentCode is the HTTP code returned for type DeleteFilterBackendNoContent -const DeleteFilterBackendNoContentCode int = 204 - -/* -DeleteFilterBackendNoContent Filter deleted - -swagger:response deleteFilterBackendNoContent -*/ -type DeleteFilterBackendNoContent struct { -} - -// NewDeleteFilterBackendNoContent creates DeleteFilterBackendNoContent with default headers values -func NewDeleteFilterBackendNoContent() *DeleteFilterBackendNoContent { - - return &DeleteFilterBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteFilterBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteFilterBackendNotFoundCode is the HTTP code returned for type DeleteFilterBackendNotFound -const DeleteFilterBackendNotFoundCode int = 404 - -/* -DeleteFilterBackendNotFound The specified resource was not found - -swagger:response deleteFilterBackendNotFound -*/ -type DeleteFilterBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFilterBackendNotFound creates DeleteFilterBackendNotFound with default headers values -func NewDeleteFilterBackendNotFound() *DeleteFilterBackendNotFound { - - return &DeleteFilterBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete filter backend not found response -func (o *DeleteFilterBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteFilterBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete filter backend not found response -func (o *DeleteFilterBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete filter backend not found response -func (o *DeleteFilterBackendNotFound) WithPayload(payload *models.Error) *DeleteFilterBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete filter backend not found response -func (o *DeleteFilterBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFilterBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteFilterBackendDefault General Error - -swagger:response deleteFilterBackendDefault -*/ -type DeleteFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFilterBackendDefault creates DeleteFilterBackendDefault with default headers values -func NewDeleteFilterBackendDefault(code int) *DeleteFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete filter backend default response -func (o *DeleteFilterBackendDefault) WithStatusCode(code int) *DeleteFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete filter backend default response -func (o *DeleteFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete filter backend default response -func (o *DeleteFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete filter backend default response -func (o *DeleteFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete filter backend default response -func (o *DeleteFilterBackendDefault) WithPayload(payload *models.Error) *DeleteFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete filter backend default response -func (o *DeleteFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/delete_filter_backend_urlbuilder.go b/operations/filter/delete_filter_backend_urlbuilder.go deleted file mode 100644 index 3bfdbd29..00000000 --- a/operations/filter/delete_filter_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteFilterBackendURL generates an URL for the delete filter backend operation -type DeleteFilterBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFilterBackendURL) WithBasePath(bp string) *DeleteFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteFilterBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/delete_filter_frontend.go b/operations/filter/delete_filter_frontend.go deleted file mode 100644 index 8eb89dc7..00000000 --- a/operations/filter/delete_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteFilterFrontendHandlerFunc turns a function with the right signature into a delete filter frontend handler -type DeleteFilterFrontendHandlerFunc func(DeleteFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteFilterFrontendHandlerFunc) Handle(params DeleteFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteFilterFrontendHandler interface for that can handle valid delete filter frontend params -type DeleteFilterFrontendHandler interface { - Handle(DeleteFilterFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteFilterFrontend creates a new http.Handler for the delete filter frontend operation -func NewDeleteFilterFrontend(ctx *middleware.Context, handler DeleteFilterFrontendHandler) *DeleteFilterFrontend { - return &DeleteFilterFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteFilterFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/filters/{index} Filter deleteFilterFrontend - -# Delete a Filter - -Deletes a Filter configuration by it's index from the specified parent. -*/ -type DeleteFilterFrontend struct { - Context *middleware.Context - Handler DeleteFilterFrontendHandler -} - -func (o *DeleteFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/delete_filter_frontend_parameters.go b/operations/filter/delete_filter_frontend_parameters.go deleted file mode 100644 index e7c9af9c..00000000 --- a/operations/filter/delete_filter_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteFilterFrontendParams creates a new DeleteFilterFrontendParams object -// with the default values initialized. -func NewDeleteFilterFrontendParams() DeleteFilterFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteFilterFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteFilterFrontendParams contains all the bound params for the delete filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteFilterFrontend -type DeleteFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteFilterFrontendParams() beforehand. -func (o *DeleteFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteFilterFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteFilterFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteFilterFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteFilterFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/delete_filter_frontend_responses.go b/operations/filter/delete_filter_frontend_responses.go deleted file mode 100644 index 9316c107..00000000 --- a/operations/filter/delete_filter_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteFilterFrontendAcceptedCode is the HTTP code returned for type DeleteFilterFrontendAccepted -const DeleteFilterFrontendAcceptedCode int = 202 - -/* -DeleteFilterFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteFilterFrontendAccepted -*/ -type DeleteFilterFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteFilterFrontendAccepted creates DeleteFilterFrontendAccepted with default headers values -func NewDeleteFilterFrontendAccepted() *DeleteFilterFrontendAccepted { - - return &DeleteFilterFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete filter frontend accepted response -func (o *DeleteFilterFrontendAccepted) WithReloadID(reloadID string) *DeleteFilterFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete filter frontend accepted response -func (o *DeleteFilterFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteFilterFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteFilterFrontendNoContentCode is the HTTP code returned for type DeleteFilterFrontendNoContent -const DeleteFilterFrontendNoContentCode int = 204 - -/* -DeleteFilterFrontendNoContent Filter deleted - -swagger:response deleteFilterFrontendNoContent -*/ -type DeleteFilterFrontendNoContent struct { -} - -// NewDeleteFilterFrontendNoContent creates DeleteFilterFrontendNoContent with default headers values -func NewDeleteFilterFrontendNoContent() *DeleteFilterFrontendNoContent { - - return &DeleteFilterFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteFilterFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteFilterFrontendNotFoundCode is the HTTP code returned for type DeleteFilterFrontendNotFound -const DeleteFilterFrontendNotFoundCode int = 404 - -/* -DeleteFilterFrontendNotFound The specified resource was not found - -swagger:response deleteFilterFrontendNotFound -*/ -type DeleteFilterFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFilterFrontendNotFound creates DeleteFilterFrontendNotFound with default headers values -func NewDeleteFilterFrontendNotFound() *DeleteFilterFrontendNotFound { - - return &DeleteFilterFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete filter frontend not found response -func (o *DeleteFilterFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteFilterFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete filter frontend not found response -func (o *DeleteFilterFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete filter frontend not found response -func (o *DeleteFilterFrontendNotFound) WithPayload(payload *models.Error) *DeleteFilterFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete filter frontend not found response -func (o *DeleteFilterFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFilterFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteFilterFrontendDefault General Error - -swagger:response deleteFilterFrontendDefault -*/ -type DeleteFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFilterFrontendDefault creates DeleteFilterFrontendDefault with default headers values -func NewDeleteFilterFrontendDefault(code int) *DeleteFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) WithStatusCode(code int) *DeleteFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) WithPayload(payload *models.Error) *DeleteFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete filter frontend default response -func (o *DeleteFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/delete_filter_frontend_urlbuilder.go b/operations/filter/delete_filter_frontend_urlbuilder.go deleted file mode 100644 index 662f6c0f..00000000 --- a/operations/filter/delete_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteFilterFrontendURL generates an URL for the delete filter frontend operation -type DeleteFilterFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFilterFrontendURL) WithBasePath(bp string) *DeleteFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteFilterFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/get_all_filter_backend.go b/operations/filter/get_all_filter_backend.go deleted file mode 100644 index 49102e32..00000000 --- a/operations/filter/get_all_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllFilterBackendHandlerFunc turns a function with the right signature into a get all filter backend handler -type GetAllFilterBackendHandlerFunc func(GetAllFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllFilterBackendHandlerFunc) Handle(params GetAllFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllFilterBackendHandler interface for that can handle valid get all filter backend params -type GetAllFilterBackendHandler interface { - Handle(GetAllFilterBackendParams, interface{}) middleware.Responder -} - -// NewGetAllFilterBackend creates a new http.Handler for the get all filter backend operation -func NewGetAllFilterBackend(ctx *middleware.Context, handler GetAllFilterBackendHandler) *GetAllFilterBackend { - return &GetAllFilterBackend{Context: ctx, Handler: handler} -} - -/* - GetAllFilterBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/filters Filter getAllFilterBackend - -# Return an array of all Filters - -Returns all Filters that are configured in specified parent. -*/ -type GetAllFilterBackend struct { - Context *middleware.Context - Handler GetAllFilterBackendHandler -} - -func (o *GetAllFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/get_all_filter_backend_parameters.go b/operations/filter/get_all_filter_backend_parameters.go deleted file mode 100644 index 262f48c4..00000000 --- a/operations/filter/get_all_filter_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllFilterBackendParams creates a new GetAllFilterBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllFilterBackendParams() GetAllFilterBackendParams { - - return GetAllFilterBackendParams{} -} - -// GetAllFilterBackendParams contains all the bound params for the get all filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllFilterBackend -type GetAllFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllFilterBackendParams() beforehand. -func (o *GetAllFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/filter/get_all_filter_backend_responses.go b/operations/filter/get_all_filter_backend_responses.go deleted file mode 100644 index 80ddb6c2..00000000 --- a/operations/filter/get_all_filter_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllFilterBackendOKCode is the HTTP code returned for type GetAllFilterBackendOK -const GetAllFilterBackendOKCode int = 200 - -/* -GetAllFilterBackendOK Successful operation - -swagger:response getAllFilterBackendOK -*/ -type GetAllFilterBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewGetAllFilterBackendOK creates GetAllFilterBackendOK with default headers values -func NewGetAllFilterBackendOK() *GetAllFilterBackendOK { - - return &GetAllFilterBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all filter backend o k response -func (o *GetAllFilterBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllFilterBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all filter backend o k response -func (o *GetAllFilterBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all filter backend o k response -func (o *GetAllFilterBackendOK) WithPayload(payload models.Filters) *GetAllFilterBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all filter backend o k response -func (o *GetAllFilterBackendOK) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllFilterBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllFilterBackendDefault General Error - -swagger:response getAllFilterBackendDefault -*/ -type GetAllFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllFilterBackendDefault creates GetAllFilterBackendDefault with default headers values -func NewGetAllFilterBackendDefault(code int) *GetAllFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all filter backend default response -func (o *GetAllFilterBackendDefault) WithStatusCode(code int) *GetAllFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all filter backend default response -func (o *GetAllFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all filter backend default response -func (o *GetAllFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all filter backend default response -func (o *GetAllFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all filter backend default response -func (o *GetAllFilterBackendDefault) WithPayload(payload *models.Error) *GetAllFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all filter backend default response -func (o *GetAllFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/get_all_filter_backend_urlbuilder.go b/operations/filter/get_all_filter_backend_urlbuilder.go deleted file mode 100644 index b263931a..00000000 --- a/operations/filter/get_all_filter_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllFilterBackendURL generates an URL for the get all filter backend operation -type GetAllFilterBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllFilterBackendURL) WithBasePath(bp string) *GetAllFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/get_all_filter_frontend.go b/operations/filter/get_all_filter_frontend.go deleted file mode 100644 index 2d57290e..00000000 --- a/operations/filter/get_all_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllFilterFrontendHandlerFunc turns a function with the right signature into a get all filter frontend handler -type GetAllFilterFrontendHandlerFunc func(GetAllFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllFilterFrontendHandlerFunc) Handle(params GetAllFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllFilterFrontendHandler interface for that can handle valid get all filter frontend params -type GetAllFilterFrontendHandler interface { - Handle(GetAllFilterFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllFilterFrontend creates a new http.Handler for the get all filter frontend operation -func NewGetAllFilterFrontend(ctx *middleware.Context, handler GetAllFilterFrontendHandler) *GetAllFilterFrontend { - return &GetAllFilterFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllFilterFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/filters Filter getAllFilterFrontend - -# Return an array of all Filters - -Returns all Filters that are configured in specified parent. -*/ -type GetAllFilterFrontend struct { - Context *middleware.Context - Handler GetAllFilterFrontendHandler -} - -func (o *GetAllFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/get_all_filter_frontend_parameters.go b/operations/filter/get_all_filter_frontend_parameters.go deleted file mode 100644 index f7266252..00000000 --- a/operations/filter/get_all_filter_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllFilterFrontendParams creates a new GetAllFilterFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllFilterFrontendParams() GetAllFilterFrontendParams { - - return GetAllFilterFrontendParams{} -} - -// GetAllFilterFrontendParams contains all the bound params for the get all filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllFilterFrontend -type GetAllFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllFilterFrontendParams() beforehand. -func (o *GetAllFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/filter/get_all_filter_frontend_responses.go b/operations/filter/get_all_filter_frontend_responses.go deleted file mode 100644 index 4cf844b9..00000000 --- a/operations/filter/get_all_filter_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllFilterFrontendOKCode is the HTTP code returned for type GetAllFilterFrontendOK -const GetAllFilterFrontendOKCode int = 200 - -/* -GetAllFilterFrontendOK Successful operation - -swagger:response getAllFilterFrontendOK -*/ -type GetAllFilterFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewGetAllFilterFrontendOK creates GetAllFilterFrontendOK with default headers values -func NewGetAllFilterFrontendOK() *GetAllFilterFrontendOK { - - return &GetAllFilterFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all filter frontend o k response -func (o *GetAllFilterFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllFilterFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all filter frontend o k response -func (o *GetAllFilterFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all filter frontend o k response -func (o *GetAllFilterFrontendOK) WithPayload(payload models.Filters) *GetAllFilterFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all filter frontend o k response -func (o *GetAllFilterFrontendOK) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllFilterFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllFilterFrontendDefault General Error - -swagger:response getAllFilterFrontendDefault -*/ -type GetAllFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllFilterFrontendDefault creates GetAllFilterFrontendDefault with default headers values -func NewGetAllFilterFrontendDefault(code int) *GetAllFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) WithStatusCode(code int) *GetAllFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) WithPayload(payload *models.Error) *GetAllFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all filter frontend default response -func (o *GetAllFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/get_all_filter_frontend_urlbuilder.go b/operations/filter/get_all_filter_frontend_urlbuilder.go deleted file mode 100644 index ba91b420..00000000 --- a/operations/filter/get_all_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllFilterFrontendURL generates an URL for the get all filter frontend operation -type GetAllFilterFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllFilterFrontendURL) WithBasePath(bp string) *GetAllFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/get_filter_backend.go b/operations/filter/get_filter_backend.go deleted file mode 100644 index 22825cdb..00000000 --- a/operations/filter/get_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFilterBackendHandlerFunc turns a function with the right signature into a get filter backend handler -type GetFilterBackendHandlerFunc func(GetFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFilterBackendHandlerFunc) Handle(params GetFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFilterBackendHandler interface for that can handle valid get filter backend params -type GetFilterBackendHandler interface { - Handle(GetFilterBackendParams, interface{}) middleware.Responder -} - -// NewGetFilterBackend creates a new http.Handler for the get filter backend operation -func NewGetFilterBackend(ctx *middleware.Context, handler GetFilterBackendHandler) *GetFilterBackend { - return &GetFilterBackend{Context: ctx, Handler: handler} -} - -/* - GetFilterBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/filters/{index} Filter getFilterBackend - -# Return one Filter - -Returns one Filter configuration by it's index in the specified parent. -*/ -type GetFilterBackend struct { - Context *middleware.Context - Handler GetFilterBackendHandler -} - -func (o *GetFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/get_filter_backend_parameters.go b/operations/filter/get_filter_backend_parameters.go deleted file mode 100644 index 20342b83..00000000 --- a/operations/filter/get_filter_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFilterBackendParams creates a new GetFilterBackendParams object -// -// There are no default values defined in the spec. -func NewGetFilterBackendParams() GetFilterBackendParams { - - return GetFilterBackendParams{} -} - -// GetFilterBackendParams contains all the bound params for the get filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFilterBackend -type GetFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFilterBackendParams() beforehand. -func (o *GetFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetFilterBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/filter/get_filter_backend_responses.go b/operations/filter/get_filter_backend_responses.go deleted file mode 100644 index be2879bf..00000000 --- a/operations/filter/get_filter_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFilterBackendOKCode is the HTTP code returned for type GetFilterBackendOK -const GetFilterBackendOKCode int = 200 - -/* -GetFilterBackendOK Successful operation - -swagger:response getFilterBackendOK -*/ -type GetFilterBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewGetFilterBackendOK creates GetFilterBackendOK with default headers values -func NewGetFilterBackendOK() *GetFilterBackendOK { - - return &GetFilterBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get filter backend o k response -func (o *GetFilterBackendOK) WithConfigurationVersion(configurationVersion string) *GetFilterBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter backend o k response -func (o *GetFilterBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter backend o k response -func (o *GetFilterBackendOK) WithPayload(payload *models.Filter) *GetFilterBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter backend o k response -func (o *GetFilterBackendOK) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetFilterBackendNotFoundCode is the HTTP code returned for type GetFilterBackendNotFound -const GetFilterBackendNotFoundCode int = 404 - -/* -GetFilterBackendNotFound The specified resource was not found - -swagger:response getFilterBackendNotFound -*/ -type GetFilterBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFilterBackendNotFound creates GetFilterBackendNotFound with default headers values -func NewGetFilterBackendNotFound() *GetFilterBackendNotFound { - - return &GetFilterBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get filter backend not found response -func (o *GetFilterBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetFilterBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter backend not found response -func (o *GetFilterBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter backend not found response -func (o *GetFilterBackendNotFound) WithPayload(payload *models.Error) *GetFilterBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter backend not found response -func (o *GetFilterBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetFilterBackendDefault General Error - -swagger:response getFilterBackendDefault -*/ -type GetFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFilterBackendDefault creates GetFilterBackendDefault with default headers values -func NewGetFilterBackendDefault(code int) *GetFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get filter backend default response -func (o *GetFilterBackendDefault) WithStatusCode(code int) *GetFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get filter backend default response -func (o *GetFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get filter backend default response -func (o *GetFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *GetFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter backend default response -func (o *GetFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter backend default response -func (o *GetFilterBackendDefault) WithPayload(payload *models.Error) *GetFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter backend default response -func (o *GetFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/get_filter_backend_urlbuilder.go b/operations/filter/get_filter_backend_urlbuilder.go deleted file mode 100644 index fbce3db8..00000000 --- a/operations/filter/get_filter_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetFilterBackendURL generates an URL for the get filter backend operation -type GetFilterBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFilterBackendURL) WithBasePath(bp string) *GetFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetFilterBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/get_filter_frontend.go b/operations/filter/get_filter_frontend.go deleted file mode 100644 index 2e2aa667..00000000 --- a/operations/filter/get_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFilterFrontendHandlerFunc turns a function with the right signature into a get filter frontend handler -type GetFilterFrontendHandlerFunc func(GetFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFilterFrontendHandlerFunc) Handle(params GetFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFilterFrontendHandler interface for that can handle valid get filter frontend params -type GetFilterFrontendHandler interface { - Handle(GetFilterFrontendParams, interface{}) middleware.Responder -} - -// NewGetFilterFrontend creates a new http.Handler for the get filter frontend operation -func NewGetFilterFrontend(ctx *middleware.Context, handler GetFilterFrontendHandler) *GetFilterFrontend { - return &GetFilterFrontend{Context: ctx, Handler: handler} -} - -/* - GetFilterFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/filters/{index} Filter getFilterFrontend - -# Return one Filter - -Returns one Filter configuration by it's index in the specified parent. -*/ -type GetFilterFrontend struct { - Context *middleware.Context - Handler GetFilterFrontendHandler -} - -func (o *GetFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/get_filter_frontend_parameters.go b/operations/filter/get_filter_frontend_parameters.go deleted file mode 100644 index 5f5bf3b7..00000000 --- a/operations/filter/get_filter_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFilterFrontendParams creates a new GetFilterFrontendParams object -// -// There are no default values defined in the spec. -func NewGetFilterFrontendParams() GetFilterFrontendParams { - - return GetFilterFrontendParams{} -} - -// GetFilterFrontendParams contains all the bound params for the get filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFilterFrontend -type GetFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFilterFrontendParams() beforehand. -func (o *GetFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetFilterFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/filter/get_filter_frontend_responses.go b/operations/filter/get_filter_frontend_responses.go deleted file mode 100644 index df339541..00000000 --- a/operations/filter/get_filter_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFilterFrontendOKCode is the HTTP code returned for type GetFilterFrontendOK -const GetFilterFrontendOKCode int = 200 - -/* -GetFilterFrontendOK Successful operation - -swagger:response getFilterFrontendOK -*/ -type GetFilterFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewGetFilterFrontendOK creates GetFilterFrontendOK with default headers values -func NewGetFilterFrontendOK() *GetFilterFrontendOK { - - return &GetFilterFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get filter frontend o k response -func (o *GetFilterFrontendOK) WithConfigurationVersion(configurationVersion string) *GetFilterFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter frontend o k response -func (o *GetFilterFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter frontend o k response -func (o *GetFilterFrontendOK) WithPayload(payload *models.Filter) *GetFilterFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter frontend o k response -func (o *GetFilterFrontendOK) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetFilterFrontendNotFoundCode is the HTTP code returned for type GetFilterFrontendNotFound -const GetFilterFrontendNotFoundCode int = 404 - -/* -GetFilterFrontendNotFound The specified resource was not found - -swagger:response getFilterFrontendNotFound -*/ -type GetFilterFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFilterFrontendNotFound creates GetFilterFrontendNotFound with default headers values -func NewGetFilterFrontendNotFound() *GetFilterFrontendNotFound { - - return &GetFilterFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get filter frontend not found response -func (o *GetFilterFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetFilterFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter frontend not found response -func (o *GetFilterFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter frontend not found response -func (o *GetFilterFrontendNotFound) WithPayload(payload *models.Error) *GetFilterFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter frontend not found response -func (o *GetFilterFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetFilterFrontendDefault General Error - -swagger:response getFilterFrontendDefault -*/ -type GetFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFilterFrontendDefault creates GetFilterFrontendDefault with default headers values -func NewGetFilterFrontendDefault(code int) *GetFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get filter frontend default response -func (o *GetFilterFrontendDefault) WithStatusCode(code int) *GetFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get filter frontend default response -func (o *GetFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get filter frontend default response -func (o *GetFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get filter frontend default response -func (o *GetFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get filter frontend default response -func (o *GetFilterFrontendDefault) WithPayload(payload *models.Error) *GetFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get filter frontend default response -func (o *GetFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/get_filter_frontend_urlbuilder.go b/operations/filter/get_filter_frontend_urlbuilder.go deleted file mode 100644 index 4cdff3bd..00000000 --- a/operations/filter/get_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetFilterFrontendURL generates an URL for the get filter frontend operation -type GetFilterFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFilterFrontendURL) WithBasePath(bp string) *GetFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetFilterFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/replace_all_filter_backend.go b/operations/filter/replace_all_filter_backend.go deleted file mode 100644 index 4efcf569..00000000 --- a/operations/filter/replace_all_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllFilterBackendHandlerFunc turns a function with the right signature into a replace all filter backend handler -type ReplaceAllFilterBackendHandlerFunc func(ReplaceAllFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllFilterBackendHandlerFunc) Handle(params ReplaceAllFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllFilterBackendHandler interface for that can handle valid replace all filter backend params -type ReplaceAllFilterBackendHandler interface { - Handle(ReplaceAllFilterBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllFilterBackend creates a new http.Handler for the replace all filter backend operation -func NewReplaceAllFilterBackend(ctx *middleware.Context, handler ReplaceAllFilterBackendHandler) *ReplaceAllFilterBackend { - return &ReplaceAllFilterBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllFilterBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/filters Filter replaceAllFilterBackend - -# Replace a Filter list - -Replaces a whole list of Filters with the list given in parameter -*/ -type ReplaceAllFilterBackend struct { - Context *middleware.Context - Handler ReplaceAllFilterBackendHandler -} - -func (o *ReplaceAllFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/replace_all_filter_backend_parameters.go b/operations/filter/replace_all_filter_backend_parameters.go deleted file mode 100644 index 50d155c4..00000000 --- a/operations/filter/replace_all_filter_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllFilterBackendParams creates a new ReplaceAllFilterBackendParams object -// with the default values initialized. -func NewReplaceAllFilterBackendParams() ReplaceAllFilterBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllFilterBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllFilterBackendParams contains all the bound params for the replace all filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllFilterBackend -type ReplaceAllFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Filters - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllFilterBackendParams() beforehand. -func (o *ReplaceAllFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filters - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllFilterBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllFilterBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllFilterBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/replace_all_filter_backend_responses.go b/operations/filter/replace_all_filter_backend_responses.go deleted file mode 100644 index 81ef2380..00000000 --- a/operations/filter/replace_all_filter_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllFilterBackendOKCode is the HTTP code returned for type ReplaceAllFilterBackendOK -const ReplaceAllFilterBackendOKCode int = 200 - -/* -ReplaceAllFilterBackendOK All Filter lines replaced - -swagger:response replaceAllFilterBackendOK -*/ -type ReplaceAllFilterBackendOK struct { - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewReplaceAllFilterBackendOK creates ReplaceAllFilterBackendOK with default headers values -func NewReplaceAllFilterBackendOK() *ReplaceAllFilterBackendOK { - - return &ReplaceAllFilterBackendOK{} -} - -// WithPayload adds the payload to the replace all filter backend o k response -func (o *ReplaceAllFilterBackendOK) WithPayload(payload models.Filters) *ReplaceAllFilterBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter backend o k response -func (o *ReplaceAllFilterBackendOK) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllFilterBackendAcceptedCode is the HTTP code returned for type ReplaceAllFilterBackendAccepted -const ReplaceAllFilterBackendAcceptedCode int = 202 - -/* -ReplaceAllFilterBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllFilterBackendAccepted -*/ -type ReplaceAllFilterBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewReplaceAllFilterBackendAccepted creates ReplaceAllFilterBackendAccepted with default headers values -func NewReplaceAllFilterBackendAccepted() *ReplaceAllFilterBackendAccepted { - - return &ReplaceAllFilterBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all filter backend accepted response -func (o *ReplaceAllFilterBackendAccepted) WithReloadID(reloadID string) *ReplaceAllFilterBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all filter backend accepted response -func (o *ReplaceAllFilterBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all filter backend accepted response -func (o *ReplaceAllFilterBackendAccepted) WithPayload(payload models.Filters) *ReplaceAllFilterBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter backend accepted response -func (o *ReplaceAllFilterBackendAccepted) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllFilterBackendBadRequestCode is the HTTP code returned for type ReplaceAllFilterBackendBadRequest -const ReplaceAllFilterBackendBadRequestCode int = 400 - -/* -ReplaceAllFilterBackendBadRequest Bad request - -swagger:response replaceAllFilterBackendBadRequest -*/ -type ReplaceAllFilterBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllFilterBackendBadRequest creates ReplaceAllFilterBackendBadRequest with default headers values -func NewReplaceAllFilterBackendBadRequest() *ReplaceAllFilterBackendBadRequest { - - return &ReplaceAllFilterBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all filter backend bad request response -func (o *ReplaceAllFilterBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllFilterBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all filter backend bad request response -func (o *ReplaceAllFilterBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all filter backend bad request response -func (o *ReplaceAllFilterBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllFilterBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter backend bad request response -func (o *ReplaceAllFilterBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllFilterBackendDefault General Error - -swagger:response replaceAllFilterBackendDefault -*/ -type ReplaceAllFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllFilterBackendDefault creates ReplaceAllFilterBackendDefault with default headers values -func NewReplaceAllFilterBackendDefault(code int) *ReplaceAllFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) WithStatusCode(code int) *ReplaceAllFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) WithPayload(payload *models.Error) *ReplaceAllFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter backend default response -func (o *ReplaceAllFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/replace_all_filter_backend_urlbuilder.go b/operations/filter/replace_all_filter_backend_urlbuilder.go deleted file mode 100644 index f218296c..00000000 --- a/operations/filter/replace_all_filter_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllFilterBackendURL generates an URL for the replace all filter backend operation -type ReplaceAllFilterBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllFilterBackendURL) WithBasePath(bp string) *ReplaceAllFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/replace_all_filter_frontend.go b/operations/filter/replace_all_filter_frontend.go deleted file mode 100644 index aca3bf40..00000000 --- a/operations/filter/replace_all_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllFilterFrontendHandlerFunc turns a function with the right signature into a replace all filter frontend handler -type ReplaceAllFilterFrontendHandlerFunc func(ReplaceAllFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllFilterFrontendHandlerFunc) Handle(params ReplaceAllFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllFilterFrontendHandler interface for that can handle valid replace all filter frontend params -type ReplaceAllFilterFrontendHandler interface { - Handle(ReplaceAllFilterFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllFilterFrontend creates a new http.Handler for the replace all filter frontend operation -func NewReplaceAllFilterFrontend(ctx *middleware.Context, handler ReplaceAllFilterFrontendHandler) *ReplaceAllFilterFrontend { - return &ReplaceAllFilterFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllFilterFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/filters Filter replaceAllFilterFrontend - -# Replace a Filter list - -Replaces a whole list of Filters with the list given in parameter -*/ -type ReplaceAllFilterFrontend struct { - Context *middleware.Context - Handler ReplaceAllFilterFrontendHandler -} - -func (o *ReplaceAllFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/replace_all_filter_frontend_parameters.go b/operations/filter/replace_all_filter_frontend_parameters.go deleted file mode 100644 index a29bfad9..00000000 --- a/operations/filter/replace_all_filter_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllFilterFrontendParams creates a new ReplaceAllFilterFrontendParams object -// with the default values initialized. -func NewReplaceAllFilterFrontendParams() ReplaceAllFilterFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllFilterFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllFilterFrontendParams contains all the bound params for the replace all filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllFilterFrontend -type ReplaceAllFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.Filters - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllFilterFrontendParams() beforehand. -func (o *ReplaceAllFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filters - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllFilterFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllFilterFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllFilterFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/replace_all_filter_frontend_responses.go b/operations/filter/replace_all_filter_frontend_responses.go deleted file mode 100644 index ce9e2295..00000000 --- a/operations/filter/replace_all_filter_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllFilterFrontendOKCode is the HTTP code returned for type ReplaceAllFilterFrontendOK -const ReplaceAllFilterFrontendOKCode int = 200 - -/* -ReplaceAllFilterFrontendOK All Filter lines replaced - -swagger:response replaceAllFilterFrontendOK -*/ -type ReplaceAllFilterFrontendOK struct { - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewReplaceAllFilterFrontendOK creates ReplaceAllFilterFrontendOK with default headers values -func NewReplaceAllFilterFrontendOK() *ReplaceAllFilterFrontendOK { - - return &ReplaceAllFilterFrontendOK{} -} - -// WithPayload adds the payload to the replace all filter frontend o k response -func (o *ReplaceAllFilterFrontendOK) WithPayload(payload models.Filters) *ReplaceAllFilterFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter frontend o k response -func (o *ReplaceAllFilterFrontendOK) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllFilterFrontendAcceptedCode is the HTTP code returned for type ReplaceAllFilterFrontendAccepted -const ReplaceAllFilterFrontendAcceptedCode int = 202 - -/* -ReplaceAllFilterFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllFilterFrontendAccepted -*/ -type ReplaceAllFilterFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.Filters `json:"body,omitempty"` -} - -// NewReplaceAllFilterFrontendAccepted creates ReplaceAllFilterFrontendAccepted with default headers values -func NewReplaceAllFilterFrontendAccepted() *ReplaceAllFilterFrontendAccepted { - - return &ReplaceAllFilterFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all filter frontend accepted response -func (o *ReplaceAllFilterFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllFilterFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all filter frontend accepted response -func (o *ReplaceAllFilterFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all filter frontend accepted response -func (o *ReplaceAllFilterFrontendAccepted) WithPayload(payload models.Filters) *ReplaceAllFilterFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter frontend accepted response -func (o *ReplaceAllFilterFrontendAccepted) SetPayload(payload models.Filters) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Filters{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllFilterFrontendBadRequestCode is the HTTP code returned for type ReplaceAllFilterFrontendBadRequest -const ReplaceAllFilterFrontendBadRequestCode int = 400 - -/* -ReplaceAllFilterFrontendBadRequest Bad request - -swagger:response replaceAllFilterFrontendBadRequest -*/ -type ReplaceAllFilterFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllFilterFrontendBadRequest creates ReplaceAllFilterFrontendBadRequest with default headers values -func NewReplaceAllFilterFrontendBadRequest() *ReplaceAllFilterFrontendBadRequest { - - return &ReplaceAllFilterFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all filter frontend bad request response -func (o *ReplaceAllFilterFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllFilterFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all filter frontend bad request response -func (o *ReplaceAllFilterFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all filter frontend bad request response -func (o *ReplaceAllFilterFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllFilterFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter frontend bad request response -func (o *ReplaceAllFilterFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllFilterFrontendDefault General Error - -swagger:response replaceAllFilterFrontendDefault -*/ -type ReplaceAllFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllFilterFrontendDefault creates ReplaceAllFilterFrontendDefault with default headers values -func NewReplaceAllFilterFrontendDefault(code int) *ReplaceAllFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) WithStatusCode(code int) *ReplaceAllFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all filter frontend default response -func (o *ReplaceAllFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/replace_all_filter_frontend_urlbuilder.go b/operations/filter/replace_all_filter_frontend_urlbuilder.go deleted file mode 100644 index 1d0d7437..00000000 --- a/operations/filter/replace_all_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllFilterFrontendURL generates an URL for the replace all filter frontend operation -type ReplaceAllFilterFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllFilterFrontendURL) WithBasePath(bp string) *ReplaceAllFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/replace_filter_backend.go b/operations/filter/replace_filter_backend.go deleted file mode 100644 index 3266ec60..00000000 --- a/operations/filter/replace_filter_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceFilterBackendHandlerFunc turns a function with the right signature into a replace filter backend handler -type ReplaceFilterBackendHandlerFunc func(ReplaceFilterBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceFilterBackendHandlerFunc) Handle(params ReplaceFilterBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceFilterBackendHandler interface for that can handle valid replace filter backend params -type ReplaceFilterBackendHandler interface { - Handle(ReplaceFilterBackendParams, interface{}) middleware.Responder -} - -// NewReplaceFilterBackend creates a new http.Handler for the replace filter backend operation -func NewReplaceFilterBackend(ctx *middleware.Context, handler ReplaceFilterBackendHandler) *ReplaceFilterBackend { - return &ReplaceFilterBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceFilterBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/filters/{index} Filter replaceFilterBackend - -# Replace a Filter - -Replaces a Filter configuration by it's index in the specified parent. -*/ -type ReplaceFilterBackend struct { - Context *middleware.Context - Handler ReplaceFilterBackendHandler -} - -func (o *ReplaceFilterBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceFilterBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/replace_filter_backend_parameters.go b/operations/filter/replace_filter_backend_parameters.go deleted file mode 100644 index 1aed1d8f..00000000 --- a/operations/filter/replace_filter_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceFilterBackendParams creates a new ReplaceFilterBackendParams object -// with the default values initialized. -func NewReplaceFilterBackendParams() ReplaceFilterBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceFilterBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceFilterBackendParams contains all the bound params for the replace filter backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceFilterBackend -type ReplaceFilterBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Filter - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceFilterBackendParams() beforehand. -func (o *ReplaceFilterBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filter - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceFilterBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFilterBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceFilterBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceFilterBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceFilterBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceFilterBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/replace_filter_backend_responses.go b/operations/filter/replace_filter_backend_responses.go deleted file mode 100644 index 52054750..00000000 --- a/operations/filter/replace_filter_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceFilterBackendOKCode is the HTTP code returned for type ReplaceFilterBackendOK -const ReplaceFilterBackendOKCode int = 200 - -/* -ReplaceFilterBackendOK Filter replaced - -swagger:response replaceFilterBackendOK -*/ -type ReplaceFilterBackendOK struct { - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewReplaceFilterBackendOK creates ReplaceFilterBackendOK with default headers values -func NewReplaceFilterBackendOK() *ReplaceFilterBackendOK { - - return &ReplaceFilterBackendOK{} -} - -// WithPayload adds the payload to the replace filter backend o k response -func (o *ReplaceFilterBackendOK) WithPayload(payload *models.Filter) *ReplaceFilterBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter backend o k response -func (o *ReplaceFilterBackendOK) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterBackendAcceptedCode is the HTTP code returned for type ReplaceFilterBackendAccepted -const ReplaceFilterBackendAcceptedCode int = 202 - -/* -ReplaceFilterBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceFilterBackendAccepted -*/ -type ReplaceFilterBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewReplaceFilterBackendAccepted creates ReplaceFilterBackendAccepted with default headers values -func NewReplaceFilterBackendAccepted() *ReplaceFilterBackendAccepted { - - return &ReplaceFilterBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace filter backend accepted response -func (o *ReplaceFilterBackendAccepted) WithReloadID(reloadID string) *ReplaceFilterBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace filter backend accepted response -func (o *ReplaceFilterBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace filter backend accepted response -func (o *ReplaceFilterBackendAccepted) WithPayload(payload *models.Filter) *ReplaceFilterBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter backend accepted response -func (o *ReplaceFilterBackendAccepted) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterBackendBadRequestCode is the HTTP code returned for type ReplaceFilterBackendBadRequest -const ReplaceFilterBackendBadRequestCode int = 400 - -/* -ReplaceFilterBackendBadRequest Bad request - -swagger:response replaceFilterBackendBadRequest -*/ -type ReplaceFilterBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterBackendBadRequest creates ReplaceFilterBackendBadRequest with default headers values -func NewReplaceFilterBackendBadRequest() *ReplaceFilterBackendBadRequest { - - return &ReplaceFilterBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter backend bad request response -func (o *ReplaceFilterBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceFilterBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter backend bad request response -func (o *ReplaceFilterBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter backend bad request response -func (o *ReplaceFilterBackendBadRequest) WithPayload(payload *models.Error) *ReplaceFilterBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter backend bad request response -func (o *ReplaceFilterBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterBackendNotFoundCode is the HTTP code returned for type ReplaceFilterBackendNotFound -const ReplaceFilterBackendNotFoundCode int = 404 - -/* -ReplaceFilterBackendNotFound The specified resource was not found - -swagger:response replaceFilterBackendNotFound -*/ -type ReplaceFilterBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterBackendNotFound creates ReplaceFilterBackendNotFound with default headers values -func NewReplaceFilterBackendNotFound() *ReplaceFilterBackendNotFound { - - return &ReplaceFilterBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter backend not found response -func (o *ReplaceFilterBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceFilterBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter backend not found response -func (o *ReplaceFilterBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter backend not found response -func (o *ReplaceFilterBackendNotFound) WithPayload(payload *models.Error) *ReplaceFilterBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter backend not found response -func (o *ReplaceFilterBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceFilterBackendDefault General Error - -swagger:response replaceFilterBackendDefault -*/ -type ReplaceFilterBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterBackendDefault creates ReplaceFilterBackendDefault with default headers values -func NewReplaceFilterBackendDefault(code int) *ReplaceFilterBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceFilterBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) WithStatusCode(code int) *ReplaceFilterBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceFilterBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) WithPayload(payload *models.Error) *ReplaceFilterBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter backend default response -func (o *ReplaceFilterBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/replace_filter_backend_urlbuilder.go b/operations/filter/replace_filter_backend_urlbuilder.go deleted file mode 100644 index cc80867d..00000000 --- a/operations/filter/replace_filter_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceFilterBackendURL generates an URL for the replace filter backend operation -type ReplaceFilterBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFilterBackendURL) WithBasePath(bp string) *ReplaceFilterBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFilterBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceFilterBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceFilterBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceFilterBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceFilterBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceFilterBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceFilterBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceFilterBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceFilterBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceFilterBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/filter/replace_filter_frontend.go b/operations/filter/replace_filter_frontend.go deleted file mode 100644 index 3d16f7eb..00000000 --- a/operations/filter/replace_filter_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceFilterFrontendHandlerFunc turns a function with the right signature into a replace filter frontend handler -type ReplaceFilterFrontendHandlerFunc func(ReplaceFilterFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceFilterFrontendHandlerFunc) Handle(params ReplaceFilterFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceFilterFrontendHandler interface for that can handle valid replace filter frontend params -type ReplaceFilterFrontendHandler interface { - Handle(ReplaceFilterFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceFilterFrontend creates a new http.Handler for the replace filter frontend operation -func NewReplaceFilterFrontend(ctx *middleware.Context, handler ReplaceFilterFrontendHandler) *ReplaceFilterFrontend { - return &ReplaceFilterFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceFilterFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/filters/{index} Filter replaceFilterFrontend - -# Replace a Filter - -Replaces a Filter configuration by it's index in the specified parent. -*/ -type ReplaceFilterFrontend struct { - Context *middleware.Context - Handler ReplaceFilterFrontendHandler -} - -func (o *ReplaceFilterFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceFilterFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/filter/replace_filter_frontend_parameters.go b/operations/filter/replace_filter_frontend_parameters.go deleted file mode 100644 index f302cb4c..00000000 --- a/operations/filter/replace_filter_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceFilterFrontendParams creates a new ReplaceFilterFrontendParams object -// with the default values initialized. -func NewReplaceFilterFrontendParams() ReplaceFilterFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceFilterFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceFilterFrontendParams contains all the bound params for the replace filter frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceFilterFrontend -type ReplaceFilterFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Filter - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Filter Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceFilterFrontendParams() beforehand. -func (o *ReplaceFilterFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Filter - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceFilterFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFilterFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceFilterFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceFilterFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceFilterFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceFilterFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/filter/replace_filter_frontend_responses.go b/operations/filter/replace_filter_frontend_responses.go deleted file mode 100644 index 4b7a6526..00000000 --- a/operations/filter/replace_filter_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceFilterFrontendOKCode is the HTTP code returned for type ReplaceFilterFrontendOK -const ReplaceFilterFrontendOKCode int = 200 - -/* -ReplaceFilterFrontendOK Filter replaced - -swagger:response replaceFilterFrontendOK -*/ -type ReplaceFilterFrontendOK struct { - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewReplaceFilterFrontendOK creates ReplaceFilterFrontendOK with default headers values -func NewReplaceFilterFrontendOK() *ReplaceFilterFrontendOK { - - return &ReplaceFilterFrontendOK{} -} - -// WithPayload adds the payload to the replace filter frontend o k response -func (o *ReplaceFilterFrontendOK) WithPayload(payload *models.Filter) *ReplaceFilterFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter frontend o k response -func (o *ReplaceFilterFrontendOK) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterFrontendAcceptedCode is the HTTP code returned for type ReplaceFilterFrontendAccepted -const ReplaceFilterFrontendAcceptedCode int = 202 - -/* -ReplaceFilterFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceFilterFrontendAccepted -*/ -type ReplaceFilterFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Filter `json:"body,omitempty"` -} - -// NewReplaceFilterFrontendAccepted creates ReplaceFilterFrontendAccepted with default headers values -func NewReplaceFilterFrontendAccepted() *ReplaceFilterFrontendAccepted { - - return &ReplaceFilterFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace filter frontend accepted response -func (o *ReplaceFilterFrontendAccepted) WithReloadID(reloadID string) *ReplaceFilterFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace filter frontend accepted response -func (o *ReplaceFilterFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace filter frontend accepted response -func (o *ReplaceFilterFrontendAccepted) WithPayload(payload *models.Filter) *ReplaceFilterFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter frontend accepted response -func (o *ReplaceFilterFrontendAccepted) SetPayload(payload *models.Filter) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterFrontendBadRequestCode is the HTTP code returned for type ReplaceFilterFrontendBadRequest -const ReplaceFilterFrontendBadRequestCode int = 400 - -/* -ReplaceFilterFrontendBadRequest Bad request - -swagger:response replaceFilterFrontendBadRequest -*/ -type ReplaceFilterFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterFrontendBadRequest creates ReplaceFilterFrontendBadRequest with default headers values -func NewReplaceFilterFrontendBadRequest() *ReplaceFilterFrontendBadRequest { - - return &ReplaceFilterFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter frontend bad request response -func (o *ReplaceFilterFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceFilterFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter frontend bad request response -func (o *ReplaceFilterFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter frontend bad request response -func (o *ReplaceFilterFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceFilterFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter frontend bad request response -func (o *ReplaceFilterFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFilterFrontendNotFoundCode is the HTTP code returned for type ReplaceFilterFrontendNotFound -const ReplaceFilterFrontendNotFoundCode int = 404 - -/* -ReplaceFilterFrontendNotFound The specified resource was not found - -swagger:response replaceFilterFrontendNotFound -*/ -type ReplaceFilterFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterFrontendNotFound creates ReplaceFilterFrontendNotFound with default headers values -func NewReplaceFilterFrontendNotFound() *ReplaceFilterFrontendNotFound { - - return &ReplaceFilterFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter frontend not found response -func (o *ReplaceFilterFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceFilterFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter frontend not found response -func (o *ReplaceFilterFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter frontend not found response -func (o *ReplaceFilterFrontendNotFound) WithPayload(payload *models.Error) *ReplaceFilterFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter frontend not found response -func (o *ReplaceFilterFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceFilterFrontendDefault General Error - -swagger:response replaceFilterFrontendDefault -*/ -type ReplaceFilterFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFilterFrontendDefault creates ReplaceFilterFrontendDefault with default headers values -func NewReplaceFilterFrontendDefault(code int) *ReplaceFilterFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceFilterFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) WithStatusCode(code int) *ReplaceFilterFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceFilterFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) WithPayload(payload *models.Error) *ReplaceFilterFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace filter frontend default response -func (o *ReplaceFilterFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFilterFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/filter/replace_filter_frontend_urlbuilder.go b/operations/filter/replace_filter_frontend_urlbuilder.go deleted file mode 100644 index 07383f6f..00000000 --- a/operations/filter/replace_filter_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package filter - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceFilterFrontendURL generates an URL for the replace filter frontend operation -type ReplaceFilterFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFilterFrontendURL) WithBasePath(bp string) *ReplaceFilterFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFilterFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceFilterFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/filters/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceFilterFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceFilterFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceFilterFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceFilterFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceFilterFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceFilterFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceFilterFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceFilterFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/frontend/create_frontend.go b/operations/frontend/create_frontend.go deleted file mode 100644 index 7f2b2ae1..00000000 --- a/operations/frontend/create_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateFrontendHandlerFunc turns a function with the right signature into a create frontend handler -type CreateFrontendHandlerFunc func(CreateFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateFrontendHandlerFunc) Handle(params CreateFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateFrontendHandler interface for that can handle valid create frontend params -type CreateFrontendHandler interface { - Handle(CreateFrontendParams, interface{}) middleware.Responder -} - -// NewCreateFrontend creates a new http.Handler for the create frontend operation -func NewCreateFrontend(ctx *middleware.Context, handler CreateFrontendHandler) *CreateFrontend { - return &CreateFrontend{Context: ctx, Handler: handler} -} - -/* - CreateFrontend swagger:route POST /services/haproxy/configuration/frontends Frontend createFrontend - -# Add a frontend - -Adds a new frontend to the configuration file. -*/ -type CreateFrontend struct { - Context *middleware.Context - Handler CreateFrontendHandler -} - -func (o *CreateFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/frontend/create_frontend_parameters.go b/operations/frontend/create_frontend_parameters.go deleted file mode 100644 index 7baecf28..00000000 --- a/operations/frontend/create_frontend_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateFrontendParams creates a new CreateFrontendParams object -// with the default values initialized. -func NewCreateFrontendParams() CreateFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateFrontendParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateFrontendParams contains all the bound params for the create frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createFrontend -type CreateFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Frontend - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateFrontendParams() beforehand. -func (o *CreateFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Frontend - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateFrontendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/frontend/create_frontend_responses.go b/operations/frontend/create_frontend_responses.go deleted file mode 100644 index 045c601f..00000000 --- a/operations/frontend/create_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateFrontendCreatedCode is the HTTP code returned for type CreateFrontendCreated -const CreateFrontendCreatedCode int = 201 - -/* -CreateFrontendCreated Frontend created - -swagger:response createFrontendCreated -*/ -type CreateFrontendCreated struct { - - /* - In: Body - */ - Payload *models.Frontend `json:"body,omitempty"` -} - -// NewCreateFrontendCreated creates CreateFrontendCreated with default headers values -func NewCreateFrontendCreated() *CreateFrontendCreated { - - return &CreateFrontendCreated{} -} - -// WithPayload adds the payload to the create frontend created response -func (o *CreateFrontendCreated) WithPayload(payload *models.Frontend) *CreateFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create frontend created response -func (o *CreateFrontendCreated) SetPayload(payload *models.Frontend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFrontendAcceptedCode is the HTTP code returned for type CreateFrontendAccepted -const CreateFrontendAcceptedCode int = 202 - -/* -CreateFrontendAccepted Configuration change accepted and reload requested - -swagger:response createFrontendAccepted -*/ -type CreateFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Frontend `json:"body,omitempty"` -} - -// NewCreateFrontendAccepted creates CreateFrontendAccepted with default headers values -func NewCreateFrontendAccepted() *CreateFrontendAccepted { - - return &CreateFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create frontend accepted response -func (o *CreateFrontendAccepted) WithReloadID(reloadID string) *CreateFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create frontend accepted response -func (o *CreateFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create frontend accepted response -func (o *CreateFrontendAccepted) WithPayload(payload *models.Frontend) *CreateFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create frontend accepted response -func (o *CreateFrontendAccepted) SetPayload(payload *models.Frontend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFrontendBadRequestCode is the HTTP code returned for type CreateFrontendBadRequest -const CreateFrontendBadRequestCode int = 400 - -/* -CreateFrontendBadRequest Bad request - -swagger:response createFrontendBadRequest -*/ -type CreateFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFrontendBadRequest creates CreateFrontendBadRequest with default headers values -func NewCreateFrontendBadRequest() *CreateFrontendBadRequest { - - return &CreateFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create frontend bad request response -func (o *CreateFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create frontend bad request response -func (o *CreateFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create frontend bad request response -func (o *CreateFrontendBadRequest) WithPayload(payload *models.Error) *CreateFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create frontend bad request response -func (o *CreateFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateFrontendConflictCode is the HTTP code returned for type CreateFrontendConflict -const CreateFrontendConflictCode int = 409 - -/* -CreateFrontendConflict The specified resource already exists - -swagger:response createFrontendConflict -*/ -type CreateFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFrontendConflict creates CreateFrontendConflict with default headers values -func NewCreateFrontendConflict() *CreateFrontendConflict { - - return &CreateFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create frontend conflict response -func (o *CreateFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create frontend conflict response -func (o *CreateFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create frontend conflict response -func (o *CreateFrontendConflict) WithPayload(payload *models.Error) *CreateFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create frontend conflict response -func (o *CreateFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateFrontendDefault General Error - -swagger:response createFrontendDefault -*/ -type CreateFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateFrontendDefault creates CreateFrontendDefault with default headers values -func NewCreateFrontendDefault(code int) *CreateFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create frontend default response -func (o *CreateFrontendDefault) WithStatusCode(code int) *CreateFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create frontend default response -func (o *CreateFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create frontend default response -func (o *CreateFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create frontend default response -func (o *CreateFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create frontend default response -func (o *CreateFrontendDefault) WithPayload(payload *models.Error) *CreateFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create frontend default response -func (o *CreateFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/frontend/create_frontend_urlbuilder.go b/operations/frontend/create_frontend_urlbuilder.go deleted file mode 100644 index 540281c4..00000000 --- a/operations/frontend/create_frontend_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateFrontendURL generates an URL for the create frontend operation -type CreateFrontendURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFrontendURL) WithBasePath(bp string) *CreateFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/frontend/delete_frontend.go b/operations/frontend/delete_frontend.go deleted file mode 100644 index cac9c8f4..00000000 --- a/operations/frontend/delete_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteFrontendHandlerFunc turns a function with the right signature into a delete frontend handler -type DeleteFrontendHandlerFunc func(DeleteFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteFrontendHandlerFunc) Handle(params DeleteFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteFrontendHandler interface for that can handle valid delete frontend params -type DeleteFrontendHandler interface { - Handle(DeleteFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteFrontend creates a new http.Handler for the delete frontend operation -func NewDeleteFrontend(ctx *middleware.Context, handler DeleteFrontendHandler) *DeleteFrontend { - return &DeleteFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{name} Frontend deleteFrontend - -# Delete a frontend - -Deletes a frontend from the configuration by it's name. -*/ -type DeleteFrontend struct { - Context *middleware.Context - Handler DeleteFrontendHandler -} - -func (o *DeleteFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/frontend/delete_frontend_parameters.go b/operations/frontend/delete_frontend_parameters.go deleted file mode 100644 index c27add2e..00000000 --- a/operations/frontend/delete_frontend_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteFrontendParams creates a new DeleteFrontendParams object -// with the default values initialized. -func NewDeleteFrontendParams() DeleteFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteFrontendParams contains all the bound params for the delete frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteFrontend -type DeleteFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteFrontendParams() beforehand. -func (o *DeleteFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/frontend/delete_frontend_responses.go b/operations/frontend/delete_frontend_responses.go deleted file mode 100644 index 298c8ef2..00000000 --- a/operations/frontend/delete_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteFrontendAcceptedCode is the HTTP code returned for type DeleteFrontendAccepted -const DeleteFrontendAcceptedCode int = 202 - -/* -DeleteFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteFrontendAccepted -*/ -type DeleteFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteFrontendAccepted creates DeleteFrontendAccepted with default headers values -func NewDeleteFrontendAccepted() *DeleteFrontendAccepted { - - return &DeleteFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete frontend accepted response -func (o *DeleteFrontendAccepted) WithReloadID(reloadID string) *DeleteFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete frontend accepted response -func (o *DeleteFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteFrontendNoContentCode is the HTTP code returned for type DeleteFrontendNoContent -const DeleteFrontendNoContentCode int = 204 - -/* -DeleteFrontendNoContent Frontend deleted - -swagger:response deleteFrontendNoContent -*/ -type DeleteFrontendNoContent struct { -} - -// NewDeleteFrontendNoContent creates DeleteFrontendNoContent with default headers values -func NewDeleteFrontendNoContent() *DeleteFrontendNoContent { - - return &DeleteFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteFrontendNotFoundCode is the HTTP code returned for type DeleteFrontendNotFound -const DeleteFrontendNotFoundCode int = 404 - -/* -DeleteFrontendNotFound The specified resource was not found - -swagger:response deleteFrontendNotFound -*/ -type DeleteFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFrontendNotFound creates DeleteFrontendNotFound with default headers values -func NewDeleteFrontendNotFound() *DeleteFrontendNotFound { - - return &DeleteFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete frontend not found response -func (o *DeleteFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete frontend not found response -func (o *DeleteFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete frontend not found response -func (o *DeleteFrontendNotFound) WithPayload(payload *models.Error) *DeleteFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete frontend not found response -func (o *DeleteFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteFrontendDefault General Error - -swagger:response deleteFrontendDefault -*/ -type DeleteFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteFrontendDefault creates DeleteFrontendDefault with default headers values -func NewDeleteFrontendDefault(code int) *DeleteFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete frontend default response -func (o *DeleteFrontendDefault) WithStatusCode(code int) *DeleteFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete frontend default response -func (o *DeleteFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete frontend default response -func (o *DeleteFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete frontend default response -func (o *DeleteFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete frontend default response -func (o *DeleteFrontendDefault) WithPayload(payload *models.Error) *DeleteFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete frontend default response -func (o *DeleteFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/frontend/delete_frontend_urlbuilder.go b/operations/frontend/delete_frontend_urlbuilder.go deleted file mode 100644 index d2abf34c..00000000 --- a/operations/frontend/delete_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteFrontendURL generates an URL for the delete frontend operation -type DeleteFrontendURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFrontendURL) WithBasePath(bp string) *DeleteFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/frontend/get_frontend.go b/operations/frontend/get_frontend.go deleted file mode 100644 index 88f26e16..00000000 --- a/operations/frontend/get_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFrontendHandlerFunc turns a function with the right signature into a get frontend handler -type GetFrontendHandlerFunc func(GetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFrontendHandlerFunc) Handle(params GetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFrontendHandler interface for that can handle valid get frontend params -type GetFrontendHandler interface { - Handle(GetFrontendParams, interface{}) middleware.Responder -} - -// NewGetFrontend creates a new http.Handler for the get frontend operation -func NewGetFrontend(ctx *middleware.Context, handler GetFrontendHandler) *GetFrontend { - return &GetFrontend{Context: ctx, Handler: handler} -} - -/* - GetFrontend swagger:route GET /services/haproxy/configuration/frontends/{name} Frontend getFrontend - -# Return a frontend - -Returns one frontend configuration by it's name. -*/ -type GetFrontend struct { - Context *middleware.Context - Handler GetFrontendHandler -} - -func (o *GetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/frontend/get_frontend_parameters.go b/operations/frontend/get_frontend_parameters.go deleted file mode 100644 index 68c4bf8e..00000000 --- a/operations/frontend/get_frontend_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFrontendParams creates a new GetFrontendParams object -// with the default values initialized. -func NewGetFrontendParams() GetFrontendParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetFrontendParams{ - FullSection: &fullSectionDefault, - } -} - -// GetFrontendParams contains all the bound params for the get frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFrontend -type GetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFrontendParams() beforehand. -func (o *GetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetFrontendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/frontend/get_frontend_responses.go b/operations/frontend/get_frontend_responses.go deleted file mode 100644 index f400254c..00000000 --- a/operations/frontend/get_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFrontendOKCode is the HTTP code returned for type GetFrontendOK -const GetFrontendOKCode int = 200 - -/* -GetFrontendOK Successful operation - -swagger:response getFrontendOK -*/ -type GetFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Frontend `json:"body,omitempty"` -} - -// NewGetFrontendOK creates GetFrontendOK with default headers values -func NewGetFrontendOK() *GetFrontendOK { - - return &GetFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get frontend o k response -func (o *GetFrontendOK) WithConfigurationVersion(configurationVersion string) *GetFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get frontend o k response -func (o *GetFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get frontend o k response -func (o *GetFrontendOK) WithPayload(payload *models.Frontend) *GetFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get frontend o k response -func (o *GetFrontendOK) SetPayload(payload *models.Frontend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetFrontendNotFoundCode is the HTTP code returned for type GetFrontendNotFound -const GetFrontendNotFoundCode int = 404 - -/* -GetFrontendNotFound The specified resource was not found - -swagger:response getFrontendNotFound -*/ -type GetFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFrontendNotFound creates GetFrontendNotFound with default headers values -func NewGetFrontendNotFound() *GetFrontendNotFound { - - return &GetFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get frontend not found response -func (o *GetFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get frontend not found response -func (o *GetFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get frontend not found response -func (o *GetFrontendNotFound) WithPayload(payload *models.Error) *GetFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get frontend not found response -func (o *GetFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetFrontendDefault General Error - -swagger:response getFrontendDefault -*/ -type GetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFrontendDefault creates GetFrontendDefault with default headers values -func NewGetFrontendDefault(code int) *GetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get frontend default response -func (o *GetFrontendDefault) WithStatusCode(code int) *GetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get frontend default response -func (o *GetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get frontend default response -func (o *GetFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get frontend default response -func (o *GetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get frontend default response -func (o *GetFrontendDefault) WithPayload(payload *models.Error) *GetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get frontend default response -func (o *GetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/frontend/get_frontend_urlbuilder.go b/operations/frontend/get_frontend_urlbuilder.go deleted file mode 100644 index eed2e838..00000000 --- a/operations/frontend/get_frontend_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetFrontendURL generates an URL for the get frontend operation -type GetFrontendURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFrontendURL) WithBasePath(bp string) *GetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/frontend/get_frontends.go b/operations/frontend/get_frontends.go deleted file mode 100644 index ea2cc9ec..00000000 --- a/operations/frontend/get_frontends.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetFrontendsHandlerFunc turns a function with the right signature into a get frontends handler -type GetFrontendsHandlerFunc func(GetFrontendsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetFrontendsHandlerFunc) Handle(params GetFrontendsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetFrontendsHandler interface for that can handle valid get frontends params -type GetFrontendsHandler interface { - Handle(GetFrontendsParams, interface{}) middleware.Responder -} - -// NewGetFrontends creates a new http.Handler for the get frontends operation -func NewGetFrontends(ctx *middleware.Context, handler GetFrontendsHandler) *GetFrontends { - return &GetFrontends{Context: ctx, Handler: handler} -} - -/* - GetFrontends swagger:route GET /services/haproxy/configuration/frontends Frontend getFrontends - -# Return an array of frontends - -Returns an array of all configured frontends. -*/ -type GetFrontends struct { - Context *middleware.Context - Handler GetFrontendsHandler -} - -func (o *GetFrontends) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetFrontendsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/frontend/get_frontends_parameters.go b/operations/frontend/get_frontends_parameters.go deleted file mode 100644 index 0ad50b47..00000000 --- a/operations/frontend/get_frontends_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetFrontendsParams creates a new GetFrontendsParams object -// with the default values initialized. -func NewGetFrontendsParams() GetFrontendsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetFrontendsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetFrontendsParams contains all the bound params for the get frontends operation -// typically these are obtained from a http.Request -// -// swagger:parameters getFrontends -type GetFrontendsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetFrontendsParams() beforehand. -func (o *GetFrontendsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetFrontendsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetFrontendsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetFrontendsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/frontend/get_frontends_responses.go b/operations/frontend/get_frontends_responses.go deleted file mode 100644 index eaaa4e90..00000000 --- a/operations/frontend/get_frontends_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetFrontendsOKCode is the HTTP code returned for type GetFrontendsOK -const GetFrontendsOKCode int = 200 - -/* -GetFrontendsOK Successful operation - -swagger:response getFrontendsOK -*/ -type GetFrontendsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Frontends `json:"body,omitempty"` -} - -// NewGetFrontendsOK creates GetFrontendsOK with default headers values -func NewGetFrontendsOK() *GetFrontendsOK { - - return &GetFrontendsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get frontends o k response -func (o *GetFrontendsOK) WithConfigurationVersion(configurationVersion string) *GetFrontendsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get frontends o k response -func (o *GetFrontendsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get frontends o k response -func (o *GetFrontendsOK) WithPayload(payload models.Frontends) *GetFrontendsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get frontends o k response -func (o *GetFrontendsOK) SetPayload(payload models.Frontends) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFrontendsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Frontends{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetFrontendsDefault General Error - -swagger:response getFrontendsDefault -*/ -type GetFrontendsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetFrontendsDefault creates GetFrontendsDefault with default headers values -func NewGetFrontendsDefault(code int) *GetFrontendsDefault { - if code <= 0 { - code = 500 - } - - return &GetFrontendsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get frontends default response -func (o *GetFrontendsDefault) WithStatusCode(code int) *GetFrontendsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get frontends default response -func (o *GetFrontendsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get frontends default response -func (o *GetFrontendsDefault) WithConfigurationVersion(configurationVersion string) *GetFrontendsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get frontends default response -func (o *GetFrontendsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get frontends default response -func (o *GetFrontendsDefault) WithPayload(payload *models.Error) *GetFrontendsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get frontends default response -func (o *GetFrontendsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetFrontendsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/frontend/get_frontends_urlbuilder.go b/operations/frontend/get_frontends_urlbuilder.go deleted file mode 100644 index 9ad42b2b..00000000 --- a/operations/frontend/get_frontends_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetFrontendsURL generates an URL for the get frontends operation -type GetFrontendsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFrontendsURL) WithBasePath(bp string) *GetFrontendsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetFrontendsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetFrontendsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetFrontendsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetFrontendsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetFrontendsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetFrontendsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetFrontendsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetFrontendsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/frontend/replace_frontend.go b/operations/frontend/replace_frontend.go deleted file mode 100644 index 7cac6737..00000000 --- a/operations/frontend/replace_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceFrontendHandlerFunc turns a function with the right signature into a replace frontend handler -type ReplaceFrontendHandlerFunc func(ReplaceFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceFrontendHandlerFunc) Handle(params ReplaceFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceFrontendHandler interface for that can handle valid replace frontend params -type ReplaceFrontendHandler interface { - Handle(ReplaceFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceFrontend creates a new http.Handler for the replace frontend operation -func NewReplaceFrontend(ctx *middleware.Context, handler ReplaceFrontendHandler) *ReplaceFrontend { - return &ReplaceFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceFrontend swagger:route PUT /services/haproxy/configuration/frontends/{name} Frontend replaceFrontend - -# Replace a frontend - -Replaces a frontend configuration by it's name. -*/ -type ReplaceFrontend struct { - Context *middleware.Context - Handler ReplaceFrontendHandler -} - -func (o *ReplaceFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/frontend/replace_frontend_parameters.go b/operations/frontend/replace_frontend_parameters.go deleted file mode 100644 index 94db3bfc..00000000 --- a/operations/frontend/replace_frontend_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceFrontendParams creates a new ReplaceFrontendParams object -// with the default values initialized. -func NewReplaceFrontendParams() ReplaceFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceFrontendParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceFrontendParams contains all the bound params for the replace frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceFrontend -type ReplaceFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Frontend - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceFrontendParams() beforehand. -func (o *ReplaceFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Frontend - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceFrontendParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceFrontendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/frontend/replace_frontend_responses.go b/operations/frontend/replace_frontend_responses.go deleted file mode 100644 index 42da8e6e..00000000 --- a/operations/frontend/replace_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceFrontendOKCode is the HTTP code returned for type ReplaceFrontendOK -const ReplaceFrontendOKCode int = 200 - -/* -ReplaceFrontendOK Frontend replaced - -swagger:response replaceFrontendOK -*/ -type ReplaceFrontendOK struct { - - /* - In: Body - */ - Payload *models.Frontend `json:"body,omitempty"` -} - -// NewReplaceFrontendOK creates ReplaceFrontendOK with default headers values -func NewReplaceFrontendOK() *ReplaceFrontendOK { - - return &ReplaceFrontendOK{} -} - -// WithPayload adds the payload to the replace frontend o k response -func (o *ReplaceFrontendOK) WithPayload(payload *models.Frontend) *ReplaceFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace frontend o k response -func (o *ReplaceFrontendOK) SetPayload(payload *models.Frontend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFrontendAcceptedCode is the HTTP code returned for type ReplaceFrontendAccepted -const ReplaceFrontendAcceptedCode int = 202 - -/* -ReplaceFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceFrontendAccepted -*/ -type ReplaceFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Frontend `json:"body,omitempty"` -} - -// NewReplaceFrontendAccepted creates ReplaceFrontendAccepted with default headers values -func NewReplaceFrontendAccepted() *ReplaceFrontendAccepted { - - return &ReplaceFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace frontend accepted response -func (o *ReplaceFrontendAccepted) WithReloadID(reloadID string) *ReplaceFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace frontend accepted response -func (o *ReplaceFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace frontend accepted response -func (o *ReplaceFrontendAccepted) WithPayload(payload *models.Frontend) *ReplaceFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace frontend accepted response -func (o *ReplaceFrontendAccepted) SetPayload(payload *models.Frontend) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFrontendBadRequestCode is the HTTP code returned for type ReplaceFrontendBadRequest -const ReplaceFrontendBadRequestCode int = 400 - -/* -ReplaceFrontendBadRequest Bad request - -swagger:response replaceFrontendBadRequest -*/ -type ReplaceFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFrontendBadRequest creates ReplaceFrontendBadRequest with default headers values -func NewReplaceFrontendBadRequest() *ReplaceFrontendBadRequest { - - return &ReplaceFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace frontend bad request response -func (o *ReplaceFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace frontend bad request response -func (o *ReplaceFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace frontend bad request response -func (o *ReplaceFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace frontend bad request response -func (o *ReplaceFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceFrontendNotFoundCode is the HTTP code returned for type ReplaceFrontendNotFound -const ReplaceFrontendNotFoundCode int = 404 - -/* -ReplaceFrontendNotFound The specified resource was not found - -swagger:response replaceFrontendNotFound -*/ -type ReplaceFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFrontendNotFound creates ReplaceFrontendNotFound with default headers values -func NewReplaceFrontendNotFound() *ReplaceFrontendNotFound { - - return &ReplaceFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace frontend not found response -func (o *ReplaceFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace frontend not found response -func (o *ReplaceFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace frontend not found response -func (o *ReplaceFrontendNotFound) WithPayload(payload *models.Error) *ReplaceFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace frontend not found response -func (o *ReplaceFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceFrontendDefault General Error - -swagger:response replaceFrontendDefault -*/ -type ReplaceFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceFrontendDefault creates ReplaceFrontendDefault with default headers values -func NewReplaceFrontendDefault(code int) *ReplaceFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace frontend default response -func (o *ReplaceFrontendDefault) WithStatusCode(code int) *ReplaceFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace frontend default response -func (o *ReplaceFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace frontend default response -func (o *ReplaceFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace frontend default response -func (o *ReplaceFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace frontend default response -func (o *ReplaceFrontendDefault) WithPayload(payload *models.Error) *ReplaceFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace frontend default response -func (o *ReplaceFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/frontend/replace_frontend_urlbuilder.go b/operations/frontend/replace_frontend_urlbuilder.go deleted file mode 100644 index ca4c3405..00000000 --- a/operations/frontend/replace_frontend_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package frontend - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceFrontendURL generates an URL for the replace frontend operation -type ReplaceFrontendURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFrontendURL) WithBasePath(bp string) *ReplaceFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/global/get_global.go b/operations/global/get_global.go deleted file mode 100644 index 1b717c77..00000000 --- a/operations/global/get_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetGlobalHandlerFunc turns a function with the right signature into a get global handler -type GetGlobalHandlerFunc func(GetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetGlobalHandlerFunc) Handle(params GetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetGlobalHandler interface for that can handle valid get global params -type GetGlobalHandler interface { - Handle(GetGlobalParams, interface{}) middleware.Responder -} - -// NewGetGlobal creates a new http.Handler for the get global operation -func NewGetGlobal(ctx *middleware.Context, handler GetGlobalHandler) *GetGlobal { - return &GetGlobal{Context: ctx, Handler: handler} -} - -/* - GetGlobal swagger:route GET /services/haproxy/configuration/global Global getGlobal - -# Return a global part of configuration - -Returns global part of configuration. -*/ -type GetGlobal struct { - Context *middleware.Context - Handler GetGlobalHandler -} - -func (o *GetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/global/get_global_parameters.go b/operations/global/get_global_parameters.go deleted file mode 100644 index 8b5579c8..00000000 --- a/operations/global/get_global_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetGlobalParams creates a new GetGlobalParams object -// with the default values initialized. -func NewGetGlobalParams() GetGlobalParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetGlobalParams{ - FullSection: &fullSectionDefault, - } -} - -// GetGlobalParams contains all the bound params for the get global operation -// typically these are obtained from a http.Request -// -// swagger:parameters getGlobal -type GetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetGlobalParams() beforehand. -func (o *GetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetGlobalParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/global/get_global_responses.go b/operations/global/get_global_responses.go deleted file mode 100644 index 283bc111..00000000 --- a/operations/global/get_global_responses.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetGlobalOKCode is the HTTP code returned for type GetGlobalOK -const GetGlobalOKCode int = 200 - -/* -GetGlobalOK Successful operation - -swagger:response getGlobalOK -*/ -type GetGlobalOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Global `json:"body,omitempty"` -} - -// NewGetGlobalOK creates GetGlobalOK with default headers values -func NewGetGlobalOK() *GetGlobalOK { - - return &GetGlobalOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get global o k response -func (o *GetGlobalOK) WithConfigurationVersion(configurationVersion string) *GetGlobalOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get global o k response -func (o *GetGlobalOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get global o k response -func (o *GetGlobalOK) WithPayload(payload *models.Global) *GetGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get global o k response -func (o *GetGlobalOK) SetPayload(payload *models.Global) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetGlobalDefault General Error - -swagger:response getGlobalDefault -*/ -type GetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetGlobalDefault creates GetGlobalDefault with default headers values -func NewGetGlobalDefault(code int) *GetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &GetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get global default response -func (o *GetGlobalDefault) WithStatusCode(code int) *GetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get global default response -func (o *GetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get global default response -func (o *GetGlobalDefault) WithConfigurationVersion(configurationVersion string) *GetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get global default response -func (o *GetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get global default response -func (o *GetGlobalDefault) WithPayload(payload *models.Error) *GetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get global default response -func (o *GetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/global/get_global_urlbuilder.go b/operations/global/get_global_urlbuilder.go deleted file mode 100644 index 8e448ffb..00000000 --- a/operations/global/get_global_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetGlobalURL generates an URL for the get global operation -type GetGlobalURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGlobalURL) WithBasePath(bp string) *GetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/global/replace_global.go b/operations/global/replace_global.go deleted file mode 100644 index be43146d..00000000 --- a/operations/global/replace_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceGlobalHandlerFunc turns a function with the right signature into a replace global handler -type ReplaceGlobalHandlerFunc func(ReplaceGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceGlobalHandlerFunc) Handle(params ReplaceGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceGlobalHandler interface for that can handle valid replace global params -type ReplaceGlobalHandler interface { - Handle(ReplaceGlobalParams, interface{}) middleware.Responder -} - -// NewReplaceGlobal creates a new http.Handler for the replace global operation -func NewReplaceGlobal(ctx *middleware.Context, handler ReplaceGlobalHandler) *ReplaceGlobal { - return &ReplaceGlobal{Context: ctx, Handler: handler} -} - -/* - ReplaceGlobal swagger:route PUT /services/haproxy/configuration/global Global replaceGlobal - -# Replace global - -Replace global part of config -*/ -type ReplaceGlobal struct { - Context *middleware.Context - Handler ReplaceGlobalHandler -} - -func (o *ReplaceGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/global/replace_global_parameters.go b/operations/global/replace_global_parameters.go deleted file mode 100644 index 878bae6c..00000000 --- a/operations/global/replace_global_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceGlobalParams creates a new ReplaceGlobalParams object -// with the default values initialized. -func NewReplaceGlobalParams() ReplaceGlobalParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceGlobalParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceGlobalParams contains all the bound params for the replace global operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceGlobal -type ReplaceGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Global - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceGlobalParams() beforehand. -func (o *ReplaceGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Global - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceGlobalParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceGlobalParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceGlobalParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/global/replace_global_responses.go b/operations/global/replace_global_responses.go deleted file mode 100644 index 8297de5b..00000000 --- a/operations/global/replace_global_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceGlobalOKCode is the HTTP code returned for type ReplaceGlobalOK -const ReplaceGlobalOKCode int = 200 - -/* -ReplaceGlobalOK Global replaced - -swagger:response replaceGlobalOK -*/ -type ReplaceGlobalOK struct { - - /* - In: Body - */ - Payload *models.Global `json:"body,omitempty"` -} - -// NewReplaceGlobalOK creates ReplaceGlobalOK with default headers values -func NewReplaceGlobalOK() *ReplaceGlobalOK { - - return &ReplaceGlobalOK{} -} - -// WithPayload adds the payload to the replace global o k response -func (o *ReplaceGlobalOK) WithPayload(payload *models.Global) *ReplaceGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace global o k response -func (o *ReplaceGlobalOK) SetPayload(payload *models.Global) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceGlobalAcceptedCode is the HTTP code returned for type ReplaceGlobalAccepted -const ReplaceGlobalAcceptedCode int = 202 - -/* -ReplaceGlobalAccepted Configuration change accepted and reload requested - -swagger:response replaceGlobalAccepted -*/ -type ReplaceGlobalAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Global `json:"body,omitempty"` -} - -// NewReplaceGlobalAccepted creates ReplaceGlobalAccepted with default headers values -func NewReplaceGlobalAccepted() *ReplaceGlobalAccepted { - - return &ReplaceGlobalAccepted{} -} - -// WithReloadID adds the reloadId to the replace global accepted response -func (o *ReplaceGlobalAccepted) WithReloadID(reloadID string) *ReplaceGlobalAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace global accepted response -func (o *ReplaceGlobalAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace global accepted response -func (o *ReplaceGlobalAccepted) WithPayload(payload *models.Global) *ReplaceGlobalAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace global accepted response -func (o *ReplaceGlobalAccepted) SetPayload(payload *models.Global) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGlobalAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceGlobalBadRequestCode is the HTTP code returned for type ReplaceGlobalBadRequest -const ReplaceGlobalBadRequestCode int = 400 - -/* -ReplaceGlobalBadRequest Bad request - -swagger:response replaceGlobalBadRequest -*/ -type ReplaceGlobalBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceGlobalBadRequest creates ReplaceGlobalBadRequest with default headers values -func NewReplaceGlobalBadRequest() *ReplaceGlobalBadRequest { - - return &ReplaceGlobalBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace global bad request response -func (o *ReplaceGlobalBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceGlobalBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace global bad request response -func (o *ReplaceGlobalBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace global bad request response -func (o *ReplaceGlobalBadRequest) WithPayload(payload *models.Error) *ReplaceGlobalBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace global bad request response -func (o *ReplaceGlobalBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGlobalBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceGlobalDefault General Error - -swagger:response replaceGlobalDefault -*/ -type ReplaceGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceGlobalDefault creates ReplaceGlobalDefault with default headers values -func NewReplaceGlobalDefault(code int) *ReplaceGlobalDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace global default response -func (o *ReplaceGlobalDefault) WithStatusCode(code int) *ReplaceGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace global default response -func (o *ReplaceGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace global default response -func (o *ReplaceGlobalDefault) WithConfigurationVersion(configurationVersion string) *ReplaceGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace global default response -func (o *ReplaceGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace global default response -func (o *ReplaceGlobalDefault) WithPayload(payload *models.Error) *ReplaceGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace global default response -func (o *ReplaceGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/global/replace_global_urlbuilder.go b/operations/global/replace_global_urlbuilder.go deleted file mode 100644 index f78ef828..00000000 --- a/operations/global/replace_global_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package global - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// ReplaceGlobalURL generates an URL for the replace global operation -type ReplaceGlobalURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceGlobalURL) WithBasePath(bp string) *ReplaceGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/group/create_group.go b/operations/group/create_group.go deleted file mode 100644 index e17e6529..00000000 --- a/operations/group/create_group.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateGroupHandlerFunc turns a function with the right signature into a create group handler -type CreateGroupHandlerFunc func(CreateGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateGroupHandlerFunc) Handle(params CreateGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateGroupHandler interface for that can handle valid create group params -type CreateGroupHandler interface { - Handle(CreateGroupParams, interface{}) middleware.Responder -} - -// NewCreateGroup creates a new http.Handler for the create group operation -func NewCreateGroup(ctx *middleware.Context, handler CreateGroupHandler) *CreateGroup { - return &CreateGroup{Context: ctx, Handler: handler} -} - -/* - CreateGroup swagger:route POST /services/haproxy/configuration/groups Group createGroup - -Add a new userlist group -*/ -type CreateGroup struct { - Context *middleware.Context - Handler CreateGroupHandler -} - -func (o *CreateGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/group/create_group_parameters.go b/operations/group/create_group_parameters.go deleted file mode 100644 index 4d078d7f..00000000 --- a/operations/group/create_group_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateGroupParams creates a new CreateGroupParams object -// with the default values initialized. -func NewCreateGroupParams() CreateGroupParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateGroupParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateGroupParams contains all the bound params for the create group operation -// typically these are obtained from a http.Request -// -// swagger:parameters createGroup -type CreateGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Group - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateGroupParams() beforehand. -func (o *CreateGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Group - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateGroupParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateGroupParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *CreateGroupParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/group/create_group_responses.go b/operations/group/create_group_responses.go deleted file mode 100644 index ceaf76a3..00000000 --- a/operations/group/create_group_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateGroupCreatedCode is the HTTP code returned for type CreateGroupCreated -const CreateGroupCreatedCode int = 201 - -/* -CreateGroupCreated Group created - -swagger:response createGroupCreated -*/ -type CreateGroupCreated struct { - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewCreateGroupCreated creates CreateGroupCreated with default headers values -func NewCreateGroupCreated() *CreateGroupCreated { - - return &CreateGroupCreated{} -} - -// WithPayload adds the payload to the create group created response -func (o *CreateGroupCreated) WithPayload(payload *models.Group) *CreateGroupCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create group created response -func (o *CreateGroupCreated) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateGroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateGroupAcceptedCode is the HTTP code returned for type CreateGroupAccepted -const CreateGroupAcceptedCode int = 202 - -/* -CreateGroupAccepted Configuration change accepted and reload requested - -swagger:response createGroupAccepted -*/ -type CreateGroupAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewCreateGroupAccepted creates CreateGroupAccepted with default headers values -func NewCreateGroupAccepted() *CreateGroupAccepted { - - return &CreateGroupAccepted{} -} - -// WithReloadID adds the reloadId to the create group accepted response -func (o *CreateGroupAccepted) WithReloadID(reloadID string) *CreateGroupAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create group accepted response -func (o *CreateGroupAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create group accepted response -func (o *CreateGroupAccepted) WithPayload(payload *models.Group) *CreateGroupAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create group accepted response -func (o *CreateGroupAccepted) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateGroupAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateGroupBadRequestCode is the HTTP code returned for type CreateGroupBadRequest -const CreateGroupBadRequestCode int = 400 - -/* -CreateGroupBadRequest Bad request - -swagger:response createGroupBadRequest -*/ -type CreateGroupBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateGroupBadRequest creates CreateGroupBadRequest with default headers values -func NewCreateGroupBadRequest() *CreateGroupBadRequest { - - return &CreateGroupBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create group bad request response -func (o *CreateGroupBadRequest) WithConfigurationVersion(configurationVersion string) *CreateGroupBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create group bad request response -func (o *CreateGroupBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create group bad request response -func (o *CreateGroupBadRequest) WithPayload(payload *models.Error) *CreateGroupBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create group bad request response -func (o *CreateGroupBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateGroupConflictCode is the HTTP code returned for type CreateGroupConflict -const CreateGroupConflictCode int = 409 - -/* -CreateGroupConflict The specified resource already exists - -swagger:response createGroupConflict -*/ -type CreateGroupConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateGroupConflict creates CreateGroupConflict with default headers values -func NewCreateGroupConflict() *CreateGroupConflict { - - return &CreateGroupConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create group conflict response -func (o *CreateGroupConflict) WithConfigurationVersion(configurationVersion string) *CreateGroupConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create group conflict response -func (o *CreateGroupConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create group conflict response -func (o *CreateGroupConflict) WithPayload(payload *models.Error) *CreateGroupConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create group conflict response -func (o *CreateGroupConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateGroupConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateGroupDefault General Error - -swagger:response createGroupDefault -*/ -type CreateGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateGroupDefault creates CreateGroupDefault with default headers values -func NewCreateGroupDefault(code int) *CreateGroupDefault { - if code <= 0 { - code = 500 - } - - return &CreateGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create group default response -func (o *CreateGroupDefault) WithStatusCode(code int) *CreateGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create group default response -func (o *CreateGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create group default response -func (o *CreateGroupDefault) WithConfigurationVersion(configurationVersion string) *CreateGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create group default response -func (o *CreateGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create group default response -func (o *CreateGroupDefault) WithPayload(payload *models.Error) *CreateGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create group default response -func (o *CreateGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/group/create_group_urlbuilder.go b/operations/group/create_group_urlbuilder.go deleted file mode 100644 index d4095381..00000000 --- a/operations/group/create_group_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateGroupURL generates an URL for the create group operation -type CreateGroupURL struct { - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateGroupURL) WithBasePath(bp string) *CreateGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/groups" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/group/delete_group.go b/operations/group/delete_group.go deleted file mode 100644 index 3916d88b..00000000 --- a/operations/group/delete_group.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteGroupHandlerFunc turns a function with the right signature into a delete group handler -type DeleteGroupHandlerFunc func(DeleteGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteGroupHandlerFunc) Handle(params DeleteGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteGroupHandler interface for that can handle valid delete group params -type DeleteGroupHandler interface { - Handle(DeleteGroupParams, interface{}) middleware.Responder -} - -// NewDeleteGroup creates a new http.Handler for the delete group operation -func NewDeleteGroup(ctx *middleware.Context, handler DeleteGroupHandler) *DeleteGroup { - return &DeleteGroup{Context: ctx, Handler: handler} -} - -/* - DeleteGroup swagger:route DELETE /services/haproxy/configuration/groups/{name} Group deleteGroup - -Delete a group -*/ -type DeleteGroup struct { - Context *middleware.Context - Handler DeleteGroupHandler -} - -func (o *DeleteGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/group/delete_group_parameters.go b/operations/group/delete_group_parameters.go deleted file mode 100644 index cec73c10..00000000 --- a/operations/group/delete_group_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteGroupParams creates a new DeleteGroupParams object -// with the default values initialized. -func NewDeleteGroupParams() DeleteGroupParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteGroupParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteGroupParams contains all the bound params for the delete group operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteGroup -type DeleteGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*group name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteGroupParams() beforehand. -func (o *DeleteGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteGroupParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteGroupParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *DeleteGroupParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/group/delete_group_responses.go b/operations/group/delete_group_responses.go deleted file mode 100644 index b0b7085d..00000000 --- a/operations/group/delete_group_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteGroupAcceptedCode is the HTTP code returned for type DeleteGroupAccepted -const DeleteGroupAcceptedCode int = 202 - -/* -DeleteGroupAccepted Configuration change accepted and reload requested - -swagger:response deleteGroupAccepted -*/ -type DeleteGroupAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteGroupAccepted creates DeleteGroupAccepted with default headers values -func NewDeleteGroupAccepted() *DeleteGroupAccepted { - - return &DeleteGroupAccepted{} -} - -// WithReloadID adds the reloadId to the delete group accepted response -func (o *DeleteGroupAccepted) WithReloadID(reloadID string) *DeleteGroupAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete group accepted response -func (o *DeleteGroupAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteGroupAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteGroupNoContentCode is the HTTP code returned for type DeleteGroupNoContent -const DeleteGroupNoContentCode int = 204 - -/* -DeleteGroupNoContent Group deleted - -swagger:response deleteGroupNoContent -*/ -type DeleteGroupNoContent struct { -} - -// NewDeleteGroupNoContent creates DeleteGroupNoContent with default headers values -func NewDeleteGroupNoContent() *DeleteGroupNoContent { - - return &DeleteGroupNoContent{} -} - -// WriteResponse to the client -func (o *DeleteGroupNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteGroupNotFoundCode is the HTTP code returned for type DeleteGroupNotFound -const DeleteGroupNotFoundCode int = 404 - -/* -DeleteGroupNotFound The specified resource was not found - -swagger:response deleteGroupNotFound -*/ -type DeleteGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteGroupNotFound creates DeleteGroupNotFound with default headers values -func NewDeleteGroupNotFound() *DeleteGroupNotFound { - - return &DeleteGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete group not found response -func (o *DeleteGroupNotFound) WithConfigurationVersion(configurationVersion string) *DeleteGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete group not found response -func (o *DeleteGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete group not found response -func (o *DeleteGroupNotFound) WithPayload(payload *models.Error) *DeleteGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete group not found response -func (o *DeleteGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteGroupDefault General Error - -swagger:response deleteGroupDefault -*/ -type DeleteGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteGroupDefault creates DeleteGroupDefault with default headers values -func NewDeleteGroupDefault(code int) *DeleteGroupDefault { - if code <= 0 { - code = 500 - } - - return &DeleteGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete group default response -func (o *DeleteGroupDefault) WithStatusCode(code int) *DeleteGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete group default response -func (o *DeleteGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete group default response -func (o *DeleteGroupDefault) WithConfigurationVersion(configurationVersion string) *DeleteGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete group default response -func (o *DeleteGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete group default response -func (o *DeleteGroupDefault) WithPayload(payload *models.Error) *DeleteGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete group default response -func (o *DeleteGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/group/delete_group_urlbuilder.go b/operations/group/delete_group_urlbuilder.go deleted file mode 100644 index ceafe4c7..00000000 --- a/operations/group/delete_group_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteGroupURL generates an URL for the delete group operation -type DeleteGroupURL struct { - Name string - - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteGroupURL) WithBasePath(bp string) *DeleteGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/group/get_group.go b/operations/group/get_group.go deleted file mode 100644 index 4b133368..00000000 --- a/operations/group/get_group.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetGroupHandlerFunc turns a function with the right signature into a get group handler -type GetGroupHandlerFunc func(GetGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetGroupHandlerFunc) Handle(params GetGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetGroupHandler interface for that can handle valid get group params -type GetGroupHandler interface { - Handle(GetGroupParams, interface{}) middleware.Responder -} - -// NewGetGroup creates a new http.Handler for the get group operation -func NewGetGroup(ctx *middleware.Context, handler GetGroupHandler) *GetGroup { - return &GetGroup{Context: ctx, Handler: handler} -} - -/* - GetGroup swagger:route GET /services/haproxy/configuration/groups/{name} Group getGroup - -Return one userlist group -*/ -type GetGroup struct { - Context *middleware.Context - Handler GetGroupHandler -} - -func (o *GetGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/group/get_group_parameters.go b/operations/group/get_group_parameters.go deleted file mode 100644 index e3692f2d..00000000 --- a/operations/group/get_group_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetGroupParams creates a new GetGroupParams object -// -// There are no default values defined in the spec. -func NewGetGroupParams() GetGroupParams { - - return GetGroupParams{} -} - -// GetGroupParams contains all the bound params for the get group operation -// typically these are obtained from a http.Request -// -// swagger:parameters getGroup -type GetGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Group name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetGroupParams() beforehand. -func (o *GetGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *GetGroupParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} diff --git a/operations/group/get_group_responses.go b/operations/group/get_group_responses.go deleted file mode 100644 index dc240ad8..00000000 --- a/operations/group/get_group_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetGroupOKCode is the HTTP code returned for type GetGroupOK -const GetGroupOKCode int = 200 - -/* -GetGroupOK Successful operation - -swagger:response getGroupOK -*/ -type GetGroupOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewGetGroupOK creates GetGroupOK with default headers values -func NewGetGroupOK() *GetGroupOK { - - return &GetGroupOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get group o k response -func (o *GetGroupOK) WithConfigurationVersion(configurationVersion string) *GetGroupOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get group o k response -func (o *GetGroupOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get group o k response -func (o *GetGroupOK) WithPayload(payload *models.Group) *GetGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get group o k response -func (o *GetGroupOK) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetGroupNotFoundCode is the HTTP code returned for type GetGroupNotFound -const GetGroupNotFoundCode int = 404 - -/* -GetGroupNotFound The specified resource already exists - -swagger:response getGroupNotFound -*/ -type GetGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetGroupNotFound creates GetGroupNotFound with default headers values -func NewGetGroupNotFound() *GetGroupNotFound { - - return &GetGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get group not found response -func (o *GetGroupNotFound) WithConfigurationVersion(configurationVersion string) *GetGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get group not found response -func (o *GetGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get group not found response -func (o *GetGroupNotFound) WithPayload(payload *models.Error) *GetGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get group not found response -func (o *GetGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetGroupDefault General Error - -swagger:response getGroupDefault -*/ -type GetGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetGroupDefault creates GetGroupDefault with default headers values -func NewGetGroupDefault(code int) *GetGroupDefault { - if code <= 0 { - code = 500 - } - - return &GetGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get group default response -func (o *GetGroupDefault) WithStatusCode(code int) *GetGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get group default response -func (o *GetGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get group default response -func (o *GetGroupDefault) WithConfigurationVersion(configurationVersion string) *GetGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get group default response -func (o *GetGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get group default response -func (o *GetGroupDefault) WithPayload(payload *models.Error) *GetGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get group default response -func (o *GetGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/group/get_group_urlbuilder.go b/operations/group/get_group_urlbuilder.go deleted file mode 100644 index f02baf5c..00000000 --- a/operations/group/get_group_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetGroupURL generates an URL for the get group operation -type GetGroupURL struct { - Name string - - TransactionID *string - Userlist string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGroupURL) WithBasePath(bp string) *GetGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/group/get_groups.go b/operations/group/get_groups.go deleted file mode 100644 index 5a72f79f..00000000 --- a/operations/group/get_groups.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetGroupsHandlerFunc turns a function with the right signature into a get groups handler -type GetGroupsHandlerFunc func(GetGroupsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetGroupsHandlerFunc) Handle(params GetGroupsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetGroupsHandler interface for that can handle valid get groups params -type GetGroupsHandler interface { - Handle(GetGroupsParams, interface{}) middleware.Responder -} - -// NewGetGroups creates a new http.Handler for the get groups operation -func NewGetGroups(ctx *middleware.Context, handler GetGroupsHandler) *GetGroups { - return &GetGroups{Context: ctx, Handler: handler} -} - -/* - GetGroups swagger:route GET /services/haproxy/configuration/groups Group getGroups - -Return an array of userlist groups -*/ -type GetGroups struct { - Context *middleware.Context - Handler GetGroupsHandler -} - -func (o *GetGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetGroupsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/group/get_groups_parameters.go b/operations/group/get_groups_parameters.go deleted file mode 100644 index c878f46b..00000000 --- a/operations/group/get_groups_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetGroupsParams creates a new GetGroupsParams object -// -// There are no default values defined in the spec. -func NewGetGroupsParams() GetGroupsParams { - - return GetGroupsParams{} -} - -// GetGroupsParams contains all the bound params for the get groups operation -// typically these are obtained from a http.Request -// -// swagger:parameters getGroups -type GetGroupsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetGroupsParams() beforehand. -func (o *GetGroupsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetGroupsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *GetGroupsParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} diff --git a/operations/group/get_groups_responses.go b/operations/group/get_groups_responses.go deleted file mode 100644 index 9dea6fbc..00000000 --- a/operations/group/get_groups_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetGroupsOKCode is the HTTP code returned for type GetGroupsOK -const GetGroupsOKCode int = 200 - -/* -GetGroupsOK Successful operation - -swagger:response getGroupsOK -*/ -type GetGroupsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Groups `json:"body,omitempty"` -} - -// NewGetGroupsOK creates GetGroupsOK with default headers values -func NewGetGroupsOK() *GetGroupsOK { - - return &GetGroupsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get groups o k response -func (o *GetGroupsOK) WithConfigurationVersion(configurationVersion string) *GetGroupsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get groups o k response -func (o *GetGroupsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get groups o k response -func (o *GetGroupsOK) WithPayload(payload models.Groups) *GetGroupsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get groups o k response -func (o *GetGroupsOK) SetPayload(payload models.Groups) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGroupsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Groups{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetGroupsDefault General Error - -swagger:response getGroupsDefault -*/ -type GetGroupsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetGroupsDefault creates GetGroupsDefault with default headers values -func NewGetGroupsDefault(code int) *GetGroupsDefault { - if code <= 0 { - code = 500 - } - - return &GetGroupsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get groups default response -func (o *GetGroupsDefault) WithStatusCode(code int) *GetGroupsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get groups default response -func (o *GetGroupsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get groups default response -func (o *GetGroupsDefault) WithConfigurationVersion(configurationVersion string) *GetGroupsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get groups default response -func (o *GetGroupsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get groups default response -func (o *GetGroupsDefault) WithPayload(payload *models.Error) *GetGroupsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get groups default response -func (o *GetGroupsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetGroupsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/group/get_groups_urlbuilder.go b/operations/group/get_groups_urlbuilder.go deleted file mode 100644 index c8e303e9..00000000 --- a/operations/group/get_groups_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetGroupsURL generates an URL for the get groups operation -type GetGroupsURL struct { - TransactionID *string - Userlist string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGroupsURL) WithBasePath(bp string) *GetGroupsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetGroupsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetGroupsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/groups" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetGroupsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetGroupsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetGroupsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetGroupsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetGroupsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/group/replace_group.go b/operations/group/replace_group.go deleted file mode 100644 index 0d483c9a..00000000 --- a/operations/group/replace_group.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceGroupHandlerFunc turns a function with the right signature into a replace group handler -type ReplaceGroupHandlerFunc func(ReplaceGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceGroupHandlerFunc) Handle(params ReplaceGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceGroupHandler interface for that can handle valid replace group params -type ReplaceGroupHandler interface { - Handle(ReplaceGroupParams, interface{}) middleware.Responder -} - -// NewReplaceGroup creates a new http.Handler for the replace group operation -func NewReplaceGroup(ctx *middleware.Context, handler ReplaceGroupHandler) *ReplaceGroup { - return &ReplaceGroup{Context: ctx, Handler: handler} -} - -/* - ReplaceGroup swagger:route PUT /services/haproxy/configuration/groups/{name} Group replaceGroup - -Replace a group -*/ -type ReplaceGroup struct { - Context *middleware.Context - Handler ReplaceGroupHandler -} - -func (o *ReplaceGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/group/replace_group_parameters.go b/operations/group/replace_group_parameters.go deleted file mode 100644 index 6277ad6f..00000000 --- a/operations/group/replace_group_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceGroupParams creates a new ReplaceGroupParams object -// with the default values initialized. -func NewReplaceGroupParams() ReplaceGroupParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceGroupParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceGroupParams contains all the bound params for the replace group operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceGroup -type ReplaceGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Group - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*group name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceGroupParams() beforehand. -func (o *ReplaceGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Group - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceGroupParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceGroupParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *ReplaceGroupParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/group/replace_group_responses.go b/operations/group/replace_group_responses.go deleted file mode 100644 index 28713fcf..00000000 --- a/operations/group/replace_group_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceGroupOKCode is the HTTP code returned for type ReplaceGroupOK -const ReplaceGroupOKCode int = 200 - -/* -ReplaceGroupOK Group replaced - -swagger:response replaceGroupOK -*/ -type ReplaceGroupOK struct { - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewReplaceGroupOK creates ReplaceGroupOK with default headers values -func NewReplaceGroupOK() *ReplaceGroupOK { - - return &ReplaceGroupOK{} -} - -// WithPayload adds the payload to the replace group o k response -func (o *ReplaceGroupOK) WithPayload(payload *models.Group) *ReplaceGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace group o k response -func (o *ReplaceGroupOK) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceGroupAcceptedCode is the HTTP code returned for type ReplaceGroupAccepted -const ReplaceGroupAcceptedCode int = 202 - -/* -ReplaceGroupAccepted Configuration change accepted and reload requested - -swagger:response replaceGroupAccepted -*/ -type ReplaceGroupAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewReplaceGroupAccepted creates ReplaceGroupAccepted with default headers values -func NewReplaceGroupAccepted() *ReplaceGroupAccepted { - - return &ReplaceGroupAccepted{} -} - -// WithReloadID adds the reloadId to the replace group accepted response -func (o *ReplaceGroupAccepted) WithReloadID(reloadID string) *ReplaceGroupAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace group accepted response -func (o *ReplaceGroupAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace group accepted response -func (o *ReplaceGroupAccepted) WithPayload(payload *models.Group) *ReplaceGroupAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace group accepted response -func (o *ReplaceGroupAccepted) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGroupAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceGroupBadRequestCode is the HTTP code returned for type ReplaceGroupBadRequest -const ReplaceGroupBadRequestCode int = 400 - -/* -ReplaceGroupBadRequest Bad request - -swagger:response replaceGroupBadRequest -*/ -type ReplaceGroupBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceGroupBadRequest creates ReplaceGroupBadRequest with default headers values -func NewReplaceGroupBadRequest() *ReplaceGroupBadRequest { - - return &ReplaceGroupBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace group bad request response -func (o *ReplaceGroupBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceGroupBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace group bad request response -func (o *ReplaceGroupBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace group bad request response -func (o *ReplaceGroupBadRequest) WithPayload(payload *models.Error) *ReplaceGroupBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace group bad request response -func (o *ReplaceGroupBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceGroupNotFoundCode is the HTTP code returned for type ReplaceGroupNotFound -const ReplaceGroupNotFoundCode int = 404 - -/* -ReplaceGroupNotFound The specified resource was not found - -swagger:response replaceGroupNotFound -*/ -type ReplaceGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceGroupNotFound creates ReplaceGroupNotFound with default headers values -func NewReplaceGroupNotFound() *ReplaceGroupNotFound { - - return &ReplaceGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace group not found response -func (o *ReplaceGroupNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace group not found response -func (o *ReplaceGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace group not found response -func (o *ReplaceGroupNotFound) WithPayload(payload *models.Error) *ReplaceGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace group not found response -func (o *ReplaceGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceGroupDefault General Error - -swagger:response replaceGroupDefault -*/ -type ReplaceGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceGroupDefault creates ReplaceGroupDefault with default headers values -func NewReplaceGroupDefault(code int) *ReplaceGroupDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace group default response -func (o *ReplaceGroupDefault) WithStatusCode(code int) *ReplaceGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace group default response -func (o *ReplaceGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace group default response -func (o *ReplaceGroupDefault) WithConfigurationVersion(configurationVersion string) *ReplaceGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace group default response -func (o *ReplaceGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace group default response -func (o *ReplaceGroupDefault) WithPayload(payload *models.Error) *ReplaceGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace group default response -func (o *ReplaceGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/group/replace_group_urlbuilder.go b/operations/group/replace_group_urlbuilder.go deleted file mode 100644 index 2cd07d3e..00000000 --- a/operations/group/replace_group_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceGroupURL generates an URL for the replace group operation -type ReplaceGroupURL struct { - Name string - - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceGroupURL) WithBasePath(bp string) *ReplaceGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/health/get_health.go b/operations/health/get_health.go deleted file mode 100644 index 52491667..00000000 --- a/operations/health/get_health.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHealthHandlerFunc turns a function with the right signature into a get health handler -type GetHealthHandlerFunc func(GetHealthParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHealthHandlerFunc) Handle(params GetHealthParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHealthHandler interface for that can handle valid get health params -type GetHealthHandler interface { - Handle(GetHealthParams, interface{}) middleware.Responder -} - -// NewGetHealth creates a new http.Handler for the get health operation -func NewGetHealth(ctx *middleware.Context, handler GetHealthHandler) *GetHealth { - return &GetHealth{Context: ctx, Handler: handler} -} - -/* - GetHealth swagger:route GET /health Health getHealth - -# Return managed services health - -Return managed services health -*/ -type GetHealth struct { - Context *middleware.Context - Handler GetHealthHandler -} - -func (o *GetHealth) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHealthParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/health/get_health_parameters.go b/operations/health/get_health_parameters.go deleted file mode 100644 index 4a5e5d86..00000000 --- a/operations/health/get_health_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetHealthParams creates a new GetHealthParams object -// -// There are no default values defined in the spec. -func NewGetHealthParams() GetHealthParams { - - return GetHealthParams{} -} - -// GetHealthParams contains all the bound params for the get health operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHealth -type GetHealthParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHealthParams() beforehand. -func (o *GetHealthParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/health/get_health_responses.go b/operations/health/get_health_responses.go deleted file mode 100644 index adf0d5cf..00000000 --- a/operations/health/get_health_responses.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHealthOKCode is the HTTP code returned for type GetHealthOK -const GetHealthOKCode int = 200 - -/* -GetHealthOK Success - -swagger:response getHealthOK -*/ -type GetHealthOK struct { - - /* - In: Body - */ - Payload *models.Health `json:"body,omitempty"` -} - -// NewGetHealthOK creates GetHealthOK with default headers values -func NewGetHealthOK() *GetHealthOK { - - return &GetHealthOK{} -} - -// WithPayload adds the payload to the get health o k response -func (o *GetHealthOK) WithPayload(payload *models.Health) *GetHealthOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get health o k response -func (o *GetHealthOK) SetPayload(payload *models.Health) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHealthOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHealthDefault General Error - -swagger:response getHealthDefault -*/ -type GetHealthDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHealthDefault creates GetHealthDefault with default headers values -func NewGetHealthDefault(code int) *GetHealthDefault { - if code <= 0 { - code = 500 - } - - return &GetHealthDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get health default response -func (o *GetHealthDefault) WithStatusCode(code int) *GetHealthDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get health default response -func (o *GetHealthDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get health default response -func (o *GetHealthDefault) WithConfigurationVersion(configurationVersion string) *GetHealthDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get health default response -func (o *GetHealthDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get health default response -func (o *GetHealthDefault) WithPayload(payload *models.Error) *GetHealthDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get health default response -func (o *GetHealthDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHealthDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/health/get_health_urlbuilder.go b/operations/health/get_health_urlbuilder.go deleted file mode 100644 index d9be758e..00000000 --- a/operations/health/get_health_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetHealthURL generates an URL for the get health operation -type GetHealthURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHealthURL) WithBasePath(bp string) *GetHealthURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHealthURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHealthURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/health" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHealthURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHealthURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHealthURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHealthURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHealthURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHealthURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_backend.go b/operations/http_after_response_rule/create_http_after_response_rule_backend.go deleted file mode 100644 index f118f10a..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a create HTTP after response rule backend handler -type CreateHTTPAfterResponseRuleBackendHandlerFunc func(CreateHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPAfterResponseRuleBackendHandlerFunc) Handle(params CreateHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPAfterResponseRuleBackendHandler interface for that can handle valid create HTTP after response rule backend params -type CreateHTTPAfterResponseRuleBackendHandler interface { - Handle(CreateHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPAfterResponseRuleBackend creates a new http.Handler for the create HTTP after response rule backend operation -func NewCreateHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler CreateHTTPAfterResponseRuleBackendHandler) *CreateHTTPAfterResponseRuleBackend { - return &CreateHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPAfterResponseRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule createHttpAfterResponseRuleBackend - -# Add a new HTTP After Response Rule - -Adds a new HTTP After Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler CreateHTTPAfterResponseRuleBackendHandler -} - -func (o *CreateHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/create_http_after_response_rule_backend_parameters.go deleted file mode 100644 index 619314d1..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPAfterResponseRuleBackendParams creates a new CreateHTTPAfterResponseRuleBackendParams object -// with the default values initialized. -func NewCreateHTTPAfterResponseRuleBackendParams() CreateHTTPAfterResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPAfterResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPAfterResponseRuleBackendParams contains all the bound params for the create HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPAfterResponseRuleBackend -type CreateHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPAfterResponseRuleBackendParams() beforehand. -func (o *CreateHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPAfterResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPAfterResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPAfterResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPAfterResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/create_http_after_response_rule_backend_responses.go deleted file mode 100644 index 0b62f5d7..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPAfterResponseRuleBackendCreatedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleBackendCreated -const CreateHTTPAfterResponseRuleBackendCreatedCode int = 201 - -/* -CreateHTTPAfterResponseRuleBackendCreated HTTP Response Rule created - -swagger:response createHttpAfterResponseRuleBackendCreated -*/ -type CreateHTTPAfterResponseRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleBackendCreated creates CreateHTTPAfterResponseRuleBackendCreated with default headers values -func NewCreateHTTPAfterResponseRuleBackendCreated() *CreateHTTPAfterResponseRuleBackendCreated { - - return &CreateHTTPAfterResponseRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Http after response rule backend created response -func (o *CreateHTTPAfterResponseRuleBackendCreated) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule backend created response -func (o *CreateHTTPAfterResponseRuleBackendCreated) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleBackendAcceptedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleBackendAccepted -const CreateHTTPAfterResponseRuleBackendAcceptedCode int = 202 - -/* -CreateHTTPAfterResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createHttpAfterResponseRuleBackendAccepted -*/ -type CreateHTTPAfterResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleBackendAccepted creates CreateHTTPAfterResponseRuleBackendAccepted with default headers values -func NewCreateHTTPAfterResponseRuleBackendAccepted() *CreateHTTPAfterResponseRuleBackendAccepted { - - return &CreateHTTPAfterResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http after response rule backend accepted response -func (o *CreateHTTPAfterResponseRuleBackendAccepted) WithReloadID(reloadID string) *CreateHTTPAfterResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http after response rule backend accepted response -func (o *CreateHTTPAfterResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http after response rule backend accepted response -func (o *CreateHTTPAfterResponseRuleBackendAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule backend accepted response -func (o *CreateHTTPAfterResponseRuleBackendAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleBackendBadRequestCode is the HTTP code returned for type CreateHTTPAfterResponseRuleBackendBadRequest -const CreateHTTPAfterResponseRuleBackendBadRequestCode int = 400 - -/* -CreateHTTPAfterResponseRuleBackendBadRequest Bad request - -swagger:response createHttpAfterResponseRuleBackendBadRequest -*/ -type CreateHTTPAfterResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleBackendBadRequest creates CreateHTTPAfterResponseRuleBackendBadRequest with default headers values -func NewCreateHTTPAfterResponseRuleBackendBadRequest() *CreateHTTPAfterResponseRuleBackendBadRequest { - - return &CreateHTTPAfterResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule backend bad request response -func (o *CreateHTTPAfterResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule backend bad request response -func (o *CreateHTTPAfterResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule backend bad request response -func (o *CreateHTTPAfterResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule backend bad request response -func (o *CreateHTTPAfterResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleBackendConflictCode is the HTTP code returned for type CreateHTTPAfterResponseRuleBackendConflict -const CreateHTTPAfterResponseRuleBackendConflictCode int = 409 - -/* -CreateHTTPAfterResponseRuleBackendConflict The specified resource already exists - -swagger:response createHttpAfterResponseRuleBackendConflict -*/ -type CreateHTTPAfterResponseRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleBackendConflict creates CreateHTTPAfterResponseRuleBackendConflict with default headers values -func NewCreateHTTPAfterResponseRuleBackendConflict() *CreateHTTPAfterResponseRuleBackendConflict { - - return &CreateHTTPAfterResponseRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule backend conflict response -func (o *CreateHTTPAfterResponseRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule backend conflict response -func (o *CreateHTTPAfterResponseRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule backend conflict response -func (o *CreateHTTPAfterResponseRuleBackendConflict) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule backend conflict response -func (o *CreateHTTPAfterResponseRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPAfterResponseRuleBackendDefault General Error - -swagger:response createHttpAfterResponseRuleBackendDefault -*/ -type CreateHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleBackendDefault creates CreateHTTPAfterResponseRuleBackendDefault with default headers values -func NewCreateHTTPAfterResponseRuleBackendDefault(code int) *CreateHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *CreateHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP after response rule backend default response -func (o *CreateHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/create_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index 10def3cd..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPAfterResponseRuleBackendURL generates an URL for the create HTTP after response rule backend operation -type CreateHTTPAfterResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *CreateHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPAfterResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_defaults.go b/operations/http_after_response_rule/create_http_after_response_rule_defaults.go deleted file mode 100644 index 35a1f880..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a create HTTP after response rule defaults handler -type CreateHTTPAfterResponseRuleDefaultsHandlerFunc func(CreateHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params CreateHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid create HTTP after response rule defaults params -type CreateHTTPAfterResponseRuleDefaultsHandler interface { - Handle(CreateHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateHTTPAfterResponseRuleDefaults creates a new http.Handler for the create HTTP after response rule defaults operation -func NewCreateHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler CreateHTTPAfterResponseRuleDefaultsHandler) *CreateHTTPAfterResponseRuleDefaults { - return &CreateHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateHTTPAfterResponseRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule createHttpAfterResponseRuleDefaults - -# Add a new HTTP After Response Rule - -Adds a new HTTP After Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler CreateHTTPAfterResponseRuleDefaultsHandler -} - -func (o *CreateHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/create_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index dfd9ab9c..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPAfterResponseRuleDefaultsParams creates a new CreateHTTPAfterResponseRuleDefaultsParams object -// with the default values initialized. -func NewCreateHTTPAfterResponseRuleDefaultsParams() CreateHTTPAfterResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPAfterResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPAfterResponseRuleDefaultsParams contains all the bound params for the create HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPAfterResponseRuleDefaults -type CreateHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPAfterResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPAfterResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/create_http_after_response_rule_defaults_responses.go deleted file mode 100644 index af5c2ac1..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPAfterResponseRuleDefaultsCreatedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleDefaultsCreated -const CreateHTTPAfterResponseRuleDefaultsCreatedCode int = 201 - -/* -CreateHTTPAfterResponseRuleDefaultsCreated HTTP Response Rule created - -swagger:response createHttpAfterResponseRuleDefaultsCreated -*/ -type CreateHTTPAfterResponseRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleDefaultsCreated creates CreateHTTPAfterResponseRuleDefaultsCreated with default headers values -func NewCreateHTTPAfterResponseRuleDefaultsCreated() *CreateHTTPAfterResponseRuleDefaultsCreated { - - return &CreateHTTPAfterResponseRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Http after response rule defaults created response -func (o *CreateHTTPAfterResponseRuleDefaultsCreated) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule defaults created response -func (o *CreateHTTPAfterResponseRuleDefaultsCreated) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleDefaultsAcceptedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleDefaultsAccepted -const CreateHTTPAfterResponseRuleDefaultsAcceptedCode int = 202 - -/* -CreateHTTPAfterResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createHttpAfterResponseRuleDefaultsAccepted -*/ -type CreateHTTPAfterResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleDefaultsAccepted creates CreateHTTPAfterResponseRuleDefaultsAccepted with default headers values -func NewCreateHTTPAfterResponseRuleDefaultsAccepted() *CreateHTTPAfterResponseRuleDefaultsAccepted { - - return &CreateHTTPAfterResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Http after response rule defaults accepted response -func (o *CreateHTTPAfterResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateHTTPAfterResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http after response rule defaults accepted response -func (o *CreateHTTPAfterResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http after response rule defaults accepted response -func (o *CreateHTTPAfterResponseRuleDefaultsAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule defaults accepted response -func (o *CreateHTTPAfterResponseRuleDefaultsAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleDefaultsBadRequestCode is the HTTP code returned for type CreateHTTPAfterResponseRuleDefaultsBadRequest -const CreateHTTPAfterResponseRuleDefaultsBadRequestCode int = 400 - -/* -CreateHTTPAfterResponseRuleDefaultsBadRequest Bad request - -swagger:response createHttpAfterResponseRuleDefaultsBadRequest -*/ -type CreateHTTPAfterResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleDefaultsBadRequest creates CreateHTTPAfterResponseRuleDefaultsBadRequest with default headers values -func NewCreateHTTPAfterResponseRuleDefaultsBadRequest() *CreateHTTPAfterResponseRuleDefaultsBadRequest { - - return &CreateHTTPAfterResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule defaults bad request response -func (o *CreateHTTPAfterResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule defaults bad request response -func (o *CreateHTTPAfterResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule defaults bad request response -func (o *CreateHTTPAfterResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule defaults bad request response -func (o *CreateHTTPAfterResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleDefaultsConflictCode is the HTTP code returned for type CreateHTTPAfterResponseRuleDefaultsConflict -const CreateHTTPAfterResponseRuleDefaultsConflictCode int = 409 - -/* -CreateHTTPAfterResponseRuleDefaultsConflict The specified resource already exists - -swagger:response createHttpAfterResponseRuleDefaultsConflict -*/ -type CreateHTTPAfterResponseRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleDefaultsConflict creates CreateHTTPAfterResponseRuleDefaultsConflict with default headers values -func NewCreateHTTPAfterResponseRuleDefaultsConflict() *CreateHTTPAfterResponseRuleDefaultsConflict { - - return &CreateHTTPAfterResponseRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule defaults conflict response -func (o *CreateHTTPAfterResponseRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule defaults conflict response -func (o *CreateHTTPAfterResponseRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule defaults conflict response -func (o *CreateHTTPAfterResponseRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule defaults conflict response -func (o *CreateHTTPAfterResponseRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response createHttpAfterResponseRuleDefaultsDefault -*/ -type CreateHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleDefaultsDefault creates CreateHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewCreateHTTPAfterResponseRuleDefaultsDefault(code int) *CreateHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *CreateHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP after response rule defaults default response -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/create_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index ff023151..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPAfterResponseRuleDefaultsURL generates an URL for the create HTTP after response rule defaults operation -type CreateHTTPAfterResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *CreateHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPAfterResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_frontend.go b/operations/http_after_response_rule/create_http_after_response_rule_frontend.go deleted file mode 100644 index 2744b175..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a create HTTP after response rule frontend handler -type CreateHTTPAfterResponseRuleFrontendHandlerFunc func(CreateHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params CreateHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPAfterResponseRuleFrontendHandler interface for that can handle valid create HTTP after response rule frontend params -type CreateHTTPAfterResponseRuleFrontendHandler interface { - Handle(CreateHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPAfterResponseRuleFrontend creates a new http.Handler for the create HTTP after response rule frontend operation -func NewCreateHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler CreateHTTPAfterResponseRuleFrontendHandler) *CreateHTTPAfterResponseRuleFrontend { - return &CreateHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPAfterResponseRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule createHttpAfterResponseRuleFrontend - -# Add a new HTTP After Response Rule - -Adds a new HTTP After Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler CreateHTTPAfterResponseRuleFrontendHandler -} - -func (o *CreateHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/create_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index b4c0fec9..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPAfterResponseRuleFrontendParams creates a new CreateHTTPAfterResponseRuleFrontendParams object -// with the default values initialized. -func NewCreateHTTPAfterResponseRuleFrontendParams() CreateHTTPAfterResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPAfterResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPAfterResponseRuleFrontendParams contains all the bound params for the create HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPAfterResponseRuleFrontend -type CreateHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *CreateHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPAfterResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPAfterResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPAfterResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPAfterResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/create_http_after_response_rule_frontend_responses.go deleted file mode 100644 index 8582bfaa..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPAfterResponseRuleFrontendCreatedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleFrontendCreated -const CreateHTTPAfterResponseRuleFrontendCreatedCode int = 201 - -/* -CreateHTTPAfterResponseRuleFrontendCreated HTTP Response Rule created - -swagger:response createHttpAfterResponseRuleFrontendCreated -*/ -type CreateHTTPAfterResponseRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleFrontendCreated creates CreateHTTPAfterResponseRuleFrontendCreated with default headers values -func NewCreateHTTPAfterResponseRuleFrontendCreated() *CreateHTTPAfterResponseRuleFrontendCreated { - - return &CreateHTTPAfterResponseRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Http after response rule frontend created response -func (o *CreateHTTPAfterResponseRuleFrontendCreated) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule frontend created response -func (o *CreateHTTPAfterResponseRuleFrontendCreated) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleFrontendAcceptedCode is the HTTP code returned for type CreateHTTPAfterResponseRuleFrontendAccepted -const CreateHTTPAfterResponseRuleFrontendAcceptedCode int = 202 - -/* -CreateHTTPAfterResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createHttpAfterResponseRuleFrontendAccepted -*/ -type CreateHTTPAfterResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleFrontendAccepted creates CreateHTTPAfterResponseRuleFrontendAccepted with default headers values -func NewCreateHTTPAfterResponseRuleFrontendAccepted() *CreateHTTPAfterResponseRuleFrontendAccepted { - - return &CreateHTTPAfterResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http after response rule frontend accepted response -func (o *CreateHTTPAfterResponseRuleFrontendAccepted) WithReloadID(reloadID string) *CreateHTTPAfterResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http after response rule frontend accepted response -func (o *CreateHTTPAfterResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http after response rule frontend accepted response -func (o *CreateHTTPAfterResponseRuleFrontendAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *CreateHTTPAfterResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule frontend accepted response -func (o *CreateHTTPAfterResponseRuleFrontendAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleFrontendBadRequestCode is the HTTP code returned for type CreateHTTPAfterResponseRuleFrontendBadRequest -const CreateHTTPAfterResponseRuleFrontendBadRequestCode int = 400 - -/* -CreateHTTPAfterResponseRuleFrontendBadRequest Bad request - -swagger:response createHttpAfterResponseRuleFrontendBadRequest -*/ -type CreateHTTPAfterResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleFrontendBadRequest creates CreateHTTPAfterResponseRuleFrontendBadRequest with default headers values -func NewCreateHTTPAfterResponseRuleFrontendBadRequest() *CreateHTTPAfterResponseRuleFrontendBadRequest { - - return &CreateHTTPAfterResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule frontend bad request response -func (o *CreateHTTPAfterResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule frontend bad request response -func (o *CreateHTTPAfterResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule frontend bad request response -func (o *CreateHTTPAfterResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule frontend bad request response -func (o *CreateHTTPAfterResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPAfterResponseRuleFrontendConflictCode is the HTTP code returned for type CreateHTTPAfterResponseRuleFrontendConflict -const CreateHTTPAfterResponseRuleFrontendConflictCode int = 409 - -/* -CreateHTTPAfterResponseRuleFrontendConflict The specified resource already exists - -swagger:response createHttpAfterResponseRuleFrontendConflict -*/ -type CreateHTTPAfterResponseRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleFrontendConflict creates CreateHTTPAfterResponseRuleFrontendConflict with default headers values -func NewCreateHTTPAfterResponseRuleFrontendConflict() *CreateHTTPAfterResponseRuleFrontendConflict { - - return &CreateHTTPAfterResponseRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http after response rule frontend conflict response -func (o *CreateHTTPAfterResponseRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http after response rule frontend conflict response -func (o *CreateHTTPAfterResponseRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http after response rule frontend conflict response -func (o *CreateHTTPAfterResponseRuleFrontendConflict) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http after response rule frontend conflict response -func (o *CreateHTTPAfterResponseRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response createHttpAfterResponseRuleFrontendDefault -*/ -type CreateHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPAfterResponseRuleFrontendDefault creates CreateHTTPAfterResponseRuleFrontendDefault with default headers values -func NewCreateHTTPAfterResponseRuleFrontendDefault(code int) *CreateHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *CreateHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *CreateHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP after response rule frontend default response -func (o *CreateHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/create_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/create_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index dfbd5d28..00000000 --- a/operations/http_after_response_rule/create_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPAfterResponseRuleFrontendURL generates an URL for the create HTTP after response rule frontend operation -type CreateHTTPAfterResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *CreateHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPAfterResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_backend.go b/operations/http_after_response_rule/delete_http_after_response_rule_backend.go deleted file mode 100644 index 34df7c33..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a delete HTTP after response rule backend handler -type DeleteHTTPAfterResponseRuleBackendHandlerFunc func(DeleteHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPAfterResponseRuleBackendHandlerFunc) Handle(params DeleteHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPAfterResponseRuleBackendHandler interface for that can handle valid delete HTTP after response rule backend params -type DeleteHTTPAfterResponseRuleBackendHandler interface { - Handle(DeleteHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPAfterResponseRuleBackend creates a new http.Handler for the delete HTTP after response rule backend operation -func NewDeleteHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler DeleteHTTPAfterResponseRuleBackendHandler) *DeleteHTTPAfterResponseRuleBackend { - return &DeleteHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPAfterResponseRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule deleteHttpAfterResponseRuleBackend - -# Delete a HTTP After Response Rule - -Deletes a HTTP After Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler DeleteHTTPAfterResponseRuleBackendHandler -} - -func (o *DeleteHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/delete_http_after_response_rule_backend_parameters.go deleted file mode 100644 index 2991d84a..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPAfterResponseRuleBackendParams creates a new DeleteHTTPAfterResponseRuleBackendParams object -// with the default values initialized. -func NewDeleteHTTPAfterResponseRuleBackendParams() DeleteHTTPAfterResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPAfterResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPAfterResponseRuleBackendParams contains all the bound params for the delete HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPAfterResponseRuleBackend -type DeleteHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPAfterResponseRuleBackendParams() beforehand. -func (o *DeleteHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPAfterResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPAfterResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPAfterResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPAfterResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/delete_http_after_response_rule_backend_responses.go deleted file mode 100644 index f54d702a..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPAfterResponseRuleBackendAcceptedCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleBackendAccepted -const DeleteHTTPAfterResponseRuleBackendAcceptedCode int = 202 - -/* -DeleteHTTPAfterResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpAfterResponseRuleBackendAccepted -*/ -type DeleteHTTPAfterResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPAfterResponseRuleBackendAccepted creates DeleteHTTPAfterResponseRuleBackendAccepted with default headers values -func NewDeleteHTTPAfterResponseRuleBackendAccepted() *DeleteHTTPAfterResponseRuleBackendAccepted { - - return &DeleteHTTPAfterResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http after response rule backend accepted response -func (o *DeleteHTTPAfterResponseRuleBackendAccepted) WithReloadID(reloadID string) *DeleteHTTPAfterResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http after response rule backend accepted response -func (o *DeleteHTTPAfterResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPAfterResponseRuleBackendNoContentCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleBackendNoContent -const DeleteHTTPAfterResponseRuleBackendNoContentCode int = 204 - -/* -DeleteHTTPAfterResponseRuleBackendNoContent HTTP After Response Rule deleted - -swagger:response deleteHttpAfterResponseRuleBackendNoContent -*/ -type DeleteHTTPAfterResponseRuleBackendNoContent struct { -} - -// NewDeleteHTTPAfterResponseRuleBackendNoContent creates DeleteHTTPAfterResponseRuleBackendNoContent with default headers values -func NewDeleteHTTPAfterResponseRuleBackendNoContent() *DeleteHTTPAfterResponseRuleBackendNoContent { - - return &DeleteHTTPAfterResponseRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPAfterResponseRuleBackendNotFoundCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleBackendNotFound -const DeleteHTTPAfterResponseRuleBackendNotFoundCode int = 404 - -/* -DeleteHTTPAfterResponseRuleBackendNotFound The specified resource was not found - -swagger:response deleteHttpAfterResponseRuleBackendNotFound -*/ -type DeleteHTTPAfterResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleBackendNotFound creates DeleteHTTPAfterResponseRuleBackendNotFound with default headers values -func NewDeleteHTTPAfterResponseRuleBackendNotFound() *DeleteHTTPAfterResponseRuleBackendNotFound { - - return &DeleteHTTPAfterResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http after response rule backend not found response -func (o *DeleteHTTPAfterResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http after response rule backend not found response -func (o *DeleteHTTPAfterResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http after response rule backend not found response -func (o *DeleteHTTPAfterResponseRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http after response rule backend not found response -func (o *DeleteHTTPAfterResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPAfterResponseRuleBackendDefault General Error - -swagger:response deleteHttpAfterResponseRuleBackendDefault -*/ -type DeleteHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleBackendDefault creates DeleteHTTPAfterResponseRuleBackendDefault with default headers values -func NewDeleteHTTPAfterResponseRuleBackendDefault(code int) *DeleteHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *DeleteHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP after response rule backend default response -func (o *DeleteHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/delete_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index 15f3cb55..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPAfterResponseRuleBackendURL generates an URL for the delete HTTP after response rule backend operation -type DeleteHTTPAfterResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *DeleteHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPAfterResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_defaults.go b/operations/http_after_response_rule/delete_http_after_response_rule_defaults.go deleted file mode 100644 index 7be69e53..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a delete HTTP after response rule defaults handler -type DeleteHTTPAfterResponseRuleDefaultsHandlerFunc func(DeleteHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params DeleteHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid delete HTTP after response rule defaults params -type DeleteHTTPAfterResponseRuleDefaultsHandler interface { - Handle(DeleteHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPAfterResponseRuleDefaults creates a new http.Handler for the delete HTTP after response rule defaults operation -func NewDeleteHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler DeleteHTTPAfterResponseRuleDefaultsHandler) *DeleteHTTPAfterResponseRuleDefaults { - return &DeleteHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPAfterResponseRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule deleteHttpAfterResponseRuleDefaults - -# Delete a HTTP After Response Rule - -Deletes a HTTP After Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler DeleteHTTPAfterResponseRuleDefaultsHandler -} - -func (o *DeleteHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/delete_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index 70e173f5..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPAfterResponseRuleDefaultsParams creates a new DeleteHTTPAfterResponseRuleDefaultsParams object -// with the default values initialized. -func NewDeleteHTTPAfterResponseRuleDefaultsParams() DeleteHTTPAfterResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPAfterResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPAfterResponseRuleDefaultsParams contains all the bound params for the delete HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPAfterResponseRuleDefaults -type DeleteHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPAfterResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPAfterResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/delete_http_after_response_rule_defaults_responses.go deleted file mode 100644 index 66cf1e49..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPAfterResponseRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleDefaultsAccepted -const DeleteHTTPAfterResponseRuleDefaultsAcceptedCode int = 202 - -/* -DeleteHTTPAfterResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpAfterResponseRuleDefaultsAccepted -*/ -type DeleteHTTPAfterResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPAfterResponseRuleDefaultsAccepted creates DeleteHTTPAfterResponseRuleDefaultsAccepted with default headers values -func NewDeleteHTTPAfterResponseRuleDefaultsAccepted() *DeleteHTTPAfterResponseRuleDefaultsAccepted { - - return &DeleteHTTPAfterResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http after response rule defaults accepted response -func (o *DeleteHTTPAfterResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteHTTPAfterResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http after response rule defaults accepted response -func (o *DeleteHTTPAfterResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPAfterResponseRuleDefaultsNoContentCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleDefaultsNoContent -const DeleteHTTPAfterResponseRuleDefaultsNoContentCode int = 204 - -/* -DeleteHTTPAfterResponseRuleDefaultsNoContent HTTP After Response Rule deleted - -swagger:response deleteHttpAfterResponseRuleDefaultsNoContent -*/ -type DeleteHTTPAfterResponseRuleDefaultsNoContent struct { -} - -// NewDeleteHTTPAfterResponseRuleDefaultsNoContent creates DeleteHTTPAfterResponseRuleDefaultsNoContent with default headers values -func NewDeleteHTTPAfterResponseRuleDefaultsNoContent() *DeleteHTTPAfterResponseRuleDefaultsNoContent { - - return &DeleteHTTPAfterResponseRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPAfterResponseRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleDefaultsNotFound -const DeleteHTTPAfterResponseRuleDefaultsNotFoundCode int = 404 - -/* -DeleteHTTPAfterResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteHttpAfterResponseRuleDefaultsNotFound -*/ -type DeleteHTTPAfterResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleDefaultsNotFound creates DeleteHTTPAfterResponseRuleDefaultsNotFound with default headers values -func NewDeleteHTTPAfterResponseRuleDefaultsNotFound() *DeleteHTTPAfterResponseRuleDefaultsNotFound { - - return &DeleteHTTPAfterResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http after response rule defaults not found response -func (o *DeleteHTTPAfterResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http after response rule defaults not found response -func (o *DeleteHTTPAfterResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http after response rule defaults not found response -func (o *DeleteHTTPAfterResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http after response rule defaults not found response -func (o *DeleteHTTPAfterResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response deleteHttpAfterResponseRuleDefaultsDefault -*/ -type DeleteHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleDefaultsDefault creates DeleteHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewDeleteHTTPAfterResponseRuleDefaultsDefault(code int) *DeleteHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *DeleteHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP after response rule defaults default response -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/delete_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 0c077d79..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPAfterResponseRuleDefaultsURL generates an URL for the delete HTTP after response rule defaults operation -type DeleteHTTPAfterResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *DeleteHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPAfterResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_frontend.go b/operations/http_after_response_rule/delete_http_after_response_rule_frontend.go deleted file mode 100644 index 1e6224d5..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a delete HTTP after response rule frontend handler -type DeleteHTTPAfterResponseRuleFrontendHandlerFunc func(DeleteHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params DeleteHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPAfterResponseRuleFrontendHandler interface for that can handle valid delete HTTP after response rule frontend params -type DeleteHTTPAfterResponseRuleFrontendHandler interface { - Handle(DeleteHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPAfterResponseRuleFrontend creates a new http.Handler for the delete HTTP after response rule frontend operation -func NewDeleteHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler DeleteHTTPAfterResponseRuleFrontendHandler) *DeleteHTTPAfterResponseRuleFrontend { - return &DeleteHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPAfterResponseRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule deleteHttpAfterResponseRuleFrontend - -# Delete a HTTP After Response Rule - -Deletes a HTTP After Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler DeleteHTTPAfterResponseRuleFrontendHandler -} - -func (o *DeleteHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/delete_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index b64c8963..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPAfterResponseRuleFrontendParams creates a new DeleteHTTPAfterResponseRuleFrontendParams object -// with the default values initialized. -func NewDeleteHTTPAfterResponseRuleFrontendParams() DeleteHTTPAfterResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPAfterResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPAfterResponseRuleFrontendParams contains all the bound params for the delete HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPAfterResponseRuleFrontend -type DeleteHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPAfterResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPAfterResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/delete_http_after_response_rule_frontend_responses.go deleted file mode 100644 index af41a95e..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPAfterResponseRuleFrontendAcceptedCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleFrontendAccepted -const DeleteHTTPAfterResponseRuleFrontendAcceptedCode int = 202 - -/* -DeleteHTTPAfterResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpAfterResponseRuleFrontendAccepted -*/ -type DeleteHTTPAfterResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPAfterResponseRuleFrontendAccepted creates DeleteHTTPAfterResponseRuleFrontendAccepted with default headers values -func NewDeleteHTTPAfterResponseRuleFrontendAccepted() *DeleteHTTPAfterResponseRuleFrontendAccepted { - - return &DeleteHTTPAfterResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http after response rule frontend accepted response -func (o *DeleteHTTPAfterResponseRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteHTTPAfterResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http after response rule frontend accepted response -func (o *DeleteHTTPAfterResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPAfterResponseRuleFrontendNoContentCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleFrontendNoContent -const DeleteHTTPAfterResponseRuleFrontendNoContentCode int = 204 - -/* -DeleteHTTPAfterResponseRuleFrontendNoContent HTTP After Response Rule deleted - -swagger:response deleteHttpAfterResponseRuleFrontendNoContent -*/ -type DeleteHTTPAfterResponseRuleFrontendNoContent struct { -} - -// NewDeleteHTTPAfterResponseRuleFrontendNoContent creates DeleteHTTPAfterResponseRuleFrontendNoContent with default headers values -func NewDeleteHTTPAfterResponseRuleFrontendNoContent() *DeleteHTTPAfterResponseRuleFrontendNoContent { - - return &DeleteHTTPAfterResponseRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPAfterResponseRuleFrontendNotFoundCode is the HTTP code returned for type DeleteHTTPAfterResponseRuleFrontendNotFound -const DeleteHTTPAfterResponseRuleFrontendNotFoundCode int = 404 - -/* -DeleteHTTPAfterResponseRuleFrontendNotFound The specified resource was not found - -swagger:response deleteHttpAfterResponseRuleFrontendNotFound -*/ -type DeleteHTTPAfterResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleFrontendNotFound creates DeleteHTTPAfterResponseRuleFrontendNotFound with default headers values -func NewDeleteHTTPAfterResponseRuleFrontendNotFound() *DeleteHTTPAfterResponseRuleFrontendNotFound { - - return &DeleteHTTPAfterResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http after response rule frontend not found response -func (o *DeleteHTTPAfterResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http after response rule frontend not found response -func (o *DeleteHTTPAfterResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http after response rule frontend not found response -func (o *DeleteHTTPAfterResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http after response rule frontend not found response -func (o *DeleteHTTPAfterResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response deleteHttpAfterResponseRuleFrontendDefault -*/ -type DeleteHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPAfterResponseRuleFrontendDefault creates DeleteHTTPAfterResponseRuleFrontendDefault with default headers values -func NewDeleteHTTPAfterResponseRuleFrontendDefault(code int) *DeleteHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *DeleteHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP after response rule frontend default response -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/delete_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 6e3168b8..00000000 --- a/operations/http_after_response_rule/delete_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPAfterResponseRuleFrontendURL generates an URL for the delete HTTP after response rule frontend operation -type DeleteHTTPAfterResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *DeleteHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPAfterResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_backend.go b/operations/http_after_response_rule/get_all_http_after_response_rule_backend.go deleted file mode 100644 index de9de95b..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a get all HTTP after response rule backend handler -type GetAllHTTPAfterResponseRuleBackendHandlerFunc func(GetAllHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPAfterResponseRuleBackendHandlerFunc) Handle(params GetAllHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPAfterResponseRuleBackendHandler interface for that can handle valid get all HTTP after response rule backend params -type GetAllHTTPAfterResponseRuleBackendHandler interface { - Handle(GetAllHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPAfterResponseRuleBackend creates a new http.Handler for the get all HTTP after response rule backend operation -func NewGetAllHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler GetAllHTTPAfterResponseRuleBackendHandler) *GetAllHTTPAfterResponseRuleBackend { - return &GetAllHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPAfterResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules HTTPAfterResponseRule getAllHttpAfterResponseRuleBackend - -# Return an array of all HTTP After Response Rules - -Returns all HTTP After Response Rules that are configured in specified parent. -*/ -type GetAllHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler GetAllHTTPAfterResponseRuleBackendHandler -} - -func (o *GetAllHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/get_all_http_after_response_rule_backend_parameters.go deleted file mode 100644 index 2e5fcd45..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPAfterResponseRuleBackendParams creates a new GetAllHTTPAfterResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPAfterResponseRuleBackendParams() GetAllHTTPAfterResponseRuleBackendParams { - - return GetAllHTTPAfterResponseRuleBackendParams{} -} - -// GetAllHTTPAfterResponseRuleBackendParams contains all the bound params for the get all HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPAfterResponseRuleBackend -type GetAllHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPAfterResponseRuleBackendParams() beforehand. -func (o *GetAllHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/get_all_http_after_response_rule_backend_responses.go deleted file mode 100644 index 6b5f690b..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPAfterResponseRuleBackendOKCode is the HTTP code returned for type GetAllHTTPAfterResponseRuleBackendOK -const GetAllHTTPAfterResponseRuleBackendOKCode int = 200 - -/* -GetAllHTTPAfterResponseRuleBackendOK Successful operation - -swagger:response getAllHttpAfterResponseRuleBackendOK -*/ -type GetAllHTTPAfterResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleBackendOK creates GetAllHTTPAfterResponseRuleBackendOK with default headers values -func NewGetAllHTTPAfterResponseRuleBackendOK() *GetAllHTTPAfterResponseRuleBackendOK { - - return &GetAllHTTPAfterResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http after response rule backend o k response -func (o *GetAllHTTPAfterResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http after response rule backend o k response -func (o *GetAllHTTPAfterResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http after response rule backend o k response -func (o *GetAllHTTPAfterResponseRuleBackendOK) WithPayload(payload models.HTTPAfterResponseRules) *GetAllHTTPAfterResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http after response rule backend o k response -func (o *GetAllHTTPAfterResponseRuleBackendOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPAfterResponseRuleBackendDefault General Error - -swagger:response getAllHttpAfterResponseRuleBackendDefault -*/ -type GetAllHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleBackendDefault creates GetAllHTTPAfterResponseRuleBackendDefault with default headers values -func NewGetAllHTTPAfterResponseRuleBackendDefault(code int) *GetAllHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *GetAllHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetAllHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP after response rule backend default response -func (o *GetAllHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/get_all_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index 4e5ac497..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPAfterResponseRuleBackendURL generates an URL for the get all HTTP after response rule backend operation -type GetAllHTTPAfterResponseRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *GetAllHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults.go b/operations/http_after_response_rule/get_all_http_after_response_rule_defaults.go deleted file mode 100644 index a7fd8e90..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get all HTTP after response rule defaults handler -type GetAllHTTPAfterResponseRuleDefaultsHandlerFunc func(GetAllHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params GetAllHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid get all HTTP after response rule defaults params -type GetAllHTTPAfterResponseRuleDefaultsHandler interface { - Handle(GetAllHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPAfterResponseRuleDefaults creates a new http.Handler for the get all HTTP after response rule defaults operation -func NewGetAllHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler GetAllHTTPAfterResponseRuleDefaultsHandler) *GetAllHTTPAfterResponseRuleDefaults { - return &GetAllHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPAfterResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules HTTPAfterResponseRule getAllHttpAfterResponseRuleDefaults - -# Return an array of all HTTP After Response Rules - -Returns all HTTP After Response Rules that are configured in specified parent. -*/ -type GetAllHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler GetAllHTTPAfterResponseRuleDefaultsHandler -} - -func (o *GetAllHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index 5977f515..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPAfterResponseRuleDefaultsParams creates a new GetAllHTTPAfterResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPAfterResponseRuleDefaultsParams() GetAllHTTPAfterResponseRuleDefaultsParams { - - return GetAllHTTPAfterResponseRuleDefaultsParams{} -} - -// GetAllHTTPAfterResponseRuleDefaultsParams contains all the bound params for the get all HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPAfterResponseRuleDefaults -type GetAllHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *GetAllHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_responses.go deleted file mode 100644 index c1d18050..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPAfterResponseRuleDefaultsOKCode is the HTTP code returned for type GetAllHTTPAfterResponseRuleDefaultsOK -const GetAllHTTPAfterResponseRuleDefaultsOKCode int = 200 - -/* -GetAllHTTPAfterResponseRuleDefaultsOK Successful operation - -swagger:response getAllHttpAfterResponseRuleDefaultsOK -*/ -type GetAllHTTPAfterResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleDefaultsOK creates GetAllHTTPAfterResponseRuleDefaultsOK with default headers values -func NewGetAllHTTPAfterResponseRuleDefaultsOK() *GetAllHTTPAfterResponseRuleDefaultsOK { - - return &GetAllHTTPAfterResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http after response rule defaults o k response -func (o *GetAllHTTPAfterResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http after response rule defaults o k response -func (o *GetAllHTTPAfterResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http after response rule defaults o k response -func (o *GetAllHTTPAfterResponseRuleDefaultsOK) WithPayload(payload models.HTTPAfterResponseRules) *GetAllHTTPAfterResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http after response rule defaults o k response -func (o *GetAllHTTPAfterResponseRuleDefaultsOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response getAllHttpAfterResponseRuleDefaultsDefault -*/ -type GetAllHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleDefaultsDefault creates GetAllHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewGetAllHTTPAfterResponseRuleDefaultsDefault(code int) *GetAllHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *GetAllHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP after response rule defaults default response -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 03bbdc6b..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPAfterResponseRuleDefaultsURL generates an URL for the get all HTTP after response rule defaults operation -type GetAllHTTPAfterResponseRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *GetAllHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend.go b/operations/http_after_response_rule/get_all_http_after_response_rule_frontend.go deleted file mode 100644 index 14140fa0..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a get all HTTP after response rule frontend handler -type GetAllHTTPAfterResponseRuleFrontendHandlerFunc func(GetAllHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params GetAllHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPAfterResponseRuleFrontendHandler interface for that can handle valid get all HTTP after response rule frontend params -type GetAllHTTPAfterResponseRuleFrontendHandler interface { - Handle(GetAllHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPAfterResponseRuleFrontend creates a new http.Handler for the get all HTTP after response rule frontend operation -func NewGetAllHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler GetAllHTTPAfterResponseRuleFrontendHandler) *GetAllHTTPAfterResponseRuleFrontend { - return &GetAllHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPAfterResponseRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules HTTPAfterResponseRule getAllHttpAfterResponseRuleFrontend - -# Return an array of all HTTP After Response Rules - -Returns all HTTP After Response Rules that are configured in specified parent. -*/ -type GetAllHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler GetAllHTTPAfterResponseRuleFrontendHandler -} - -func (o *GetAllHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index 1f4ff913..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPAfterResponseRuleFrontendParams creates a new GetAllHTTPAfterResponseRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPAfterResponseRuleFrontendParams() GetAllHTTPAfterResponseRuleFrontendParams { - - return GetAllHTTPAfterResponseRuleFrontendParams{} -} - -// GetAllHTTPAfterResponseRuleFrontendParams contains all the bound params for the get all HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPAfterResponseRuleFrontend -type GetAllHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *GetAllHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_responses.go deleted file mode 100644 index 7420df63..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPAfterResponseRuleFrontendOKCode is the HTTP code returned for type GetAllHTTPAfterResponseRuleFrontendOK -const GetAllHTTPAfterResponseRuleFrontendOKCode int = 200 - -/* -GetAllHTTPAfterResponseRuleFrontendOK Successful operation - -swagger:response getAllHttpAfterResponseRuleFrontendOK -*/ -type GetAllHTTPAfterResponseRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleFrontendOK creates GetAllHTTPAfterResponseRuleFrontendOK with default headers values -func NewGetAllHTTPAfterResponseRuleFrontendOK() *GetAllHTTPAfterResponseRuleFrontendOK { - - return &GetAllHTTPAfterResponseRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http after response rule frontend o k response -func (o *GetAllHTTPAfterResponseRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http after response rule frontend o k response -func (o *GetAllHTTPAfterResponseRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http after response rule frontend o k response -func (o *GetAllHTTPAfterResponseRuleFrontendOK) WithPayload(payload models.HTTPAfterResponseRules) *GetAllHTTPAfterResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http after response rule frontend o k response -func (o *GetAllHTTPAfterResponseRuleFrontendOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response getAllHttpAfterResponseRuleFrontendDefault -*/ -type GetAllHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPAfterResponseRuleFrontendDefault creates GetAllHTTPAfterResponseRuleFrontendDefault with default headers values -func NewGetAllHTTPAfterResponseRuleFrontendDefault(code int) *GetAllHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *GetAllHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP after response rule frontend default response -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 4e069d69..00000000 --- a/operations/http_after_response_rule/get_all_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPAfterResponseRuleFrontendURL generates an URL for the get all HTTP after response rule frontend operation -type GetAllHTTPAfterResponseRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *GetAllHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_backend.go b/operations/http_after_response_rule/get_http_after_response_rule_backend.go deleted file mode 100644 index ec42e733..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a get HTTP after response rule backend handler -type GetHTTPAfterResponseRuleBackendHandlerFunc func(GetHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPAfterResponseRuleBackendHandlerFunc) Handle(params GetHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPAfterResponseRuleBackendHandler interface for that can handle valid get HTTP after response rule backend params -type GetHTTPAfterResponseRuleBackendHandler interface { - Handle(GetHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetHTTPAfterResponseRuleBackend creates a new http.Handler for the get HTTP after response rule backend operation -func NewGetHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler GetHTTPAfterResponseRuleBackendHandler) *GetHTTPAfterResponseRuleBackend { - return &GetHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetHTTPAfterResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule getHttpAfterResponseRuleBackend - -# Return one HTTP After Response Rule - -Returns one HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler GetHTTPAfterResponseRuleBackendHandler -} - -func (o *GetHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/get_http_after_response_rule_backend_parameters.go deleted file mode 100644 index a296c30e..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPAfterResponseRuleBackendParams creates a new GetHTTPAfterResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPAfterResponseRuleBackendParams() GetHTTPAfterResponseRuleBackendParams { - - return GetHTTPAfterResponseRuleBackendParams{} -} - -// GetHTTPAfterResponseRuleBackendParams contains all the bound params for the get HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPAfterResponseRuleBackend -type GetHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPAfterResponseRuleBackendParams() beforehand. -func (o *GetHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPAfterResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/get_http_after_response_rule_backend_responses.go deleted file mode 100644 index 15d4e38f..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPAfterResponseRuleBackendOKCode is the HTTP code returned for type GetHTTPAfterResponseRuleBackendOK -const GetHTTPAfterResponseRuleBackendOKCode int = 200 - -/* -GetHTTPAfterResponseRuleBackendOK Successful operation - -swagger:response getHttpAfterResponseRuleBackendOK -*/ -type GetHTTPAfterResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleBackendOK creates GetHTTPAfterResponseRuleBackendOK with default headers values -func NewGetHTTPAfterResponseRuleBackendOK() *GetHTTPAfterResponseRuleBackendOK { - - return &GetHTTPAfterResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule backend o k response -func (o *GetHTTPAfterResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule backend o k response -func (o *GetHTTPAfterResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule backend o k response -func (o *GetHTTPAfterResponseRuleBackendOK) WithPayload(payload *models.HTTPAfterResponseRule) *GetHTTPAfterResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule backend o k response -func (o *GetHTTPAfterResponseRuleBackendOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPAfterResponseRuleBackendNotFoundCode is the HTTP code returned for type GetHTTPAfterResponseRuleBackendNotFound -const GetHTTPAfterResponseRuleBackendNotFoundCode int = 404 - -/* -GetHTTPAfterResponseRuleBackendNotFound The specified resource was not found - -swagger:response getHttpAfterResponseRuleBackendNotFound -*/ -type GetHTTPAfterResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleBackendNotFound creates GetHTTPAfterResponseRuleBackendNotFound with default headers values -func NewGetHTTPAfterResponseRuleBackendNotFound() *GetHTTPAfterResponseRuleBackendNotFound { - - return &GetHTTPAfterResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule backend not found response -func (o *GetHTTPAfterResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule backend not found response -func (o *GetHTTPAfterResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule backend not found response -func (o *GetHTTPAfterResponseRuleBackendNotFound) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule backend not found response -func (o *GetHTTPAfterResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPAfterResponseRuleBackendDefault General Error - -swagger:response getHttpAfterResponseRuleBackendDefault -*/ -type GetHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleBackendDefault creates GetHTTPAfterResponseRuleBackendDefault with default headers values -func NewGetHTTPAfterResponseRuleBackendDefault(code int) *GetHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *GetHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP after response rule backend default response -func (o *GetHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/get_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index 192c8de8..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPAfterResponseRuleBackendURL generates an URL for the get HTTP after response rule backend operation -type GetHTTPAfterResponseRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *GetHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPAfterResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_defaults.go b/operations/http_after_response_rule/get_http_after_response_rule_defaults.go deleted file mode 100644 index dc69e517..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get HTTP after response rule defaults handler -type GetHTTPAfterResponseRuleDefaultsHandlerFunc func(GetHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params GetHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid get HTTP after response rule defaults params -type GetHTTPAfterResponseRuleDefaultsHandler interface { - Handle(GetHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetHTTPAfterResponseRuleDefaults creates a new http.Handler for the get HTTP after response rule defaults operation -func NewGetHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler GetHTTPAfterResponseRuleDefaultsHandler) *GetHTTPAfterResponseRuleDefaults { - return &GetHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetHTTPAfterResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule getHttpAfterResponseRuleDefaults - -# Return one HTTP After Response Rule - -Returns one HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler GetHTTPAfterResponseRuleDefaultsHandler -} - -func (o *GetHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/get_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index 339de0e2..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPAfterResponseRuleDefaultsParams creates a new GetHTTPAfterResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPAfterResponseRuleDefaultsParams() GetHTTPAfterResponseRuleDefaultsParams { - - return GetHTTPAfterResponseRuleDefaultsParams{} -} - -// GetHTTPAfterResponseRuleDefaultsParams contains all the bound params for the get HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPAfterResponseRuleDefaults -type GetHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *GetHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPAfterResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/get_http_after_response_rule_defaults_responses.go deleted file mode 100644 index bc257cec..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPAfterResponseRuleDefaultsOKCode is the HTTP code returned for type GetHTTPAfterResponseRuleDefaultsOK -const GetHTTPAfterResponseRuleDefaultsOKCode int = 200 - -/* -GetHTTPAfterResponseRuleDefaultsOK Successful operation - -swagger:response getHttpAfterResponseRuleDefaultsOK -*/ -type GetHTTPAfterResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleDefaultsOK creates GetHTTPAfterResponseRuleDefaultsOK with default headers values -func NewGetHTTPAfterResponseRuleDefaultsOK() *GetHTTPAfterResponseRuleDefaultsOK { - - return &GetHTTPAfterResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule defaults o k response -func (o *GetHTTPAfterResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule defaults o k response -func (o *GetHTTPAfterResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule defaults o k response -func (o *GetHTTPAfterResponseRuleDefaultsOK) WithPayload(payload *models.HTTPAfterResponseRule) *GetHTTPAfterResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule defaults o k response -func (o *GetHTTPAfterResponseRuleDefaultsOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPAfterResponseRuleDefaultsNotFoundCode is the HTTP code returned for type GetHTTPAfterResponseRuleDefaultsNotFound -const GetHTTPAfterResponseRuleDefaultsNotFoundCode int = 404 - -/* -GetHTTPAfterResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response getHttpAfterResponseRuleDefaultsNotFound -*/ -type GetHTTPAfterResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleDefaultsNotFound creates GetHTTPAfterResponseRuleDefaultsNotFound with default headers values -func NewGetHTTPAfterResponseRuleDefaultsNotFound() *GetHTTPAfterResponseRuleDefaultsNotFound { - - return &GetHTTPAfterResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule defaults not found response -func (o *GetHTTPAfterResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule defaults not found response -func (o *GetHTTPAfterResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule defaults not found response -func (o *GetHTTPAfterResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule defaults not found response -func (o *GetHTTPAfterResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response getHttpAfterResponseRuleDefaultsDefault -*/ -type GetHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleDefaultsDefault creates GetHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewGetHTTPAfterResponseRuleDefaultsDefault(code int) *GetHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *GetHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP after response rule defaults default response -func (o *GetHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/get_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 4ffb9146..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPAfterResponseRuleDefaultsURL generates an URL for the get HTTP after response rule defaults operation -type GetHTTPAfterResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *GetHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPAfterResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_frontend.go b/operations/http_after_response_rule/get_http_after_response_rule_frontend.go deleted file mode 100644 index 58eb6ea7..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a get HTTP after response rule frontend handler -type GetHTTPAfterResponseRuleFrontendHandlerFunc func(GetHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params GetHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPAfterResponseRuleFrontendHandler interface for that can handle valid get HTTP after response rule frontend params -type GetHTTPAfterResponseRuleFrontendHandler interface { - Handle(GetHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetHTTPAfterResponseRuleFrontend creates a new http.Handler for the get HTTP after response rule frontend operation -func NewGetHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler GetHTTPAfterResponseRuleFrontendHandler) *GetHTTPAfterResponseRuleFrontend { - return &GetHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetHTTPAfterResponseRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule getHttpAfterResponseRuleFrontend - -# Return one HTTP After Response Rule - -Returns one HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler GetHTTPAfterResponseRuleFrontendHandler -} - -func (o *GetHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/get_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index af73db0d..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPAfterResponseRuleFrontendParams creates a new GetHTTPAfterResponseRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPAfterResponseRuleFrontendParams() GetHTTPAfterResponseRuleFrontendParams { - - return GetHTTPAfterResponseRuleFrontendParams{} -} - -// GetHTTPAfterResponseRuleFrontendParams contains all the bound params for the get HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPAfterResponseRuleFrontend -type GetHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *GetHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPAfterResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/get_http_after_response_rule_frontend_responses.go deleted file mode 100644 index f672ab1c..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPAfterResponseRuleFrontendOKCode is the HTTP code returned for type GetHTTPAfterResponseRuleFrontendOK -const GetHTTPAfterResponseRuleFrontendOKCode int = 200 - -/* -GetHTTPAfterResponseRuleFrontendOK Successful operation - -swagger:response getHttpAfterResponseRuleFrontendOK -*/ -type GetHTTPAfterResponseRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleFrontendOK creates GetHTTPAfterResponseRuleFrontendOK with default headers values -func NewGetHTTPAfterResponseRuleFrontendOK() *GetHTTPAfterResponseRuleFrontendOK { - - return &GetHTTPAfterResponseRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule frontend o k response -func (o *GetHTTPAfterResponseRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule frontend o k response -func (o *GetHTTPAfterResponseRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule frontend o k response -func (o *GetHTTPAfterResponseRuleFrontendOK) WithPayload(payload *models.HTTPAfterResponseRule) *GetHTTPAfterResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule frontend o k response -func (o *GetHTTPAfterResponseRuleFrontendOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPAfterResponseRuleFrontendNotFoundCode is the HTTP code returned for type GetHTTPAfterResponseRuleFrontendNotFound -const GetHTTPAfterResponseRuleFrontendNotFoundCode int = 404 - -/* -GetHTTPAfterResponseRuleFrontendNotFound The specified resource was not found - -swagger:response getHttpAfterResponseRuleFrontendNotFound -*/ -type GetHTTPAfterResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleFrontendNotFound creates GetHTTPAfterResponseRuleFrontendNotFound with default headers values -func NewGetHTTPAfterResponseRuleFrontendNotFound() *GetHTTPAfterResponseRuleFrontendNotFound { - - return &GetHTTPAfterResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http after response rule frontend not found response -func (o *GetHTTPAfterResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http after response rule frontend not found response -func (o *GetHTTPAfterResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http after response rule frontend not found response -func (o *GetHTTPAfterResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http after response rule frontend not found response -func (o *GetHTTPAfterResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response getHttpAfterResponseRuleFrontendDefault -*/ -type GetHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPAfterResponseRuleFrontendDefault creates GetHTTPAfterResponseRuleFrontendDefault with default headers values -func NewGetHTTPAfterResponseRuleFrontendDefault(code int) *GetHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *GetHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *GetHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP after response rule frontend default response -func (o *GetHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/get_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/get_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 94dfe8cd..00000000 --- a/operations/http_after_response_rule/get_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPAfterResponseRuleFrontendURL generates an URL for the get HTTP after response rule frontend operation -type GetHTTPAfterResponseRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *GetHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPAfterResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_backend.go deleted file mode 100644 index 8e7a7b99..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a replace all HTTP after response rule backend handler -type ReplaceAllHTTPAfterResponseRuleBackendHandlerFunc func(ReplaceAllHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPAfterResponseRuleBackendHandlerFunc) Handle(params ReplaceAllHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPAfterResponseRuleBackendHandler interface for that can handle valid replace all HTTP after response rule backend params -type ReplaceAllHTTPAfterResponseRuleBackendHandler interface { - Handle(ReplaceAllHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPAfterResponseRuleBackend creates a new http.Handler for the replace all HTTP after response rule backend operation -func NewReplaceAllHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler ReplaceAllHTTPAfterResponseRuleBackendHandler) *ReplaceAllHTTPAfterResponseRuleBackend { - return &ReplaceAllHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPAfterResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules HTTPAfterResponseRule replaceAllHttpAfterResponseRuleBackend - -# Replace an HTTP After Response Rules list - -Replaces a whole list of HTTP After Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllHTTPAfterResponseRuleBackendHandler -} - -func (o *ReplaceAllHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_parameters.go deleted file mode 100644 index 6f98b854..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPAfterResponseRuleBackendParams creates a new ReplaceAllHTTPAfterResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceAllHTTPAfterResponseRuleBackendParams() ReplaceAllHTTPAfterResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPAfterResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPAfterResponseRuleBackendParams contains all the bound params for the replace all HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPAfterResponseRuleBackend -type ReplaceAllHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPAfterResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPAfterResponseRuleBackendParams() beforehand. -func (o *ReplaceAllHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPAfterResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPAfterResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPAfterResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_responses.go deleted file mode 100644 index a1f90582..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPAfterResponseRuleBackendOKCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleBackendOK -const ReplaceAllHTTPAfterResponseRuleBackendOKCode int = 200 - -/* -ReplaceAllHTTPAfterResponseRuleBackendOK All TTP After Response Rules lines replaced - -swagger:response replaceAllHttpAfterResponseRuleBackendOK -*/ -type ReplaceAllHTTPAfterResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleBackendOK creates ReplaceAllHTTPAfterResponseRuleBackendOK with default headers values -func NewReplaceAllHTTPAfterResponseRuleBackendOK() *ReplaceAllHTTPAfterResponseRuleBackendOK { - - return &ReplaceAllHTTPAfterResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Http after response rule backend o k response -func (o *ReplaceAllHTTPAfterResponseRuleBackendOK) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule backend o k response -func (o *ReplaceAllHTTPAfterResponseRuleBackendOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleBackendAccepted -const ReplaceAllHTTPAfterResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllHTTPAfterResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpAfterResponseRuleBackendAccepted -*/ -type ReplaceAllHTTPAfterResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleBackendAccepted creates ReplaceAllHTTPAfterResponseRuleBackendAccepted with default headers values -func NewReplaceAllHTTPAfterResponseRuleBackendAccepted() *ReplaceAllHTTPAfterResponseRuleBackendAccepted { - - return &ReplaceAllHTTPAfterResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http after response rule backend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPAfterResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http after response rule backend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http after response rule backend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleBackendAccepted) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule backend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleBackendAccepted) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleBackendBadRequest -const ReplaceAllHTTPAfterResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllHTTPAfterResponseRuleBackendBadRequest Bad request - -swagger:response replaceAllHttpAfterResponseRuleBackendBadRequest -*/ -type ReplaceAllHTTPAfterResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleBackendBadRequest creates ReplaceAllHTTPAfterResponseRuleBackendBadRequest with default headers values -func NewReplaceAllHTTPAfterResponseRuleBackendBadRequest() *ReplaceAllHTTPAfterResponseRuleBackendBadRequest { - - return &ReplaceAllHTTPAfterResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http after response rule backend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http after response rule backend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http after response rule backend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule backend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPAfterResponseRuleBackendDefault General Error - -swagger:response replaceAllHttpAfterResponseRuleBackendDefault -*/ -type ReplaceAllHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleBackendDefault creates ReplaceAllHTTPAfterResponseRuleBackendDefault with default headers values -func NewReplaceAllHTTPAfterResponseRuleBackendDefault(code int) *ReplaceAllHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceAllHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP after response rule backend default response -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index aa4d9aeb..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPAfterResponseRuleBackendURL generates an URL for the replace all HTTP after response rule backend operation -type ReplaceAllHTTPAfterResponseRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *ReplaceAllHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults.go deleted file mode 100644 index c62c30f6..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace all HTTP after response rule defaults handler -type ReplaceAllHTTPAfterResponseRuleDefaultsHandlerFunc func(ReplaceAllHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params ReplaceAllHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid replace all HTTP after response rule defaults params -type ReplaceAllHTTPAfterResponseRuleDefaultsHandler interface { - Handle(ReplaceAllHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPAfterResponseRuleDefaults creates a new http.Handler for the replace all HTTP after response rule defaults operation -func NewReplaceAllHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler ReplaceAllHTTPAfterResponseRuleDefaultsHandler) *ReplaceAllHTTPAfterResponseRuleDefaults { - return &ReplaceAllHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPAfterResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules HTTPAfterResponseRule replaceAllHttpAfterResponseRuleDefaults - -# Replace an HTTP After Response Rules list - -Replaces a whole list of HTTP After Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllHTTPAfterResponseRuleDefaultsHandler -} - -func (o *ReplaceAllHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index 345e37ea..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPAfterResponseRuleDefaultsParams creates a new ReplaceAllHTTPAfterResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllHTTPAfterResponseRuleDefaultsParams() ReplaceAllHTTPAfterResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPAfterResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPAfterResponseRuleDefaultsParams contains all the bound params for the replace all HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPAfterResponseRuleDefaults -type ReplaceAllHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPAfterResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPAfterResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_responses.go deleted file mode 100644 index 1ba0806d..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPAfterResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleDefaultsOK -const ReplaceAllHTTPAfterResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceAllHTTPAfterResponseRuleDefaultsOK All TTP After Response Rules lines replaced - -swagger:response replaceAllHttpAfterResponseRuleDefaultsOK -*/ -type ReplaceAllHTTPAfterResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleDefaultsOK creates ReplaceAllHTTPAfterResponseRuleDefaultsOK with default headers values -func NewReplaceAllHTTPAfterResponseRuleDefaultsOK() *ReplaceAllHTTPAfterResponseRuleDefaultsOK { - - return &ReplaceAllHTTPAfterResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Http after response rule defaults o k response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsOK) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule defaults o k response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleDefaultsAccepted -const ReplaceAllHTTPAfterResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllHTTPAfterResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpAfterResponseRuleDefaultsAccepted -*/ -type ReplaceAllHTTPAfterResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleDefaultsAccepted creates ReplaceAllHTTPAfterResponseRuleDefaultsAccepted with default headers values -func NewReplaceAllHTTPAfterResponseRuleDefaultsAccepted() *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted { - - return &ReplaceAllHTTPAfterResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http after response rule defaults accepted response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http after response rule defaults accepted response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http after response rule defaults accepted response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule defaults accepted response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest -const ReplaceAllHTTPAfterResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceAllHttpAfterResponseRuleDefaultsBadRequest -*/ -type ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleDefaultsBadRequest creates ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest with default headers values -func NewReplaceAllHTTPAfterResponseRuleDefaultsBadRequest() *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest { - - return &ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http after response rule defaults bad request response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http after response rule defaults bad request response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http after response rule defaults bad request response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule defaults bad request response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response replaceAllHttpAfterResponseRuleDefaultsDefault -*/ -type ReplaceAllHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleDefaultsDefault creates ReplaceAllHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewReplaceAllHTTPAfterResponseRuleDefaultsDefault(code int) *ReplaceAllHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP after response rule defaults default response -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index ba516977..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPAfterResponseRuleDefaultsURL generates an URL for the replace all HTTP after response rule defaults operation -type ReplaceAllHTTPAfterResponseRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend.go deleted file mode 100644 index 10ecff47..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a replace all HTTP after response rule frontend handler -type ReplaceAllHTTPAfterResponseRuleFrontendHandlerFunc func(ReplaceAllHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params ReplaceAllHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPAfterResponseRuleFrontendHandler interface for that can handle valid replace all HTTP after response rule frontend params -type ReplaceAllHTTPAfterResponseRuleFrontendHandler interface { - Handle(ReplaceAllHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPAfterResponseRuleFrontend creates a new http.Handler for the replace all HTTP after response rule frontend operation -func NewReplaceAllHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler ReplaceAllHTTPAfterResponseRuleFrontendHandler) *ReplaceAllHTTPAfterResponseRuleFrontend { - return &ReplaceAllHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPAfterResponseRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules HTTPAfterResponseRule replaceAllHttpAfterResponseRuleFrontend - -# Replace an HTTP After Response Rules list - -Replaces a whole list of HTTP After Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllHTTPAfterResponseRuleFrontendHandler -} - -func (o *ReplaceAllHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index 8ea77a58..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPAfterResponseRuleFrontendParams creates a new ReplaceAllHTTPAfterResponseRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllHTTPAfterResponseRuleFrontendParams() ReplaceAllHTTPAfterResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPAfterResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPAfterResponseRuleFrontendParams contains all the bound params for the replace all HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPAfterResponseRuleFrontend -type ReplaceAllHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPAfterResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *ReplaceAllHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPAfterResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPAfterResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPAfterResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_responses.go deleted file mode 100644 index 949f4ba9..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPAfterResponseRuleFrontendOKCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleFrontendOK -const ReplaceAllHTTPAfterResponseRuleFrontendOKCode int = 200 - -/* -ReplaceAllHTTPAfterResponseRuleFrontendOK All TTP After Response Rules lines replaced - -swagger:response replaceAllHttpAfterResponseRuleFrontendOK -*/ -type ReplaceAllHTTPAfterResponseRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleFrontendOK creates ReplaceAllHTTPAfterResponseRuleFrontendOK with default headers values -func NewReplaceAllHTTPAfterResponseRuleFrontendOK() *ReplaceAllHTTPAfterResponseRuleFrontendOK { - - return &ReplaceAllHTTPAfterResponseRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Http after response rule frontend o k response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendOK) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule frontend o k response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendOK) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleFrontendAccepted -const ReplaceAllHTTPAfterResponseRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllHTTPAfterResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpAfterResponseRuleFrontendAccepted -*/ -type ReplaceAllHTTPAfterResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPAfterResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleFrontendAccepted creates ReplaceAllHTTPAfterResponseRuleFrontendAccepted with default headers values -func NewReplaceAllHTTPAfterResponseRuleFrontendAccepted() *ReplaceAllHTTPAfterResponseRuleFrontendAccepted { - - return &ReplaceAllHTTPAfterResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http after response rule frontend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPAfterResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http after response rule frontend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http after response rule frontend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendAccepted) WithPayload(payload models.HTTPAfterResponseRules) *ReplaceAllHTTPAfterResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule frontend accepted response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendAccepted) SetPayload(payload models.HTTPAfterResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPAfterResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPAfterResponseRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPAfterResponseRuleFrontendBadRequest -const ReplaceAllHTTPAfterResponseRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllHTTPAfterResponseRuleFrontendBadRequest Bad request - -swagger:response replaceAllHttpAfterResponseRuleFrontendBadRequest -*/ -type ReplaceAllHTTPAfterResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleFrontendBadRequest creates ReplaceAllHTTPAfterResponseRuleFrontendBadRequest with default headers values -func NewReplaceAllHTTPAfterResponseRuleFrontendBadRequest() *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest { - - return &ReplaceAllHTTPAfterResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http after response rule frontend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http after response rule frontend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http after response rule frontend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http after response rule frontend bad request response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response replaceAllHttpAfterResponseRuleFrontendDefault -*/ -type ReplaceAllHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPAfterResponseRuleFrontendDefault creates ReplaceAllHTTPAfterResponseRuleFrontendDefault with default headers values -func NewReplaceAllHTTPAfterResponseRuleFrontendDefault(code int) *ReplaceAllHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP after response rule frontend default response -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 8b82f6d7..00000000 --- a/operations/http_after_response_rule/replace_all_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPAfterResponseRuleFrontendURL generates an URL for the replace all HTTP after response rule frontend operation -type ReplaceAllHTTPAfterResponseRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *ReplaceAllHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_backend.go b/operations/http_after_response_rule/replace_http_after_response_rule_backend.go deleted file mode 100644 index c9860cd7..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPAfterResponseRuleBackendHandlerFunc turns a function with the right signature into a replace HTTP after response rule backend handler -type ReplaceHTTPAfterResponseRuleBackendHandlerFunc func(ReplaceHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPAfterResponseRuleBackendHandlerFunc) Handle(params ReplaceHTTPAfterResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPAfterResponseRuleBackendHandler interface for that can handle valid replace HTTP after response rule backend params -type ReplaceHTTPAfterResponseRuleBackendHandler interface { - Handle(ReplaceHTTPAfterResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPAfterResponseRuleBackend creates a new http.Handler for the replace HTTP after response rule backend operation -func NewReplaceHTTPAfterResponseRuleBackend(ctx *middleware.Context, handler ReplaceHTTPAfterResponseRuleBackendHandler) *ReplaceHTTPAfterResponseRuleBackend { - return &ReplaceHTTPAfterResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPAfterResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule replaceHttpAfterResponseRuleBackend - -# Replace a HTTP After Response Rule - -Replaces a HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPAfterResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceHTTPAfterResponseRuleBackendHandler -} - -func (o *ReplaceHTTPAfterResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPAfterResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_backend_parameters.go b/operations/http_after_response_rule/replace_http_after_response_rule_backend_parameters.go deleted file mode 100644 index 477be655..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPAfterResponseRuleBackendParams creates a new ReplaceHTTPAfterResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceHTTPAfterResponseRuleBackendParams() ReplaceHTTPAfterResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPAfterResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPAfterResponseRuleBackendParams contains all the bound params for the replace HTTP after response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPAfterResponseRuleBackend -type ReplaceHTTPAfterResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPAfterResponseRuleBackendParams() beforehand. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPAfterResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPAfterResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_backend_responses.go b/operations/http_after_response_rule/replace_http_after_response_rule_backend_responses.go deleted file mode 100644 index cb0b17a7..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPAfterResponseRuleBackendOKCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleBackendOK -const ReplaceHTTPAfterResponseRuleBackendOKCode int = 200 - -/* -ReplaceHTTPAfterResponseRuleBackendOK HTTP After Response Rule replaced - -swagger:response replaceHttpAfterResponseRuleBackendOK -*/ -type ReplaceHTTPAfterResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleBackendOK creates ReplaceHTTPAfterResponseRuleBackendOK with default headers values -func NewReplaceHTTPAfterResponseRuleBackendOK() *ReplaceHTTPAfterResponseRuleBackendOK { - - return &ReplaceHTTPAfterResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Http after response rule backend o k response -func (o *ReplaceHTTPAfterResponseRuleBackendOK) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule backend o k response -func (o *ReplaceHTTPAfterResponseRuleBackendOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleBackendAccepted -const ReplaceHTTPAfterResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceHTTPAfterResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpAfterResponseRuleBackendAccepted -*/ -type ReplaceHTTPAfterResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleBackendAccepted creates ReplaceHTTPAfterResponseRuleBackendAccepted with default headers values -func NewReplaceHTTPAfterResponseRuleBackendAccepted() *ReplaceHTTPAfterResponseRuleBackendAccepted { - - return &ReplaceHTTPAfterResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http after response rule backend accepted response -func (o *ReplaceHTTPAfterResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceHTTPAfterResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http after response rule backend accepted response -func (o *ReplaceHTTPAfterResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http after response rule backend accepted response -func (o *ReplaceHTTPAfterResponseRuleBackendAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule backend accepted response -func (o *ReplaceHTTPAfterResponseRuleBackendAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleBackendBadRequest -const ReplaceHTTPAfterResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceHTTPAfterResponseRuleBackendBadRequest Bad request - -swagger:response replaceHttpAfterResponseRuleBackendBadRequest -*/ -type ReplaceHTTPAfterResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleBackendBadRequest creates ReplaceHTTPAfterResponseRuleBackendBadRequest with default headers values -func NewReplaceHTTPAfterResponseRuleBackendBadRequest() *ReplaceHTTPAfterResponseRuleBackendBadRequest { - - return &ReplaceHTTPAfterResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule backend bad request response -func (o *ReplaceHTTPAfterResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule backend bad request response -func (o *ReplaceHTTPAfterResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule backend bad request response -func (o *ReplaceHTTPAfterResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule backend bad request response -func (o *ReplaceHTTPAfterResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleBackendNotFoundCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleBackendNotFound -const ReplaceHTTPAfterResponseRuleBackendNotFoundCode int = 404 - -/* -ReplaceHTTPAfterResponseRuleBackendNotFound The specified resource was not found - -swagger:response replaceHttpAfterResponseRuleBackendNotFound -*/ -type ReplaceHTTPAfterResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleBackendNotFound creates ReplaceHTTPAfterResponseRuleBackendNotFound with default headers values -func NewReplaceHTTPAfterResponseRuleBackendNotFound() *ReplaceHTTPAfterResponseRuleBackendNotFound { - - return &ReplaceHTTPAfterResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule backend not found response -func (o *ReplaceHTTPAfterResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule backend not found response -func (o *ReplaceHTTPAfterResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule backend not found response -func (o *ReplaceHTTPAfterResponseRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule backend not found response -func (o *ReplaceHTTPAfterResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPAfterResponseRuleBackendDefault General Error - -swagger:response replaceHttpAfterResponseRuleBackendDefault -*/ -type ReplaceHTTPAfterResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleBackendDefault creates ReplaceHTTPAfterResponseRuleBackendDefault with default headers values -func NewReplaceHTTPAfterResponseRuleBackendDefault(code int) *ReplaceHTTPAfterResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPAfterResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceHTTPAfterResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP after response rule backend default response -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_backend_urlbuilder.go b/operations/http_after_response_rule/replace_http_after_response_rule_backend_urlbuilder.go deleted file mode 100644 index 1d81f287..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPAfterResponseRuleBackendURL generates an URL for the replace HTTP after response rule backend operation -type ReplaceHTTPAfterResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleBackendURL) WithBasePath(bp string) *ReplaceHTTPAfterResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPAfterResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPAfterResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPAfterResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPAfterResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPAfterResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPAfterResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPAfterResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPAfterResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPAfterResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_defaults.go b/operations/http_after_response_rule/replace_http_after_response_rule_defaults.go deleted file mode 100644 index 47391e46..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPAfterResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace HTTP after response rule defaults handler -type ReplaceHTTPAfterResponseRuleDefaultsHandlerFunc func(ReplaceHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPAfterResponseRuleDefaultsHandlerFunc) Handle(params ReplaceHTTPAfterResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPAfterResponseRuleDefaultsHandler interface for that can handle valid replace HTTP after response rule defaults params -type ReplaceHTTPAfterResponseRuleDefaultsHandler interface { - Handle(ReplaceHTTPAfterResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPAfterResponseRuleDefaults creates a new http.Handler for the replace HTTP after response rule defaults operation -func NewReplaceHTTPAfterResponseRuleDefaults(ctx *middleware.Context, handler ReplaceHTTPAfterResponseRuleDefaultsHandler) *ReplaceHTTPAfterResponseRuleDefaults { - return &ReplaceHTTPAfterResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPAfterResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule replaceHttpAfterResponseRuleDefaults - -# Replace a HTTP After Response Rule - -Replaces a HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPAfterResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceHTTPAfterResponseRuleDefaultsHandler -} - -func (o *ReplaceHTTPAfterResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPAfterResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_parameters.go b/operations/http_after_response_rule/replace_http_after_response_rule_defaults_parameters.go deleted file mode 100644 index 73c11bee..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPAfterResponseRuleDefaultsParams creates a new ReplaceHTTPAfterResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceHTTPAfterResponseRuleDefaultsParams() ReplaceHTTPAfterResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPAfterResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPAfterResponseRuleDefaultsParams contains all the bound params for the replace HTTP after response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPAfterResponseRuleDefaults -type ReplaceHTTPAfterResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPAfterResponseRuleDefaultsParams() beforehand. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPAfterResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPAfterResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_responses.go b/operations/http_after_response_rule/replace_http_after_response_rule_defaults_responses.go deleted file mode 100644 index 6bd6deb6..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPAfterResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleDefaultsOK -const ReplaceHTTPAfterResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceHTTPAfterResponseRuleDefaultsOK HTTP After Response Rule replaced - -swagger:response replaceHttpAfterResponseRuleDefaultsOK -*/ -type ReplaceHTTPAfterResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleDefaultsOK creates ReplaceHTTPAfterResponseRuleDefaultsOK with default headers values -func NewReplaceHTTPAfterResponseRuleDefaultsOK() *ReplaceHTTPAfterResponseRuleDefaultsOK { - - return &ReplaceHTTPAfterResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Http after response rule defaults o k response -func (o *ReplaceHTTPAfterResponseRuleDefaultsOK) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule defaults o k response -func (o *ReplaceHTTPAfterResponseRuleDefaultsOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleDefaultsAccepted -const ReplaceHTTPAfterResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceHTTPAfterResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpAfterResponseRuleDefaultsAccepted -*/ -type ReplaceHTTPAfterResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleDefaultsAccepted creates ReplaceHTTPAfterResponseRuleDefaultsAccepted with default headers values -func NewReplaceHTTPAfterResponseRuleDefaultsAccepted() *ReplaceHTTPAfterResponseRuleDefaultsAccepted { - - return &ReplaceHTTPAfterResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http after response rule defaults accepted response -func (o *ReplaceHTTPAfterResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceHTTPAfterResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http after response rule defaults accepted response -func (o *ReplaceHTTPAfterResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http after response rule defaults accepted response -func (o *ReplaceHTTPAfterResponseRuleDefaultsAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule defaults accepted response -func (o *ReplaceHTTPAfterResponseRuleDefaultsAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleDefaultsBadRequest -const ReplaceHTTPAfterResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceHTTPAfterResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceHttpAfterResponseRuleDefaultsBadRequest -*/ -type ReplaceHTTPAfterResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleDefaultsBadRequest creates ReplaceHTTPAfterResponseRuleDefaultsBadRequest with default headers values -func NewReplaceHTTPAfterResponseRuleDefaultsBadRequest() *ReplaceHTTPAfterResponseRuleDefaultsBadRequest { - - return &ReplaceHTTPAfterResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule defaults bad request response -func (o *ReplaceHTTPAfterResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule defaults bad request response -func (o *ReplaceHTTPAfterResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule defaults bad request response -func (o *ReplaceHTTPAfterResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule defaults bad request response -func (o *ReplaceHTTPAfterResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleDefaultsNotFound -const ReplaceHTTPAfterResponseRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceHTTPAfterResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceHttpAfterResponseRuleDefaultsNotFound -*/ -type ReplaceHTTPAfterResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleDefaultsNotFound creates ReplaceHTTPAfterResponseRuleDefaultsNotFound with default headers values -func NewReplaceHTTPAfterResponseRuleDefaultsNotFound() *ReplaceHTTPAfterResponseRuleDefaultsNotFound { - - return &ReplaceHTTPAfterResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule defaults not found response -func (o *ReplaceHTTPAfterResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule defaults not found response -func (o *ReplaceHTTPAfterResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule defaults not found response -func (o *ReplaceHTTPAfterResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule defaults not found response -func (o *ReplaceHTTPAfterResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPAfterResponseRuleDefaultsDefault General Error - -swagger:response replaceHttpAfterResponseRuleDefaultsDefault -*/ -type ReplaceHTTPAfterResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleDefaultsDefault creates ReplaceHTTPAfterResponseRuleDefaultsDefault with default headers values -func NewReplaceHTTPAfterResponseRuleDefaultsDefault(code int) *ReplaceHTTPAfterResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPAfterResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceHTTPAfterResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP after response rule defaults default response -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_urlbuilder.go b/operations/http_after_response_rule/replace_http_after_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 6519aaea..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPAfterResponseRuleDefaultsURL generates an URL for the replace HTTP after response rule defaults operation -type ReplaceHTTPAfterResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceHTTPAfterResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPAfterResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPAfterResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPAfterResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPAfterResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPAfterResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_frontend.go b/operations/http_after_response_rule/replace_http_after_response_rule_frontend.go deleted file mode 100644 index 3545eb06..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPAfterResponseRuleFrontendHandlerFunc turns a function with the right signature into a replace HTTP after response rule frontend handler -type ReplaceHTTPAfterResponseRuleFrontendHandlerFunc func(ReplaceHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPAfterResponseRuleFrontendHandlerFunc) Handle(params ReplaceHTTPAfterResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPAfterResponseRuleFrontendHandler interface for that can handle valid replace HTTP after response rule frontend params -type ReplaceHTTPAfterResponseRuleFrontendHandler interface { - Handle(ReplaceHTTPAfterResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPAfterResponseRuleFrontend creates a new http.Handler for the replace HTTP after response rule frontend operation -func NewReplaceHTTPAfterResponseRuleFrontend(ctx *middleware.Context, handler ReplaceHTTPAfterResponseRuleFrontendHandler) *ReplaceHTTPAfterResponseRuleFrontend { - return &ReplaceHTTPAfterResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPAfterResponseRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index} HTTPAfterResponseRule replaceHttpAfterResponseRuleFrontend - -# Replace a HTTP After Response Rule - -Replaces a HTTP After Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPAfterResponseRuleFrontend struct { - Context *middleware.Context - Handler ReplaceHTTPAfterResponseRuleFrontendHandler -} - -func (o *ReplaceHTTPAfterResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPAfterResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_parameters.go b/operations/http_after_response_rule/replace_http_after_response_rule_frontend_parameters.go deleted file mode 100644 index d1b4304e..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPAfterResponseRuleFrontendParams creates a new ReplaceHTTPAfterResponseRuleFrontendParams object -// with the default values initialized. -func NewReplaceHTTPAfterResponseRuleFrontendParams() ReplaceHTTPAfterResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPAfterResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPAfterResponseRuleFrontendParams contains all the bound params for the replace HTTP after response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPAfterResponseRuleFrontend -type ReplaceHTTPAfterResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPAfterResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP After Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPAfterResponseRuleFrontendParams() beforehand. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPAfterResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPAfterResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPAfterResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_responses.go b/operations/http_after_response_rule/replace_http_after_response_rule_frontend_responses.go deleted file mode 100644 index 20c8e377..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPAfterResponseRuleFrontendOKCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleFrontendOK -const ReplaceHTTPAfterResponseRuleFrontendOKCode int = 200 - -/* -ReplaceHTTPAfterResponseRuleFrontendOK HTTP After Response Rule replaced - -swagger:response replaceHttpAfterResponseRuleFrontendOK -*/ -type ReplaceHTTPAfterResponseRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleFrontendOK creates ReplaceHTTPAfterResponseRuleFrontendOK with default headers values -func NewReplaceHTTPAfterResponseRuleFrontendOK() *ReplaceHTTPAfterResponseRuleFrontendOK { - - return &ReplaceHTTPAfterResponseRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Http after response rule frontend o k response -func (o *ReplaceHTTPAfterResponseRuleFrontendOK) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule frontend o k response -func (o *ReplaceHTTPAfterResponseRuleFrontendOK) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleFrontendAccepted -const ReplaceHTTPAfterResponseRuleFrontendAcceptedCode int = 202 - -/* -ReplaceHTTPAfterResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpAfterResponseRuleFrontendAccepted -*/ -type ReplaceHTTPAfterResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPAfterResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleFrontendAccepted creates ReplaceHTTPAfterResponseRuleFrontendAccepted with default headers values -func NewReplaceHTTPAfterResponseRuleFrontendAccepted() *ReplaceHTTPAfterResponseRuleFrontendAccepted { - - return &ReplaceHTTPAfterResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http after response rule frontend accepted response -func (o *ReplaceHTTPAfterResponseRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceHTTPAfterResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http after response rule frontend accepted response -func (o *ReplaceHTTPAfterResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http after response rule frontend accepted response -func (o *ReplaceHTTPAfterResponseRuleFrontendAccepted) WithPayload(payload *models.HTTPAfterResponseRule) *ReplaceHTTPAfterResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule frontend accepted response -func (o *ReplaceHTTPAfterResponseRuleFrontendAccepted) SetPayload(payload *models.HTTPAfterResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleFrontendBadRequest -const ReplaceHTTPAfterResponseRuleFrontendBadRequestCode int = 400 - -/* -ReplaceHTTPAfterResponseRuleFrontendBadRequest Bad request - -swagger:response replaceHttpAfterResponseRuleFrontendBadRequest -*/ -type ReplaceHTTPAfterResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleFrontendBadRequest creates ReplaceHTTPAfterResponseRuleFrontendBadRequest with default headers values -func NewReplaceHTTPAfterResponseRuleFrontendBadRequest() *ReplaceHTTPAfterResponseRuleFrontendBadRequest { - - return &ReplaceHTTPAfterResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule frontend bad request response -func (o *ReplaceHTTPAfterResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule frontend bad request response -func (o *ReplaceHTTPAfterResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule frontend bad request response -func (o *ReplaceHTTPAfterResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule frontend bad request response -func (o *ReplaceHTTPAfterResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPAfterResponseRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceHTTPAfterResponseRuleFrontendNotFound -const ReplaceHTTPAfterResponseRuleFrontendNotFoundCode int = 404 - -/* -ReplaceHTTPAfterResponseRuleFrontendNotFound The specified resource was not found - -swagger:response replaceHttpAfterResponseRuleFrontendNotFound -*/ -type ReplaceHTTPAfterResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleFrontendNotFound creates ReplaceHTTPAfterResponseRuleFrontendNotFound with default headers values -func NewReplaceHTTPAfterResponseRuleFrontendNotFound() *ReplaceHTTPAfterResponseRuleFrontendNotFound { - - return &ReplaceHTTPAfterResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http after response rule frontend not found response -func (o *ReplaceHTTPAfterResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http after response rule frontend not found response -func (o *ReplaceHTTPAfterResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http after response rule frontend not found response -func (o *ReplaceHTTPAfterResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http after response rule frontend not found response -func (o *ReplaceHTTPAfterResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPAfterResponseRuleFrontendDefault General Error - -swagger:response replaceHttpAfterResponseRuleFrontendDefault -*/ -type ReplaceHTTPAfterResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPAfterResponseRuleFrontendDefault creates ReplaceHTTPAfterResponseRuleFrontendDefault with default headers values -func NewReplaceHTTPAfterResponseRuleFrontendDefault(code int) *ReplaceHTTPAfterResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPAfterResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) WithStatusCode(code int) *ReplaceHTTPAfterResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPAfterResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceHTTPAfterResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP after response rule frontend default response -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPAfterResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_urlbuilder.go b/operations/http_after_response_rule/replace_http_after_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 0939a6a2..00000000 --- a/operations/http_after_response_rule/replace_http_after_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_after_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPAfterResponseRuleFrontendURL generates an URL for the replace HTTP after response rule frontend operation -type ReplaceHTTPAfterResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) WithBasePath(bp string) *ReplaceHTTPAfterResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPAfterResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPAfterResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPAfterResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPAfterResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPAfterResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/create_http_check_backend.go b/operations/http_check/create_http_check_backend.go deleted file mode 100644 index 0c433993..00000000 --- a/operations/http_check/create_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPCheckBackendHandlerFunc turns a function with the right signature into a create HTTP check backend handler -type CreateHTTPCheckBackendHandlerFunc func(CreateHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPCheckBackendHandlerFunc) Handle(params CreateHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPCheckBackendHandler interface for that can handle valid create HTTP check backend params -type CreateHTTPCheckBackendHandler interface { - Handle(CreateHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPCheckBackend creates a new http.Handler for the create HTTP check backend operation -func NewCreateHTTPCheckBackend(ctx *middleware.Context, handler CreateHTTPCheckBackendHandler) *CreateHTTPCheckBackend { - return &CreateHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPCheckBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/http_checks/{index} HTTPCheck createHttpCheckBackend - -# Add a new HTTP check - -Adds a new HTTP check of the specified type in the specified parent. -*/ -type CreateHTTPCheckBackend struct { - Context *middleware.Context - Handler CreateHTTPCheckBackendHandler -} - -func (o *CreateHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/create_http_check_backend_parameters.go b/operations/http_check/create_http_check_backend_parameters.go deleted file mode 100644 index 9e7ba597..00000000 --- a/operations/http_check/create_http_check_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPCheckBackendParams creates a new CreateHTTPCheckBackendParams object -// with the default values initialized. -func NewCreateHTTPCheckBackendParams() CreateHTTPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPCheckBackendParams contains all the bound params for the create HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPCheckBackend -type CreateHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPCheckBackendParams() beforehand. -func (o *CreateHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/create_http_check_backend_responses.go b/operations/http_check/create_http_check_backend_responses.go deleted file mode 100644 index 58bab841..00000000 --- a/operations/http_check/create_http_check_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPCheckBackendCreatedCode is the HTTP code returned for type CreateHTTPCheckBackendCreated -const CreateHTTPCheckBackendCreatedCode int = 201 - -/* -CreateHTTPCheckBackendCreated HTTP check created - -swagger:response createHttpCheckBackendCreated -*/ -type CreateHTTPCheckBackendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewCreateHTTPCheckBackendCreated creates CreateHTTPCheckBackendCreated with default headers values -func NewCreateHTTPCheckBackendCreated() *CreateHTTPCheckBackendCreated { - - return &CreateHTTPCheckBackendCreated{} -} - -// WithPayload adds the payload to the create Http check backend created response -func (o *CreateHTTPCheckBackendCreated) WithPayload(payload *models.HTTPCheck) *CreateHTTPCheckBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check backend created response -func (o *CreateHTTPCheckBackendCreated) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckBackendAcceptedCode is the HTTP code returned for type CreateHTTPCheckBackendAccepted -const CreateHTTPCheckBackendAcceptedCode int = 202 - -/* -CreateHTTPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response createHttpCheckBackendAccepted -*/ -type CreateHTTPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewCreateHTTPCheckBackendAccepted creates CreateHTTPCheckBackendAccepted with default headers values -func NewCreateHTTPCheckBackendAccepted() *CreateHTTPCheckBackendAccepted { - - return &CreateHTTPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http check backend accepted response -func (o *CreateHTTPCheckBackendAccepted) WithReloadID(reloadID string) *CreateHTTPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http check backend accepted response -func (o *CreateHTTPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http check backend accepted response -func (o *CreateHTTPCheckBackendAccepted) WithPayload(payload *models.HTTPCheck) *CreateHTTPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check backend accepted response -func (o *CreateHTTPCheckBackendAccepted) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckBackendBadRequestCode is the HTTP code returned for type CreateHTTPCheckBackendBadRequest -const CreateHTTPCheckBackendBadRequestCode int = 400 - -/* -CreateHTTPCheckBackendBadRequest Bad request - -swagger:response createHttpCheckBackendBadRequest -*/ -type CreateHTTPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckBackendBadRequest creates CreateHTTPCheckBackendBadRequest with default headers values -func NewCreateHTTPCheckBackendBadRequest() *CreateHTTPCheckBackendBadRequest { - - return &CreateHTTPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http check backend bad request response -func (o *CreateHTTPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http check backend bad request response -func (o *CreateHTTPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http check backend bad request response -func (o *CreateHTTPCheckBackendBadRequest) WithPayload(payload *models.Error) *CreateHTTPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check backend bad request response -func (o *CreateHTTPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckBackendConflictCode is the HTTP code returned for type CreateHTTPCheckBackendConflict -const CreateHTTPCheckBackendConflictCode int = 409 - -/* -CreateHTTPCheckBackendConflict The specified resource already exists - -swagger:response createHttpCheckBackendConflict -*/ -type CreateHTTPCheckBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckBackendConflict creates CreateHTTPCheckBackendConflict with default headers values -func NewCreateHTTPCheckBackendConflict() *CreateHTTPCheckBackendConflict { - - return &CreateHTTPCheckBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http check backend conflict response -func (o *CreateHTTPCheckBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http check backend conflict response -func (o *CreateHTTPCheckBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http check backend conflict response -func (o *CreateHTTPCheckBackendConflict) WithPayload(payload *models.Error) *CreateHTTPCheckBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check backend conflict response -func (o *CreateHTTPCheckBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPCheckBackendDefault General Error - -swagger:response createHttpCheckBackendDefault -*/ -type CreateHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckBackendDefault creates CreateHTTPCheckBackendDefault with default headers values -func NewCreateHTTPCheckBackendDefault(code int) *CreateHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) WithStatusCode(code int) *CreateHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) WithPayload(payload *models.Error) *CreateHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP check backend default response -func (o *CreateHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/create_http_check_backend_urlbuilder.go b/operations/http_check/create_http_check_backend_urlbuilder.go deleted file mode 100644 index b6478ed7..00000000 --- a/operations/http_check/create_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPCheckBackendURL generates an URL for the create HTTP check backend operation -type CreateHTTPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPCheckBackendURL) WithBasePath(bp string) *CreateHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/create_http_check_defaults.go b/operations/http_check/create_http_check_defaults.go deleted file mode 100644 index 109bce16..00000000 --- a/operations/http_check/create_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a create HTTP check defaults handler -type CreateHTTPCheckDefaultsHandlerFunc func(CreateHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPCheckDefaultsHandlerFunc) Handle(params CreateHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPCheckDefaultsHandler interface for that can handle valid create HTTP check defaults params -type CreateHTTPCheckDefaultsHandler interface { - Handle(CreateHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateHTTPCheckDefaults creates a new http.Handler for the create HTTP check defaults operation -func NewCreateHTTPCheckDefaults(ctx *middleware.Context, handler CreateHTTPCheckDefaultsHandler) *CreateHTTPCheckDefaults { - return &CreateHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - CreateHTTPCheckDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index} HTTPCheck createHttpCheckDefaults - -# Add a new HTTP check - -Adds a new HTTP check of the specified type in the specified parent. -*/ -type CreateHTTPCheckDefaults struct { - Context *middleware.Context - Handler CreateHTTPCheckDefaultsHandler -} - -func (o *CreateHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/create_http_check_defaults_parameters.go b/operations/http_check/create_http_check_defaults_parameters.go deleted file mode 100644 index 75b62bed..00000000 --- a/operations/http_check/create_http_check_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPCheckDefaultsParams creates a new CreateHTTPCheckDefaultsParams object -// with the default values initialized. -func NewCreateHTTPCheckDefaultsParams() CreateHTTPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPCheckDefaultsParams contains all the bound params for the create HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPCheckDefaults -type CreateHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPCheckDefaultsParams() beforehand. -func (o *CreateHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/create_http_check_defaults_responses.go b/operations/http_check/create_http_check_defaults_responses.go deleted file mode 100644 index 9e3c6373..00000000 --- a/operations/http_check/create_http_check_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPCheckDefaultsCreatedCode is the HTTP code returned for type CreateHTTPCheckDefaultsCreated -const CreateHTTPCheckDefaultsCreatedCode int = 201 - -/* -CreateHTTPCheckDefaultsCreated HTTP check created - -swagger:response createHttpCheckDefaultsCreated -*/ -type CreateHTTPCheckDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewCreateHTTPCheckDefaultsCreated creates CreateHTTPCheckDefaultsCreated with default headers values -func NewCreateHTTPCheckDefaultsCreated() *CreateHTTPCheckDefaultsCreated { - - return &CreateHTTPCheckDefaultsCreated{} -} - -// WithPayload adds the payload to the create Http check defaults created response -func (o *CreateHTTPCheckDefaultsCreated) WithPayload(payload *models.HTTPCheck) *CreateHTTPCheckDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check defaults created response -func (o *CreateHTTPCheckDefaultsCreated) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckDefaultsAcceptedCode is the HTTP code returned for type CreateHTTPCheckDefaultsAccepted -const CreateHTTPCheckDefaultsAcceptedCode int = 202 - -/* -CreateHTTPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createHttpCheckDefaultsAccepted -*/ -type CreateHTTPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewCreateHTTPCheckDefaultsAccepted creates CreateHTTPCheckDefaultsAccepted with default headers values -func NewCreateHTTPCheckDefaultsAccepted() *CreateHTTPCheckDefaultsAccepted { - - return &CreateHTTPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Http check defaults accepted response -func (o *CreateHTTPCheckDefaultsAccepted) WithReloadID(reloadID string) *CreateHTTPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http check defaults accepted response -func (o *CreateHTTPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http check defaults accepted response -func (o *CreateHTTPCheckDefaultsAccepted) WithPayload(payload *models.HTTPCheck) *CreateHTTPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check defaults accepted response -func (o *CreateHTTPCheckDefaultsAccepted) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckDefaultsBadRequestCode is the HTTP code returned for type CreateHTTPCheckDefaultsBadRequest -const CreateHTTPCheckDefaultsBadRequestCode int = 400 - -/* -CreateHTTPCheckDefaultsBadRequest Bad request - -swagger:response createHttpCheckDefaultsBadRequest -*/ -type CreateHTTPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckDefaultsBadRequest creates CreateHTTPCheckDefaultsBadRequest with default headers values -func NewCreateHTTPCheckDefaultsBadRequest() *CreateHTTPCheckDefaultsBadRequest { - - return &CreateHTTPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http check defaults bad request response -func (o *CreateHTTPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http check defaults bad request response -func (o *CreateHTTPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http check defaults bad request response -func (o *CreateHTTPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *CreateHTTPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check defaults bad request response -func (o *CreateHTTPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPCheckDefaultsConflictCode is the HTTP code returned for type CreateHTTPCheckDefaultsConflict -const CreateHTTPCheckDefaultsConflictCode int = 409 - -/* -CreateHTTPCheckDefaultsConflict The specified resource already exists - -swagger:response createHttpCheckDefaultsConflict -*/ -type CreateHTTPCheckDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckDefaultsConflict creates CreateHTTPCheckDefaultsConflict with default headers values -func NewCreateHTTPCheckDefaultsConflict() *CreateHTTPCheckDefaultsConflict { - - return &CreateHTTPCheckDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http check defaults conflict response -func (o *CreateHTTPCheckDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http check defaults conflict response -func (o *CreateHTTPCheckDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http check defaults conflict response -func (o *CreateHTTPCheckDefaultsConflict) WithPayload(payload *models.Error) *CreateHTTPCheckDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http check defaults conflict response -func (o *CreateHTTPCheckDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPCheckDefaultsDefault General Error - -swagger:response createHttpCheckDefaultsDefault -*/ -type CreateHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPCheckDefaultsDefault creates CreateHTTPCheckDefaultsDefault with default headers values -func NewCreateHTTPCheckDefaultsDefault(code int) *CreateHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) WithStatusCode(code int) *CreateHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *CreateHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP check defaults default response -func (o *CreateHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/create_http_check_defaults_urlbuilder.go b/operations/http_check/create_http_check_defaults_urlbuilder.go deleted file mode 100644 index cc676e7b..00000000 --- a/operations/http_check/create_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPCheckDefaultsURL generates an URL for the create HTTP check defaults operation -type CreateHTTPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPCheckDefaultsURL) WithBasePath(bp string) *CreateHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/delete_http_check_backend.go b/operations/http_check/delete_http_check_backend.go deleted file mode 100644 index bed6f045..00000000 --- a/operations/http_check/delete_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPCheckBackendHandlerFunc turns a function with the right signature into a delete HTTP check backend handler -type DeleteHTTPCheckBackendHandlerFunc func(DeleteHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPCheckBackendHandlerFunc) Handle(params DeleteHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPCheckBackendHandler interface for that can handle valid delete HTTP check backend params -type DeleteHTTPCheckBackendHandler interface { - Handle(DeleteHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPCheckBackend creates a new http.Handler for the delete HTTP check backend operation -func NewDeleteHTTPCheckBackend(ctx *middleware.Context, handler DeleteHTTPCheckBackendHandler) *DeleteHTTPCheckBackend { - return &DeleteHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPCheckBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/http_checks/{index} HTTPCheck deleteHttpCheckBackend - -# Delete a HTTP check - -Deletes a HTTP check configuration by it's index from the specified parent. -*/ -type DeleteHTTPCheckBackend struct { - Context *middleware.Context - Handler DeleteHTTPCheckBackendHandler -} - -func (o *DeleteHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/delete_http_check_backend_parameters.go b/operations/http_check/delete_http_check_backend_parameters.go deleted file mode 100644 index 5255e0e4..00000000 --- a/operations/http_check/delete_http_check_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPCheckBackendParams creates a new DeleteHTTPCheckBackendParams object -// with the default values initialized. -func NewDeleteHTTPCheckBackendParams() DeleteHTTPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPCheckBackendParams contains all the bound params for the delete HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPCheckBackend -type DeleteHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPCheckBackendParams() beforehand. -func (o *DeleteHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/delete_http_check_backend_responses.go b/operations/http_check/delete_http_check_backend_responses.go deleted file mode 100644 index d0e0e3d2..00000000 --- a/operations/http_check/delete_http_check_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPCheckBackendAcceptedCode is the HTTP code returned for type DeleteHTTPCheckBackendAccepted -const DeleteHTTPCheckBackendAcceptedCode int = 202 - -/* -DeleteHTTPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpCheckBackendAccepted -*/ -type DeleteHTTPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPCheckBackendAccepted creates DeleteHTTPCheckBackendAccepted with default headers values -func NewDeleteHTTPCheckBackendAccepted() *DeleteHTTPCheckBackendAccepted { - - return &DeleteHTTPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http check backend accepted response -func (o *DeleteHTTPCheckBackendAccepted) WithReloadID(reloadID string) *DeleteHTTPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http check backend accepted response -func (o *DeleteHTTPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPCheckBackendNoContentCode is the HTTP code returned for type DeleteHTTPCheckBackendNoContent -const DeleteHTTPCheckBackendNoContentCode int = 204 - -/* -DeleteHTTPCheckBackendNoContent HTTP check deleted - -swagger:response deleteHttpCheckBackendNoContent -*/ -type DeleteHTTPCheckBackendNoContent struct { -} - -// NewDeleteHTTPCheckBackendNoContent creates DeleteHTTPCheckBackendNoContent with default headers values -func NewDeleteHTTPCheckBackendNoContent() *DeleteHTTPCheckBackendNoContent { - - return &DeleteHTTPCheckBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPCheckBackendNotFoundCode is the HTTP code returned for type DeleteHTTPCheckBackendNotFound -const DeleteHTTPCheckBackendNotFoundCode int = 404 - -/* -DeleteHTTPCheckBackendNotFound The specified resource was not found - -swagger:response deleteHttpCheckBackendNotFound -*/ -type DeleteHTTPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPCheckBackendNotFound creates DeleteHTTPCheckBackendNotFound with default headers values -func NewDeleteHTTPCheckBackendNotFound() *DeleteHTTPCheckBackendNotFound { - - return &DeleteHTTPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http check backend not found response -func (o *DeleteHTTPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http check backend not found response -func (o *DeleteHTTPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http check backend not found response -func (o *DeleteHTTPCheckBackendNotFound) WithPayload(payload *models.Error) *DeleteHTTPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http check backend not found response -func (o *DeleteHTTPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPCheckBackendDefault General Error - -swagger:response deleteHttpCheckBackendDefault -*/ -type DeleteHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPCheckBackendDefault creates DeleteHTTPCheckBackendDefault with default headers values -func NewDeleteHTTPCheckBackendDefault(code int) *DeleteHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) WithStatusCode(code int) *DeleteHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) WithPayload(payload *models.Error) *DeleteHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP check backend default response -func (o *DeleteHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/delete_http_check_backend_urlbuilder.go b/operations/http_check/delete_http_check_backend_urlbuilder.go deleted file mode 100644 index d8a11ce1..00000000 --- a/operations/http_check/delete_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPCheckBackendURL generates an URL for the delete HTTP check backend operation -type DeleteHTTPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPCheckBackendURL) WithBasePath(bp string) *DeleteHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/delete_http_check_defaults.go b/operations/http_check/delete_http_check_defaults.go deleted file mode 100644 index 4eea6d68..00000000 --- a/operations/http_check/delete_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a delete HTTP check defaults handler -type DeleteHTTPCheckDefaultsHandlerFunc func(DeleteHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPCheckDefaultsHandlerFunc) Handle(params DeleteHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPCheckDefaultsHandler interface for that can handle valid delete HTTP check defaults params -type DeleteHTTPCheckDefaultsHandler interface { - Handle(DeleteHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPCheckDefaults creates a new http.Handler for the delete HTTP check defaults operation -func NewDeleteHTTPCheckDefaults(ctx *middleware.Context, handler DeleteHTTPCheckDefaultsHandler) *DeleteHTTPCheckDefaults { - return &DeleteHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPCheckDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index} HTTPCheck deleteHttpCheckDefaults - -# Delete a HTTP check - -Deletes a HTTP check configuration by it's index from the specified parent. -*/ -type DeleteHTTPCheckDefaults struct { - Context *middleware.Context - Handler DeleteHTTPCheckDefaultsHandler -} - -func (o *DeleteHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/delete_http_check_defaults_parameters.go b/operations/http_check/delete_http_check_defaults_parameters.go deleted file mode 100644 index 46d2fb26..00000000 --- a/operations/http_check/delete_http_check_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPCheckDefaultsParams creates a new DeleteHTTPCheckDefaultsParams object -// with the default values initialized. -func NewDeleteHTTPCheckDefaultsParams() DeleteHTTPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPCheckDefaultsParams contains all the bound params for the delete HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPCheckDefaults -type DeleteHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPCheckDefaultsParams() beforehand. -func (o *DeleteHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/delete_http_check_defaults_responses.go b/operations/http_check/delete_http_check_defaults_responses.go deleted file mode 100644 index 39dd5a33..00000000 --- a/operations/http_check/delete_http_check_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPCheckDefaultsAcceptedCode is the HTTP code returned for type DeleteHTTPCheckDefaultsAccepted -const DeleteHTTPCheckDefaultsAcceptedCode int = 202 - -/* -DeleteHTTPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpCheckDefaultsAccepted -*/ -type DeleteHTTPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPCheckDefaultsAccepted creates DeleteHTTPCheckDefaultsAccepted with default headers values -func NewDeleteHTTPCheckDefaultsAccepted() *DeleteHTTPCheckDefaultsAccepted { - - return &DeleteHTTPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http check defaults accepted response -func (o *DeleteHTTPCheckDefaultsAccepted) WithReloadID(reloadID string) *DeleteHTTPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http check defaults accepted response -func (o *DeleteHTTPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPCheckDefaultsNoContentCode is the HTTP code returned for type DeleteHTTPCheckDefaultsNoContent -const DeleteHTTPCheckDefaultsNoContentCode int = 204 - -/* -DeleteHTTPCheckDefaultsNoContent HTTP check deleted - -swagger:response deleteHttpCheckDefaultsNoContent -*/ -type DeleteHTTPCheckDefaultsNoContent struct { -} - -// NewDeleteHTTPCheckDefaultsNoContent creates DeleteHTTPCheckDefaultsNoContent with default headers values -func NewDeleteHTTPCheckDefaultsNoContent() *DeleteHTTPCheckDefaultsNoContent { - - return &DeleteHTTPCheckDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPCheckDefaultsNotFoundCode is the HTTP code returned for type DeleteHTTPCheckDefaultsNotFound -const DeleteHTTPCheckDefaultsNotFoundCode int = 404 - -/* -DeleteHTTPCheckDefaultsNotFound The specified resource was not found - -swagger:response deleteHttpCheckDefaultsNotFound -*/ -type DeleteHTTPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPCheckDefaultsNotFound creates DeleteHTTPCheckDefaultsNotFound with default headers values -func NewDeleteHTTPCheckDefaultsNotFound() *DeleteHTTPCheckDefaultsNotFound { - - return &DeleteHTTPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http check defaults not found response -func (o *DeleteHTTPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http check defaults not found response -func (o *DeleteHTTPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http check defaults not found response -func (o *DeleteHTTPCheckDefaultsNotFound) WithPayload(payload *models.Error) *DeleteHTTPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http check defaults not found response -func (o *DeleteHTTPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPCheckDefaultsDefault General Error - -swagger:response deleteHttpCheckDefaultsDefault -*/ -type DeleteHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPCheckDefaultsDefault creates DeleteHTTPCheckDefaultsDefault with default headers values -func NewDeleteHTTPCheckDefaultsDefault(code int) *DeleteHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) WithStatusCode(code int) *DeleteHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *DeleteHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP check defaults default response -func (o *DeleteHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/delete_http_check_defaults_urlbuilder.go b/operations/http_check/delete_http_check_defaults_urlbuilder.go deleted file mode 100644 index cebd6550..00000000 --- a/operations/http_check/delete_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPCheckDefaultsURL generates an URL for the delete HTTP check defaults operation -type DeleteHTTPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPCheckDefaultsURL) WithBasePath(bp string) *DeleteHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/get_all_http_check_backend.go b/operations/http_check/get_all_http_check_backend.go deleted file mode 100644 index 9a05839f..00000000 --- a/operations/http_check/get_all_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPCheckBackendHandlerFunc turns a function with the right signature into a get all HTTP check backend handler -type GetAllHTTPCheckBackendHandlerFunc func(GetAllHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPCheckBackendHandlerFunc) Handle(params GetAllHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPCheckBackendHandler interface for that can handle valid get all HTTP check backend params -type GetAllHTTPCheckBackendHandler interface { - Handle(GetAllHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPCheckBackend creates a new http.Handler for the get all HTTP check backend operation -func NewGetAllHTTPCheckBackend(ctx *middleware.Context, handler GetAllHTTPCheckBackendHandler) *GetAllHTTPCheckBackend { - return &GetAllHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPCheckBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_checks HTTPCheck getAllHttpCheckBackend - -# Return an array of HTTP checks - -Returns all HTTP checks that are configured in specified parent. -*/ -type GetAllHTTPCheckBackend struct { - Context *middleware.Context - Handler GetAllHTTPCheckBackendHandler -} - -func (o *GetAllHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/get_all_http_check_backend_parameters.go b/operations/http_check/get_all_http_check_backend_parameters.go deleted file mode 100644 index 5155ce84..00000000 --- a/operations/http_check/get_all_http_check_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPCheckBackendParams creates a new GetAllHTTPCheckBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPCheckBackendParams() GetAllHTTPCheckBackendParams { - - return GetAllHTTPCheckBackendParams{} -} - -// GetAllHTTPCheckBackendParams contains all the bound params for the get all HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPCheckBackend -type GetAllHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPCheckBackendParams() beforehand. -func (o *GetAllHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_check/get_all_http_check_backend_responses.go b/operations/http_check/get_all_http_check_backend_responses.go deleted file mode 100644 index cf332d02..00000000 --- a/operations/http_check/get_all_http_check_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPCheckBackendOKCode is the HTTP code returned for type GetAllHTTPCheckBackendOK -const GetAllHTTPCheckBackendOKCode int = 200 - -/* -GetAllHTTPCheckBackendOK Successful operation - -swagger:response getAllHttpCheckBackendOK -*/ -type GetAllHTTPCheckBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewGetAllHTTPCheckBackendOK creates GetAllHTTPCheckBackendOK with default headers values -func NewGetAllHTTPCheckBackendOK() *GetAllHTTPCheckBackendOK { - - return &GetAllHTTPCheckBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http check backend o k response -func (o *GetAllHTTPCheckBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPCheckBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http check backend o k response -func (o *GetAllHTTPCheckBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http check backend o k response -func (o *GetAllHTTPCheckBackendOK) WithPayload(payload models.HTTPChecks) *GetAllHTTPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http check backend o k response -func (o *GetAllHTTPCheckBackendOK) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPCheckBackendDefault General Error - -swagger:response getAllHttpCheckBackendDefault -*/ -type GetAllHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPCheckBackendDefault creates GetAllHTTPCheckBackendDefault with default headers values -func NewGetAllHTTPCheckBackendDefault(code int) *GetAllHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) WithStatusCode(code int) *GetAllHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) WithPayload(payload *models.Error) *GetAllHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP check backend default response -func (o *GetAllHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/get_all_http_check_backend_urlbuilder.go b/operations/http_check/get_all_http_check_backend_urlbuilder.go deleted file mode 100644 index 3b7b3e8b..00000000 --- a/operations/http_check/get_all_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPCheckBackendURL generates an URL for the get all HTTP check backend operation -type GetAllHTTPCheckBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPCheckBackendURL) WithBasePath(bp string) *GetAllHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/get_all_http_check_defaults.go b/operations/http_check/get_all_http_check_defaults.go deleted file mode 100644 index 8f39f420..00000000 --- a/operations/http_check/get_all_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a get all HTTP check defaults handler -type GetAllHTTPCheckDefaultsHandlerFunc func(GetAllHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPCheckDefaultsHandlerFunc) Handle(params GetAllHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPCheckDefaultsHandler interface for that can handle valid get all HTTP check defaults params -type GetAllHTTPCheckDefaultsHandler interface { - Handle(GetAllHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPCheckDefaults creates a new http.Handler for the get all HTTP check defaults operation -func NewGetAllHTTPCheckDefaults(ctx *middleware.Context, handler GetAllHTTPCheckDefaultsHandler) *GetAllHTTPCheckDefaults { - return &GetAllHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPCheckDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_checks HTTPCheck getAllHttpCheckDefaults - -# Return an array of HTTP checks - -Returns all HTTP checks that are configured in specified parent. -*/ -type GetAllHTTPCheckDefaults struct { - Context *middleware.Context - Handler GetAllHTTPCheckDefaultsHandler -} - -func (o *GetAllHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/get_all_http_check_defaults_parameters.go b/operations/http_check/get_all_http_check_defaults_parameters.go deleted file mode 100644 index 6e398d48..00000000 --- a/operations/http_check/get_all_http_check_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPCheckDefaultsParams creates a new GetAllHTTPCheckDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPCheckDefaultsParams() GetAllHTTPCheckDefaultsParams { - - return GetAllHTTPCheckDefaultsParams{} -} - -// GetAllHTTPCheckDefaultsParams contains all the bound params for the get all HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPCheckDefaults -type GetAllHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPCheckDefaultsParams() beforehand. -func (o *GetAllHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_check/get_all_http_check_defaults_responses.go b/operations/http_check/get_all_http_check_defaults_responses.go deleted file mode 100644 index 5617b676..00000000 --- a/operations/http_check/get_all_http_check_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPCheckDefaultsOKCode is the HTTP code returned for type GetAllHTTPCheckDefaultsOK -const GetAllHTTPCheckDefaultsOKCode int = 200 - -/* -GetAllHTTPCheckDefaultsOK Successful operation - -swagger:response getAllHttpCheckDefaultsOK -*/ -type GetAllHTTPCheckDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewGetAllHTTPCheckDefaultsOK creates GetAllHTTPCheckDefaultsOK with default headers values -func NewGetAllHTTPCheckDefaultsOK() *GetAllHTTPCheckDefaultsOK { - - return &GetAllHTTPCheckDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http check defaults o k response -func (o *GetAllHTTPCheckDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPCheckDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http check defaults o k response -func (o *GetAllHTTPCheckDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http check defaults o k response -func (o *GetAllHTTPCheckDefaultsOK) WithPayload(payload models.HTTPChecks) *GetAllHTTPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http check defaults o k response -func (o *GetAllHTTPCheckDefaultsOK) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPCheckDefaultsDefault General Error - -swagger:response getAllHttpCheckDefaultsDefault -*/ -type GetAllHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPCheckDefaultsDefault creates GetAllHTTPCheckDefaultsDefault with default headers values -func NewGetAllHTTPCheckDefaultsDefault(code int) *GetAllHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) WithStatusCode(code int) *GetAllHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *GetAllHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP check defaults default response -func (o *GetAllHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/get_all_http_check_defaults_urlbuilder.go b/operations/http_check/get_all_http_check_defaults_urlbuilder.go deleted file mode 100644 index aeb0abf2..00000000 --- a/operations/http_check/get_all_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPCheckDefaultsURL generates an URL for the get all HTTP check defaults operation -type GetAllHTTPCheckDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPCheckDefaultsURL) WithBasePath(bp string) *GetAllHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/get_http_check_backend.go b/operations/http_check/get_http_check_backend.go deleted file mode 100644 index 75aa429c..00000000 --- a/operations/http_check/get_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPCheckBackendHandlerFunc turns a function with the right signature into a get HTTP check backend handler -type GetHTTPCheckBackendHandlerFunc func(GetHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPCheckBackendHandlerFunc) Handle(params GetHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPCheckBackendHandler interface for that can handle valid get HTTP check backend params -type GetHTTPCheckBackendHandler interface { - Handle(GetHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewGetHTTPCheckBackend creates a new http.Handler for the get HTTP check backend operation -func NewGetHTTPCheckBackend(ctx *middleware.Context, handler GetHTTPCheckBackendHandler) *GetHTTPCheckBackend { - return &GetHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - GetHTTPCheckBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_checks/{index} HTTPCheck getHttpCheckBackend - -# Return one HTTP check - -Returns one HTTP check configuration by it's index in the specified parent. -*/ -type GetHTTPCheckBackend struct { - Context *middleware.Context - Handler GetHTTPCheckBackendHandler -} - -func (o *GetHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/get_http_check_backend_parameters.go b/operations/http_check/get_http_check_backend_parameters.go deleted file mode 100644 index 490eec9a..00000000 --- a/operations/http_check/get_http_check_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPCheckBackendParams creates a new GetHTTPCheckBackendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPCheckBackendParams() GetHTTPCheckBackendParams { - - return GetHTTPCheckBackendParams{} -} - -// GetHTTPCheckBackendParams contains all the bound params for the get HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPCheckBackend -type GetHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPCheckBackendParams() beforehand. -func (o *GetHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_check/get_http_check_backend_responses.go b/operations/http_check/get_http_check_backend_responses.go deleted file mode 100644 index 9743dd9d..00000000 --- a/operations/http_check/get_http_check_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPCheckBackendOKCode is the HTTP code returned for type GetHTTPCheckBackendOK -const GetHTTPCheckBackendOKCode int = 200 - -/* -GetHTTPCheckBackendOK Successful operation - -swagger:response getHttpCheckBackendOK -*/ -type GetHTTPCheckBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewGetHTTPCheckBackendOK creates GetHTTPCheckBackendOK with default headers values -func NewGetHTTPCheckBackendOK() *GetHTTPCheckBackendOK { - - return &GetHTTPCheckBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http check backend o k response -func (o *GetHTTPCheckBackendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http check backend o k response -func (o *GetHTTPCheckBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http check backend o k response -func (o *GetHTTPCheckBackendOK) WithPayload(payload *models.HTTPCheck) *GetHTTPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http check backend o k response -func (o *GetHTTPCheckBackendOK) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPCheckBackendNotFoundCode is the HTTP code returned for type GetHTTPCheckBackendNotFound -const GetHTTPCheckBackendNotFoundCode int = 404 - -/* -GetHTTPCheckBackendNotFound The specified resource was not found - -swagger:response getHttpCheckBackendNotFound -*/ -type GetHTTPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPCheckBackendNotFound creates GetHTTPCheckBackendNotFound with default headers values -func NewGetHTTPCheckBackendNotFound() *GetHTTPCheckBackendNotFound { - - return &GetHTTPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http check backend not found response -func (o *GetHTTPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http check backend not found response -func (o *GetHTTPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http check backend not found response -func (o *GetHTTPCheckBackendNotFound) WithPayload(payload *models.Error) *GetHTTPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http check backend not found response -func (o *GetHTTPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPCheckBackendDefault General Error - -swagger:response getHttpCheckBackendDefault -*/ -type GetHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPCheckBackendDefault creates GetHTTPCheckBackendDefault with default headers values -func NewGetHTTPCheckBackendDefault(code int) *GetHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) WithStatusCode(code int) *GetHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) WithPayload(payload *models.Error) *GetHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP check backend default response -func (o *GetHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/get_http_check_backend_urlbuilder.go b/operations/http_check/get_http_check_backend_urlbuilder.go deleted file mode 100644 index 78632526..00000000 --- a/operations/http_check/get_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPCheckBackendURL generates an URL for the get HTTP check backend operation -type GetHTTPCheckBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPCheckBackendURL) WithBasePath(bp string) *GetHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/get_http_check_defaults.go b/operations/http_check/get_http_check_defaults.go deleted file mode 100644 index 512d1f12..00000000 --- a/operations/http_check/get_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a get HTTP check defaults handler -type GetHTTPCheckDefaultsHandlerFunc func(GetHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPCheckDefaultsHandlerFunc) Handle(params GetHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPCheckDefaultsHandler interface for that can handle valid get HTTP check defaults params -type GetHTTPCheckDefaultsHandler interface { - Handle(GetHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewGetHTTPCheckDefaults creates a new http.Handler for the get HTTP check defaults operation -func NewGetHTTPCheckDefaults(ctx *middleware.Context, handler GetHTTPCheckDefaultsHandler) *GetHTTPCheckDefaults { - return &GetHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - GetHTTPCheckDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index} HTTPCheck getHttpCheckDefaults - -# Return one HTTP check - -Returns one HTTP check configuration by it's index in the specified parent. -*/ -type GetHTTPCheckDefaults struct { - Context *middleware.Context - Handler GetHTTPCheckDefaultsHandler -} - -func (o *GetHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/get_http_check_defaults_parameters.go b/operations/http_check/get_http_check_defaults_parameters.go deleted file mode 100644 index de85fd3a..00000000 --- a/operations/http_check/get_http_check_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPCheckDefaultsParams creates a new GetHTTPCheckDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPCheckDefaultsParams() GetHTTPCheckDefaultsParams { - - return GetHTTPCheckDefaultsParams{} -} - -// GetHTTPCheckDefaultsParams contains all the bound params for the get HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPCheckDefaults -type GetHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPCheckDefaultsParams() beforehand. -func (o *GetHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_check/get_http_check_defaults_responses.go b/operations/http_check/get_http_check_defaults_responses.go deleted file mode 100644 index eb739b7a..00000000 --- a/operations/http_check/get_http_check_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPCheckDefaultsOKCode is the HTTP code returned for type GetHTTPCheckDefaultsOK -const GetHTTPCheckDefaultsOKCode int = 200 - -/* -GetHTTPCheckDefaultsOK Successful operation - -swagger:response getHttpCheckDefaultsOK -*/ -type GetHTTPCheckDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewGetHTTPCheckDefaultsOK creates GetHTTPCheckDefaultsOK with default headers values -func NewGetHTTPCheckDefaultsOK() *GetHTTPCheckDefaultsOK { - - return &GetHTTPCheckDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http check defaults o k response -func (o *GetHTTPCheckDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http check defaults o k response -func (o *GetHTTPCheckDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http check defaults o k response -func (o *GetHTTPCheckDefaultsOK) WithPayload(payload *models.HTTPCheck) *GetHTTPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http check defaults o k response -func (o *GetHTTPCheckDefaultsOK) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPCheckDefaultsNotFoundCode is the HTTP code returned for type GetHTTPCheckDefaultsNotFound -const GetHTTPCheckDefaultsNotFoundCode int = 404 - -/* -GetHTTPCheckDefaultsNotFound The specified resource was not found - -swagger:response getHttpCheckDefaultsNotFound -*/ -type GetHTTPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPCheckDefaultsNotFound creates GetHTTPCheckDefaultsNotFound with default headers values -func NewGetHTTPCheckDefaultsNotFound() *GetHTTPCheckDefaultsNotFound { - - return &GetHTTPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http check defaults not found response -func (o *GetHTTPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http check defaults not found response -func (o *GetHTTPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http check defaults not found response -func (o *GetHTTPCheckDefaultsNotFound) WithPayload(payload *models.Error) *GetHTTPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http check defaults not found response -func (o *GetHTTPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPCheckDefaultsDefault General Error - -swagger:response getHttpCheckDefaultsDefault -*/ -type GetHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPCheckDefaultsDefault creates GetHTTPCheckDefaultsDefault with default headers values -func NewGetHTTPCheckDefaultsDefault(code int) *GetHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) WithStatusCode(code int) *GetHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *GetHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP check defaults default response -func (o *GetHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/get_http_check_defaults_urlbuilder.go b/operations/http_check/get_http_check_defaults_urlbuilder.go deleted file mode 100644 index 7c41f974..00000000 --- a/operations/http_check/get_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPCheckDefaultsURL generates an URL for the get HTTP check defaults operation -type GetHTTPCheckDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPCheckDefaultsURL) WithBasePath(bp string) *GetHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/replace_all_http_check_backend.go b/operations/http_check/replace_all_http_check_backend.go deleted file mode 100644 index 37d43acf..00000000 --- a/operations/http_check/replace_all_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPCheckBackendHandlerFunc turns a function with the right signature into a replace all HTTP check backend handler -type ReplaceAllHTTPCheckBackendHandlerFunc func(ReplaceAllHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPCheckBackendHandlerFunc) Handle(params ReplaceAllHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPCheckBackendHandler interface for that can handle valid replace all HTTP check backend params -type ReplaceAllHTTPCheckBackendHandler interface { - Handle(ReplaceAllHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPCheckBackend creates a new http.Handler for the replace all HTTP check backend operation -func NewReplaceAllHTTPCheckBackend(ctx *middleware.Context, handler ReplaceAllHTTPCheckBackendHandler) *ReplaceAllHTTPCheckBackend { - return &ReplaceAllHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPCheckBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_checks HTTPCheck replaceAllHttpCheckBackend - -# Replace an HTTP checks list - -Replaces a whole list of HTTP checks with the list given in parameter -*/ -type ReplaceAllHTTPCheckBackend struct { - Context *middleware.Context - Handler ReplaceAllHTTPCheckBackendHandler -} - -func (o *ReplaceAllHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/replace_all_http_check_backend_parameters.go b/operations/http_check/replace_all_http_check_backend_parameters.go deleted file mode 100644 index 3569802c..00000000 --- a/operations/http_check/replace_all_http_check_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPCheckBackendParams creates a new ReplaceAllHTTPCheckBackendParams object -// with the default values initialized. -func NewReplaceAllHTTPCheckBackendParams() ReplaceAllHTTPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPCheckBackendParams contains all the bound params for the replace all HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPCheckBackend -type ReplaceAllHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPChecks - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPCheckBackendParams() beforehand. -func (o *ReplaceAllHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPChecks - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/replace_all_http_check_backend_responses.go b/operations/http_check/replace_all_http_check_backend_responses.go deleted file mode 100644 index b5f0721c..00000000 --- a/operations/http_check/replace_all_http_check_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPCheckBackendOKCode is the HTTP code returned for type ReplaceAllHTTPCheckBackendOK -const ReplaceAllHTTPCheckBackendOKCode int = 200 - -/* -ReplaceAllHTTPCheckBackendOK All HTTP checks lines replaced - -swagger:response replaceAllHttpCheckBackendOK -*/ -type ReplaceAllHTTPCheckBackendOK struct { - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckBackendOK creates ReplaceAllHTTPCheckBackendOK with default headers values -func NewReplaceAllHTTPCheckBackendOK() *ReplaceAllHTTPCheckBackendOK { - - return &ReplaceAllHTTPCheckBackendOK{} -} - -// WithPayload adds the payload to the replace all Http check backend o k response -func (o *ReplaceAllHTTPCheckBackendOK) WithPayload(payload models.HTTPChecks) *ReplaceAllHTTPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check backend o k response -func (o *ReplaceAllHTTPCheckBackendOK) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPCheckBackendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPCheckBackendAccepted -const ReplaceAllHTTPCheckBackendAcceptedCode int = 202 - -/* -ReplaceAllHTTPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpCheckBackendAccepted -*/ -type ReplaceAllHTTPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckBackendAccepted creates ReplaceAllHTTPCheckBackendAccepted with default headers values -func NewReplaceAllHTTPCheckBackendAccepted() *ReplaceAllHTTPCheckBackendAccepted { - - return &ReplaceAllHTTPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http check backend accepted response -func (o *ReplaceAllHTTPCheckBackendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http check backend accepted response -func (o *ReplaceAllHTTPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http check backend accepted response -func (o *ReplaceAllHTTPCheckBackendAccepted) WithPayload(payload models.HTTPChecks) *ReplaceAllHTTPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check backend accepted response -func (o *ReplaceAllHTTPCheckBackendAccepted) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPCheckBackendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPCheckBackendBadRequest -const ReplaceAllHTTPCheckBackendBadRequestCode int = 400 - -/* -ReplaceAllHTTPCheckBackendBadRequest Bad request - -swagger:response replaceAllHttpCheckBackendBadRequest -*/ -type ReplaceAllHTTPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckBackendBadRequest creates ReplaceAllHTTPCheckBackendBadRequest with default headers values -func NewReplaceAllHTTPCheckBackendBadRequest() *ReplaceAllHTTPCheckBackendBadRequest { - - return &ReplaceAllHTTPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http check backend bad request response -func (o *ReplaceAllHTTPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http check backend bad request response -func (o *ReplaceAllHTTPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http check backend bad request response -func (o *ReplaceAllHTTPCheckBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check backend bad request response -func (o *ReplaceAllHTTPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPCheckBackendDefault General Error - -swagger:response replaceAllHttpCheckBackendDefault -*/ -type ReplaceAllHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckBackendDefault creates ReplaceAllHTTPCheckBackendDefault with default headers values -func NewReplaceAllHTTPCheckBackendDefault(code int) *ReplaceAllHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) WithStatusCode(code int) *ReplaceAllHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP check backend default response -func (o *ReplaceAllHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/replace_all_http_check_backend_urlbuilder.go b/operations/http_check/replace_all_http_check_backend_urlbuilder.go deleted file mode 100644 index 8b4941c7..00000000 --- a/operations/http_check/replace_all_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPCheckBackendURL generates an URL for the replace all HTTP check backend operation -type ReplaceAllHTTPCheckBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPCheckBackendURL) WithBasePath(bp string) *ReplaceAllHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/replace_all_http_check_defaults.go b/operations/http_check/replace_all_http_check_defaults.go deleted file mode 100644 index 05e0f64f..00000000 --- a/operations/http_check/replace_all_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a replace all HTTP check defaults handler -type ReplaceAllHTTPCheckDefaultsHandlerFunc func(ReplaceAllHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPCheckDefaultsHandlerFunc) Handle(params ReplaceAllHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPCheckDefaultsHandler interface for that can handle valid replace all HTTP check defaults params -type ReplaceAllHTTPCheckDefaultsHandler interface { - Handle(ReplaceAllHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPCheckDefaults creates a new http.Handler for the replace all HTTP check defaults operation -func NewReplaceAllHTTPCheckDefaults(ctx *middleware.Context, handler ReplaceAllHTTPCheckDefaultsHandler) *ReplaceAllHTTPCheckDefaults { - return &ReplaceAllHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPCheckDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks HTTPCheck replaceAllHttpCheckDefaults - -# Replace an HTTP checks list - -Replaces a whole list of HTTP checks with the list given in parameter -*/ -type ReplaceAllHTTPCheckDefaults struct { - Context *middleware.Context - Handler ReplaceAllHTTPCheckDefaultsHandler -} - -func (o *ReplaceAllHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/replace_all_http_check_defaults_parameters.go b/operations/http_check/replace_all_http_check_defaults_parameters.go deleted file mode 100644 index 0eb7a155..00000000 --- a/operations/http_check/replace_all_http_check_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPCheckDefaultsParams creates a new ReplaceAllHTTPCheckDefaultsParams object -// with the default values initialized. -func NewReplaceAllHTTPCheckDefaultsParams() ReplaceAllHTTPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPCheckDefaultsParams contains all the bound params for the replace all HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPCheckDefaults -type ReplaceAllHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPChecks - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPCheckDefaultsParams() beforehand. -func (o *ReplaceAllHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPChecks - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/replace_all_http_check_defaults_responses.go b/operations/http_check/replace_all_http_check_defaults_responses.go deleted file mode 100644 index a6882dd7..00000000 --- a/operations/http_check/replace_all_http_check_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPCheckDefaultsOKCode is the HTTP code returned for type ReplaceAllHTTPCheckDefaultsOK -const ReplaceAllHTTPCheckDefaultsOKCode int = 200 - -/* -ReplaceAllHTTPCheckDefaultsOK All HTTP checks lines replaced - -swagger:response replaceAllHttpCheckDefaultsOK -*/ -type ReplaceAllHTTPCheckDefaultsOK struct { - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckDefaultsOK creates ReplaceAllHTTPCheckDefaultsOK with default headers values -func NewReplaceAllHTTPCheckDefaultsOK() *ReplaceAllHTTPCheckDefaultsOK { - - return &ReplaceAllHTTPCheckDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Http check defaults o k response -func (o *ReplaceAllHTTPCheckDefaultsOK) WithPayload(payload models.HTTPChecks) *ReplaceAllHTTPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check defaults o k response -func (o *ReplaceAllHTTPCheckDefaultsOK) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPCheckDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllHTTPCheckDefaultsAccepted -const ReplaceAllHTTPCheckDefaultsAcceptedCode int = 202 - -/* -ReplaceAllHTTPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpCheckDefaultsAccepted -*/ -type ReplaceAllHTTPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPChecks `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckDefaultsAccepted creates ReplaceAllHTTPCheckDefaultsAccepted with default headers values -func NewReplaceAllHTTPCheckDefaultsAccepted() *ReplaceAllHTTPCheckDefaultsAccepted { - - return &ReplaceAllHTTPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http check defaults accepted response -func (o *ReplaceAllHTTPCheckDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http check defaults accepted response -func (o *ReplaceAllHTTPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http check defaults accepted response -func (o *ReplaceAllHTTPCheckDefaultsAccepted) WithPayload(payload models.HTTPChecks) *ReplaceAllHTTPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check defaults accepted response -func (o *ReplaceAllHTTPCheckDefaultsAccepted) SetPayload(payload models.HTTPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPCheckDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllHTTPCheckDefaultsBadRequest -const ReplaceAllHTTPCheckDefaultsBadRequestCode int = 400 - -/* -ReplaceAllHTTPCheckDefaultsBadRequest Bad request - -swagger:response replaceAllHttpCheckDefaultsBadRequest -*/ -type ReplaceAllHTTPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckDefaultsBadRequest creates ReplaceAllHTTPCheckDefaultsBadRequest with default headers values -func NewReplaceAllHTTPCheckDefaultsBadRequest() *ReplaceAllHTTPCheckDefaultsBadRequest { - - return &ReplaceAllHTTPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http check defaults bad request response -func (o *ReplaceAllHTTPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http check defaults bad request response -func (o *ReplaceAllHTTPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http check defaults bad request response -func (o *ReplaceAllHTTPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http check defaults bad request response -func (o *ReplaceAllHTTPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPCheckDefaultsDefault General Error - -swagger:response replaceAllHttpCheckDefaultsDefault -*/ -type ReplaceAllHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPCheckDefaultsDefault creates ReplaceAllHTTPCheckDefaultsDefault with default headers values -func NewReplaceAllHTTPCheckDefaultsDefault(code int) *ReplaceAllHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) WithStatusCode(code int) *ReplaceAllHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP check defaults default response -func (o *ReplaceAllHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/replace_all_http_check_defaults_urlbuilder.go b/operations/http_check/replace_all_http_check_defaults_urlbuilder.go deleted file mode 100644 index 38c1d3d6..00000000 --- a/operations/http_check/replace_all_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPCheckDefaultsURL generates an URL for the replace all HTTP check defaults operation -type ReplaceAllHTTPCheckDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPCheckDefaultsURL) WithBasePath(bp string) *ReplaceAllHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/replace_http_check_backend.go b/operations/http_check/replace_http_check_backend.go deleted file mode 100644 index f6043b1b..00000000 --- a/operations/http_check/replace_http_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPCheckBackendHandlerFunc turns a function with the right signature into a replace HTTP check backend handler -type ReplaceHTTPCheckBackendHandlerFunc func(ReplaceHTTPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPCheckBackendHandlerFunc) Handle(params ReplaceHTTPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPCheckBackendHandler interface for that can handle valid replace HTTP check backend params -type ReplaceHTTPCheckBackendHandler interface { - Handle(ReplaceHTTPCheckBackendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPCheckBackend creates a new http.Handler for the replace HTTP check backend operation -func NewReplaceHTTPCheckBackend(ctx *middleware.Context, handler ReplaceHTTPCheckBackendHandler) *ReplaceHTTPCheckBackend { - return &ReplaceHTTPCheckBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPCheckBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_checks/{index} HTTPCheck replaceHttpCheckBackend - -# Replace a HTTP check - -Replaces a HTTP Check configuration by it's index in the specified parent. -*/ -type ReplaceHTTPCheckBackend struct { - Context *middleware.Context - Handler ReplaceHTTPCheckBackendHandler -} - -func (o *ReplaceHTTPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/replace_http_check_backend_parameters.go b/operations/http_check/replace_http_check_backend_parameters.go deleted file mode 100644 index 77edcfdb..00000000 --- a/operations/http_check/replace_http_check_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPCheckBackendParams creates a new ReplaceHTTPCheckBackendParams object -// with the default values initialized. -func NewReplaceHTTPCheckBackendParams() ReplaceHTTPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPCheckBackendParams contains all the bound params for the replace HTTP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPCheckBackend -type ReplaceHTTPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPCheckBackendParams() beforehand. -func (o *ReplaceHTTPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/replace_http_check_backend_responses.go b/operations/http_check/replace_http_check_backend_responses.go deleted file mode 100644 index 9da64dc2..00000000 --- a/operations/http_check/replace_http_check_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPCheckBackendOKCode is the HTTP code returned for type ReplaceHTTPCheckBackendOK -const ReplaceHTTPCheckBackendOKCode int = 200 - -/* -ReplaceHTTPCheckBackendOK HTTP check replaced - -swagger:response replaceHttpCheckBackendOK -*/ -type ReplaceHTTPCheckBackendOK struct { - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckBackendOK creates ReplaceHTTPCheckBackendOK with default headers values -func NewReplaceHTTPCheckBackendOK() *ReplaceHTTPCheckBackendOK { - - return &ReplaceHTTPCheckBackendOK{} -} - -// WithPayload adds the payload to the replace Http check backend o k response -func (o *ReplaceHTTPCheckBackendOK) WithPayload(payload *models.HTTPCheck) *ReplaceHTTPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check backend o k response -func (o *ReplaceHTTPCheckBackendOK) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckBackendAcceptedCode is the HTTP code returned for type ReplaceHTTPCheckBackendAccepted -const ReplaceHTTPCheckBackendAcceptedCode int = 202 - -/* -ReplaceHTTPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpCheckBackendAccepted -*/ -type ReplaceHTTPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckBackendAccepted creates ReplaceHTTPCheckBackendAccepted with default headers values -func NewReplaceHTTPCheckBackendAccepted() *ReplaceHTTPCheckBackendAccepted { - - return &ReplaceHTTPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http check backend accepted response -func (o *ReplaceHTTPCheckBackendAccepted) WithReloadID(reloadID string) *ReplaceHTTPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http check backend accepted response -func (o *ReplaceHTTPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http check backend accepted response -func (o *ReplaceHTTPCheckBackendAccepted) WithPayload(payload *models.HTTPCheck) *ReplaceHTTPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check backend accepted response -func (o *ReplaceHTTPCheckBackendAccepted) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckBackendBadRequestCode is the HTTP code returned for type ReplaceHTTPCheckBackendBadRequest -const ReplaceHTTPCheckBackendBadRequestCode int = 400 - -/* -ReplaceHTTPCheckBackendBadRequest Bad request - -swagger:response replaceHttpCheckBackendBadRequest -*/ -type ReplaceHTTPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckBackendBadRequest creates ReplaceHTTPCheckBackendBadRequest with default headers values -func NewReplaceHTTPCheckBackendBadRequest() *ReplaceHTTPCheckBackendBadRequest { - - return &ReplaceHTTPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http check backend bad request response -func (o *ReplaceHTTPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http check backend bad request response -func (o *ReplaceHTTPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http check backend bad request response -func (o *ReplaceHTTPCheckBackendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check backend bad request response -func (o *ReplaceHTTPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckBackendNotFoundCode is the HTTP code returned for type ReplaceHTTPCheckBackendNotFound -const ReplaceHTTPCheckBackendNotFoundCode int = 404 - -/* -ReplaceHTTPCheckBackendNotFound The specified resource was not found - -swagger:response replaceHttpCheckBackendNotFound -*/ -type ReplaceHTTPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckBackendNotFound creates ReplaceHTTPCheckBackendNotFound with default headers values -func NewReplaceHTTPCheckBackendNotFound() *ReplaceHTTPCheckBackendNotFound { - - return &ReplaceHTTPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http check backend not found response -func (o *ReplaceHTTPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http check backend not found response -func (o *ReplaceHTTPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http check backend not found response -func (o *ReplaceHTTPCheckBackendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check backend not found response -func (o *ReplaceHTTPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPCheckBackendDefault General Error - -swagger:response replaceHttpCheckBackendDefault -*/ -type ReplaceHTTPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckBackendDefault creates ReplaceHTTPCheckBackendDefault with default headers values -func NewReplaceHTTPCheckBackendDefault(code int) *ReplaceHTTPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) WithStatusCode(code int) *ReplaceHTTPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) WithPayload(payload *models.Error) *ReplaceHTTPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP check backend default response -func (o *ReplaceHTTPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/replace_http_check_backend_urlbuilder.go b/operations/http_check/replace_http_check_backend_urlbuilder.go deleted file mode 100644 index eb617d41..00000000 --- a/operations/http_check/replace_http_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPCheckBackendURL generates an URL for the replace HTTP check backend operation -type ReplaceHTTPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPCheckBackendURL) WithBasePath(bp string) *ReplaceHTTPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_check/replace_http_check_defaults.go b/operations/http_check/replace_http_check_defaults.go deleted file mode 100644 index abdae708..00000000 --- a/operations/http_check/replace_http_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPCheckDefaultsHandlerFunc turns a function with the right signature into a replace HTTP check defaults handler -type ReplaceHTTPCheckDefaultsHandlerFunc func(ReplaceHTTPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPCheckDefaultsHandlerFunc) Handle(params ReplaceHTTPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPCheckDefaultsHandler interface for that can handle valid replace HTTP check defaults params -type ReplaceHTTPCheckDefaultsHandler interface { - Handle(ReplaceHTTPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPCheckDefaults creates a new http.Handler for the replace HTTP check defaults operation -func NewReplaceHTTPCheckDefaults(ctx *middleware.Context, handler ReplaceHTTPCheckDefaultsHandler) *ReplaceHTTPCheckDefaults { - return &ReplaceHTTPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPCheckDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index} HTTPCheck replaceHttpCheckDefaults - -# Replace a HTTP check - -Replaces a HTTP Check configuration by it's index in the specified parent. -*/ -type ReplaceHTTPCheckDefaults struct { - Context *middleware.Context - Handler ReplaceHTTPCheckDefaultsHandler -} - -func (o *ReplaceHTTPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_check/replace_http_check_defaults_parameters.go b/operations/http_check/replace_http_check_defaults_parameters.go deleted file mode 100644 index 01775240..00000000 --- a/operations/http_check/replace_http_check_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPCheckDefaultsParams creates a new ReplaceHTTPCheckDefaultsParams object -// with the default values initialized. -func NewReplaceHTTPCheckDefaultsParams() ReplaceHTTPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPCheckDefaultsParams contains all the bound params for the replace HTTP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPCheckDefaults -type ReplaceHTTPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPCheckDefaultsParams() beforehand. -func (o *ReplaceHTTPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_check/replace_http_check_defaults_responses.go b/operations/http_check/replace_http_check_defaults_responses.go deleted file mode 100644 index 27012528..00000000 --- a/operations/http_check/replace_http_check_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPCheckDefaultsOKCode is the HTTP code returned for type ReplaceHTTPCheckDefaultsOK -const ReplaceHTTPCheckDefaultsOKCode int = 200 - -/* -ReplaceHTTPCheckDefaultsOK HTTP check replaced - -swagger:response replaceHttpCheckDefaultsOK -*/ -type ReplaceHTTPCheckDefaultsOK struct { - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckDefaultsOK creates ReplaceHTTPCheckDefaultsOK with default headers values -func NewReplaceHTTPCheckDefaultsOK() *ReplaceHTTPCheckDefaultsOK { - - return &ReplaceHTTPCheckDefaultsOK{} -} - -// WithPayload adds the payload to the replace Http check defaults o k response -func (o *ReplaceHTTPCheckDefaultsOK) WithPayload(payload *models.HTTPCheck) *ReplaceHTTPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check defaults o k response -func (o *ReplaceHTTPCheckDefaultsOK) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckDefaultsAcceptedCode is the HTTP code returned for type ReplaceHTTPCheckDefaultsAccepted -const ReplaceHTTPCheckDefaultsAcceptedCode int = 202 - -/* -ReplaceHTTPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpCheckDefaultsAccepted -*/ -type ReplaceHTTPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPCheck `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckDefaultsAccepted creates ReplaceHTTPCheckDefaultsAccepted with default headers values -func NewReplaceHTTPCheckDefaultsAccepted() *ReplaceHTTPCheckDefaultsAccepted { - - return &ReplaceHTTPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http check defaults accepted response -func (o *ReplaceHTTPCheckDefaultsAccepted) WithReloadID(reloadID string) *ReplaceHTTPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http check defaults accepted response -func (o *ReplaceHTTPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http check defaults accepted response -func (o *ReplaceHTTPCheckDefaultsAccepted) WithPayload(payload *models.HTTPCheck) *ReplaceHTTPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check defaults accepted response -func (o *ReplaceHTTPCheckDefaultsAccepted) SetPayload(payload *models.HTTPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckDefaultsBadRequestCode is the HTTP code returned for type ReplaceHTTPCheckDefaultsBadRequest -const ReplaceHTTPCheckDefaultsBadRequestCode int = 400 - -/* -ReplaceHTTPCheckDefaultsBadRequest Bad request - -swagger:response replaceHttpCheckDefaultsBadRequest -*/ -type ReplaceHTTPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckDefaultsBadRequest creates ReplaceHTTPCheckDefaultsBadRequest with default headers values -func NewReplaceHTTPCheckDefaultsBadRequest() *ReplaceHTTPCheckDefaultsBadRequest { - - return &ReplaceHTTPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http check defaults bad request response -func (o *ReplaceHTTPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http check defaults bad request response -func (o *ReplaceHTTPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http check defaults bad request response -func (o *ReplaceHTTPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check defaults bad request response -func (o *ReplaceHTTPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPCheckDefaultsNotFoundCode is the HTTP code returned for type ReplaceHTTPCheckDefaultsNotFound -const ReplaceHTTPCheckDefaultsNotFoundCode int = 404 - -/* -ReplaceHTTPCheckDefaultsNotFound The specified resource was not found - -swagger:response replaceHttpCheckDefaultsNotFound -*/ -type ReplaceHTTPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckDefaultsNotFound creates ReplaceHTTPCheckDefaultsNotFound with default headers values -func NewReplaceHTTPCheckDefaultsNotFound() *ReplaceHTTPCheckDefaultsNotFound { - - return &ReplaceHTTPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http check defaults not found response -func (o *ReplaceHTTPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http check defaults not found response -func (o *ReplaceHTTPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http check defaults not found response -func (o *ReplaceHTTPCheckDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceHTTPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http check defaults not found response -func (o *ReplaceHTTPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPCheckDefaultsDefault General Error - -swagger:response replaceHttpCheckDefaultsDefault -*/ -type ReplaceHTTPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPCheckDefaultsDefault creates ReplaceHTTPCheckDefaultsDefault with default headers values -func NewReplaceHTTPCheckDefaultsDefault(code int) *ReplaceHTTPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) WithStatusCode(code int) *ReplaceHTTPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) WithPayload(payload *models.Error) *ReplaceHTTPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP check defaults default response -func (o *ReplaceHTTPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_check/replace_http_check_defaults_urlbuilder.go b/operations/http_check/replace_http_check_defaults_urlbuilder.go deleted file mode 100644 index 45ccc7ed..00000000 --- a/operations/http_check/replace_http_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPCheckDefaultsURL generates an URL for the replace HTTP check defaults operation -type ReplaceHTTPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPCheckDefaultsURL) WithBasePath(bp string) *ReplaceHTTPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/create_http_error_rule_backend.go b/operations/http_error_rule/create_http_error_rule_backend.go deleted file mode 100644 index 577ec15b..00000000 --- a/operations/http_error_rule/create_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a create HTTP error rule backend handler -type CreateHTTPErrorRuleBackendHandlerFunc func(CreateHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPErrorRuleBackendHandlerFunc) Handle(params CreateHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPErrorRuleBackendHandler interface for that can handle valid create HTTP error rule backend params -type CreateHTTPErrorRuleBackendHandler interface { - Handle(CreateHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPErrorRuleBackend creates a new http.Handler for the create HTTP error rule backend operation -func NewCreateHTTPErrorRuleBackend(ctx *middleware.Context, handler CreateHTTPErrorRuleBackendHandler) *CreateHTTPErrorRuleBackend { - return &CreateHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPErrorRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index} HTTPErrorRule createHttpErrorRuleBackend - -# Add a new HTTP Error Rule - -Adds a new HTTP Error Rule of the specified type in the specified parent. -*/ -type CreateHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler CreateHTTPErrorRuleBackendHandler -} - -func (o *CreateHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/create_http_error_rule_backend_parameters.go b/operations/http_error_rule/create_http_error_rule_backend_parameters.go deleted file mode 100644 index aeb5b09d..00000000 --- a/operations/http_error_rule/create_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPErrorRuleBackendParams creates a new CreateHTTPErrorRuleBackendParams object -// with the default values initialized. -func NewCreateHTTPErrorRuleBackendParams() CreateHTTPErrorRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPErrorRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPErrorRuleBackendParams contains all the bound params for the create HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPErrorRuleBackend -type CreateHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPErrorRuleBackendParams() beforehand. -func (o *CreateHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPErrorRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPErrorRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPErrorRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPErrorRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/create_http_error_rule_backend_responses.go b/operations/http_error_rule/create_http_error_rule_backend_responses.go deleted file mode 100644 index 58cb631f..00000000 --- a/operations/http_error_rule/create_http_error_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPErrorRuleBackendCreatedCode is the HTTP code returned for type CreateHTTPErrorRuleBackendCreated -const CreateHTTPErrorRuleBackendCreatedCode int = 201 - -/* -CreateHTTPErrorRuleBackendCreated HTTP Error Rule created - -swagger:response createHttpErrorRuleBackendCreated -*/ -type CreateHTTPErrorRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleBackendCreated creates CreateHTTPErrorRuleBackendCreated with default headers values -func NewCreateHTTPErrorRuleBackendCreated() *CreateHTTPErrorRuleBackendCreated { - - return &CreateHTTPErrorRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Http error rule backend created response -func (o *CreateHTTPErrorRuleBackendCreated) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule backend created response -func (o *CreateHTTPErrorRuleBackendCreated) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleBackendAcceptedCode is the HTTP code returned for type CreateHTTPErrorRuleBackendAccepted -const CreateHTTPErrorRuleBackendAcceptedCode int = 202 - -/* -CreateHTTPErrorRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createHttpErrorRuleBackendAccepted -*/ -type CreateHTTPErrorRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleBackendAccepted creates CreateHTTPErrorRuleBackendAccepted with default headers values -func NewCreateHTTPErrorRuleBackendAccepted() *CreateHTTPErrorRuleBackendAccepted { - - return &CreateHTTPErrorRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http error rule backend accepted response -func (o *CreateHTTPErrorRuleBackendAccepted) WithReloadID(reloadID string) *CreateHTTPErrorRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http error rule backend accepted response -func (o *CreateHTTPErrorRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http error rule backend accepted response -func (o *CreateHTTPErrorRuleBackendAccepted) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule backend accepted response -func (o *CreateHTTPErrorRuleBackendAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleBackendBadRequestCode is the HTTP code returned for type CreateHTTPErrorRuleBackendBadRequest -const CreateHTTPErrorRuleBackendBadRequestCode int = 400 - -/* -CreateHTTPErrorRuleBackendBadRequest Bad request - -swagger:response createHttpErrorRuleBackendBadRequest -*/ -type CreateHTTPErrorRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleBackendBadRequest creates CreateHTTPErrorRuleBackendBadRequest with default headers values -func NewCreateHTTPErrorRuleBackendBadRequest() *CreateHTTPErrorRuleBackendBadRequest { - - return &CreateHTTPErrorRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule backend bad request response -func (o *CreateHTTPErrorRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule backend bad request response -func (o *CreateHTTPErrorRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule backend bad request response -func (o *CreateHTTPErrorRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateHTTPErrorRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule backend bad request response -func (o *CreateHTTPErrorRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleBackendConflictCode is the HTTP code returned for type CreateHTTPErrorRuleBackendConflict -const CreateHTTPErrorRuleBackendConflictCode int = 409 - -/* -CreateHTTPErrorRuleBackendConflict The specified resource already exists - -swagger:response createHttpErrorRuleBackendConflict -*/ -type CreateHTTPErrorRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleBackendConflict creates CreateHTTPErrorRuleBackendConflict with default headers values -func NewCreateHTTPErrorRuleBackendConflict() *CreateHTTPErrorRuleBackendConflict { - - return &CreateHTTPErrorRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule backend conflict response -func (o *CreateHTTPErrorRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule backend conflict response -func (o *CreateHTTPErrorRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule backend conflict response -func (o *CreateHTTPErrorRuleBackendConflict) WithPayload(payload *models.Error) *CreateHTTPErrorRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule backend conflict response -func (o *CreateHTTPErrorRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPErrorRuleBackendDefault General Error - -swagger:response createHttpErrorRuleBackendDefault -*/ -type CreateHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleBackendDefault creates CreateHTTPErrorRuleBackendDefault with default headers values -func NewCreateHTTPErrorRuleBackendDefault(code int) *CreateHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) WithStatusCode(code int) *CreateHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *CreateHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP error rule backend default response -func (o *CreateHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/create_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/create_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index e497992d..00000000 --- a/operations/http_error_rule/create_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPErrorRuleBackendURL generates an URL for the create HTTP error rule backend operation -type CreateHTTPErrorRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleBackendURL) WithBasePath(bp string) *CreateHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPErrorRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/create_http_error_rule_defaults.go b/operations/http_error_rule/create_http_error_rule_defaults.go deleted file mode 100644 index 569e6be5..00000000 --- a/operations/http_error_rule/create_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a create HTTP error rule defaults handler -type CreateHTTPErrorRuleDefaultsHandlerFunc func(CreateHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPErrorRuleDefaultsHandlerFunc) Handle(params CreateHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPErrorRuleDefaultsHandler interface for that can handle valid create HTTP error rule defaults params -type CreateHTTPErrorRuleDefaultsHandler interface { - Handle(CreateHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateHTTPErrorRuleDefaults creates a new http.Handler for the create HTTP error rule defaults operation -func NewCreateHTTPErrorRuleDefaults(ctx *middleware.Context, handler CreateHTTPErrorRuleDefaultsHandler) *CreateHTTPErrorRuleDefaults { - return &CreateHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateHTTPErrorRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index} HTTPErrorRule createHttpErrorRuleDefaults - -# Add a new HTTP Error Rule - -Adds a new HTTP Error Rule of the specified type in the specified parent. -*/ -type CreateHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler CreateHTTPErrorRuleDefaultsHandler -} - -func (o *CreateHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/create_http_error_rule_defaults_parameters.go b/operations/http_error_rule/create_http_error_rule_defaults_parameters.go deleted file mode 100644 index 3c60a513..00000000 --- a/operations/http_error_rule/create_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPErrorRuleDefaultsParams creates a new CreateHTTPErrorRuleDefaultsParams object -// with the default values initialized. -func NewCreateHTTPErrorRuleDefaultsParams() CreateHTTPErrorRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPErrorRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPErrorRuleDefaultsParams contains all the bound params for the create HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPErrorRuleDefaults -type CreateHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPErrorRuleDefaultsParams() beforehand. -func (o *CreateHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPErrorRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPErrorRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPErrorRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPErrorRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/create_http_error_rule_defaults_responses.go b/operations/http_error_rule/create_http_error_rule_defaults_responses.go deleted file mode 100644 index d2439b8f..00000000 --- a/operations/http_error_rule/create_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPErrorRuleDefaultsCreatedCode is the HTTP code returned for type CreateHTTPErrorRuleDefaultsCreated -const CreateHTTPErrorRuleDefaultsCreatedCode int = 201 - -/* -CreateHTTPErrorRuleDefaultsCreated HTTP Error Rule created - -swagger:response createHttpErrorRuleDefaultsCreated -*/ -type CreateHTTPErrorRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleDefaultsCreated creates CreateHTTPErrorRuleDefaultsCreated with default headers values -func NewCreateHTTPErrorRuleDefaultsCreated() *CreateHTTPErrorRuleDefaultsCreated { - - return &CreateHTTPErrorRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Http error rule defaults created response -func (o *CreateHTTPErrorRuleDefaultsCreated) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule defaults created response -func (o *CreateHTTPErrorRuleDefaultsCreated) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleDefaultsAcceptedCode is the HTTP code returned for type CreateHTTPErrorRuleDefaultsAccepted -const CreateHTTPErrorRuleDefaultsAcceptedCode int = 202 - -/* -CreateHTTPErrorRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createHttpErrorRuleDefaultsAccepted -*/ -type CreateHTTPErrorRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleDefaultsAccepted creates CreateHTTPErrorRuleDefaultsAccepted with default headers values -func NewCreateHTTPErrorRuleDefaultsAccepted() *CreateHTTPErrorRuleDefaultsAccepted { - - return &CreateHTTPErrorRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Http error rule defaults accepted response -func (o *CreateHTTPErrorRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateHTTPErrorRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http error rule defaults accepted response -func (o *CreateHTTPErrorRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http error rule defaults accepted response -func (o *CreateHTTPErrorRuleDefaultsAccepted) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule defaults accepted response -func (o *CreateHTTPErrorRuleDefaultsAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleDefaultsBadRequestCode is the HTTP code returned for type CreateHTTPErrorRuleDefaultsBadRequest -const CreateHTTPErrorRuleDefaultsBadRequestCode int = 400 - -/* -CreateHTTPErrorRuleDefaultsBadRequest Bad request - -swagger:response createHttpErrorRuleDefaultsBadRequest -*/ -type CreateHTTPErrorRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleDefaultsBadRequest creates CreateHTTPErrorRuleDefaultsBadRequest with default headers values -func NewCreateHTTPErrorRuleDefaultsBadRequest() *CreateHTTPErrorRuleDefaultsBadRequest { - - return &CreateHTTPErrorRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule defaults bad request response -func (o *CreateHTTPErrorRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule defaults bad request response -func (o *CreateHTTPErrorRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule defaults bad request response -func (o *CreateHTTPErrorRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateHTTPErrorRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule defaults bad request response -func (o *CreateHTTPErrorRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleDefaultsConflictCode is the HTTP code returned for type CreateHTTPErrorRuleDefaultsConflict -const CreateHTTPErrorRuleDefaultsConflictCode int = 409 - -/* -CreateHTTPErrorRuleDefaultsConflict The specified resource already exists - -swagger:response createHttpErrorRuleDefaultsConflict -*/ -type CreateHTTPErrorRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleDefaultsConflict creates CreateHTTPErrorRuleDefaultsConflict with default headers values -func NewCreateHTTPErrorRuleDefaultsConflict() *CreateHTTPErrorRuleDefaultsConflict { - - return &CreateHTTPErrorRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule defaults conflict response -func (o *CreateHTTPErrorRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule defaults conflict response -func (o *CreateHTTPErrorRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule defaults conflict response -func (o *CreateHTTPErrorRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateHTTPErrorRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule defaults conflict response -func (o *CreateHTTPErrorRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPErrorRuleDefaultsDefault General Error - -swagger:response createHttpErrorRuleDefaultsDefault -*/ -type CreateHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleDefaultsDefault creates CreateHTTPErrorRuleDefaultsDefault with default headers values -func NewCreateHTTPErrorRuleDefaultsDefault(code int) *CreateHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *CreateHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP error rule defaults default response -func (o *CreateHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/create_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/create_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index f01e00ec..00000000 --- a/operations/http_error_rule/create_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPErrorRuleDefaultsURL generates an URL for the create HTTP error rule defaults operation -type CreateHTTPErrorRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *CreateHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPErrorRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/create_http_error_rule_frontend.go b/operations/http_error_rule/create_http_error_rule_frontend.go deleted file mode 100644 index 2bcbff56..00000000 --- a/operations/http_error_rule/create_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a create HTTP error rule frontend handler -type CreateHTTPErrorRuleFrontendHandlerFunc func(CreateHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPErrorRuleFrontendHandlerFunc) Handle(params CreateHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPErrorRuleFrontendHandler interface for that can handle valid create HTTP error rule frontend params -type CreateHTTPErrorRuleFrontendHandler interface { - Handle(CreateHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPErrorRuleFrontend creates a new http.Handler for the create HTTP error rule frontend operation -func NewCreateHTTPErrorRuleFrontend(ctx *middleware.Context, handler CreateHTTPErrorRuleFrontendHandler) *CreateHTTPErrorRuleFrontend { - return &CreateHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPErrorRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index} HTTPErrorRule createHttpErrorRuleFrontend - -# Add a new HTTP Error Rule - -Adds a new HTTP Error Rule of the specified type in the specified parent. -*/ -type CreateHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler CreateHTTPErrorRuleFrontendHandler -} - -func (o *CreateHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/create_http_error_rule_frontend_parameters.go b/operations/http_error_rule/create_http_error_rule_frontend_parameters.go deleted file mode 100644 index 29024d0a..00000000 --- a/operations/http_error_rule/create_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPErrorRuleFrontendParams creates a new CreateHTTPErrorRuleFrontendParams object -// with the default values initialized. -func NewCreateHTTPErrorRuleFrontendParams() CreateHTTPErrorRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPErrorRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPErrorRuleFrontendParams contains all the bound params for the create HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPErrorRuleFrontend -type CreateHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPErrorRuleFrontendParams() beforehand. -func (o *CreateHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPErrorRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPErrorRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPErrorRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPErrorRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/create_http_error_rule_frontend_responses.go b/operations/http_error_rule/create_http_error_rule_frontend_responses.go deleted file mode 100644 index 845dcf23..00000000 --- a/operations/http_error_rule/create_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPErrorRuleFrontendCreatedCode is the HTTP code returned for type CreateHTTPErrorRuleFrontendCreated -const CreateHTTPErrorRuleFrontendCreatedCode int = 201 - -/* -CreateHTTPErrorRuleFrontendCreated HTTP Error Rule created - -swagger:response createHttpErrorRuleFrontendCreated -*/ -type CreateHTTPErrorRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleFrontendCreated creates CreateHTTPErrorRuleFrontendCreated with default headers values -func NewCreateHTTPErrorRuleFrontendCreated() *CreateHTTPErrorRuleFrontendCreated { - - return &CreateHTTPErrorRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Http error rule frontend created response -func (o *CreateHTTPErrorRuleFrontendCreated) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule frontend created response -func (o *CreateHTTPErrorRuleFrontendCreated) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleFrontendAcceptedCode is the HTTP code returned for type CreateHTTPErrorRuleFrontendAccepted -const CreateHTTPErrorRuleFrontendAcceptedCode int = 202 - -/* -CreateHTTPErrorRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createHttpErrorRuleFrontendAccepted -*/ -type CreateHTTPErrorRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleFrontendAccepted creates CreateHTTPErrorRuleFrontendAccepted with default headers values -func NewCreateHTTPErrorRuleFrontendAccepted() *CreateHTTPErrorRuleFrontendAccepted { - - return &CreateHTTPErrorRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http error rule frontend accepted response -func (o *CreateHTTPErrorRuleFrontendAccepted) WithReloadID(reloadID string) *CreateHTTPErrorRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http error rule frontend accepted response -func (o *CreateHTTPErrorRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http error rule frontend accepted response -func (o *CreateHTTPErrorRuleFrontendAccepted) WithPayload(payload *models.HTTPErrorRule) *CreateHTTPErrorRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule frontend accepted response -func (o *CreateHTTPErrorRuleFrontendAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleFrontendBadRequestCode is the HTTP code returned for type CreateHTTPErrorRuleFrontendBadRequest -const CreateHTTPErrorRuleFrontendBadRequestCode int = 400 - -/* -CreateHTTPErrorRuleFrontendBadRequest Bad request - -swagger:response createHttpErrorRuleFrontendBadRequest -*/ -type CreateHTTPErrorRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleFrontendBadRequest creates CreateHTTPErrorRuleFrontendBadRequest with default headers values -func NewCreateHTTPErrorRuleFrontendBadRequest() *CreateHTTPErrorRuleFrontendBadRequest { - - return &CreateHTTPErrorRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule frontend bad request response -func (o *CreateHTTPErrorRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule frontend bad request response -func (o *CreateHTTPErrorRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule frontend bad request response -func (o *CreateHTTPErrorRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateHTTPErrorRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule frontend bad request response -func (o *CreateHTTPErrorRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorRuleFrontendConflictCode is the HTTP code returned for type CreateHTTPErrorRuleFrontendConflict -const CreateHTTPErrorRuleFrontendConflictCode int = 409 - -/* -CreateHTTPErrorRuleFrontendConflict The specified resource already exists - -swagger:response createHttpErrorRuleFrontendConflict -*/ -type CreateHTTPErrorRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleFrontendConflict creates CreateHTTPErrorRuleFrontendConflict with default headers values -func NewCreateHTTPErrorRuleFrontendConflict() *CreateHTTPErrorRuleFrontendConflict { - - return &CreateHTTPErrorRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http error rule frontend conflict response -func (o *CreateHTTPErrorRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http error rule frontend conflict response -func (o *CreateHTTPErrorRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http error rule frontend conflict response -func (o *CreateHTTPErrorRuleFrontendConflict) WithPayload(payload *models.Error) *CreateHTTPErrorRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http error rule frontend conflict response -func (o *CreateHTTPErrorRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPErrorRuleFrontendDefault General Error - -swagger:response createHttpErrorRuleFrontendDefault -*/ -type CreateHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorRuleFrontendDefault creates CreateHTTPErrorRuleFrontendDefault with default headers values -func NewCreateHTTPErrorRuleFrontendDefault(code int) *CreateHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *CreateHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *CreateHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP error rule frontend default response -func (o *CreateHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/create_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/create_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index bacf7224..00000000 --- a/operations/http_error_rule/create_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPErrorRuleFrontendURL generates an URL for the create HTTP error rule frontend operation -type CreateHTTPErrorRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleFrontendURL) WithBasePath(bp string) *CreateHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPErrorRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/delete_http_error_rule_backend.go b/operations/http_error_rule/delete_http_error_rule_backend.go deleted file mode 100644 index 14188449..00000000 --- a/operations/http_error_rule/delete_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a delete HTTP error rule backend handler -type DeleteHTTPErrorRuleBackendHandlerFunc func(DeleteHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPErrorRuleBackendHandlerFunc) Handle(params DeleteHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPErrorRuleBackendHandler interface for that can handle valid delete HTTP error rule backend params -type DeleteHTTPErrorRuleBackendHandler interface { - Handle(DeleteHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPErrorRuleBackend creates a new http.Handler for the delete HTTP error rule backend operation -func NewDeleteHTTPErrorRuleBackend(ctx *middleware.Context, handler DeleteHTTPErrorRuleBackendHandler) *DeleteHTTPErrorRuleBackend { - return &DeleteHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPErrorRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index} HTTPErrorRule deleteHttpErrorRuleBackend - -# Delete a HTTP Error Rule - -Deletes a HTTP Error Rule configuration by its index from the specified parent. -*/ -type DeleteHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler DeleteHTTPErrorRuleBackendHandler -} - -func (o *DeleteHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/delete_http_error_rule_backend_parameters.go b/operations/http_error_rule/delete_http_error_rule_backend_parameters.go deleted file mode 100644 index 47f7a25a..00000000 --- a/operations/http_error_rule/delete_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPErrorRuleBackendParams creates a new DeleteHTTPErrorRuleBackendParams object -// with the default values initialized. -func NewDeleteHTTPErrorRuleBackendParams() DeleteHTTPErrorRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPErrorRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPErrorRuleBackendParams contains all the bound params for the delete HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPErrorRuleBackend -type DeleteHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPErrorRuleBackendParams() beforehand. -func (o *DeleteHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPErrorRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPErrorRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPErrorRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPErrorRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/delete_http_error_rule_backend_responses.go b/operations/http_error_rule/delete_http_error_rule_backend_responses.go deleted file mode 100644 index 879e5bea..00000000 --- a/operations/http_error_rule/delete_http_error_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPErrorRuleBackendAcceptedCode is the HTTP code returned for type DeleteHTTPErrorRuleBackendAccepted -const DeleteHTTPErrorRuleBackendAcceptedCode int = 202 - -/* -DeleteHTTPErrorRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpErrorRuleBackendAccepted -*/ -type DeleteHTTPErrorRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPErrorRuleBackendAccepted creates DeleteHTTPErrorRuleBackendAccepted with default headers values -func NewDeleteHTTPErrorRuleBackendAccepted() *DeleteHTTPErrorRuleBackendAccepted { - - return &DeleteHTTPErrorRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http error rule backend accepted response -func (o *DeleteHTTPErrorRuleBackendAccepted) WithReloadID(reloadID string) *DeleteHTTPErrorRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http error rule backend accepted response -func (o *DeleteHTTPErrorRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPErrorRuleBackendNoContentCode is the HTTP code returned for type DeleteHTTPErrorRuleBackendNoContent -const DeleteHTTPErrorRuleBackendNoContentCode int = 204 - -/* -DeleteHTTPErrorRuleBackendNoContent HTTP Error Rule deleted - -swagger:response deleteHttpErrorRuleBackendNoContent -*/ -type DeleteHTTPErrorRuleBackendNoContent struct { -} - -// NewDeleteHTTPErrorRuleBackendNoContent creates DeleteHTTPErrorRuleBackendNoContent with default headers values -func NewDeleteHTTPErrorRuleBackendNoContent() *DeleteHTTPErrorRuleBackendNoContent { - - return &DeleteHTTPErrorRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPErrorRuleBackendNotFoundCode is the HTTP code returned for type DeleteHTTPErrorRuleBackendNotFound -const DeleteHTTPErrorRuleBackendNotFoundCode int = 404 - -/* -DeleteHTTPErrorRuleBackendNotFound The specified resource was not found - -swagger:response deleteHttpErrorRuleBackendNotFound -*/ -type DeleteHTTPErrorRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleBackendNotFound creates DeleteHTTPErrorRuleBackendNotFound with default headers values -func NewDeleteHTTPErrorRuleBackendNotFound() *DeleteHTTPErrorRuleBackendNotFound { - - return &DeleteHTTPErrorRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http error rule backend not found response -func (o *DeleteHTTPErrorRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http error rule backend not found response -func (o *DeleteHTTPErrorRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http error rule backend not found response -func (o *DeleteHTTPErrorRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http error rule backend not found response -func (o *DeleteHTTPErrorRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPErrorRuleBackendDefault General Error - -swagger:response deleteHttpErrorRuleBackendDefault -*/ -type DeleteHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleBackendDefault creates DeleteHTTPErrorRuleBackendDefault with default headers values -func NewDeleteHTTPErrorRuleBackendDefault(code int) *DeleteHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) WithStatusCode(code int) *DeleteHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP error rule backend default response -func (o *DeleteHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/delete_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/delete_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index 9caf1e60..00000000 --- a/operations/http_error_rule/delete_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPErrorRuleBackendURL generates an URL for the delete HTTP error rule backend operation -type DeleteHTTPErrorRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleBackendURL) WithBasePath(bp string) *DeleteHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPErrorRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/delete_http_error_rule_defaults.go b/operations/http_error_rule/delete_http_error_rule_defaults.go deleted file mode 100644 index d423efe4..00000000 --- a/operations/http_error_rule/delete_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a delete HTTP error rule defaults handler -type DeleteHTTPErrorRuleDefaultsHandlerFunc func(DeleteHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPErrorRuleDefaultsHandlerFunc) Handle(params DeleteHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPErrorRuleDefaultsHandler interface for that can handle valid delete HTTP error rule defaults params -type DeleteHTTPErrorRuleDefaultsHandler interface { - Handle(DeleteHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPErrorRuleDefaults creates a new http.Handler for the delete HTTP error rule defaults operation -func NewDeleteHTTPErrorRuleDefaults(ctx *middleware.Context, handler DeleteHTTPErrorRuleDefaultsHandler) *DeleteHTTPErrorRuleDefaults { - return &DeleteHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPErrorRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index} HTTPErrorRule deleteHttpErrorRuleDefaults - -# Delete a HTTP Error Rule - -Deletes a HTTP Error Rule configuration by its index from the specified parent. -*/ -type DeleteHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler DeleteHTTPErrorRuleDefaultsHandler -} - -func (o *DeleteHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/delete_http_error_rule_defaults_parameters.go b/operations/http_error_rule/delete_http_error_rule_defaults_parameters.go deleted file mode 100644 index 93dd1b48..00000000 --- a/operations/http_error_rule/delete_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPErrorRuleDefaultsParams creates a new DeleteHTTPErrorRuleDefaultsParams object -// with the default values initialized. -func NewDeleteHTTPErrorRuleDefaultsParams() DeleteHTTPErrorRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPErrorRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPErrorRuleDefaultsParams contains all the bound params for the delete HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPErrorRuleDefaults -type DeleteHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPErrorRuleDefaultsParams() beforehand. -func (o *DeleteHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPErrorRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPErrorRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPErrorRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPErrorRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/delete_http_error_rule_defaults_responses.go b/operations/http_error_rule/delete_http_error_rule_defaults_responses.go deleted file mode 100644 index e8fce5ff..00000000 --- a/operations/http_error_rule/delete_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPErrorRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteHTTPErrorRuleDefaultsAccepted -const DeleteHTTPErrorRuleDefaultsAcceptedCode int = 202 - -/* -DeleteHTTPErrorRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpErrorRuleDefaultsAccepted -*/ -type DeleteHTTPErrorRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPErrorRuleDefaultsAccepted creates DeleteHTTPErrorRuleDefaultsAccepted with default headers values -func NewDeleteHTTPErrorRuleDefaultsAccepted() *DeleteHTTPErrorRuleDefaultsAccepted { - - return &DeleteHTTPErrorRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http error rule defaults accepted response -func (o *DeleteHTTPErrorRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteHTTPErrorRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http error rule defaults accepted response -func (o *DeleteHTTPErrorRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPErrorRuleDefaultsNoContentCode is the HTTP code returned for type DeleteHTTPErrorRuleDefaultsNoContent -const DeleteHTTPErrorRuleDefaultsNoContentCode int = 204 - -/* -DeleteHTTPErrorRuleDefaultsNoContent HTTP Error Rule deleted - -swagger:response deleteHttpErrorRuleDefaultsNoContent -*/ -type DeleteHTTPErrorRuleDefaultsNoContent struct { -} - -// NewDeleteHTTPErrorRuleDefaultsNoContent creates DeleteHTTPErrorRuleDefaultsNoContent with default headers values -func NewDeleteHTTPErrorRuleDefaultsNoContent() *DeleteHTTPErrorRuleDefaultsNoContent { - - return &DeleteHTTPErrorRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPErrorRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteHTTPErrorRuleDefaultsNotFound -const DeleteHTTPErrorRuleDefaultsNotFoundCode int = 404 - -/* -DeleteHTTPErrorRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteHttpErrorRuleDefaultsNotFound -*/ -type DeleteHTTPErrorRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleDefaultsNotFound creates DeleteHTTPErrorRuleDefaultsNotFound with default headers values -func NewDeleteHTTPErrorRuleDefaultsNotFound() *DeleteHTTPErrorRuleDefaultsNotFound { - - return &DeleteHTTPErrorRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http error rule defaults not found response -func (o *DeleteHTTPErrorRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http error rule defaults not found response -func (o *DeleteHTTPErrorRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http error rule defaults not found response -func (o *DeleteHTTPErrorRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http error rule defaults not found response -func (o *DeleteHTTPErrorRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPErrorRuleDefaultsDefault General Error - -swagger:response deleteHttpErrorRuleDefaultsDefault -*/ -type DeleteHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleDefaultsDefault creates DeleteHTTPErrorRuleDefaultsDefault with default headers values -func NewDeleteHTTPErrorRuleDefaultsDefault(code int) *DeleteHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *DeleteHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP error rule defaults default response -func (o *DeleteHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/delete_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/delete_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index a6550389..00000000 --- a/operations/http_error_rule/delete_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPErrorRuleDefaultsURL generates an URL for the delete HTTP error rule defaults operation -type DeleteHTTPErrorRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *DeleteHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPErrorRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/delete_http_error_rule_frontend.go b/operations/http_error_rule/delete_http_error_rule_frontend.go deleted file mode 100644 index 18de76d7..00000000 --- a/operations/http_error_rule/delete_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a delete HTTP error rule frontend handler -type DeleteHTTPErrorRuleFrontendHandlerFunc func(DeleteHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPErrorRuleFrontendHandlerFunc) Handle(params DeleteHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPErrorRuleFrontendHandler interface for that can handle valid delete HTTP error rule frontend params -type DeleteHTTPErrorRuleFrontendHandler interface { - Handle(DeleteHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPErrorRuleFrontend creates a new http.Handler for the delete HTTP error rule frontend operation -func NewDeleteHTTPErrorRuleFrontend(ctx *middleware.Context, handler DeleteHTTPErrorRuleFrontendHandler) *DeleteHTTPErrorRuleFrontend { - return &DeleteHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPErrorRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index} HTTPErrorRule deleteHttpErrorRuleFrontend - -# Delete a HTTP Error Rule - -Deletes a HTTP Error Rule configuration by its index from the specified parent. -*/ -type DeleteHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler DeleteHTTPErrorRuleFrontendHandler -} - -func (o *DeleteHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/delete_http_error_rule_frontend_parameters.go b/operations/http_error_rule/delete_http_error_rule_frontend_parameters.go deleted file mode 100644 index 091a494e..00000000 --- a/operations/http_error_rule/delete_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPErrorRuleFrontendParams creates a new DeleteHTTPErrorRuleFrontendParams object -// with the default values initialized. -func NewDeleteHTTPErrorRuleFrontendParams() DeleteHTTPErrorRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPErrorRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPErrorRuleFrontendParams contains all the bound params for the delete HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPErrorRuleFrontend -type DeleteHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPErrorRuleFrontendParams() beforehand. -func (o *DeleteHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPErrorRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPErrorRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPErrorRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPErrorRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/delete_http_error_rule_frontend_responses.go b/operations/http_error_rule/delete_http_error_rule_frontend_responses.go deleted file mode 100644 index b1961794..00000000 --- a/operations/http_error_rule/delete_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPErrorRuleFrontendAcceptedCode is the HTTP code returned for type DeleteHTTPErrorRuleFrontendAccepted -const DeleteHTTPErrorRuleFrontendAcceptedCode int = 202 - -/* -DeleteHTTPErrorRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpErrorRuleFrontendAccepted -*/ -type DeleteHTTPErrorRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPErrorRuleFrontendAccepted creates DeleteHTTPErrorRuleFrontendAccepted with default headers values -func NewDeleteHTTPErrorRuleFrontendAccepted() *DeleteHTTPErrorRuleFrontendAccepted { - - return &DeleteHTTPErrorRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http error rule frontend accepted response -func (o *DeleteHTTPErrorRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteHTTPErrorRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http error rule frontend accepted response -func (o *DeleteHTTPErrorRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPErrorRuleFrontendNoContentCode is the HTTP code returned for type DeleteHTTPErrorRuleFrontendNoContent -const DeleteHTTPErrorRuleFrontendNoContentCode int = 204 - -/* -DeleteHTTPErrorRuleFrontendNoContent HTTP Error Rule deleted - -swagger:response deleteHttpErrorRuleFrontendNoContent -*/ -type DeleteHTTPErrorRuleFrontendNoContent struct { -} - -// NewDeleteHTTPErrorRuleFrontendNoContent creates DeleteHTTPErrorRuleFrontendNoContent with default headers values -func NewDeleteHTTPErrorRuleFrontendNoContent() *DeleteHTTPErrorRuleFrontendNoContent { - - return &DeleteHTTPErrorRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPErrorRuleFrontendNotFoundCode is the HTTP code returned for type DeleteHTTPErrorRuleFrontendNotFound -const DeleteHTTPErrorRuleFrontendNotFoundCode int = 404 - -/* -DeleteHTTPErrorRuleFrontendNotFound The specified resource was not found - -swagger:response deleteHttpErrorRuleFrontendNotFound -*/ -type DeleteHTTPErrorRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleFrontendNotFound creates DeleteHTTPErrorRuleFrontendNotFound with default headers values -func NewDeleteHTTPErrorRuleFrontendNotFound() *DeleteHTTPErrorRuleFrontendNotFound { - - return &DeleteHTTPErrorRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http error rule frontend not found response -func (o *DeleteHTTPErrorRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http error rule frontend not found response -func (o *DeleteHTTPErrorRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http error rule frontend not found response -func (o *DeleteHTTPErrorRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http error rule frontend not found response -func (o *DeleteHTTPErrorRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPErrorRuleFrontendDefault General Error - -swagger:response deleteHttpErrorRuleFrontendDefault -*/ -type DeleteHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorRuleFrontendDefault creates DeleteHTTPErrorRuleFrontendDefault with default headers values -func NewDeleteHTTPErrorRuleFrontendDefault(code int) *DeleteHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *DeleteHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP error rule frontend default response -func (o *DeleteHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/delete_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/delete_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index e28eb514..00000000 --- a/operations/http_error_rule/delete_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPErrorRuleFrontendURL generates an URL for the delete HTTP error rule frontend operation -type DeleteHTTPErrorRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleFrontendURL) WithBasePath(bp string) *DeleteHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPErrorRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_all_http_error_rule_backend.go b/operations/http_error_rule/get_all_http_error_rule_backend.go deleted file mode 100644 index e285389b..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a get all HTTP error rule backend handler -type GetAllHTTPErrorRuleBackendHandlerFunc func(GetAllHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPErrorRuleBackendHandlerFunc) Handle(params GetAllHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPErrorRuleBackendHandler interface for that can handle valid get all HTTP error rule backend params -type GetAllHTTPErrorRuleBackendHandler interface { - Handle(GetAllHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPErrorRuleBackend creates a new http.Handler for the get all HTTP error rule backend operation -func NewGetAllHTTPErrorRuleBackend(ctx *middleware.Context, handler GetAllHTTPErrorRuleBackendHandler) *GetAllHTTPErrorRuleBackend { - return &GetAllHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPErrorRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules HTTPErrorRule getAllHttpErrorRuleBackend - -# Return an array of all HTTP Error Rules - -Returns all HTTP Error Rules that are configured in the specified parent. -*/ -type GetAllHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler GetAllHTTPErrorRuleBackendHandler -} - -func (o *GetAllHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_all_http_error_rule_backend_parameters.go b/operations/http_error_rule/get_all_http_error_rule_backend_parameters.go deleted file mode 100644 index d035242d..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPErrorRuleBackendParams creates a new GetAllHTTPErrorRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPErrorRuleBackendParams() GetAllHTTPErrorRuleBackendParams { - - return GetAllHTTPErrorRuleBackendParams{} -} - -// GetAllHTTPErrorRuleBackendParams contains all the bound params for the get all HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPErrorRuleBackend -type GetAllHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPErrorRuleBackendParams() beforehand. -func (o *GetAllHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_all_http_error_rule_backend_responses.go b/operations/http_error_rule/get_all_http_error_rule_backend_responses.go deleted file mode 100644 index 5c54e7fd..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPErrorRuleBackendOKCode is the HTTP code returned for type GetAllHTTPErrorRuleBackendOK -const GetAllHTTPErrorRuleBackendOKCode int = 200 - -/* -GetAllHTTPErrorRuleBackendOK Successful operation - -swagger:response getAllHttpErrorRuleBackendOK -*/ -type GetAllHTTPErrorRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleBackendOK creates GetAllHTTPErrorRuleBackendOK with default headers values -func NewGetAllHTTPErrorRuleBackendOK() *GetAllHTTPErrorRuleBackendOK { - - return &GetAllHTTPErrorRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http error rule backend o k response -func (o *GetAllHTTPErrorRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http error rule backend o k response -func (o *GetAllHTTPErrorRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http error rule backend o k response -func (o *GetAllHTTPErrorRuleBackendOK) WithPayload(payload models.HTTPErrorRules) *GetAllHTTPErrorRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http error rule backend o k response -func (o *GetAllHTTPErrorRuleBackendOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPErrorRuleBackendDefault General Error - -swagger:response getAllHttpErrorRuleBackendDefault -*/ -type GetAllHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleBackendDefault creates GetAllHTTPErrorRuleBackendDefault with default headers values -func NewGetAllHTTPErrorRuleBackendDefault(code int) *GetAllHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) WithStatusCode(code int) *GetAllHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *GetAllHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP error rule backend default response -func (o *GetAllHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_all_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/get_all_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index 9e33716b..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPErrorRuleBackendURL generates an URL for the get all HTTP error rule backend operation -type GetAllHTTPErrorRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleBackendURL) WithBasePath(bp string) *GetAllHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_all_http_error_rule_defaults.go b/operations/http_error_rule/get_all_http_error_rule_defaults.go deleted file mode 100644 index 66c0e4dc..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a get all HTTP error rule defaults handler -type GetAllHTTPErrorRuleDefaultsHandlerFunc func(GetAllHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPErrorRuleDefaultsHandlerFunc) Handle(params GetAllHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPErrorRuleDefaultsHandler interface for that can handle valid get all HTTP error rule defaults params -type GetAllHTTPErrorRuleDefaultsHandler interface { - Handle(GetAllHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPErrorRuleDefaults creates a new http.Handler for the get all HTTP error rule defaults operation -func NewGetAllHTTPErrorRuleDefaults(ctx *middleware.Context, handler GetAllHTTPErrorRuleDefaultsHandler) *GetAllHTTPErrorRuleDefaults { - return &GetAllHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPErrorRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules HTTPErrorRule getAllHttpErrorRuleDefaults - -# Return an array of all HTTP Error Rules - -Returns all HTTP Error Rules that are configured in the specified parent. -*/ -type GetAllHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler GetAllHTTPErrorRuleDefaultsHandler -} - -func (o *GetAllHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_all_http_error_rule_defaults_parameters.go b/operations/http_error_rule/get_all_http_error_rule_defaults_parameters.go deleted file mode 100644 index 0fef73aa..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPErrorRuleDefaultsParams creates a new GetAllHTTPErrorRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPErrorRuleDefaultsParams() GetAllHTTPErrorRuleDefaultsParams { - - return GetAllHTTPErrorRuleDefaultsParams{} -} - -// GetAllHTTPErrorRuleDefaultsParams contains all the bound params for the get all HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPErrorRuleDefaults -type GetAllHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPErrorRuleDefaultsParams() beforehand. -func (o *GetAllHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_all_http_error_rule_defaults_responses.go b/operations/http_error_rule/get_all_http_error_rule_defaults_responses.go deleted file mode 100644 index 9b3fb21b..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPErrorRuleDefaultsOKCode is the HTTP code returned for type GetAllHTTPErrorRuleDefaultsOK -const GetAllHTTPErrorRuleDefaultsOKCode int = 200 - -/* -GetAllHTTPErrorRuleDefaultsOK Successful operation - -swagger:response getAllHttpErrorRuleDefaultsOK -*/ -type GetAllHTTPErrorRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleDefaultsOK creates GetAllHTTPErrorRuleDefaultsOK with default headers values -func NewGetAllHTTPErrorRuleDefaultsOK() *GetAllHTTPErrorRuleDefaultsOK { - - return &GetAllHTTPErrorRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http error rule defaults o k response -func (o *GetAllHTTPErrorRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http error rule defaults o k response -func (o *GetAllHTTPErrorRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http error rule defaults o k response -func (o *GetAllHTTPErrorRuleDefaultsOK) WithPayload(payload models.HTTPErrorRules) *GetAllHTTPErrorRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http error rule defaults o k response -func (o *GetAllHTTPErrorRuleDefaultsOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPErrorRuleDefaultsDefault General Error - -swagger:response getAllHttpErrorRuleDefaultsDefault -*/ -type GetAllHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleDefaultsDefault creates GetAllHTTPErrorRuleDefaultsDefault with default headers values -func NewGetAllHTTPErrorRuleDefaultsDefault(code int) *GetAllHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *GetAllHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP error rule defaults default response -func (o *GetAllHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_all_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/get_all_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index ee731257..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPErrorRuleDefaultsURL generates an URL for the get all HTTP error rule defaults operation -type GetAllHTTPErrorRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *GetAllHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_all_http_error_rule_frontend.go b/operations/http_error_rule/get_all_http_error_rule_frontend.go deleted file mode 100644 index 71a7fa5c..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a get all HTTP error rule frontend handler -type GetAllHTTPErrorRuleFrontendHandlerFunc func(GetAllHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPErrorRuleFrontendHandlerFunc) Handle(params GetAllHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPErrorRuleFrontendHandler interface for that can handle valid get all HTTP error rule frontend params -type GetAllHTTPErrorRuleFrontendHandler interface { - Handle(GetAllHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPErrorRuleFrontend creates a new http.Handler for the get all HTTP error rule frontend operation -func NewGetAllHTTPErrorRuleFrontend(ctx *middleware.Context, handler GetAllHTTPErrorRuleFrontendHandler) *GetAllHTTPErrorRuleFrontend { - return &GetAllHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPErrorRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules HTTPErrorRule getAllHttpErrorRuleFrontend - -# Return an array of all HTTP Error Rules - -Returns all HTTP Error Rules that are configured in the specified parent. -*/ -type GetAllHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler GetAllHTTPErrorRuleFrontendHandler -} - -func (o *GetAllHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_all_http_error_rule_frontend_parameters.go b/operations/http_error_rule/get_all_http_error_rule_frontend_parameters.go deleted file mode 100644 index 1ad477c3..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPErrorRuleFrontendParams creates a new GetAllHTTPErrorRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPErrorRuleFrontendParams() GetAllHTTPErrorRuleFrontendParams { - - return GetAllHTTPErrorRuleFrontendParams{} -} - -// GetAllHTTPErrorRuleFrontendParams contains all the bound params for the get all HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPErrorRuleFrontend -type GetAllHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPErrorRuleFrontendParams() beforehand. -func (o *GetAllHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_all_http_error_rule_frontend_responses.go b/operations/http_error_rule/get_all_http_error_rule_frontend_responses.go deleted file mode 100644 index 035d4205..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPErrorRuleFrontendOKCode is the HTTP code returned for type GetAllHTTPErrorRuleFrontendOK -const GetAllHTTPErrorRuleFrontendOKCode int = 200 - -/* -GetAllHTTPErrorRuleFrontendOK Successful operation - -swagger:response getAllHttpErrorRuleFrontendOK -*/ -type GetAllHTTPErrorRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleFrontendOK creates GetAllHTTPErrorRuleFrontendOK with default headers values -func NewGetAllHTTPErrorRuleFrontendOK() *GetAllHTTPErrorRuleFrontendOK { - - return &GetAllHTTPErrorRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http error rule frontend o k response -func (o *GetAllHTTPErrorRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http error rule frontend o k response -func (o *GetAllHTTPErrorRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http error rule frontend o k response -func (o *GetAllHTTPErrorRuleFrontendOK) WithPayload(payload models.HTTPErrorRules) *GetAllHTTPErrorRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http error rule frontend o k response -func (o *GetAllHTTPErrorRuleFrontendOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPErrorRuleFrontendDefault General Error - -swagger:response getAllHttpErrorRuleFrontendDefault -*/ -type GetAllHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPErrorRuleFrontendDefault creates GetAllHTTPErrorRuleFrontendDefault with default headers values -func NewGetAllHTTPErrorRuleFrontendDefault(code int) *GetAllHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *GetAllHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP error rule frontend default response -func (o *GetAllHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_all_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/get_all_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index 78dfc902..00000000 --- a/operations/http_error_rule/get_all_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPErrorRuleFrontendURL generates an URL for the get all HTTP error rule frontend operation -type GetAllHTTPErrorRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleFrontendURL) WithBasePath(bp string) *GetAllHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_http_error_rule_backend.go b/operations/http_error_rule/get_http_error_rule_backend.go deleted file mode 100644 index 10010c6f..00000000 --- a/operations/http_error_rule/get_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a get HTTP error rule backend handler -type GetHTTPErrorRuleBackendHandlerFunc func(GetHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPErrorRuleBackendHandlerFunc) Handle(params GetHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPErrorRuleBackendHandler interface for that can handle valid get HTTP error rule backend params -type GetHTTPErrorRuleBackendHandler interface { - Handle(GetHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetHTTPErrorRuleBackend creates a new http.Handler for the get HTTP error rule backend operation -func NewGetHTTPErrorRuleBackend(ctx *middleware.Context, handler GetHTTPErrorRuleBackendHandler) *GetHTTPErrorRuleBackend { - return &GetHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetHTTPErrorRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index} HTTPErrorRule getHttpErrorRuleBackend - -# Return one HTTP Error Rule - -Returns one HTTP Error Rule configuration by its index in the specified parent. -*/ -type GetHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler GetHTTPErrorRuleBackendHandler -} - -func (o *GetHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_http_error_rule_backend_parameters.go b/operations/http_error_rule/get_http_error_rule_backend_parameters.go deleted file mode 100644 index e98e511c..00000000 --- a/operations/http_error_rule/get_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPErrorRuleBackendParams creates a new GetHTTPErrorRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPErrorRuleBackendParams() GetHTTPErrorRuleBackendParams { - - return GetHTTPErrorRuleBackendParams{} -} - -// GetHTTPErrorRuleBackendParams contains all the bound params for the get HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPErrorRuleBackend -type GetHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPErrorRuleBackendParams() beforehand. -func (o *GetHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPErrorRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_http_error_rule_backend_responses.go b/operations/http_error_rule/get_http_error_rule_backend_responses.go deleted file mode 100644 index 602f2132..00000000 --- a/operations/http_error_rule/get_http_error_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPErrorRuleBackendOKCode is the HTTP code returned for type GetHTTPErrorRuleBackendOK -const GetHTTPErrorRuleBackendOKCode int = 200 - -/* -GetHTTPErrorRuleBackendOK Successful operation - -swagger:response getHttpErrorRuleBackendOK -*/ -type GetHTTPErrorRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleBackendOK creates GetHTTPErrorRuleBackendOK with default headers values -func NewGetHTTPErrorRuleBackendOK() *GetHTTPErrorRuleBackendOK { - - return &GetHTTPErrorRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule backend o k response -func (o *GetHTTPErrorRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule backend o k response -func (o *GetHTTPErrorRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule backend o k response -func (o *GetHTTPErrorRuleBackendOK) WithPayload(payload *models.HTTPErrorRule) *GetHTTPErrorRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule backend o k response -func (o *GetHTTPErrorRuleBackendOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPErrorRuleBackendNotFoundCode is the HTTP code returned for type GetHTTPErrorRuleBackendNotFound -const GetHTTPErrorRuleBackendNotFoundCode int = 404 - -/* -GetHTTPErrorRuleBackendNotFound The specified resource was not found - -swagger:response getHttpErrorRuleBackendNotFound -*/ -type GetHTTPErrorRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleBackendNotFound creates GetHTTPErrorRuleBackendNotFound with default headers values -func NewGetHTTPErrorRuleBackendNotFound() *GetHTTPErrorRuleBackendNotFound { - - return &GetHTTPErrorRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule backend not found response -func (o *GetHTTPErrorRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule backend not found response -func (o *GetHTTPErrorRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule backend not found response -func (o *GetHTTPErrorRuleBackendNotFound) WithPayload(payload *models.Error) *GetHTTPErrorRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule backend not found response -func (o *GetHTTPErrorRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPErrorRuleBackendDefault General Error - -swagger:response getHttpErrorRuleBackendDefault -*/ -type GetHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleBackendDefault creates GetHTTPErrorRuleBackendDefault with default headers values -func NewGetHTTPErrorRuleBackendDefault(code int) *GetHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) WithStatusCode(code int) *GetHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *GetHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP error rule backend default response -func (o *GetHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/get_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index 521c2199..00000000 --- a/operations/http_error_rule/get_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPErrorRuleBackendURL generates an URL for the get HTTP error rule backend operation -type GetHTTPErrorRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleBackendURL) WithBasePath(bp string) *GetHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPErrorRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_http_error_rule_defaults.go b/operations/http_error_rule/get_http_error_rule_defaults.go deleted file mode 100644 index a123c248..00000000 --- a/operations/http_error_rule/get_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a get HTTP error rule defaults handler -type GetHTTPErrorRuleDefaultsHandlerFunc func(GetHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPErrorRuleDefaultsHandlerFunc) Handle(params GetHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPErrorRuleDefaultsHandler interface for that can handle valid get HTTP error rule defaults params -type GetHTTPErrorRuleDefaultsHandler interface { - Handle(GetHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetHTTPErrorRuleDefaults creates a new http.Handler for the get HTTP error rule defaults operation -func NewGetHTTPErrorRuleDefaults(ctx *middleware.Context, handler GetHTTPErrorRuleDefaultsHandler) *GetHTTPErrorRuleDefaults { - return &GetHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetHTTPErrorRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index} HTTPErrorRule getHttpErrorRuleDefaults - -# Return one HTTP Error Rule - -Returns one HTTP Error Rule configuration by its index in the specified parent. -*/ -type GetHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler GetHTTPErrorRuleDefaultsHandler -} - -func (o *GetHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_http_error_rule_defaults_parameters.go b/operations/http_error_rule/get_http_error_rule_defaults_parameters.go deleted file mode 100644 index 291419a8..00000000 --- a/operations/http_error_rule/get_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPErrorRuleDefaultsParams creates a new GetHTTPErrorRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPErrorRuleDefaultsParams() GetHTTPErrorRuleDefaultsParams { - - return GetHTTPErrorRuleDefaultsParams{} -} - -// GetHTTPErrorRuleDefaultsParams contains all the bound params for the get HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPErrorRuleDefaults -type GetHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPErrorRuleDefaultsParams() beforehand. -func (o *GetHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPErrorRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_http_error_rule_defaults_responses.go b/operations/http_error_rule/get_http_error_rule_defaults_responses.go deleted file mode 100644 index b1ee104b..00000000 --- a/operations/http_error_rule/get_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPErrorRuleDefaultsOKCode is the HTTP code returned for type GetHTTPErrorRuleDefaultsOK -const GetHTTPErrorRuleDefaultsOKCode int = 200 - -/* -GetHTTPErrorRuleDefaultsOK Successful operation - -swagger:response getHttpErrorRuleDefaultsOK -*/ -type GetHTTPErrorRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleDefaultsOK creates GetHTTPErrorRuleDefaultsOK with default headers values -func NewGetHTTPErrorRuleDefaultsOK() *GetHTTPErrorRuleDefaultsOK { - - return &GetHTTPErrorRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule defaults o k response -func (o *GetHTTPErrorRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule defaults o k response -func (o *GetHTTPErrorRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule defaults o k response -func (o *GetHTTPErrorRuleDefaultsOK) WithPayload(payload *models.HTTPErrorRule) *GetHTTPErrorRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule defaults o k response -func (o *GetHTTPErrorRuleDefaultsOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPErrorRuleDefaultsNotFoundCode is the HTTP code returned for type GetHTTPErrorRuleDefaultsNotFound -const GetHTTPErrorRuleDefaultsNotFoundCode int = 404 - -/* -GetHTTPErrorRuleDefaultsNotFound The specified resource was not found - -swagger:response getHttpErrorRuleDefaultsNotFound -*/ -type GetHTTPErrorRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleDefaultsNotFound creates GetHTTPErrorRuleDefaultsNotFound with default headers values -func NewGetHTTPErrorRuleDefaultsNotFound() *GetHTTPErrorRuleDefaultsNotFound { - - return &GetHTTPErrorRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule defaults not found response -func (o *GetHTTPErrorRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule defaults not found response -func (o *GetHTTPErrorRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule defaults not found response -func (o *GetHTTPErrorRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetHTTPErrorRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule defaults not found response -func (o *GetHTTPErrorRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPErrorRuleDefaultsDefault General Error - -swagger:response getHttpErrorRuleDefaultsDefault -*/ -type GetHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleDefaultsDefault creates GetHTTPErrorRuleDefaultsDefault with default headers values -func NewGetHTTPErrorRuleDefaultsDefault(code int) *GetHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *GetHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *GetHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP error rule defaults default response -func (o *GetHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/get_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index 890cc04e..00000000 --- a/operations/http_error_rule/get_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPErrorRuleDefaultsURL generates an URL for the get HTTP error rule defaults operation -type GetHTTPErrorRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *GetHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPErrorRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/get_http_error_rule_frontend.go b/operations/http_error_rule/get_http_error_rule_frontend.go deleted file mode 100644 index bc2510ac..00000000 --- a/operations/http_error_rule/get_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a get HTTP error rule frontend handler -type GetHTTPErrorRuleFrontendHandlerFunc func(GetHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPErrorRuleFrontendHandlerFunc) Handle(params GetHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPErrorRuleFrontendHandler interface for that can handle valid get HTTP error rule frontend params -type GetHTTPErrorRuleFrontendHandler interface { - Handle(GetHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetHTTPErrorRuleFrontend creates a new http.Handler for the get HTTP error rule frontend operation -func NewGetHTTPErrorRuleFrontend(ctx *middleware.Context, handler GetHTTPErrorRuleFrontendHandler) *GetHTTPErrorRuleFrontend { - return &GetHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetHTTPErrorRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index} HTTPErrorRule getHttpErrorRuleFrontend - -# Return one HTTP Error Rule - -Returns one HTTP Error Rule configuration by its index in the specified parent. -*/ -type GetHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler GetHTTPErrorRuleFrontendHandler -} - -func (o *GetHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/get_http_error_rule_frontend_parameters.go b/operations/http_error_rule/get_http_error_rule_frontend_parameters.go deleted file mode 100644 index 9fff8ee0..00000000 --- a/operations/http_error_rule/get_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPErrorRuleFrontendParams creates a new GetHTTPErrorRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPErrorRuleFrontendParams() GetHTTPErrorRuleFrontendParams { - - return GetHTTPErrorRuleFrontendParams{} -} - -// GetHTTPErrorRuleFrontendParams contains all the bound params for the get HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPErrorRuleFrontend -type GetHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPErrorRuleFrontendParams() beforehand. -func (o *GetHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPErrorRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_error_rule/get_http_error_rule_frontend_responses.go b/operations/http_error_rule/get_http_error_rule_frontend_responses.go deleted file mode 100644 index b3227462..00000000 --- a/operations/http_error_rule/get_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPErrorRuleFrontendOKCode is the HTTP code returned for type GetHTTPErrorRuleFrontendOK -const GetHTTPErrorRuleFrontendOKCode int = 200 - -/* -GetHTTPErrorRuleFrontendOK Successful operation - -swagger:response getHttpErrorRuleFrontendOK -*/ -type GetHTTPErrorRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleFrontendOK creates GetHTTPErrorRuleFrontendOK with default headers values -func NewGetHTTPErrorRuleFrontendOK() *GetHTTPErrorRuleFrontendOK { - - return &GetHTTPErrorRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule frontend o k response -func (o *GetHTTPErrorRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule frontend o k response -func (o *GetHTTPErrorRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule frontend o k response -func (o *GetHTTPErrorRuleFrontendOK) WithPayload(payload *models.HTTPErrorRule) *GetHTTPErrorRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule frontend o k response -func (o *GetHTTPErrorRuleFrontendOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPErrorRuleFrontendNotFoundCode is the HTTP code returned for type GetHTTPErrorRuleFrontendNotFound -const GetHTTPErrorRuleFrontendNotFoundCode int = 404 - -/* -GetHTTPErrorRuleFrontendNotFound The specified resource was not found - -swagger:response getHttpErrorRuleFrontendNotFound -*/ -type GetHTTPErrorRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleFrontendNotFound creates GetHTTPErrorRuleFrontendNotFound with default headers values -func NewGetHTTPErrorRuleFrontendNotFound() *GetHTTPErrorRuleFrontendNotFound { - - return &GetHTTPErrorRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http error rule frontend not found response -func (o *GetHTTPErrorRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http error rule frontend not found response -func (o *GetHTTPErrorRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http error rule frontend not found response -func (o *GetHTTPErrorRuleFrontendNotFound) WithPayload(payload *models.Error) *GetHTTPErrorRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http error rule frontend not found response -func (o *GetHTTPErrorRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPErrorRuleFrontendDefault General Error - -swagger:response getHttpErrorRuleFrontendDefault -*/ -type GetHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorRuleFrontendDefault creates GetHTTPErrorRuleFrontendDefault with default headers values -func NewGetHTTPErrorRuleFrontendDefault(code int) *GetHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *GetHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *GetHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP error rule frontend default response -func (o *GetHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/get_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/get_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index c466e7f3..00000000 --- a/operations/http_error_rule/get_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPErrorRuleFrontendURL generates an URL for the get HTTP error rule frontend operation -type GetHTTPErrorRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleFrontendURL) WithBasePath(bp string) *GetHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPErrorRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_backend.go b/operations/http_error_rule/replace_all_http_error_rule_backend.go deleted file mode 100644 index 8fc1a354..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a replace all HTTP error rule backend handler -type ReplaceAllHTTPErrorRuleBackendHandlerFunc func(ReplaceAllHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPErrorRuleBackendHandlerFunc) Handle(params ReplaceAllHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPErrorRuleBackendHandler interface for that can handle valid replace all HTTP error rule backend params -type ReplaceAllHTTPErrorRuleBackendHandler interface { - Handle(ReplaceAllHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPErrorRuleBackend creates a new http.Handler for the replace all HTTP error rule backend operation -func NewReplaceAllHTTPErrorRuleBackend(ctx *middleware.Context, handler ReplaceAllHTTPErrorRuleBackendHandler) *ReplaceAllHTTPErrorRuleBackend { - return &ReplaceAllHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPErrorRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules HTTPErrorRule replaceAllHttpErrorRuleBackend - -# Replace an HTTP Error Rules list - -Replaces a whole list of HTTP Error Rules with the list given in parameter -*/ -type ReplaceAllHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllHTTPErrorRuleBackendHandler -} - -func (o *ReplaceAllHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_backend_parameters.go b/operations/http_error_rule/replace_all_http_error_rule_backend_parameters.go deleted file mode 100644 index ac8581e9..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPErrorRuleBackendParams creates a new ReplaceAllHTTPErrorRuleBackendParams object -// with the default values initialized. -func NewReplaceAllHTTPErrorRuleBackendParams() ReplaceAllHTTPErrorRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPErrorRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPErrorRuleBackendParams contains all the bound params for the replace all HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPErrorRuleBackend -type ReplaceAllHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPErrorRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPErrorRuleBackendParams() beforehand. -func (o *ReplaceAllHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPErrorRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPErrorRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPErrorRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_backend_responses.go b/operations/http_error_rule/replace_all_http_error_rule_backend_responses.go deleted file mode 100644 index 12f84493..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPErrorRuleBackendOKCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleBackendOK -const ReplaceAllHTTPErrorRuleBackendOKCode int = 200 - -/* -ReplaceAllHTTPErrorRuleBackendOK All HTTP Error Rules lines replaced - -swagger:response replaceAllHttpErrorRuleBackendOK -*/ -type ReplaceAllHTTPErrorRuleBackendOK struct { - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleBackendOK creates ReplaceAllHTTPErrorRuleBackendOK with default headers values -func NewReplaceAllHTTPErrorRuleBackendOK() *ReplaceAllHTTPErrorRuleBackendOK { - - return &ReplaceAllHTTPErrorRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Http error rule backend o k response -func (o *ReplaceAllHTTPErrorRuleBackendOK) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule backend o k response -func (o *ReplaceAllHTTPErrorRuleBackendOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleBackendAccepted -const ReplaceAllHTTPErrorRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllHTTPErrorRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpErrorRuleBackendAccepted -*/ -type ReplaceAllHTTPErrorRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleBackendAccepted creates ReplaceAllHTTPErrorRuleBackendAccepted with default headers values -func NewReplaceAllHTTPErrorRuleBackendAccepted() *ReplaceAllHTTPErrorRuleBackendAccepted { - - return &ReplaceAllHTTPErrorRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http error rule backend accepted response -func (o *ReplaceAllHTTPErrorRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPErrorRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http error rule backend accepted response -func (o *ReplaceAllHTTPErrorRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http error rule backend accepted response -func (o *ReplaceAllHTTPErrorRuleBackendAccepted) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule backend accepted response -func (o *ReplaceAllHTTPErrorRuleBackendAccepted) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleBackendBadRequest -const ReplaceAllHTTPErrorRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllHTTPErrorRuleBackendBadRequest Bad request - -swagger:response replaceAllHttpErrorRuleBackendBadRequest -*/ -type ReplaceAllHTTPErrorRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleBackendBadRequest creates ReplaceAllHTTPErrorRuleBackendBadRequest with default headers values -func NewReplaceAllHTTPErrorRuleBackendBadRequest() *ReplaceAllHTTPErrorRuleBackendBadRequest { - - return &ReplaceAllHTTPErrorRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http error rule backend bad request response -func (o *ReplaceAllHTTPErrorRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http error rule backend bad request response -func (o *ReplaceAllHTTPErrorRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http error rule backend bad request response -func (o *ReplaceAllHTTPErrorRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule backend bad request response -func (o *ReplaceAllHTTPErrorRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPErrorRuleBackendDefault General Error - -swagger:response replaceAllHttpErrorRuleBackendDefault -*/ -type ReplaceAllHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleBackendDefault creates ReplaceAllHTTPErrorRuleBackendDefault with default headers values -func NewReplaceAllHTTPErrorRuleBackendDefault(code int) *ReplaceAllHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) WithStatusCode(code int) *ReplaceAllHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP error rule backend default response -func (o *ReplaceAllHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/replace_all_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index a29aa22d..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPErrorRuleBackendURL generates an URL for the replace all HTTP error rule backend operation -type ReplaceAllHTTPErrorRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleBackendURL) WithBasePath(bp string) *ReplaceAllHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_defaults.go b/operations/http_error_rule/replace_all_http_error_rule_defaults.go deleted file mode 100644 index e98d93bc..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a replace all HTTP error rule defaults handler -type ReplaceAllHTTPErrorRuleDefaultsHandlerFunc func(ReplaceAllHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPErrorRuleDefaultsHandlerFunc) Handle(params ReplaceAllHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPErrorRuleDefaultsHandler interface for that can handle valid replace all HTTP error rule defaults params -type ReplaceAllHTTPErrorRuleDefaultsHandler interface { - Handle(ReplaceAllHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPErrorRuleDefaults creates a new http.Handler for the replace all HTTP error rule defaults operation -func NewReplaceAllHTTPErrorRuleDefaults(ctx *middleware.Context, handler ReplaceAllHTTPErrorRuleDefaultsHandler) *ReplaceAllHTTPErrorRuleDefaults { - return &ReplaceAllHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPErrorRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules HTTPErrorRule replaceAllHttpErrorRuleDefaults - -# Replace an HTTP Error Rules list - -Replaces a whole list of HTTP Error Rules with the list given in parameter -*/ -type ReplaceAllHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllHTTPErrorRuleDefaultsHandler -} - -func (o *ReplaceAllHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_defaults_parameters.go b/operations/http_error_rule/replace_all_http_error_rule_defaults_parameters.go deleted file mode 100644 index 46e22230..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPErrorRuleDefaultsParams creates a new ReplaceAllHTTPErrorRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllHTTPErrorRuleDefaultsParams() ReplaceAllHTTPErrorRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPErrorRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPErrorRuleDefaultsParams contains all the bound params for the replace all HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPErrorRuleDefaults -type ReplaceAllHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPErrorRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPErrorRuleDefaultsParams() beforehand. -func (o *ReplaceAllHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPErrorRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPErrorRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPErrorRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_defaults_responses.go b/operations/http_error_rule/replace_all_http_error_rule_defaults_responses.go deleted file mode 100644 index 374527b6..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPErrorRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleDefaultsOK -const ReplaceAllHTTPErrorRuleDefaultsOKCode int = 200 - -/* -ReplaceAllHTTPErrorRuleDefaultsOK All HTTP Error Rules lines replaced - -swagger:response replaceAllHttpErrorRuleDefaultsOK -*/ -type ReplaceAllHTTPErrorRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleDefaultsOK creates ReplaceAllHTTPErrorRuleDefaultsOK with default headers values -func NewReplaceAllHTTPErrorRuleDefaultsOK() *ReplaceAllHTTPErrorRuleDefaultsOK { - - return &ReplaceAllHTTPErrorRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Http error rule defaults o k response -func (o *ReplaceAllHTTPErrorRuleDefaultsOK) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule defaults o k response -func (o *ReplaceAllHTTPErrorRuleDefaultsOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleDefaultsAccepted -const ReplaceAllHTTPErrorRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllHTTPErrorRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpErrorRuleDefaultsAccepted -*/ -type ReplaceAllHTTPErrorRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleDefaultsAccepted creates ReplaceAllHTTPErrorRuleDefaultsAccepted with default headers values -func NewReplaceAllHTTPErrorRuleDefaultsAccepted() *ReplaceAllHTTPErrorRuleDefaultsAccepted { - - return &ReplaceAllHTTPErrorRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http error rule defaults accepted response -func (o *ReplaceAllHTTPErrorRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPErrorRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http error rule defaults accepted response -func (o *ReplaceAllHTTPErrorRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http error rule defaults accepted response -func (o *ReplaceAllHTTPErrorRuleDefaultsAccepted) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule defaults accepted response -func (o *ReplaceAllHTTPErrorRuleDefaultsAccepted) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleDefaultsBadRequest -const ReplaceAllHTTPErrorRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllHTTPErrorRuleDefaultsBadRequest Bad request - -swagger:response replaceAllHttpErrorRuleDefaultsBadRequest -*/ -type ReplaceAllHTTPErrorRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleDefaultsBadRequest creates ReplaceAllHTTPErrorRuleDefaultsBadRequest with default headers values -func NewReplaceAllHTTPErrorRuleDefaultsBadRequest() *ReplaceAllHTTPErrorRuleDefaultsBadRequest { - - return &ReplaceAllHTTPErrorRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http error rule defaults bad request response -func (o *ReplaceAllHTTPErrorRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http error rule defaults bad request response -func (o *ReplaceAllHTTPErrorRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http error rule defaults bad request response -func (o *ReplaceAllHTTPErrorRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule defaults bad request response -func (o *ReplaceAllHTTPErrorRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPErrorRuleDefaultsDefault General Error - -swagger:response replaceAllHttpErrorRuleDefaultsDefault -*/ -type ReplaceAllHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleDefaultsDefault creates ReplaceAllHTTPErrorRuleDefaultsDefault with default headers values -func NewReplaceAllHTTPErrorRuleDefaultsDefault(code int) *ReplaceAllHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP error rule defaults default response -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/replace_all_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index 745c95c9..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPErrorRuleDefaultsURL generates an URL for the replace all HTTP error rule defaults operation -type ReplaceAllHTTPErrorRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_frontend.go b/operations/http_error_rule/replace_all_http_error_rule_frontend.go deleted file mode 100644 index 9cb0d328..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a replace all HTTP error rule frontend handler -type ReplaceAllHTTPErrorRuleFrontendHandlerFunc func(ReplaceAllHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPErrorRuleFrontendHandlerFunc) Handle(params ReplaceAllHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPErrorRuleFrontendHandler interface for that can handle valid replace all HTTP error rule frontend params -type ReplaceAllHTTPErrorRuleFrontendHandler interface { - Handle(ReplaceAllHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPErrorRuleFrontend creates a new http.Handler for the replace all HTTP error rule frontend operation -func NewReplaceAllHTTPErrorRuleFrontend(ctx *middleware.Context, handler ReplaceAllHTTPErrorRuleFrontendHandler) *ReplaceAllHTTPErrorRuleFrontend { - return &ReplaceAllHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPErrorRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules HTTPErrorRule replaceAllHttpErrorRuleFrontend - -# Replace an HTTP Error Rules list - -Replaces a whole list of HTTP Error Rules with the list given in parameter -*/ -type ReplaceAllHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllHTTPErrorRuleFrontendHandler -} - -func (o *ReplaceAllHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_frontend_parameters.go b/operations/http_error_rule/replace_all_http_error_rule_frontend_parameters.go deleted file mode 100644 index e31239a1..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPErrorRuleFrontendParams creates a new ReplaceAllHTTPErrorRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllHTTPErrorRuleFrontendParams() ReplaceAllHTTPErrorRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPErrorRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPErrorRuleFrontendParams contains all the bound params for the replace all HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPErrorRuleFrontend -type ReplaceAllHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPErrorRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPErrorRuleFrontendParams() beforehand. -func (o *ReplaceAllHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPErrorRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPErrorRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPErrorRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_frontend_responses.go b/operations/http_error_rule/replace_all_http_error_rule_frontend_responses.go deleted file mode 100644 index abcfc5d2..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPErrorRuleFrontendOKCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleFrontendOK -const ReplaceAllHTTPErrorRuleFrontendOKCode int = 200 - -/* -ReplaceAllHTTPErrorRuleFrontendOK All HTTP Error Rules lines replaced - -swagger:response replaceAllHttpErrorRuleFrontendOK -*/ -type ReplaceAllHTTPErrorRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleFrontendOK creates ReplaceAllHTTPErrorRuleFrontendOK with default headers values -func NewReplaceAllHTTPErrorRuleFrontendOK() *ReplaceAllHTTPErrorRuleFrontendOK { - - return &ReplaceAllHTTPErrorRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Http error rule frontend o k response -func (o *ReplaceAllHTTPErrorRuleFrontendOK) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule frontend o k response -func (o *ReplaceAllHTTPErrorRuleFrontendOK) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleFrontendAccepted -const ReplaceAllHTTPErrorRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllHTTPErrorRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpErrorRuleFrontendAccepted -*/ -type ReplaceAllHTTPErrorRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPErrorRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleFrontendAccepted creates ReplaceAllHTTPErrorRuleFrontendAccepted with default headers values -func NewReplaceAllHTTPErrorRuleFrontendAccepted() *ReplaceAllHTTPErrorRuleFrontendAccepted { - - return &ReplaceAllHTTPErrorRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http error rule frontend accepted response -func (o *ReplaceAllHTTPErrorRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPErrorRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http error rule frontend accepted response -func (o *ReplaceAllHTTPErrorRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http error rule frontend accepted response -func (o *ReplaceAllHTTPErrorRuleFrontendAccepted) WithPayload(payload models.HTTPErrorRules) *ReplaceAllHTTPErrorRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule frontend accepted response -func (o *ReplaceAllHTTPErrorRuleFrontendAccepted) SetPayload(payload models.HTTPErrorRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPErrorRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPErrorRuleFrontendBadRequest -const ReplaceAllHTTPErrorRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllHTTPErrorRuleFrontendBadRequest Bad request - -swagger:response replaceAllHttpErrorRuleFrontendBadRequest -*/ -type ReplaceAllHTTPErrorRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleFrontendBadRequest creates ReplaceAllHTTPErrorRuleFrontendBadRequest with default headers values -func NewReplaceAllHTTPErrorRuleFrontendBadRequest() *ReplaceAllHTTPErrorRuleFrontendBadRequest { - - return &ReplaceAllHTTPErrorRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http error rule frontend bad request response -func (o *ReplaceAllHTTPErrorRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http error rule frontend bad request response -func (o *ReplaceAllHTTPErrorRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http error rule frontend bad request response -func (o *ReplaceAllHTTPErrorRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http error rule frontend bad request response -func (o *ReplaceAllHTTPErrorRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPErrorRuleFrontendDefault General Error - -swagger:response replaceAllHttpErrorRuleFrontendDefault -*/ -type ReplaceAllHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPErrorRuleFrontendDefault creates ReplaceAllHTTPErrorRuleFrontendDefault with default headers values -func NewReplaceAllHTTPErrorRuleFrontendDefault(code int) *ReplaceAllHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP error rule frontend default response -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_all_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/replace_all_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index d8b20f9c..00000000 --- a/operations/http_error_rule/replace_all_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPErrorRuleFrontendURL generates an URL for the replace all HTTP error rule frontend operation -type ReplaceAllHTTPErrorRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleFrontendURL) WithBasePath(bp string) *ReplaceAllHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_http_error_rule_backend.go b/operations/http_error_rule/replace_http_error_rule_backend.go deleted file mode 100644 index d66c2de3..00000000 --- a/operations/http_error_rule/replace_http_error_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPErrorRuleBackendHandlerFunc turns a function with the right signature into a replace HTTP error rule backend handler -type ReplaceHTTPErrorRuleBackendHandlerFunc func(ReplaceHTTPErrorRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPErrorRuleBackendHandlerFunc) Handle(params ReplaceHTTPErrorRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPErrorRuleBackendHandler interface for that can handle valid replace HTTP error rule backend params -type ReplaceHTTPErrorRuleBackendHandler interface { - Handle(ReplaceHTTPErrorRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPErrorRuleBackend creates a new http.Handler for the replace HTTP error rule backend operation -func NewReplaceHTTPErrorRuleBackend(ctx *middleware.Context, handler ReplaceHTTPErrorRuleBackendHandler) *ReplaceHTTPErrorRuleBackend { - return &ReplaceHTTPErrorRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPErrorRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index} HTTPErrorRule replaceHttpErrorRuleBackend - -# Replace a HTTP Error Rule - -Replaces a HTTP Error Rule configuration by its index in the specified parent. -*/ -type ReplaceHTTPErrorRuleBackend struct { - Context *middleware.Context - Handler ReplaceHTTPErrorRuleBackendHandler -} - -func (o *ReplaceHTTPErrorRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPErrorRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_http_error_rule_backend_parameters.go b/operations/http_error_rule/replace_http_error_rule_backend_parameters.go deleted file mode 100644 index cbb6f4f7..00000000 --- a/operations/http_error_rule/replace_http_error_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPErrorRuleBackendParams creates a new ReplaceHTTPErrorRuleBackendParams object -// with the default values initialized. -func NewReplaceHTTPErrorRuleBackendParams() ReplaceHTTPErrorRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPErrorRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPErrorRuleBackendParams contains all the bound params for the replace HTTP error rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPErrorRuleBackend -type ReplaceHTTPErrorRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPErrorRuleBackendParams() beforehand. -func (o *ReplaceHTTPErrorRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPErrorRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPErrorRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPErrorRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPErrorRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPErrorRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPErrorRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_http_error_rule_backend_responses.go b/operations/http_error_rule/replace_http_error_rule_backend_responses.go deleted file mode 100644 index aaa7fc2f..00000000 --- a/operations/http_error_rule/replace_http_error_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPErrorRuleBackendOKCode is the HTTP code returned for type ReplaceHTTPErrorRuleBackendOK -const ReplaceHTTPErrorRuleBackendOKCode int = 200 - -/* -ReplaceHTTPErrorRuleBackendOK HTTP Error Rule replaced - -swagger:response replaceHttpErrorRuleBackendOK -*/ -type ReplaceHTTPErrorRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleBackendOK creates ReplaceHTTPErrorRuleBackendOK with default headers values -func NewReplaceHTTPErrorRuleBackendOK() *ReplaceHTTPErrorRuleBackendOK { - - return &ReplaceHTTPErrorRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Http error rule backend o k response -func (o *ReplaceHTTPErrorRuleBackendOK) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule backend o k response -func (o *ReplaceHTTPErrorRuleBackendOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleBackendAcceptedCode is the HTTP code returned for type ReplaceHTTPErrorRuleBackendAccepted -const ReplaceHTTPErrorRuleBackendAcceptedCode int = 202 - -/* -ReplaceHTTPErrorRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpErrorRuleBackendAccepted -*/ -type ReplaceHTTPErrorRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleBackendAccepted creates ReplaceHTTPErrorRuleBackendAccepted with default headers values -func NewReplaceHTTPErrorRuleBackendAccepted() *ReplaceHTTPErrorRuleBackendAccepted { - - return &ReplaceHTTPErrorRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http error rule backend accepted response -func (o *ReplaceHTTPErrorRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceHTTPErrorRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http error rule backend accepted response -func (o *ReplaceHTTPErrorRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http error rule backend accepted response -func (o *ReplaceHTTPErrorRuleBackendAccepted) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule backend accepted response -func (o *ReplaceHTTPErrorRuleBackendAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleBackendBadRequestCode is the HTTP code returned for type ReplaceHTTPErrorRuleBackendBadRequest -const ReplaceHTTPErrorRuleBackendBadRequestCode int = 400 - -/* -ReplaceHTTPErrorRuleBackendBadRequest Bad request - -swagger:response replaceHttpErrorRuleBackendBadRequest -*/ -type ReplaceHTTPErrorRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleBackendBadRequest creates ReplaceHTTPErrorRuleBackendBadRequest with default headers values -func NewReplaceHTTPErrorRuleBackendBadRequest() *ReplaceHTTPErrorRuleBackendBadRequest { - - return &ReplaceHTTPErrorRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule backend bad request response -func (o *ReplaceHTTPErrorRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule backend bad request response -func (o *ReplaceHTTPErrorRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule backend bad request response -func (o *ReplaceHTTPErrorRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule backend bad request response -func (o *ReplaceHTTPErrorRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleBackendNotFoundCode is the HTTP code returned for type ReplaceHTTPErrorRuleBackendNotFound -const ReplaceHTTPErrorRuleBackendNotFoundCode int = 404 - -/* -ReplaceHTTPErrorRuleBackendNotFound The specified resource was not found - -swagger:response replaceHttpErrorRuleBackendNotFound -*/ -type ReplaceHTTPErrorRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleBackendNotFound creates ReplaceHTTPErrorRuleBackendNotFound with default headers values -func NewReplaceHTTPErrorRuleBackendNotFound() *ReplaceHTTPErrorRuleBackendNotFound { - - return &ReplaceHTTPErrorRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule backend not found response -func (o *ReplaceHTTPErrorRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule backend not found response -func (o *ReplaceHTTPErrorRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule backend not found response -func (o *ReplaceHTTPErrorRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule backend not found response -func (o *ReplaceHTTPErrorRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPErrorRuleBackendDefault General Error - -swagger:response replaceHttpErrorRuleBackendDefault -*/ -type ReplaceHTTPErrorRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleBackendDefault creates ReplaceHTTPErrorRuleBackendDefault with default headers values -func NewReplaceHTTPErrorRuleBackendDefault(code int) *ReplaceHTTPErrorRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPErrorRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) WithStatusCode(code int) *ReplaceHTTPErrorRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP error rule backend default response -func (o *ReplaceHTTPErrorRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_http_error_rule_backend_urlbuilder.go b/operations/http_error_rule/replace_http_error_rule_backend_urlbuilder.go deleted file mode 100644 index 7704dea4..00000000 --- a/operations/http_error_rule/replace_http_error_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPErrorRuleBackendURL generates an URL for the replace HTTP error rule backend operation -type ReplaceHTTPErrorRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleBackendURL) WithBasePath(bp string) *ReplaceHTTPErrorRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPErrorRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPErrorRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPErrorRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPErrorRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPErrorRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPErrorRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPErrorRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPErrorRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPErrorRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_http_error_rule_defaults.go b/operations/http_error_rule/replace_http_error_rule_defaults.go deleted file mode 100644 index c49037f2..00000000 --- a/operations/http_error_rule/replace_http_error_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPErrorRuleDefaultsHandlerFunc turns a function with the right signature into a replace HTTP error rule defaults handler -type ReplaceHTTPErrorRuleDefaultsHandlerFunc func(ReplaceHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPErrorRuleDefaultsHandlerFunc) Handle(params ReplaceHTTPErrorRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPErrorRuleDefaultsHandler interface for that can handle valid replace HTTP error rule defaults params -type ReplaceHTTPErrorRuleDefaultsHandler interface { - Handle(ReplaceHTTPErrorRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPErrorRuleDefaults creates a new http.Handler for the replace HTTP error rule defaults operation -func NewReplaceHTTPErrorRuleDefaults(ctx *middleware.Context, handler ReplaceHTTPErrorRuleDefaultsHandler) *ReplaceHTTPErrorRuleDefaults { - return &ReplaceHTTPErrorRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPErrorRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index} HTTPErrorRule replaceHttpErrorRuleDefaults - -# Replace a HTTP Error Rule - -Replaces a HTTP Error Rule configuration by its index in the specified parent. -*/ -type ReplaceHTTPErrorRuleDefaults struct { - Context *middleware.Context - Handler ReplaceHTTPErrorRuleDefaultsHandler -} - -func (o *ReplaceHTTPErrorRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPErrorRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_http_error_rule_defaults_parameters.go b/operations/http_error_rule/replace_http_error_rule_defaults_parameters.go deleted file mode 100644 index 6b883e15..00000000 --- a/operations/http_error_rule/replace_http_error_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPErrorRuleDefaultsParams creates a new ReplaceHTTPErrorRuleDefaultsParams object -// with the default values initialized. -func NewReplaceHTTPErrorRuleDefaultsParams() ReplaceHTTPErrorRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPErrorRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPErrorRuleDefaultsParams contains all the bound params for the replace HTTP error rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPErrorRuleDefaults -type ReplaceHTTPErrorRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPErrorRuleDefaultsParams() beforehand. -func (o *ReplaceHTTPErrorRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPErrorRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPErrorRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPErrorRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPErrorRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPErrorRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPErrorRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_http_error_rule_defaults_responses.go b/operations/http_error_rule/replace_http_error_rule_defaults_responses.go deleted file mode 100644 index feaaff9e..00000000 --- a/operations/http_error_rule/replace_http_error_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPErrorRuleDefaultsOKCode is the HTTP code returned for type ReplaceHTTPErrorRuleDefaultsOK -const ReplaceHTTPErrorRuleDefaultsOKCode int = 200 - -/* -ReplaceHTTPErrorRuleDefaultsOK HTTP Error Rule replaced - -swagger:response replaceHttpErrorRuleDefaultsOK -*/ -type ReplaceHTTPErrorRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleDefaultsOK creates ReplaceHTTPErrorRuleDefaultsOK with default headers values -func NewReplaceHTTPErrorRuleDefaultsOK() *ReplaceHTTPErrorRuleDefaultsOK { - - return &ReplaceHTTPErrorRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Http error rule defaults o k response -func (o *ReplaceHTTPErrorRuleDefaultsOK) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule defaults o k response -func (o *ReplaceHTTPErrorRuleDefaultsOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceHTTPErrorRuleDefaultsAccepted -const ReplaceHTTPErrorRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceHTTPErrorRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpErrorRuleDefaultsAccepted -*/ -type ReplaceHTTPErrorRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleDefaultsAccepted creates ReplaceHTTPErrorRuleDefaultsAccepted with default headers values -func NewReplaceHTTPErrorRuleDefaultsAccepted() *ReplaceHTTPErrorRuleDefaultsAccepted { - - return &ReplaceHTTPErrorRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http error rule defaults accepted response -func (o *ReplaceHTTPErrorRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceHTTPErrorRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http error rule defaults accepted response -func (o *ReplaceHTTPErrorRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http error rule defaults accepted response -func (o *ReplaceHTTPErrorRuleDefaultsAccepted) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule defaults accepted response -func (o *ReplaceHTTPErrorRuleDefaultsAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceHTTPErrorRuleDefaultsBadRequest -const ReplaceHTTPErrorRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceHTTPErrorRuleDefaultsBadRequest Bad request - -swagger:response replaceHttpErrorRuleDefaultsBadRequest -*/ -type ReplaceHTTPErrorRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleDefaultsBadRequest creates ReplaceHTTPErrorRuleDefaultsBadRequest with default headers values -func NewReplaceHTTPErrorRuleDefaultsBadRequest() *ReplaceHTTPErrorRuleDefaultsBadRequest { - - return &ReplaceHTTPErrorRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule defaults bad request response -func (o *ReplaceHTTPErrorRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule defaults bad request response -func (o *ReplaceHTTPErrorRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule defaults bad request response -func (o *ReplaceHTTPErrorRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule defaults bad request response -func (o *ReplaceHTTPErrorRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceHTTPErrorRuleDefaultsNotFound -const ReplaceHTTPErrorRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceHTTPErrorRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceHttpErrorRuleDefaultsNotFound -*/ -type ReplaceHTTPErrorRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleDefaultsNotFound creates ReplaceHTTPErrorRuleDefaultsNotFound with default headers values -func NewReplaceHTTPErrorRuleDefaultsNotFound() *ReplaceHTTPErrorRuleDefaultsNotFound { - - return &ReplaceHTTPErrorRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule defaults not found response -func (o *ReplaceHTTPErrorRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule defaults not found response -func (o *ReplaceHTTPErrorRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule defaults not found response -func (o *ReplaceHTTPErrorRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule defaults not found response -func (o *ReplaceHTTPErrorRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPErrorRuleDefaultsDefault General Error - -swagger:response replaceHttpErrorRuleDefaultsDefault -*/ -type ReplaceHTTPErrorRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleDefaultsDefault creates ReplaceHTTPErrorRuleDefaultsDefault with default headers values -func NewReplaceHTTPErrorRuleDefaultsDefault(code int) *ReplaceHTTPErrorRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPErrorRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) WithStatusCode(code int) *ReplaceHTTPErrorRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP error rule defaults default response -func (o *ReplaceHTTPErrorRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_http_error_rule_defaults_urlbuilder.go b/operations/http_error_rule/replace_http_error_rule_defaults_urlbuilder.go deleted file mode 100644 index ce879f9f..00000000 --- a/operations/http_error_rule/replace_http_error_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPErrorRuleDefaultsURL generates an URL for the replace HTTP error rule defaults operation -type ReplaceHTTPErrorRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleDefaultsURL) WithBasePath(bp string) *ReplaceHTTPErrorRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPErrorRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPErrorRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPErrorRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPErrorRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPErrorRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPErrorRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPErrorRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPErrorRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPErrorRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_error_rule/replace_http_error_rule_frontend.go b/operations/http_error_rule/replace_http_error_rule_frontend.go deleted file mode 100644 index 440ae3fd..00000000 --- a/operations/http_error_rule/replace_http_error_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPErrorRuleFrontendHandlerFunc turns a function with the right signature into a replace HTTP error rule frontend handler -type ReplaceHTTPErrorRuleFrontendHandlerFunc func(ReplaceHTTPErrorRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPErrorRuleFrontendHandlerFunc) Handle(params ReplaceHTTPErrorRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPErrorRuleFrontendHandler interface for that can handle valid replace HTTP error rule frontend params -type ReplaceHTTPErrorRuleFrontendHandler interface { - Handle(ReplaceHTTPErrorRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPErrorRuleFrontend creates a new http.Handler for the replace HTTP error rule frontend operation -func NewReplaceHTTPErrorRuleFrontend(ctx *middleware.Context, handler ReplaceHTTPErrorRuleFrontendHandler) *ReplaceHTTPErrorRuleFrontend { - return &ReplaceHTTPErrorRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPErrorRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index} HTTPErrorRule replaceHttpErrorRuleFrontend - -# Replace a HTTP Error Rule - -Replaces a HTTP Error Rule configuration by its index in the specified parent. -*/ -type ReplaceHTTPErrorRuleFrontend struct { - Context *middleware.Context - Handler ReplaceHTTPErrorRuleFrontendHandler -} - -func (o *ReplaceHTTPErrorRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPErrorRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_error_rule/replace_http_error_rule_frontend_parameters.go b/operations/http_error_rule/replace_http_error_rule_frontend_parameters.go deleted file mode 100644 index 2fca35e8..00000000 --- a/operations/http_error_rule/replace_http_error_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPErrorRuleFrontendParams creates a new ReplaceHTTPErrorRuleFrontendParams object -// with the default values initialized. -func NewReplaceHTTPErrorRuleFrontendParams() ReplaceHTTPErrorRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPErrorRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPErrorRuleFrontendParams contains all the bound params for the replace HTTP error rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPErrorRuleFrontend -type ReplaceHTTPErrorRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Error Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPErrorRuleFrontendParams() beforehand. -func (o *ReplaceHTTPErrorRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPErrorRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPErrorRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPErrorRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPErrorRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPErrorRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPErrorRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_error_rule/replace_http_error_rule_frontend_responses.go b/operations/http_error_rule/replace_http_error_rule_frontend_responses.go deleted file mode 100644 index d82a0bb2..00000000 --- a/operations/http_error_rule/replace_http_error_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPErrorRuleFrontendOKCode is the HTTP code returned for type ReplaceHTTPErrorRuleFrontendOK -const ReplaceHTTPErrorRuleFrontendOKCode int = 200 - -/* -ReplaceHTTPErrorRuleFrontendOK HTTP Error Rule replaced - -swagger:response replaceHttpErrorRuleFrontendOK -*/ -type ReplaceHTTPErrorRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleFrontendOK creates ReplaceHTTPErrorRuleFrontendOK with default headers values -func NewReplaceHTTPErrorRuleFrontendOK() *ReplaceHTTPErrorRuleFrontendOK { - - return &ReplaceHTTPErrorRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Http error rule frontend o k response -func (o *ReplaceHTTPErrorRuleFrontendOK) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule frontend o k response -func (o *ReplaceHTTPErrorRuleFrontendOK) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceHTTPErrorRuleFrontendAccepted -const ReplaceHTTPErrorRuleFrontendAcceptedCode int = 202 - -/* -ReplaceHTTPErrorRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpErrorRuleFrontendAccepted -*/ -type ReplaceHTTPErrorRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorRule `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleFrontendAccepted creates ReplaceHTTPErrorRuleFrontendAccepted with default headers values -func NewReplaceHTTPErrorRuleFrontendAccepted() *ReplaceHTTPErrorRuleFrontendAccepted { - - return &ReplaceHTTPErrorRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http error rule frontend accepted response -func (o *ReplaceHTTPErrorRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceHTTPErrorRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http error rule frontend accepted response -func (o *ReplaceHTTPErrorRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http error rule frontend accepted response -func (o *ReplaceHTTPErrorRuleFrontendAccepted) WithPayload(payload *models.HTTPErrorRule) *ReplaceHTTPErrorRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule frontend accepted response -func (o *ReplaceHTTPErrorRuleFrontendAccepted) SetPayload(payload *models.HTTPErrorRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceHTTPErrorRuleFrontendBadRequest -const ReplaceHTTPErrorRuleFrontendBadRequestCode int = 400 - -/* -ReplaceHTTPErrorRuleFrontendBadRequest Bad request - -swagger:response replaceHttpErrorRuleFrontendBadRequest -*/ -type ReplaceHTTPErrorRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleFrontendBadRequest creates ReplaceHTTPErrorRuleFrontendBadRequest with default headers values -func NewReplaceHTTPErrorRuleFrontendBadRequest() *ReplaceHTTPErrorRuleFrontendBadRequest { - - return &ReplaceHTTPErrorRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule frontend bad request response -func (o *ReplaceHTTPErrorRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule frontend bad request response -func (o *ReplaceHTTPErrorRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule frontend bad request response -func (o *ReplaceHTTPErrorRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule frontend bad request response -func (o *ReplaceHTTPErrorRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceHTTPErrorRuleFrontendNotFound -const ReplaceHTTPErrorRuleFrontendNotFoundCode int = 404 - -/* -ReplaceHTTPErrorRuleFrontendNotFound The specified resource was not found - -swagger:response replaceHttpErrorRuleFrontendNotFound -*/ -type ReplaceHTTPErrorRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleFrontendNotFound creates ReplaceHTTPErrorRuleFrontendNotFound with default headers values -func NewReplaceHTTPErrorRuleFrontendNotFound() *ReplaceHTTPErrorRuleFrontendNotFound { - - return &ReplaceHTTPErrorRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http error rule frontend not found response -func (o *ReplaceHTTPErrorRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http error rule frontend not found response -func (o *ReplaceHTTPErrorRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http error rule frontend not found response -func (o *ReplaceHTTPErrorRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http error rule frontend not found response -func (o *ReplaceHTTPErrorRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPErrorRuleFrontendDefault General Error - -swagger:response replaceHttpErrorRuleFrontendDefault -*/ -type ReplaceHTTPErrorRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorRuleFrontendDefault creates ReplaceHTTPErrorRuleFrontendDefault with default headers values -func NewReplaceHTTPErrorRuleFrontendDefault(code int) *ReplaceHTTPErrorRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPErrorRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) WithStatusCode(code int) *ReplaceHTTPErrorRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceHTTPErrorRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP error rule frontend default response -func (o *ReplaceHTTPErrorRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_error_rule/replace_http_error_rule_frontend_urlbuilder.go b/operations/http_error_rule/replace_http_error_rule_frontend_urlbuilder.go deleted file mode 100644 index 2eac0515..00000000 --- a/operations/http_error_rule/replace_http_error_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_error_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPErrorRuleFrontendURL generates an URL for the replace HTTP error rule frontend operation -type ReplaceHTTPErrorRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleFrontendURL) WithBasePath(bp string) *ReplaceHTTPErrorRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPErrorRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPErrorRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPErrorRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPErrorRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPErrorRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPErrorRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPErrorRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPErrorRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPErrorRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_errors/create_http_errors_section.go b/operations/http_errors/create_http_errors_section.go deleted file mode 100644 index 0289fc48..00000000 --- a/operations/http_errors/create_http_errors_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPErrorsSectionHandlerFunc turns a function with the right signature into a create HTTP errors section handler -type CreateHTTPErrorsSectionHandlerFunc func(CreateHTTPErrorsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPErrorsSectionHandlerFunc) Handle(params CreateHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPErrorsSectionHandler interface for that can handle valid create HTTP errors section params -type CreateHTTPErrorsSectionHandler interface { - Handle(CreateHTTPErrorsSectionParams, interface{}) middleware.Responder -} - -// NewCreateHTTPErrorsSection creates a new http.Handler for the create HTTP errors section operation -func NewCreateHTTPErrorsSection(ctx *middleware.Context, handler CreateHTTPErrorsSectionHandler) *CreateHTTPErrorsSection { - return &CreateHTTPErrorsSection{Context: ctx, Handler: handler} -} - -/* - CreateHTTPErrorsSection swagger:route POST /services/haproxy/configuration/http_errors_sections HTTPErrors createHttpErrorsSection - -# Add a new http-error section - -Adds a new http-error section to the configuration. -*/ -type CreateHTTPErrorsSection struct { - Context *middleware.Context - Handler CreateHTTPErrorsSectionHandler -} - -func (o *CreateHTTPErrorsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPErrorsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_errors/create_http_errors_section_parameters.go b/operations/http_errors/create_http_errors_section_parameters.go deleted file mode 100644 index 91dae721..00000000 --- a/operations/http_errors/create_http_errors_section_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPErrorsSectionParams creates a new CreateHTTPErrorsSectionParams object -// with the default values initialized. -func NewCreateHTTPErrorsSectionParams() CreateHTTPErrorsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPErrorsSectionParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPErrorsSectionParams contains all the bound params for the create HTTP errors section operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPErrorsSection -type CreateHTTPErrorsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorsSection - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPErrorsSectionParams() beforehand. -func (o *CreateHTTPErrorsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorsSection - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPErrorsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPErrorsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPErrorsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPErrorsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_errors/create_http_errors_section_responses.go b/operations/http_errors/create_http_errors_section_responses.go deleted file mode 100644 index 1a681087..00000000 --- a/operations/http_errors/create_http_errors_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPErrorsSectionCreatedCode is the HTTP code returned for type CreateHTTPErrorsSectionCreated -const CreateHTTPErrorsSectionCreatedCode int = 201 - -/* -CreateHTTPErrorsSectionCreated http-error section created - -swagger:response createHttpErrorsSectionCreated -*/ -type CreateHTTPErrorsSectionCreated struct { - - /* - In: Body - */ - Payload *models.HTTPErrorsSection `json:"body,omitempty"` -} - -// NewCreateHTTPErrorsSectionCreated creates CreateHTTPErrorsSectionCreated with default headers values -func NewCreateHTTPErrorsSectionCreated() *CreateHTTPErrorsSectionCreated { - - return &CreateHTTPErrorsSectionCreated{} -} - -// WithPayload adds the payload to the create Http errors section created response -func (o *CreateHTTPErrorsSectionCreated) WithPayload(payload *models.HTTPErrorsSection) *CreateHTTPErrorsSectionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http errors section created response -func (o *CreateHTTPErrorsSectionCreated) SetPayload(payload *models.HTTPErrorsSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorsSectionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorsSectionAcceptedCode is the HTTP code returned for type CreateHTTPErrorsSectionAccepted -const CreateHTTPErrorsSectionAcceptedCode int = 202 - -/* -CreateHTTPErrorsSectionAccepted Configuration change accepted and reload requested - -swagger:response createHttpErrorsSectionAccepted -*/ -type CreateHTTPErrorsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorsSection `json:"body,omitempty"` -} - -// NewCreateHTTPErrorsSectionAccepted creates CreateHTTPErrorsSectionAccepted with default headers values -func NewCreateHTTPErrorsSectionAccepted() *CreateHTTPErrorsSectionAccepted { - - return &CreateHTTPErrorsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the create Http errors section accepted response -func (o *CreateHTTPErrorsSectionAccepted) WithReloadID(reloadID string) *CreateHTTPErrorsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http errors section accepted response -func (o *CreateHTTPErrorsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http errors section accepted response -func (o *CreateHTTPErrorsSectionAccepted) WithPayload(payload *models.HTTPErrorsSection) *CreateHTTPErrorsSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http errors section accepted response -func (o *CreateHTTPErrorsSectionAccepted) SetPayload(payload *models.HTTPErrorsSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorsSectionBadRequestCode is the HTTP code returned for type CreateHTTPErrorsSectionBadRequest -const CreateHTTPErrorsSectionBadRequestCode int = 400 - -/* -CreateHTTPErrorsSectionBadRequest Bad request - -swagger:response createHttpErrorsSectionBadRequest -*/ -type CreateHTTPErrorsSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorsSectionBadRequest creates CreateHTTPErrorsSectionBadRequest with default headers values -func NewCreateHTTPErrorsSectionBadRequest() *CreateHTTPErrorsSectionBadRequest { - - return &CreateHTTPErrorsSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http errors section bad request response -func (o *CreateHTTPErrorsSectionBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorsSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http errors section bad request response -func (o *CreateHTTPErrorsSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http errors section bad request response -func (o *CreateHTTPErrorsSectionBadRequest) WithPayload(payload *models.Error) *CreateHTTPErrorsSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http errors section bad request response -func (o *CreateHTTPErrorsSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorsSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPErrorsSectionConflictCode is the HTTP code returned for type CreateHTTPErrorsSectionConflict -const CreateHTTPErrorsSectionConflictCode int = 409 - -/* -CreateHTTPErrorsSectionConflict The specified resource already exists - -swagger:response createHttpErrorsSectionConflict -*/ -type CreateHTTPErrorsSectionConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorsSectionConflict creates CreateHTTPErrorsSectionConflict with default headers values -func NewCreateHTTPErrorsSectionConflict() *CreateHTTPErrorsSectionConflict { - - return &CreateHTTPErrorsSectionConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http errors section conflict response -func (o *CreateHTTPErrorsSectionConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorsSectionConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http errors section conflict response -func (o *CreateHTTPErrorsSectionConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http errors section conflict response -func (o *CreateHTTPErrorsSectionConflict) WithPayload(payload *models.Error) *CreateHTTPErrorsSectionConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http errors section conflict response -func (o *CreateHTTPErrorsSectionConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorsSectionConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPErrorsSectionDefault General Error - -swagger:response createHttpErrorsSectionDefault -*/ -type CreateHTTPErrorsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPErrorsSectionDefault creates CreateHTTPErrorsSectionDefault with default headers values -func NewCreateHTTPErrorsSectionDefault(code int) *CreateHTTPErrorsSectionDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPErrorsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) WithStatusCode(code int) *CreateHTTPErrorsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPErrorsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) WithPayload(payload *models.Error) *CreateHTTPErrorsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP errors section default response -func (o *CreateHTTPErrorsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPErrorsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_errors/create_http_errors_section_urlbuilder.go b/operations/http_errors/create_http_errors_section_urlbuilder.go deleted file mode 100644 index 5f729d41..00000000 --- a/operations/http_errors/create_http_errors_section_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateHTTPErrorsSectionURL generates an URL for the create HTTP errors section operation -type CreateHTTPErrorsSectionURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorsSectionURL) WithBasePath(bp string) *CreateHTTPErrorsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPErrorsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPErrorsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/http_errors_sections" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPErrorsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPErrorsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPErrorsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPErrorsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPErrorsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPErrorsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_errors/delete_http_errors_section.go b/operations/http_errors/delete_http_errors_section.go deleted file mode 100644 index f2ed6646..00000000 --- a/operations/http_errors/delete_http_errors_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPErrorsSectionHandlerFunc turns a function with the right signature into a delete HTTP errors section handler -type DeleteHTTPErrorsSectionHandlerFunc func(DeleteHTTPErrorsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPErrorsSectionHandlerFunc) Handle(params DeleteHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPErrorsSectionHandler interface for that can handle valid delete HTTP errors section params -type DeleteHTTPErrorsSectionHandler interface { - Handle(DeleteHTTPErrorsSectionParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPErrorsSection creates a new http.Handler for the delete HTTP errors section operation -func NewDeleteHTTPErrorsSection(ctx *middleware.Context, handler DeleteHTTPErrorsSectionHandler) *DeleteHTTPErrorsSection { - return &DeleteHTTPErrorsSection{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPErrorsSection swagger:route DELETE /services/haproxy/configuration/http_errors_sections/{name} HTTPErrors deleteHttpErrorsSection - -# Delete a http-error section - -Deletes a http-error section with a given name from the configuration. -*/ -type DeleteHTTPErrorsSection struct { - Context *middleware.Context - Handler DeleteHTTPErrorsSectionHandler -} - -func (o *DeleteHTTPErrorsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPErrorsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_errors/delete_http_errors_section_parameters.go b/operations/http_errors/delete_http_errors_section_parameters.go deleted file mode 100644 index 5cbc4668..00000000 --- a/operations/http_errors/delete_http_errors_section_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPErrorsSectionParams creates a new DeleteHTTPErrorsSectionParams object -// with the default values initialized. -func NewDeleteHTTPErrorsSectionParams() DeleteHTTPErrorsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPErrorsSectionParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPErrorsSectionParams contains all the bound params for the delete HTTP errors section operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPErrorsSection -type DeleteHTTPErrorsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*http-error section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPErrorsSectionParams() beforehand. -func (o *DeleteHTTPErrorsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPErrorsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPErrorsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteHTTPErrorsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPErrorsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPErrorsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_errors/delete_http_errors_section_responses.go b/operations/http_errors/delete_http_errors_section_responses.go deleted file mode 100644 index 232ab1e7..00000000 --- a/operations/http_errors/delete_http_errors_section_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPErrorsSectionAcceptedCode is the HTTP code returned for type DeleteHTTPErrorsSectionAccepted -const DeleteHTTPErrorsSectionAcceptedCode int = 202 - -/* -DeleteHTTPErrorsSectionAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpErrorsSectionAccepted -*/ -type DeleteHTTPErrorsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPErrorsSectionAccepted creates DeleteHTTPErrorsSectionAccepted with default headers values -func NewDeleteHTTPErrorsSectionAccepted() *DeleteHTTPErrorsSectionAccepted { - - return &DeleteHTTPErrorsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http errors section accepted response -func (o *DeleteHTTPErrorsSectionAccepted) WithReloadID(reloadID string) *DeleteHTTPErrorsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http errors section accepted response -func (o *DeleteHTTPErrorsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPErrorsSectionNoContentCode is the HTTP code returned for type DeleteHTTPErrorsSectionNoContent -const DeleteHTTPErrorsSectionNoContentCode int = 204 - -/* -DeleteHTTPErrorsSectionNoContent http-error section deleted - -swagger:response deleteHttpErrorsSectionNoContent -*/ -type DeleteHTTPErrorsSectionNoContent struct { -} - -// NewDeleteHTTPErrorsSectionNoContent creates DeleteHTTPErrorsSectionNoContent with default headers values -func NewDeleteHTTPErrorsSectionNoContent() *DeleteHTTPErrorsSectionNoContent { - - return &DeleteHTTPErrorsSectionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorsSectionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPErrorsSectionNotFoundCode is the HTTP code returned for type DeleteHTTPErrorsSectionNotFound -const DeleteHTTPErrorsSectionNotFoundCode int = 404 - -/* -DeleteHTTPErrorsSectionNotFound The specified resource was not found - -swagger:response deleteHttpErrorsSectionNotFound -*/ -type DeleteHTTPErrorsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorsSectionNotFound creates DeleteHTTPErrorsSectionNotFound with default headers values -func NewDeleteHTTPErrorsSectionNotFound() *DeleteHTTPErrorsSectionNotFound { - - return &DeleteHTTPErrorsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http errors section not found response -func (o *DeleteHTTPErrorsSectionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http errors section not found response -func (o *DeleteHTTPErrorsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http errors section not found response -func (o *DeleteHTTPErrorsSectionNotFound) WithPayload(payload *models.Error) *DeleteHTTPErrorsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http errors section not found response -func (o *DeleteHTTPErrorsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPErrorsSectionDefault General Error - -swagger:response deleteHttpErrorsSectionDefault -*/ -type DeleteHTTPErrorsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPErrorsSectionDefault creates DeleteHTTPErrorsSectionDefault with default headers values -func NewDeleteHTTPErrorsSectionDefault(code int) *DeleteHTTPErrorsSectionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPErrorsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) WithStatusCode(code int) *DeleteHTTPErrorsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPErrorsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) WithPayload(payload *models.Error) *DeleteHTTPErrorsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP errors section default response -func (o *DeleteHTTPErrorsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPErrorsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_errors/delete_http_errors_section_urlbuilder.go b/operations/http_errors/delete_http_errors_section_urlbuilder.go deleted file mode 100644 index 9503858e..00000000 --- a/operations/http_errors/delete_http_errors_section_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPErrorsSectionURL generates an URL for the delete HTTP errors section operation -type DeleteHTTPErrorsSectionURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorsSectionURL) WithBasePath(bp string) *DeleteHTTPErrorsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPErrorsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPErrorsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/http_errors_sections/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteHTTPErrorsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPErrorsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPErrorsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPErrorsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPErrorsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPErrorsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPErrorsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_errors/get_http_errors_section.go b/operations/http_errors/get_http_errors_section.go deleted file mode 100644 index 203e6089..00000000 --- a/operations/http_errors/get_http_errors_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPErrorsSectionHandlerFunc turns a function with the right signature into a get HTTP errors section handler -type GetHTTPErrorsSectionHandlerFunc func(GetHTTPErrorsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPErrorsSectionHandlerFunc) Handle(params GetHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPErrorsSectionHandler interface for that can handle valid get HTTP errors section params -type GetHTTPErrorsSectionHandler interface { - Handle(GetHTTPErrorsSectionParams, interface{}) middleware.Responder -} - -// NewGetHTTPErrorsSection creates a new http.Handler for the get HTTP errors section operation -func NewGetHTTPErrorsSection(ctx *middleware.Context, handler GetHTTPErrorsSectionHandler) *GetHTTPErrorsSection { - return &GetHTTPErrorsSection{Context: ctx, Handler: handler} -} - -/* - GetHTTPErrorsSection swagger:route GET /services/haproxy/configuration/http_errors_sections/{name} HTTPErrors getHttpErrorsSection - -# Return a http-error section - -Returns one http-error section with a given name from the configuration. -*/ -type GetHTTPErrorsSection struct { - Context *middleware.Context - Handler GetHTTPErrorsSectionHandler -} - -func (o *GetHTTPErrorsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPErrorsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_errors/get_http_errors_section_parameters.go b/operations/http_errors/get_http_errors_section_parameters.go deleted file mode 100644 index fdf564d2..00000000 --- a/operations/http_errors/get_http_errors_section_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetHTTPErrorsSectionParams creates a new GetHTTPErrorsSectionParams object -// -// There are no default values defined in the spec. -func NewGetHTTPErrorsSectionParams() GetHTTPErrorsSectionParams { - - return GetHTTPErrorsSectionParams{} -} - -// GetHTTPErrorsSectionParams contains all the bound params for the get HTTP errors section operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPErrorsSection -type GetHTTPErrorsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*http-error section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPErrorsSectionParams() beforehand. -func (o *GetHTTPErrorsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetHTTPErrorsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPErrorsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_errors/get_http_errors_section_responses.go b/operations/http_errors/get_http_errors_section_responses.go deleted file mode 100644 index af39dacf..00000000 --- a/operations/http_errors/get_http_errors_section_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPErrorsSectionOKCode is the HTTP code returned for type GetHTTPErrorsSectionOK -const GetHTTPErrorsSectionOKCode int = 200 - -/* -GetHTTPErrorsSectionOK Successful operation - -swagger:response getHttpErrorsSectionOK -*/ -type GetHTTPErrorsSectionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPErrorsSection `json:"body,omitempty"` -} - -// NewGetHTTPErrorsSectionOK creates GetHTTPErrorsSectionOK with default headers values -func NewGetHTTPErrorsSectionOK() *GetHTTPErrorsSectionOK { - - return &GetHTTPErrorsSectionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http errors section o k response -func (o *GetHTTPErrorsSectionOK) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorsSectionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http errors section o k response -func (o *GetHTTPErrorsSectionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http errors section o k response -func (o *GetHTTPErrorsSectionOK) WithPayload(payload *models.HTTPErrorsSection) *GetHTTPErrorsSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http errors section o k response -func (o *GetHTTPErrorsSectionOK) SetPayload(payload *models.HTTPErrorsSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorsSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPErrorsSectionNotFoundCode is the HTTP code returned for type GetHTTPErrorsSectionNotFound -const GetHTTPErrorsSectionNotFoundCode int = 404 - -/* -GetHTTPErrorsSectionNotFound The specified resource was not found - -swagger:response getHttpErrorsSectionNotFound -*/ -type GetHTTPErrorsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorsSectionNotFound creates GetHTTPErrorsSectionNotFound with default headers values -func NewGetHTTPErrorsSectionNotFound() *GetHTTPErrorsSectionNotFound { - - return &GetHTTPErrorsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http errors section not found response -func (o *GetHTTPErrorsSectionNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http errors section not found response -func (o *GetHTTPErrorsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http errors section not found response -func (o *GetHTTPErrorsSectionNotFound) WithPayload(payload *models.Error) *GetHTTPErrorsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http errors section not found response -func (o *GetHTTPErrorsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPErrorsSectionDefault General Error - -swagger:response getHttpErrorsSectionDefault -*/ -type GetHTTPErrorsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorsSectionDefault creates GetHTTPErrorsSectionDefault with default headers values -func NewGetHTTPErrorsSectionDefault(code int) *GetHTTPErrorsSectionDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPErrorsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) WithStatusCode(code int) *GetHTTPErrorsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) WithPayload(payload *models.Error) *GetHTTPErrorsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP errors section default response -func (o *GetHTTPErrorsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_errors/get_http_errors_section_urlbuilder.go b/operations/http_errors/get_http_errors_section_urlbuilder.go deleted file mode 100644 index 45cce8e3..00000000 --- a/operations/http_errors/get_http_errors_section_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetHTTPErrorsSectionURL generates an URL for the get HTTP errors section operation -type GetHTTPErrorsSectionURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorsSectionURL) WithBasePath(bp string) *GetHTTPErrorsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPErrorsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/http_errors_sections/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetHTTPErrorsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPErrorsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPErrorsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPErrorsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPErrorsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPErrorsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPErrorsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_errors/get_http_errors_sections.go b/operations/http_errors/get_http_errors_sections.go deleted file mode 100644 index c715c3dc..00000000 --- a/operations/http_errors/get_http_errors_sections.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPErrorsSectionsHandlerFunc turns a function with the right signature into a get HTTP errors sections handler -type GetHTTPErrorsSectionsHandlerFunc func(GetHTTPErrorsSectionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPErrorsSectionsHandlerFunc) Handle(params GetHTTPErrorsSectionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPErrorsSectionsHandler interface for that can handle valid get HTTP errors sections params -type GetHTTPErrorsSectionsHandler interface { - Handle(GetHTTPErrorsSectionsParams, interface{}) middleware.Responder -} - -// NewGetHTTPErrorsSections creates a new http.Handler for the get HTTP errors sections operation -func NewGetHTTPErrorsSections(ctx *middleware.Context, handler GetHTTPErrorsSectionsHandler) *GetHTTPErrorsSections { - return &GetHTTPErrorsSections{Context: ctx, Handler: handler} -} - -/* - GetHTTPErrorsSections swagger:route GET /services/haproxy/configuration/http_errors_sections HTTPErrors getHttpErrorsSections - -# Return an array of http-error sections - -Returns an array of all configured http-error sections. -*/ -type GetHTTPErrorsSections struct { - Context *middleware.Context - Handler GetHTTPErrorsSectionsHandler -} - -func (o *GetHTTPErrorsSections) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPErrorsSectionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_errors/get_http_errors_sections_parameters.go b/operations/http_errors/get_http_errors_sections_parameters.go deleted file mode 100644 index d765df8b..00000000 --- a/operations/http_errors/get_http_errors_sections_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetHTTPErrorsSectionsParams creates a new GetHTTPErrorsSectionsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPErrorsSectionsParams() GetHTTPErrorsSectionsParams { - - return GetHTTPErrorsSectionsParams{} -} - -// GetHTTPErrorsSectionsParams contains all the bound params for the get HTTP errors sections operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPErrorsSections -type GetHTTPErrorsSectionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPErrorsSectionsParams() beforehand. -func (o *GetHTTPErrorsSectionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPErrorsSectionsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_errors/get_http_errors_sections_responses.go b/operations/http_errors/get_http_errors_sections_responses.go deleted file mode 100644 index 43829ded..00000000 --- a/operations/http_errors/get_http_errors_sections_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPErrorsSectionsOKCode is the HTTP code returned for type GetHTTPErrorsSectionsOK -const GetHTTPErrorsSectionsOKCode int = 200 - -/* -GetHTTPErrorsSectionsOK Successful operation - -swagger:response getHttpErrorsSectionsOK -*/ -type GetHTTPErrorsSectionsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPErrorsSections `json:"body,omitempty"` -} - -// NewGetHTTPErrorsSectionsOK creates GetHTTPErrorsSectionsOK with default headers values -func NewGetHTTPErrorsSectionsOK() *GetHTTPErrorsSectionsOK { - - return &GetHTTPErrorsSectionsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http errors sections o k response -func (o *GetHTTPErrorsSectionsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorsSectionsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http errors sections o k response -func (o *GetHTTPErrorsSectionsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http errors sections o k response -func (o *GetHTTPErrorsSectionsOK) WithPayload(payload models.HTTPErrorsSections) *GetHTTPErrorsSectionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http errors sections o k response -func (o *GetHTTPErrorsSectionsOK) SetPayload(payload models.HTTPErrorsSections) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorsSectionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPErrorsSections{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetHTTPErrorsSectionsDefault General Error - -swagger:response getHttpErrorsSectionsDefault -*/ -type GetHTTPErrorsSectionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPErrorsSectionsDefault creates GetHTTPErrorsSectionsDefault with default headers values -func NewGetHTTPErrorsSectionsDefault(code int) *GetHTTPErrorsSectionsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPErrorsSectionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) WithStatusCode(code int) *GetHTTPErrorsSectionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPErrorsSectionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) WithPayload(payload *models.Error) *GetHTTPErrorsSectionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP errors sections default response -func (o *GetHTTPErrorsSectionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPErrorsSectionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_errors/get_http_errors_sections_urlbuilder.go b/operations/http_errors/get_http_errors_sections_urlbuilder.go deleted file mode 100644 index 28764ed7..00000000 --- a/operations/http_errors/get_http_errors_sections_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetHTTPErrorsSectionsURL generates an URL for the get HTTP errors sections operation -type GetHTTPErrorsSectionsURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorsSectionsURL) WithBasePath(bp string) *GetHTTPErrorsSectionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPErrorsSectionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPErrorsSectionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/http_errors_sections" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPErrorsSectionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPErrorsSectionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPErrorsSectionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPErrorsSectionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPErrorsSectionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPErrorsSectionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_errors/replace_http_errors_section.go b/operations/http_errors/replace_http_errors_section.go deleted file mode 100644 index 57cb2447..00000000 --- a/operations/http_errors/replace_http_errors_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPErrorsSectionHandlerFunc turns a function with the right signature into a replace HTTP errors section handler -type ReplaceHTTPErrorsSectionHandlerFunc func(ReplaceHTTPErrorsSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPErrorsSectionHandlerFunc) Handle(params ReplaceHTTPErrorsSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPErrorsSectionHandler interface for that can handle valid replace HTTP errors section params -type ReplaceHTTPErrorsSectionHandler interface { - Handle(ReplaceHTTPErrorsSectionParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPErrorsSection creates a new http.Handler for the replace HTTP errors section operation -func NewReplaceHTTPErrorsSection(ctx *middleware.Context, handler ReplaceHTTPErrorsSectionHandler) *ReplaceHTTPErrorsSection { - return &ReplaceHTTPErrorsSection{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPErrorsSection swagger:route PUT /services/haproxy/configuration/http_errors_sections/{name} HTTPErrors replaceHttpErrorsSection - -# Replace a http-error section - -Replaces a http-error section with a given name in the configuration. -*/ -type ReplaceHTTPErrorsSection struct { - Context *middleware.Context - Handler ReplaceHTTPErrorsSectionHandler -} - -func (o *ReplaceHTTPErrorsSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPErrorsSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_errors/replace_http_errors_section_parameters.go b/operations/http_errors/replace_http_errors_section_parameters.go deleted file mode 100644 index 79f65393..00000000 --- a/operations/http_errors/replace_http_errors_section_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPErrorsSectionParams creates a new ReplaceHTTPErrorsSectionParams object -// with the default values initialized. -func NewReplaceHTTPErrorsSectionParams() ReplaceHTTPErrorsSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPErrorsSectionParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPErrorsSectionParams contains all the bound params for the replace HTTP errors section operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPErrorsSection -type ReplaceHTTPErrorsSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPErrorsSection - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*http-error section name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPErrorsSectionParams() beforehand. -func (o *ReplaceHTTPErrorsSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPErrorsSection - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPErrorsSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPErrorsSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceHTTPErrorsSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPErrorsSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPErrorsSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_errors/replace_http_errors_section_responses.go b/operations/http_errors/replace_http_errors_section_responses.go deleted file mode 100644 index 3dc172ff..00000000 --- a/operations/http_errors/replace_http_errors_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPErrorsSectionOKCode is the HTTP code returned for type ReplaceHTTPErrorsSectionOK -const ReplaceHTTPErrorsSectionOKCode int = 200 - -/* -ReplaceHTTPErrorsSectionOK http-error section updated - -swagger:response replaceHttpErrorsSectionOK -*/ -type ReplaceHTTPErrorsSectionOK struct { - - /* - In: Body - */ - Payload *models.HTTPErrorsSection `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorsSectionOK creates ReplaceHTTPErrorsSectionOK with default headers values -func NewReplaceHTTPErrorsSectionOK() *ReplaceHTTPErrorsSectionOK { - - return &ReplaceHTTPErrorsSectionOK{} -} - -// WithPayload adds the payload to the replace Http errors section o k response -func (o *ReplaceHTTPErrorsSectionOK) WithPayload(payload *models.HTTPErrorsSection) *ReplaceHTTPErrorsSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http errors section o k response -func (o *ReplaceHTTPErrorsSectionOK) SetPayload(payload *models.HTTPErrorsSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorsSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorsSectionAcceptedCode is the HTTP code returned for type ReplaceHTTPErrorsSectionAccepted -const ReplaceHTTPErrorsSectionAcceptedCode int = 202 - -/* -ReplaceHTTPErrorsSectionAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpErrorsSectionAccepted -*/ -type ReplaceHTTPErrorsSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPErrorsSection `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorsSectionAccepted creates ReplaceHTTPErrorsSectionAccepted with default headers values -func NewReplaceHTTPErrorsSectionAccepted() *ReplaceHTTPErrorsSectionAccepted { - - return &ReplaceHTTPErrorsSectionAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http errors section accepted response -func (o *ReplaceHTTPErrorsSectionAccepted) WithReloadID(reloadID string) *ReplaceHTTPErrorsSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http errors section accepted response -func (o *ReplaceHTTPErrorsSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http errors section accepted response -func (o *ReplaceHTTPErrorsSectionAccepted) WithPayload(payload *models.HTTPErrorsSection) *ReplaceHTTPErrorsSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http errors section accepted response -func (o *ReplaceHTTPErrorsSectionAccepted) SetPayload(payload *models.HTTPErrorsSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorsSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorsSectionBadRequestCode is the HTTP code returned for type ReplaceHTTPErrorsSectionBadRequest -const ReplaceHTTPErrorsSectionBadRequestCode int = 400 - -/* -ReplaceHTTPErrorsSectionBadRequest Bad request - -swagger:response replaceHttpErrorsSectionBadRequest -*/ -type ReplaceHTTPErrorsSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorsSectionBadRequest creates ReplaceHTTPErrorsSectionBadRequest with default headers values -func NewReplaceHTTPErrorsSectionBadRequest() *ReplaceHTTPErrorsSectionBadRequest { - - return &ReplaceHTTPErrorsSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http errors section bad request response -func (o *ReplaceHTTPErrorsSectionBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorsSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http errors section bad request response -func (o *ReplaceHTTPErrorsSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http errors section bad request response -func (o *ReplaceHTTPErrorsSectionBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPErrorsSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http errors section bad request response -func (o *ReplaceHTTPErrorsSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorsSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPErrorsSectionNotFoundCode is the HTTP code returned for type ReplaceHTTPErrorsSectionNotFound -const ReplaceHTTPErrorsSectionNotFoundCode int = 404 - -/* -ReplaceHTTPErrorsSectionNotFound The specified resource was not found - -swagger:response replaceHttpErrorsSectionNotFound -*/ -type ReplaceHTTPErrorsSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorsSectionNotFound creates ReplaceHTTPErrorsSectionNotFound with default headers values -func NewReplaceHTTPErrorsSectionNotFound() *ReplaceHTTPErrorsSectionNotFound { - - return &ReplaceHTTPErrorsSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http errors section not found response -func (o *ReplaceHTTPErrorsSectionNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorsSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http errors section not found response -func (o *ReplaceHTTPErrorsSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http errors section not found response -func (o *ReplaceHTTPErrorsSectionNotFound) WithPayload(payload *models.Error) *ReplaceHTTPErrorsSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http errors section not found response -func (o *ReplaceHTTPErrorsSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorsSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPErrorsSectionDefault General Error - -swagger:response replaceHttpErrorsSectionDefault -*/ -type ReplaceHTTPErrorsSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPErrorsSectionDefault creates ReplaceHTTPErrorsSectionDefault with default headers values -func NewReplaceHTTPErrorsSectionDefault(code int) *ReplaceHTTPErrorsSectionDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPErrorsSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) WithStatusCode(code int) *ReplaceHTTPErrorsSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPErrorsSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) WithPayload(payload *models.Error) *ReplaceHTTPErrorsSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP errors section default response -func (o *ReplaceHTTPErrorsSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPErrorsSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_errors/replace_http_errors_section_urlbuilder.go b/operations/http_errors/replace_http_errors_section_urlbuilder.go deleted file mode 100644 index 2ad5b195..00000000 --- a/operations/http_errors/replace_http_errors_section_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_errors - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPErrorsSectionURL generates an URL for the replace HTTP errors section operation -type ReplaceHTTPErrorsSectionURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorsSectionURL) WithBasePath(bp string) *ReplaceHTTPErrorsSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPErrorsSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPErrorsSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/http_errors_sections/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceHTTPErrorsSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPErrorsSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPErrorsSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPErrorsSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPErrorsSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPErrorsSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPErrorsSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/create_http_request_rule_backend.go b/operations/http_request_rule/create_http_request_rule_backend.go deleted file mode 100644 index 7c8b0e5a..00000000 --- a/operations/http_request_rule/create_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a create HTTP request rule backend handler -type CreateHTTPRequestRuleBackendHandlerFunc func(CreateHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPRequestRuleBackendHandlerFunc) Handle(params CreateHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPRequestRuleBackendHandler interface for that can handle valid create HTTP request rule backend params -type CreateHTTPRequestRuleBackendHandler interface { - Handle(CreateHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPRequestRuleBackend creates a new http.Handler for the create HTTP request rule backend operation -func NewCreateHTTPRequestRuleBackend(ctx *middleware.Context, handler CreateHTTPRequestRuleBackendHandler) *CreateHTTPRequestRuleBackend { - return &CreateHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPRequestRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index} HTTPRequestRule createHttpRequestRuleBackend - -# Add a new HTTP Request Rule - -Adds a new HTTP Request Rule of the specified type in the specified parent. -*/ -type CreateHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler CreateHTTPRequestRuleBackendHandler -} - -func (o *CreateHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/create_http_request_rule_backend_parameters.go b/operations/http_request_rule/create_http_request_rule_backend_parameters.go deleted file mode 100644 index 41a9c904..00000000 --- a/operations/http_request_rule/create_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPRequestRuleBackendParams creates a new CreateHTTPRequestRuleBackendParams object -// with the default values initialized. -func NewCreateHTTPRequestRuleBackendParams() CreateHTTPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPRequestRuleBackendParams contains all the bound params for the create HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPRequestRuleBackend -type CreateHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPRequestRuleBackendParams() beforehand. -func (o *CreateHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/create_http_request_rule_backend_responses.go b/operations/http_request_rule/create_http_request_rule_backend_responses.go deleted file mode 100644 index b310d13c..00000000 --- a/operations/http_request_rule/create_http_request_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPRequestRuleBackendCreatedCode is the HTTP code returned for type CreateHTTPRequestRuleBackendCreated -const CreateHTTPRequestRuleBackendCreatedCode int = 201 - -/* -CreateHTTPRequestRuleBackendCreated HTTP Request Rule created - -swagger:response createHttpRequestRuleBackendCreated -*/ -type CreateHTTPRequestRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleBackendCreated creates CreateHTTPRequestRuleBackendCreated with default headers values -func NewCreateHTTPRequestRuleBackendCreated() *CreateHTTPRequestRuleBackendCreated { - - return &CreateHTTPRequestRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Http request rule backend created response -func (o *CreateHTTPRequestRuleBackendCreated) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule backend created response -func (o *CreateHTTPRequestRuleBackendCreated) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleBackendAcceptedCode is the HTTP code returned for type CreateHTTPRequestRuleBackendAccepted -const CreateHTTPRequestRuleBackendAcceptedCode int = 202 - -/* -CreateHTTPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createHttpRequestRuleBackendAccepted -*/ -type CreateHTTPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleBackendAccepted creates CreateHTTPRequestRuleBackendAccepted with default headers values -func NewCreateHTTPRequestRuleBackendAccepted() *CreateHTTPRequestRuleBackendAccepted { - - return &CreateHTTPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http request rule backend accepted response -func (o *CreateHTTPRequestRuleBackendAccepted) WithReloadID(reloadID string) *CreateHTTPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http request rule backend accepted response -func (o *CreateHTTPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http request rule backend accepted response -func (o *CreateHTTPRequestRuleBackendAccepted) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule backend accepted response -func (o *CreateHTTPRequestRuleBackendAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleBackendBadRequestCode is the HTTP code returned for type CreateHTTPRequestRuleBackendBadRequest -const CreateHTTPRequestRuleBackendBadRequestCode int = 400 - -/* -CreateHTTPRequestRuleBackendBadRequest Bad request - -swagger:response createHttpRequestRuleBackendBadRequest -*/ -type CreateHTTPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleBackendBadRequest creates CreateHTTPRequestRuleBackendBadRequest with default headers values -func NewCreateHTTPRequestRuleBackendBadRequest() *CreateHTTPRequestRuleBackendBadRequest { - - return &CreateHTTPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule backend bad request response -func (o *CreateHTTPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule backend bad request response -func (o *CreateHTTPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule backend bad request response -func (o *CreateHTTPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateHTTPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule backend bad request response -func (o *CreateHTTPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleBackendConflictCode is the HTTP code returned for type CreateHTTPRequestRuleBackendConflict -const CreateHTTPRequestRuleBackendConflictCode int = 409 - -/* -CreateHTTPRequestRuleBackendConflict The specified resource already exists - -swagger:response createHttpRequestRuleBackendConflict -*/ -type CreateHTTPRequestRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleBackendConflict creates CreateHTTPRequestRuleBackendConflict with default headers values -func NewCreateHTTPRequestRuleBackendConflict() *CreateHTTPRequestRuleBackendConflict { - - return &CreateHTTPRequestRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule backend conflict response -func (o *CreateHTTPRequestRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule backend conflict response -func (o *CreateHTTPRequestRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule backend conflict response -func (o *CreateHTTPRequestRuleBackendConflict) WithPayload(payload *models.Error) *CreateHTTPRequestRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule backend conflict response -func (o *CreateHTTPRequestRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPRequestRuleBackendDefault General Error - -swagger:response createHttpRequestRuleBackendDefault -*/ -type CreateHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleBackendDefault creates CreateHTTPRequestRuleBackendDefault with default headers values -func NewCreateHTTPRequestRuleBackendDefault(code int) *CreateHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) WithStatusCode(code int) *CreateHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *CreateHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP request rule backend default response -func (o *CreateHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/create_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/create_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index c5b99edb..00000000 --- a/operations/http_request_rule/create_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPRequestRuleBackendURL generates an URL for the create HTTP request rule backend operation -type CreateHTTPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleBackendURL) WithBasePath(bp string) *CreateHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/create_http_request_rule_defaults.go b/operations/http_request_rule/create_http_request_rule_defaults.go deleted file mode 100644 index 179b3ede..00000000 --- a/operations/http_request_rule/create_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a create HTTP request rule defaults handler -type CreateHTTPRequestRuleDefaultsHandlerFunc func(CreateHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPRequestRuleDefaultsHandlerFunc) Handle(params CreateHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPRequestRuleDefaultsHandler interface for that can handle valid create HTTP request rule defaults params -type CreateHTTPRequestRuleDefaultsHandler interface { - Handle(CreateHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateHTTPRequestRuleDefaults creates a new http.Handler for the create HTTP request rule defaults operation -func NewCreateHTTPRequestRuleDefaults(ctx *middleware.Context, handler CreateHTTPRequestRuleDefaultsHandler) *CreateHTTPRequestRuleDefaults { - return &CreateHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateHTTPRequestRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index} HTTPRequestRule createHttpRequestRuleDefaults - -# Add a new HTTP Request Rule - -Adds a new HTTP Request Rule of the specified type in the specified parent. -*/ -type CreateHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler CreateHTTPRequestRuleDefaultsHandler -} - -func (o *CreateHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/create_http_request_rule_defaults_parameters.go b/operations/http_request_rule/create_http_request_rule_defaults_parameters.go deleted file mode 100644 index b11f6ee6..00000000 --- a/operations/http_request_rule/create_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPRequestRuleDefaultsParams creates a new CreateHTTPRequestRuleDefaultsParams object -// with the default values initialized. -func NewCreateHTTPRequestRuleDefaultsParams() CreateHTTPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPRequestRuleDefaultsParams contains all the bound params for the create HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPRequestRuleDefaults -type CreateHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPRequestRuleDefaultsParams() beforehand. -func (o *CreateHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/create_http_request_rule_defaults_responses.go b/operations/http_request_rule/create_http_request_rule_defaults_responses.go deleted file mode 100644 index f919fb00..00000000 --- a/operations/http_request_rule/create_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPRequestRuleDefaultsCreatedCode is the HTTP code returned for type CreateHTTPRequestRuleDefaultsCreated -const CreateHTTPRequestRuleDefaultsCreatedCode int = 201 - -/* -CreateHTTPRequestRuleDefaultsCreated HTTP Request Rule created - -swagger:response createHttpRequestRuleDefaultsCreated -*/ -type CreateHTTPRequestRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleDefaultsCreated creates CreateHTTPRequestRuleDefaultsCreated with default headers values -func NewCreateHTTPRequestRuleDefaultsCreated() *CreateHTTPRequestRuleDefaultsCreated { - - return &CreateHTTPRequestRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Http request rule defaults created response -func (o *CreateHTTPRequestRuleDefaultsCreated) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule defaults created response -func (o *CreateHTTPRequestRuleDefaultsCreated) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type CreateHTTPRequestRuleDefaultsAccepted -const CreateHTTPRequestRuleDefaultsAcceptedCode int = 202 - -/* -CreateHTTPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createHttpRequestRuleDefaultsAccepted -*/ -type CreateHTTPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleDefaultsAccepted creates CreateHTTPRequestRuleDefaultsAccepted with default headers values -func NewCreateHTTPRequestRuleDefaultsAccepted() *CreateHTTPRequestRuleDefaultsAccepted { - - return &CreateHTTPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Http request rule defaults accepted response -func (o *CreateHTTPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateHTTPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http request rule defaults accepted response -func (o *CreateHTTPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http request rule defaults accepted response -func (o *CreateHTTPRequestRuleDefaultsAccepted) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule defaults accepted response -func (o *CreateHTTPRequestRuleDefaultsAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type CreateHTTPRequestRuleDefaultsBadRequest -const CreateHTTPRequestRuleDefaultsBadRequestCode int = 400 - -/* -CreateHTTPRequestRuleDefaultsBadRequest Bad request - -swagger:response createHttpRequestRuleDefaultsBadRequest -*/ -type CreateHTTPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleDefaultsBadRequest creates CreateHTTPRequestRuleDefaultsBadRequest with default headers values -func NewCreateHTTPRequestRuleDefaultsBadRequest() *CreateHTTPRequestRuleDefaultsBadRequest { - - return &CreateHTTPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule defaults bad request response -func (o *CreateHTTPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule defaults bad request response -func (o *CreateHTTPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule defaults bad request response -func (o *CreateHTTPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateHTTPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule defaults bad request response -func (o *CreateHTTPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleDefaultsConflictCode is the HTTP code returned for type CreateHTTPRequestRuleDefaultsConflict -const CreateHTTPRequestRuleDefaultsConflictCode int = 409 - -/* -CreateHTTPRequestRuleDefaultsConflict The specified resource already exists - -swagger:response createHttpRequestRuleDefaultsConflict -*/ -type CreateHTTPRequestRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleDefaultsConflict creates CreateHTTPRequestRuleDefaultsConflict with default headers values -func NewCreateHTTPRequestRuleDefaultsConflict() *CreateHTTPRequestRuleDefaultsConflict { - - return &CreateHTTPRequestRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule defaults conflict response -func (o *CreateHTTPRequestRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule defaults conflict response -func (o *CreateHTTPRequestRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule defaults conflict response -func (o *CreateHTTPRequestRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateHTTPRequestRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule defaults conflict response -func (o *CreateHTTPRequestRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPRequestRuleDefaultsDefault General Error - -swagger:response createHttpRequestRuleDefaultsDefault -*/ -type CreateHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleDefaultsDefault creates CreateHTTPRequestRuleDefaultsDefault with default headers values -func NewCreateHTTPRequestRuleDefaultsDefault(code int) *CreateHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *CreateHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP request rule defaults default response -func (o *CreateHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/create_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/create_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 388a18b9..00000000 --- a/operations/http_request_rule/create_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPRequestRuleDefaultsURL generates an URL for the create HTTP request rule defaults operation -type CreateHTTPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *CreateHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/create_http_request_rule_frontend.go b/operations/http_request_rule/create_http_request_rule_frontend.go deleted file mode 100644 index 17621119..00000000 --- a/operations/http_request_rule/create_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a create HTTP request rule frontend handler -type CreateHTTPRequestRuleFrontendHandlerFunc func(CreateHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPRequestRuleFrontendHandlerFunc) Handle(params CreateHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPRequestRuleFrontendHandler interface for that can handle valid create HTTP request rule frontend params -type CreateHTTPRequestRuleFrontendHandler interface { - Handle(CreateHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPRequestRuleFrontend creates a new http.Handler for the create HTTP request rule frontend operation -func NewCreateHTTPRequestRuleFrontend(ctx *middleware.Context, handler CreateHTTPRequestRuleFrontendHandler) *CreateHTTPRequestRuleFrontend { - return &CreateHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPRequestRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index} HTTPRequestRule createHttpRequestRuleFrontend - -# Add a new HTTP Request Rule - -Adds a new HTTP Request Rule of the specified type in the specified parent. -*/ -type CreateHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler CreateHTTPRequestRuleFrontendHandler -} - -func (o *CreateHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/create_http_request_rule_frontend_parameters.go b/operations/http_request_rule/create_http_request_rule_frontend_parameters.go deleted file mode 100644 index f14c1300..00000000 --- a/operations/http_request_rule/create_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPRequestRuleFrontendParams creates a new CreateHTTPRequestRuleFrontendParams object -// with the default values initialized. -func NewCreateHTTPRequestRuleFrontendParams() CreateHTTPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPRequestRuleFrontendParams contains all the bound params for the create HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPRequestRuleFrontend -type CreateHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPRequestRuleFrontendParams() beforehand. -func (o *CreateHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/create_http_request_rule_frontend_responses.go b/operations/http_request_rule/create_http_request_rule_frontend_responses.go deleted file mode 100644 index b8cbb16a..00000000 --- a/operations/http_request_rule/create_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPRequestRuleFrontendCreatedCode is the HTTP code returned for type CreateHTTPRequestRuleFrontendCreated -const CreateHTTPRequestRuleFrontendCreatedCode int = 201 - -/* -CreateHTTPRequestRuleFrontendCreated HTTP Request Rule created - -swagger:response createHttpRequestRuleFrontendCreated -*/ -type CreateHTTPRequestRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleFrontendCreated creates CreateHTTPRequestRuleFrontendCreated with default headers values -func NewCreateHTTPRequestRuleFrontendCreated() *CreateHTTPRequestRuleFrontendCreated { - - return &CreateHTTPRequestRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Http request rule frontend created response -func (o *CreateHTTPRequestRuleFrontendCreated) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule frontend created response -func (o *CreateHTTPRequestRuleFrontendCreated) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleFrontendAcceptedCode is the HTTP code returned for type CreateHTTPRequestRuleFrontendAccepted -const CreateHTTPRequestRuleFrontendAcceptedCode int = 202 - -/* -CreateHTTPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createHttpRequestRuleFrontendAccepted -*/ -type CreateHTTPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleFrontendAccepted creates CreateHTTPRequestRuleFrontendAccepted with default headers values -func NewCreateHTTPRequestRuleFrontendAccepted() *CreateHTTPRequestRuleFrontendAccepted { - - return &CreateHTTPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http request rule frontend accepted response -func (o *CreateHTTPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *CreateHTTPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http request rule frontend accepted response -func (o *CreateHTTPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http request rule frontend accepted response -func (o *CreateHTTPRequestRuleFrontendAccepted) WithPayload(payload *models.HTTPRequestRule) *CreateHTTPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule frontend accepted response -func (o *CreateHTTPRequestRuleFrontendAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleFrontendBadRequestCode is the HTTP code returned for type CreateHTTPRequestRuleFrontendBadRequest -const CreateHTTPRequestRuleFrontendBadRequestCode int = 400 - -/* -CreateHTTPRequestRuleFrontendBadRequest Bad request - -swagger:response createHttpRequestRuleFrontendBadRequest -*/ -type CreateHTTPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleFrontendBadRequest creates CreateHTTPRequestRuleFrontendBadRequest with default headers values -func NewCreateHTTPRequestRuleFrontendBadRequest() *CreateHTTPRequestRuleFrontendBadRequest { - - return &CreateHTTPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule frontend bad request response -func (o *CreateHTTPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule frontend bad request response -func (o *CreateHTTPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule frontend bad request response -func (o *CreateHTTPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateHTTPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule frontend bad request response -func (o *CreateHTTPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPRequestRuleFrontendConflictCode is the HTTP code returned for type CreateHTTPRequestRuleFrontendConflict -const CreateHTTPRequestRuleFrontendConflictCode int = 409 - -/* -CreateHTTPRequestRuleFrontendConflict The specified resource already exists - -swagger:response createHttpRequestRuleFrontendConflict -*/ -type CreateHTTPRequestRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleFrontendConflict creates CreateHTTPRequestRuleFrontendConflict with default headers values -func NewCreateHTTPRequestRuleFrontendConflict() *CreateHTTPRequestRuleFrontendConflict { - - return &CreateHTTPRequestRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http request rule frontend conflict response -func (o *CreateHTTPRequestRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http request rule frontend conflict response -func (o *CreateHTTPRequestRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http request rule frontend conflict response -func (o *CreateHTTPRequestRuleFrontendConflict) WithPayload(payload *models.Error) *CreateHTTPRequestRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http request rule frontend conflict response -func (o *CreateHTTPRequestRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPRequestRuleFrontendDefault General Error - -swagger:response createHttpRequestRuleFrontendDefault -*/ -type CreateHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPRequestRuleFrontendDefault creates CreateHTTPRequestRuleFrontendDefault with default headers values -func NewCreateHTTPRequestRuleFrontendDefault(code int) *CreateHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *CreateHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *CreateHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP request rule frontend default response -func (o *CreateHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/create_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/create_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index ca46cf46..00000000 --- a/operations/http_request_rule/create_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPRequestRuleFrontendURL generates an URL for the create HTTP request rule frontend operation -type CreateHTTPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleFrontendURL) WithBasePath(bp string) *CreateHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/delete_http_request_rule_backend.go b/operations/http_request_rule/delete_http_request_rule_backend.go deleted file mode 100644 index d97b4040..00000000 --- a/operations/http_request_rule/delete_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a delete HTTP request rule backend handler -type DeleteHTTPRequestRuleBackendHandlerFunc func(DeleteHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPRequestRuleBackendHandlerFunc) Handle(params DeleteHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPRequestRuleBackendHandler interface for that can handle valid delete HTTP request rule backend params -type DeleteHTTPRequestRuleBackendHandler interface { - Handle(DeleteHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPRequestRuleBackend creates a new http.Handler for the delete HTTP request rule backend operation -func NewDeleteHTTPRequestRuleBackend(ctx *middleware.Context, handler DeleteHTTPRequestRuleBackendHandler) *DeleteHTTPRequestRuleBackend { - return &DeleteHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPRequestRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index} HTTPRequestRule deleteHttpRequestRuleBackend - -# Delete a HTTP Request Rule - -Deletes a HTTP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler DeleteHTTPRequestRuleBackendHandler -} - -func (o *DeleteHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/delete_http_request_rule_backend_parameters.go b/operations/http_request_rule/delete_http_request_rule_backend_parameters.go deleted file mode 100644 index 11d009ad..00000000 --- a/operations/http_request_rule/delete_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPRequestRuleBackendParams creates a new DeleteHTTPRequestRuleBackendParams object -// with the default values initialized. -func NewDeleteHTTPRequestRuleBackendParams() DeleteHTTPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPRequestRuleBackendParams contains all the bound params for the delete HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPRequestRuleBackend -type DeleteHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPRequestRuleBackendParams() beforehand. -func (o *DeleteHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/delete_http_request_rule_backend_responses.go b/operations/http_request_rule/delete_http_request_rule_backend_responses.go deleted file mode 100644 index 536f1414..00000000 --- a/operations/http_request_rule/delete_http_request_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPRequestRuleBackendAcceptedCode is the HTTP code returned for type DeleteHTTPRequestRuleBackendAccepted -const DeleteHTTPRequestRuleBackendAcceptedCode int = 202 - -/* -DeleteHTTPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpRequestRuleBackendAccepted -*/ -type DeleteHTTPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPRequestRuleBackendAccepted creates DeleteHTTPRequestRuleBackendAccepted with default headers values -func NewDeleteHTTPRequestRuleBackendAccepted() *DeleteHTTPRequestRuleBackendAccepted { - - return &DeleteHTTPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http request rule backend accepted response -func (o *DeleteHTTPRequestRuleBackendAccepted) WithReloadID(reloadID string) *DeleteHTTPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http request rule backend accepted response -func (o *DeleteHTTPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPRequestRuleBackendNoContentCode is the HTTP code returned for type DeleteHTTPRequestRuleBackendNoContent -const DeleteHTTPRequestRuleBackendNoContentCode int = 204 - -/* -DeleteHTTPRequestRuleBackendNoContent HTTP Request Rule deleted - -swagger:response deleteHttpRequestRuleBackendNoContent -*/ -type DeleteHTTPRequestRuleBackendNoContent struct { -} - -// NewDeleteHTTPRequestRuleBackendNoContent creates DeleteHTTPRequestRuleBackendNoContent with default headers values -func NewDeleteHTTPRequestRuleBackendNoContent() *DeleteHTTPRequestRuleBackendNoContent { - - return &DeleteHTTPRequestRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPRequestRuleBackendNotFoundCode is the HTTP code returned for type DeleteHTTPRequestRuleBackendNotFound -const DeleteHTTPRequestRuleBackendNotFoundCode int = 404 - -/* -DeleteHTTPRequestRuleBackendNotFound The specified resource was not found - -swagger:response deleteHttpRequestRuleBackendNotFound -*/ -type DeleteHTTPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleBackendNotFound creates DeleteHTTPRequestRuleBackendNotFound with default headers values -func NewDeleteHTTPRequestRuleBackendNotFound() *DeleteHTTPRequestRuleBackendNotFound { - - return &DeleteHTTPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http request rule backend not found response -func (o *DeleteHTTPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http request rule backend not found response -func (o *DeleteHTTPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http request rule backend not found response -func (o *DeleteHTTPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http request rule backend not found response -func (o *DeleteHTTPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPRequestRuleBackendDefault General Error - -swagger:response deleteHttpRequestRuleBackendDefault -*/ -type DeleteHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleBackendDefault creates DeleteHTTPRequestRuleBackendDefault with default headers values -func NewDeleteHTTPRequestRuleBackendDefault(code int) *DeleteHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) WithStatusCode(code int) *DeleteHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP request rule backend default response -func (o *DeleteHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/delete_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/delete_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index 8731fc7e..00000000 --- a/operations/http_request_rule/delete_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPRequestRuleBackendURL generates an URL for the delete HTTP request rule backend operation -type DeleteHTTPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleBackendURL) WithBasePath(bp string) *DeleteHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/delete_http_request_rule_defaults.go b/operations/http_request_rule/delete_http_request_rule_defaults.go deleted file mode 100644 index 316095e4..00000000 --- a/operations/http_request_rule/delete_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a delete HTTP request rule defaults handler -type DeleteHTTPRequestRuleDefaultsHandlerFunc func(DeleteHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPRequestRuleDefaultsHandlerFunc) Handle(params DeleteHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPRequestRuleDefaultsHandler interface for that can handle valid delete HTTP request rule defaults params -type DeleteHTTPRequestRuleDefaultsHandler interface { - Handle(DeleteHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPRequestRuleDefaults creates a new http.Handler for the delete HTTP request rule defaults operation -func NewDeleteHTTPRequestRuleDefaults(ctx *middleware.Context, handler DeleteHTTPRequestRuleDefaultsHandler) *DeleteHTTPRequestRuleDefaults { - return &DeleteHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPRequestRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index} HTTPRequestRule deleteHttpRequestRuleDefaults - -# Delete a HTTP Request Rule - -Deletes a HTTP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler DeleteHTTPRequestRuleDefaultsHandler -} - -func (o *DeleteHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/delete_http_request_rule_defaults_parameters.go b/operations/http_request_rule/delete_http_request_rule_defaults_parameters.go deleted file mode 100644 index d4371873..00000000 --- a/operations/http_request_rule/delete_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPRequestRuleDefaultsParams creates a new DeleteHTTPRequestRuleDefaultsParams object -// with the default values initialized. -func NewDeleteHTTPRequestRuleDefaultsParams() DeleteHTTPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPRequestRuleDefaultsParams contains all the bound params for the delete HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPRequestRuleDefaults -type DeleteHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPRequestRuleDefaultsParams() beforehand. -func (o *DeleteHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/delete_http_request_rule_defaults_responses.go b/operations/http_request_rule/delete_http_request_rule_defaults_responses.go deleted file mode 100644 index 7c692799..00000000 --- a/operations/http_request_rule/delete_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteHTTPRequestRuleDefaultsAccepted -const DeleteHTTPRequestRuleDefaultsAcceptedCode int = 202 - -/* -DeleteHTTPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpRequestRuleDefaultsAccepted -*/ -type DeleteHTTPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPRequestRuleDefaultsAccepted creates DeleteHTTPRequestRuleDefaultsAccepted with default headers values -func NewDeleteHTTPRequestRuleDefaultsAccepted() *DeleteHTTPRequestRuleDefaultsAccepted { - - return &DeleteHTTPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http request rule defaults accepted response -func (o *DeleteHTTPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteHTTPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http request rule defaults accepted response -func (o *DeleteHTTPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPRequestRuleDefaultsNoContentCode is the HTTP code returned for type DeleteHTTPRequestRuleDefaultsNoContent -const DeleteHTTPRequestRuleDefaultsNoContentCode int = 204 - -/* -DeleteHTTPRequestRuleDefaultsNoContent HTTP Request Rule deleted - -swagger:response deleteHttpRequestRuleDefaultsNoContent -*/ -type DeleteHTTPRequestRuleDefaultsNoContent struct { -} - -// NewDeleteHTTPRequestRuleDefaultsNoContent creates DeleteHTTPRequestRuleDefaultsNoContent with default headers values -func NewDeleteHTTPRequestRuleDefaultsNoContent() *DeleteHTTPRequestRuleDefaultsNoContent { - - return &DeleteHTTPRequestRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteHTTPRequestRuleDefaultsNotFound -const DeleteHTTPRequestRuleDefaultsNotFoundCode int = 404 - -/* -DeleteHTTPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteHttpRequestRuleDefaultsNotFound -*/ -type DeleteHTTPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleDefaultsNotFound creates DeleteHTTPRequestRuleDefaultsNotFound with default headers values -func NewDeleteHTTPRequestRuleDefaultsNotFound() *DeleteHTTPRequestRuleDefaultsNotFound { - - return &DeleteHTTPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http request rule defaults not found response -func (o *DeleteHTTPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http request rule defaults not found response -func (o *DeleteHTTPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http request rule defaults not found response -func (o *DeleteHTTPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http request rule defaults not found response -func (o *DeleteHTTPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPRequestRuleDefaultsDefault General Error - -swagger:response deleteHttpRequestRuleDefaultsDefault -*/ -type DeleteHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleDefaultsDefault creates DeleteHTTPRequestRuleDefaultsDefault with default headers values -func NewDeleteHTTPRequestRuleDefaultsDefault(code int) *DeleteHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *DeleteHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP request rule defaults default response -func (o *DeleteHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/delete_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/delete_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 5baa2b88..00000000 --- a/operations/http_request_rule/delete_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPRequestRuleDefaultsURL generates an URL for the delete HTTP request rule defaults operation -type DeleteHTTPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *DeleteHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/delete_http_request_rule_frontend.go b/operations/http_request_rule/delete_http_request_rule_frontend.go deleted file mode 100644 index 0dab4b79..00000000 --- a/operations/http_request_rule/delete_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a delete HTTP request rule frontend handler -type DeleteHTTPRequestRuleFrontendHandlerFunc func(DeleteHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPRequestRuleFrontendHandlerFunc) Handle(params DeleteHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPRequestRuleFrontendHandler interface for that can handle valid delete HTTP request rule frontend params -type DeleteHTTPRequestRuleFrontendHandler interface { - Handle(DeleteHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPRequestRuleFrontend creates a new http.Handler for the delete HTTP request rule frontend operation -func NewDeleteHTTPRequestRuleFrontend(ctx *middleware.Context, handler DeleteHTTPRequestRuleFrontendHandler) *DeleteHTTPRequestRuleFrontend { - return &DeleteHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPRequestRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index} HTTPRequestRule deleteHttpRequestRuleFrontend - -# Delete a HTTP Request Rule - -Deletes a HTTP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler DeleteHTTPRequestRuleFrontendHandler -} - -func (o *DeleteHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/delete_http_request_rule_frontend_parameters.go b/operations/http_request_rule/delete_http_request_rule_frontend_parameters.go deleted file mode 100644 index d020eb92..00000000 --- a/operations/http_request_rule/delete_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPRequestRuleFrontendParams creates a new DeleteHTTPRequestRuleFrontendParams object -// with the default values initialized. -func NewDeleteHTTPRequestRuleFrontendParams() DeleteHTTPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPRequestRuleFrontendParams contains all the bound params for the delete HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPRequestRuleFrontend -type DeleteHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPRequestRuleFrontendParams() beforehand. -func (o *DeleteHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/delete_http_request_rule_frontend_responses.go b/operations/http_request_rule/delete_http_request_rule_frontend_responses.go deleted file mode 100644 index f3ad7fe0..00000000 --- a/operations/http_request_rule/delete_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPRequestRuleFrontendAcceptedCode is the HTTP code returned for type DeleteHTTPRequestRuleFrontendAccepted -const DeleteHTTPRequestRuleFrontendAcceptedCode int = 202 - -/* -DeleteHTTPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpRequestRuleFrontendAccepted -*/ -type DeleteHTTPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPRequestRuleFrontendAccepted creates DeleteHTTPRequestRuleFrontendAccepted with default headers values -func NewDeleteHTTPRequestRuleFrontendAccepted() *DeleteHTTPRequestRuleFrontendAccepted { - - return &DeleteHTTPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http request rule frontend accepted response -func (o *DeleteHTTPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteHTTPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http request rule frontend accepted response -func (o *DeleteHTTPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPRequestRuleFrontendNoContentCode is the HTTP code returned for type DeleteHTTPRequestRuleFrontendNoContent -const DeleteHTTPRequestRuleFrontendNoContentCode int = 204 - -/* -DeleteHTTPRequestRuleFrontendNoContent HTTP Request Rule deleted - -swagger:response deleteHttpRequestRuleFrontendNoContent -*/ -type DeleteHTTPRequestRuleFrontendNoContent struct { -} - -// NewDeleteHTTPRequestRuleFrontendNoContent creates DeleteHTTPRequestRuleFrontendNoContent with default headers values -func NewDeleteHTTPRequestRuleFrontendNoContent() *DeleteHTTPRequestRuleFrontendNoContent { - - return &DeleteHTTPRequestRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPRequestRuleFrontendNotFoundCode is the HTTP code returned for type DeleteHTTPRequestRuleFrontendNotFound -const DeleteHTTPRequestRuleFrontendNotFoundCode int = 404 - -/* -DeleteHTTPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response deleteHttpRequestRuleFrontendNotFound -*/ -type DeleteHTTPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleFrontendNotFound creates DeleteHTTPRequestRuleFrontendNotFound with default headers values -func NewDeleteHTTPRequestRuleFrontendNotFound() *DeleteHTTPRequestRuleFrontendNotFound { - - return &DeleteHTTPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http request rule frontend not found response -func (o *DeleteHTTPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http request rule frontend not found response -func (o *DeleteHTTPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http request rule frontend not found response -func (o *DeleteHTTPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http request rule frontend not found response -func (o *DeleteHTTPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPRequestRuleFrontendDefault General Error - -swagger:response deleteHttpRequestRuleFrontendDefault -*/ -type DeleteHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPRequestRuleFrontendDefault creates DeleteHTTPRequestRuleFrontendDefault with default headers values -func NewDeleteHTTPRequestRuleFrontendDefault(code int) *DeleteHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *DeleteHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP request rule frontend default response -func (o *DeleteHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/delete_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/delete_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 88963fe3..00000000 --- a/operations/http_request_rule/delete_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPRequestRuleFrontendURL generates an URL for the delete HTTP request rule frontend operation -type DeleteHTTPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleFrontendURL) WithBasePath(bp string) *DeleteHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_all_http_request_rule_backend.go b/operations/http_request_rule/get_all_http_request_rule_backend.go deleted file mode 100644 index 52d72b33..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a get all HTTP request rule backend handler -type GetAllHTTPRequestRuleBackendHandlerFunc func(GetAllHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPRequestRuleBackendHandlerFunc) Handle(params GetAllHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPRequestRuleBackendHandler interface for that can handle valid get all HTTP request rule backend params -type GetAllHTTPRequestRuleBackendHandler interface { - Handle(GetAllHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPRequestRuleBackend creates a new http.Handler for the get all HTTP request rule backend operation -func NewGetAllHTTPRequestRuleBackend(ctx *middleware.Context, handler GetAllHTTPRequestRuleBackendHandler) *GetAllHTTPRequestRuleBackend { - return &GetAllHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPRequestRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules HTTPRequestRule getAllHttpRequestRuleBackend - -# Return an array of all HTTP Request Rules - -Returns all HTTP Request Rules that are configured in specified parent. -*/ -type GetAllHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler GetAllHTTPRequestRuleBackendHandler -} - -func (o *GetAllHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_all_http_request_rule_backend_parameters.go b/operations/http_request_rule/get_all_http_request_rule_backend_parameters.go deleted file mode 100644 index 79dd9c24..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPRequestRuleBackendParams creates a new GetAllHTTPRequestRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPRequestRuleBackendParams() GetAllHTTPRequestRuleBackendParams { - - return GetAllHTTPRequestRuleBackendParams{} -} - -// GetAllHTTPRequestRuleBackendParams contains all the bound params for the get all HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPRequestRuleBackend -type GetAllHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPRequestRuleBackendParams() beforehand. -func (o *GetAllHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_all_http_request_rule_backend_responses.go b/operations/http_request_rule/get_all_http_request_rule_backend_responses.go deleted file mode 100644 index 355485c4..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPRequestRuleBackendOKCode is the HTTP code returned for type GetAllHTTPRequestRuleBackendOK -const GetAllHTTPRequestRuleBackendOKCode int = 200 - -/* -GetAllHTTPRequestRuleBackendOK Successful operation - -swagger:response getAllHttpRequestRuleBackendOK -*/ -type GetAllHTTPRequestRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleBackendOK creates GetAllHTTPRequestRuleBackendOK with default headers values -func NewGetAllHTTPRequestRuleBackendOK() *GetAllHTTPRequestRuleBackendOK { - - return &GetAllHTTPRequestRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http request rule backend o k response -func (o *GetAllHTTPRequestRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http request rule backend o k response -func (o *GetAllHTTPRequestRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http request rule backend o k response -func (o *GetAllHTTPRequestRuleBackendOK) WithPayload(payload models.HTTPRequestRules) *GetAllHTTPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http request rule backend o k response -func (o *GetAllHTTPRequestRuleBackendOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPRequestRuleBackendDefault General Error - -swagger:response getAllHttpRequestRuleBackendDefault -*/ -type GetAllHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleBackendDefault creates GetAllHTTPRequestRuleBackendDefault with default headers values -func NewGetAllHTTPRequestRuleBackendDefault(code int) *GetAllHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) WithStatusCode(code int) *GetAllHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *GetAllHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP request rule backend default response -func (o *GetAllHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_all_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/get_all_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index b8ecf015..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPRequestRuleBackendURL generates an URL for the get all HTTP request rule backend operation -type GetAllHTTPRequestRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleBackendURL) WithBasePath(bp string) *GetAllHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_all_http_request_rule_defaults.go b/operations/http_request_rule/get_all_http_request_rule_defaults.go deleted file mode 100644 index 5c2f5bdf..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a get all HTTP request rule defaults handler -type GetAllHTTPRequestRuleDefaultsHandlerFunc func(GetAllHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPRequestRuleDefaultsHandlerFunc) Handle(params GetAllHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPRequestRuleDefaultsHandler interface for that can handle valid get all HTTP request rule defaults params -type GetAllHTTPRequestRuleDefaultsHandler interface { - Handle(GetAllHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPRequestRuleDefaults creates a new http.Handler for the get all HTTP request rule defaults operation -func NewGetAllHTTPRequestRuleDefaults(ctx *middleware.Context, handler GetAllHTTPRequestRuleDefaultsHandler) *GetAllHTTPRequestRuleDefaults { - return &GetAllHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPRequestRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules HTTPRequestRule getAllHttpRequestRuleDefaults - -# Return an array of all HTTP Request Rules - -Returns all HTTP Request Rules that are configured in specified parent. -*/ -type GetAllHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler GetAllHTTPRequestRuleDefaultsHandler -} - -func (o *GetAllHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_all_http_request_rule_defaults_parameters.go b/operations/http_request_rule/get_all_http_request_rule_defaults_parameters.go deleted file mode 100644 index d44850d0..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPRequestRuleDefaultsParams creates a new GetAllHTTPRequestRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPRequestRuleDefaultsParams() GetAllHTTPRequestRuleDefaultsParams { - - return GetAllHTTPRequestRuleDefaultsParams{} -} - -// GetAllHTTPRequestRuleDefaultsParams contains all the bound params for the get all HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPRequestRuleDefaults -type GetAllHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPRequestRuleDefaultsParams() beforehand. -func (o *GetAllHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_all_http_request_rule_defaults_responses.go b/operations/http_request_rule/get_all_http_request_rule_defaults_responses.go deleted file mode 100644 index 2fe34239..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPRequestRuleDefaultsOKCode is the HTTP code returned for type GetAllHTTPRequestRuleDefaultsOK -const GetAllHTTPRequestRuleDefaultsOKCode int = 200 - -/* -GetAllHTTPRequestRuleDefaultsOK Successful operation - -swagger:response getAllHttpRequestRuleDefaultsOK -*/ -type GetAllHTTPRequestRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleDefaultsOK creates GetAllHTTPRequestRuleDefaultsOK with default headers values -func NewGetAllHTTPRequestRuleDefaultsOK() *GetAllHTTPRequestRuleDefaultsOK { - - return &GetAllHTTPRequestRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http request rule defaults o k response -func (o *GetAllHTTPRequestRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http request rule defaults o k response -func (o *GetAllHTTPRequestRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http request rule defaults o k response -func (o *GetAllHTTPRequestRuleDefaultsOK) WithPayload(payload models.HTTPRequestRules) *GetAllHTTPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http request rule defaults o k response -func (o *GetAllHTTPRequestRuleDefaultsOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPRequestRuleDefaultsDefault General Error - -swagger:response getAllHttpRequestRuleDefaultsDefault -*/ -type GetAllHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleDefaultsDefault creates GetAllHTTPRequestRuleDefaultsDefault with default headers values -func NewGetAllHTTPRequestRuleDefaultsDefault(code int) *GetAllHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *GetAllHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP request rule defaults default response -func (o *GetAllHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_all_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/get_all_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 8fa0db96..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPRequestRuleDefaultsURL generates an URL for the get all HTTP request rule defaults operation -type GetAllHTTPRequestRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *GetAllHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_all_http_request_rule_frontend.go b/operations/http_request_rule/get_all_http_request_rule_frontend.go deleted file mode 100644 index 88274661..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a get all HTTP request rule frontend handler -type GetAllHTTPRequestRuleFrontendHandlerFunc func(GetAllHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPRequestRuleFrontendHandlerFunc) Handle(params GetAllHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPRequestRuleFrontendHandler interface for that can handle valid get all HTTP request rule frontend params -type GetAllHTTPRequestRuleFrontendHandler interface { - Handle(GetAllHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPRequestRuleFrontend creates a new http.Handler for the get all HTTP request rule frontend operation -func NewGetAllHTTPRequestRuleFrontend(ctx *middleware.Context, handler GetAllHTTPRequestRuleFrontendHandler) *GetAllHTTPRequestRuleFrontend { - return &GetAllHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPRequestRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules HTTPRequestRule getAllHttpRequestRuleFrontend - -# Return an array of all HTTP Request Rules - -Returns all HTTP Request Rules that are configured in specified parent. -*/ -type GetAllHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler GetAllHTTPRequestRuleFrontendHandler -} - -func (o *GetAllHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_all_http_request_rule_frontend_parameters.go b/operations/http_request_rule/get_all_http_request_rule_frontend_parameters.go deleted file mode 100644 index 3d65849b..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPRequestRuleFrontendParams creates a new GetAllHTTPRequestRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPRequestRuleFrontendParams() GetAllHTTPRequestRuleFrontendParams { - - return GetAllHTTPRequestRuleFrontendParams{} -} - -// GetAllHTTPRequestRuleFrontendParams contains all the bound params for the get all HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPRequestRuleFrontend -type GetAllHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPRequestRuleFrontendParams() beforehand. -func (o *GetAllHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_all_http_request_rule_frontend_responses.go b/operations/http_request_rule/get_all_http_request_rule_frontend_responses.go deleted file mode 100644 index cb32fa71..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPRequestRuleFrontendOKCode is the HTTP code returned for type GetAllHTTPRequestRuleFrontendOK -const GetAllHTTPRequestRuleFrontendOKCode int = 200 - -/* -GetAllHTTPRequestRuleFrontendOK Successful operation - -swagger:response getAllHttpRequestRuleFrontendOK -*/ -type GetAllHTTPRequestRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleFrontendOK creates GetAllHTTPRequestRuleFrontendOK with default headers values -func NewGetAllHTTPRequestRuleFrontendOK() *GetAllHTTPRequestRuleFrontendOK { - - return &GetAllHTTPRequestRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http request rule frontend o k response -func (o *GetAllHTTPRequestRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http request rule frontend o k response -func (o *GetAllHTTPRequestRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http request rule frontend o k response -func (o *GetAllHTTPRequestRuleFrontendOK) WithPayload(payload models.HTTPRequestRules) *GetAllHTTPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http request rule frontend o k response -func (o *GetAllHTTPRequestRuleFrontendOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPRequestRuleFrontendDefault General Error - -swagger:response getAllHttpRequestRuleFrontendDefault -*/ -type GetAllHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPRequestRuleFrontendDefault creates GetAllHTTPRequestRuleFrontendDefault with default headers values -func NewGetAllHTTPRequestRuleFrontendDefault(code int) *GetAllHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *GetAllHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP request rule frontend default response -func (o *GetAllHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_all_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/get_all_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 77c76688..00000000 --- a/operations/http_request_rule/get_all_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPRequestRuleFrontendURL generates an URL for the get all HTTP request rule frontend operation -type GetAllHTTPRequestRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleFrontendURL) WithBasePath(bp string) *GetAllHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_http_request_rule_backend.go b/operations/http_request_rule/get_http_request_rule_backend.go deleted file mode 100644 index ee470e96..00000000 --- a/operations/http_request_rule/get_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a get HTTP request rule backend handler -type GetHTTPRequestRuleBackendHandlerFunc func(GetHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPRequestRuleBackendHandlerFunc) Handle(params GetHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPRequestRuleBackendHandler interface for that can handle valid get HTTP request rule backend params -type GetHTTPRequestRuleBackendHandler interface { - Handle(GetHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetHTTPRequestRuleBackend creates a new http.Handler for the get HTTP request rule backend operation -func NewGetHTTPRequestRuleBackend(ctx *middleware.Context, handler GetHTTPRequestRuleBackendHandler) *GetHTTPRequestRuleBackend { - return &GetHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetHTTPRequestRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index} HTTPRequestRule getHttpRequestRuleBackend - -# Return one HTTP Request Rule - -Returns one HTTP Request Rule configuration by it's index in the specified parent. -*/ -type GetHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler GetHTTPRequestRuleBackendHandler -} - -func (o *GetHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_http_request_rule_backend_parameters.go b/operations/http_request_rule/get_http_request_rule_backend_parameters.go deleted file mode 100644 index 84ba784c..00000000 --- a/operations/http_request_rule/get_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPRequestRuleBackendParams creates a new GetHTTPRequestRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPRequestRuleBackendParams() GetHTTPRequestRuleBackendParams { - - return GetHTTPRequestRuleBackendParams{} -} - -// GetHTTPRequestRuleBackendParams contains all the bound params for the get HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPRequestRuleBackend -type GetHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPRequestRuleBackendParams() beforehand. -func (o *GetHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_http_request_rule_backend_responses.go b/operations/http_request_rule/get_http_request_rule_backend_responses.go deleted file mode 100644 index 205ccf51..00000000 --- a/operations/http_request_rule/get_http_request_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPRequestRuleBackendOKCode is the HTTP code returned for type GetHTTPRequestRuleBackendOK -const GetHTTPRequestRuleBackendOKCode int = 200 - -/* -GetHTTPRequestRuleBackendOK Successful operation - -swagger:response getHttpRequestRuleBackendOK -*/ -type GetHTTPRequestRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleBackendOK creates GetHTTPRequestRuleBackendOK with default headers values -func NewGetHTTPRequestRuleBackendOK() *GetHTTPRequestRuleBackendOK { - - return &GetHTTPRequestRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule backend o k response -func (o *GetHTTPRequestRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule backend o k response -func (o *GetHTTPRequestRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule backend o k response -func (o *GetHTTPRequestRuleBackendOK) WithPayload(payload *models.HTTPRequestRule) *GetHTTPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule backend o k response -func (o *GetHTTPRequestRuleBackendOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPRequestRuleBackendNotFoundCode is the HTTP code returned for type GetHTTPRequestRuleBackendNotFound -const GetHTTPRequestRuleBackendNotFoundCode int = 404 - -/* -GetHTTPRequestRuleBackendNotFound The specified resource was not found - -swagger:response getHttpRequestRuleBackendNotFound -*/ -type GetHTTPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleBackendNotFound creates GetHTTPRequestRuleBackendNotFound with default headers values -func NewGetHTTPRequestRuleBackendNotFound() *GetHTTPRequestRuleBackendNotFound { - - return &GetHTTPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule backend not found response -func (o *GetHTTPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule backend not found response -func (o *GetHTTPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule backend not found response -func (o *GetHTTPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *GetHTTPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule backend not found response -func (o *GetHTTPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPRequestRuleBackendDefault General Error - -swagger:response getHttpRequestRuleBackendDefault -*/ -type GetHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleBackendDefault creates GetHTTPRequestRuleBackendDefault with default headers values -func NewGetHTTPRequestRuleBackendDefault(code int) *GetHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) WithStatusCode(code int) *GetHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *GetHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP request rule backend default response -func (o *GetHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/get_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index f05bc08d..00000000 --- a/operations/http_request_rule/get_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPRequestRuleBackendURL generates an URL for the get HTTP request rule backend operation -type GetHTTPRequestRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleBackendURL) WithBasePath(bp string) *GetHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_http_request_rule_defaults.go b/operations/http_request_rule/get_http_request_rule_defaults.go deleted file mode 100644 index f9095a92..00000000 --- a/operations/http_request_rule/get_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a get HTTP request rule defaults handler -type GetHTTPRequestRuleDefaultsHandlerFunc func(GetHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPRequestRuleDefaultsHandlerFunc) Handle(params GetHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPRequestRuleDefaultsHandler interface for that can handle valid get HTTP request rule defaults params -type GetHTTPRequestRuleDefaultsHandler interface { - Handle(GetHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetHTTPRequestRuleDefaults creates a new http.Handler for the get HTTP request rule defaults operation -func NewGetHTTPRequestRuleDefaults(ctx *middleware.Context, handler GetHTTPRequestRuleDefaultsHandler) *GetHTTPRequestRuleDefaults { - return &GetHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetHTTPRequestRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index} HTTPRequestRule getHttpRequestRuleDefaults - -# Return one HTTP Request Rule - -Returns one HTTP Request Rule configuration by it's index in the specified parent. -*/ -type GetHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler GetHTTPRequestRuleDefaultsHandler -} - -func (o *GetHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_http_request_rule_defaults_parameters.go b/operations/http_request_rule/get_http_request_rule_defaults_parameters.go deleted file mode 100644 index 8360f053..00000000 --- a/operations/http_request_rule/get_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPRequestRuleDefaultsParams creates a new GetHTTPRequestRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPRequestRuleDefaultsParams() GetHTTPRequestRuleDefaultsParams { - - return GetHTTPRequestRuleDefaultsParams{} -} - -// GetHTTPRequestRuleDefaultsParams contains all the bound params for the get HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPRequestRuleDefaults -type GetHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPRequestRuleDefaultsParams() beforehand. -func (o *GetHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_http_request_rule_defaults_responses.go b/operations/http_request_rule/get_http_request_rule_defaults_responses.go deleted file mode 100644 index acb75fe1..00000000 --- a/operations/http_request_rule/get_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPRequestRuleDefaultsOKCode is the HTTP code returned for type GetHTTPRequestRuleDefaultsOK -const GetHTTPRequestRuleDefaultsOKCode int = 200 - -/* -GetHTTPRequestRuleDefaultsOK Successful operation - -swagger:response getHttpRequestRuleDefaultsOK -*/ -type GetHTTPRequestRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleDefaultsOK creates GetHTTPRequestRuleDefaultsOK with default headers values -func NewGetHTTPRequestRuleDefaultsOK() *GetHTTPRequestRuleDefaultsOK { - - return &GetHTTPRequestRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule defaults o k response -func (o *GetHTTPRequestRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule defaults o k response -func (o *GetHTTPRequestRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule defaults o k response -func (o *GetHTTPRequestRuleDefaultsOK) WithPayload(payload *models.HTTPRequestRule) *GetHTTPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule defaults o k response -func (o *GetHTTPRequestRuleDefaultsOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type GetHTTPRequestRuleDefaultsNotFound -const GetHTTPRequestRuleDefaultsNotFoundCode int = 404 - -/* -GetHTTPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response getHttpRequestRuleDefaultsNotFound -*/ -type GetHTTPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleDefaultsNotFound creates GetHTTPRequestRuleDefaultsNotFound with default headers values -func NewGetHTTPRequestRuleDefaultsNotFound() *GetHTTPRequestRuleDefaultsNotFound { - - return &GetHTTPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule defaults not found response -func (o *GetHTTPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule defaults not found response -func (o *GetHTTPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule defaults not found response -func (o *GetHTTPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetHTTPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule defaults not found response -func (o *GetHTTPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPRequestRuleDefaultsDefault General Error - -swagger:response getHttpRequestRuleDefaultsDefault -*/ -type GetHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleDefaultsDefault creates GetHTTPRequestRuleDefaultsDefault with default headers values -func NewGetHTTPRequestRuleDefaultsDefault(code int) *GetHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *GetHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *GetHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP request rule defaults default response -func (o *GetHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/get_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index d304b595..00000000 --- a/operations/http_request_rule/get_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPRequestRuleDefaultsURL generates an URL for the get HTTP request rule defaults operation -type GetHTTPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *GetHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/get_http_request_rule_frontend.go b/operations/http_request_rule/get_http_request_rule_frontend.go deleted file mode 100644 index 37e5c652..00000000 --- a/operations/http_request_rule/get_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a get HTTP request rule frontend handler -type GetHTTPRequestRuleFrontendHandlerFunc func(GetHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPRequestRuleFrontendHandlerFunc) Handle(params GetHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPRequestRuleFrontendHandler interface for that can handle valid get HTTP request rule frontend params -type GetHTTPRequestRuleFrontendHandler interface { - Handle(GetHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetHTTPRequestRuleFrontend creates a new http.Handler for the get HTTP request rule frontend operation -func NewGetHTTPRequestRuleFrontend(ctx *middleware.Context, handler GetHTTPRequestRuleFrontendHandler) *GetHTTPRequestRuleFrontend { - return &GetHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetHTTPRequestRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index} HTTPRequestRule getHttpRequestRuleFrontend - -# Return one HTTP Request Rule - -Returns one HTTP Request Rule configuration by it's index in the specified parent. -*/ -type GetHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler GetHTTPRequestRuleFrontendHandler -} - -func (o *GetHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/get_http_request_rule_frontend_parameters.go b/operations/http_request_rule/get_http_request_rule_frontend_parameters.go deleted file mode 100644 index 1a737167..00000000 --- a/operations/http_request_rule/get_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPRequestRuleFrontendParams creates a new GetHTTPRequestRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPRequestRuleFrontendParams() GetHTTPRequestRuleFrontendParams { - - return GetHTTPRequestRuleFrontendParams{} -} - -// GetHTTPRequestRuleFrontendParams contains all the bound params for the get HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPRequestRuleFrontend -type GetHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPRequestRuleFrontendParams() beforehand. -func (o *GetHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_request_rule/get_http_request_rule_frontend_responses.go b/operations/http_request_rule/get_http_request_rule_frontend_responses.go deleted file mode 100644 index c69fc176..00000000 --- a/operations/http_request_rule/get_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPRequestRuleFrontendOKCode is the HTTP code returned for type GetHTTPRequestRuleFrontendOK -const GetHTTPRequestRuleFrontendOKCode int = 200 - -/* -GetHTTPRequestRuleFrontendOK Successful operation - -swagger:response getHttpRequestRuleFrontendOK -*/ -type GetHTTPRequestRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleFrontendOK creates GetHTTPRequestRuleFrontendOK with default headers values -func NewGetHTTPRequestRuleFrontendOK() *GetHTTPRequestRuleFrontendOK { - - return &GetHTTPRequestRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule frontend o k response -func (o *GetHTTPRequestRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule frontend o k response -func (o *GetHTTPRequestRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule frontend o k response -func (o *GetHTTPRequestRuleFrontendOK) WithPayload(payload *models.HTTPRequestRule) *GetHTTPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule frontend o k response -func (o *GetHTTPRequestRuleFrontendOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPRequestRuleFrontendNotFoundCode is the HTTP code returned for type GetHTTPRequestRuleFrontendNotFound -const GetHTTPRequestRuleFrontendNotFoundCode int = 404 - -/* -GetHTTPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response getHttpRequestRuleFrontendNotFound -*/ -type GetHTTPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleFrontendNotFound creates GetHTTPRequestRuleFrontendNotFound with default headers values -func NewGetHTTPRequestRuleFrontendNotFound() *GetHTTPRequestRuleFrontendNotFound { - - return &GetHTTPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http request rule frontend not found response -func (o *GetHTTPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http request rule frontend not found response -func (o *GetHTTPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http request rule frontend not found response -func (o *GetHTTPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *GetHTTPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http request rule frontend not found response -func (o *GetHTTPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPRequestRuleFrontendDefault General Error - -swagger:response getHttpRequestRuleFrontendDefault -*/ -type GetHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPRequestRuleFrontendDefault creates GetHTTPRequestRuleFrontendDefault with default headers values -func NewGetHTTPRequestRuleFrontendDefault(code int) *GetHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *GetHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *GetHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP request rule frontend default response -func (o *GetHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/get_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/get_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 4d797ca9..00000000 --- a/operations/http_request_rule/get_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPRequestRuleFrontendURL generates an URL for the get HTTP request rule frontend operation -type GetHTTPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleFrontendURL) WithBasePath(bp string) *GetHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_backend.go b/operations/http_request_rule/replace_all_http_request_rule_backend.go deleted file mode 100644 index 09c00f13..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a replace all HTTP request rule backend handler -type ReplaceAllHTTPRequestRuleBackendHandlerFunc func(ReplaceAllHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPRequestRuleBackendHandlerFunc) Handle(params ReplaceAllHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPRequestRuleBackendHandler interface for that can handle valid replace all HTTP request rule backend params -type ReplaceAllHTTPRequestRuleBackendHandler interface { - Handle(ReplaceAllHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPRequestRuleBackend creates a new http.Handler for the replace all HTTP request rule backend operation -func NewReplaceAllHTTPRequestRuleBackend(ctx *middleware.Context, handler ReplaceAllHTTPRequestRuleBackendHandler) *ReplaceAllHTTPRequestRuleBackend { - return &ReplaceAllHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPRequestRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules HTTPRequestRule replaceAllHttpRequestRuleBackend - -# Replace an HTTP Request Rule list - -Replaces a whole list of HTTP Request Rules with the list given in parameter -*/ -type ReplaceAllHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllHTTPRequestRuleBackendHandler -} - -func (o *ReplaceAllHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_backend_parameters.go b/operations/http_request_rule/replace_all_http_request_rule_backend_parameters.go deleted file mode 100644 index 9b266644..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPRequestRuleBackendParams creates a new ReplaceAllHTTPRequestRuleBackendParams object -// with the default values initialized. -func NewReplaceAllHTTPRequestRuleBackendParams() ReplaceAllHTTPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPRequestRuleBackendParams contains all the bound params for the replace all HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPRequestRuleBackend -type ReplaceAllHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPRequestRuleBackendParams() beforehand. -func (o *ReplaceAllHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_backend_responses.go b/operations/http_request_rule/replace_all_http_request_rule_backend_responses.go deleted file mode 100644 index 87cebd7e..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPRequestRuleBackendOKCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleBackendOK -const ReplaceAllHTTPRequestRuleBackendOKCode int = 200 - -/* -ReplaceAllHTTPRequestRuleBackendOK All HTTP Request Rule lines replaced - -swagger:response replaceAllHttpRequestRuleBackendOK -*/ -type ReplaceAllHTTPRequestRuleBackendOK struct { - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleBackendOK creates ReplaceAllHTTPRequestRuleBackendOK with default headers values -func NewReplaceAllHTTPRequestRuleBackendOK() *ReplaceAllHTTPRequestRuleBackendOK { - - return &ReplaceAllHTTPRequestRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Http request rule backend o k response -func (o *ReplaceAllHTTPRequestRuleBackendOK) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule backend o k response -func (o *ReplaceAllHTTPRequestRuleBackendOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleBackendAccepted -const ReplaceAllHTTPRequestRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllHTTPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpRequestRuleBackendAccepted -*/ -type ReplaceAllHTTPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleBackendAccepted creates ReplaceAllHTTPRequestRuleBackendAccepted with default headers values -func NewReplaceAllHTTPRequestRuleBackendAccepted() *ReplaceAllHTTPRequestRuleBackendAccepted { - - return &ReplaceAllHTTPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http request rule backend accepted response -func (o *ReplaceAllHTTPRequestRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http request rule backend accepted response -func (o *ReplaceAllHTTPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http request rule backend accepted response -func (o *ReplaceAllHTTPRequestRuleBackendAccepted) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule backend accepted response -func (o *ReplaceAllHTTPRequestRuleBackendAccepted) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleBackendBadRequest -const ReplaceAllHTTPRequestRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllHTTPRequestRuleBackendBadRequest Bad request - -swagger:response replaceAllHttpRequestRuleBackendBadRequest -*/ -type ReplaceAllHTTPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleBackendBadRequest creates ReplaceAllHTTPRequestRuleBackendBadRequest with default headers values -func NewReplaceAllHTTPRequestRuleBackendBadRequest() *ReplaceAllHTTPRequestRuleBackendBadRequest { - - return &ReplaceAllHTTPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http request rule backend bad request response -func (o *ReplaceAllHTTPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http request rule backend bad request response -func (o *ReplaceAllHTTPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http request rule backend bad request response -func (o *ReplaceAllHTTPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule backend bad request response -func (o *ReplaceAllHTTPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPRequestRuleBackendDefault General Error - -swagger:response replaceAllHttpRequestRuleBackendDefault -*/ -type ReplaceAllHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleBackendDefault creates ReplaceAllHTTPRequestRuleBackendDefault with default headers values -func NewReplaceAllHTTPRequestRuleBackendDefault(code int) *ReplaceAllHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) WithStatusCode(code int) *ReplaceAllHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP request rule backend default response -func (o *ReplaceAllHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/replace_all_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index 71cbaa23..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPRequestRuleBackendURL generates an URL for the replace all HTTP request rule backend operation -type ReplaceAllHTTPRequestRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleBackendURL) WithBasePath(bp string) *ReplaceAllHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_defaults.go b/operations/http_request_rule/replace_all_http_request_rule_defaults.go deleted file mode 100644 index b4411d7d..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a replace all HTTP request rule defaults handler -type ReplaceAllHTTPRequestRuleDefaultsHandlerFunc func(ReplaceAllHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPRequestRuleDefaultsHandlerFunc) Handle(params ReplaceAllHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPRequestRuleDefaultsHandler interface for that can handle valid replace all HTTP request rule defaults params -type ReplaceAllHTTPRequestRuleDefaultsHandler interface { - Handle(ReplaceAllHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPRequestRuleDefaults creates a new http.Handler for the replace all HTTP request rule defaults operation -func NewReplaceAllHTTPRequestRuleDefaults(ctx *middleware.Context, handler ReplaceAllHTTPRequestRuleDefaultsHandler) *ReplaceAllHTTPRequestRuleDefaults { - return &ReplaceAllHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPRequestRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules HTTPRequestRule replaceAllHttpRequestRuleDefaults - -# Replace an HTTP Request Rule list - -Replaces a whole list of HTTP Request Rules with the list given in parameter -*/ -type ReplaceAllHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllHTTPRequestRuleDefaultsHandler -} - -func (o *ReplaceAllHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_defaults_parameters.go b/operations/http_request_rule/replace_all_http_request_rule_defaults_parameters.go deleted file mode 100644 index 74433bc2..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPRequestRuleDefaultsParams creates a new ReplaceAllHTTPRequestRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllHTTPRequestRuleDefaultsParams() ReplaceAllHTTPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPRequestRuleDefaultsParams contains all the bound params for the replace all HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPRequestRuleDefaults -type ReplaceAllHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPRequestRuleDefaultsParams() beforehand. -func (o *ReplaceAllHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_defaults_responses.go b/operations/http_request_rule/replace_all_http_request_rule_defaults_responses.go deleted file mode 100644 index 53c3a2c7..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPRequestRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleDefaultsOK -const ReplaceAllHTTPRequestRuleDefaultsOKCode int = 200 - -/* -ReplaceAllHTTPRequestRuleDefaultsOK All HTTP Request Rule lines replaced - -swagger:response replaceAllHttpRequestRuleDefaultsOK -*/ -type ReplaceAllHTTPRequestRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleDefaultsOK creates ReplaceAllHTTPRequestRuleDefaultsOK with default headers values -func NewReplaceAllHTTPRequestRuleDefaultsOK() *ReplaceAllHTTPRequestRuleDefaultsOK { - - return &ReplaceAllHTTPRequestRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Http request rule defaults o k response -func (o *ReplaceAllHTTPRequestRuleDefaultsOK) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule defaults o k response -func (o *ReplaceAllHTTPRequestRuleDefaultsOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleDefaultsAccepted -const ReplaceAllHTTPRequestRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllHTTPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpRequestRuleDefaultsAccepted -*/ -type ReplaceAllHTTPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleDefaultsAccepted creates ReplaceAllHTTPRequestRuleDefaultsAccepted with default headers values -func NewReplaceAllHTTPRequestRuleDefaultsAccepted() *ReplaceAllHTTPRequestRuleDefaultsAccepted { - - return &ReplaceAllHTTPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http request rule defaults accepted response -func (o *ReplaceAllHTTPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http request rule defaults accepted response -func (o *ReplaceAllHTTPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http request rule defaults accepted response -func (o *ReplaceAllHTTPRequestRuleDefaultsAccepted) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule defaults accepted response -func (o *ReplaceAllHTTPRequestRuleDefaultsAccepted) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleDefaultsBadRequest -const ReplaceAllHTTPRequestRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllHTTPRequestRuleDefaultsBadRequest Bad request - -swagger:response replaceAllHttpRequestRuleDefaultsBadRequest -*/ -type ReplaceAllHTTPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleDefaultsBadRequest creates ReplaceAllHTTPRequestRuleDefaultsBadRequest with default headers values -func NewReplaceAllHTTPRequestRuleDefaultsBadRequest() *ReplaceAllHTTPRequestRuleDefaultsBadRequest { - - return &ReplaceAllHTTPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http request rule defaults bad request response -func (o *ReplaceAllHTTPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http request rule defaults bad request response -func (o *ReplaceAllHTTPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http request rule defaults bad request response -func (o *ReplaceAllHTTPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule defaults bad request response -func (o *ReplaceAllHTTPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPRequestRuleDefaultsDefault General Error - -swagger:response replaceAllHttpRequestRuleDefaultsDefault -*/ -type ReplaceAllHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleDefaultsDefault creates ReplaceAllHTTPRequestRuleDefaultsDefault with default headers values -func NewReplaceAllHTTPRequestRuleDefaultsDefault(code int) *ReplaceAllHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP request rule defaults default response -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/replace_all_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 436bb2c7..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPRequestRuleDefaultsURL generates an URL for the replace all HTTP request rule defaults operation -type ReplaceAllHTTPRequestRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_frontend.go b/operations/http_request_rule/replace_all_http_request_rule_frontend.go deleted file mode 100644 index fd804c5e..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a replace all HTTP request rule frontend handler -type ReplaceAllHTTPRequestRuleFrontendHandlerFunc func(ReplaceAllHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPRequestRuleFrontendHandlerFunc) Handle(params ReplaceAllHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPRequestRuleFrontendHandler interface for that can handle valid replace all HTTP request rule frontend params -type ReplaceAllHTTPRequestRuleFrontendHandler interface { - Handle(ReplaceAllHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPRequestRuleFrontend creates a new http.Handler for the replace all HTTP request rule frontend operation -func NewReplaceAllHTTPRequestRuleFrontend(ctx *middleware.Context, handler ReplaceAllHTTPRequestRuleFrontendHandler) *ReplaceAllHTTPRequestRuleFrontend { - return &ReplaceAllHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPRequestRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules HTTPRequestRule replaceAllHttpRequestRuleFrontend - -# Replace an HTTP Request Rule list - -Replaces a whole list of HTTP Request Rules with the list given in parameter -*/ -type ReplaceAllHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllHTTPRequestRuleFrontendHandler -} - -func (o *ReplaceAllHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_frontend_parameters.go b/operations/http_request_rule/replace_all_http_request_rule_frontend_parameters.go deleted file mode 100644 index 44460cf2..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPRequestRuleFrontendParams creates a new ReplaceAllHTTPRequestRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllHTTPRequestRuleFrontendParams() ReplaceAllHTTPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPRequestRuleFrontendParams contains all the bound params for the replace all HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPRequestRuleFrontend -type ReplaceAllHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPRequestRuleFrontendParams() beforehand. -func (o *ReplaceAllHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_frontend_responses.go b/operations/http_request_rule/replace_all_http_request_rule_frontend_responses.go deleted file mode 100644 index 68366081..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPRequestRuleFrontendOKCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleFrontendOK -const ReplaceAllHTTPRequestRuleFrontendOKCode int = 200 - -/* -ReplaceAllHTTPRequestRuleFrontendOK All HTTP Request Rule lines replaced - -swagger:response replaceAllHttpRequestRuleFrontendOK -*/ -type ReplaceAllHTTPRequestRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleFrontendOK creates ReplaceAllHTTPRequestRuleFrontendOK with default headers values -func NewReplaceAllHTTPRequestRuleFrontendOK() *ReplaceAllHTTPRequestRuleFrontendOK { - - return &ReplaceAllHTTPRequestRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Http request rule frontend o k response -func (o *ReplaceAllHTTPRequestRuleFrontendOK) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule frontend o k response -func (o *ReplaceAllHTTPRequestRuleFrontendOK) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleFrontendAccepted -const ReplaceAllHTTPRequestRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllHTTPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpRequestRuleFrontendAccepted -*/ -type ReplaceAllHTTPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleFrontendAccepted creates ReplaceAllHTTPRequestRuleFrontendAccepted with default headers values -func NewReplaceAllHTTPRequestRuleFrontendAccepted() *ReplaceAllHTTPRequestRuleFrontendAccepted { - - return &ReplaceAllHTTPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http request rule frontend accepted response -func (o *ReplaceAllHTTPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http request rule frontend accepted response -func (o *ReplaceAllHTTPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http request rule frontend accepted response -func (o *ReplaceAllHTTPRequestRuleFrontendAccepted) WithPayload(payload models.HTTPRequestRules) *ReplaceAllHTTPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule frontend accepted response -func (o *ReplaceAllHTTPRequestRuleFrontendAccepted) SetPayload(payload models.HTTPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPRequestRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPRequestRuleFrontendBadRequest -const ReplaceAllHTTPRequestRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllHTTPRequestRuleFrontendBadRequest Bad request - -swagger:response replaceAllHttpRequestRuleFrontendBadRequest -*/ -type ReplaceAllHTTPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleFrontendBadRequest creates ReplaceAllHTTPRequestRuleFrontendBadRequest with default headers values -func NewReplaceAllHTTPRequestRuleFrontendBadRequest() *ReplaceAllHTTPRequestRuleFrontendBadRequest { - - return &ReplaceAllHTTPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http request rule frontend bad request response -func (o *ReplaceAllHTTPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http request rule frontend bad request response -func (o *ReplaceAllHTTPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http request rule frontend bad request response -func (o *ReplaceAllHTTPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http request rule frontend bad request response -func (o *ReplaceAllHTTPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPRequestRuleFrontendDefault General Error - -swagger:response replaceAllHttpRequestRuleFrontendDefault -*/ -type ReplaceAllHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPRequestRuleFrontendDefault creates ReplaceAllHTTPRequestRuleFrontendDefault with default headers values -func NewReplaceAllHTTPRequestRuleFrontendDefault(code int) *ReplaceAllHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP request rule frontend default response -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_all_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/replace_all_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 91d6abf3..00000000 --- a/operations/http_request_rule/replace_all_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPRequestRuleFrontendURL generates an URL for the replace all HTTP request rule frontend operation -type ReplaceAllHTTPRequestRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleFrontendURL) WithBasePath(bp string) *ReplaceAllHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_http_request_rule_backend.go b/operations/http_request_rule/replace_http_request_rule_backend.go deleted file mode 100644 index 15196888..00000000 --- a/operations/http_request_rule/replace_http_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPRequestRuleBackendHandlerFunc turns a function with the right signature into a replace HTTP request rule backend handler -type ReplaceHTTPRequestRuleBackendHandlerFunc func(ReplaceHTTPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPRequestRuleBackendHandlerFunc) Handle(params ReplaceHTTPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPRequestRuleBackendHandler interface for that can handle valid replace HTTP request rule backend params -type ReplaceHTTPRequestRuleBackendHandler interface { - Handle(ReplaceHTTPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPRequestRuleBackend creates a new http.Handler for the replace HTTP request rule backend operation -func NewReplaceHTTPRequestRuleBackend(ctx *middleware.Context, handler ReplaceHTTPRequestRuleBackendHandler) *ReplaceHTTPRequestRuleBackend { - return &ReplaceHTTPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPRequestRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index} HTTPRequestRule replaceHttpRequestRuleBackend - -# Replace a HTTP Request Rule - -Replaces a HTTP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPRequestRuleBackend struct { - Context *middleware.Context - Handler ReplaceHTTPRequestRuleBackendHandler -} - -func (o *ReplaceHTTPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_http_request_rule_backend_parameters.go b/operations/http_request_rule/replace_http_request_rule_backend_parameters.go deleted file mode 100644 index 167200cc..00000000 --- a/operations/http_request_rule/replace_http_request_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPRequestRuleBackendParams creates a new ReplaceHTTPRequestRuleBackendParams object -// with the default values initialized. -func NewReplaceHTTPRequestRuleBackendParams() ReplaceHTTPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPRequestRuleBackendParams contains all the bound params for the replace HTTP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPRequestRuleBackend -type ReplaceHTTPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPRequestRuleBackendParams() beforehand. -func (o *ReplaceHTTPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_http_request_rule_backend_responses.go b/operations/http_request_rule/replace_http_request_rule_backend_responses.go deleted file mode 100644 index 663d443d..00000000 --- a/operations/http_request_rule/replace_http_request_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPRequestRuleBackendOKCode is the HTTP code returned for type ReplaceHTTPRequestRuleBackendOK -const ReplaceHTTPRequestRuleBackendOKCode int = 200 - -/* -ReplaceHTTPRequestRuleBackendOK HTTP Request Rule replaced - -swagger:response replaceHttpRequestRuleBackendOK -*/ -type ReplaceHTTPRequestRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleBackendOK creates ReplaceHTTPRequestRuleBackendOK with default headers values -func NewReplaceHTTPRequestRuleBackendOK() *ReplaceHTTPRequestRuleBackendOK { - - return &ReplaceHTTPRequestRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Http request rule backend o k response -func (o *ReplaceHTTPRequestRuleBackendOK) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule backend o k response -func (o *ReplaceHTTPRequestRuleBackendOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleBackendAcceptedCode is the HTTP code returned for type ReplaceHTTPRequestRuleBackendAccepted -const ReplaceHTTPRequestRuleBackendAcceptedCode int = 202 - -/* -ReplaceHTTPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpRequestRuleBackendAccepted -*/ -type ReplaceHTTPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleBackendAccepted creates ReplaceHTTPRequestRuleBackendAccepted with default headers values -func NewReplaceHTTPRequestRuleBackendAccepted() *ReplaceHTTPRequestRuleBackendAccepted { - - return &ReplaceHTTPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http request rule backend accepted response -func (o *ReplaceHTTPRequestRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceHTTPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http request rule backend accepted response -func (o *ReplaceHTTPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http request rule backend accepted response -func (o *ReplaceHTTPRequestRuleBackendAccepted) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule backend accepted response -func (o *ReplaceHTTPRequestRuleBackendAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleBackendBadRequestCode is the HTTP code returned for type ReplaceHTTPRequestRuleBackendBadRequest -const ReplaceHTTPRequestRuleBackendBadRequestCode int = 400 - -/* -ReplaceHTTPRequestRuleBackendBadRequest Bad request - -swagger:response replaceHttpRequestRuleBackendBadRequest -*/ -type ReplaceHTTPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleBackendBadRequest creates ReplaceHTTPRequestRuleBackendBadRequest with default headers values -func NewReplaceHTTPRequestRuleBackendBadRequest() *ReplaceHTTPRequestRuleBackendBadRequest { - - return &ReplaceHTTPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule backend bad request response -func (o *ReplaceHTTPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule backend bad request response -func (o *ReplaceHTTPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule backend bad request response -func (o *ReplaceHTTPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule backend bad request response -func (o *ReplaceHTTPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleBackendNotFoundCode is the HTTP code returned for type ReplaceHTTPRequestRuleBackendNotFound -const ReplaceHTTPRequestRuleBackendNotFoundCode int = 404 - -/* -ReplaceHTTPRequestRuleBackendNotFound The specified resource was not found - -swagger:response replaceHttpRequestRuleBackendNotFound -*/ -type ReplaceHTTPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleBackendNotFound creates ReplaceHTTPRequestRuleBackendNotFound with default headers values -func NewReplaceHTTPRequestRuleBackendNotFound() *ReplaceHTTPRequestRuleBackendNotFound { - - return &ReplaceHTTPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule backend not found response -func (o *ReplaceHTTPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule backend not found response -func (o *ReplaceHTTPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule backend not found response -func (o *ReplaceHTTPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule backend not found response -func (o *ReplaceHTTPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPRequestRuleBackendDefault General Error - -swagger:response replaceHttpRequestRuleBackendDefault -*/ -type ReplaceHTTPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleBackendDefault creates ReplaceHTTPRequestRuleBackendDefault with default headers values -func NewReplaceHTTPRequestRuleBackendDefault(code int) *ReplaceHTTPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) WithStatusCode(code int) *ReplaceHTTPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP request rule backend default response -func (o *ReplaceHTTPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_http_request_rule_backend_urlbuilder.go b/operations/http_request_rule/replace_http_request_rule_backend_urlbuilder.go deleted file mode 100644 index 1cbccc97..00000000 --- a/operations/http_request_rule/replace_http_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPRequestRuleBackendURL generates an URL for the replace HTTP request rule backend operation -type ReplaceHTTPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleBackendURL) WithBasePath(bp string) *ReplaceHTTPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_http_request_rule_defaults.go b/operations/http_request_rule/replace_http_request_rule_defaults.go deleted file mode 100644 index fd1b501e..00000000 --- a/operations/http_request_rule/replace_http_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a replace HTTP request rule defaults handler -type ReplaceHTTPRequestRuleDefaultsHandlerFunc func(ReplaceHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPRequestRuleDefaultsHandlerFunc) Handle(params ReplaceHTTPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPRequestRuleDefaultsHandler interface for that can handle valid replace HTTP request rule defaults params -type ReplaceHTTPRequestRuleDefaultsHandler interface { - Handle(ReplaceHTTPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPRequestRuleDefaults creates a new http.Handler for the replace HTTP request rule defaults operation -func NewReplaceHTTPRequestRuleDefaults(ctx *middleware.Context, handler ReplaceHTTPRequestRuleDefaultsHandler) *ReplaceHTTPRequestRuleDefaults { - return &ReplaceHTTPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPRequestRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index} HTTPRequestRule replaceHttpRequestRuleDefaults - -# Replace a HTTP Request Rule - -Replaces a HTTP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPRequestRuleDefaults struct { - Context *middleware.Context - Handler ReplaceHTTPRequestRuleDefaultsHandler -} - -func (o *ReplaceHTTPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_http_request_rule_defaults_parameters.go b/operations/http_request_rule/replace_http_request_rule_defaults_parameters.go deleted file mode 100644 index 4aca19cc..00000000 --- a/operations/http_request_rule/replace_http_request_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPRequestRuleDefaultsParams creates a new ReplaceHTTPRequestRuleDefaultsParams object -// with the default values initialized. -func NewReplaceHTTPRequestRuleDefaultsParams() ReplaceHTTPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPRequestRuleDefaultsParams contains all the bound params for the replace HTTP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPRequestRuleDefaults -type ReplaceHTTPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPRequestRuleDefaultsParams() beforehand. -func (o *ReplaceHTTPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_http_request_rule_defaults_responses.go b/operations/http_request_rule/replace_http_request_rule_defaults_responses.go deleted file mode 100644 index e1c62a02..00000000 --- a/operations/http_request_rule/replace_http_request_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPRequestRuleDefaultsOKCode is the HTTP code returned for type ReplaceHTTPRequestRuleDefaultsOK -const ReplaceHTTPRequestRuleDefaultsOKCode int = 200 - -/* -ReplaceHTTPRequestRuleDefaultsOK HTTP Request Rule replaced - -swagger:response replaceHttpRequestRuleDefaultsOK -*/ -type ReplaceHTTPRequestRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleDefaultsOK creates ReplaceHTTPRequestRuleDefaultsOK with default headers values -func NewReplaceHTTPRequestRuleDefaultsOK() *ReplaceHTTPRequestRuleDefaultsOK { - - return &ReplaceHTTPRequestRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Http request rule defaults o k response -func (o *ReplaceHTTPRequestRuleDefaultsOK) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule defaults o k response -func (o *ReplaceHTTPRequestRuleDefaultsOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceHTTPRequestRuleDefaultsAccepted -const ReplaceHTTPRequestRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceHTTPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpRequestRuleDefaultsAccepted -*/ -type ReplaceHTTPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleDefaultsAccepted creates ReplaceHTTPRequestRuleDefaultsAccepted with default headers values -func NewReplaceHTTPRequestRuleDefaultsAccepted() *ReplaceHTTPRequestRuleDefaultsAccepted { - - return &ReplaceHTTPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http request rule defaults accepted response -func (o *ReplaceHTTPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceHTTPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http request rule defaults accepted response -func (o *ReplaceHTTPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http request rule defaults accepted response -func (o *ReplaceHTTPRequestRuleDefaultsAccepted) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule defaults accepted response -func (o *ReplaceHTTPRequestRuleDefaultsAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceHTTPRequestRuleDefaultsBadRequest -const ReplaceHTTPRequestRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceHTTPRequestRuleDefaultsBadRequest Bad request - -swagger:response replaceHttpRequestRuleDefaultsBadRequest -*/ -type ReplaceHTTPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleDefaultsBadRequest creates ReplaceHTTPRequestRuleDefaultsBadRequest with default headers values -func NewReplaceHTTPRequestRuleDefaultsBadRequest() *ReplaceHTTPRequestRuleDefaultsBadRequest { - - return &ReplaceHTTPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule defaults bad request response -func (o *ReplaceHTTPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule defaults bad request response -func (o *ReplaceHTTPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule defaults bad request response -func (o *ReplaceHTTPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule defaults bad request response -func (o *ReplaceHTTPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceHTTPRequestRuleDefaultsNotFound -const ReplaceHTTPRequestRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceHTTPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceHttpRequestRuleDefaultsNotFound -*/ -type ReplaceHTTPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleDefaultsNotFound creates ReplaceHTTPRequestRuleDefaultsNotFound with default headers values -func NewReplaceHTTPRequestRuleDefaultsNotFound() *ReplaceHTTPRequestRuleDefaultsNotFound { - - return &ReplaceHTTPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule defaults not found response -func (o *ReplaceHTTPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule defaults not found response -func (o *ReplaceHTTPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule defaults not found response -func (o *ReplaceHTTPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule defaults not found response -func (o *ReplaceHTTPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPRequestRuleDefaultsDefault General Error - -swagger:response replaceHttpRequestRuleDefaultsDefault -*/ -type ReplaceHTTPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleDefaultsDefault creates ReplaceHTTPRequestRuleDefaultsDefault with default headers values -func NewReplaceHTTPRequestRuleDefaultsDefault(code int) *ReplaceHTTPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) WithStatusCode(code int) *ReplaceHTTPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP request rule defaults default response -func (o *ReplaceHTTPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_http_request_rule_defaults_urlbuilder.go b/operations/http_request_rule/replace_http_request_rule_defaults_urlbuilder.go deleted file mode 100644 index d6d3f739..00000000 --- a/operations/http_request_rule/replace_http_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPRequestRuleDefaultsURL generates an URL for the replace HTTP request rule defaults operation -type ReplaceHTTPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleDefaultsURL) WithBasePath(bp string) *ReplaceHTTPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_request_rule/replace_http_request_rule_frontend.go b/operations/http_request_rule/replace_http_request_rule_frontend.go deleted file mode 100644 index 0098a65c..00000000 --- a/operations/http_request_rule/replace_http_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPRequestRuleFrontendHandlerFunc turns a function with the right signature into a replace HTTP request rule frontend handler -type ReplaceHTTPRequestRuleFrontendHandlerFunc func(ReplaceHTTPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPRequestRuleFrontendHandlerFunc) Handle(params ReplaceHTTPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPRequestRuleFrontendHandler interface for that can handle valid replace HTTP request rule frontend params -type ReplaceHTTPRequestRuleFrontendHandler interface { - Handle(ReplaceHTTPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPRequestRuleFrontend creates a new http.Handler for the replace HTTP request rule frontend operation -func NewReplaceHTTPRequestRuleFrontend(ctx *middleware.Context, handler ReplaceHTTPRequestRuleFrontendHandler) *ReplaceHTTPRequestRuleFrontend { - return &ReplaceHTTPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPRequestRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index} HTTPRequestRule replaceHttpRequestRuleFrontend - -# Replace a HTTP Request Rule - -Replaces a HTTP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPRequestRuleFrontend struct { - Context *middleware.Context - Handler ReplaceHTTPRequestRuleFrontendHandler -} - -func (o *ReplaceHTTPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_request_rule/replace_http_request_rule_frontend_parameters.go b/operations/http_request_rule/replace_http_request_rule_frontend_parameters.go deleted file mode 100644 index e84ee71f..00000000 --- a/operations/http_request_rule/replace_http_request_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPRequestRuleFrontendParams creates a new ReplaceHTTPRequestRuleFrontendParams object -// with the default values initialized. -func NewReplaceHTTPRequestRuleFrontendParams() ReplaceHTTPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPRequestRuleFrontendParams contains all the bound params for the replace HTTP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPRequestRuleFrontend -type ReplaceHTTPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPRequestRuleFrontendParams() beforehand. -func (o *ReplaceHTTPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_request_rule/replace_http_request_rule_frontend_responses.go b/operations/http_request_rule/replace_http_request_rule_frontend_responses.go deleted file mode 100644 index 1f93abb2..00000000 --- a/operations/http_request_rule/replace_http_request_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPRequestRuleFrontendOKCode is the HTTP code returned for type ReplaceHTTPRequestRuleFrontendOK -const ReplaceHTTPRequestRuleFrontendOKCode int = 200 - -/* -ReplaceHTTPRequestRuleFrontendOK HTTP Request Rule replaced - -swagger:response replaceHttpRequestRuleFrontendOK -*/ -type ReplaceHTTPRequestRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleFrontendOK creates ReplaceHTTPRequestRuleFrontendOK with default headers values -func NewReplaceHTTPRequestRuleFrontendOK() *ReplaceHTTPRequestRuleFrontendOK { - - return &ReplaceHTTPRequestRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Http request rule frontend o k response -func (o *ReplaceHTTPRequestRuleFrontendOK) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule frontend o k response -func (o *ReplaceHTTPRequestRuleFrontendOK) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceHTTPRequestRuleFrontendAccepted -const ReplaceHTTPRequestRuleFrontendAcceptedCode int = 202 - -/* -ReplaceHTTPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpRequestRuleFrontendAccepted -*/ -type ReplaceHTTPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPRequestRule `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleFrontendAccepted creates ReplaceHTTPRequestRuleFrontendAccepted with default headers values -func NewReplaceHTTPRequestRuleFrontendAccepted() *ReplaceHTTPRequestRuleFrontendAccepted { - - return &ReplaceHTTPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http request rule frontend accepted response -func (o *ReplaceHTTPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceHTTPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http request rule frontend accepted response -func (o *ReplaceHTTPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http request rule frontend accepted response -func (o *ReplaceHTTPRequestRuleFrontendAccepted) WithPayload(payload *models.HTTPRequestRule) *ReplaceHTTPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule frontend accepted response -func (o *ReplaceHTTPRequestRuleFrontendAccepted) SetPayload(payload *models.HTTPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceHTTPRequestRuleFrontendBadRequest -const ReplaceHTTPRequestRuleFrontendBadRequestCode int = 400 - -/* -ReplaceHTTPRequestRuleFrontendBadRequest Bad request - -swagger:response replaceHttpRequestRuleFrontendBadRequest -*/ -type ReplaceHTTPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleFrontendBadRequest creates ReplaceHTTPRequestRuleFrontendBadRequest with default headers values -func NewReplaceHTTPRequestRuleFrontendBadRequest() *ReplaceHTTPRequestRuleFrontendBadRequest { - - return &ReplaceHTTPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule frontend bad request response -func (o *ReplaceHTTPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule frontend bad request response -func (o *ReplaceHTTPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule frontend bad request response -func (o *ReplaceHTTPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule frontend bad request response -func (o *ReplaceHTTPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPRequestRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceHTTPRequestRuleFrontendNotFound -const ReplaceHTTPRequestRuleFrontendNotFoundCode int = 404 - -/* -ReplaceHTTPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response replaceHttpRequestRuleFrontendNotFound -*/ -type ReplaceHTTPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleFrontendNotFound creates ReplaceHTTPRequestRuleFrontendNotFound with default headers values -func NewReplaceHTTPRequestRuleFrontendNotFound() *ReplaceHTTPRequestRuleFrontendNotFound { - - return &ReplaceHTTPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http request rule frontend not found response -func (o *ReplaceHTTPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http request rule frontend not found response -func (o *ReplaceHTTPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http request rule frontend not found response -func (o *ReplaceHTTPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http request rule frontend not found response -func (o *ReplaceHTTPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPRequestRuleFrontendDefault General Error - -swagger:response replaceHttpRequestRuleFrontendDefault -*/ -type ReplaceHTTPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPRequestRuleFrontendDefault creates ReplaceHTTPRequestRuleFrontendDefault with default headers values -func NewReplaceHTTPRequestRuleFrontendDefault(code int) *ReplaceHTTPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) WithStatusCode(code int) *ReplaceHTTPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceHTTPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP request rule frontend default response -func (o *ReplaceHTTPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_request_rule/replace_http_request_rule_frontend_urlbuilder.go b/operations/http_request_rule/replace_http_request_rule_frontend_urlbuilder.go deleted file mode 100644 index c63e1d44..00000000 --- a/operations/http_request_rule/replace_http_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPRequestRuleFrontendURL generates an URL for the replace HTTP request rule frontend operation -type ReplaceHTTPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleFrontendURL) WithBasePath(bp string) *ReplaceHTTPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/create_http_response_rule_backend.go b/operations/http_response_rule/create_http_response_rule_backend.go deleted file mode 100644 index 41448440..00000000 --- a/operations/http_response_rule/create_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a create HTTP response rule backend handler -type CreateHTTPResponseRuleBackendHandlerFunc func(CreateHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPResponseRuleBackendHandlerFunc) Handle(params CreateHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPResponseRuleBackendHandler interface for that can handle valid create HTTP response rule backend params -type CreateHTTPResponseRuleBackendHandler interface { - Handle(CreateHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPResponseRuleBackend creates a new http.Handler for the create HTTP response rule backend operation -func NewCreateHTTPResponseRuleBackend(ctx *middleware.Context, handler CreateHTTPResponseRuleBackendHandler) *CreateHTTPResponseRuleBackend { - return &CreateHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPResponseRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index} HTTPResponseRule createHttpResponseRuleBackend - -# Add a new HTTP Response Rule - -Adds a new HTTP Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler CreateHTTPResponseRuleBackendHandler -} - -func (o *CreateHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/create_http_response_rule_backend_parameters.go b/operations/http_response_rule/create_http_response_rule_backend_parameters.go deleted file mode 100644 index ed06a582..00000000 --- a/operations/http_response_rule/create_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPResponseRuleBackendParams creates a new CreateHTTPResponseRuleBackendParams object -// with the default values initialized. -func NewCreateHTTPResponseRuleBackendParams() CreateHTTPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPResponseRuleBackendParams contains all the bound params for the create HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPResponseRuleBackend -type CreateHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPResponseRuleBackendParams() beforehand. -func (o *CreateHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/create_http_response_rule_backend_responses.go b/operations/http_response_rule/create_http_response_rule_backend_responses.go deleted file mode 100644 index b976a663..00000000 --- a/operations/http_response_rule/create_http_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPResponseRuleBackendCreatedCode is the HTTP code returned for type CreateHTTPResponseRuleBackendCreated -const CreateHTTPResponseRuleBackendCreatedCode int = 201 - -/* -CreateHTTPResponseRuleBackendCreated HTTP Response Rule created - -swagger:response createHttpResponseRuleBackendCreated -*/ -type CreateHTTPResponseRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleBackendCreated creates CreateHTTPResponseRuleBackendCreated with default headers values -func NewCreateHTTPResponseRuleBackendCreated() *CreateHTTPResponseRuleBackendCreated { - - return &CreateHTTPResponseRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Http response rule backend created response -func (o *CreateHTTPResponseRuleBackendCreated) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule backend created response -func (o *CreateHTTPResponseRuleBackendCreated) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleBackendAcceptedCode is the HTTP code returned for type CreateHTTPResponseRuleBackendAccepted -const CreateHTTPResponseRuleBackendAcceptedCode int = 202 - -/* -CreateHTTPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createHttpResponseRuleBackendAccepted -*/ -type CreateHTTPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleBackendAccepted creates CreateHTTPResponseRuleBackendAccepted with default headers values -func NewCreateHTTPResponseRuleBackendAccepted() *CreateHTTPResponseRuleBackendAccepted { - - return &CreateHTTPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http response rule backend accepted response -func (o *CreateHTTPResponseRuleBackendAccepted) WithReloadID(reloadID string) *CreateHTTPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http response rule backend accepted response -func (o *CreateHTTPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http response rule backend accepted response -func (o *CreateHTTPResponseRuleBackendAccepted) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule backend accepted response -func (o *CreateHTTPResponseRuleBackendAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleBackendBadRequestCode is the HTTP code returned for type CreateHTTPResponseRuleBackendBadRequest -const CreateHTTPResponseRuleBackendBadRequestCode int = 400 - -/* -CreateHTTPResponseRuleBackendBadRequest Bad request - -swagger:response createHttpResponseRuleBackendBadRequest -*/ -type CreateHTTPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleBackendBadRequest creates CreateHTTPResponseRuleBackendBadRequest with default headers values -func NewCreateHTTPResponseRuleBackendBadRequest() *CreateHTTPResponseRuleBackendBadRequest { - - return &CreateHTTPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule backend bad request response -func (o *CreateHTTPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule backend bad request response -func (o *CreateHTTPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule backend bad request response -func (o *CreateHTTPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateHTTPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule backend bad request response -func (o *CreateHTTPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleBackendConflictCode is the HTTP code returned for type CreateHTTPResponseRuleBackendConflict -const CreateHTTPResponseRuleBackendConflictCode int = 409 - -/* -CreateHTTPResponseRuleBackendConflict The specified resource already exists - -swagger:response createHttpResponseRuleBackendConflict -*/ -type CreateHTTPResponseRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleBackendConflict creates CreateHTTPResponseRuleBackendConflict with default headers values -func NewCreateHTTPResponseRuleBackendConflict() *CreateHTTPResponseRuleBackendConflict { - - return &CreateHTTPResponseRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule backend conflict response -func (o *CreateHTTPResponseRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule backend conflict response -func (o *CreateHTTPResponseRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule backend conflict response -func (o *CreateHTTPResponseRuleBackendConflict) WithPayload(payload *models.Error) *CreateHTTPResponseRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule backend conflict response -func (o *CreateHTTPResponseRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPResponseRuleBackendDefault General Error - -swagger:response createHttpResponseRuleBackendDefault -*/ -type CreateHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleBackendDefault creates CreateHTTPResponseRuleBackendDefault with default headers values -func NewCreateHTTPResponseRuleBackendDefault(code int) *CreateHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) WithStatusCode(code int) *CreateHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *CreateHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP response rule backend default response -func (o *CreateHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/create_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/create_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index 07902121..00000000 --- a/operations/http_response_rule/create_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPResponseRuleBackendURL generates an URL for the create HTTP response rule backend operation -type CreateHTTPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleBackendURL) WithBasePath(bp string) *CreateHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/create_http_response_rule_defaults.go b/operations/http_response_rule/create_http_response_rule_defaults.go deleted file mode 100644 index 00c812cb..00000000 --- a/operations/http_response_rule/create_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a create HTTP response rule defaults handler -type CreateHTTPResponseRuleDefaultsHandlerFunc func(CreateHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPResponseRuleDefaultsHandlerFunc) Handle(params CreateHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPResponseRuleDefaultsHandler interface for that can handle valid create HTTP response rule defaults params -type CreateHTTPResponseRuleDefaultsHandler interface { - Handle(CreateHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateHTTPResponseRuleDefaults creates a new http.Handler for the create HTTP response rule defaults operation -func NewCreateHTTPResponseRuleDefaults(ctx *middleware.Context, handler CreateHTTPResponseRuleDefaultsHandler) *CreateHTTPResponseRuleDefaults { - return &CreateHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateHTTPResponseRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index} HTTPResponseRule createHttpResponseRuleDefaults - -# Add a new HTTP Response Rule - -Adds a new HTTP Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler CreateHTTPResponseRuleDefaultsHandler -} - -func (o *CreateHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/create_http_response_rule_defaults_parameters.go b/operations/http_response_rule/create_http_response_rule_defaults_parameters.go deleted file mode 100644 index d967f025..00000000 --- a/operations/http_response_rule/create_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPResponseRuleDefaultsParams creates a new CreateHTTPResponseRuleDefaultsParams object -// with the default values initialized. -func NewCreateHTTPResponseRuleDefaultsParams() CreateHTTPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPResponseRuleDefaultsParams contains all the bound params for the create HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPResponseRuleDefaults -type CreateHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPResponseRuleDefaultsParams() beforehand. -func (o *CreateHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/create_http_response_rule_defaults_responses.go b/operations/http_response_rule/create_http_response_rule_defaults_responses.go deleted file mode 100644 index 9f991732..00000000 --- a/operations/http_response_rule/create_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPResponseRuleDefaultsCreatedCode is the HTTP code returned for type CreateHTTPResponseRuleDefaultsCreated -const CreateHTTPResponseRuleDefaultsCreatedCode int = 201 - -/* -CreateHTTPResponseRuleDefaultsCreated HTTP Response Rule created - -swagger:response createHttpResponseRuleDefaultsCreated -*/ -type CreateHTTPResponseRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleDefaultsCreated creates CreateHTTPResponseRuleDefaultsCreated with default headers values -func NewCreateHTTPResponseRuleDefaultsCreated() *CreateHTTPResponseRuleDefaultsCreated { - - return &CreateHTTPResponseRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Http response rule defaults created response -func (o *CreateHTTPResponseRuleDefaultsCreated) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule defaults created response -func (o *CreateHTTPResponseRuleDefaultsCreated) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type CreateHTTPResponseRuleDefaultsAccepted -const CreateHTTPResponseRuleDefaultsAcceptedCode int = 202 - -/* -CreateHTTPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createHttpResponseRuleDefaultsAccepted -*/ -type CreateHTTPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleDefaultsAccepted creates CreateHTTPResponseRuleDefaultsAccepted with default headers values -func NewCreateHTTPResponseRuleDefaultsAccepted() *CreateHTTPResponseRuleDefaultsAccepted { - - return &CreateHTTPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Http response rule defaults accepted response -func (o *CreateHTTPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateHTTPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http response rule defaults accepted response -func (o *CreateHTTPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http response rule defaults accepted response -func (o *CreateHTTPResponseRuleDefaultsAccepted) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule defaults accepted response -func (o *CreateHTTPResponseRuleDefaultsAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type CreateHTTPResponseRuleDefaultsBadRequest -const CreateHTTPResponseRuleDefaultsBadRequestCode int = 400 - -/* -CreateHTTPResponseRuleDefaultsBadRequest Bad request - -swagger:response createHttpResponseRuleDefaultsBadRequest -*/ -type CreateHTTPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleDefaultsBadRequest creates CreateHTTPResponseRuleDefaultsBadRequest with default headers values -func NewCreateHTTPResponseRuleDefaultsBadRequest() *CreateHTTPResponseRuleDefaultsBadRequest { - - return &CreateHTTPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule defaults bad request response -func (o *CreateHTTPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule defaults bad request response -func (o *CreateHTTPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule defaults bad request response -func (o *CreateHTTPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateHTTPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule defaults bad request response -func (o *CreateHTTPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleDefaultsConflictCode is the HTTP code returned for type CreateHTTPResponseRuleDefaultsConflict -const CreateHTTPResponseRuleDefaultsConflictCode int = 409 - -/* -CreateHTTPResponseRuleDefaultsConflict The specified resource already exists - -swagger:response createHttpResponseRuleDefaultsConflict -*/ -type CreateHTTPResponseRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleDefaultsConflict creates CreateHTTPResponseRuleDefaultsConflict with default headers values -func NewCreateHTTPResponseRuleDefaultsConflict() *CreateHTTPResponseRuleDefaultsConflict { - - return &CreateHTTPResponseRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule defaults conflict response -func (o *CreateHTTPResponseRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule defaults conflict response -func (o *CreateHTTPResponseRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule defaults conflict response -func (o *CreateHTTPResponseRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateHTTPResponseRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule defaults conflict response -func (o *CreateHTTPResponseRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPResponseRuleDefaultsDefault General Error - -swagger:response createHttpResponseRuleDefaultsDefault -*/ -type CreateHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleDefaultsDefault creates CreateHTTPResponseRuleDefaultsDefault with default headers values -func NewCreateHTTPResponseRuleDefaultsDefault(code int) *CreateHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *CreateHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP response rule defaults default response -func (o *CreateHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/create_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/create_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 493aa6ac..00000000 --- a/operations/http_response_rule/create_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPResponseRuleDefaultsURL generates an URL for the create HTTP response rule defaults operation -type CreateHTTPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *CreateHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/create_http_response_rule_frontend.go b/operations/http_response_rule/create_http_response_rule_frontend.go deleted file mode 100644 index 7a701f4c..00000000 --- a/operations/http_response_rule/create_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a create HTTP response rule frontend handler -type CreateHTTPResponseRuleFrontendHandlerFunc func(CreateHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateHTTPResponseRuleFrontendHandlerFunc) Handle(params CreateHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateHTTPResponseRuleFrontendHandler interface for that can handle valid create HTTP response rule frontend params -type CreateHTTPResponseRuleFrontendHandler interface { - Handle(CreateHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateHTTPResponseRuleFrontend creates a new http.Handler for the create HTTP response rule frontend operation -func NewCreateHTTPResponseRuleFrontend(ctx *middleware.Context, handler CreateHTTPResponseRuleFrontendHandler) *CreateHTTPResponseRuleFrontend { - return &CreateHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateHTTPResponseRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index} HTTPResponseRule createHttpResponseRuleFrontend - -# Add a new HTTP Response Rule - -Adds a new HTTP Response Rule of the specified type in the specified parent. -*/ -type CreateHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler CreateHTTPResponseRuleFrontendHandler -} - -func (o *CreateHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/create_http_response_rule_frontend_parameters.go b/operations/http_response_rule/create_http_response_rule_frontend_parameters.go deleted file mode 100644 index f700f54c..00000000 --- a/operations/http_response_rule/create_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateHTTPResponseRuleFrontendParams creates a new CreateHTTPResponseRuleFrontendParams object -// with the default values initialized. -func NewCreateHTTPResponseRuleFrontendParams() CreateHTTPResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateHTTPResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateHTTPResponseRuleFrontendParams contains all the bound params for the create HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createHTTPResponseRuleFrontend -type CreateHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateHTTPResponseRuleFrontendParams() beforehand. -func (o *CreateHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateHTTPResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateHTTPResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateHTTPResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateHTTPResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/create_http_response_rule_frontend_responses.go b/operations/http_response_rule/create_http_response_rule_frontend_responses.go deleted file mode 100644 index b296f2d0..00000000 --- a/operations/http_response_rule/create_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateHTTPResponseRuleFrontendCreatedCode is the HTTP code returned for type CreateHTTPResponseRuleFrontendCreated -const CreateHTTPResponseRuleFrontendCreatedCode int = 201 - -/* -CreateHTTPResponseRuleFrontendCreated HTTP Response Rule created - -swagger:response createHttpResponseRuleFrontendCreated -*/ -type CreateHTTPResponseRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleFrontendCreated creates CreateHTTPResponseRuleFrontendCreated with default headers values -func NewCreateHTTPResponseRuleFrontendCreated() *CreateHTTPResponseRuleFrontendCreated { - - return &CreateHTTPResponseRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Http response rule frontend created response -func (o *CreateHTTPResponseRuleFrontendCreated) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule frontend created response -func (o *CreateHTTPResponseRuleFrontendCreated) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleFrontendAcceptedCode is the HTTP code returned for type CreateHTTPResponseRuleFrontendAccepted -const CreateHTTPResponseRuleFrontendAcceptedCode int = 202 - -/* -CreateHTTPResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createHttpResponseRuleFrontendAccepted -*/ -type CreateHTTPResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleFrontendAccepted creates CreateHTTPResponseRuleFrontendAccepted with default headers values -func NewCreateHTTPResponseRuleFrontendAccepted() *CreateHTTPResponseRuleFrontendAccepted { - - return &CreateHTTPResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Http response rule frontend accepted response -func (o *CreateHTTPResponseRuleFrontendAccepted) WithReloadID(reloadID string) *CreateHTTPResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Http response rule frontend accepted response -func (o *CreateHTTPResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Http response rule frontend accepted response -func (o *CreateHTTPResponseRuleFrontendAccepted) WithPayload(payload *models.HTTPResponseRule) *CreateHTTPResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule frontend accepted response -func (o *CreateHTTPResponseRuleFrontendAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleFrontendBadRequestCode is the HTTP code returned for type CreateHTTPResponseRuleFrontendBadRequest -const CreateHTTPResponseRuleFrontendBadRequestCode int = 400 - -/* -CreateHTTPResponseRuleFrontendBadRequest Bad request - -swagger:response createHttpResponseRuleFrontendBadRequest -*/ -type CreateHTTPResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleFrontendBadRequest creates CreateHTTPResponseRuleFrontendBadRequest with default headers values -func NewCreateHTTPResponseRuleFrontendBadRequest() *CreateHTTPResponseRuleFrontendBadRequest { - - return &CreateHTTPResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule frontend bad request response -func (o *CreateHTTPResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule frontend bad request response -func (o *CreateHTTPResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule frontend bad request response -func (o *CreateHTTPResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateHTTPResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule frontend bad request response -func (o *CreateHTTPResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateHTTPResponseRuleFrontendConflictCode is the HTTP code returned for type CreateHTTPResponseRuleFrontendConflict -const CreateHTTPResponseRuleFrontendConflictCode int = 409 - -/* -CreateHTTPResponseRuleFrontendConflict The specified resource already exists - -swagger:response createHttpResponseRuleFrontendConflict -*/ -type CreateHTTPResponseRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleFrontendConflict creates CreateHTTPResponseRuleFrontendConflict with default headers values -func NewCreateHTTPResponseRuleFrontendConflict() *CreateHTTPResponseRuleFrontendConflict { - - return &CreateHTTPResponseRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Http response rule frontend conflict response -func (o *CreateHTTPResponseRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Http response rule frontend conflict response -func (o *CreateHTTPResponseRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Http response rule frontend conflict response -func (o *CreateHTTPResponseRuleFrontendConflict) WithPayload(payload *models.Error) *CreateHTTPResponseRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Http response rule frontend conflict response -func (o *CreateHTTPResponseRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateHTTPResponseRuleFrontendDefault General Error - -swagger:response createHttpResponseRuleFrontendDefault -*/ -type CreateHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateHTTPResponseRuleFrontendDefault creates CreateHTTPResponseRuleFrontendDefault with default headers values -func NewCreateHTTPResponseRuleFrontendDefault(code int) *CreateHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *CreateHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *CreateHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create HTTP response rule frontend default response -func (o *CreateHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/create_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/create_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 511206ed..00000000 --- a/operations/http_response_rule/create_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateHTTPResponseRuleFrontendURL generates an URL for the create HTTP response rule frontend operation -type CreateHTTPResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleFrontendURL) WithBasePath(bp string) *CreateHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateHTTPResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/delete_http_response_rule_backend.go b/operations/http_response_rule/delete_http_response_rule_backend.go deleted file mode 100644 index bc9fbd21..00000000 --- a/operations/http_response_rule/delete_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a delete HTTP response rule backend handler -type DeleteHTTPResponseRuleBackendHandlerFunc func(DeleteHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPResponseRuleBackendHandlerFunc) Handle(params DeleteHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPResponseRuleBackendHandler interface for that can handle valid delete HTTP response rule backend params -type DeleteHTTPResponseRuleBackendHandler interface { - Handle(DeleteHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPResponseRuleBackend creates a new http.Handler for the delete HTTP response rule backend operation -func NewDeleteHTTPResponseRuleBackend(ctx *middleware.Context, handler DeleteHTTPResponseRuleBackendHandler) *DeleteHTTPResponseRuleBackend { - return &DeleteHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPResponseRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index} HTTPResponseRule deleteHttpResponseRuleBackend - -# Delete a HTTP Response Rule - -Deletes a HTTP Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler DeleteHTTPResponseRuleBackendHandler -} - -func (o *DeleteHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/delete_http_response_rule_backend_parameters.go b/operations/http_response_rule/delete_http_response_rule_backend_parameters.go deleted file mode 100644 index a038ceb2..00000000 --- a/operations/http_response_rule/delete_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPResponseRuleBackendParams creates a new DeleteHTTPResponseRuleBackendParams object -// with the default values initialized. -func NewDeleteHTTPResponseRuleBackendParams() DeleteHTTPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPResponseRuleBackendParams contains all the bound params for the delete HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPResponseRuleBackend -type DeleteHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPResponseRuleBackendParams() beforehand. -func (o *DeleteHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/delete_http_response_rule_backend_responses.go b/operations/http_response_rule/delete_http_response_rule_backend_responses.go deleted file mode 100644 index ac0d1584..00000000 --- a/operations/http_response_rule/delete_http_response_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPResponseRuleBackendAcceptedCode is the HTTP code returned for type DeleteHTTPResponseRuleBackendAccepted -const DeleteHTTPResponseRuleBackendAcceptedCode int = 202 - -/* -DeleteHTTPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpResponseRuleBackendAccepted -*/ -type DeleteHTTPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPResponseRuleBackendAccepted creates DeleteHTTPResponseRuleBackendAccepted with default headers values -func NewDeleteHTTPResponseRuleBackendAccepted() *DeleteHTTPResponseRuleBackendAccepted { - - return &DeleteHTTPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http response rule backend accepted response -func (o *DeleteHTTPResponseRuleBackendAccepted) WithReloadID(reloadID string) *DeleteHTTPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http response rule backend accepted response -func (o *DeleteHTTPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPResponseRuleBackendNoContentCode is the HTTP code returned for type DeleteHTTPResponseRuleBackendNoContent -const DeleteHTTPResponseRuleBackendNoContentCode int = 204 - -/* -DeleteHTTPResponseRuleBackendNoContent HTTP Response Rule deleted - -swagger:response deleteHttpResponseRuleBackendNoContent -*/ -type DeleteHTTPResponseRuleBackendNoContent struct { -} - -// NewDeleteHTTPResponseRuleBackendNoContent creates DeleteHTTPResponseRuleBackendNoContent with default headers values -func NewDeleteHTTPResponseRuleBackendNoContent() *DeleteHTTPResponseRuleBackendNoContent { - - return &DeleteHTTPResponseRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPResponseRuleBackendNotFoundCode is the HTTP code returned for type DeleteHTTPResponseRuleBackendNotFound -const DeleteHTTPResponseRuleBackendNotFoundCode int = 404 - -/* -DeleteHTTPResponseRuleBackendNotFound The specified resource was not found - -swagger:response deleteHttpResponseRuleBackendNotFound -*/ -type DeleteHTTPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleBackendNotFound creates DeleteHTTPResponseRuleBackendNotFound with default headers values -func NewDeleteHTTPResponseRuleBackendNotFound() *DeleteHTTPResponseRuleBackendNotFound { - - return &DeleteHTTPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http response rule backend not found response -func (o *DeleteHTTPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http response rule backend not found response -func (o *DeleteHTTPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http response rule backend not found response -func (o *DeleteHTTPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http response rule backend not found response -func (o *DeleteHTTPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPResponseRuleBackendDefault General Error - -swagger:response deleteHttpResponseRuleBackendDefault -*/ -type DeleteHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleBackendDefault creates DeleteHTTPResponseRuleBackendDefault with default headers values -func NewDeleteHTTPResponseRuleBackendDefault(code int) *DeleteHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) WithStatusCode(code int) *DeleteHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP response rule backend default response -func (o *DeleteHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/delete_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/delete_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index d5e551be..00000000 --- a/operations/http_response_rule/delete_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPResponseRuleBackendURL generates an URL for the delete HTTP response rule backend operation -type DeleteHTTPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleBackendURL) WithBasePath(bp string) *DeleteHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/delete_http_response_rule_defaults.go b/operations/http_response_rule/delete_http_response_rule_defaults.go deleted file mode 100644 index fa6af86e..00000000 --- a/operations/http_response_rule/delete_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a delete HTTP response rule defaults handler -type DeleteHTTPResponseRuleDefaultsHandlerFunc func(DeleteHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPResponseRuleDefaultsHandlerFunc) Handle(params DeleteHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPResponseRuleDefaultsHandler interface for that can handle valid delete HTTP response rule defaults params -type DeleteHTTPResponseRuleDefaultsHandler interface { - Handle(DeleteHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPResponseRuleDefaults creates a new http.Handler for the delete HTTP response rule defaults operation -func NewDeleteHTTPResponseRuleDefaults(ctx *middleware.Context, handler DeleteHTTPResponseRuleDefaultsHandler) *DeleteHTTPResponseRuleDefaults { - return &DeleteHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPResponseRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index} HTTPResponseRule deleteHttpResponseRuleDefaults - -# Delete a HTTP Response Rule - -Deletes a HTTP Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler DeleteHTTPResponseRuleDefaultsHandler -} - -func (o *DeleteHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/delete_http_response_rule_defaults_parameters.go b/operations/http_response_rule/delete_http_response_rule_defaults_parameters.go deleted file mode 100644 index 5b206894..00000000 --- a/operations/http_response_rule/delete_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPResponseRuleDefaultsParams creates a new DeleteHTTPResponseRuleDefaultsParams object -// with the default values initialized. -func NewDeleteHTTPResponseRuleDefaultsParams() DeleteHTTPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPResponseRuleDefaultsParams contains all the bound params for the delete HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPResponseRuleDefaults -type DeleteHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPResponseRuleDefaultsParams() beforehand. -func (o *DeleteHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/delete_http_response_rule_defaults_responses.go b/operations/http_response_rule/delete_http_response_rule_defaults_responses.go deleted file mode 100644 index 05e89310..00000000 --- a/operations/http_response_rule/delete_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteHTTPResponseRuleDefaultsAccepted -const DeleteHTTPResponseRuleDefaultsAcceptedCode int = 202 - -/* -DeleteHTTPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpResponseRuleDefaultsAccepted -*/ -type DeleteHTTPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPResponseRuleDefaultsAccepted creates DeleteHTTPResponseRuleDefaultsAccepted with default headers values -func NewDeleteHTTPResponseRuleDefaultsAccepted() *DeleteHTTPResponseRuleDefaultsAccepted { - - return &DeleteHTTPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http response rule defaults accepted response -func (o *DeleteHTTPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteHTTPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http response rule defaults accepted response -func (o *DeleteHTTPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPResponseRuleDefaultsNoContentCode is the HTTP code returned for type DeleteHTTPResponseRuleDefaultsNoContent -const DeleteHTTPResponseRuleDefaultsNoContentCode int = 204 - -/* -DeleteHTTPResponseRuleDefaultsNoContent HTTP Response Rule deleted - -swagger:response deleteHttpResponseRuleDefaultsNoContent -*/ -type DeleteHTTPResponseRuleDefaultsNoContent struct { -} - -// NewDeleteHTTPResponseRuleDefaultsNoContent creates DeleteHTTPResponseRuleDefaultsNoContent with default headers values -func NewDeleteHTTPResponseRuleDefaultsNoContent() *DeleteHTTPResponseRuleDefaultsNoContent { - - return &DeleteHTTPResponseRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteHTTPResponseRuleDefaultsNotFound -const DeleteHTTPResponseRuleDefaultsNotFoundCode int = 404 - -/* -DeleteHTTPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteHttpResponseRuleDefaultsNotFound -*/ -type DeleteHTTPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleDefaultsNotFound creates DeleteHTTPResponseRuleDefaultsNotFound with default headers values -func NewDeleteHTTPResponseRuleDefaultsNotFound() *DeleteHTTPResponseRuleDefaultsNotFound { - - return &DeleteHTTPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http response rule defaults not found response -func (o *DeleteHTTPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http response rule defaults not found response -func (o *DeleteHTTPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http response rule defaults not found response -func (o *DeleteHTTPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http response rule defaults not found response -func (o *DeleteHTTPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPResponseRuleDefaultsDefault General Error - -swagger:response deleteHttpResponseRuleDefaultsDefault -*/ -type DeleteHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleDefaultsDefault creates DeleteHTTPResponseRuleDefaultsDefault with default headers values -func NewDeleteHTTPResponseRuleDefaultsDefault(code int) *DeleteHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *DeleteHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP response rule defaults default response -func (o *DeleteHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/delete_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/delete_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 1b0aba87..00000000 --- a/operations/http_response_rule/delete_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPResponseRuleDefaultsURL generates an URL for the delete HTTP response rule defaults operation -type DeleteHTTPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *DeleteHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/delete_http_response_rule_frontend.go b/operations/http_response_rule/delete_http_response_rule_frontend.go deleted file mode 100644 index 67dd90f8..00000000 --- a/operations/http_response_rule/delete_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a delete HTTP response rule frontend handler -type DeleteHTTPResponseRuleFrontendHandlerFunc func(DeleteHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteHTTPResponseRuleFrontendHandlerFunc) Handle(params DeleteHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteHTTPResponseRuleFrontendHandler interface for that can handle valid delete HTTP response rule frontend params -type DeleteHTTPResponseRuleFrontendHandler interface { - Handle(DeleteHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteHTTPResponseRuleFrontend creates a new http.Handler for the delete HTTP response rule frontend operation -func NewDeleteHTTPResponseRuleFrontend(ctx *middleware.Context, handler DeleteHTTPResponseRuleFrontendHandler) *DeleteHTTPResponseRuleFrontend { - return &DeleteHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteHTTPResponseRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index} HTTPResponseRule deleteHttpResponseRuleFrontend - -# Delete a HTTP Response Rule - -Deletes a HTTP Response Rule configuration by it's index from the specified parent. -*/ -type DeleteHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler DeleteHTTPResponseRuleFrontendHandler -} - -func (o *DeleteHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/delete_http_response_rule_frontend_parameters.go b/operations/http_response_rule/delete_http_response_rule_frontend_parameters.go deleted file mode 100644 index ec5b77ee..00000000 --- a/operations/http_response_rule/delete_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteHTTPResponseRuleFrontendParams creates a new DeleteHTTPResponseRuleFrontendParams object -// with the default values initialized. -func NewDeleteHTTPResponseRuleFrontendParams() DeleteHTTPResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteHTTPResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteHTTPResponseRuleFrontendParams contains all the bound params for the delete HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteHTTPResponseRuleFrontend -type DeleteHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteHTTPResponseRuleFrontendParams() beforehand. -func (o *DeleteHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteHTTPResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteHTTPResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteHTTPResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteHTTPResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/delete_http_response_rule_frontend_responses.go b/operations/http_response_rule/delete_http_response_rule_frontend_responses.go deleted file mode 100644 index 215ea94e..00000000 --- a/operations/http_response_rule/delete_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteHTTPResponseRuleFrontendAcceptedCode is the HTTP code returned for type DeleteHTTPResponseRuleFrontendAccepted -const DeleteHTTPResponseRuleFrontendAcceptedCode int = 202 - -/* -DeleteHTTPResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteHttpResponseRuleFrontendAccepted -*/ -type DeleteHTTPResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteHTTPResponseRuleFrontendAccepted creates DeleteHTTPResponseRuleFrontendAccepted with default headers values -func NewDeleteHTTPResponseRuleFrontendAccepted() *DeleteHTTPResponseRuleFrontendAccepted { - - return &DeleteHTTPResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Http response rule frontend accepted response -func (o *DeleteHTTPResponseRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteHTTPResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Http response rule frontend accepted response -func (o *DeleteHTTPResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteHTTPResponseRuleFrontendNoContentCode is the HTTP code returned for type DeleteHTTPResponseRuleFrontendNoContent -const DeleteHTTPResponseRuleFrontendNoContentCode int = 204 - -/* -DeleteHTTPResponseRuleFrontendNoContent HTTP Response Rule deleted - -swagger:response deleteHttpResponseRuleFrontendNoContent -*/ -type DeleteHTTPResponseRuleFrontendNoContent struct { -} - -// NewDeleteHTTPResponseRuleFrontendNoContent creates DeleteHTTPResponseRuleFrontendNoContent with default headers values -func NewDeleteHTTPResponseRuleFrontendNoContent() *DeleteHTTPResponseRuleFrontendNoContent { - - return &DeleteHTTPResponseRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteHTTPResponseRuleFrontendNotFoundCode is the HTTP code returned for type DeleteHTTPResponseRuleFrontendNotFound -const DeleteHTTPResponseRuleFrontendNotFoundCode int = 404 - -/* -DeleteHTTPResponseRuleFrontendNotFound The specified resource was not found - -swagger:response deleteHttpResponseRuleFrontendNotFound -*/ -type DeleteHTTPResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleFrontendNotFound creates DeleteHTTPResponseRuleFrontendNotFound with default headers values -func NewDeleteHTTPResponseRuleFrontendNotFound() *DeleteHTTPResponseRuleFrontendNotFound { - - return &DeleteHTTPResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Http response rule frontend not found response -func (o *DeleteHTTPResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Http response rule frontend not found response -func (o *DeleteHTTPResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Http response rule frontend not found response -func (o *DeleteHTTPResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Http response rule frontend not found response -func (o *DeleteHTTPResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteHTTPResponseRuleFrontendDefault General Error - -swagger:response deleteHttpResponseRuleFrontendDefault -*/ -type DeleteHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteHTTPResponseRuleFrontendDefault creates DeleteHTTPResponseRuleFrontendDefault with default headers values -func NewDeleteHTTPResponseRuleFrontendDefault(code int) *DeleteHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *DeleteHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete HTTP response rule frontend default response -func (o *DeleteHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/delete_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/delete_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 36df31b5..00000000 --- a/operations/http_response_rule/delete_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteHTTPResponseRuleFrontendURL generates an URL for the delete HTTP response rule frontend operation -type DeleteHTTPResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleFrontendURL) WithBasePath(bp string) *DeleteHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteHTTPResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_all_http_response_rule_backend.go b/operations/http_response_rule/get_all_http_response_rule_backend.go deleted file mode 100644 index 929a58a1..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a get all HTTP response rule backend handler -type GetAllHTTPResponseRuleBackendHandlerFunc func(GetAllHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPResponseRuleBackendHandlerFunc) Handle(params GetAllHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPResponseRuleBackendHandler interface for that can handle valid get all HTTP response rule backend params -type GetAllHTTPResponseRuleBackendHandler interface { - Handle(GetAllHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPResponseRuleBackend creates a new http.Handler for the get all HTTP response rule backend operation -func NewGetAllHTTPResponseRuleBackend(ctx *middleware.Context, handler GetAllHTTPResponseRuleBackendHandler) *GetAllHTTPResponseRuleBackend { - return &GetAllHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules HTTPResponseRule getAllHttpResponseRuleBackend - -# Return an array of all HTTP Response Rules - -Returns all HTTP Response Rules that are configured in specified parent. -*/ -type GetAllHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler GetAllHTTPResponseRuleBackendHandler -} - -func (o *GetAllHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_all_http_response_rule_backend_parameters.go b/operations/http_response_rule/get_all_http_response_rule_backend_parameters.go deleted file mode 100644 index 4f9d5de5..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPResponseRuleBackendParams creates a new GetAllHTTPResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPResponseRuleBackendParams() GetAllHTTPResponseRuleBackendParams { - - return GetAllHTTPResponseRuleBackendParams{} -} - -// GetAllHTTPResponseRuleBackendParams contains all the bound params for the get all HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPResponseRuleBackend -type GetAllHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPResponseRuleBackendParams() beforehand. -func (o *GetAllHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_all_http_response_rule_backend_responses.go b/operations/http_response_rule/get_all_http_response_rule_backend_responses.go deleted file mode 100644 index 8dcce087..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPResponseRuleBackendOKCode is the HTTP code returned for type GetAllHTTPResponseRuleBackendOK -const GetAllHTTPResponseRuleBackendOKCode int = 200 - -/* -GetAllHTTPResponseRuleBackendOK Successful operation - -swagger:response getAllHttpResponseRuleBackendOK -*/ -type GetAllHTTPResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleBackendOK creates GetAllHTTPResponseRuleBackendOK with default headers values -func NewGetAllHTTPResponseRuleBackendOK() *GetAllHTTPResponseRuleBackendOK { - - return &GetAllHTTPResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http response rule backend o k response -func (o *GetAllHTTPResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http response rule backend o k response -func (o *GetAllHTTPResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http response rule backend o k response -func (o *GetAllHTTPResponseRuleBackendOK) WithPayload(payload models.HTTPResponseRules) *GetAllHTTPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http response rule backend o k response -func (o *GetAllHTTPResponseRuleBackendOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPResponseRuleBackendDefault General Error - -swagger:response getAllHttpResponseRuleBackendDefault -*/ -type GetAllHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleBackendDefault creates GetAllHTTPResponseRuleBackendDefault with default headers values -func NewGetAllHTTPResponseRuleBackendDefault(code int) *GetAllHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) WithStatusCode(code int) *GetAllHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetAllHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP response rule backend default response -func (o *GetAllHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_all_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/get_all_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index 34f283e4..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPResponseRuleBackendURL generates an URL for the get all HTTP response rule backend operation -type GetAllHTTPResponseRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleBackendURL) WithBasePath(bp string) *GetAllHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_all_http_response_rule_defaults.go b/operations/http_response_rule/get_all_http_response_rule_defaults.go deleted file mode 100644 index e3ef40ae..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get all HTTP response rule defaults handler -type GetAllHTTPResponseRuleDefaultsHandlerFunc func(GetAllHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPResponseRuleDefaultsHandlerFunc) Handle(params GetAllHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPResponseRuleDefaultsHandler interface for that can handle valid get all HTTP response rule defaults params -type GetAllHTTPResponseRuleDefaultsHandler interface { - Handle(GetAllHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPResponseRuleDefaults creates a new http.Handler for the get all HTTP response rule defaults operation -func NewGetAllHTTPResponseRuleDefaults(ctx *middleware.Context, handler GetAllHTTPResponseRuleDefaultsHandler) *GetAllHTTPResponseRuleDefaults { - return &GetAllHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules HTTPResponseRule getAllHttpResponseRuleDefaults - -# Return an array of all HTTP Response Rules - -Returns all HTTP Response Rules that are configured in specified parent. -*/ -type GetAllHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler GetAllHTTPResponseRuleDefaultsHandler -} - -func (o *GetAllHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_all_http_response_rule_defaults_parameters.go b/operations/http_response_rule/get_all_http_response_rule_defaults_parameters.go deleted file mode 100644 index 085c476a..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPResponseRuleDefaultsParams creates a new GetAllHTTPResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPResponseRuleDefaultsParams() GetAllHTTPResponseRuleDefaultsParams { - - return GetAllHTTPResponseRuleDefaultsParams{} -} - -// GetAllHTTPResponseRuleDefaultsParams contains all the bound params for the get all HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPResponseRuleDefaults -type GetAllHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPResponseRuleDefaultsParams() beforehand. -func (o *GetAllHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_all_http_response_rule_defaults_responses.go b/operations/http_response_rule/get_all_http_response_rule_defaults_responses.go deleted file mode 100644 index 71ec2f10..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPResponseRuleDefaultsOKCode is the HTTP code returned for type GetAllHTTPResponseRuleDefaultsOK -const GetAllHTTPResponseRuleDefaultsOKCode int = 200 - -/* -GetAllHTTPResponseRuleDefaultsOK Successful operation - -swagger:response getAllHttpResponseRuleDefaultsOK -*/ -type GetAllHTTPResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleDefaultsOK creates GetAllHTTPResponseRuleDefaultsOK with default headers values -func NewGetAllHTTPResponseRuleDefaultsOK() *GetAllHTTPResponseRuleDefaultsOK { - - return &GetAllHTTPResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http response rule defaults o k response -func (o *GetAllHTTPResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http response rule defaults o k response -func (o *GetAllHTTPResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http response rule defaults o k response -func (o *GetAllHTTPResponseRuleDefaultsOK) WithPayload(payload models.HTTPResponseRules) *GetAllHTTPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http response rule defaults o k response -func (o *GetAllHTTPResponseRuleDefaultsOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPResponseRuleDefaultsDefault General Error - -swagger:response getAllHttpResponseRuleDefaultsDefault -*/ -type GetAllHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleDefaultsDefault creates GetAllHTTPResponseRuleDefaultsDefault with default headers values -func NewGetAllHTTPResponseRuleDefaultsDefault(code int) *GetAllHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *GetAllHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP response rule defaults default response -func (o *GetAllHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_all_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/get_all_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 4cf22af9..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPResponseRuleDefaultsURL generates an URL for the get all HTTP response rule defaults operation -type GetAllHTTPResponseRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *GetAllHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_all_http_response_rule_frontend.go b/operations/http_response_rule/get_all_http_response_rule_frontend.go deleted file mode 100644 index 94440698..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a get all HTTP response rule frontend handler -type GetAllHTTPResponseRuleFrontendHandlerFunc func(GetAllHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllHTTPResponseRuleFrontendHandlerFunc) Handle(params GetAllHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllHTTPResponseRuleFrontendHandler interface for that can handle valid get all HTTP response rule frontend params -type GetAllHTTPResponseRuleFrontendHandler interface { - Handle(GetAllHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllHTTPResponseRuleFrontend creates a new http.Handler for the get all HTTP response rule frontend operation -func NewGetAllHTTPResponseRuleFrontend(ctx *middleware.Context, handler GetAllHTTPResponseRuleFrontendHandler) *GetAllHTTPResponseRuleFrontend { - return &GetAllHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllHTTPResponseRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules HTTPResponseRule getAllHttpResponseRuleFrontend - -# Return an array of all HTTP Response Rules - -Returns all HTTP Response Rules that are configured in specified parent. -*/ -type GetAllHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler GetAllHTTPResponseRuleFrontendHandler -} - -func (o *GetAllHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_all_http_response_rule_frontend_parameters.go b/operations/http_response_rule/get_all_http_response_rule_frontend_parameters.go deleted file mode 100644 index 0c4a366e..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllHTTPResponseRuleFrontendParams creates a new GetAllHTTPResponseRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllHTTPResponseRuleFrontendParams() GetAllHTTPResponseRuleFrontendParams { - - return GetAllHTTPResponseRuleFrontendParams{} -} - -// GetAllHTTPResponseRuleFrontendParams contains all the bound params for the get all HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllHTTPResponseRuleFrontend -type GetAllHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllHTTPResponseRuleFrontendParams() beforehand. -func (o *GetAllHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_all_http_response_rule_frontend_responses.go b/operations/http_response_rule/get_all_http_response_rule_frontend_responses.go deleted file mode 100644 index 8b22206d..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllHTTPResponseRuleFrontendOKCode is the HTTP code returned for type GetAllHTTPResponseRuleFrontendOK -const GetAllHTTPResponseRuleFrontendOKCode int = 200 - -/* -GetAllHTTPResponseRuleFrontendOK Successful operation - -swagger:response getAllHttpResponseRuleFrontendOK -*/ -type GetAllHTTPResponseRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleFrontendOK creates GetAllHTTPResponseRuleFrontendOK with default headers values -func NewGetAllHTTPResponseRuleFrontendOK() *GetAllHTTPResponseRuleFrontendOK { - - return &GetAllHTTPResponseRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Http response rule frontend o k response -func (o *GetAllHTTPResponseRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Http response rule frontend o k response -func (o *GetAllHTTPResponseRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Http response rule frontend o k response -func (o *GetAllHTTPResponseRuleFrontendOK) WithPayload(payload models.HTTPResponseRules) *GetAllHTTPResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Http response rule frontend o k response -func (o *GetAllHTTPResponseRuleFrontendOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllHTTPResponseRuleFrontendDefault General Error - -swagger:response getAllHttpResponseRuleFrontendDefault -*/ -type GetAllHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllHTTPResponseRuleFrontendDefault creates GetAllHTTPResponseRuleFrontendDefault with default headers values -func NewGetAllHTTPResponseRuleFrontendDefault(code int) *GetAllHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *GetAllHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all HTTP response rule frontend default response -func (o *GetAllHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_all_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/get_all_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 8f58a3d8..00000000 --- a/operations/http_response_rule/get_all_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllHTTPResponseRuleFrontendURL generates an URL for the get all HTTP response rule frontend operation -type GetAllHTTPResponseRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleFrontendURL) WithBasePath(bp string) *GetAllHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_http_response_rule_backend.go b/operations/http_response_rule/get_http_response_rule_backend.go deleted file mode 100644 index db89ebff..00000000 --- a/operations/http_response_rule/get_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a get HTTP response rule backend handler -type GetHTTPResponseRuleBackendHandlerFunc func(GetHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPResponseRuleBackendHandlerFunc) Handle(params GetHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPResponseRuleBackendHandler interface for that can handle valid get HTTP response rule backend params -type GetHTTPResponseRuleBackendHandler interface { - Handle(GetHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetHTTPResponseRuleBackend creates a new http.Handler for the get HTTP response rule backend operation -func NewGetHTTPResponseRuleBackend(ctx *middleware.Context, handler GetHTTPResponseRuleBackendHandler) *GetHTTPResponseRuleBackend { - return &GetHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetHTTPResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index} HTTPResponseRule getHttpResponseRuleBackend - -# Return one HTTP Response Rule - -Returns one HTTP Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler GetHTTPResponseRuleBackendHandler -} - -func (o *GetHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_http_response_rule_backend_parameters.go b/operations/http_response_rule/get_http_response_rule_backend_parameters.go deleted file mode 100644 index 53be771f..00000000 --- a/operations/http_response_rule/get_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPResponseRuleBackendParams creates a new GetHTTPResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPResponseRuleBackendParams() GetHTTPResponseRuleBackendParams { - - return GetHTTPResponseRuleBackendParams{} -} - -// GetHTTPResponseRuleBackendParams contains all the bound params for the get HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPResponseRuleBackend -type GetHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPResponseRuleBackendParams() beforehand. -func (o *GetHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_http_response_rule_backend_responses.go b/operations/http_response_rule/get_http_response_rule_backend_responses.go deleted file mode 100644 index a3c957d8..00000000 --- a/operations/http_response_rule/get_http_response_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPResponseRuleBackendOKCode is the HTTP code returned for type GetHTTPResponseRuleBackendOK -const GetHTTPResponseRuleBackendOKCode int = 200 - -/* -GetHTTPResponseRuleBackendOK Successful operation - -swagger:response getHttpResponseRuleBackendOK -*/ -type GetHTTPResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleBackendOK creates GetHTTPResponseRuleBackendOK with default headers values -func NewGetHTTPResponseRuleBackendOK() *GetHTTPResponseRuleBackendOK { - - return &GetHTTPResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule backend o k response -func (o *GetHTTPResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule backend o k response -func (o *GetHTTPResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule backend o k response -func (o *GetHTTPResponseRuleBackendOK) WithPayload(payload *models.HTTPResponseRule) *GetHTTPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule backend o k response -func (o *GetHTTPResponseRuleBackendOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPResponseRuleBackendNotFoundCode is the HTTP code returned for type GetHTTPResponseRuleBackendNotFound -const GetHTTPResponseRuleBackendNotFoundCode int = 404 - -/* -GetHTTPResponseRuleBackendNotFound The specified resource was not found - -swagger:response getHttpResponseRuleBackendNotFound -*/ -type GetHTTPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleBackendNotFound creates GetHTTPResponseRuleBackendNotFound with default headers values -func NewGetHTTPResponseRuleBackendNotFound() *GetHTTPResponseRuleBackendNotFound { - - return &GetHTTPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule backend not found response -func (o *GetHTTPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule backend not found response -func (o *GetHTTPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule backend not found response -func (o *GetHTTPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *GetHTTPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule backend not found response -func (o *GetHTTPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPResponseRuleBackendDefault General Error - -swagger:response getHttpResponseRuleBackendDefault -*/ -type GetHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleBackendDefault creates GetHTTPResponseRuleBackendDefault with default headers values -func NewGetHTTPResponseRuleBackendDefault(code int) *GetHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) WithStatusCode(code int) *GetHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP response rule backend default response -func (o *GetHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/get_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index 8009c090..00000000 --- a/operations/http_response_rule/get_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPResponseRuleBackendURL generates an URL for the get HTTP response rule backend operation -type GetHTTPResponseRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleBackendURL) WithBasePath(bp string) *GetHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_http_response_rule_defaults.go b/operations/http_response_rule/get_http_response_rule_defaults.go deleted file mode 100644 index 50ad5096..00000000 --- a/operations/http_response_rule/get_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get HTTP response rule defaults handler -type GetHTTPResponseRuleDefaultsHandlerFunc func(GetHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPResponseRuleDefaultsHandlerFunc) Handle(params GetHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPResponseRuleDefaultsHandler interface for that can handle valid get HTTP response rule defaults params -type GetHTTPResponseRuleDefaultsHandler interface { - Handle(GetHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetHTTPResponseRuleDefaults creates a new http.Handler for the get HTTP response rule defaults operation -func NewGetHTTPResponseRuleDefaults(ctx *middleware.Context, handler GetHTTPResponseRuleDefaultsHandler) *GetHTTPResponseRuleDefaults { - return &GetHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetHTTPResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index} HTTPResponseRule getHttpResponseRuleDefaults - -# Return one HTTP Response Rule - -Returns one HTTP Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler GetHTTPResponseRuleDefaultsHandler -} - -func (o *GetHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_http_response_rule_defaults_parameters.go b/operations/http_response_rule/get_http_response_rule_defaults_parameters.go deleted file mode 100644 index c9ef817e..00000000 --- a/operations/http_response_rule/get_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPResponseRuleDefaultsParams creates a new GetHTTPResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetHTTPResponseRuleDefaultsParams() GetHTTPResponseRuleDefaultsParams { - - return GetHTTPResponseRuleDefaultsParams{} -} - -// GetHTTPResponseRuleDefaultsParams contains all the bound params for the get HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPResponseRuleDefaults -type GetHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPResponseRuleDefaultsParams() beforehand. -func (o *GetHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_http_response_rule_defaults_responses.go b/operations/http_response_rule/get_http_response_rule_defaults_responses.go deleted file mode 100644 index 643fdd3e..00000000 --- a/operations/http_response_rule/get_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPResponseRuleDefaultsOKCode is the HTTP code returned for type GetHTTPResponseRuleDefaultsOK -const GetHTTPResponseRuleDefaultsOKCode int = 200 - -/* -GetHTTPResponseRuleDefaultsOK Successful operation - -swagger:response getHttpResponseRuleDefaultsOK -*/ -type GetHTTPResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleDefaultsOK creates GetHTTPResponseRuleDefaultsOK with default headers values -func NewGetHTTPResponseRuleDefaultsOK() *GetHTTPResponseRuleDefaultsOK { - - return &GetHTTPResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule defaults o k response -func (o *GetHTTPResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule defaults o k response -func (o *GetHTTPResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule defaults o k response -func (o *GetHTTPResponseRuleDefaultsOK) WithPayload(payload *models.HTTPResponseRule) *GetHTTPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule defaults o k response -func (o *GetHTTPResponseRuleDefaultsOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type GetHTTPResponseRuleDefaultsNotFound -const GetHTTPResponseRuleDefaultsNotFoundCode int = 404 - -/* -GetHTTPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response getHttpResponseRuleDefaultsNotFound -*/ -type GetHTTPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleDefaultsNotFound creates GetHTTPResponseRuleDefaultsNotFound with default headers values -func NewGetHTTPResponseRuleDefaultsNotFound() *GetHTTPResponseRuleDefaultsNotFound { - - return &GetHTTPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule defaults not found response -func (o *GetHTTPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule defaults not found response -func (o *GetHTTPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule defaults not found response -func (o *GetHTTPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetHTTPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule defaults not found response -func (o *GetHTTPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPResponseRuleDefaultsDefault General Error - -swagger:response getHttpResponseRuleDefaultsDefault -*/ -type GetHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleDefaultsDefault creates GetHTTPResponseRuleDefaultsDefault with default headers values -func NewGetHTTPResponseRuleDefaultsDefault(code int) *GetHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *GetHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP response rule defaults default response -func (o *GetHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/get_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 4202975e..00000000 --- a/operations/http_response_rule/get_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPResponseRuleDefaultsURL generates an URL for the get HTTP response rule defaults operation -type GetHTTPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *GetHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/get_http_response_rule_frontend.go b/operations/http_response_rule/get_http_response_rule_frontend.go deleted file mode 100644 index 34fbf140..00000000 --- a/operations/http_response_rule/get_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a get HTTP response rule frontend handler -type GetHTTPResponseRuleFrontendHandlerFunc func(GetHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHTTPResponseRuleFrontendHandlerFunc) Handle(params GetHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHTTPResponseRuleFrontendHandler interface for that can handle valid get HTTP response rule frontend params -type GetHTTPResponseRuleFrontendHandler interface { - Handle(GetHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetHTTPResponseRuleFrontend creates a new http.Handler for the get HTTP response rule frontend operation -func NewGetHTTPResponseRuleFrontend(ctx *middleware.Context, handler GetHTTPResponseRuleFrontendHandler) *GetHTTPResponseRuleFrontend { - return &GetHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetHTTPResponseRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index} HTTPResponseRule getHttpResponseRuleFrontend - -# Return one HTTP Response Rule - -Returns one HTTP Response Rule configuration by it's index in the specified parent. -*/ -type GetHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler GetHTTPResponseRuleFrontendHandler -} - -func (o *GetHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/get_http_response_rule_frontend_parameters.go b/operations/http_response_rule/get_http_response_rule_frontend_parameters.go deleted file mode 100644 index 6e9ee92d..00000000 --- a/operations/http_response_rule/get_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetHTTPResponseRuleFrontendParams creates a new GetHTTPResponseRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetHTTPResponseRuleFrontendParams() GetHTTPResponseRuleFrontendParams { - - return GetHTTPResponseRuleFrontendParams{} -} - -// GetHTTPResponseRuleFrontendParams contains all the bound params for the get HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHTTPResponseRuleFrontend -type GetHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHTTPResponseRuleFrontendParams() beforehand. -func (o *GetHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetHTTPResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/http_response_rule/get_http_response_rule_frontend_responses.go b/operations/http_response_rule/get_http_response_rule_frontend_responses.go deleted file mode 100644 index 5aa4d2b3..00000000 --- a/operations/http_response_rule/get_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHTTPResponseRuleFrontendOKCode is the HTTP code returned for type GetHTTPResponseRuleFrontendOK -const GetHTTPResponseRuleFrontendOKCode int = 200 - -/* -GetHTTPResponseRuleFrontendOK Successful operation - -swagger:response getHttpResponseRuleFrontendOK -*/ -type GetHTTPResponseRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleFrontendOK creates GetHTTPResponseRuleFrontendOK with default headers values -func NewGetHTTPResponseRuleFrontendOK() *GetHTTPResponseRuleFrontendOK { - - return &GetHTTPResponseRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule frontend o k response -func (o *GetHTTPResponseRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule frontend o k response -func (o *GetHTTPResponseRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule frontend o k response -func (o *GetHTTPResponseRuleFrontendOK) WithPayload(payload *models.HTTPResponseRule) *GetHTTPResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule frontend o k response -func (o *GetHTTPResponseRuleFrontendOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetHTTPResponseRuleFrontendNotFoundCode is the HTTP code returned for type GetHTTPResponseRuleFrontendNotFound -const GetHTTPResponseRuleFrontendNotFoundCode int = 404 - -/* -GetHTTPResponseRuleFrontendNotFound The specified resource was not found - -swagger:response getHttpResponseRuleFrontendNotFound -*/ -type GetHTTPResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleFrontendNotFound creates GetHTTPResponseRuleFrontendNotFound with default headers values -func NewGetHTTPResponseRuleFrontendNotFound() *GetHTTPResponseRuleFrontendNotFound { - - return &GetHTTPResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Http response rule frontend not found response -func (o *GetHTTPResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Http response rule frontend not found response -func (o *GetHTTPResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Http response rule frontend not found response -func (o *GetHTTPResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *GetHTTPResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Http response rule frontend not found response -func (o *GetHTTPResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHTTPResponseRuleFrontendDefault General Error - -swagger:response getHttpResponseRuleFrontendDefault -*/ -type GetHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHTTPResponseRuleFrontendDefault creates GetHTTPResponseRuleFrontendDefault with default headers values -func NewGetHTTPResponseRuleFrontendDefault(code int) *GetHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *GetHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *GetHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get HTTP response rule frontend default response -func (o *GetHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/get_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/get_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 0b5635ab..00000000 --- a/operations/http_response_rule/get_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetHTTPResponseRuleFrontendURL generates an URL for the get HTTP response rule frontend operation -type GetHTTPResponseRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleFrontendURL) WithBasePath(bp string) *GetHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetHTTPResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_backend.go b/operations/http_response_rule/replace_all_http_response_rule_backend.go deleted file mode 100644 index ffcf3525..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a replace all HTTP response rule backend handler -type ReplaceAllHTTPResponseRuleBackendHandlerFunc func(ReplaceAllHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPResponseRuleBackendHandlerFunc) Handle(params ReplaceAllHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPResponseRuleBackendHandler interface for that can handle valid replace all HTTP response rule backend params -type ReplaceAllHTTPResponseRuleBackendHandler interface { - Handle(ReplaceAllHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPResponseRuleBackend creates a new http.Handler for the replace all HTTP response rule backend operation -func NewReplaceAllHTTPResponseRuleBackend(ctx *middleware.Context, handler ReplaceAllHTTPResponseRuleBackendHandler) *ReplaceAllHTTPResponseRuleBackend { - return &ReplaceAllHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules HTTPResponseRule replaceAllHttpResponseRuleBackend - -# Replace an HTTP Response Rule list - -Replaces a whole list of HTTP Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllHTTPResponseRuleBackendHandler -} - -func (o *ReplaceAllHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_backend_parameters.go b/operations/http_response_rule/replace_all_http_response_rule_backend_parameters.go deleted file mode 100644 index 2ed736be..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPResponseRuleBackendParams creates a new ReplaceAllHTTPResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceAllHTTPResponseRuleBackendParams() ReplaceAllHTTPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPResponseRuleBackendParams contains all the bound params for the replace all HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPResponseRuleBackend -type ReplaceAllHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPResponseRuleBackendParams() beforehand. -func (o *ReplaceAllHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_backend_responses.go b/operations/http_response_rule/replace_all_http_response_rule_backend_responses.go deleted file mode 100644 index 51dbe4d5..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPResponseRuleBackendOKCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleBackendOK -const ReplaceAllHTTPResponseRuleBackendOKCode int = 200 - -/* -ReplaceAllHTTPResponseRuleBackendOK All HTTP Response Rule lines replaced - -swagger:response replaceAllHttpResponseRuleBackendOK -*/ -type ReplaceAllHTTPResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleBackendOK creates ReplaceAllHTTPResponseRuleBackendOK with default headers values -func NewReplaceAllHTTPResponseRuleBackendOK() *ReplaceAllHTTPResponseRuleBackendOK { - - return &ReplaceAllHTTPResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Http response rule backend o k response -func (o *ReplaceAllHTTPResponseRuleBackendOK) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule backend o k response -func (o *ReplaceAllHTTPResponseRuleBackendOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleBackendAccepted -const ReplaceAllHTTPResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllHTTPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpResponseRuleBackendAccepted -*/ -type ReplaceAllHTTPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleBackendAccepted creates ReplaceAllHTTPResponseRuleBackendAccepted with default headers values -func NewReplaceAllHTTPResponseRuleBackendAccepted() *ReplaceAllHTTPResponseRuleBackendAccepted { - - return &ReplaceAllHTTPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http response rule backend accepted response -func (o *ReplaceAllHTTPResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http response rule backend accepted response -func (o *ReplaceAllHTTPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http response rule backend accepted response -func (o *ReplaceAllHTTPResponseRuleBackendAccepted) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule backend accepted response -func (o *ReplaceAllHTTPResponseRuleBackendAccepted) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleBackendBadRequest -const ReplaceAllHTTPResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllHTTPResponseRuleBackendBadRequest Bad request - -swagger:response replaceAllHttpResponseRuleBackendBadRequest -*/ -type ReplaceAllHTTPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleBackendBadRequest creates ReplaceAllHTTPResponseRuleBackendBadRequest with default headers values -func NewReplaceAllHTTPResponseRuleBackendBadRequest() *ReplaceAllHTTPResponseRuleBackendBadRequest { - - return &ReplaceAllHTTPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http response rule backend bad request response -func (o *ReplaceAllHTTPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http response rule backend bad request response -func (o *ReplaceAllHTTPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http response rule backend bad request response -func (o *ReplaceAllHTTPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule backend bad request response -func (o *ReplaceAllHTTPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPResponseRuleBackendDefault General Error - -swagger:response replaceAllHttpResponseRuleBackendDefault -*/ -type ReplaceAllHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleBackendDefault creates ReplaceAllHTTPResponseRuleBackendDefault with default headers values -func NewReplaceAllHTTPResponseRuleBackendDefault(code int) *ReplaceAllHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceAllHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP response rule backend default response -func (o *ReplaceAllHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/replace_all_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index 635e3eda..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPResponseRuleBackendURL generates an URL for the replace all HTTP response rule backend operation -type ReplaceAllHTTPResponseRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleBackendURL) WithBasePath(bp string) *ReplaceAllHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_defaults.go b/operations/http_response_rule/replace_all_http_response_rule_defaults.go deleted file mode 100644 index e81221ef..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace all HTTP response rule defaults handler -type ReplaceAllHTTPResponseRuleDefaultsHandlerFunc func(ReplaceAllHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPResponseRuleDefaultsHandlerFunc) Handle(params ReplaceAllHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPResponseRuleDefaultsHandler interface for that can handle valid replace all HTTP response rule defaults params -type ReplaceAllHTTPResponseRuleDefaultsHandler interface { - Handle(ReplaceAllHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPResponseRuleDefaults creates a new http.Handler for the replace all HTTP response rule defaults operation -func NewReplaceAllHTTPResponseRuleDefaults(ctx *middleware.Context, handler ReplaceAllHTTPResponseRuleDefaultsHandler) *ReplaceAllHTTPResponseRuleDefaults { - return &ReplaceAllHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules HTTPResponseRule replaceAllHttpResponseRuleDefaults - -# Replace an HTTP Response Rule list - -Replaces a whole list of HTTP Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllHTTPResponseRuleDefaultsHandler -} - -func (o *ReplaceAllHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_defaults_parameters.go b/operations/http_response_rule/replace_all_http_response_rule_defaults_parameters.go deleted file mode 100644 index 576e44e5..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPResponseRuleDefaultsParams creates a new ReplaceAllHTTPResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllHTTPResponseRuleDefaultsParams() ReplaceAllHTTPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPResponseRuleDefaultsParams contains all the bound params for the replace all HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPResponseRuleDefaults -type ReplaceAllHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPResponseRuleDefaultsParams() beforehand. -func (o *ReplaceAllHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_defaults_responses.go b/operations/http_response_rule/replace_all_http_response_rule_defaults_responses.go deleted file mode 100644 index 62602c04..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleDefaultsOK -const ReplaceAllHTTPResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceAllHTTPResponseRuleDefaultsOK All HTTP Response Rule lines replaced - -swagger:response replaceAllHttpResponseRuleDefaultsOK -*/ -type ReplaceAllHTTPResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleDefaultsOK creates ReplaceAllHTTPResponseRuleDefaultsOK with default headers values -func NewReplaceAllHTTPResponseRuleDefaultsOK() *ReplaceAllHTTPResponseRuleDefaultsOK { - - return &ReplaceAllHTTPResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Http response rule defaults o k response -func (o *ReplaceAllHTTPResponseRuleDefaultsOK) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule defaults o k response -func (o *ReplaceAllHTTPResponseRuleDefaultsOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleDefaultsAccepted -const ReplaceAllHTTPResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllHTTPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpResponseRuleDefaultsAccepted -*/ -type ReplaceAllHTTPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleDefaultsAccepted creates ReplaceAllHTTPResponseRuleDefaultsAccepted with default headers values -func NewReplaceAllHTTPResponseRuleDefaultsAccepted() *ReplaceAllHTTPResponseRuleDefaultsAccepted { - - return &ReplaceAllHTTPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http response rule defaults accepted response -func (o *ReplaceAllHTTPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http response rule defaults accepted response -func (o *ReplaceAllHTTPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http response rule defaults accepted response -func (o *ReplaceAllHTTPResponseRuleDefaultsAccepted) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule defaults accepted response -func (o *ReplaceAllHTTPResponseRuleDefaultsAccepted) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleDefaultsBadRequest -const ReplaceAllHTTPResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllHTTPResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceAllHttpResponseRuleDefaultsBadRequest -*/ -type ReplaceAllHTTPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleDefaultsBadRequest creates ReplaceAllHTTPResponseRuleDefaultsBadRequest with default headers values -func NewReplaceAllHTTPResponseRuleDefaultsBadRequest() *ReplaceAllHTTPResponseRuleDefaultsBadRequest { - - return &ReplaceAllHTTPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http response rule defaults bad request response -func (o *ReplaceAllHTTPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http response rule defaults bad request response -func (o *ReplaceAllHTTPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http response rule defaults bad request response -func (o *ReplaceAllHTTPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule defaults bad request response -func (o *ReplaceAllHTTPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPResponseRuleDefaultsDefault General Error - -swagger:response replaceAllHttpResponseRuleDefaultsDefault -*/ -type ReplaceAllHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleDefaultsDefault creates ReplaceAllHTTPResponseRuleDefaultsDefault with default headers values -func NewReplaceAllHTTPResponseRuleDefaultsDefault(code int) *ReplaceAllHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP response rule defaults default response -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/replace_all_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 307173d4..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPResponseRuleDefaultsURL generates an URL for the replace all HTTP response rule defaults operation -type ReplaceAllHTTPResponseRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_frontend.go b/operations/http_response_rule/replace_all_http_response_rule_frontend.go deleted file mode 100644 index be92aa68..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a replace all HTTP response rule frontend handler -type ReplaceAllHTTPResponseRuleFrontendHandlerFunc func(ReplaceAllHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllHTTPResponseRuleFrontendHandlerFunc) Handle(params ReplaceAllHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllHTTPResponseRuleFrontendHandler interface for that can handle valid replace all HTTP response rule frontend params -type ReplaceAllHTTPResponseRuleFrontendHandler interface { - Handle(ReplaceAllHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllHTTPResponseRuleFrontend creates a new http.Handler for the replace all HTTP response rule frontend operation -func NewReplaceAllHTTPResponseRuleFrontend(ctx *middleware.Context, handler ReplaceAllHTTPResponseRuleFrontendHandler) *ReplaceAllHTTPResponseRuleFrontend { - return &ReplaceAllHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllHTTPResponseRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules HTTPResponseRule replaceAllHttpResponseRuleFrontend - -# Replace an HTTP Response Rule list - -Replaces a whole list of HTTP Response Rules with the list given in parameter -*/ -type ReplaceAllHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllHTTPResponseRuleFrontendHandler -} - -func (o *ReplaceAllHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_frontend_parameters.go b/operations/http_response_rule/replace_all_http_response_rule_frontend_parameters.go deleted file mode 100644 index 5b117c23..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllHTTPResponseRuleFrontendParams creates a new ReplaceAllHTTPResponseRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllHTTPResponseRuleFrontendParams() ReplaceAllHTTPResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllHTTPResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllHTTPResponseRuleFrontendParams contains all the bound params for the replace all HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllHTTPResponseRuleFrontend -type ReplaceAllHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.HTTPResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllHTTPResponseRuleFrontendParams() beforehand. -func (o *ReplaceAllHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllHTTPResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllHTTPResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllHTTPResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_frontend_responses.go b/operations/http_response_rule/replace_all_http_response_rule_frontend_responses.go deleted file mode 100644 index 081c226d..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllHTTPResponseRuleFrontendOKCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleFrontendOK -const ReplaceAllHTTPResponseRuleFrontendOKCode int = 200 - -/* -ReplaceAllHTTPResponseRuleFrontendOK All HTTP Response Rule lines replaced - -swagger:response replaceAllHttpResponseRuleFrontendOK -*/ -type ReplaceAllHTTPResponseRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleFrontendOK creates ReplaceAllHTTPResponseRuleFrontendOK with default headers values -func NewReplaceAllHTTPResponseRuleFrontendOK() *ReplaceAllHTTPResponseRuleFrontendOK { - - return &ReplaceAllHTTPResponseRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Http response rule frontend o k response -func (o *ReplaceAllHTTPResponseRuleFrontendOK) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule frontend o k response -func (o *ReplaceAllHTTPResponseRuleFrontendOK) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleFrontendAccepted -const ReplaceAllHTTPResponseRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllHTTPResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllHttpResponseRuleFrontendAccepted -*/ -type ReplaceAllHTTPResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.HTTPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleFrontendAccepted creates ReplaceAllHTTPResponseRuleFrontendAccepted with default headers values -func NewReplaceAllHTTPResponseRuleFrontendAccepted() *ReplaceAllHTTPResponseRuleFrontendAccepted { - - return &ReplaceAllHTTPResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Http response rule frontend accepted response -func (o *ReplaceAllHTTPResponseRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllHTTPResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Http response rule frontend accepted response -func (o *ReplaceAllHTTPResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Http response rule frontend accepted response -func (o *ReplaceAllHTTPResponseRuleFrontendAccepted) WithPayload(payload models.HTTPResponseRules) *ReplaceAllHTTPResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule frontend accepted response -func (o *ReplaceAllHTTPResponseRuleFrontendAccepted) SetPayload(payload models.HTTPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.HTTPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllHTTPResponseRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllHTTPResponseRuleFrontendBadRequest -const ReplaceAllHTTPResponseRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllHTTPResponseRuleFrontendBadRequest Bad request - -swagger:response replaceAllHttpResponseRuleFrontendBadRequest -*/ -type ReplaceAllHTTPResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleFrontendBadRequest creates ReplaceAllHTTPResponseRuleFrontendBadRequest with default headers values -func NewReplaceAllHTTPResponseRuleFrontendBadRequest() *ReplaceAllHTTPResponseRuleFrontendBadRequest { - - return &ReplaceAllHTTPResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Http response rule frontend bad request response -func (o *ReplaceAllHTTPResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Http response rule frontend bad request response -func (o *ReplaceAllHTTPResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Http response rule frontend bad request response -func (o *ReplaceAllHTTPResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Http response rule frontend bad request response -func (o *ReplaceAllHTTPResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllHTTPResponseRuleFrontendDefault General Error - -swagger:response replaceAllHttpResponseRuleFrontendDefault -*/ -type ReplaceAllHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllHTTPResponseRuleFrontendDefault creates ReplaceAllHTTPResponseRuleFrontendDefault with default headers values -func NewReplaceAllHTTPResponseRuleFrontendDefault(code int) *ReplaceAllHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all HTTP response rule frontend default response -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_all_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/replace_all_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 79e9a0e3..00000000 --- a/operations/http_response_rule/replace_all_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllHTTPResponseRuleFrontendURL generates an URL for the replace all HTTP response rule frontend operation -type ReplaceAllHTTPResponseRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleFrontendURL) WithBasePath(bp string) *ReplaceAllHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_http_response_rule_backend.go b/operations/http_response_rule/replace_http_response_rule_backend.go deleted file mode 100644 index 8bad65a1..00000000 --- a/operations/http_response_rule/replace_http_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPResponseRuleBackendHandlerFunc turns a function with the right signature into a replace HTTP response rule backend handler -type ReplaceHTTPResponseRuleBackendHandlerFunc func(ReplaceHTTPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPResponseRuleBackendHandlerFunc) Handle(params ReplaceHTTPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPResponseRuleBackendHandler interface for that can handle valid replace HTTP response rule backend params -type ReplaceHTTPResponseRuleBackendHandler interface { - Handle(ReplaceHTTPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPResponseRuleBackend creates a new http.Handler for the replace HTTP response rule backend operation -func NewReplaceHTTPResponseRuleBackend(ctx *middleware.Context, handler ReplaceHTTPResponseRuleBackendHandler) *ReplaceHTTPResponseRuleBackend { - return &ReplaceHTTPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index} HTTPResponseRule replaceHttpResponseRuleBackend - -# Replace a HTTP Response Rule - -Replaces a HTTP Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceHTTPResponseRuleBackendHandler -} - -func (o *ReplaceHTTPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_http_response_rule_backend_parameters.go b/operations/http_response_rule/replace_http_response_rule_backend_parameters.go deleted file mode 100644 index 9e7b2038..00000000 --- a/operations/http_response_rule/replace_http_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPResponseRuleBackendParams creates a new ReplaceHTTPResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceHTTPResponseRuleBackendParams() ReplaceHTTPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPResponseRuleBackendParams contains all the bound params for the replace HTTP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPResponseRuleBackend -type ReplaceHTTPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPResponseRuleBackendParams() beforehand. -func (o *ReplaceHTTPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_http_response_rule_backend_responses.go b/operations/http_response_rule/replace_http_response_rule_backend_responses.go deleted file mode 100644 index 4bddf943..00000000 --- a/operations/http_response_rule/replace_http_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPResponseRuleBackendOKCode is the HTTP code returned for type ReplaceHTTPResponseRuleBackendOK -const ReplaceHTTPResponseRuleBackendOKCode int = 200 - -/* -ReplaceHTTPResponseRuleBackendOK HTTP Response Rule replaced - -swagger:response replaceHttpResponseRuleBackendOK -*/ -type ReplaceHTTPResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleBackendOK creates ReplaceHTTPResponseRuleBackendOK with default headers values -func NewReplaceHTTPResponseRuleBackendOK() *ReplaceHTTPResponseRuleBackendOK { - - return &ReplaceHTTPResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Http response rule backend o k response -func (o *ReplaceHTTPResponseRuleBackendOK) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule backend o k response -func (o *ReplaceHTTPResponseRuleBackendOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceHTTPResponseRuleBackendAccepted -const ReplaceHTTPResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceHTTPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpResponseRuleBackendAccepted -*/ -type ReplaceHTTPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleBackendAccepted creates ReplaceHTTPResponseRuleBackendAccepted with default headers values -func NewReplaceHTTPResponseRuleBackendAccepted() *ReplaceHTTPResponseRuleBackendAccepted { - - return &ReplaceHTTPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http response rule backend accepted response -func (o *ReplaceHTTPResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceHTTPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http response rule backend accepted response -func (o *ReplaceHTTPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http response rule backend accepted response -func (o *ReplaceHTTPResponseRuleBackendAccepted) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule backend accepted response -func (o *ReplaceHTTPResponseRuleBackendAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceHTTPResponseRuleBackendBadRequest -const ReplaceHTTPResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceHTTPResponseRuleBackendBadRequest Bad request - -swagger:response replaceHttpResponseRuleBackendBadRequest -*/ -type ReplaceHTTPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleBackendBadRequest creates ReplaceHTTPResponseRuleBackendBadRequest with default headers values -func NewReplaceHTTPResponseRuleBackendBadRequest() *ReplaceHTTPResponseRuleBackendBadRequest { - - return &ReplaceHTTPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule backend bad request response -func (o *ReplaceHTTPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule backend bad request response -func (o *ReplaceHTTPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule backend bad request response -func (o *ReplaceHTTPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule backend bad request response -func (o *ReplaceHTTPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleBackendNotFoundCode is the HTTP code returned for type ReplaceHTTPResponseRuleBackendNotFound -const ReplaceHTTPResponseRuleBackendNotFoundCode int = 404 - -/* -ReplaceHTTPResponseRuleBackendNotFound The specified resource was not found - -swagger:response replaceHttpResponseRuleBackendNotFound -*/ -type ReplaceHTTPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleBackendNotFound creates ReplaceHTTPResponseRuleBackendNotFound with default headers values -func NewReplaceHTTPResponseRuleBackendNotFound() *ReplaceHTTPResponseRuleBackendNotFound { - - return &ReplaceHTTPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule backend not found response -func (o *ReplaceHTTPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule backend not found response -func (o *ReplaceHTTPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule backend not found response -func (o *ReplaceHTTPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule backend not found response -func (o *ReplaceHTTPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPResponseRuleBackendDefault General Error - -swagger:response replaceHttpResponseRuleBackendDefault -*/ -type ReplaceHTTPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleBackendDefault creates ReplaceHTTPResponseRuleBackendDefault with default headers values -func NewReplaceHTTPResponseRuleBackendDefault(code int) *ReplaceHTTPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceHTTPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP response rule backend default response -func (o *ReplaceHTTPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_http_response_rule_backend_urlbuilder.go b/operations/http_response_rule/replace_http_response_rule_backend_urlbuilder.go deleted file mode 100644 index 49d4b9a4..00000000 --- a/operations/http_response_rule/replace_http_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPResponseRuleBackendURL generates an URL for the replace HTTP response rule backend operation -type ReplaceHTTPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleBackendURL) WithBasePath(bp string) *ReplaceHTTPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_http_response_rule_defaults.go b/operations/http_response_rule/replace_http_response_rule_defaults.go deleted file mode 100644 index b4cef6eb..00000000 --- a/operations/http_response_rule/replace_http_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace HTTP response rule defaults handler -type ReplaceHTTPResponseRuleDefaultsHandlerFunc func(ReplaceHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPResponseRuleDefaultsHandlerFunc) Handle(params ReplaceHTTPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPResponseRuleDefaultsHandler interface for that can handle valid replace HTTP response rule defaults params -type ReplaceHTTPResponseRuleDefaultsHandler interface { - Handle(ReplaceHTTPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPResponseRuleDefaults creates a new http.Handler for the replace HTTP response rule defaults operation -func NewReplaceHTTPResponseRuleDefaults(ctx *middleware.Context, handler ReplaceHTTPResponseRuleDefaultsHandler) *ReplaceHTTPResponseRuleDefaults { - return &ReplaceHTTPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index} HTTPResponseRule replaceHttpResponseRuleDefaults - -# Replace a HTTP Response Rule - -Replaces a HTTP Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceHTTPResponseRuleDefaultsHandler -} - -func (o *ReplaceHTTPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_http_response_rule_defaults_parameters.go b/operations/http_response_rule/replace_http_response_rule_defaults_parameters.go deleted file mode 100644 index 342c5502..00000000 --- a/operations/http_response_rule/replace_http_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPResponseRuleDefaultsParams creates a new ReplaceHTTPResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceHTTPResponseRuleDefaultsParams() ReplaceHTTPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPResponseRuleDefaultsParams contains all the bound params for the replace HTTP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPResponseRuleDefaults -type ReplaceHTTPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPResponseRuleDefaultsParams() beforehand. -func (o *ReplaceHTTPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_http_response_rule_defaults_responses.go b/operations/http_response_rule/replace_http_response_rule_defaults_responses.go deleted file mode 100644 index 90d02718..00000000 --- a/operations/http_response_rule/replace_http_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceHTTPResponseRuleDefaultsOK -const ReplaceHTTPResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceHTTPResponseRuleDefaultsOK HTTP Response Rule replaced - -swagger:response replaceHttpResponseRuleDefaultsOK -*/ -type ReplaceHTTPResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleDefaultsOK creates ReplaceHTTPResponseRuleDefaultsOK with default headers values -func NewReplaceHTTPResponseRuleDefaultsOK() *ReplaceHTTPResponseRuleDefaultsOK { - - return &ReplaceHTTPResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Http response rule defaults o k response -func (o *ReplaceHTTPResponseRuleDefaultsOK) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule defaults o k response -func (o *ReplaceHTTPResponseRuleDefaultsOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceHTTPResponseRuleDefaultsAccepted -const ReplaceHTTPResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceHTTPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpResponseRuleDefaultsAccepted -*/ -type ReplaceHTTPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleDefaultsAccepted creates ReplaceHTTPResponseRuleDefaultsAccepted with default headers values -func NewReplaceHTTPResponseRuleDefaultsAccepted() *ReplaceHTTPResponseRuleDefaultsAccepted { - - return &ReplaceHTTPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http response rule defaults accepted response -func (o *ReplaceHTTPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceHTTPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http response rule defaults accepted response -func (o *ReplaceHTTPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http response rule defaults accepted response -func (o *ReplaceHTTPResponseRuleDefaultsAccepted) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule defaults accepted response -func (o *ReplaceHTTPResponseRuleDefaultsAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceHTTPResponseRuleDefaultsBadRequest -const ReplaceHTTPResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceHTTPResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceHttpResponseRuleDefaultsBadRequest -*/ -type ReplaceHTTPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleDefaultsBadRequest creates ReplaceHTTPResponseRuleDefaultsBadRequest with default headers values -func NewReplaceHTTPResponseRuleDefaultsBadRequest() *ReplaceHTTPResponseRuleDefaultsBadRequest { - - return &ReplaceHTTPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule defaults bad request response -func (o *ReplaceHTTPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule defaults bad request response -func (o *ReplaceHTTPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule defaults bad request response -func (o *ReplaceHTTPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule defaults bad request response -func (o *ReplaceHTTPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceHTTPResponseRuleDefaultsNotFound -const ReplaceHTTPResponseRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceHTTPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceHttpResponseRuleDefaultsNotFound -*/ -type ReplaceHTTPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleDefaultsNotFound creates ReplaceHTTPResponseRuleDefaultsNotFound with default headers values -func NewReplaceHTTPResponseRuleDefaultsNotFound() *ReplaceHTTPResponseRuleDefaultsNotFound { - - return &ReplaceHTTPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule defaults not found response -func (o *ReplaceHTTPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule defaults not found response -func (o *ReplaceHTTPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule defaults not found response -func (o *ReplaceHTTPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule defaults not found response -func (o *ReplaceHTTPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPResponseRuleDefaultsDefault General Error - -swagger:response replaceHttpResponseRuleDefaultsDefault -*/ -type ReplaceHTTPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleDefaultsDefault creates ReplaceHTTPResponseRuleDefaultsDefault with default headers values -func NewReplaceHTTPResponseRuleDefaultsDefault(code int) *ReplaceHTTPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceHTTPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP response rule defaults default response -func (o *ReplaceHTTPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_http_response_rule_defaults_urlbuilder.go b/operations/http_response_rule/replace_http_response_rule_defaults_urlbuilder.go deleted file mode 100644 index cc12768c..00000000 --- a/operations/http_response_rule/replace_http_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPResponseRuleDefaultsURL generates an URL for the replace HTTP response rule defaults operation -type ReplaceHTTPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceHTTPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/http_response_rule/replace_http_response_rule_frontend.go b/operations/http_response_rule/replace_http_response_rule_frontend.go deleted file mode 100644 index 5dbfb231..00000000 --- a/operations/http_response_rule/replace_http_response_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceHTTPResponseRuleFrontendHandlerFunc turns a function with the right signature into a replace HTTP response rule frontend handler -type ReplaceHTTPResponseRuleFrontendHandlerFunc func(ReplaceHTTPResponseRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceHTTPResponseRuleFrontendHandlerFunc) Handle(params ReplaceHTTPResponseRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceHTTPResponseRuleFrontendHandler interface for that can handle valid replace HTTP response rule frontend params -type ReplaceHTTPResponseRuleFrontendHandler interface { - Handle(ReplaceHTTPResponseRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceHTTPResponseRuleFrontend creates a new http.Handler for the replace HTTP response rule frontend operation -func NewReplaceHTTPResponseRuleFrontend(ctx *middleware.Context, handler ReplaceHTTPResponseRuleFrontendHandler) *ReplaceHTTPResponseRuleFrontend { - return &ReplaceHTTPResponseRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceHTTPResponseRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index} HTTPResponseRule replaceHttpResponseRuleFrontend - -# Replace a HTTP Response Rule - -Replaces a HTTP Response Rule configuration by it's index in the specified parent. -*/ -type ReplaceHTTPResponseRuleFrontend struct { - Context *middleware.Context - Handler ReplaceHTTPResponseRuleFrontendHandler -} - -func (o *ReplaceHTTPResponseRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceHTTPResponseRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/http_response_rule/replace_http_response_rule_frontend_parameters.go b/operations/http_response_rule/replace_http_response_rule_frontend_parameters.go deleted file mode 100644 index 0cdab708..00000000 --- a/operations/http_response_rule/replace_http_response_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceHTTPResponseRuleFrontendParams creates a new ReplaceHTTPResponseRuleFrontendParams object -// with the default values initialized. -func NewReplaceHTTPResponseRuleFrontendParams() ReplaceHTTPResponseRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceHTTPResponseRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceHTTPResponseRuleFrontendParams contains all the bound params for the replace HTTP response rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceHTTPResponseRuleFrontend -type ReplaceHTTPResponseRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.HTTPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*HTTP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceHTTPResponseRuleFrontendParams() beforehand. -func (o *ReplaceHTTPResponseRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.HTTPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceHTTPResponseRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceHTTPResponseRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceHTTPResponseRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceHTTPResponseRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceHTTPResponseRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceHTTPResponseRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/http_response_rule/replace_http_response_rule_frontend_responses.go b/operations/http_response_rule/replace_http_response_rule_frontend_responses.go deleted file mode 100644 index 18b8559f..00000000 --- a/operations/http_response_rule/replace_http_response_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceHTTPResponseRuleFrontendOKCode is the HTTP code returned for type ReplaceHTTPResponseRuleFrontendOK -const ReplaceHTTPResponseRuleFrontendOKCode int = 200 - -/* -ReplaceHTTPResponseRuleFrontendOK HTTP Response Rule replaced - -swagger:response replaceHttpResponseRuleFrontendOK -*/ -type ReplaceHTTPResponseRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleFrontendOK creates ReplaceHTTPResponseRuleFrontendOK with default headers values -func NewReplaceHTTPResponseRuleFrontendOK() *ReplaceHTTPResponseRuleFrontendOK { - - return &ReplaceHTTPResponseRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Http response rule frontend o k response -func (o *ReplaceHTTPResponseRuleFrontendOK) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule frontend o k response -func (o *ReplaceHTTPResponseRuleFrontendOK) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceHTTPResponseRuleFrontendAccepted -const ReplaceHTTPResponseRuleFrontendAcceptedCode int = 202 - -/* -ReplaceHTTPResponseRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceHttpResponseRuleFrontendAccepted -*/ -type ReplaceHTTPResponseRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.HTTPResponseRule `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleFrontendAccepted creates ReplaceHTTPResponseRuleFrontendAccepted with default headers values -func NewReplaceHTTPResponseRuleFrontendAccepted() *ReplaceHTTPResponseRuleFrontendAccepted { - - return &ReplaceHTTPResponseRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Http response rule frontend accepted response -func (o *ReplaceHTTPResponseRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceHTTPResponseRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Http response rule frontend accepted response -func (o *ReplaceHTTPResponseRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Http response rule frontend accepted response -func (o *ReplaceHTTPResponseRuleFrontendAccepted) WithPayload(payload *models.HTTPResponseRule) *ReplaceHTTPResponseRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule frontend accepted response -func (o *ReplaceHTTPResponseRuleFrontendAccepted) SetPayload(payload *models.HTTPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceHTTPResponseRuleFrontendBadRequest -const ReplaceHTTPResponseRuleFrontendBadRequestCode int = 400 - -/* -ReplaceHTTPResponseRuleFrontendBadRequest Bad request - -swagger:response replaceHttpResponseRuleFrontendBadRequest -*/ -type ReplaceHTTPResponseRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleFrontendBadRequest creates ReplaceHTTPResponseRuleFrontendBadRequest with default headers values -func NewReplaceHTTPResponseRuleFrontendBadRequest() *ReplaceHTTPResponseRuleFrontendBadRequest { - - return &ReplaceHTTPResponseRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule frontend bad request response -func (o *ReplaceHTTPResponseRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule frontend bad request response -func (o *ReplaceHTTPResponseRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule frontend bad request response -func (o *ReplaceHTTPResponseRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule frontend bad request response -func (o *ReplaceHTTPResponseRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceHTTPResponseRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceHTTPResponseRuleFrontendNotFound -const ReplaceHTTPResponseRuleFrontendNotFoundCode int = 404 - -/* -ReplaceHTTPResponseRuleFrontendNotFound The specified resource was not found - -swagger:response replaceHttpResponseRuleFrontendNotFound -*/ -type ReplaceHTTPResponseRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleFrontendNotFound creates ReplaceHTTPResponseRuleFrontendNotFound with default headers values -func NewReplaceHTTPResponseRuleFrontendNotFound() *ReplaceHTTPResponseRuleFrontendNotFound { - - return &ReplaceHTTPResponseRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Http response rule frontend not found response -func (o *ReplaceHTTPResponseRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Http response rule frontend not found response -func (o *ReplaceHTTPResponseRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Http response rule frontend not found response -func (o *ReplaceHTTPResponseRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Http response rule frontend not found response -func (o *ReplaceHTTPResponseRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceHTTPResponseRuleFrontendDefault General Error - -swagger:response replaceHttpResponseRuleFrontendDefault -*/ -type ReplaceHTTPResponseRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceHTTPResponseRuleFrontendDefault creates ReplaceHTTPResponseRuleFrontendDefault with default headers values -func NewReplaceHTTPResponseRuleFrontendDefault(code int) *ReplaceHTTPResponseRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceHTTPResponseRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) WithStatusCode(code int) *ReplaceHTTPResponseRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceHTTPResponseRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceHTTPResponseRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace HTTP response rule frontend default response -func (o *ReplaceHTTPResponseRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceHTTPResponseRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/http_response_rule/replace_http_response_rule_frontend_urlbuilder.go b/operations/http_response_rule/replace_http_response_rule_frontend_urlbuilder.go deleted file mode 100644 index 5a9ca611..00000000 --- a/operations/http_response_rule/replace_http_response_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package http_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceHTTPResponseRuleFrontendURL generates an URL for the replace HTTP response rule frontend operation -type ReplaceHTTPResponseRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleFrontendURL) WithBasePath(bp string) *ReplaceHTTPResponseRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceHTTPResponseRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceHTTPResponseRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceHTTPResponseRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceHTTPResponseRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceHTTPResponseRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceHTTPResponseRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceHTTPResponseRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceHTTPResponseRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceHTTPResponseRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceHTTPResponseRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/information/get_haproxy_process_info.go b/operations/information/get_haproxy_process_info.go deleted file mode 100644 index 08b8f4e4..00000000 --- a/operations/information/get_haproxy_process_info.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHaproxyProcessInfoHandlerFunc turns a function with the right signature into a get haproxy process info handler -type GetHaproxyProcessInfoHandlerFunc func(GetHaproxyProcessInfoParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHaproxyProcessInfoHandlerFunc) Handle(params GetHaproxyProcessInfoParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetHaproxyProcessInfoHandler interface for that can handle valid get haproxy process info params -type GetHaproxyProcessInfoHandler interface { - Handle(GetHaproxyProcessInfoParams, interface{}) middleware.Responder -} - -// NewGetHaproxyProcessInfo creates a new http.Handler for the get haproxy process info operation -func NewGetHaproxyProcessInfo(ctx *middleware.Context, handler GetHaproxyProcessInfoHandler) *GetHaproxyProcessInfo { - return &GetHaproxyProcessInfo{Context: ctx, Handler: handler} -} - -/* - GetHaproxyProcessInfo swagger:route GET /services/haproxy/runtime/info Information getHaproxyProcessInfo - -# Return HAProxy process information - -Return HAProxy process information -*/ -type GetHaproxyProcessInfo struct { - Context *middleware.Context - Handler GetHaproxyProcessInfoHandler -} - -func (o *GetHaproxyProcessInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetHaproxyProcessInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/information/get_haproxy_process_info_parameters.go b/operations/information/get_haproxy_process_info_parameters.go deleted file mode 100644 index f4f800be..00000000 --- a/operations/information/get_haproxy_process_info_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetHaproxyProcessInfoParams creates a new GetHaproxyProcessInfoParams object -// -// There are no default values defined in the spec. -func NewGetHaproxyProcessInfoParams() GetHaproxyProcessInfoParams { - - return GetHaproxyProcessInfoParams{} -} - -// GetHaproxyProcessInfoParams contains all the bound params for the get haproxy process info operation -// typically these are obtained from a http.Request -// -// swagger:parameters getHaproxyProcessInfo -type GetHaproxyProcessInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetHaproxyProcessInfoParams() beforehand. -func (o *GetHaproxyProcessInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/information/get_haproxy_process_info_responses.go b/operations/information/get_haproxy_process_info_responses.go deleted file mode 100644 index cb6be2ba..00000000 --- a/operations/information/get_haproxy_process_info_responses.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetHaproxyProcessInfoOKCode is the HTTP code returned for type GetHaproxyProcessInfoOK -const GetHaproxyProcessInfoOKCode int = 200 - -/* -GetHaproxyProcessInfoOK Success - -swagger:response getHaproxyProcessInfoOK -*/ -type GetHaproxyProcessInfoOK struct { - - /* - In: Body - */ - Payload *models.ProcessInfo `json:"body,omitempty"` -} - -// NewGetHaproxyProcessInfoOK creates GetHaproxyProcessInfoOK with default headers values -func NewGetHaproxyProcessInfoOK() *GetHaproxyProcessInfoOK { - - return &GetHaproxyProcessInfoOK{} -} - -// WithPayload adds the payload to the get haproxy process info o k response -func (o *GetHaproxyProcessInfoOK) WithPayload(payload *models.ProcessInfo) *GetHaproxyProcessInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get haproxy process info o k response -func (o *GetHaproxyProcessInfoOK) SetPayload(payload *models.ProcessInfo) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHaproxyProcessInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetHaproxyProcessInfoDefault General Error - -swagger:response getHaproxyProcessInfoDefault -*/ -type GetHaproxyProcessInfoDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetHaproxyProcessInfoDefault creates GetHaproxyProcessInfoDefault with default headers values -func NewGetHaproxyProcessInfoDefault(code int) *GetHaproxyProcessInfoDefault { - if code <= 0 { - code = 500 - } - - return &GetHaproxyProcessInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) WithStatusCode(code int) *GetHaproxyProcessInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) WithConfigurationVersion(configurationVersion string) *GetHaproxyProcessInfoDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) WithPayload(payload *models.Error) *GetHaproxyProcessInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get haproxy process info default response -func (o *GetHaproxyProcessInfoDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetHaproxyProcessInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/information/get_haproxy_process_info_urlbuilder.go b/operations/information/get_haproxy_process_info_urlbuilder.go deleted file mode 100644 index e2510349..00000000 --- a/operations/information/get_haproxy_process_info_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetHaproxyProcessInfoURL generates an URL for the get haproxy process info operation -type GetHaproxyProcessInfoURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHaproxyProcessInfoURL) WithBasePath(bp string) *GetHaproxyProcessInfoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetHaproxyProcessInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetHaproxyProcessInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/info" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetHaproxyProcessInfoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetHaproxyProcessInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetHaproxyProcessInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetHaproxyProcessInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetHaproxyProcessInfoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetHaproxyProcessInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/information/get_info.go b/operations/information/get_info.go deleted file mode 100644 index 08a9b83a..00000000 --- a/operations/information/get_info.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetInfoHandlerFunc turns a function with the right signature into a get info handler -type GetInfoHandlerFunc func(GetInfoParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetInfoHandlerFunc) Handle(params GetInfoParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetInfoHandler interface for that can handle valid get info params -type GetInfoHandler interface { - Handle(GetInfoParams, interface{}) middleware.Responder -} - -// NewGetInfo creates a new http.Handler for the get info operation -func NewGetInfo(ctx *middleware.Context, handler GetInfoHandler) *GetInfo { - return &GetInfo{Context: ctx, Handler: handler} -} - -/* - GetInfo swagger:route GET /info Information getInfo - -# Return API, hardware and OS information - -Return API, hardware and OS information -*/ -type GetInfo struct { - Context *middleware.Context - Handler GetInfoHandler -} - -func (o *GetInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetInfoParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/information/get_info_parameters.go b/operations/information/get_info_parameters.go deleted file mode 100644 index 4e2594ac..00000000 --- a/operations/information/get_info_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetInfoParams creates a new GetInfoParams object -// -// There are no default values defined in the spec. -func NewGetInfoParams() GetInfoParams { - - return GetInfoParams{} -} - -// GetInfoParams contains all the bound params for the get info operation -// typically these are obtained from a http.Request -// -// swagger:parameters getInfo -type GetInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetInfoParams() beforehand. -func (o *GetInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/information/get_info_responses.go b/operations/information/get_info_responses.go deleted file mode 100644 index 751f8ac8..00000000 --- a/operations/information/get_info_responses.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetInfoOKCode is the HTTP code returned for type GetInfoOK -const GetInfoOKCode int = 200 - -/* -GetInfoOK Success - -swagger:response getInfoOK -*/ -type GetInfoOK struct { - - /* - In: Body - */ - Payload *models.Info `json:"body,omitempty"` -} - -// NewGetInfoOK creates GetInfoOK with default headers values -func NewGetInfoOK() *GetInfoOK { - - return &GetInfoOK{} -} - -// WithPayload adds the payload to the get info o k response -func (o *GetInfoOK) WithPayload(payload *models.Info) *GetInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get info o k response -func (o *GetInfoOK) SetPayload(payload *models.Info) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetInfoDefault General Error - -swagger:response getInfoDefault -*/ -type GetInfoDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetInfoDefault creates GetInfoDefault with default headers values -func NewGetInfoDefault(code int) *GetInfoDefault { - if code <= 0 { - code = 500 - } - - return &GetInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get info default response -func (o *GetInfoDefault) WithStatusCode(code int) *GetInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get info default response -func (o *GetInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get info default response -func (o *GetInfoDefault) WithConfigurationVersion(configurationVersion string) *GetInfoDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get info default response -func (o *GetInfoDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get info default response -func (o *GetInfoDefault) WithPayload(payload *models.Error) *GetInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get info default response -func (o *GetInfoDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/information/get_info_urlbuilder.go b/operations/information/get_info_urlbuilder.go deleted file mode 100644 index c1bd8756..00000000 --- a/operations/information/get_info_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package information - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetInfoURL generates an URL for the get info operation -type GetInfoURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetInfoURL) WithBasePath(bp string) *GetInfoURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/info" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetInfoURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetInfoURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_forward/create_log_forward.go b/operations/log_forward/create_log_forward.go deleted file mode 100644 index 51e4266f..00000000 --- a/operations/log_forward/create_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogForwardHandlerFunc turns a function with the right signature into a create log forward handler -type CreateLogForwardHandlerFunc func(CreateLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogForwardHandlerFunc) Handle(params CreateLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogForwardHandler interface for that can handle valid create log forward params -type CreateLogForwardHandler interface { - Handle(CreateLogForwardParams, interface{}) middleware.Responder -} - -// NewCreateLogForward creates a new http.Handler for the create log forward operation -func NewCreateLogForward(ctx *middleware.Context, handler CreateLogForwardHandler) *CreateLogForward { - return &CreateLogForward{Context: ctx, Handler: handler} -} - -/* - CreateLogForward swagger:route POST /services/haproxy/configuration/log_forwards LogForward createLogForward - -# Add a log forward - -Adds a new log_forward to the configuration file. -*/ -type CreateLogForward struct { - Context *middleware.Context - Handler CreateLogForwardHandler -} - -func (o *CreateLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_forward/create_log_forward_parameters.go b/operations/log_forward/create_log_forward_parameters.go deleted file mode 100644 index f9fcbea3..00000000 --- a/operations/log_forward/create_log_forward_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogForwardParams creates a new CreateLogForwardParams object -// with the default values initialized. -func NewCreateLogForwardParams() CreateLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateLogForwardParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateLogForwardParams contains all the bound params for the create log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogForward -type CreateLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogForward - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogForwardParams() beforehand. -func (o *CreateLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogForward - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateLogForwardParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_forward/create_log_forward_responses.go b/operations/log_forward/create_log_forward_responses.go deleted file mode 100644 index 154fb552..00000000 --- a/operations/log_forward/create_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogForwardCreatedCode is the HTTP code returned for type CreateLogForwardCreated -const CreateLogForwardCreatedCode int = 201 - -/* -CreateLogForwardCreated Log Forward created - -swagger:response createLogForwardCreated -*/ -type CreateLogForwardCreated struct { - - /* - In: Body - */ - Payload *models.LogForward `json:"body,omitempty"` -} - -// NewCreateLogForwardCreated creates CreateLogForwardCreated with default headers values -func NewCreateLogForwardCreated() *CreateLogForwardCreated { - - return &CreateLogForwardCreated{} -} - -// WithPayload adds the payload to the create log forward created response -func (o *CreateLogForwardCreated) WithPayload(payload *models.LogForward) *CreateLogForwardCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log forward created response -func (o *CreateLogForwardCreated) SetPayload(payload *models.LogForward) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogForwardCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogForwardAcceptedCode is the HTTP code returned for type CreateLogForwardAccepted -const CreateLogForwardAcceptedCode int = 202 - -/* -CreateLogForwardAccepted Configuration change accepted and reload requested - -swagger:response createLogForwardAccepted -*/ -type CreateLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogForward `json:"body,omitempty"` -} - -// NewCreateLogForwardAccepted creates CreateLogForwardAccepted with default headers values -func NewCreateLogForwardAccepted() *CreateLogForwardAccepted { - - return &CreateLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the create log forward accepted response -func (o *CreateLogForwardAccepted) WithReloadID(reloadID string) *CreateLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log forward accepted response -func (o *CreateLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log forward accepted response -func (o *CreateLogForwardAccepted) WithPayload(payload *models.LogForward) *CreateLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log forward accepted response -func (o *CreateLogForwardAccepted) SetPayload(payload *models.LogForward) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogForwardBadRequestCode is the HTTP code returned for type CreateLogForwardBadRequest -const CreateLogForwardBadRequestCode int = 400 - -/* -CreateLogForwardBadRequest Bad request - -swagger:response createLogForwardBadRequest -*/ -type CreateLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogForwardBadRequest creates CreateLogForwardBadRequest with default headers values -func NewCreateLogForwardBadRequest() *CreateLogForwardBadRequest { - - return &CreateLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log forward bad request response -func (o *CreateLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log forward bad request response -func (o *CreateLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log forward bad request response -func (o *CreateLogForwardBadRequest) WithPayload(payload *models.Error) *CreateLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log forward bad request response -func (o *CreateLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogForwardConflictCode is the HTTP code returned for type CreateLogForwardConflict -const CreateLogForwardConflictCode int = 409 - -/* -CreateLogForwardConflict The specified resource already exists - -swagger:response createLogForwardConflict -*/ -type CreateLogForwardConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogForwardConflict creates CreateLogForwardConflict with default headers values -func NewCreateLogForwardConflict() *CreateLogForwardConflict { - - return &CreateLogForwardConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log forward conflict response -func (o *CreateLogForwardConflict) WithConfigurationVersion(configurationVersion string) *CreateLogForwardConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log forward conflict response -func (o *CreateLogForwardConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log forward conflict response -func (o *CreateLogForwardConflict) WithPayload(payload *models.Error) *CreateLogForwardConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log forward conflict response -func (o *CreateLogForwardConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogForwardConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogForwardDefault General Error - -swagger:response createLogForwardDefault -*/ -type CreateLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogForwardDefault creates CreateLogForwardDefault with default headers values -func NewCreateLogForwardDefault(code int) *CreateLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log forward default response -func (o *CreateLogForwardDefault) WithStatusCode(code int) *CreateLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log forward default response -func (o *CreateLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log forward default response -func (o *CreateLogForwardDefault) WithConfigurationVersion(configurationVersion string) *CreateLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log forward default response -func (o *CreateLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log forward default response -func (o *CreateLogForwardDefault) WithPayload(payload *models.Error) *CreateLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log forward default response -func (o *CreateLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_forward/create_log_forward_urlbuilder.go b/operations/log_forward/create_log_forward_urlbuilder.go deleted file mode 100644 index 203c2836..00000000 --- a/operations/log_forward/create_log_forward_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateLogForwardURL generates an URL for the create log forward operation -type CreateLogForwardURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogForwardURL) WithBasePath(bp string) *CreateLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_forward/delete_log_forward.go b/operations/log_forward/delete_log_forward.go deleted file mode 100644 index b8fccea8..00000000 --- a/operations/log_forward/delete_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogForwardHandlerFunc turns a function with the right signature into a delete log forward handler -type DeleteLogForwardHandlerFunc func(DeleteLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogForwardHandlerFunc) Handle(params DeleteLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogForwardHandler interface for that can handle valid delete log forward params -type DeleteLogForwardHandler interface { - Handle(DeleteLogForwardParams, interface{}) middleware.Responder -} - -// NewDeleteLogForward creates a new http.Handler for the delete log forward operation -func NewDeleteLogForward(ctx *middleware.Context, handler DeleteLogForwardHandler) *DeleteLogForward { - return &DeleteLogForward{Context: ctx, Handler: handler} -} - -/* - DeleteLogForward swagger:route DELETE /services/haproxy/configuration/log_forwards/{name} LogForward deleteLogForward - -# Delete a log forward - -Deletes a log forward from the configuration by it's name. -*/ -type DeleteLogForward struct { - Context *middleware.Context - Handler DeleteLogForwardHandler -} - -func (o *DeleteLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_forward/delete_log_forward_parameters.go b/operations/log_forward/delete_log_forward_parameters.go deleted file mode 100644 index 7c5229a4..00000000 --- a/operations/log_forward/delete_log_forward_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogForwardParams creates a new DeleteLogForwardParams object -// with the default values initialized. -func NewDeleteLogForwardParams() DeleteLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogForwardParams contains all the bound params for the delete log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogForward -type DeleteLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Forward name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogForwardParams() beforehand. -func (o *DeleteLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_forward/delete_log_forward_responses.go b/operations/log_forward/delete_log_forward_responses.go deleted file mode 100644 index 94c5988d..00000000 --- a/operations/log_forward/delete_log_forward_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogForwardAcceptedCode is the HTTP code returned for type DeleteLogForwardAccepted -const DeleteLogForwardAcceptedCode int = 202 - -/* -DeleteLogForwardAccepted Configuration change accepted and reload requested - -swagger:response deleteLogForwardAccepted -*/ -type DeleteLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogForwardAccepted creates DeleteLogForwardAccepted with default headers values -func NewDeleteLogForwardAccepted() *DeleteLogForwardAccepted { - - return &DeleteLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the delete log forward accepted response -func (o *DeleteLogForwardAccepted) WithReloadID(reloadID string) *DeleteLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log forward accepted response -func (o *DeleteLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogForwardNoContentCode is the HTTP code returned for type DeleteLogForwardNoContent -const DeleteLogForwardNoContentCode int = 204 - -/* -DeleteLogForwardNoContent Log Forward deleted - -swagger:response deleteLogForwardNoContent -*/ -type DeleteLogForwardNoContent struct { -} - -// NewDeleteLogForwardNoContent creates DeleteLogForwardNoContent with default headers values -func NewDeleteLogForwardNoContent() *DeleteLogForwardNoContent { - - return &DeleteLogForwardNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogForwardNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogForwardNotFoundCode is the HTTP code returned for type DeleteLogForwardNotFound -const DeleteLogForwardNotFoundCode int = 404 - -/* -DeleteLogForwardNotFound The specified resource was not found - -swagger:response deleteLogForwardNotFound -*/ -type DeleteLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogForwardNotFound creates DeleteLogForwardNotFound with default headers values -func NewDeleteLogForwardNotFound() *DeleteLogForwardNotFound { - - return &DeleteLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log forward not found response -func (o *DeleteLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log forward not found response -func (o *DeleteLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log forward not found response -func (o *DeleteLogForwardNotFound) WithPayload(payload *models.Error) *DeleteLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log forward not found response -func (o *DeleteLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogForwardDefault General Error - -swagger:response deleteLogForwardDefault -*/ -type DeleteLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogForwardDefault creates DeleteLogForwardDefault with default headers values -func NewDeleteLogForwardDefault(code int) *DeleteLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log forward default response -func (o *DeleteLogForwardDefault) WithStatusCode(code int) *DeleteLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log forward default response -func (o *DeleteLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log forward default response -func (o *DeleteLogForwardDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log forward default response -func (o *DeleteLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log forward default response -func (o *DeleteLogForwardDefault) WithPayload(payload *models.Error) *DeleteLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log forward default response -func (o *DeleteLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_forward/delete_log_forward_urlbuilder.go b/operations/log_forward/delete_log_forward_urlbuilder.go deleted file mode 100644 index ff00b076..00000000 --- a/operations/log_forward/delete_log_forward_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogForwardURL generates an URL for the delete log forward operation -type DeleteLogForwardURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogForwardURL) WithBasePath(bp string) *DeleteLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_forward/get_log_forward.go b/operations/log_forward/get_log_forward.go deleted file mode 100644 index f66b077f..00000000 --- a/operations/log_forward/get_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogForwardHandlerFunc turns a function with the right signature into a get log forward handler -type GetLogForwardHandlerFunc func(GetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogForwardHandlerFunc) Handle(params GetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogForwardHandler interface for that can handle valid get log forward params -type GetLogForwardHandler interface { - Handle(GetLogForwardParams, interface{}) middleware.Responder -} - -// NewGetLogForward creates a new http.Handler for the get log forward operation -func NewGetLogForward(ctx *middleware.Context, handler GetLogForwardHandler) *GetLogForward { - return &GetLogForward{Context: ctx, Handler: handler} -} - -/* - GetLogForward swagger:route GET /services/haproxy/configuration/log_forwards/{name} LogForward getLogForward - -# Return a log forward - -Returns one log forward configuration by it's name. -*/ -type GetLogForward struct { - Context *middleware.Context - Handler GetLogForwardHandler -} - -func (o *GetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_forward/get_log_forward_parameters.go b/operations/log_forward/get_log_forward_parameters.go deleted file mode 100644 index ba466077..00000000 --- a/operations/log_forward/get_log_forward_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogForwardParams creates a new GetLogForwardParams object -// with the default values initialized. -func NewGetLogForwardParams() GetLogForwardParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetLogForwardParams{ - FullSection: &fullSectionDefault, - } -} - -// GetLogForwardParams contains all the bound params for the get log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogForward -type GetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Log Forward name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogForwardParams() beforehand. -func (o *GetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetLogForwardParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_forward/get_log_forward_responses.go b/operations/log_forward/get_log_forward_responses.go deleted file mode 100644 index e8d54f3e..00000000 --- a/operations/log_forward/get_log_forward_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogForwardOKCode is the HTTP code returned for type GetLogForwardOK -const GetLogForwardOKCode int = 200 - -/* -GetLogForwardOK Successful operation - -swagger:response getLogForwardOK -*/ -type GetLogForwardOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogForward `json:"body,omitempty"` -} - -// NewGetLogForwardOK creates GetLogForwardOK with default headers values -func NewGetLogForwardOK() *GetLogForwardOK { - - return &GetLogForwardOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log forward o k response -func (o *GetLogForwardOK) WithConfigurationVersion(configurationVersion string) *GetLogForwardOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log forward o k response -func (o *GetLogForwardOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log forward o k response -func (o *GetLogForwardOK) WithPayload(payload *models.LogForward) *GetLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log forward o k response -func (o *GetLogForwardOK) SetPayload(payload *models.LogForward) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogForwardNotFoundCode is the HTTP code returned for type GetLogForwardNotFound -const GetLogForwardNotFoundCode int = 404 - -/* -GetLogForwardNotFound The specified resource was not found - -swagger:response getLogForwardNotFound -*/ -type GetLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogForwardNotFound creates GetLogForwardNotFound with default headers values -func NewGetLogForwardNotFound() *GetLogForwardNotFound { - - return &GetLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log forward not found response -func (o *GetLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *GetLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log forward not found response -func (o *GetLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log forward not found response -func (o *GetLogForwardNotFound) WithPayload(payload *models.Error) *GetLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log forward not found response -func (o *GetLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogForwardDefault General Error - -swagger:response getLogForwardDefault -*/ -type GetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogForwardDefault creates GetLogForwardDefault with default headers values -func NewGetLogForwardDefault(code int) *GetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &GetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log forward default response -func (o *GetLogForwardDefault) WithStatusCode(code int) *GetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log forward default response -func (o *GetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log forward default response -func (o *GetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *GetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log forward default response -func (o *GetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log forward default response -func (o *GetLogForwardDefault) WithPayload(payload *models.Error) *GetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log forward default response -func (o *GetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_forward/get_log_forward_urlbuilder.go b/operations/log_forward/get_log_forward_urlbuilder.go deleted file mode 100644 index 6802d930..00000000 --- a/operations/log_forward/get_log_forward_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogForwardURL generates an URL for the get log forward operation -type GetLogForwardURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogForwardURL) WithBasePath(bp string) *GetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_forward/get_log_forwards.go b/operations/log_forward/get_log_forwards.go deleted file mode 100644 index 8e62bfcd..00000000 --- a/operations/log_forward/get_log_forwards.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogForwardsHandlerFunc turns a function with the right signature into a get log forwards handler -type GetLogForwardsHandlerFunc func(GetLogForwardsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogForwardsHandlerFunc) Handle(params GetLogForwardsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogForwardsHandler interface for that can handle valid get log forwards params -type GetLogForwardsHandler interface { - Handle(GetLogForwardsParams, interface{}) middleware.Responder -} - -// NewGetLogForwards creates a new http.Handler for the get log forwards operation -func NewGetLogForwards(ctx *middleware.Context, handler GetLogForwardsHandler) *GetLogForwards { - return &GetLogForwards{Context: ctx, Handler: handler} -} - -/* - GetLogForwards swagger:route GET /services/haproxy/configuration/log_forwards LogForward getLogForwards - -# Return an array of log forwards - -Returns an array of all configured log forwards. -*/ -type GetLogForwards struct { - Context *middleware.Context - Handler GetLogForwardsHandler -} - -func (o *GetLogForwards) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogForwardsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_forward/get_log_forwards_parameters.go b/operations/log_forward/get_log_forwards_parameters.go deleted file mode 100644 index a74542df..00000000 --- a/operations/log_forward/get_log_forwards_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogForwardsParams creates a new GetLogForwardsParams object -// with the default values initialized. -func NewGetLogForwardsParams() GetLogForwardsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetLogForwardsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetLogForwardsParams contains all the bound params for the get log forwards operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogForwards -type GetLogForwardsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogForwardsParams() beforehand. -func (o *GetLogForwardsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetLogForwardsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetLogForwardsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogForwardsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_forward/get_log_forwards_responses.go b/operations/log_forward/get_log_forwards_responses.go deleted file mode 100644 index cf69f31f..00000000 --- a/operations/log_forward/get_log_forwards_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogForwardsOKCode is the HTTP code returned for type GetLogForwardsOK -const GetLogForwardsOKCode int = 200 - -/* -GetLogForwardsOK Successful operation - -swagger:response getLogForwardsOK -*/ -type GetLogForwardsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogForwards `json:"body,omitempty"` -} - -// NewGetLogForwardsOK creates GetLogForwardsOK with default headers values -func NewGetLogForwardsOK() *GetLogForwardsOK { - - return &GetLogForwardsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log forwards o k response -func (o *GetLogForwardsOK) WithConfigurationVersion(configurationVersion string) *GetLogForwardsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log forwards o k response -func (o *GetLogForwardsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log forwards o k response -func (o *GetLogForwardsOK) WithPayload(payload models.LogForwards) *GetLogForwardsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log forwards o k response -func (o *GetLogForwardsOK) SetPayload(payload models.LogForwards) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogForwardsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogForwards{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetLogForwardsDefault General Error - -swagger:response getLogForwardsDefault -*/ -type GetLogForwardsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogForwardsDefault creates GetLogForwardsDefault with default headers values -func NewGetLogForwardsDefault(code int) *GetLogForwardsDefault { - if code <= 0 { - code = 500 - } - - return &GetLogForwardsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log forwards default response -func (o *GetLogForwardsDefault) WithStatusCode(code int) *GetLogForwardsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log forwards default response -func (o *GetLogForwardsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log forwards default response -func (o *GetLogForwardsDefault) WithConfigurationVersion(configurationVersion string) *GetLogForwardsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log forwards default response -func (o *GetLogForwardsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log forwards default response -func (o *GetLogForwardsDefault) WithPayload(payload *models.Error) *GetLogForwardsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log forwards default response -func (o *GetLogForwardsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogForwardsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_forward/get_log_forwards_urlbuilder.go b/operations/log_forward/get_log_forwards_urlbuilder.go deleted file mode 100644 index 0bd00ddc..00000000 --- a/operations/log_forward/get_log_forwards_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetLogForwardsURL generates an URL for the get log forwards operation -type GetLogForwardsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogForwardsURL) WithBasePath(bp string) *GetLogForwardsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogForwardsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogForwardsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogForwardsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogForwardsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogForwardsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogForwardsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogForwardsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogForwardsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_forward/replace_log_forward.go b/operations/log_forward/replace_log_forward.go deleted file mode 100644 index 1dced43d..00000000 --- a/operations/log_forward/replace_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogForwardHandlerFunc turns a function with the right signature into a replace log forward handler -type ReplaceLogForwardHandlerFunc func(ReplaceLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogForwardHandlerFunc) Handle(params ReplaceLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogForwardHandler interface for that can handle valid replace log forward params -type ReplaceLogForwardHandler interface { - Handle(ReplaceLogForwardParams, interface{}) middleware.Responder -} - -// NewReplaceLogForward creates a new http.Handler for the replace log forward operation -func NewReplaceLogForward(ctx *middleware.Context, handler ReplaceLogForwardHandler) *ReplaceLogForward { - return &ReplaceLogForward{Context: ctx, Handler: handler} -} - -/* - ReplaceLogForward swagger:route PUT /services/haproxy/configuration/log_forwards/{name} LogForward replaceLogForward - -# Replace a log forward - -Replaces a log forward configuration by it's name. -*/ -type ReplaceLogForward struct { - Context *middleware.Context - Handler ReplaceLogForwardHandler -} - -func (o *ReplaceLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_forward/replace_log_forward_parameters.go b/operations/log_forward/replace_log_forward_parameters.go deleted file mode 100644 index b9d4cdcc..00000000 --- a/operations/log_forward/replace_log_forward_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogForwardParams creates a new ReplaceLogForwardParams object -// with the default values initialized. -func NewReplaceLogForwardParams() ReplaceLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceLogForwardParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceLogForwardParams contains all the bound params for the replace log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogForward -type ReplaceLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogForward - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Log Forward name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogForwardParams() beforehand. -func (o *ReplaceLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogForward - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceLogForwardParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceLogForwardParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_forward/replace_log_forward_responses.go b/operations/log_forward/replace_log_forward_responses.go deleted file mode 100644 index e80f0150..00000000 --- a/operations/log_forward/replace_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogForwardOKCode is the HTTP code returned for type ReplaceLogForwardOK -const ReplaceLogForwardOKCode int = 200 - -/* -ReplaceLogForwardOK Log Forward replaced - -swagger:response replaceLogForwardOK -*/ -type ReplaceLogForwardOK struct { - - /* - In: Body - */ - Payload *models.LogForward `json:"body,omitempty"` -} - -// NewReplaceLogForwardOK creates ReplaceLogForwardOK with default headers values -func NewReplaceLogForwardOK() *ReplaceLogForwardOK { - - return &ReplaceLogForwardOK{} -} - -// WithPayload adds the payload to the replace log forward o k response -func (o *ReplaceLogForwardOK) WithPayload(payload *models.LogForward) *ReplaceLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log forward o k response -func (o *ReplaceLogForwardOK) SetPayload(payload *models.LogForward) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogForwardAcceptedCode is the HTTP code returned for type ReplaceLogForwardAccepted -const ReplaceLogForwardAcceptedCode int = 202 - -/* -ReplaceLogForwardAccepted Configuration change accepted and reload requested - -swagger:response replaceLogForwardAccepted -*/ -type ReplaceLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogForward `json:"body,omitempty"` -} - -// NewReplaceLogForwardAccepted creates ReplaceLogForwardAccepted with default headers values -func NewReplaceLogForwardAccepted() *ReplaceLogForwardAccepted { - - return &ReplaceLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the replace log forward accepted response -func (o *ReplaceLogForwardAccepted) WithReloadID(reloadID string) *ReplaceLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log forward accepted response -func (o *ReplaceLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log forward accepted response -func (o *ReplaceLogForwardAccepted) WithPayload(payload *models.LogForward) *ReplaceLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log forward accepted response -func (o *ReplaceLogForwardAccepted) SetPayload(payload *models.LogForward) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogForwardBadRequestCode is the HTTP code returned for type ReplaceLogForwardBadRequest -const ReplaceLogForwardBadRequestCode int = 400 - -/* -ReplaceLogForwardBadRequest Bad request - -swagger:response replaceLogForwardBadRequest -*/ -type ReplaceLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogForwardBadRequest creates ReplaceLogForwardBadRequest with default headers values -func NewReplaceLogForwardBadRequest() *ReplaceLogForwardBadRequest { - - return &ReplaceLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log forward bad request response -func (o *ReplaceLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log forward bad request response -func (o *ReplaceLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log forward bad request response -func (o *ReplaceLogForwardBadRequest) WithPayload(payload *models.Error) *ReplaceLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log forward bad request response -func (o *ReplaceLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogForwardNotFoundCode is the HTTP code returned for type ReplaceLogForwardNotFound -const ReplaceLogForwardNotFoundCode int = 404 - -/* -ReplaceLogForwardNotFound The specified resource was not found - -swagger:response replaceLogForwardNotFound -*/ -type ReplaceLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogForwardNotFound creates ReplaceLogForwardNotFound with default headers values -func NewReplaceLogForwardNotFound() *ReplaceLogForwardNotFound { - - return &ReplaceLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log forward not found response -func (o *ReplaceLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log forward not found response -func (o *ReplaceLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log forward not found response -func (o *ReplaceLogForwardNotFound) WithPayload(payload *models.Error) *ReplaceLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log forward not found response -func (o *ReplaceLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogForwardDefault General Error - -swagger:response replaceLogForwardDefault -*/ -type ReplaceLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogForwardDefault creates ReplaceLogForwardDefault with default headers values -func NewReplaceLogForwardDefault(code int) *ReplaceLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log forward default response -func (o *ReplaceLogForwardDefault) WithStatusCode(code int) *ReplaceLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log forward default response -func (o *ReplaceLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log forward default response -func (o *ReplaceLogForwardDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log forward default response -func (o *ReplaceLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log forward default response -func (o *ReplaceLogForwardDefault) WithPayload(payload *models.Error) *ReplaceLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log forward default response -func (o *ReplaceLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_forward/replace_log_forward_urlbuilder.go b/operations/log_forward/replace_log_forward_urlbuilder.go deleted file mode 100644 index d5a61125..00000000 --- a/operations/log_forward/replace_log_forward_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_forward - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogForwardURL generates an URL for the replace log forward operation -type ReplaceLogForwardURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogForwardURL) WithBasePath(bp string) *ReplaceLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_profile/create_log_profile.go b/operations/log_profile/create_log_profile.go deleted file mode 100644 index 9aee48e4..00000000 --- a/operations/log_profile/create_log_profile.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogProfileHandlerFunc turns a function with the right signature into a create log profile handler -type CreateLogProfileHandlerFunc func(CreateLogProfileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogProfileHandlerFunc) Handle(params CreateLogProfileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogProfileHandler interface for that can handle valid create log profile params -type CreateLogProfileHandler interface { - Handle(CreateLogProfileParams, interface{}) middleware.Responder -} - -// NewCreateLogProfile creates a new http.Handler for the create log profile operation -func NewCreateLogProfile(ctx *middleware.Context, handler CreateLogProfileHandler) *CreateLogProfile { - return &CreateLogProfile{Context: ctx, Handler: handler} -} - -/* - CreateLogProfile swagger:route POST /services/haproxy/configuration/log_profiles LogProfile createLogProfile - -# Add a new Log Profile - -Creates a new log_profile section -*/ -type CreateLogProfile struct { - Context *middleware.Context - Handler CreateLogProfileHandler -} - -func (o *CreateLogProfile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogProfileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_profile/create_log_profile_parameters.go b/operations/log_profile/create_log_profile_parameters.go deleted file mode 100644 index 9f0b4941..00000000 --- a/operations/log_profile/create_log_profile_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogProfileParams creates a new CreateLogProfileParams object -// with the default values initialized. -func NewCreateLogProfileParams() CreateLogProfileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogProfileParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogProfileParams contains all the bound params for the create log profile operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogProfile -type CreateLogProfileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogProfile - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogProfileParams() beforehand. -func (o *CreateLogProfileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogProfile - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogProfileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogProfileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogProfileParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogProfileParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_profile/create_log_profile_responses.go b/operations/log_profile/create_log_profile_responses.go deleted file mode 100644 index acf83f5a..00000000 --- a/operations/log_profile/create_log_profile_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogProfileCreatedCode is the HTTP code returned for type CreateLogProfileCreated -const CreateLogProfileCreatedCode int = 201 - -/* -CreateLogProfileCreated Log Profile created - -swagger:response createLogProfileCreated -*/ -type CreateLogProfileCreated struct { - - /* - In: Body - */ - Payload *models.LogProfile `json:"body,omitempty"` -} - -// NewCreateLogProfileCreated creates CreateLogProfileCreated with default headers values -func NewCreateLogProfileCreated() *CreateLogProfileCreated { - - return &CreateLogProfileCreated{} -} - -// WithPayload adds the payload to the create log profile created response -func (o *CreateLogProfileCreated) WithPayload(payload *models.LogProfile) *CreateLogProfileCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log profile created response -func (o *CreateLogProfileCreated) SetPayload(payload *models.LogProfile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogProfileCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogProfileAcceptedCode is the HTTP code returned for type CreateLogProfileAccepted -const CreateLogProfileAcceptedCode int = 202 - -/* -CreateLogProfileAccepted Configuration change accepted and reload requested - -swagger:response createLogProfileAccepted -*/ -type CreateLogProfileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogProfile `json:"body,omitempty"` -} - -// NewCreateLogProfileAccepted creates CreateLogProfileAccepted with default headers values -func NewCreateLogProfileAccepted() *CreateLogProfileAccepted { - - return &CreateLogProfileAccepted{} -} - -// WithReloadID adds the reloadId to the create log profile accepted response -func (o *CreateLogProfileAccepted) WithReloadID(reloadID string) *CreateLogProfileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log profile accepted response -func (o *CreateLogProfileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log profile accepted response -func (o *CreateLogProfileAccepted) WithPayload(payload *models.LogProfile) *CreateLogProfileAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log profile accepted response -func (o *CreateLogProfileAccepted) SetPayload(payload *models.LogProfile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogProfileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogProfileBadRequestCode is the HTTP code returned for type CreateLogProfileBadRequest -const CreateLogProfileBadRequestCode int = 400 - -/* -CreateLogProfileBadRequest Bad request - -swagger:response createLogProfileBadRequest -*/ -type CreateLogProfileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogProfileBadRequest creates CreateLogProfileBadRequest with default headers values -func NewCreateLogProfileBadRequest() *CreateLogProfileBadRequest { - - return &CreateLogProfileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log profile bad request response -func (o *CreateLogProfileBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogProfileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log profile bad request response -func (o *CreateLogProfileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log profile bad request response -func (o *CreateLogProfileBadRequest) WithPayload(payload *models.Error) *CreateLogProfileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log profile bad request response -func (o *CreateLogProfileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogProfileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogProfileConflictCode is the HTTP code returned for type CreateLogProfileConflict -const CreateLogProfileConflictCode int = 409 - -/* -CreateLogProfileConflict The specified resource already exists - -swagger:response createLogProfileConflict -*/ -type CreateLogProfileConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogProfileConflict creates CreateLogProfileConflict with default headers values -func NewCreateLogProfileConflict() *CreateLogProfileConflict { - - return &CreateLogProfileConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log profile conflict response -func (o *CreateLogProfileConflict) WithConfigurationVersion(configurationVersion string) *CreateLogProfileConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log profile conflict response -func (o *CreateLogProfileConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log profile conflict response -func (o *CreateLogProfileConflict) WithPayload(payload *models.Error) *CreateLogProfileConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log profile conflict response -func (o *CreateLogProfileConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogProfileConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogProfileDefault General Error - -swagger:response createLogProfileDefault -*/ -type CreateLogProfileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogProfileDefault creates CreateLogProfileDefault with default headers values -func NewCreateLogProfileDefault(code int) *CreateLogProfileDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogProfileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log profile default response -func (o *CreateLogProfileDefault) WithStatusCode(code int) *CreateLogProfileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log profile default response -func (o *CreateLogProfileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log profile default response -func (o *CreateLogProfileDefault) WithConfigurationVersion(configurationVersion string) *CreateLogProfileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log profile default response -func (o *CreateLogProfileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log profile default response -func (o *CreateLogProfileDefault) WithPayload(payload *models.Error) *CreateLogProfileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log profile default response -func (o *CreateLogProfileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogProfileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_profile/create_log_profile_urlbuilder.go b/operations/log_profile/create_log_profile_urlbuilder.go deleted file mode 100644 index 8098f2fe..00000000 --- a/operations/log_profile/create_log_profile_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateLogProfileURL generates an URL for the create log profile operation -type CreateLogProfileURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogProfileURL) WithBasePath(bp string) *CreateLogProfileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogProfileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogProfileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_profiles" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogProfileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogProfileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogProfileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogProfileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogProfileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogProfileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_profile/delete_log_profile.go b/operations/log_profile/delete_log_profile.go deleted file mode 100644 index 11c78fc7..00000000 --- a/operations/log_profile/delete_log_profile.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogProfileHandlerFunc turns a function with the right signature into a delete log profile handler -type DeleteLogProfileHandlerFunc func(DeleteLogProfileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogProfileHandlerFunc) Handle(params DeleteLogProfileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogProfileHandler interface for that can handle valid delete log profile params -type DeleteLogProfileHandler interface { - Handle(DeleteLogProfileParams, interface{}) middleware.Responder -} - -// NewDeleteLogProfile creates a new http.Handler for the delete log profile operation -func NewDeleteLogProfile(ctx *middleware.Context, handler DeleteLogProfileHandler) *DeleteLogProfile { - return &DeleteLogProfile{Context: ctx, Handler: handler} -} - -/* - DeleteLogProfile swagger:route DELETE /services/haproxy/configuration/log_profiles/{name} LogProfile deleteLogProfile - -# Delete a Log Profile - -Deletes a log_profile section from the configuration -*/ -type DeleteLogProfile struct { - Context *middleware.Context - Handler DeleteLogProfileHandler -} - -func (o *DeleteLogProfile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogProfileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_profile/delete_log_profile_parameters.go b/operations/log_profile/delete_log_profile_parameters.go deleted file mode 100644 index 8142fb18..00000000 --- a/operations/log_profile/delete_log_profile_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogProfileParams creates a new DeleteLogProfileParams object -// with the default values initialized. -func NewDeleteLogProfileParams() DeleteLogProfileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogProfileParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogProfileParams contains all the bound params for the delete log profile operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogProfile -type DeleteLogProfileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*log_profile name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogProfileParams() beforehand. -func (o *DeleteLogProfileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogProfileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogProfileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteLogProfileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogProfileParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogProfileParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_profile/delete_log_profile_responses.go b/operations/log_profile/delete_log_profile_responses.go deleted file mode 100644 index c91458f1..00000000 --- a/operations/log_profile/delete_log_profile_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogProfileAcceptedCode is the HTTP code returned for type DeleteLogProfileAccepted -const DeleteLogProfileAcceptedCode int = 202 - -/* -DeleteLogProfileAccepted Configuration change accepted and reload requested - -swagger:response deleteLogProfileAccepted -*/ -type DeleteLogProfileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogProfileAccepted creates DeleteLogProfileAccepted with default headers values -func NewDeleteLogProfileAccepted() *DeleteLogProfileAccepted { - - return &DeleteLogProfileAccepted{} -} - -// WithReloadID adds the reloadId to the delete log profile accepted response -func (o *DeleteLogProfileAccepted) WithReloadID(reloadID string) *DeleteLogProfileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log profile accepted response -func (o *DeleteLogProfileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogProfileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogProfileNoContentCode is the HTTP code returned for type DeleteLogProfileNoContent -const DeleteLogProfileNoContentCode int = 204 - -/* -DeleteLogProfileNoContent log_profile deleted - -swagger:response deleteLogProfileNoContent -*/ -type DeleteLogProfileNoContent struct { -} - -// NewDeleteLogProfileNoContent creates DeleteLogProfileNoContent with default headers values -func NewDeleteLogProfileNoContent() *DeleteLogProfileNoContent { - - return &DeleteLogProfileNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogProfileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogProfileNotFoundCode is the HTTP code returned for type DeleteLogProfileNotFound -const DeleteLogProfileNotFoundCode int = 404 - -/* -DeleteLogProfileNotFound The specified resource was not found - -swagger:response deleteLogProfileNotFound -*/ -type DeleteLogProfileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogProfileNotFound creates DeleteLogProfileNotFound with default headers values -func NewDeleteLogProfileNotFound() *DeleteLogProfileNotFound { - - return &DeleteLogProfileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log profile not found response -func (o *DeleteLogProfileNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogProfileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log profile not found response -func (o *DeleteLogProfileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log profile not found response -func (o *DeleteLogProfileNotFound) WithPayload(payload *models.Error) *DeleteLogProfileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log profile not found response -func (o *DeleteLogProfileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogProfileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogProfileDefault General Error - -swagger:response deleteLogProfileDefault -*/ -type DeleteLogProfileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogProfileDefault creates DeleteLogProfileDefault with default headers values -func NewDeleteLogProfileDefault(code int) *DeleteLogProfileDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogProfileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log profile default response -func (o *DeleteLogProfileDefault) WithStatusCode(code int) *DeleteLogProfileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log profile default response -func (o *DeleteLogProfileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log profile default response -func (o *DeleteLogProfileDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogProfileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log profile default response -func (o *DeleteLogProfileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log profile default response -func (o *DeleteLogProfileDefault) WithPayload(payload *models.Error) *DeleteLogProfileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log profile default response -func (o *DeleteLogProfileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogProfileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_profile/delete_log_profile_urlbuilder.go b/operations/log_profile/delete_log_profile_urlbuilder.go deleted file mode 100644 index c052d423..00000000 --- a/operations/log_profile/delete_log_profile_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogProfileURL generates an URL for the delete log profile operation -type DeleteLogProfileURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogProfileURL) WithBasePath(bp string) *DeleteLogProfileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogProfileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogProfileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_profiles/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteLogProfileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogProfileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogProfileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogProfileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogProfileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogProfileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogProfileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_profile/edit_log_profile.go b/operations/log_profile/edit_log_profile.go deleted file mode 100644 index 6c4632a0..00000000 --- a/operations/log_profile/edit_log_profile.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// EditLogProfileHandlerFunc turns a function with the right signature into a edit log profile handler -type EditLogProfileHandlerFunc func(EditLogProfileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditLogProfileHandlerFunc) Handle(params EditLogProfileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// EditLogProfileHandler interface for that can handle valid edit log profile params -type EditLogProfileHandler interface { - Handle(EditLogProfileParams, interface{}) middleware.Responder -} - -// NewEditLogProfile creates a new http.Handler for the edit log profile operation -func NewEditLogProfile(ctx *middleware.Context, handler EditLogProfileHandler) *EditLogProfile { - return &EditLogProfile{Context: ctx, Handler: handler} -} - -/* - EditLogProfile swagger:route PUT /services/haproxy/configuration/log_profiles/{name} LogProfile editLogProfile - -# Modify a Log Profile - -Modifies a log_profile's configuration by its name -*/ -type EditLogProfile struct { - Context *middleware.Context - Handler EditLogProfileHandler -} - -func (o *EditLogProfile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditLogProfileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_profile/edit_log_profile_parameters.go b/operations/log_profile/edit_log_profile_parameters.go deleted file mode 100644 index e10fb414..00000000 --- a/operations/log_profile/edit_log_profile_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewEditLogProfileParams creates a new EditLogProfileParams object -// with the default values initialized. -func NewEditLogProfileParams() EditLogProfileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return EditLogProfileParams{ - ForceReload: &forceReloadDefault, - } -} - -// EditLogProfileParams contains all the bound params for the edit log profile operation -// typically these are obtained from a http.Request -// -// swagger:parameters editLogProfile -type EditLogProfileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogProfile - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*log_profile name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEditLogProfileParams() beforehand. -func (o *EditLogProfileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogProfile - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *EditLogProfileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewEditLogProfileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *EditLogProfileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *EditLogProfileParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *EditLogProfileParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_profile/edit_log_profile_responses.go b/operations/log_profile/edit_log_profile_responses.go deleted file mode 100644 index 59b9a4ef..00000000 --- a/operations/log_profile/edit_log_profile_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// EditLogProfileOKCode is the HTTP code returned for type EditLogProfileOK -const EditLogProfileOKCode int = 200 - -/* -EditLogProfileOK log_profile configuration updated - -swagger:response editLogProfileOK -*/ -type EditLogProfileOK struct { - - /* - In: Body - */ - Payload *models.LogProfile `json:"body,omitempty"` -} - -// NewEditLogProfileOK creates EditLogProfileOK with default headers values -func NewEditLogProfileOK() *EditLogProfileOK { - - return &EditLogProfileOK{} -} - -// WithPayload adds the payload to the edit log profile o k response -func (o *EditLogProfileOK) WithPayload(payload *models.LogProfile) *EditLogProfileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit log profile o k response -func (o *EditLogProfileOK) SetPayload(payload *models.LogProfile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditLogProfileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditLogProfileAcceptedCode is the HTTP code returned for type EditLogProfileAccepted -const EditLogProfileAcceptedCode int = 202 - -/* -EditLogProfileAccepted Configuration change accepted and reload requested - -swagger:response editLogProfileAccepted -*/ -type EditLogProfileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogProfile `json:"body,omitempty"` -} - -// NewEditLogProfileAccepted creates EditLogProfileAccepted with default headers values -func NewEditLogProfileAccepted() *EditLogProfileAccepted { - - return &EditLogProfileAccepted{} -} - -// WithReloadID adds the reloadId to the edit log profile accepted response -func (o *EditLogProfileAccepted) WithReloadID(reloadID string) *EditLogProfileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the edit log profile accepted response -func (o *EditLogProfileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the edit log profile accepted response -func (o *EditLogProfileAccepted) WithPayload(payload *models.LogProfile) *EditLogProfileAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit log profile accepted response -func (o *EditLogProfileAccepted) SetPayload(payload *models.LogProfile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditLogProfileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditLogProfileBadRequestCode is the HTTP code returned for type EditLogProfileBadRequest -const EditLogProfileBadRequestCode int = 400 - -/* -EditLogProfileBadRequest Bad request - -swagger:response editLogProfileBadRequest -*/ -type EditLogProfileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditLogProfileBadRequest creates EditLogProfileBadRequest with default headers values -func NewEditLogProfileBadRequest() *EditLogProfileBadRequest { - - return &EditLogProfileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit log profile bad request response -func (o *EditLogProfileBadRequest) WithConfigurationVersion(configurationVersion string) *EditLogProfileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit log profile bad request response -func (o *EditLogProfileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit log profile bad request response -func (o *EditLogProfileBadRequest) WithPayload(payload *models.Error) *EditLogProfileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit log profile bad request response -func (o *EditLogProfileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditLogProfileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditLogProfileNotFoundCode is the HTTP code returned for type EditLogProfileNotFound -const EditLogProfileNotFoundCode int = 404 - -/* -EditLogProfileNotFound The specified resource was not found - -swagger:response editLogProfileNotFound -*/ -type EditLogProfileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditLogProfileNotFound creates EditLogProfileNotFound with default headers values -func NewEditLogProfileNotFound() *EditLogProfileNotFound { - - return &EditLogProfileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit log profile not found response -func (o *EditLogProfileNotFound) WithConfigurationVersion(configurationVersion string) *EditLogProfileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit log profile not found response -func (o *EditLogProfileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit log profile not found response -func (o *EditLogProfileNotFound) WithPayload(payload *models.Error) *EditLogProfileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit log profile not found response -func (o *EditLogProfileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditLogProfileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -EditLogProfileDefault General Error - -swagger:response editLogProfileDefault -*/ -type EditLogProfileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditLogProfileDefault creates EditLogProfileDefault with default headers values -func NewEditLogProfileDefault(code int) *EditLogProfileDefault { - if code <= 0 { - code = 500 - } - - return &EditLogProfileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit log profile default response -func (o *EditLogProfileDefault) WithStatusCode(code int) *EditLogProfileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit log profile default response -func (o *EditLogProfileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the edit log profile default response -func (o *EditLogProfileDefault) WithConfigurationVersion(configurationVersion string) *EditLogProfileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit log profile default response -func (o *EditLogProfileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit log profile default response -func (o *EditLogProfileDefault) WithPayload(payload *models.Error) *EditLogProfileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit log profile default response -func (o *EditLogProfileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditLogProfileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_profile/edit_log_profile_urlbuilder.go b/operations/log_profile/edit_log_profile_urlbuilder.go deleted file mode 100644 index c9e9a19c..00000000 --- a/operations/log_profile/edit_log_profile_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// EditLogProfileURL generates an URL for the edit log profile operation -type EditLogProfileURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditLogProfileURL) WithBasePath(bp string) *EditLogProfileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditLogProfileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditLogProfileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_profiles/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on EditLogProfileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EditLogProfileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EditLogProfileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditLogProfileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditLogProfileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditLogProfileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EditLogProfileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_profile/get_log_profile.go b/operations/log_profile/get_log_profile.go deleted file mode 100644 index 9810df02..00000000 --- a/operations/log_profile/get_log_profile.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogProfileHandlerFunc turns a function with the right signature into a get log profile handler -type GetLogProfileHandlerFunc func(GetLogProfileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogProfileHandlerFunc) Handle(params GetLogProfileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogProfileHandler interface for that can handle valid get log profile params -type GetLogProfileHandler interface { - Handle(GetLogProfileParams, interface{}) middleware.Responder -} - -// NewGetLogProfile creates a new http.Handler for the get log profile operation -func NewGetLogProfile(ctx *middleware.Context, handler GetLogProfileHandler) *GetLogProfile { - return &GetLogProfile{Context: ctx, Handler: handler} -} - -/* - GetLogProfile swagger:route GET /services/haproxy/configuration/log_profiles/{name} LogProfile getLogProfile - -# Return a Log Profile - -Find a log_profile section by its name -*/ -type GetLogProfile struct { - Context *middleware.Context - Handler GetLogProfileHandler -} - -func (o *GetLogProfile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogProfileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_profile/get_log_profile_parameters.go b/operations/log_profile/get_log_profile_parameters.go deleted file mode 100644 index 265fe4d4..00000000 --- a/operations/log_profile/get_log_profile_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetLogProfileParams creates a new GetLogProfileParams object -// -// There are no default values defined in the spec. -func NewGetLogProfileParams() GetLogProfileParams { - - return GetLogProfileParams{} -} - -// GetLogProfileParams contains all the bound params for the get log profile operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogProfile -type GetLogProfileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*log_profile name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogProfileParams() beforehand. -func (o *GetLogProfileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetLogProfileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogProfileParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_profile/get_log_profile_responses.go b/operations/log_profile/get_log_profile_responses.go deleted file mode 100644 index 3debfef4..00000000 --- a/operations/log_profile/get_log_profile_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogProfileOKCode is the HTTP code returned for type GetLogProfileOK -const GetLogProfileOKCode int = 200 - -/* -GetLogProfileOK Successful operation - -swagger:response getLogProfileOK -*/ -type GetLogProfileOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogProfile `json:"body,omitempty"` -} - -// NewGetLogProfileOK creates GetLogProfileOK with default headers values -func NewGetLogProfileOK() *GetLogProfileOK { - - return &GetLogProfileOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log profile o k response -func (o *GetLogProfileOK) WithConfigurationVersion(configurationVersion string) *GetLogProfileOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log profile o k response -func (o *GetLogProfileOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log profile o k response -func (o *GetLogProfileOK) WithPayload(payload *models.LogProfile) *GetLogProfileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log profile o k response -func (o *GetLogProfileOK) SetPayload(payload *models.LogProfile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogProfileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogProfileNotFoundCode is the HTTP code returned for type GetLogProfileNotFound -const GetLogProfileNotFoundCode int = 404 - -/* -GetLogProfileNotFound The specified resource was not found - -swagger:response getLogProfileNotFound -*/ -type GetLogProfileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogProfileNotFound creates GetLogProfileNotFound with default headers values -func NewGetLogProfileNotFound() *GetLogProfileNotFound { - - return &GetLogProfileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log profile not found response -func (o *GetLogProfileNotFound) WithConfigurationVersion(configurationVersion string) *GetLogProfileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log profile not found response -func (o *GetLogProfileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log profile not found response -func (o *GetLogProfileNotFound) WithPayload(payload *models.Error) *GetLogProfileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log profile not found response -func (o *GetLogProfileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogProfileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogProfileDefault General Error - -swagger:response getLogProfileDefault -*/ -type GetLogProfileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogProfileDefault creates GetLogProfileDefault with default headers values -func NewGetLogProfileDefault(code int) *GetLogProfileDefault { - if code <= 0 { - code = 500 - } - - return &GetLogProfileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log profile default response -func (o *GetLogProfileDefault) WithStatusCode(code int) *GetLogProfileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log profile default response -func (o *GetLogProfileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log profile default response -func (o *GetLogProfileDefault) WithConfigurationVersion(configurationVersion string) *GetLogProfileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log profile default response -func (o *GetLogProfileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log profile default response -func (o *GetLogProfileDefault) WithPayload(payload *models.Error) *GetLogProfileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log profile default response -func (o *GetLogProfileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogProfileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_profile/get_log_profile_urlbuilder.go b/operations/log_profile/get_log_profile_urlbuilder.go deleted file mode 100644 index b2acbeaf..00000000 --- a/operations/log_profile/get_log_profile_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetLogProfileURL generates an URL for the get log profile operation -type GetLogProfileURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogProfileURL) WithBasePath(bp string) *GetLogProfileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogProfileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogProfileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_profiles/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetLogProfileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogProfileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogProfileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogProfileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogProfileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogProfileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogProfileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_profile/get_log_profiles.go b/operations/log_profile/get_log_profiles.go deleted file mode 100644 index 63f1086c..00000000 --- a/operations/log_profile/get_log_profiles.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogProfilesHandlerFunc turns a function with the right signature into a get log profiles handler -type GetLogProfilesHandlerFunc func(GetLogProfilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogProfilesHandlerFunc) Handle(params GetLogProfilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogProfilesHandler interface for that can handle valid get log profiles params -type GetLogProfilesHandler interface { - Handle(GetLogProfilesParams, interface{}) middleware.Responder -} - -// NewGetLogProfiles creates a new http.Handler for the get log profiles operation -func NewGetLogProfiles(ctx *middleware.Context, handler GetLogProfilesHandler) *GetLogProfiles { - return &GetLogProfiles{Context: ctx, Handler: handler} -} - -/* - GetLogProfiles swagger:route GET /services/haproxy/configuration/log_profiles LogProfile getLogProfiles - -# Return all the Log Profiles - -Returns an array of all the configured log_profile sections in HAProxy -*/ -type GetLogProfiles struct { - Context *middleware.Context - Handler GetLogProfilesHandler -} - -func (o *GetLogProfiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogProfilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_profile/get_log_profiles_parameters.go b/operations/log_profile/get_log_profiles_parameters.go deleted file mode 100644 index df943ec4..00000000 --- a/operations/log_profile/get_log_profiles_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetLogProfilesParams creates a new GetLogProfilesParams object -// -// There are no default values defined in the spec. -func NewGetLogProfilesParams() GetLogProfilesParams { - - return GetLogProfilesParams{} -} - -// GetLogProfilesParams contains all the bound params for the get log profiles operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogProfiles -type GetLogProfilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogProfilesParams() beforehand. -func (o *GetLogProfilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogProfilesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_profile/get_log_profiles_responses.go b/operations/log_profile/get_log_profiles_responses.go deleted file mode 100644 index f27e6f60..00000000 --- a/operations/log_profile/get_log_profiles_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogProfilesOKCode is the HTTP code returned for type GetLogProfilesOK -const GetLogProfilesOKCode int = 200 - -/* -GetLogProfilesOK Successful operation - -swagger:response getLogProfilesOK -*/ -type GetLogProfilesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogProfiles `json:"body,omitempty"` -} - -// NewGetLogProfilesOK creates GetLogProfilesOK with default headers values -func NewGetLogProfilesOK() *GetLogProfilesOK { - - return &GetLogProfilesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log profiles o k response -func (o *GetLogProfilesOK) WithConfigurationVersion(configurationVersion string) *GetLogProfilesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log profiles o k response -func (o *GetLogProfilesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log profiles o k response -func (o *GetLogProfilesOK) WithPayload(payload models.LogProfiles) *GetLogProfilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log profiles o k response -func (o *GetLogProfilesOK) SetPayload(payload models.LogProfiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogProfilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogProfiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetLogProfilesDefault General Error - -swagger:response getLogProfilesDefault -*/ -type GetLogProfilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogProfilesDefault creates GetLogProfilesDefault with default headers values -func NewGetLogProfilesDefault(code int) *GetLogProfilesDefault { - if code <= 0 { - code = 500 - } - - return &GetLogProfilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log profiles default response -func (o *GetLogProfilesDefault) WithStatusCode(code int) *GetLogProfilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log profiles default response -func (o *GetLogProfilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log profiles default response -func (o *GetLogProfilesDefault) WithConfigurationVersion(configurationVersion string) *GetLogProfilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log profiles default response -func (o *GetLogProfilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log profiles default response -func (o *GetLogProfilesDefault) WithPayload(payload *models.Error) *GetLogProfilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log profiles default response -func (o *GetLogProfilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogProfilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_profile/get_log_profiles_urlbuilder.go b/operations/log_profile/get_log_profiles_urlbuilder.go deleted file mode 100644 index c0e6e16e..00000000 --- a/operations/log_profile/get_log_profiles_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_profile - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetLogProfilesURL generates an URL for the get log profiles operation -type GetLogProfilesURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogProfilesURL) WithBasePath(bp string) *GetLogProfilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogProfilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogProfilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_profiles" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogProfilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogProfilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogProfilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogProfilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogProfilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogProfilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_backend.go b/operations/log_target/create_log_target_backend.go deleted file mode 100644 index 85c40f2c..00000000 --- a/operations/log_target/create_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetBackendHandlerFunc turns a function with the right signature into a create log target backend handler -type CreateLogTargetBackendHandlerFunc func(CreateLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetBackendHandlerFunc) Handle(params CreateLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetBackendHandler interface for that can handle valid create log target backend params -type CreateLogTargetBackendHandler interface { - Handle(CreateLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetBackend creates a new http.Handler for the create log target backend operation -func NewCreateLogTargetBackend(ctx *middleware.Context, handler CreateLogTargetBackendHandler) *CreateLogTargetBackend { - return &CreateLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/log_targets/{index} LogTarget createLogTargetBackend - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetBackend struct { - Context *middleware.Context - Handler CreateLogTargetBackendHandler -} - -func (o *CreateLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_backend_parameters.go b/operations/log_target/create_log_target_backend_parameters.go deleted file mode 100644 index b642be2f..00000000 --- a/operations/log_target/create_log_target_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetBackendParams creates a new CreateLogTargetBackendParams object -// with the default values initialized. -func NewCreateLogTargetBackendParams() CreateLogTargetBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetBackendParams contains all the bound params for the create log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetBackend -type CreateLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetBackendParams() beforehand. -func (o *CreateLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_backend_responses.go b/operations/log_target/create_log_target_backend_responses.go deleted file mode 100644 index f6140f96..00000000 --- a/operations/log_target/create_log_target_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetBackendCreatedCode is the HTTP code returned for type CreateLogTargetBackendCreated -const CreateLogTargetBackendCreatedCode int = 201 - -/* -CreateLogTargetBackendCreated Log Target created - -swagger:response createLogTargetBackendCreated -*/ -type CreateLogTargetBackendCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetBackendCreated creates CreateLogTargetBackendCreated with default headers values -func NewCreateLogTargetBackendCreated() *CreateLogTargetBackendCreated { - - return &CreateLogTargetBackendCreated{} -} - -// WithPayload adds the payload to the create log target backend created response -func (o *CreateLogTargetBackendCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target backend created response -func (o *CreateLogTargetBackendCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetBackendAcceptedCode is the HTTP code returned for type CreateLogTargetBackendAccepted -const CreateLogTargetBackendAcceptedCode int = 202 - -/* -CreateLogTargetBackendAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetBackendAccepted -*/ -type CreateLogTargetBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetBackendAccepted creates CreateLogTargetBackendAccepted with default headers values -func NewCreateLogTargetBackendAccepted() *CreateLogTargetBackendAccepted { - - return &CreateLogTargetBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create log target backend accepted response -func (o *CreateLogTargetBackendAccepted) WithReloadID(reloadID string) *CreateLogTargetBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target backend accepted response -func (o *CreateLogTargetBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target backend accepted response -func (o *CreateLogTargetBackendAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target backend accepted response -func (o *CreateLogTargetBackendAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetBackendBadRequestCode is the HTTP code returned for type CreateLogTargetBackendBadRequest -const CreateLogTargetBackendBadRequestCode int = 400 - -/* -CreateLogTargetBackendBadRequest Bad request - -swagger:response createLogTargetBackendBadRequest -*/ -type CreateLogTargetBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetBackendBadRequest creates CreateLogTargetBackendBadRequest with default headers values -func NewCreateLogTargetBackendBadRequest() *CreateLogTargetBackendBadRequest { - - return &CreateLogTargetBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target backend bad request response -func (o *CreateLogTargetBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target backend bad request response -func (o *CreateLogTargetBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target backend bad request response -func (o *CreateLogTargetBackendBadRequest) WithPayload(payload *models.Error) *CreateLogTargetBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target backend bad request response -func (o *CreateLogTargetBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetBackendConflictCode is the HTTP code returned for type CreateLogTargetBackendConflict -const CreateLogTargetBackendConflictCode int = 409 - -/* -CreateLogTargetBackendConflict The specified resource already exists - -swagger:response createLogTargetBackendConflict -*/ -type CreateLogTargetBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetBackendConflict creates CreateLogTargetBackendConflict with default headers values -func NewCreateLogTargetBackendConflict() *CreateLogTargetBackendConflict { - - return &CreateLogTargetBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target backend conflict response -func (o *CreateLogTargetBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target backend conflict response -func (o *CreateLogTargetBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target backend conflict response -func (o *CreateLogTargetBackendConflict) WithPayload(payload *models.Error) *CreateLogTargetBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target backend conflict response -func (o *CreateLogTargetBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetBackendDefault General Error - -swagger:response createLogTargetBackendDefault -*/ -type CreateLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetBackendDefault creates CreateLogTargetBackendDefault with default headers values -func NewCreateLogTargetBackendDefault(code int) *CreateLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target backend default response -func (o *CreateLogTargetBackendDefault) WithStatusCode(code int) *CreateLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target backend default response -func (o *CreateLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target backend default response -func (o *CreateLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target backend default response -func (o *CreateLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target backend default response -func (o *CreateLogTargetBackendDefault) WithPayload(payload *models.Error) *CreateLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target backend default response -func (o *CreateLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_backend_urlbuilder.go b/operations/log_target/create_log_target_backend_urlbuilder.go deleted file mode 100644 index 77d8ab60..00000000 --- a/operations/log_target/create_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetBackendURL generates an URL for the create log target backend operation -type CreateLogTargetBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetBackendURL) WithBasePath(bp string) *CreateLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_defaults.go b/operations/log_target/create_log_target_defaults.go deleted file mode 100644 index f69a13ad..00000000 --- a/operations/log_target/create_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetDefaultsHandlerFunc turns a function with the right signature into a create log target defaults handler -type CreateLogTargetDefaultsHandlerFunc func(CreateLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetDefaultsHandlerFunc) Handle(params CreateLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetDefaultsHandler interface for that can handle valid create log target defaults params -type CreateLogTargetDefaultsHandler interface { - Handle(CreateLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetDefaults creates a new http.Handler for the create log target defaults operation -func NewCreateLogTargetDefaults(ctx *middleware.Context, handler CreateLogTargetDefaultsHandler) *CreateLogTargetDefaults { - return &CreateLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index} LogTarget createLogTargetDefaults - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetDefaults struct { - Context *middleware.Context - Handler CreateLogTargetDefaultsHandler -} - -func (o *CreateLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_defaults_parameters.go b/operations/log_target/create_log_target_defaults_parameters.go deleted file mode 100644 index be3778fe..00000000 --- a/operations/log_target/create_log_target_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetDefaultsParams creates a new CreateLogTargetDefaultsParams object -// with the default values initialized. -func NewCreateLogTargetDefaultsParams() CreateLogTargetDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetDefaultsParams contains all the bound params for the create log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetDefaults -type CreateLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetDefaultsParams() beforehand. -func (o *CreateLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_defaults_responses.go b/operations/log_target/create_log_target_defaults_responses.go deleted file mode 100644 index 1954337e..00000000 --- a/operations/log_target/create_log_target_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetDefaultsCreatedCode is the HTTP code returned for type CreateLogTargetDefaultsCreated -const CreateLogTargetDefaultsCreatedCode int = 201 - -/* -CreateLogTargetDefaultsCreated Log Target created - -swagger:response createLogTargetDefaultsCreated -*/ -type CreateLogTargetDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetDefaultsCreated creates CreateLogTargetDefaultsCreated with default headers values -func NewCreateLogTargetDefaultsCreated() *CreateLogTargetDefaultsCreated { - - return &CreateLogTargetDefaultsCreated{} -} - -// WithPayload adds the payload to the create log target defaults created response -func (o *CreateLogTargetDefaultsCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target defaults created response -func (o *CreateLogTargetDefaultsCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetDefaultsAcceptedCode is the HTTP code returned for type CreateLogTargetDefaultsAccepted -const CreateLogTargetDefaultsAcceptedCode int = 202 - -/* -CreateLogTargetDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetDefaultsAccepted -*/ -type CreateLogTargetDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetDefaultsAccepted creates CreateLogTargetDefaultsAccepted with default headers values -func NewCreateLogTargetDefaultsAccepted() *CreateLogTargetDefaultsAccepted { - - return &CreateLogTargetDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create log target defaults accepted response -func (o *CreateLogTargetDefaultsAccepted) WithReloadID(reloadID string) *CreateLogTargetDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target defaults accepted response -func (o *CreateLogTargetDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target defaults accepted response -func (o *CreateLogTargetDefaultsAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target defaults accepted response -func (o *CreateLogTargetDefaultsAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetDefaultsBadRequestCode is the HTTP code returned for type CreateLogTargetDefaultsBadRequest -const CreateLogTargetDefaultsBadRequestCode int = 400 - -/* -CreateLogTargetDefaultsBadRequest Bad request - -swagger:response createLogTargetDefaultsBadRequest -*/ -type CreateLogTargetDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetDefaultsBadRequest creates CreateLogTargetDefaultsBadRequest with default headers values -func NewCreateLogTargetDefaultsBadRequest() *CreateLogTargetDefaultsBadRequest { - - return &CreateLogTargetDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target defaults bad request response -func (o *CreateLogTargetDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target defaults bad request response -func (o *CreateLogTargetDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target defaults bad request response -func (o *CreateLogTargetDefaultsBadRequest) WithPayload(payload *models.Error) *CreateLogTargetDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target defaults bad request response -func (o *CreateLogTargetDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetDefaultsConflictCode is the HTTP code returned for type CreateLogTargetDefaultsConflict -const CreateLogTargetDefaultsConflictCode int = 409 - -/* -CreateLogTargetDefaultsConflict The specified resource already exists - -swagger:response createLogTargetDefaultsConflict -*/ -type CreateLogTargetDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetDefaultsConflict creates CreateLogTargetDefaultsConflict with default headers values -func NewCreateLogTargetDefaultsConflict() *CreateLogTargetDefaultsConflict { - - return &CreateLogTargetDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target defaults conflict response -func (o *CreateLogTargetDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target defaults conflict response -func (o *CreateLogTargetDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target defaults conflict response -func (o *CreateLogTargetDefaultsConflict) WithPayload(payload *models.Error) *CreateLogTargetDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target defaults conflict response -func (o *CreateLogTargetDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetDefaultsDefault General Error - -swagger:response createLogTargetDefaultsDefault -*/ -type CreateLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetDefaultsDefault creates CreateLogTargetDefaultsDefault with default headers values -func NewCreateLogTargetDefaultsDefault(code int) *CreateLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) WithStatusCode(code int) *CreateLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) WithPayload(payload *models.Error) *CreateLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target defaults default response -func (o *CreateLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_defaults_urlbuilder.go b/operations/log_target/create_log_target_defaults_urlbuilder.go deleted file mode 100644 index 517fa28b..00000000 --- a/operations/log_target/create_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetDefaultsURL generates an URL for the create log target defaults operation -type CreateLogTargetDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetDefaultsURL) WithBasePath(bp string) *CreateLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_frontend.go b/operations/log_target/create_log_target_frontend.go deleted file mode 100644 index cfb1d563..00000000 --- a/operations/log_target/create_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetFrontendHandlerFunc turns a function with the right signature into a create log target frontend handler -type CreateLogTargetFrontendHandlerFunc func(CreateLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetFrontendHandlerFunc) Handle(params CreateLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetFrontendHandler interface for that can handle valid create log target frontend params -type CreateLogTargetFrontendHandler interface { - Handle(CreateLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetFrontend creates a new http.Handler for the create log target frontend operation -func NewCreateLogTargetFrontend(ctx *middleware.Context, handler CreateLogTargetFrontendHandler) *CreateLogTargetFrontend { - return &CreateLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index} LogTarget createLogTargetFrontend - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetFrontend struct { - Context *middleware.Context - Handler CreateLogTargetFrontendHandler -} - -func (o *CreateLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_frontend_parameters.go b/operations/log_target/create_log_target_frontend_parameters.go deleted file mode 100644 index a92b211e..00000000 --- a/operations/log_target/create_log_target_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetFrontendParams creates a new CreateLogTargetFrontendParams object -// with the default values initialized. -func NewCreateLogTargetFrontendParams() CreateLogTargetFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetFrontendParams contains all the bound params for the create log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetFrontend -type CreateLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetFrontendParams() beforehand. -func (o *CreateLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_frontend_responses.go b/operations/log_target/create_log_target_frontend_responses.go deleted file mode 100644 index fb9534ff..00000000 --- a/operations/log_target/create_log_target_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetFrontendCreatedCode is the HTTP code returned for type CreateLogTargetFrontendCreated -const CreateLogTargetFrontendCreatedCode int = 201 - -/* -CreateLogTargetFrontendCreated Log Target created - -swagger:response createLogTargetFrontendCreated -*/ -type CreateLogTargetFrontendCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetFrontendCreated creates CreateLogTargetFrontendCreated with default headers values -func NewCreateLogTargetFrontendCreated() *CreateLogTargetFrontendCreated { - - return &CreateLogTargetFrontendCreated{} -} - -// WithPayload adds the payload to the create log target frontend created response -func (o *CreateLogTargetFrontendCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target frontend created response -func (o *CreateLogTargetFrontendCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetFrontendAcceptedCode is the HTTP code returned for type CreateLogTargetFrontendAccepted -const CreateLogTargetFrontendAcceptedCode int = 202 - -/* -CreateLogTargetFrontendAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetFrontendAccepted -*/ -type CreateLogTargetFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetFrontendAccepted creates CreateLogTargetFrontendAccepted with default headers values -func NewCreateLogTargetFrontendAccepted() *CreateLogTargetFrontendAccepted { - - return &CreateLogTargetFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create log target frontend accepted response -func (o *CreateLogTargetFrontendAccepted) WithReloadID(reloadID string) *CreateLogTargetFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target frontend accepted response -func (o *CreateLogTargetFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target frontend accepted response -func (o *CreateLogTargetFrontendAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target frontend accepted response -func (o *CreateLogTargetFrontendAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetFrontendBadRequestCode is the HTTP code returned for type CreateLogTargetFrontendBadRequest -const CreateLogTargetFrontendBadRequestCode int = 400 - -/* -CreateLogTargetFrontendBadRequest Bad request - -swagger:response createLogTargetFrontendBadRequest -*/ -type CreateLogTargetFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetFrontendBadRequest creates CreateLogTargetFrontendBadRequest with default headers values -func NewCreateLogTargetFrontendBadRequest() *CreateLogTargetFrontendBadRequest { - - return &CreateLogTargetFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target frontend bad request response -func (o *CreateLogTargetFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target frontend bad request response -func (o *CreateLogTargetFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target frontend bad request response -func (o *CreateLogTargetFrontendBadRequest) WithPayload(payload *models.Error) *CreateLogTargetFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target frontend bad request response -func (o *CreateLogTargetFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetFrontendConflictCode is the HTTP code returned for type CreateLogTargetFrontendConflict -const CreateLogTargetFrontendConflictCode int = 409 - -/* -CreateLogTargetFrontendConflict The specified resource already exists - -swagger:response createLogTargetFrontendConflict -*/ -type CreateLogTargetFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetFrontendConflict creates CreateLogTargetFrontendConflict with default headers values -func NewCreateLogTargetFrontendConflict() *CreateLogTargetFrontendConflict { - - return &CreateLogTargetFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target frontend conflict response -func (o *CreateLogTargetFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target frontend conflict response -func (o *CreateLogTargetFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target frontend conflict response -func (o *CreateLogTargetFrontendConflict) WithPayload(payload *models.Error) *CreateLogTargetFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target frontend conflict response -func (o *CreateLogTargetFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetFrontendDefault General Error - -swagger:response createLogTargetFrontendDefault -*/ -type CreateLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetFrontendDefault creates CreateLogTargetFrontendDefault with default headers values -func NewCreateLogTargetFrontendDefault(code int) *CreateLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) WithStatusCode(code int) *CreateLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) WithPayload(payload *models.Error) *CreateLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target frontend default response -func (o *CreateLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_frontend_urlbuilder.go b/operations/log_target/create_log_target_frontend_urlbuilder.go deleted file mode 100644 index ef1a4d30..00000000 --- a/operations/log_target/create_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetFrontendURL generates an URL for the create log target frontend operation -type CreateLogTargetFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetFrontendURL) WithBasePath(bp string) *CreateLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_global.go b/operations/log_target/create_log_target_global.go deleted file mode 100644 index b3fb3248..00000000 --- a/operations/log_target/create_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetGlobalHandlerFunc turns a function with the right signature into a create log target global handler -type CreateLogTargetGlobalHandlerFunc func(CreateLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetGlobalHandlerFunc) Handle(params CreateLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetGlobalHandler interface for that can handle valid create log target global params -type CreateLogTargetGlobalHandler interface { - Handle(CreateLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetGlobal creates a new http.Handler for the create log target global operation -func NewCreateLogTargetGlobal(ctx *middleware.Context, handler CreateLogTargetGlobalHandler) *CreateLogTargetGlobal { - return &CreateLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetGlobal swagger:route POST /services/haproxy/configuration/global/log_targets/{index} LogTarget createLogTargetGlobal - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetGlobal struct { - Context *middleware.Context - Handler CreateLogTargetGlobalHandler -} - -func (o *CreateLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_global_parameters.go b/operations/log_target/create_log_target_global_parameters.go deleted file mode 100644 index ce958962..00000000 --- a/operations/log_target/create_log_target_global_parameters.go +++ /dev/null @@ -1,226 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetGlobalParams creates a new CreateLogTargetGlobalParams object -// with the default values initialized. -func NewCreateLogTargetGlobalParams() CreateLogTargetGlobalParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetGlobalParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetGlobalParams contains all the bound params for the create log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetGlobal -type CreateLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetGlobalParams() beforehand. -func (o *CreateLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetGlobalParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetGlobalParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetGlobalParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_global_responses.go b/operations/log_target/create_log_target_global_responses.go deleted file mode 100644 index 2e3e054b..00000000 --- a/operations/log_target/create_log_target_global_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetGlobalCreatedCode is the HTTP code returned for type CreateLogTargetGlobalCreated -const CreateLogTargetGlobalCreatedCode int = 201 - -/* -CreateLogTargetGlobalCreated Log Target created - -swagger:response createLogTargetGlobalCreated -*/ -type CreateLogTargetGlobalCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetGlobalCreated creates CreateLogTargetGlobalCreated with default headers values -func NewCreateLogTargetGlobalCreated() *CreateLogTargetGlobalCreated { - - return &CreateLogTargetGlobalCreated{} -} - -// WithPayload adds the payload to the create log target global created response -func (o *CreateLogTargetGlobalCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetGlobalCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target global created response -func (o *CreateLogTargetGlobalCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetGlobalCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetGlobalAcceptedCode is the HTTP code returned for type CreateLogTargetGlobalAccepted -const CreateLogTargetGlobalAcceptedCode int = 202 - -/* -CreateLogTargetGlobalAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetGlobalAccepted -*/ -type CreateLogTargetGlobalAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetGlobalAccepted creates CreateLogTargetGlobalAccepted with default headers values -func NewCreateLogTargetGlobalAccepted() *CreateLogTargetGlobalAccepted { - - return &CreateLogTargetGlobalAccepted{} -} - -// WithReloadID adds the reloadId to the create log target global accepted response -func (o *CreateLogTargetGlobalAccepted) WithReloadID(reloadID string) *CreateLogTargetGlobalAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target global accepted response -func (o *CreateLogTargetGlobalAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target global accepted response -func (o *CreateLogTargetGlobalAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetGlobalAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target global accepted response -func (o *CreateLogTargetGlobalAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetGlobalAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetGlobalBadRequestCode is the HTTP code returned for type CreateLogTargetGlobalBadRequest -const CreateLogTargetGlobalBadRequestCode int = 400 - -/* -CreateLogTargetGlobalBadRequest Bad request - -swagger:response createLogTargetGlobalBadRequest -*/ -type CreateLogTargetGlobalBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetGlobalBadRequest creates CreateLogTargetGlobalBadRequest with default headers values -func NewCreateLogTargetGlobalBadRequest() *CreateLogTargetGlobalBadRequest { - - return &CreateLogTargetGlobalBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target global bad request response -func (o *CreateLogTargetGlobalBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetGlobalBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target global bad request response -func (o *CreateLogTargetGlobalBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target global bad request response -func (o *CreateLogTargetGlobalBadRequest) WithPayload(payload *models.Error) *CreateLogTargetGlobalBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target global bad request response -func (o *CreateLogTargetGlobalBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetGlobalBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetGlobalConflictCode is the HTTP code returned for type CreateLogTargetGlobalConflict -const CreateLogTargetGlobalConflictCode int = 409 - -/* -CreateLogTargetGlobalConflict The specified resource already exists - -swagger:response createLogTargetGlobalConflict -*/ -type CreateLogTargetGlobalConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetGlobalConflict creates CreateLogTargetGlobalConflict with default headers values -func NewCreateLogTargetGlobalConflict() *CreateLogTargetGlobalConflict { - - return &CreateLogTargetGlobalConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target global conflict response -func (o *CreateLogTargetGlobalConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetGlobalConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target global conflict response -func (o *CreateLogTargetGlobalConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target global conflict response -func (o *CreateLogTargetGlobalConflict) WithPayload(payload *models.Error) *CreateLogTargetGlobalConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target global conflict response -func (o *CreateLogTargetGlobalConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetGlobalConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetGlobalDefault General Error - -swagger:response createLogTargetGlobalDefault -*/ -type CreateLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetGlobalDefault creates CreateLogTargetGlobalDefault with default headers values -func NewCreateLogTargetGlobalDefault(code int) *CreateLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target global default response -func (o *CreateLogTargetGlobalDefault) WithStatusCode(code int) *CreateLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target global default response -func (o *CreateLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target global default response -func (o *CreateLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target global default response -func (o *CreateLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target global default response -func (o *CreateLogTargetGlobalDefault) WithPayload(payload *models.Error) *CreateLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target global default response -func (o *CreateLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_global_urlbuilder.go b/operations/log_target/create_log_target_global_urlbuilder.go deleted file mode 100644 index 9e63c28c..00000000 --- a/operations/log_target/create_log_target_global_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetGlobalURL generates an URL for the create log target global operation -type CreateLogTargetGlobalURL struct { - Index int64 - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetGlobalURL) WithBasePath(bp string) *CreateLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetGlobalURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_log_forward.go b/operations/log_target/create_log_target_log_forward.go deleted file mode 100644 index 6f029958..00000000 --- a/operations/log_target/create_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetLogForwardHandlerFunc turns a function with the right signature into a create log target log forward handler -type CreateLogTargetLogForwardHandlerFunc func(CreateLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetLogForwardHandlerFunc) Handle(params CreateLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetLogForwardHandler interface for that can handle valid create log target log forward params -type CreateLogTargetLogForwardHandler interface { - Handle(CreateLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetLogForward creates a new http.Handler for the create log target log forward operation -func NewCreateLogTargetLogForward(ctx *middleware.Context, handler CreateLogTargetLogForwardHandler) *CreateLogTargetLogForward { - return &CreateLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetLogForward swagger:route POST /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index} LogTarget createLogTargetLogForward - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetLogForward struct { - Context *middleware.Context - Handler CreateLogTargetLogForwardHandler -} - -func (o *CreateLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_log_forward_parameters.go b/operations/log_target/create_log_target_log_forward_parameters.go deleted file mode 100644 index b09d6390..00000000 --- a/operations/log_target/create_log_target_log_forward_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetLogForwardParams creates a new CreateLogTargetLogForwardParams object -// with the default values initialized. -func NewCreateLogTargetLogForwardParams() CreateLogTargetLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetLogForwardParams contains all the bound params for the create log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetLogForward -type CreateLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetLogForwardParams() beforehand. -func (o *CreateLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetLogForwardParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_log_forward_responses.go b/operations/log_target/create_log_target_log_forward_responses.go deleted file mode 100644 index 609921fe..00000000 --- a/operations/log_target/create_log_target_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetLogForwardCreatedCode is the HTTP code returned for type CreateLogTargetLogForwardCreated -const CreateLogTargetLogForwardCreatedCode int = 201 - -/* -CreateLogTargetLogForwardCreated Log Target created - -swagger:response createLogTargetLogForwardCreated -*/ -type CreateLogTargetLogForwardCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetLogForwardCreated creates CreateLogTargetLogForwardCreated with default headers values -func NewCreateLogTargetLogForwardCreated() *CreateLogTargetLogForwardCreated { - - return &CreateLogTargetLogForwardCreated{} -} - -// WithPayload adds the payload to the create log target log forward created response -func (o *CreateLogTargetLogForwardCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetLogForwardCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target log forward created response -func (o *CreateLogTargetLogForwardCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetLogForwardCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetLogForwardAcceptedCode is the HTTP code returned for type CreateLogTargetLogForwardAccepted -const CreateLogTargetLogForwardAcceptedCode int = 202 - -/* -CreateLogTargetLogForwardAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetLogForwardAccepted -*/ -type CreateLogTargetLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetLogForwardAccepted creates CreateLogTargetLogForwardAccepted with default headers values -func NewCreateLogTargetLogForwardAccepted() *CreateLogTargetLogForwardAccepted { - - return &CreateLogTargetLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the create log target log forward accepted response -func (o *CreateLogTargetLogForwardAccepted) WithReloadID(reloadID string) *CreateLogTargetLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target log forward accepted response -func (o *CreateLogTargetLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target log forward accepted response -func (o *CreateLogTargetLogForwardAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target log forward accepted response -func (o *CreateLogTargetLogForwardAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetLogForwardBadRequestCode is the HTTP code returned for type CreateLogTargetLogForwardBadRequest -const CreateLogTargetLogForwardBadRequestCode int = 400 - -/* -CreateLogTargetLogForwardBadRequest Bad request - -swagger:response createLogTargetLogForwardBadRequest -*/ -type CreateLogTargetLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetLogForwardBadRequest creates CreateLogTargetLogForwardBadRequest with default headers values -func NewCreateLogTargetLogForwardBadRequest() *CreateLogTargetLogForwardBadRequest { - - return &CreateLogTargetLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target log forward bad request response -func (o *CreateLogTargetLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target log forward bad request response -func (o *CreateLogTargetLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target log forward bad request response -func (o *CreateLogTargetLogForwardBadRequest) WithPayload(payload *models.Error) *CreateLogTargetLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target log forward bad request response -func (o *CreateLogTargetLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetLogForwardConflictCode is the HTTP code returned for type CreateLogTargetLogForwardConflict -const CreateLogTargetLogForwardConflictCode int = 409 - -/* -CreateLogTargetLogForwardConflict The specified resource already exists - -swagger:response createLogTargetLogForwardConflict -*/ -type CreateLogTargetLogForwardConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetLogForwardConflict creates CreateLogTargetLogForwardConflict with default headers values -func NewCreateLogTargetLogForwardConflict() *CreateLogTargetLogForwardConflict { - - return &CreateLogTargetLogForwardConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target log forward conflict response -func (o *CreateLogTargetLogForwardConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetLogForwardConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target log forward conflict response -func (o *CreateLogTargetLogForwardConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target log forward conflict response -func (o *CreateLogTargetLogForwardConflict) WithPayload(payload *models.Error) *CreateLogTargetLogForwardConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target log forward conflict response -func (o *CreateLogTargetLogForwardConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetLogForwardConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetLogForwardDefault General Error - -swagger:response createLogTargetLogForwardDefault -*/ -type CreateLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetLogForwardDefault creates CreateLogTargetLogForwardDefault with default headers values -func NewCreateLogTargetLogForwardDefault(code int) *CreateLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) WithStatusCode(code int) *CreateLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) WithPayload(payload *models.Error) *CreateLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target log forward default response -func (o *CreateLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_log_forward_urlbuilder.go b/operations/log_target/create_log_target_log_forward_urlbuilder.go deleted file mode 100644 index 976ac606..00000000 --- a/operations/log_target/create_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetLogForwardURL generates an URL for the create log target log forward operation -type CreateLogTargetLogForwardURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetLogForwardURL) WithBasePath(bp string) *CreateLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/create_log_target_peer.go b/operations/log_target/create_log_target_peer.go deleted file mode 100644 index d6110879..00000000 --- a/operations/log_target/create_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateLogTargetPeerHandlerFunc turns a function with the right signature into a create log target peer handler -type CreateLogTargetPeerHandlerFunc func(CreateLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateLogTargetPeerHandlerFunc) Handle(params CreateLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateLogTargetPeerHandler interface for that can handle valid create log target peer params -type CreateLogTargetPeerHandler interface { - Handle(CreateLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewCreateLogTargetPeer creates a new http.Handler for the create log target peer operation -func NewCreateLogTargetPeer(ctx *middleware.Context, handler CreateLogTargetPeerHandler) *CreateLogTargetPeer { - return &CreateLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - CreateLogTargetPeer swagger:route POST /services/haproxy/configuration/peers/{parent_name}/log_targets/{index} LogTarget createLogTargetPeer - -# Add a new Log Target - -Adds a new Log Target of the specified type in the specified parent. -*/ -type CreateLogTargetPeer struct { - Context *middleware.Context - Handler CreateLogTargetPeerHandler -} - -func (o *CreateLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/create_log_target_peer_parameters.go b/operations/log_target/create_log_target_peer_parameters.go deleted file mode 100644 index df9ae9b5..00000000 --- a/operations/log_target/create_log_target_peer_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateLogTargetPeerParams creates a new CreateLogTargetPeerParams object -// with the default values initialized. -func NewCreateLogTargetPeerParams() CreateLogTargetPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateLogTargetPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateLogTargetPeerParams contains all the bound params for the create log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters createLogTargetPeer -type CreateLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateLogTargetPeerParams() beforehand. -func (o *CreateLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateLogTargetPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateLogTargetPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateLogTargetPeerParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateLogTargetPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/create_log_target_peer_responses.go b/operations/log_target/create_log_target_peer_responses.go deleted file mode 100644 index 1e69d308..00000000 --- a/operations/log_target/create_log_target_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateLogTargetPeerCreatedCode is the HTTP code returned for type CreateLogTargetPeerCreated -const CreateLogTargetPeerCreatedCode int = 201 - -/* -CreateLogTargetPeerCreated Log Target created - -swagger:response createLogTargetPeerCreated -*/ -type CreateLogTargetPeerCreated struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetPeerCreated creates CreateLogTargetPeerCreated with default headers values -func NewCreateLogTargetPeerCreated() *CreateLogTargetPeerCreated { - - return &CreateLogTargetPeerCreated{} -} - -// WithPayload adds the payload to the create log target peer created response -func (o *CreateLogTargetPeerCreated) WithPayload(payload *models.LogTarget) *CreateLogTargetPeerCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target peer created response -func (o *CreateLogTargetPeerCreated) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetPeerCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetPeerAcceptedCode is the HTTP code returned for type CreateLogTargetPeerAccepted -const CreateLogTargetPeerAcceptedCode int = 202 - -/* -CreateLogTargetPeerAccepted Configuration change accepted and reload requested - -swagger:response createLogTargetPeerAccepted -*/ -type CreateLogTargetPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewCreateLogTargetPeerAccepted creates CreateLogTargetPeerAccepted with default headers values -func NewCreateLogTargetPeerAccepted() *CreateLogTargetPeerAccepted { - - return &CreateLogTargetPeerAccepted{} -} - -// WithReloadID adds the reloadId to the create log target peer accepted response -func (o *CreateLogTargetPeerAccepted) WithReloadID(reloadID string) *CreateLogTargetPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create log target peer accepted response -func (o *CreateLogTargetPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create log target peer accepted response -func (o *CreateLogTargetPeerAccepted) WithPayload(payload *models.LogTarget) *CreateLogTargetPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target peer accepted response -func (o *CreateLogTargetPeerAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetPeerBadRequestCode is the HTTP code returned for type CreateLogTargetPeerBadRequest -const CreateLogTargetPeerBadRequestCode int = 400 - -/* -CreateLogTargetPeerBadRequest Bad request - -swagger:response createLogTargetPeerBadRequest -*/ -type CreateLogTargetPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetPeerBadRequest creates CreateLogTargetPeerBadRequest with default headers values -func NewCreateLogTargetPeerBadRequest() *CreateLogTargetPeerBadRequest { - - return &CreateLogTargetPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target peer bad request response -func (o *CreateLogTargetPeerBadRequest) WithConfigurationVersion(configurationVersion string) *CreateLogTargetPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target peer bad request response -func (o *CreateLogTargetPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target peer bad request response -func (o *CreateLogTargetPeerBadRequest) WithPayload(payload *models.Error) *CreateLogTargetPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target peer bad request response -func (o *CreateLogTargetPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateLogTargetPeerConflictCode is the HTTP code returned for type CreateLogTargetPeerConflict -const CreateLogTargetPeerConflictCode int = 409 - -/* -CreateLogTargetPeerConflict The specified resource already exists - -swagger:response createLogTargetPeerConflict -*/ -type CreateLogTargetPeerConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetPeerConflict creates CreateLogTargetPeerConflict with default headers values -func NewCreateLogTargetPeerConflict() *CreateLogTargetPeerConflict { - - return &CreateLogTargetPeerConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create log target peer conflict response -func (o *CreateLogTargetPeerConflict) WithConfigurationVersion(configurationVersion string) *CreateLogTargetPeerConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target peer conflict response -func (o *CreateLogTargetPeerConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target peer conflict response -func (o *CreateLogTargetPeerConflict) WithPayload(payload *models.Error) *CreateLogTargetPeerConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target peer conflict response -func (o *CreateLogTargetPeerConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetPeerConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateLogTargetPeerDefault General Error - -swagger:response createLogTargetPeerDefault -*/ -type CreateLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateLogTargetPeerDefault creates CreateLogTargetPeerDefault with default headers values -func NewCreateLogTargetPeerDefault(code int) *CreateLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &CreateLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create log target peer default response -func (o *CreateLogTargetPeerDefault) WithStatusCode(code int) *CreateLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create log target peer default response -func (o *CreateLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create log target peer default response -func (o *CreateLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *CreateLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create log target peer default response -func (o *CreateLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create log target peer default response -func (o *CreateLogTargetPeerDefault) WithPayload(payload *models.Error) *CreateLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create log target peer default response -func (o *CreateLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/create_log_target_peer_urlbuilder.go b/operations/log_target/create_log_target_peer_urlbuilder.go deleted file mode 100644 index e3c99ecd..00000000 --- a/operations/log_target/create_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateLogTargetPeerURL generates an URL for the create log target peer operation -type CreateLogTargetPeerURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetPeerURL) WithBasePath(bp string) *CreateLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateLogTargetPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_backend.go b/operations/log_target/delete_log_target_backend.go deleted file mode 100644 index 6d590da0..00000000 --- a/operations/log_target/delete_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetBackendHandlerFunc turns a function with the right signature into a delete log target backend handler -type DeleteLogTargetBackendHandlerFunc func(DeleteLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetBackendHandlerFunc) Handle(params DeleteLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetBackendHandler interface for that can handle valid delete log target backend params -type DeleteLogTargetBackendHandler interface { - Handle(DeleteLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetBackend creates a new http.Handler for the delete log target backend operation -func NewDeleteLogTargetBackend(ctx *middleware.Context, handler DeleteLogTargetBackendHandler) *DeleteLogTargetBackend { - return &DeleteLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/log_targets/{index} LogTarget deleteLogTargetBackend - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetBackend struct { - Context *middleware.Context - Handler DeleteLogTargetBackendHandler -} - -func (o *DeleteLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_backend_parameters.go b/operations/log_target/delete_log_target_backend_parameters.go deleted file mode 100644 index 332c7854..00000000 --- a/operations/log_target/delete_log_target_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetBackendParams creates a new DeleteLogTargetBackendParams object -// with the default values initialized. -func NewDeleteLogTargetBackendParams() DeleteLogTargetBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetBackendParams contains all the bound params for the delete log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetBackend -type DeleteLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetBackendParams() beforehand. -func (o *DeleteLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_backend_responses.go b/operations/log_target/delete_log_target_backend_responses.go deleted file mode 100644 index f0b91fb9..00000000 --- a/operations/log_target/delete_log_target_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetBackendAcceptedCode is the HTTP code returned for type DeleteLogTargetBackendAccepted -const DeleteLogTargetBackendAcceptedCode int = 202 - -/* -DeleteLogTargetBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetBackendAccepted -*/ -type DeleteLogTargetBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetBackendAccepted creates DeleteLogTargetBackendAccepted with default headers values -func NewDeleteLogTargetBackendAccepted() *DeleteLogTargetBackendAccepted { - - return &DeleteLogTargetBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target backend accepted response -func (o *DeleteLogTargetBackendAccepted) WithReloadID(reloadID string) *DeleteLogTargetBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target backend accepted response -func (o *DeleteLogTargetBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetBackendNoContentCode is the HTTP code returned for type DeleteLogTargetBackendNoContent -const DeleteLogTargetBackendNoContentCode int = 204 - -/* -DeleteLogTargetBackendNoContent Log Target deleted - -swagger:response deleteLogTargetBackendNoContent -*/ -type DeleteLogTargetBackendNoContent struct { -} - -// NewDeleteLogTargetBackendNoContent creates DeleteLogTargetBackendNoContent with default headers values -func NewDeleteLogTargetBackendNoContent() *DeleteLogTargetBackendNoContent { - - return &DeleteLogTargetBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetBackendNotFoundCode is the HTTP code returned for type DeleteLogTargetBackendNotFound -const DeleteLogTargetBackendNotFoundCode int = 404 - -/* -DeleteLogTargetBackendNotFound The specified resource was not found - -swagger:response deleteLogTargetBackendNotFound -*/ -type DeleteLogTargetBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetBackendNotFound creates DeleteLogTargetBackendNotFound with default headers values -func NewDeleteLogTargetBackendNotFound() *DeleteLogTargetBackendNotFound { - - return &DeleteLogTargetBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target backend not found response -func (o *DeleteLogTargetBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target backend not found response -func (o *DeleteLogTargetBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target backend not found response -func (o *DeleteLogTargetBackendNotFound) WithPayload(payload *models.Error) *DeleteLogTargetBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target backend not found response -func (o *DeleteLogTargetBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetBackendDefault General Error - -swagger:response deleteLogTargetBackendDefault -*/ -type DeleteLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetBackendDefault creates DeleteLogTargetBackendDefault with default headers values -func NewDeleteLogTargetBackendDefault(code int) *DeleteLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) WithStatusCode(code int) *DeleteLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) WithPayload(payload *models.Error) *DeleteLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target backend default response -func (o *DeleteLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_backend_urlbuilder.go b/operations/log_target/delete_log_target_backend_urlbuilder.go deleted file mode 100644 index 2c68de25..00000000 --- a/operations/log_target/delete_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetBackendURL generates an URL for the delete log target backend operation -type DeleteLogTargetBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetBackendURL) WithBasePath(bp string) *DeleteLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_defaults.go b/operations/log_target/delete_log_target_defaults.go deleted file mode 100644 index 269db9da..00000000 --- a/operations/log_target/delete_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetDefaultsHandlerFunc turns a function with the right signature into a delete log target defaults handler -type DeleteLogTargetDefaultsHandlerFunc func(DeleteLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetDefaultsHandlerFunc) Handle(params DeleteLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetDefaultsHandler interface for that can handle valid delete log target defaults params -type DeleteLogTargetDefaultsHandler interface { - Handle(DeleteLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetDefaults creates a new http.Handler for the delete log target defaults operation -func NewDeleteLogTargetDefaults(ctx *middleware.Context, handler DeleteLogTargetDefaultsHandler) *DeleteLogTargetDefaults { - return &DeleteLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index} LogTarget deleteLogTargetDefaults - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetDefaults struct { - Context *middleware.Context - Handler DeleteLogTargetDefaultsHandler -} - -func (o *DeleteLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_defaults_parameters.go b/operations/log_target/delete_log_target_defaults_parameters.go deleted file mode 100644 index f15f4784..00000000 --- a/operations/log_target/delete_log_target_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetDefaultsParams creates a new DeleteLogTargetDefaultsParams object -// with the default values initialized. -func NewDeleteLogTargetDefaultsParams() DeleteLogTargetDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetDefaultsParams contains all the bound params for the delete log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetDefaults -type DeleteLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetDefaultsParams() beforehand. -func (o *DeleteLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_defaults_responses.go b/operations/log_target/delete_log_target_defaults_responses.go deleted file mode 100644 index 0a381d3d..00000000 --- a/operations/log_target/delete_log_target_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetDefaultsAcceptedCode is the HTTP code returned for type DeleteLogTargetDefaultsAccepted -const DeleteLogTargetDefaultsAcceptedCode int = 202 - -/* -DeleteLogTargetDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetDefaultsAccepted -*/ -type DeleteLogTargetDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetDefaultsAccepted creates DeleteLogTargetDefaultsAccepted with default headers values -func NewDeleteLogTargetDefaultsAccepted() *DeleteLogTargetDefaultsAccepted { - - return &DeleteLogTargetDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target defaults accepted response -func (o *DeleteLogTargetDefaultsAccepted) WithReloadID(reloadID string) *DeleteLogTargetDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target defaults accepted response -func (o *DeleteLogTargetDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetDefaultsNoContentCode is the HTTP code returned for type DeleteLogTargetDefaultsNoContent -const DeleteLogTargetDefaultsNoContentCode int = 204 - -/* -DeleteLogTargetDefaultsNoContent Log Target deleted - -swagger:response deleteLogTargetDefaultsNoContent -*/ -type DeleteLogTargetDefaultsNoContent struct { -} - -// NewDeleteLogTargetDefaultsNoContent creates DeleteLogTargetDefaultsNoContent with default headers values -func NewDeleteLogTargetDefaultsNoContent() *DeleteLogTargetDefaultsNoContent { - - return &DeleteLogTargetDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetDefaultsNotFoundCode is the HTTP code returned for type DeleteLogTargetDefaultsNotFound -const DeleteLogTargetDefaultsNotFoundCode int = 404 - -/* -DeleteLogTargetDefaultsNotFound The specified resource was not found - -swagger:response deleteLogTargetDefaultsNotFound -*/ -type DeleteLogTargetDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetDefaultsNotFound creates DeleteLogTargetDefaultsNotFound with default headers values -func NewDeleteLogTargetDefaultsNotFound() *DeleteLogTargetDefaultsNotFound { - - return &DeleteLogTargetDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target defaults not found response -func (o *DeleteLogTargetDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target defaults not found response -func (o *DeleteLogTargetDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target defaults not found response -func (o *DeleteLogTargetDefaultsNotFound) WithPayload(payload *models.Error) *DeleteLogTargetDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target defaults not found response -func (o *DeleteLogTargetDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetDefaultsDefault General Error - -swagger:response deleteLogTargetDefaultsDefault -*/ -type DeleteLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetDefaultsDefault creates DeleteLogTargetDefaultsDefault with default headers values -func NewDeleteLogTargetDefaultsDefault(code int) *DeleteLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) WithStatusCode(code int) *DeleteLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) WithPayload(payload *models.Error) *DeleteLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target defaults default response -func (o *DeleteLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_defaults_urlbuilder.go b/operations/log_target/delete_log_target_defaults_urlbuilder.go deleted file mode 100644 index c549f589..00000000 --- a/operations/log_target/delete_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetDefaultsURL generates an URL for the delete log target defaults operation -type DeleteLogTargetDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetDefaultsURL) WithBasePath(bp string) *DeleteLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_frontend.go b/operations/log_target/delete_log_target_frontend.go deleted file mode 100644 index 6520cc95..00000000 --- a/operations/log_target/delete_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetFrontendHandlerFunc turns a function with the right signature into a delete log target frontend handler -type DeleteLogTargetFrontendHandlerFunc func(DeleteLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetFrontendHandlerFunc) Handle(params DeleteLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetFrontendHandler interface for that can handle valid delete log target frontend params -type DeleteLogTargetFrontendHandler interface { - Handle(DeleteLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetFrontend creates a new http.Handler for the delete log target frontend operation -func NewDeleteLogTargetFrontend(ctx *middleware.Context, handler DeleteLogTargetFrontendHandler) *DeleteLogTargetFrontend { - return &DeleteLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index} LogTarget deleteLogTargetFrontend - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetFrontend struct { - Context *middleware.Context - Handler DeleteLogTargetFrontendHandler -} - -func (o *DeleteLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_frontend_parameters.go b/operations/log_target/delete_log_target_frontend_parameters.go deleted file mode 100644 index 3e346055..00000000 --- a/operations/log_target/delete_log_target_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetFrontendParams creates a new DeleteLogTargetFrontendParams object -// with the default values initialized. -func NewDeleteLogTargetFrontendParams() DeleteLogTargetFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetFrontendParams contains all the bound params for the delete log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetFrontend -type DeleteLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetFrontendParams() beforehand. -func (o *DeleteLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_frontend_responses.go b/operations/log_target/delete_log_target_frontend_responses.go deleted file mode 100644 index 8eb2c0b7..00000000 --- a/operations/log_target/delete_log_target_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetFrontendAcceptedCode is the HTTP code returned for type DeleteLogTargetFrontendAccepted -const DeleteLogTargetFrontendAcceptedCode int = 202 - -/* -DeleteLogTargetFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetFrontendAccepted -*/ -type DeleteLogTargetFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetFrontendAccepted creates DeleteLogTargetFrontendAccepted with default headers values -func NewDeleteLogTargetFrontendAccepted() *DeleteLogTargetFrontendAccepted { - - return &DeleteLogTargetFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target frontend accepted response -func (o *DeleteLogTargetFrontendAccepted) WithReloadID(reloadID string) *DeleteLogTargetFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target frontend accepted response -func (o *DeleteLogTargetFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetFrontendNoContentCode is the HTTP code returned for type DeleteLogTargetFrontendNoContent -const DeleteLogTargetFrontendNoContentCode int = 204 - -/* -DeleteLogTargetFrontendNoContent Log Target deleted - -swagger:response deleteLogTargetFrontendNoContent -*/ -type DeleteLogTargetFrontendNoContent struct { -} - -// NewDeleteLogTargetFrontendNoContent creates DeleteLogTargetFrontendNoContent with default headers values -func NewDeleteLogTargetFrontendNoContent() *DeleteLogTargetFrontendNoContent { - - return &DeleteLogTargetFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetFrontendNotFoundCode is the HTTP code returned for type DeleteLogTargetFrontendNotFound -const DeleteLogTargetFrontendNotFoundCode int = 404 - -/* -DeleteLogTargetFrontendNotFound The specified resource was not found - -swagger:response deleteLogTargetFrontendNotFound -*/ -type DeleteLogTargetFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetFrontendNotFound creates DeleteLogTargetFrontendNotFound with default headers values -func NewDeleteLogTargetFrontendNotFound() *DeleteLogTargetFrontendNotFound { - - return &DeleteLogTargetFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target frontend not found response -func (o *DeleteLogTargetFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target frontend not found response -func (o *DeleteLogTargetFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target frontend not found response -func (o *DeleteLogTargetFrontendNotFound) WithPayload(payload *models.Error) *DeleteLogTargetFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target frontend not found response -func (o *DeleteLogTargetFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetFrontendDefault General Error - -swagger:response deleteLogTargetFrontendDefault -*/ -type DeleteLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetFrontendDefault creates DeleteLogTargetFrontendDefault with default headers values -func NewDeleteLogTargetFrontendDefault(code int) *DeleteLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) WithStatusCode(code int) *DeleteLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) WithPayload(payload *models.Error) *DeleteLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target frontend default response -func (o *DeleteLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_frontend_urlbuilder.go b/operations/log_target/delete_log_target_frontend_urlbuilder.go deleted file mode 100644 index 7c93b4cf..00000000 --- a/operations/log_target/delete_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetFrontendURL generates an URL for the delete log target frontend operation -type DeleteLogTargetFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetFrontendURL) WithBasePath(bp string) *DeleteLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_global.go b/operations/log_target/delete_log_target_global.go deleted file mode 100644 index ae28120b..00000000 --- a/operations/log_target/delete_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetGlobalHandlerFunc turns a function with the right signature into a delete log target global handler -type DeleteLogTargetGlobalHandlerFunc func(DeleteLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetGlobalHandlerFunc) Handle(params DeleteLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetGlobalHandler interface for that can handle valid delete log target global params -type DeleteLogTargetGlobalHandler interface { - Handle(DeleteLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetGlobal creates a new http.Handler for the delete log target global operation -func NewDeleteLogTargetGlobal(ctx *middleware.Context, handler DeleteLogTargetGlobalHandler) *DeleteLogTargetGlobal { - return &DeleteLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetGlobal swagger:route DELETE /services/haproxy/configuration/global/log_targets/{index} LogTarget deleteLogTargetGlobal - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetGlobal struct { - Context *middleware.Context - Handler DeleteLogTargetGlobalHandler -} - -func (o *DeleteLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_global_parameters.go b/operations/log_target/delete_log_target_global_parameters.go deleted file mode 100644 index 76f390f4..00000000 --- a/operations/log_target/delete_log_target_global_parameters.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetGlobalParams creates a new DeleteLogTargetGlobalParams object -// with the default values initialized. -func NewDeleteLogTargetGlobalParams() DeleteLogTargetGlobalParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetGlobalParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetGlobalParams contains all the bound params for the delete log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetGlobal -type DeleteLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetGlobalParams() beforehand. -func (o *DeleteLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetGlobalParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetGlobalParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetGlobalParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_global_responses.go b/operations/log_target/delete_log_target_global_responses.go deleted file mode 100644 index e5b62d59..00000000 --- a/operations/log_target/delete_log_target_global_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetGlobalAcceptedCode is the HTTP code returned for type DeleteLogTargetGlobalAccepted -const DeleteLogTargetGlobalAcceptedCode int = 202 - -/* -DeleteLogTargetGlobalAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetGlobalAccepted -*/ -type DeleteLogTargetGlobalAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetGlobalAccepted creates DeleteLogTargetGlobalAccepted with default headers values -func NewDeleteLogTargetGlobalAccepted() *DeleteLogTargetGlobalAccepted { - - return &DeleteLogTargetGlobalAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target global accepted response -func (o *DeleteLogTargetGlobalAccepted) WithReloadID(reloadID string) *DeleteLogTargetGlobalAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target global accepted response -func (o *DeleteLogTargetGlobalAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetGlobalAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetGlobalNoContentCode is the HTTP code returned for type DeleteLogTargetGlobalNoContent -const DeleteLogTargetGlobalNoContentCode int = 204 - -/* -DeleteLogTargetGlobalNoContent Log Target deleted - -swagger:response deleteLogTargetGlobalNoContent -*/ -type DeleteLogTargetGlobalNoContent struct { -} - -// NewDeleteLogTargetGlobalNoContent creates DeleteLogTargetGlobalNoContent with default headers values -func NewDeleteLogTargetGlobalNoContent() *DeleteLogTargetGlobalNoContent { - - return &DeleteLogTargetGlobalNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetGlobalNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetGlobalNotFoundCode is the HTTP code returned for type DeleteLogTargetGlobalNotFound -const DeleteLogTargetGlobalNotFoundCode int = 404 - -/* -DeleteLogTargetGlobalNotFound The specified resource was not found - -swagger:response deleteLogTargetGlobalNotFound -*/ -type DeleteLogTargetGlobalNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetGlobalNotFound creates DeleteLogTargetGlobalNotFound with default headers values -func NewDeleteLogTargetGlobalNotFound() *DeleteLogTargetGlobalNotFound { - - return &DeleteLogTargetGlobalNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target global not found response -func (o *DeleteLogTargetGlobalNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetGlobalNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target global not found response -func (o *DeleteLogTargetGlobalNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target global not found response -func (o *DeleteLogTargetGlobalNotFound) WithPayload(payload *models.Error) *DeleteLogTargetGlobalNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target global not found response -func (o *DeleteLogTargetGlobalNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetGlobalNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetGlobalDefault General Error - -swagger:response deleteLogTargetGlobalDefault -*/ -type DeleteLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetGlobalDefault creates DeleteLogTargetGlobalDefault with default headers values -func NewDeleteLogTargetGlobalDefault(code int) *DeleteLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) WithStatusCode(code int) *DeleteLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) WithPayload(payload *models.Error) *DeleteLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target global default response -func (o *DeleteLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_global_urlbuilder.go b/operations/log_target/delete_log_target_global_urlbuilder.go deleted file mode 100644 index ecb9d960..00000000 --- a/operations/log_target/delete_log_target_global_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetGlobalURL generates an URL for the delete log target global operation -type DeleteLogTargetGlobalURL struct { - Index int64 - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetGlobalURL) WithBasePath(bp string) *DeleteLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetGlobalURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_log_forward.go b/operations/log_target/delete_log_target_log_forward.go deleted file mode 100644 index 865c9c11..00000000 --- a/operations/log_target/delete_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetLogForwardHandlerFunc turns a function with the right signature into a delete log target log forward handler -type DeleteLogTargetLogForwardHandlerFunc func(DeleteLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetLogForwardHandlerFunc) Handle(params DeleteLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetLogForwardHandler interface for that can handle valid delete log target log forward params -type DeleteLogTargetLogForwardHandler interface { - Handle(DeleteLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetLogForward creates a new http.Handler for the delete log target log forward operation -func NewDeleteLogTargetLogForward(ctx *middleware.Context, handler DeleteLogTargetLogForwardHandler) *DeleteLogTargetLogForward { - return &DeleteLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetLogForward swagger:route DELETE /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index} LogTarget deleteLogTargetLogForward - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetLogForward struct { - Context *middleware.Context - Handler DeleteLogTargetLogForwardHandler -} - -func (o *DeleteLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_log_forward_parameters.go b/operations/log_target/delete_log_target_log_forward_parameters.go deleted file mode 100644 index 14118574..00000000 --- a/operations/log_target/delete_log_target_log_forward_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetLogForwardParams creates a new DeleteLogTargetLogForwardParams object -// with the default values initialized. -func NewDeleteLogTargetLogForwardParams() DeleteLogTargetLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetLogForwardParams contains all the bound params for the delete log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetLogForward -type DeleteLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetLogForwardParams() beforehand. -func (o *DeleteLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetLogForwardParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_log_forward_responses.go b/operations/log_target/delete_log_target_log_forward_responses.go deleted file mode 100644 index 73a6de01..00000000 --- a/operations/log_target/delete_log_target_log_forward_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetLogForwardAcceptedCode is the HTTP code returned for type DeleteLogTargetLogForwardAccepted -const DeleteLogTargetLogForwardAcceptedCode int = 202 - -/* -DeleteLogTargetLogForwardAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetLogForwardAccepted -*/ -type DeleteLogTargetLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetLogForwardAccepted creates DeleteLogTargetLogForwardAccepted with default headers values -func NewDeleteLogTargetLogForwardAccepted() *DeleteLogTargetLogForwardAccepted { - - return &DeleteLogTargetLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target log forward accepted response -func (o *DeleteLogTargetLogForwardAccepted) WithReloadID(reloadID string) *DeleteLogTargetLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target log forward accepted response -func (o *DeleteLogTargetLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetLogForwardNoContentCode is the HTTP code returned for type DeleteLogTargetLogForwardNoContent -const DeleteLogTargetLogForwardNoContentCode int = 204 - -/* -DeleteLogTargetLogForwardNoContent Log Target deleted - -swagger:response deleteLogTargetLogForwardNoContent -*/ -type DeleteLogTargetLogForwardNoContent struct { -} - -// NewDeleteLogTargetLogForwardNoContent creates DeleteLogTargetLogForwardNoContent with default headers values -func NewDeleteLogTargetLogForwardNoContent() *DeleteLogTargetLogForwardNoContent { - - return &DeleteLogTargetLogForwardNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetLogForwardNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetLogForwardNotFoundCode is the HTTP code returned for type DeleteLogTargetLogForwardNotFound -const DeleteLogTargetLogForwardNotFoundCode int = 404 - -/* -DeleteLogTargetLogForwardNotFound The specified resource was not found - -swagger:response deleteLogTargetLogForwardNotFound -*/ -type DeleteLogTargetLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetLogForwardNotFound creates DeleteLogTargetLogForwardNotFound with default headers values -func NewDeleteLogTargetLogForwardNotFound() *DeleteLogTargetLogForwardNotFound { - - return &DeleteLogTargetLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target log forward not found response -func (o *DeleteLogTargetLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target log forward not found response -func (o *DeleteLogTargetLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target log forward not found response -func (o *DeleteLogTargetLogForwardNotFound) WithPayload(payload *models.Error) *DeleteLogTargetLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target log forward not found response -func (o *DeleteLogTargetLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetLogForwardDefault General Error - -swagger:response deleteLogTargetLogForwardDefault -*/ -type DeleteLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetLogForwardDefault creates DeleteLogTargetLogForwardDefault with default headers values -func NewDeleteLogTargetLogForwardDefault(code int) *DeleteLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) WithStatusCode(code int) *DeleteLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) WithPayload(payload *models.Error) *DeleteLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target log forward default response -func (o *DeleteLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_log_forward_urlbuilder.go b/operations/log_target/delete_log_target_log_forward_urlbuilder.go deleted file mode 100644 index d7100bdf..00000000 --- a/operations/log_target/delete_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetLogForwardURL generates an URL for the delete log target log forward operation -type DeleteLogTargetLogForwardURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetLogForwardURL) WithBasePath(bp string) *DeleteLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/delete_log_target_peer.go b/operations/log_target/delete_log_target_peer.go deleted file mode 100644 index c875b00e..00000000 --- a/operations/log_target/delete_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteLogTargetPeerHandlerFunc turns a function with the right signature into a delete log target peer handler -type DeleteLogTargetPeerHandlerFunc func(DeleteLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteLogTargetPeerHandlerFunc) Handle(params DeleteLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteLogTargetPeerHandler interface for that can handle valid delete log target peer params -type DeleteLogTargetPeerHandler interface { - Handle(DeleteLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewDeleteLogTargetPeer creates a new http.Handler for the delete log target peer operation -func NewDeleteLogTargetPeer(ctx *middleware.Context, handler DeleteLogTargetPeerHandler) *DeleteLogTargetPeer { - return &DeleteLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - DeleteLogTargetPeer swagger:route DELETE /services/haproxy/configuration/peers/{parent_name}/log_targets/{index} LogTarget deleteLogTargetPeer - -# Delete a Log Target - -Deletes a Log Target configuration by it's index from the specified parent. -*/ -type DeleteLogTargetPeer struct { - Context *middleware.Context - Handler DeleteLogTargetPeerHandler -} - -func (o *DeleteLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/delete_log_target_peer_parameters.go b/operations/log_target/delete_log_target_peer_parameters.go deleted file mode 100644 index 9d913948..00000000 --- a/operations/log_target/delete_log_target_peer_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteLogTargetPeerParams creates a new DeleteLogTargetPeerParams object -// with the default values initialized. -func NewDeleteLogTargetPeerParams() DeleteLogTargetPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteLogTargetPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteLogTargetPeerParams contains all the bound params for the delete log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteLogTargetPeer -type DeleteLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteLogTargetPeerParams() beforehand. -func (o *DeleteLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteLogTargetPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteLogTargetPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteLogTargetPeerParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteLogTargetPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/delete_log_target_peer_responses.go b/operations/log_target/delete_log_target_peer_responses.go deleted file mode 100644 index c751fa1d..00000000 --- a/operations/log_target/delete_log_target_peer_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteLogTargetPeerAcceptedCode is the HTTP code returned for type DeleteLogTargetPeerAccepted -const DeleteLogTargetPeerAcceptedCode int = 202 - -/* -DeleteLogTargetPeerAccepted Configuration change accepted and reload requested - -swagger:response deleteLogTargetPeerAccepted -*/ -type DeleteLogTargetPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteLogTargetPeerAccepted creates DeleteLogTargetPeerAccepted with default headers values -func NewDeleteLogTargetPeerAccepted() *DeleteLogTargetPeerAccepted { - - return &DeleteLogTargetPeerAccepted{} -} - -// WithReloadID adds the reloadId to the delete log target peer accepted response -func (o *DeleteLogTargetPeerAccepted) WithReloadID(reloadID string) *DeleteLogTargetPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete log target peer accepted response -func (o *DeleteLogTargetPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteLogTargetPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteLogTargetPeerNoContentCode is the HTTP code returned for type DeleteLogTargetPeerNoContent -const DeleteLogTargetPeerNoContentCode int = 204 - -/* -DeleteLogTargetPeerNoContent Log Target deleted - -swagger:response deleteLogTargetPeerNoContent -*/ -type DeleteLogTargetPeerNoContent struct { -} - -// NewDeleteLogTargetPeerNoContent creates DeleteLogTargetPeerNoContent with default headers values -func NewDeleteLogTargetPeerNoContent() *DeleteLogTargetPeerNoContent { - - return &DeleteLogTargetPeerNoContent{} -} - -// WriteResponse to the client -func (o *DeleteLogTargetPeerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteLogTargetPeerNotFoundCode is the HTTP code returned for type DeleteLogTargetPeerNotFound -const DeleteLogTargetPeerNotFoundCode int = 404 - -/* -DeleteLogTargetPeerNotFound The specified resource was not found - -swagger:response deleteLogTargetPeerNotFound -*/ -type DeleteLogTargetPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetPeerNotFound creates DeleteLogTargetPeerNotFound with default headers values -func NewDeleteLogTargetPeerNotFound() *DeleteLogTargetPeerNotFound { - - return &DeleteLogTargetPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target peer not found response -func (o *DeleteLogTargetPeerNotFound) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target peer not found response -func (o *DeleteLogTargetPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target peer not found response -func (o *DeleteLogTargetPeerNotFound) WithPayload(payload *models.Error) *DeleteLogTargetPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target peer not found response -func (o *DeleteLogTargetPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteLogTargetPeerDefault General Error - -swagger:response deleteLogTargetPeerDefault -*/ -type DeleteLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteLogTargetPeerDefault creates DeleteLogTargetPeerDefault with default headers values -func NewDeleteLogTargetPeerDefault(code int) *DeleteLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &DeleteLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) WithStatusCode(code int) *DeleteLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *DeleteLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) WithPayload(payload *models.Error) *DeleteLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete log target peer default response -func (o *DeleteLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/delete_log_target_peer_urlbuilder.go b/operations/log_target/delete_log_target_peer_urlbuilder.go deleted file mode 100644 index 773c6762..00000000 --- a/operations/log_target/delete_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteLogTargetPeerURL generates an URL for the delete log target peer operation -type DeleteLogTargetPeerURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetPeerURL) WithBasePath(bp string) *DeleteLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteLogTargetPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_backend.go b/operations/log_target/get_all_log_target_backend.go deleted file mode 100644 index fbc27bd3..00000000 --- a/operations/log_target/get_all_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetBackendHandlerFunc turns a function with the right signature into a get all log target backend handler -type GetAllLogTargetBackendHandlerFunc func(GetAllLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetBackendHandlerFunc) Handle(params GetAllLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetBackendHandler interface for that can handle valid get all log target backend params -type GetAllLogTargetBackendHandler interface { - Handle(GetAllLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetBackend creates a new http.Handler for the get all log target backend operation -func NewGetAllLogTargetBackend(ctx *middleware.Context, handler GetAllLogTargetBackendHandler) *GetAllLogTargetBackend { - return &GetAllLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/log_targets LogTarget getAllLogTargetBackend - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetBackend struct { - Context *middleware.Context - Handler GetAllLogTargetBackendHandler -} - -func (o *GetAllLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_backend_parameters.go b/operations/log_target/get_all_log_target_backend_parameters.go deleted file mode 100644 index b8a6f24c..00000000 --- a/operations/log_target/get_all_log_target_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetBackendParams creates a new GetAllLogTargetBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetBackendParams() GetAllLogTargetBackendParams { - - return GetAllLogTargetBackendParams{} -} - -// GetAllLogTargetBackendParams contains all the bound params for the get all log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetBackend -type GetAllLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetBackendParams() beforehand. -func (o *GetAllLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_backend_responses.go b/operations/log_target/get_all_log_target_backend_responses.go deleted file mode 100644 index 115bc8a8..00000000 --- a/operations/log_target/get_all_log_target_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetBackendOKCode is the HTTP code returned for type GetAllLogTargetBackendOK -const GetAllLogTargetBackendOKCode int = 200 - -/* -GetAllLogTargetBackendOK Successful operation - -swagger:response getAllLogTargetBackendOK -*/ -type GetAllLogTargetBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetBackendOK creates GetAllLogTargetBackendOK with default headers values -func NewGetAllLogTargetBackendOK() *GetAllLogTargetBackendOK { - - return &GetAllLogTargetBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target backend o k response -func (o *GetAllLogTargetBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target backend o k response -func (o *GetAllLogTargetBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target backend o k response -func (o *GetAllLogTargetBackendOK) WithPayload(payload models.LogTargets) *GetAllLogTargetBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target backend o k response -func (o *GetAllLogTargetBackendOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetBackendDefault General Error - -swagger:response getAllLogTargetBackendDefault -*/ -type GetAllLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetBackendDefault creates GetAllLogTargetBackendDefault with default headers values -func NewGetAllLogTargetBackendDefault(code int) *GetAllLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) WithStatusCode(code int) *GetAllLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) WithPayload(payload *models.Error) *GetAllLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target backend default response -func (o *GetAllLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_backend_urlbuilder.go b/operations/log_target/get_all_log_target_backend_urlbuilder.go deleted file mode 100644 index 032cf317..00000000 --- a/operations/log_target/get_all_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllLogTargetBackendURL generates an URL for the get all log target backend operation -type GetAllLogTargetBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetBackendURL) WithBasePath(bp string) *GetAllLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_defaults.go b/operations/log_target/get_all_log_target_defaults.go deleted file mode 100644 index d213bb19..00000000 --- a/operations/log_target/get_all_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetDefaultsHandlerFunc turns a function with the right signature into a get all log target defaults handler -type GetAllLogTargetDefaultsHandlerFunc func(GetAllLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetDefaultsHandlerFunc) Handle(params GetAllLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetDefaultsHandler interface for that can handle valid get all log target defaults params -type GetAllLogTargetDefaultsHandler interface { - Handle(GetAllLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetDefaults creates a new http.Handler for the get all log target defaults operation -func NewGetAllLogTargetDefaults(ctx *middleware.Context, handler GetAllLogTargetDefaultsHandler) *GetAllLogTargetDefaults { - return &GetAllLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/log_targets LogTarget getAllLogTargetDefaults - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetDefaults struct { - Context *middleware.Context - Handler GetAllLogTargetDefaultsHandler -} - -func (o *GetAllLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_defaults_parameters.go b/operations/log_target/get_all_log_target_defaults_parameters.go deleted file mode 100644 index 393d187d..00000000 --- a/operations/log_target/get_all_log_target_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetDefaultsParams creates a new GetAllLogTargetDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetDefaultsParams() GetAllLogTargetDefaultsParams { - - return GetAllLogTargetDefaultsParams{} -} - -// GetAllLogTargetDefaultsParams contains all the bound params for the get all log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetDefaults -type GetAllLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetDefaultsParams() beforehand. -func (o *GetAllLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_defaults_responses.go b/operations/log_target/get_all_log_target_defaults_responses.go deleted file mode 100644 index 0683d3d5..00000000 --- a/operations/log_target/get_all_log_target_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetDefaultsOKCode is the HTTP code returned for type GetAllLogTargetDefaultsOK -const GetAllLogTargetDefaultsOKCode int = 200 - -/* -GetAllLogTargetDefaultsOK Successful operation - -swagger:response getAllLogTargetDefaultsOK -*/ -type GetAllLogTargetDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetDefaultsOK creates GetAllLogTargetDefaultsOK with default headers values -func NewGetAllLogTargetDefaultsOK() *GetAllLogTargetDefaultsOK { - - return &GetAllLogTargetDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target defaults o k response -func (o *GetAllLogTargetDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target defaults o k response -func (o *GetAllLogTargetDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target defaults o k response -func (o *GetAllLogTargetDefaultsOK) WithPayload(payload models.LogTargets) *GetAllLogTargetDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target defaults o k response -func (o *GetAllLogTargetDefaultsOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetDefaultsDefault General Error - -swagger:response getAllLogTargetDefaultsDefault -*/ -type GetAllLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetDefaultsDefault creates GetAllLogTargetDefaultsDefault with default headers values -func NewGetAllLogTargetDefaultsDefault(code int) *GetAllLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) WithStatusCode(code int) *GetAllLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) WithPayload(payload *models.Error) *GetAllLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target defaults default response -func (o *GetAllLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_defaults_urlbuilder.go b/operations/log_target/get_all_log_target_defaults_urlbuilder.go deleted file mode 100644 index 1625eabe..00000000 --- a/operations/log_target/get_all_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllLogTargetDefaultsURL generates an URL for the get all log target defaults operation -type GetAllLogTargetDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetDefaultsURL) WithBasePath(bp string) *GetAllLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_frontend.go b/operations/log_target/get_all_log_target_frontend.go deleted file mode 100644 index 50b0db9f..00000000 --- a/operations/log_target/get_all_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetFrontendHandlerFunc turns a function with the right signature into a get all log target frontend handler -type GetAllLogTargetFrontendHandlerFunc func(GetAllLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetFrontendHandlerFunc) Handle(params GetAllLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetFrontendHandler interface for that can handle valid get all log target frontend params -type GetAllLogTargetFrontendHandler interface { - Handle(GetAllLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetFrontend creates a new http.Handler for the get all log target frontend operation -func NewGetAllLogTargetFrontend(ctx *middleware.Context, handler GetAllLogTargetFrontendHandler) *GetAllLogTargetFrontend { - return &GetAllLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/log_targets LogTarget getAllLogTargetFrontend - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetFrontend struct { - Context *middleware.Context - Handler GetAllLogTargetFrontendHandler -} - -func (o *GetAllLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_frontend_parameters.go b/operations/log_target/get_all_log_target_frontend_parameters.go deleted file mode 100644 index 3707ca4e..00000000 --- a/operations/log_target/get_all_log_target_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetFrontendParams creates a new GetAllLogTargetFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetFrontendParams() GetAllLogTargetFrontendParams { - - return GetAllLogTargetFrontendParams{} -} - -// GetAllLogTargetFrontendParams contains all the bound params for the get all log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetFrontend -type GetAllLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetFrontendParams() beforehand. -func (o *GetAllLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_frontend_responses.go b/operations/log_target/get_all_log_target_frontend_responses.go deleted file mode 100644 index 41fcd1a5..00000000 --- a/operations/log_target/get_all_log_target_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetFrontendOKCode is the HTTP code returned for type GetAllLogTargetFrontendOK -const GetAllLogTargetFrontendOKCode int = 200 - -/* -GetAllLogTargetFrontendOK Successful operation - -swagger:response getAllLogTargetFrontendOK -*/ -type GetAllLogTargetFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetFrontendOK creates GetAllLogTargetFrontendOK with default headers values -func NewGetAllLogTargetFrontendOK() *GetAllLogTargetFrontendOK { - - return &GetAllLogTargetFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target frontend o k response -func (o *GetAllLogTargetFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target frontend o k response -func (o *GetAllLogTargetFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target frontend o k response -func (o *GetAllLogTargetFrontendOK) WithPayload(payload models.LogTargets) *GetAllLogTargetFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target frontend o k response -func (o *GetAllLogTargetFrontendOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetFrontendDefault General Error - -swagger:response getAllLogTargetFrontendDefault -*/ -type GetAllLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetFrontendDefault creates GetAllLogTargetFrontendDefault with default headers values -func NewGetAllLogTargetFrontendDefault(code int) *GetAllLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) WithStatusCode(code int) *GetAllLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) WithPayload(payload *models.Error) *GetAllLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target frontend default response -func (o *GetAllLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_frontend_urlbuilder.go b/operations/log_target/get_all_log_target_frontend_urlbuilder.go deleted file mode 100644 index ff43e2bc..00000000 --- a/operations/log_target/get_all_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllLogTargetFrontendURL generates an URL for the get all log target frontend operation -type GetAllLogTargetFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetFrontendURL) WithBasePath(bp string) *GetAllLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_global.go b/operations/log_target/get_all_log_target_global.go deleted file mode 100644 index 9a404076..00000000 --- a/operations/log_target/get_all_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetGlobalHandlerFunc turns a function with the right signature into a get all log target global handler -type GetAllLogTargetGlobalHandlerFunc func(GetAllLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetGlobalHandlerFunc) Handle(params GetAllLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetGlobalHandler interface for that can handle valid get all log target global params -type GetAllLogTargetGlobalHandler interface { - Handle(GetAllLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetGlobal creates a new http.Handler for the get all log target global operation -func NewGetAllLogTargetGlobal(ctx *middleware.Context, handler GetAllLogTargetGlobalHandler) *GetAllLogTargetGlobal { - return &GetAllLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetGlobal swagger:route GET /services/haproxy/configuration/global/log_targets LogTarget getAllLogTargetGlobal - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetGlobal struct { - Context *middleware.Context - Handler GetAllLogTargetGlobalHandler -} - -func (o *GetAllLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_global_parameters.go b/operations/log_target/get_all_log_target_global_parameters.go deleted file mode 100644 index 61519c11..00000000 --- a/operations/log_target/get_all_log_target_global_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetGlobalParams creates a new GetAllLogTargetGlobalParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetGlobalParams() GetAllLogTargetGlobalParams { - - return GetAllLogTargetGlobalParams{} -} - -// GetAllLogTargetGlobalParams contains all the bound params for the get all log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetGlobal -type GetAllLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetGlobalParams() beforehand. -func (o *GetAllLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_global_responses.go b/operations/log_target/get_all_log_target_global_responses.go deleted file mode 100644 index f2832f15..00000000 --- a/operations/log_target/get_all_log_target_global_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetGlobalOKCode is the HTTP code returned for type GetAllLogTargetGlobalOK -const GetAllLogTargetGlobalOKCode int = 200 - -/* -GetAllLogTargetGlobalOK Successful operation - -swagger:response getAllLogTargetGlobalOK -*/ -type GetAllLogTargetGlobalOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetGlobalOK creates GetAllLogTargetGlobalOK with default headers values -func NewGetAllLogTargetGlobalOK() *GetAllLogTargetGlobalOK { - - return &GetAllLogTargetGlobalOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target global o k response -func (o *GetAllLogTargetGlobalOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetGlobalOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target global o k response -func (o *GetAllLogTargetGlobalOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target global o k response -func (o *GetAllLogTargetGlobalOK) WithPayload(payload models.LogTargets) *GetAllLogTargetGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target global o k response -func (o *GetAllLogTargetGlobalOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetGlobalDefault General Error - -swagger:response getAllLogTargetGlobalDefault -*/ -type GetAllLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetGlobalDefault creates GetAllLogTargetGlobalDefault with default headers values -func NewGetAllLogTargetGlobalDefault(code int) *GetAllLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) WithStatusCode(code int) *GetAllLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) WithPayload(payload *models.Error) *GetAllLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target global default response -func (o *GetAllLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_global_urlbuilder.go b/operations/log_target/get_all_log_target_global_urlbuilder.go deleted file mode 100644 index 7edc8046..00000000 --- a/operations/log_target/get_all_log_target_global_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllLogTargetGlobalURL generates an URL for the get all log target global operation -type GetAllLogTargetGlobalURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetGlobalURL) WithBasePath(bp string) *GetAllLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_log_forward.go b/operations/log_target/get_all_log_target_log_forward.go deleted file mode 100644 index fb0820d0..00000000 --- a/operations/log_target/get_all_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetLogForwardHandlerFunc turns a function with the right signature into a get all log target log forward handler -type GetAllLogTargetLogForwardHandlerFunc func(GetAllLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetLogForwardHandlerFunc) Handle(params GetAllLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetLogForwardHandler interface for that can handle valid get all log target log forward params -type GetAllLogTargetLogForwardHandler interface { - Handle(GetAllLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetLogForward creates a new http.Handler for the get all log target log forward operation -func NewGetAllLogTargetLogForward(ctx *middleware.Context, handler GetAllLogTargetLogForwardHandler) *GetAllLogTargetLogForward { - return &GetAllLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetLogForward swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets LogTarget getAllLogTargetLogForward - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetLogForward struct { - Context *middleware.Context - Handler GetAllLogTargetLogForwardHandler -} - -func (o *GetAllLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_log_forward_parameters.go b/operations/log_target/get_all_log_target_log_forward_parameters.go deleted file mode 100644 index a4fa352a..00000000 --- a/operations/log_target/get_all_log_target_log_forward_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetLogForwardParams creates a new GetAllLogTargetLogForwardParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetLogForwardParams() GetAllLogTargetLogForwardParams { - - return GetAllLogTargetLogForwardParams{} -} - -// GetAllLogTargetLogForwardParams contains all the bound params for the get all log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetLogForward -type GetAllLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetLogForwardParams() beforehand. -func (o *GetAllLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_log_forward_responses.go b/operations/log_target/get_all_log_target_log_forward_responses.go deleted file mode 100644 index 677343ce..00000000 --- a/operations/log_target/get_all_log_target_log_forward_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetLogForwardOKCode is the HTTP code returned for type GetAllLogTargetLogForwardOK -const GetAllLogTargetLogForwardOKCode int = 200 - -/* -GetAllLogTargetLogForwardOK Successful operation - -swagger:response getAllLogTargetLogForwardOK -*/ -type GetAllLogTargetLogForwardOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetLogForwardOK creates GetAllLogTargetLogForwardOK with default headers values -func NewGetAllLogTargetLogForwardOK() *GetAllLogTargetLogForwardOK { - - return &GetAllLogTargetLogForwardOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target log forward o k response -func (o *GetAllLogTargetLogForwardOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetLogForwardOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target log forward o k response -func (o *GetAllLogTargetLogForwardOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target log forward o k response -func (o *GetAllLogTargetLogForwardOK) WithPayload(payload models.LogTargets) *GetAllLogTargetLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target log forward o k response -func (o *GetAllLogTargetLogForwardOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetLogForwardDefault General Error - -swagger:response getAllLogTargetLogForwardDefault -*/ -type GetAllLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetLogForwardDefault creates GetAllLogTargetLogForwardDefault with default headers values -func NewGetAllLogTargetLogForwardDefault(code int) *GetAllLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) WithStatusCode(code int) *GetAllLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) WithPayload(payload *models.Error) *GetAllLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target log forward default response -func (o *GetAllLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_log_forward_urlbuilder.go b/operations/log_target/get_all_log_target_log_forward_urlbuilder.go deleted file mode 100644 index 424ac9a8..00000000 --- a/operations/log_target/get_all_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllLogTargetLogForwardURL generates an URL for the get all log target log forward operation -type GetAllLogTargetLogForwardURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetLogForwardURL) WithBasePath(bp string) *GetAllLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_all_log_target_peer.go b/operations/log_target/get_all_log_target_peer.go deleted file mode 100644 index f0c7883c..00000000 --- a/operations/log_target/get_all_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllLogTargetPeerHandlerFunc turns a function with the right signature into a get all log target peer handler -type GetAllLogTargetPeerHandlerFunc func(GetAllLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllLogTargetPeerHandlerFunc) Handle(params GetAllLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllLogTargetPeerHandler interface for that can handle valid get all log target peer params -type GetAllLogTargetPeerHandler interface { - Handle(GetAllLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewGetAllLogTargetPeer creates a new http.Handler for the get all log target peer operation -func NewGetAllLogTargetPeer(ctx *middleware.Context, handler GetAllLogTargetPeerHandler) *GetAllLogTargetPeer { - return &GetAllLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - GetAllLogTargetPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/log_targets LogTarget getAllLogTargetPeer - -# Return an array of all Log Targets - -Returns all Log Targets that are configured in specified parent. -*/ -type GetAllLogTargetPeer struct { - Context *middleware.Context - Handler GetAllLogTargetPeerHandler -} - -func (o *GetAllLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_all_log_target_peer_parameters.go b/operations/log_target/get_all_log_target_peer_parameters.go deleted file mode 100644 index 31c67090..00000000 --- a/operations/log_target/get_all_log_target_peer_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllLogTargetPeerParams creates a new GetAllLogTargetPeerParams object -// -// There are no default values defined in the spec. -func NewGetAllLogTargetPeerParams() GetAllLogTargetPeerParams { - - return GetAllLogTargetPeerParams{} -} - -// GetAllLogTargetPeerParams contains all the bound params for the get all log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllLogTargetPeer -type GetAllLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllLogTargetPeerParams() beforehand. -func (o *GetAllLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_all_log_target_peer_responses.go b/operations/log_target/get_all_log_target_peer_responses.go deleted file mode 100644 index c97c6077..00000000 --- a/operations/log_target/get_all_log_target_peer_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllLogTargetPeerOKCode is the HTTP code returned for type GetAllLogTargetPeerOK -const GetAllLogTargetPeerOKCode int = 200 - -/* -GetAllLogTargetPeerOK Successful operation - -swagger:response getAllLogTargetPeerOK -*/ -type GetAllLogTargetPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewGetAllLogTargetPeerOK creates GetAllLogTargetPeerOK with default headers values -func NewGetAllLogTargetPeerOK() *GetAllLogTargetPeerOK { - - return &GetAllLogTargetPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target peer o k response -func (o *GetAllLogTargetPeerOK) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target peer o k response -func (o *GetAllLogTargetPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target peer o k response -func (o *GetAllLogTargetPeerOK) WithPayload(payload models.LogTargets) *GetAllLogTargetPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target peer o k response -func (o *GetAllLogTargetPeerOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllLogTargetPeerDefault General Error - -swagger:response getAllLogTargetPeerDefault -*/ -type GetAllLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllLogTargetPeerDefault creates GetAllLogTargetPeerDefault with default headers values -func NewGetAllLogTargetPeerDefault(code int) *GetAllLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetAllLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) WithStatusCode(code int) *GetAllLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *GetAllLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) WithPayload(payload *models.Error) *GetAllLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all log target peer default response -func (o *GetAllLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_all_log_target_peer_urlbuilder.go b/operations/log_target/get_all_log_target_peer_urlbuilder.go deleted file mode 100644 index bdcd2791..00000000 --- a/operations/log_target/get_all_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllLogTargetPeerURL generates an URL for the get all log target peer operation -type GetAllLogTargetPeerURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetPeerURL) WithBasePath(bp string) *GetAllLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_backend.go b/operations/log_target/get_log_target_backend.go deleted file mode 100644 index 0b52dac4..00000000 --- a/operations/log_target/get_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetBackendHandlerFunc turns a function with the right signature into a get log target backend handler -type GetLogTargetBackendHandlerFunc func(GetLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetBackendHandlerFunc) Handle(params GetLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetBackendHandler interface for that can handle valid get log target backend params -type GetLogTargetBackendHandler interface { - Handle(GetLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewGetLogTargetBackend creates a new http.Handler for the get log target backend operation -func NewGetLogTargetBackend(ctx *middleware.Context, handler GetLogTargetBackendHandler) *GetLogTargetBackend { - return &GetLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - GetLogTargetBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/log_targets/{index} LogTarget getLogTargetBackend - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetBackend struct { - Context *middleware.Context - Handler GetLogTargetBackendHandler -} - -func (o *GetLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_backend_parameters.go b/operations/log_target/get_log_target_backend_parameters.go deleted file mode 100644 index 01ea6552..00000000 --- a/operations/log_target/get_log_target_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetBackendParams creates a new GetLogTargetBackendParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetBackendParams() GetLogTargetBackendParams { - - return GetLogTargetBackendParams{} -} - -// GetLogTargetBackendParams contains all the bound params for the get log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetBackend -type GetLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetBackendParams() beforehand. -func (o *GetLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_backend_responses.go b/operations/log_target/get_log_target_backend_responses.go deleted file mode 100644 index dec4047c..00000000 --- a/operations/log_target/get_log_target_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetBackendOKCode is the HTTP code returned for type GetLogTargetBackendOK -const GetLogTargetBackendOKCode int = 200 - -/* -GetLogTargetBackendOK Successful operation - -swagger:response getLogTargetBackendOK -*/ -type GetLogTargetBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetBackendOK creates GetLogTargetBackendOK with default headers values -func NewGetLogTargetBackendOK() *GetLogTargetBackendOK { - - return &GetLogTargetBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target backend o k response -func (o *GetLogTargetBackendOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target backend o k response -func (o *GetLogTargetBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target backend o k response -func (o *GetLogTargetBackendOK) WithPayload(payload *models.LogTarget) *GetLogTargetBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target backend o k response -func (o *GetLogTargetBackendOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetBackendNotFoundCode is the HTTP code returned for type GetLogTargetBackendNotFound -const GetLogTargetBackendNotFoundCode int = 404 - -/* -GetLogTargetBackendNotFound The specified resource was not found - -swagger:response getLogTargetBackendNotFound -*/ -type GetLogTargetBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetBackendNotFound creates GetLogTargetBackendNotFound with default headers values -func NewGetLogTargetBackendNotFound() *GetLogTargetBackendNotFound { - - return &GetLogTargetBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target backend not found response -func (o *GetLogTargetBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target backend not found response -func (o *GetLogTargetBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target backend not found response -func (o *GetLogTargetBackendNotFound) WithPayload(payload *models.Error) *GetLogTargetBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target backend not found response -func (o *GetLogTargetBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetBackendDefault General Error - -swagger:response getLogTargetBackendDefault -*/ -type GetLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetBackendDefault creates GetLogTargetBackendDefault with default headers values -func NewGetLogTargetBackendDefault(code int) *GetLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target backend default response -func (o *GetLogTargetBackendDefault) WithStatusCode(code int) *GetLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target backend default response -func (o *GetLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target backend default response -func (o *GetLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target backend default response -func (o *GetLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target backend default response -func (o *GetLogTargetBackendDefault) WithPayload(payload *models.Error) *GetLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target backend default response -func (o *GetLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_backend_urlbuilder.go b/operations/log_target/get_log_target_backend_urlbuilder.go deleted file mode 100644 index 6ddab662..00000000 --- a/operations/log_target/get_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetBackendURL generates an URL for the get log target backend operation -type GetLogTargetBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetBackendURL) WithBasePath(bp string) *GetLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_defaults.go b/operations/log_target/get_log_target_defaults.go deleted file mode 100644 index b03e998f..00000000 --- a/operations/log_target/get_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetDefaultsHandlerFunc turns a function with the right signature into a get log target defaults handler -type GetLogTargetDefaultsHandlerFunc func(GetLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetDefaultsHandlerFunc) Handle(params GetLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetDefaultsHandler interface for that can handle valid get log target defaults params -type GetLogTargetDefaultsHandler interface { - Handle(GetLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewGetLogTargetDefaults creates a new http.Handler for the get log target defaults operation -func NewGetLogTargetDefaults(ctx *middleware.Context, handler GetLogTargetDefaultsHandler) *GetLogTargetDefaults { - return &GetLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - GetLogTargetDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index} LogTarget getLogTargetDefaults - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetDefaults struct { - Context *middleware.Context - Handler GetLogTargetDefaultsHandler -} - -func (o *GetLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_defaults_parameters.go b/operations/log_target/get_log_target_defaults_parameters.go deleted file mode 100644 index f47aaa88..00000000 --- a/operations/log_target/get_log_target_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetDefaultsParams creates a new GetLogTargetDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetDefaultsParams() GetLogTargetDefaultsParams { - - return GetLogTargetDefaultsParams{} -} - -// GetLogTargetDefaultsParams contains all the bound params for the get log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetDefaults -type GetLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetDefaultsParams() beforehand. -func (o *GetLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_defaults_responses.go b/operations/log_target/get_log_target_defaults_responses.go deleted file mode 100644 index d8e63913..00000000 --- a/operations/log_target/get_log_target_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetDefaultsOKCode is the HTTP code returned for type GetLogTargetDefaultsOK -const GetLogTargetDefaultsOKCode int = 200 - -/* -GetLogTargetDefaultsOK Successful operation - -swagger:response getLogTargetDefaultsOK -*/ -type GetLogTargetDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetDefaultsOK creates GetLogTargetDefaultsOK with default headers values -func NewGetLogTargetDefaultsOK() *GetLogTargetDefaultsOK { - - return &GetLogTargetDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target defaults o k response -func (o *GetLogTargetDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target defaults o k response -func (o *GetLogTargetDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target defaults o k response -func (o *GetLogTargetDefaultsOK) WithPayload(payload *models.LogTarget) *GetLogTargetDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target defaults o k response -func (o *GetLogTargetDefaultsOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetDefaultsNotFoundCode is the HTTP code returned for type GetLogTargetDefaultsNotFound -const GetLogTargetDefaultsNotFoundCode int = 404 - -/* -GetLogTargetDefaultsNotFound The specified resource was not found - -swagger:response getLogTargetDefaultsNotFound -*/ -type GetLogTargetDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetDefaultsNotFound creates GetLogTargetDefaultsNotFound with default headers values -func NewGetLogTargetDefaultsNotFound() *GetLogTargetDefaultsNotFound { - - return &GetLogTargetDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target defaults not found response -func (o *GetLogTargetDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target defaults not found response -func (o *GetLogTargetDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target defaults not found response -func (o *GetLogTargetDefaultsNotFound) WithPayload(payload *models.Error) *GetLogTargetDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target defaults not found response -func (o *GetLogTargetDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetDefaultsDefault General Error - -swagger:response getLogTargetDefaultsDefault -*/ -type GetLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetDefaultsDefault creates GetLogTargetDefaultsDefault with default headers values -func NewGetLogTargetDefaultsDefault(code int) *GetLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) WithStatusCode(code int) *GetLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) WithPayload(payload *models.Error) *GetLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target defaults default response -func (o *GetLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_defaults_urlbuilder.go b/operations/log_target/get_log_target_defaults_urlbuilder.go deleted file mode 100644 index ddd1320e..00000000 --- a/operations/log_target/get_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetDefaultsURL generates an URL for the get log target defaults operation -type GetLogTargetDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetDefaultsURL) WithBasePath(bp string) *GetLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_frontend.go b/operations/log_target/get_log_target_frontend.go deleted file mode 100644 index 2de86a44..00000000 --- a/operations/log_target/get_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetFrontendHandlerFunc turns a function with the right signature into a get log target frontend handler -type GetLogTargetFrontendHandlerFunc func(GetLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetFrontendHandlerFunc) Handle(params GetLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetFrontendHandler interface for that can handle valid get log target frontend params -type GetLogTargetFrontendHandler interface { - Handle(GetLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewGetLogTargetFrontend creates a new http.Handler for the get log target frontend operation -func NewGetLogTargetFrontend(ctx *middleware.Context, handler GetLogTargetFrontendHandler) *GetLogTargetFrontend { - return &GetLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - GetLogTargetFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index} LogTarget getLogTargetFrontend - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetFrontend struct { - Context *middleware.Context - Handler GetLogTargetFrontendHandler -} - -func (o *GetLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_frontend_parameters.go b/operations/log_target/get_log_target_frontend_parameters.go deleted file mode 100644 index 31412579..00000000 --- a/operations/log_target/get_log_target_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetFrontendParams creates a new GetLogTargetFrontendParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetFrontendParams() GetLogTargetFrontendParams { - - return GetLogTargetFrontendParams{} -} - -// GetLogTargetFrontendParams contains all the bound params for the get log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetFrontend -type GetLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetFrontendParams() beforehand. -func (o *GetLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_frontend_responses.go b/operations/log_target/get_log_target_frontend_responses.go deleted file mode 100644 index aebf7e91..00000000 --- a/operations/log_target/get_log_target_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetFrontendOKCode is the HTTP code returned for type GetLogTargetFrontendOK -const GetLogTargetFrontendOKCode int = 200 - -/* -GetLogTargetFrontendOK Successful operation - -swagger:response getLogTargetFrontendOK -*/ -type GetLogTargetFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetFrontendOK creates GetLogTargetFrontendOK with default headers values -func NewGetLogTargetFrontendOK() *GetLogTargetFrontendOK { - - return &GetLogTargetFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target frontend o k response -func (o *GetLogTargetFrontendOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target frontend o k response -func (o *GetLogTargetFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target frontend o k response -func (o *GetLogTargetFrontendOK) WithPayload(payload *models.LogTarget) *GetLogTargetFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target frontend o k response -func (o *GetLogTargetFrontendOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetFrontendNotFoundCode is the HTTP code returned for type GetLogTargetFrontendNotFound -const GetLogTargetFrontendNotFoundCode int = 404 - -/* -GetLogTargetFrontendNotFound The specified resource was not found - -swagger:response getLogTargetFrontendNotFound -*/ -type GetLogTargetFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetFrontendNotFound creates GetLogTargetFrontendNotFound with default headers values -func NewGetLogTargetFrontendNotFound() *GetLogTargetFrontendNotFound { - - return &GetLogTargetFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target frontend not found response -func (o *GetLogTargetFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target frontend not found response -func (o *GetLogTargetFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target frontend not found response -func (o *GetLogTargetFrontendNotFound) WithPayload(payload *models.Error) *GetLogTargetFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target frontend not found response -func (o *GetLogTargetFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetFrontendDefault General Error - -swagger:response getLogTargetFrontendDefault -*/ -type GetLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetFrontendDefault creates GetLogTargetFrontendDefault with default headers values -func NewGetLogTargetFrontendDefault(code int) *GetLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) WithStatusCode(code int) *GetLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) WithPayload(payload *models.Error) *GetLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target frontend default response -func (o *GetLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_frontend_urlbuilder.go b/operations/log_target/get_log_target_frontend_urlbuilder.go deleted file mode 100644 index 557e8498..00000000 --- a/operations/log_target/get_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetFrontendURL generates an URL for the get log target frontend operation -type GetLogTargetFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetFrontendURL) WithBasePath(bp string) *GetLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_global.go b/operations/log_target/get_log_target_global.go deleted file mode 100644 index 10a993f4..00000000 --- a/operations/log_target/get_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetGlobalHandlerFunc turns a function with the right signature into a get log target global handler -type GetLogTargetGlobalHandlerFunc func(GetLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetGlobalHandlerFunc) Handle(params GetLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetGlobalHandler interface for that can handle valid get log target global params -type GetLogTargetGlobalHandler interface { - Handle(GetLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewGetLogTargetGlobal creates a new http.Handler for the get log target global operation -func NewGetLogTargetGlobal(ctx *middleware.Context, handler GetLogTargetGlobalHandler) *GetLogTargetGlobal { - return &GetLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - GetLogTargetGlobal swagger:route GET /services/haproxy/configuration/global/log_targets/{index} LogTarget getLogTargetGlobal - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetGlobal struct { - Context *middleware.Context - Handler GetLogTargetGlobalHandler -} - -func (o *GetLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_global_parameters.go b/operations/log_target/get_log_target_global_parameters.go deleted file mode 100644 index 21fb6066..00000000 --- a/operations/log_target/get_log_target_global_parameters.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetGlobalParams creates a new GetLogTargetGlobalParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetGlobalParams() GetLogTargetGlobalParams { - - return GetLogTargetGlobalParams{} -} - -// GetLogTargetGlobalParams contains all the bound params for the get log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetGlobal -type GetLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetGlobalParams() beforehand. -func (o *GetLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetGlobalParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_global_responses.go b/operations/log_target/get_log_target_global_responses.go deleted file mode 100644 index ecafeb76..00000000 --- a/operations/log_target/get_log_target_global_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetGlobalOKCode is the HTTP code returned for type GetLogTargetGlobalOK -const GetLogTargetGlobalOKCode int = 200 - -/* -GetLogTargetGlobalOK Successful operation - -swagger:response getLogTargetGlobalOK -*/ -type GetLogTargetGlobalOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetGlobalOK creates GetLogTargetGlobalOK with default headers values -func NewGetLogTargetGlobalOK() *GetLogTargetGlobalOK { - - return &GetLogTargetGlobalOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target global o k response -func (o *GetLogTargetGlobalOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetGlobalOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target global o k response -func (o *GetLogTargetGlobalOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target global o k response -func (o *GetLogTargetGlobalOK) WithPayload(payload *models.LogTarget) *GetLogTargetGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target global o k response -func (o *GetLogTargetGlobalOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetGlobalNotFoundCode is the HTTP code returned for type GetLogTargetGlobalNotFound -const GetLogTargetGlobalNotFoundCode int = 404 - -/* -GetLogTargetGlobalNotFound The specified resource was not found - -swagger:response getLogTargetGlobalNotFound -*/ -type GetLogTargetGlobalNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetGlobalNotFound creates GetLogTargetGlobalNotFound with default headers values -func NewGetLogTargetGlobalNotFound() *GetLogTargetGlobalNotFound { - - return &GetLogTargetGlobalNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target global not found response -func (o *GetLogTargetGlobalNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetGlobalNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target global not found response -func (o *GetLogTargetGlobalNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target global not found response -func (o *GetLogTargetGlobalNotFound) WithPayload(payload *models.Error) *GetLogTargetGlobalNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target global not found response -func (o *GetLogTargetGlobalNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetGlobalNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetGlobalDefault General Error - -swagger:response getLogTargetGlobalDefault -*/ -type GetLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetGlobalDefault creates GetLogTargetGlobalDefault with default headers values -func NewGetLogTargetGlobalDefault(code int) *GetLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target global default response -func (o *GetLogTargetGlobalDefault) WithStatusCode(code int) *GetLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target global default response -func (o *GetLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target global default response -func (o *GetLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target global default response -func (o *GetLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target global default response -func (o *GetLogTargetGlobalDefault) WithPayload(payload *models.Error) *GetLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target global default response -func (o *GetLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_global_urlbuilder.go b/operations/log_target/get_log_target_global_urlbuilder.go deleted file mode 100644 index 79dd9ab7..00000000 --- a/operations/log_target/get_log_target_global_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetGlobalURL generates an URL for the get log target global operation -type GetLogTargetGlobalURL struct { - Index int64 - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetGlobalURL) WithBasePath(bp string) *GetLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetGlobalURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_log_forward.go b/operations/log_target/get_log_target_log_forward.go deleted file mode 100644 index f1414aed..00000000 --- a/operations/log_target/get_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetLogForwardHandlerFunc turns a function with the right signature into a get log target log forward handler -type GetLogTargetLogForwardHandlerFunc func(GetLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetLogForwardHandlerFunc) Handle(params GetLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetLogForwardHandler interface for that can handle valid get log target log forward params -type GetLogTargetLogForwardHandler interface { - Handle(GetLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewGetLogTargetLogForward creates a new http.Handler for the get log target log forward operation -func NewGetLogTargetLogForward(ctx *middleware.Context, handler GetLogTargetLogForwardHandler) *GetLogTargetLogForward { - return &GetLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - GetLogTargetLogForward swagger:route GET /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index} LogTarget getLogTargetLogForward - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetLogForward struct { - Context *middleware.Context - Handler GetLogTargetLogForwardHandler -} - -func (o *GetLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_log_forward_parameters.go b/operations/log_target/get_log_target_log_forward_parameters.go deleted file mode 100644 index dfcc8f30..00000000 --- a/operations/log_target/get_log_target_log_forward_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetLogForwardParams creates a new GetLogTargetLogForwardParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetLogForwardParams() GetLogTargetLogForwardParams { - - return GetLogTargetLogForwardParams{} -} - -// GetLogTargetLogForwardParams contains all the bound params for the get log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetLogForward -type GetLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetLogForwardParams() beforehand. -func (o *GetLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetLogForwardParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_log_forward_responses.go b/operations/log_target/get_log_target_log_forward_responses.go deleted file mode 100644 index 7ee4c0bc..00000000 --- a/operations/log_target/get_log_target_log_forward_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetLogForwardOKCode is the HTTP code returned for type GetLogTargetLogForwardOK -const GetLogTargetLogForwardOKCode int = 200 - -/* -GetLogTargetLogForwardOK Successful operation - -swagger:response getLogTargetLogForwardOK -*/ -type GetLogTargetLogForwardOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetLogForwardOK creates GetLogTargetLogForwardOK with default headers values -func NewGetLogTargetLogForwardOK() *GetLogTargetLogForwardOK { - - return &GetLogTargetLogForwardOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target log forward o k response -func (o *GetLogTargetLogForwardOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetLogForwardOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target log forward o k response -func (o *GetLogTargetLogForwardOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target log forward o k response -func (o *GetLogTargetLogForwardOK) WithPayload(payload *models.LogTarget) *GetLogTargetLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target log forward o k response -func (o *GetLogTargetLogForwardOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetLogForwardNotFoundCode is the HTTP code returned for type GetLogTargetLogForwardNotFound -const GetLogTargetLogForwardNotFoundCode int = 404 - -/* -GetLogTargetLogForwardNotFound The specified resource was not found - -swagger:response getLogTargetLogForwardNotFound -*/ -type GetLogTargetLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetLogForwardNotFound creates GetLogTargetLogForwardNotFound with default headers values -func NewGetLogTargetLogForwardNotFound() *GetLogTargetLogForwardNotFound { - - return &GetLogTargetLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target log forward not found response -func (o *GetLogTargetLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target log forward not found response -func (o *GetLogTargetLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target log forward not found response -func (o *GetLogTargetLogForwardNotFound) WithPayload(payload *models.Error) *GetLogTargetLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target log forward not found response -func (o *GetLogTargetLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetLogForwardDefault General Error - -swagger:response getLogTargetLogForwardDefault -*/ -type GetLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetLogForwardDefault creates GetLogTargetLogForwardDefault with default headers values -func NewGetLogTargetLogForwardDefault(code int) *GetLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) WithStatusCode(code int) *GetLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) WithPayload(payload *models.Error) *GetLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target log forward default response -func (o *GetLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_log_forward_urlbuilder.go b/operations/log_target/get_log_target_log_forward_urlbuilder.go deleted file mode 100644 index 0473dc86..00000000 --- a/operations/log_target/get_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetLogForwardURL generates an URL for the get log target log forward operation -type GetLogTargetLogForwardURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetLogForwardURL) WithBasePath(bp string) *GetLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/get_log_target_peer.go b/operations/log_target/get_log_target_peer.go deleted file mode 100644 index 1808a0ed..00000000 --- a/operations/log_target/get_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetLogTargetPeerHandlerFunc turns a function with the right signature into a get log target peer handler -type GetLogTargetPeerHandlerFunc func(GetLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLogTargetPeerHandlerFunc) Handle(params GetLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetLogTargetPeerHandler interface for that can handle valid get log target peer params -type GetLogTargetPeerHandler interface { - Handle(GetLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewGetLogTargetPeer creates a new http.Handler for the get log target peer operation -func NewGetLogTargetPeer(ctx *middleware.Context, handler GetLogTargetPeerHandler) *GetLogTargetPeer { - return &GetLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - GetLogTargetPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/log_targets/{index} LogTarget getLogTargetPeer - -# Return one Log Target - -Returns one Log Target configuration by it's index in the specified parent. -*/ -type GetLogTargetPeer struct { - Context *middleware.Context - Handler GetLogTargetPeerHandler -} - -func (o *GetLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/get_log_target_peer_parameters.go b/operations/log_target/get_log_target_peer_parameters.go deleted file mode 100644 index 27d9a7a4..00000000 --- a/operations/log_target/get_log_target_peer_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetLogTargetPeerParams creates a new GetLogTargetPeerParams object -// -// There are no default values defined in the spec. -func NewGetLogTargetPeerParams() GetLogTargetPeerParams { - - return GetLogTargetPeerParams{} -} - -// GetLogTargetPeerParams contains all the bound params for the get log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getLogTargetPeer -type GetLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetLogTargetPeerParams() beforehand. -func (o *GetLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetLogTargetPeerParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/log_target/get_log_target_peer_responses.go b/operations/log_target/get_log_target_peer_responses.go deleted file mode 100644 index 6dcf5186..00000000 --- a/operations/log_target/get_log_target_peer_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetLogTargetPeerOKCode is the HTTP code returned for type GetLogTargetPeerOK -const GetLogTargetPeerOKCode int = 200 - -/* -GetLogTargetPeerOK Successful operation - -swagger:response getLogTargetPeerOK -*/ -type GetLogTargetPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewGetLogTargetPeerOK creates GetLogTargetPeerOK with default headers values -func NewGetLogTargetPeerOK() *GetLogTargetPeerOK { - - return &GetLogTargetPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target peer o k response -func (o *GetLogTargetPeerOK) WithConfigurationVersion(configurationVersion string) *GetLogTargetPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target peer o k response -func (o *GetLogTargetPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target peer o k response -func (o *GetLogTargetPeerOK) WithPayload(payload *models.LogTarget) *GetLogTargetPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target peer o k response -func (o *GetLogTargetPeerOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetLogTargetPeerNotFoundCode is the HTTP code returned for type GetLogTargetPeerNotFound -const GetLogTargetPeerNotFoundCode int = 404 - -/* -GetLogTargetPeerNotFound The specified resource was not found - -swagger:response getLogTargetPeerNotFound -*/ -type GetLogTargetPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetPeerNotFound creates GetLogTargetPeerNotFound with default headers values -func NewGetLogTargetPeerNotFound() *GetLogTargetPeerNotFound { - - return &GetLogTargetPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get log target peer not found response -func (o *GetLogTargetPeerNotFound) WithConfigurationVersion(configurationVersion string) *GetLogTargetPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target peer not found response -func (o *GetLogTargetPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target peer not found response -func (o *GetLogTargetPeerNotFound) WithPayload(payload *models.Error) *GetLogTargetPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target peer not found response -func (o *GetLogTargetPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetLogTargetPeerDefault General Error - -swagger:response getLogTargetPeerDefault -*/ -type GetLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetLogTargetPeerDefault creates GetLogTargetPeerDefault with default headers values -func NewGetLogTargetPeerDefault(code int) *GetLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get log target peer default response -func (o *GetLogTargetPeerDefault) WithStatusCode(code int) *GetLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get log target peer default response -func (o *GetLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get log target peer default response -func (o *GetLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *GetLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get log target peer default response -func (o *GetLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get log target peer default response -func (o *GetLogTargetPeerDefault) WithPayload(payload *models.Error) *GetLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get log target peer default response -func (o *GetLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/get_log_target_peer_urlbuilder.go b/operations/log_target/get_log_target_peer_urlbuilder.go deleted file mode 100644 index 02979f73..00000000 --- a/operations/log_target/get_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetLogTargetPeerURL generates an URL for the get log target peer operation -type GetLogTargetPeerURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetPeerURL) WithBasePath(bp string) *GetLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetLogTargetPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_backend.go b/operations/log_target/replace_all_log_target_backend.go deleted file mode 100644 index 4b6eebd2..00000000 --- a/operations/log_target/replace_all_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetBackendHandlerFunc turns a function with the right signature into a replace all log target backend handler -type ReplaceAllLogTargetBackendHandlerFunc func(ReplaceAllLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetBackendHandlerFunc) Handle(params ReplaceAllLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetBackendHandler interface for that can handle valid replace all log target backend params -type ReplaceAllLogTargetBackendHandler interface { - Handle(ReplaceAllLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetBackend creates a new http.Handler for the replace all log target backend operation -func NewReplaceAllLogTargetBackend(ctx *middleware.Context, handler ReplaceAllLogTargetBackendHandler) *ReplaceAllLogTargetBackend { - return &ReplaceAllLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/log_targets LogTarget replaceAllLogTargetBackend - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetBackend struct { - Context *middleware.Context - Handler ReplaceAllLogTargetBackendHandler -} - -func (o *ReplaceAllLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_backend_parameters.go b/operations/log_target/replace_all_log_target_backend_parameters.go deleted file mode 100644 index ef4dd2f2..00000000 --- a/operations/log_target/replace_all_log_target_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetBackendParams creates a new ReplaceAllLogTargetBackendParams object -// with the default values initialized. -func NewReplaceAllLogTargetBackendParams() ReplaceAllLogTargetBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetBackendParams contains all the bound params for the replace all log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetBackend -type ReplaceAllLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetBackendParams() beforehand. -func (o *ReplaceAllLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_backend_responses.go b/operations/log_target/replace_all_log_target_backend_responses.go deleted file mode 100644 index fbbc6cd1..00000000 --- a/operations/log_target/replace_all_log_target_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetBackendOKCode is the HTTP code returned for type ReplaceAllLogTargetBackendOK -const ReplaceAllLogTargetBackendOKCode int = 200 - -/* -ReplaceAllLogTargetBackendOK All Log Target lines replaced - -swagger:response replaceAllLogTargetBackendOK -*/ -type ReplaceAllLogTargetBackendOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetBackendOK creates ReplaceAllLogTargetBackendOK with default headers values -func NewReplaceAllLogTargetBackendOK() *ReplaceAllLogTargetBackendOK { - - return &ReplaceAllLogTargetBackendOK{} -} - -// WithPayload adds the payload to the replace all log target backend o k response -func (o *ReplaceAllLogTargetBackendOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target backend o k response -func (o *ReplaceAllLogTargetBackendOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetBackendAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetBackendAccepted -const ReplaceAllLogTargetBackendAcceptedCode int = 202 - -/* -ReplaceAllLogTargetBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetBackendAccepted -*/ -type ReplaceAllLogTargetBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetBackendAccepted creates ReplaceAllLogTargetBackendAccepted with default headers values -func NewReplaceAllLogTargetBackendAccepted() *ReplaceAllLogTargetBackendAccepted { - - return &ReplaceAllLogTargetBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target backend accepted response -func (o *ReplaceAllLogTargetBackendAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target backend accepted response -func (o *ReplaceAllLogTargetBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target backend accepted response -func (o *ReplaceAllLogTargetBackendAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target backend accepted response -func (o *ReplaceAllLogTargetBackendAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetBackendBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetBackendBadRequest -const ReplaceAllLogTargetBackendBadRequestCode int = 400 - -/* -ReplaceAllLogTargetBackendBadRequest Bad request - -swagger:response replaceAllLogTargetBackendBadRequest -*/ -type ReplaceAllLogTargetBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetBackendBadRequest creates ReplaceAllLogTargetBackendBadRequest with default headers values -func NewReplaceAllLogTargetBackendBadRequest() *ReplaceAllLogTargetBackendBadRequest { - - return &ReplaceAllLogTargetBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target backend bad request response -func (o *ReplaceAllLogTargetBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target backend bad request response -func (o *ReplaceAllLogTargetBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target backend bad request response -func (o *ReplaceAllLogTargetBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target backend bad request response -func (o *ReplaceAllLogTargetBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetBackendDefault General Error - -swagger:response replaceAllLogTargetBackendDefault -*/ -type ReplaceAllLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetBackendDefault creates ReplaceAllLogTargetBackendDefault with default headers values -func NewReplaceAllLogTargetBackendDefault(code int) *ReplaceAllLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) WithStatusCode(code int) *ReplaceAllLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target backend default response -func (o *ReplaceAllLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_backend_urlbuilder.go b/operations/log_target/replace_all_log_target_backend_urlbuilder.go deleted file mode 100644 index a8d1ba75..00000000 --- a/operations/log_target/replace_all_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetBackendURL generates an URL for the replace all log target backend operation -type ReplaceAllLogTargetBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetBackendURL) WithBasePath(bp string) *ReplaceAllLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_defaults.go b/operations/log_target/replace_all_log_target_defaults.go deleted file mode 100644 index efa3728b..00000000 --- a/operations/log_target/replace_all_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetDefaultsHandlerFunc turns a function with the right signature into a replace all log target defaults handler -type ReplaceAllLogTargetDefaultsHandlerFunc func(ReplaceAllLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetDefaultsHandlerFunc) Handle(params ReplaceAllLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetDefaultsHandler interface for that can handle valid replace all log target defaults params -type ReplaceAllLogTargetDefaultsHandler interface { - Handle(ReplaceAllLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetDefaults creates a new http.Handler for the replace all log target defaults operation -func NewReplaceAllLogTargetDefaults(ctx *middleware.Context, handler ReplaceAllLogTargetDefaultsHandler) *ReplaceAllLogTargetDefaults { - return &ReplaceAllLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets LogTarget replaceAllLogTargetDefaults - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetDefaults struct { - Context *middleware.Context - Handler ReplaceAllLogTargetDefaultsHandler -} - -func (o *ReplaceAllLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_defaults_parameters.go b/operations/log_target/replace_all_log_target_defaults_parameters.go deleted file mode 100644 index 3a5c341a..00000000 --- a/operations/log_target/replace_all_log_target_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetDefaultsParams creates a new ReplaceAllLogTargetDefaultsParams object -// with the default values initialized. -func NewReplaceAllLogTargetDefaultsParams() ReplaceAllLogTargetDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetDefaultsParams contains all the bound params for the replace all log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetDefaults -type ReplaceAllLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetDefaultsParams() beforehand. -func (o *ReplaceAllLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_defaults_responses.go b/operations/log_target/replace_all_log_target_defaults_responses.go deleted file mode 100644 index a4c088b9..00000000 --- a/operations/log_target/replace_all_log_target_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetDefaultsOKCode is the HTTP code returned for type ReplaceAllLogTargetDefaultsOK -const ReplaceAllLogTargetDefaultsOKCode int = 200 - -/* -ReplaceAllLogTargetDefaultsOK All Log Target lines replaced - -swagger:response replaceAllLogTargetDefaultsOK -*/ -type ReplaceAllLogTargetDefaultsOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetDefaultsOK creates ReplaceAllLogTargetDefaultsOK with default headers values -func NewReplaceAllLogTargetDefaultsOK() *ReplaceAllLogTargetDefaultsOK { - - return &ReplaceAllLogTargetDefaultsOK{} -} - -// WithPayload adds the payload to the replace all log target defaults o k response -func (o *ReplaceAllLogTargetDefaultsOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target defaults o k response -func (o *ReplaceAllLogTargetDefaultsOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetDefaultsAccepted -const ReplaceAllLogTargetDefaultsAcceptedCode int = 202 - -/* -ReplaceAllLogTargetDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetDefaultsAccepted -*/ -type ReplaceAllLogTargetDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetDefaultsAccepted creates ReplaceAllLogTargetDefaultsAccepted with default headers values -func NewReplaceAllLogTargetDefaultsAccepted() *ReplaceAllLogTargetDefaultsAccepted { - - return &ReplaceAllLogTargetDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target defaults accepted response -func (o *ReplaceAllLogTargetDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target defaults accepted response -func (o *ReplaceAllLogTargetDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target defaults accepted response -func (o *ReplaceAllLogTargetDefaultsAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target defaults accepted response -func (o *ReplaceAllLogTargetDefaultsAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetDefaultsBadRequest -const ReplaceAllLogTargetDefaultsBadRequestCode int = 400 - -/* -ReplaceAllLogTargetDefaultsBadRequest Bad request - -swagger:response replaceAllLogTargetDefaultsBadRequest -*/ -type ReplaceAllLogTargetDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetDefaultsBadRequest creates ReplaceAllLogTargetDefaultsBadRequest with default headers values -func NewReplaceAllLogTargetDefaultsBadRequest() *ReplaceAllLogTargetDefaultsBadRequest { - - return &ReplaceAllLogTargetDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target defaults bad request response -func (o *ReplaceAllLogTargetDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target defaults bad request response -func (o *ReplaceAllLogTargetDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target defaults bad request response -func (o *ReplaceAllLogTargetDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target defaults bad request response -func (o *ReplaceAllLogTargetDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetDefaultsDefault General Error - -swagger:response replaceAllLogTargetDefaultsDefault -*/ -type ReplaceAllLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetDefaultsDefault creates ReplaceAllLogTargetDefaultsDefault with default headers values -func NewReplaceAllLogTargetDefaultsDefault(code int) *ReplaceAllLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) WithStatusCode(code int) *ReplaceAllLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target defaults default response -func (o *ReplaceAllLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_defaults_urlbuilder.go b/operations/log_target/replace_all_log_target_defaults_urlbuilder.go deleted file mode 100644 index cb10eba2..00000000 --- a/operations/log_target/replace_all_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetDefaultsURL generates an URL for the replace all log target defaults operation -type ReplaceAllLogTargetDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetDefaultsURL) WithBasePath(bp string) *ReplaceAllLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_frontend.go b/operations/log_target/replace_all_log_target_frontend.go deleted file mode 100644 index 5c9c5cfe..00000000 --- a/operations/log_target/replace_all_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetFrontendHandlerFunc turns a function with the right signature into a replace all log target frontend handler -type ReplaceAllLogTargetFrontendHandlerFunc func(ReplaceAllLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetFrontendHandlerFunc) Handle(params ReplaceAllLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetFrontendHandler interface for that can handle valid replace all log target frontend params -type ReplaceAllLogTargetFrontendHandler interface { - Handle(ReplaceAllLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetFrontend creates a new http.Handler for the replace all log target frontend operation -func NewReplaceAllLogTargetFrontend(ctx *middleware.Context, handler ReplaceAllLogTargetFrontendHandler) *ReplaceAllLogTargetFrontend { - return &ReplaceAllLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets LogTarget replaceAllLogTargetFrontend - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetFrontend struct { - Context *middleware.Context - Handler ReplaceAllLogTargetFrontendHandler -} - -func (o *ReplaceAllLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_frontend_parameters.go b/operations/log_target/replace_all_log_target_frontend_parameters.go deleted file mode 100644 index f0d87f43..00000000 --- a/operations/log_target/replace_all_log_target_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetFrontendParams creates a new ReplaceAllLogTargetFrontendParams object -// with the default values initialized. -func NewReplaceAllLogTargetFrontendParams() ReplaceAllLogTargetFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetFrontendParams contains all the bound params for the replace all log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetFrontend -type ReplaceAllLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetFrontendParams() beforehand. -func (o *ReplaceAllLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_frontend_responses.go b/operations/log_target/replace_all_log_target_frontend_responses.go deleted file mode 100644 index b866bdb1..00000000 --- a/operations/log_target/replace_all_log_target_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetFrontendOKCode is the HTTP code returned for type ReplaceAllLogTargetFrontendOK -const ReplaceAllLogTargetFrontendOKCode int = 200 - -/* -ReplaceAllLogTargetFrontendOK All Log Target lines replaced - -swagger:response replaceAllLogTargetFrontendOK -*/ -type ReplaceAllLogTargetFrontendOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetFrontendOK creates ReplaceAllLogTargetFrontendOK with default headers values -func NewReplaceAllLogTargetFrontendOK() *ReplaceAllLogTargetFrontendOK { - - return &ReplaceAllLogTargetFrontendOK{} -} - -// WithPayload adds the payload to the replace all log target frontend o k response -func (o *ReplaceAllLogTargetFrontendOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target frontend o k response -func (o *ReplaceAllLogTargetFrontendOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetFrontendAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetFrontendAccepted -const ReplaceAllLogTargetFrontendAcceptedCode int = 202 - -/* -ReplaceAllLogTargetFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetFrontendAccepted -*/ -type ReplaceAllLogTargetFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetFrontendAccepted creates ReplaceAllLogTargetFrontendAccepted with default headers values -func NewReplaceAllLogTargetFrontendAccepted() *ReplaceAllLogTargetFrontendAccepted { - - return &ReplaceAllLogTargetFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target frontend accepted response -func (o *ReplaceAllLogTargetFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target frontend accepted response -func (o *ReplaceAllLogTargetFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target frontend accepted response -func (o *ReplaceAllLogTargetFrontendAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target frontend accepted response -func (o *ReplaceAllLogTargetFrontendAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetFrontendBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetFrontendBadRequest -const ReplaceAllLogTargetFrontendBadRequestCode int = 400 - -/* -ReplaceAllLogTargetFrontendBadRequest Bad request - -swagger:response replaceAllLogTargetFrontendBadRequest -*/ -type ReplaceAllLogTargetFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetFrontendBadRequest creates ReplaceAllLogTargetFrontendBadRequest with default headers values -func NewReplaceAllLogTargetFrontendBadRequest() *ReplaceAllLogTargetFrontendBadRequest { - - return &ReplaceAllLogTargetFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target frontend bad request response -func (o *ReplaceAllLogTargetFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target frontend bad request response -func (o *ReplaceAllLogTargetFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target frontend bad request response -func (o *ReplaceAllLogTargetFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target frontend bad request response -func (o *ReplaceAllLogTargetFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetFrontendDefault General Error - -swagger:response replaceAllLogTargetFrontendDefault -*/ -type ReplaceAllLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetFrontendDefault creates ReplaceAllLogTargetFrontendDefault with default headers values -func NewReplaceAllLogTargetFrontendDefault(code int) *ReplaceAllLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) WithStatusCode(code int) *ReplaceAllLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target frontend default response -func (o *ReplaceAllLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_frontend_urlbuilder.go b/operations/log_target/replace_all_log_target_frontend_urlbuilder.go deleted file mode 100644 index 2ed116d6..00000000 --- a/operations/log_target/replace_all_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetFrontendURL generates an URL for the replace all log target frontend operation -type ReplaceAllLogTargetFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetFrontendURL) WithBasePath(bp string) *ReplaceAllLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_global.go b/operations/log_target/replace_all_log_target_global.go deleted file mode 100644 index 35b19617..00000000 --- a/operations/log_target/replace_all_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetGlobalHandlerFunc turns a function with the right signature into a replace all log target global handler -type ReplaceAllLogTargetGlobalHandlerFunc func(ReplaceAllLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetGlobalHandlerFunc) Handle(params ReplaceAllLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetGlobalHandler interface for that can handle valid replace all log target global params -type ReplaceAllLogTargetGlobalHandler interface { - Handle(ReplaceAllLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetGlobal creates a new http.Handler for the replace all log target global operation -func NewReplaceAllLogTargetGlobal(ctx *middleware.Context, handler ReplaceAllLogTargetGlobalHandler) *ReplaceAllLogTargetGlobal { - return &ReplaceAllLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetGlobal swagger:route PUT /services/haproxy/configuration/global/log_targets LogTarget replaceAllLogTargetGlobal - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetGlobal struct { - Context *middleware.Context - Handler ReplaceAllLogTargetGlobalHandler -} - -func (o *ReplaceAllLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_global_parameters.go b/operations/log_target/replace_all_log_target_global_parameters.go deleted file mode 100644 index 557b6d9e..00000000 --- a/operations/log_target/replace_all_log_target_global_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetGlobalParams creates a new ReplaceAllLogTargetGlobalParams object -// with the default values initialized. -func NewReplaceAllLogTargetGlobalParams() ReplaceAllLogTargetGlobalParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetGlobalParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetGlobalParams contains all the bound params for the replace all log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetGlobal -type ReplaceAllLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetGlobalParams() beforehand. -func (o *ReplaceAllLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetGlobalParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetGlobalParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_global_responses.go b/operations/log_target/replace_all_log_target_global_responses.go deleted file mode 100644 index 3f3a3c61..00000000 --- a/operations/log_target/replace_all_log_target_global_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetGlobalOKCode is the HTTP code returned for type ReplaceAllLogTargetGlobalOK -const ReplaceAllLogTargetGlobalOKCode int = 200 - -/* -ReplaceAllLogTargetGlobalOK All Log Target lines replaced - -swagger:response replaceAllLogTargetGlobalOK -*/ -type ReplaceAllLogTargetGlobalOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetGlobalOK creates ReplaceAllLogTargetGlobalOK with default headers values -func NewReplaceAllLogTargetGlobalOK() *ReplaceAllLogTargetGlobalOK { - - return &ReplaceAllLogTargetGlobalOK{} -} - -// WithPayload adds the payload to the replace all log target global o k response -func (o *ReplaceAllLogTargetGlobalOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target global o k response -func (o *ReplaceAllLogTargetGlobalOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetGlobalAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetGlobalAccepted -const ReplaceAllLogTargetGlobalAcceptedCode int = 202 - -/* -ReplaceAllLogTargetGlobalAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetGlobalAccepted -*/ -type ReplaceAllLogTargetGlobalAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetGlobalAccepted creates ReplaceAllLogTargetGlobalAccepted with default headers values -func NewReplaceAllLogTargetGlobalAccepted() *ReplaceAllLogTargetGlobalAccepted { - - return &ReplaceAllLogTargetGlobalAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target global accepted response -func (o *ReplaceAllLogTargetGlobalAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetGlobalAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target global accepted response -func (o *ReplaceAllLogTargetGlobalAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target global accepted response -func (o *ReplaceAllLogTargetGlobalAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetGlobalAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target global accepted response -func (o *ReplaceAllLogTargetGlobalAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetGlobalAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetGlobalBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetGlobalBadRequest -const ReplaceAllLogTargetGlobalBadRequestCode int = 400 - -/* -ReplaceAllLogTargetGlobalBadRequest Bad request - -swagger:response replaceAllLogTargetGlobalBadRequest -*/ -type ReplaceAllLogTargetGlobalBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetGlobalBadRequest creates ReplaceAllLogTargetGlobalBadRequest with default headers values -func NewReplaceAllLogTargetGlobalBadRequest() *ReplaceAllLogTargetGlobalBadRequest { - - return &ReplaceAllLogTargetGlobalBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target global bad request response -func (o *ReplaceAllLogTargetGlobalBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetGlobalBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target global bad request response -func (o *ReplaceAllLogTargetGlobalBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target global bad request response -func (o *ReplaceAllLogTargetGlobalBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetGlobalBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target global bad request response -func (o *ReplaceAllLogTargetGlobalBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetGlobalBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetGlobalDefault General Error - -swagger:response replaceAllLogTargetGlobalDefault -*/ -type ReplaceAllLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetGlobalDefault creates ReplaceAllLogTargetGlobalDefault with default headers values -func NewReplaceAllLogTargetGlobalDefault(code int) *ReplaceAllLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) WithStatusCode(code int) *ReplaceAllLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target global default response -func (o *ReplaceAllLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_global_urlbuilder.go b/operations/log_target/replace_all_log_target_global_urlbuilder.go deleted file mode 100644 index d621cf4d..00000000 --- a/operations/log_target/replace_all_log_target_global_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetGlobalURL generates an URL for the replace all log target global operation -type ReplaceAllLogTargetGlobalURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetGlobalURL) WithBasePath(bp string) *ReplaceAllLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_log_forward.go b/operations/log_target/replace_all_log_target_log_forward.go deleted file mode 100644 index 7cd739a1..00000000 --- a/operations/log_target/replace_all_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetLogForwardHandlerFunc turns a function with the right signature into a replace all log target log forward handler -type ReplaceAllLogTargetLogForwardHandlerFunc func(ReplaceAllLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetLogForwardHandlerFunc) Handle(params ReplaceAllLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetLogForwardHandler interface for that can handle valid replace all log target log forward params -type ReplaceAllLogTargetLogForwardHandler interface { - Handle(ReplaceAllLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetLogForward creates a new http.Handler for the replace all log target log forward operation -func NewReplaceAllLogTargetLogForward(ctx *middleware.Context, handler ReplaceAllLogTargetLogForwardHandler) *ReplaceAllLogTargetLogForward { - return &ReplaceAllLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetLogForward swagger:route PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets LogTarget replaceAllLogTargetLogForward - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetLogForward struct { - Context *middleware.Context - Handler ReplaceAllLogTargetLogForwardHandler -} - -func (o *ReplaceAllLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_log_forward_parameters.go b/operations/log_target/replace_all_log_target_log_forward_parameters.go deleted file mode 100644 index 39b16410..00000000 --- a/operations/log_target/replace_all_log_target_log_forward_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetLogForwardParams creates a new ReplaceAllLogTargetLogForwardParams object -// with the default values initialized. -func NewReplaceAllLogTargetLogForwardParams() ReplaceAllLogTargetLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetLogForwardParams contains all the bound params for the replace all log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetLogForward -type ReplaceAllLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetLogForwardParams() beforehand. -func (o *ReplaceAllLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_log_forward_responses.go b/operations/log_target/replace_all_log_target_log_forward_responses.go deleted file mode 100644 index 689e8aad..00000000 --- a/operations/log_target/replace_all_log_target_log_forward_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetLogForwardOKCode is the HTTP code returned for type ReplaceAllLogTargetLogForwardOK -const ReplaceAllLogTargetLogForwardOKCode int = 200 - -/* -ReplaceAllLogTargetLogForwardOK All Log Target lines replaced - -swagger:response replaceAllLogTargetLogForwardOK -*/ -type ReplaceAllLogTargetLogForwardOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetLogForwardOK creates ReplaceAllLogTargetLogForwardOK with default headers values -func NewReplaceAllLogTargetLogForwardOK() *ReplaceAllLogTargetLogForwardOK { - - return &ReplaceAllLogTargetLogForwardOK{} -} - -// WithPayload adds the payload to the replace all log target log forward o k response -func (o *ReplaceAllLogTargetLogForwardOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target log forward o k response -func (o *ReplaceAllLogTargetLogForwardOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetLogForwardAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetLogForwardAccepted -const ReplaceAllLogTargetLogForwardAcceptedCode int = 202 - -/* -ReplaceAllLogTargetLogForwardAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetLogForwardAccepted -*/ -type ReplaceAllLogTargetLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetLogForwardAccepted creates ReplaceAllLogTargetLogForwardAccepted with default headers values -func NewReplaceAllLogTargetLogForwardAccepted() *ReplaceAllLogTargetLogForwardAccepted { - - return &ReplaceAllLogTargetLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target log forward accepted response -func (o *ReplaceAllLogTargetLogForwardAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target log forward accepted response -func (o *ReplaceAllLogTargetLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target log forward accepted response -func (o *ReplaceAllLogTargetLogForwardAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target log forward accepted response -func (o *ReplaceAllLogTargetLogForwardAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetLogForwardBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetLogForwardBadRequest -const ReplaceAllLogTargetLogForwardBadRequestCode int = 400 - -/* -ReplaceAllLogTargetLogForwardBadRequest Bad request - -swagger:response replaceAllLogTargetLogForwardBadRequest -*/ -type ReplaceAllLogTargetLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetLogForwardBadRequest creates ReplaceAllLogTargetLogForwardBadRequest with default headers values -func NewReplaceAllLogTargetLogForwardBadRequest() *ReplaceAllLogTargetLogForwardBadRequest { - - return &ReplaceAllLogTargetLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target log forward bad request response -func (o *ReplaceAllLogTargetLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target log forward bad request response -func (o *ReplaceAllLogTargetLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target log forward bad request response -func (o *ReplaceAllLogTargetLogForwardBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target log forward bad request response -func (o *ReplaceAllLogTargetLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetLogForwardDefault General Error - -swagger:response replaceAllLogTargetLogForwardDefault -*/ -type ReplaceAllLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetLogForwardDefault creates ReplaceAllLogTargetLogForwardDefault with default headers values -func NewReplaceAllLogTargetLogForwardDefault(code int) *ReplaceAllLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) WithStatusCode(code int) *ReplaceAllLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target log forward default response -func (o *ReplaceAllLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_log_forward_urlbuilder.go b/operations/log_target/replace_all_log_target_log_forward_urlbuilder.go deleted file mode 100644 index b98359a1..00000000 --- a/operations/log_target/replace_all_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetLogForwardURL generates an URL for the replace all log target log forward operation -type ReplaceAllLogTargetLogForwardURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetLogForwardURL) WithBasePath(bp string) *ReplaceAllLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_all_log_target_peer.go b/operations/log_target/replace_all_log_target_peer.go deleted file mode 100644 index 584fb739..00000000 --- a/operations/log_target/replace_all_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllLogTargetPeerHandlerFunc turns a function with the right signature into a replace all log target peer handler -type ReplaceAllLogTargetPeerHandlerFunc func(ReplaceAllLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllLogTargetPeerHandlerFunc) Handle(params ReplaceAllLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllLogTargetPeerHandler interface for that can handle valid replace all log target peer params -type ReplaceAllLogTargetPeerHandler interface { - Handle(ReplaceAllLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewReplaceAllLogTargetPeer creates a new http.Handler for the replace all log target peer operation -func NewReplaceAllLogTargetPeer(ctx *middleware.Context, handler ReplaceAllLogTargetPeerHandler) *ReplaceAllLogTargetPeer { - return &ReplaceAllLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - ReplaceAllLogTargetPeer swagger:route PUT /services/haproxy/configuration/peers/{parent_name}/log_targets LogTarget replaceAllLogTargetPeer - -# Replace a Log Target list - -Replaces a whole list of Log Targets with the list given in parameter -*/ -type ReplaceAllLogTargetPeer struct { - Context *middleware.Context - Handler ReplaceAllLogTargetPeerHandler -} - -func (o *ReplaceAllLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_all_log_target_peer_parameters.go b/operations/log_target/replace_all_log_target_peer_parameters.go deleted file mode 100644 index c5ae7f2e..00000000 --- a/operations/log_target/replace_all_log_target_peer_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllLogTargetPeerParams creates a new ReplaceAllLogTargetPeerParams object -// with the default values initialized. -func NewReplaceAllLogTargetPeerParams() ReplaceAllLogTargetPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllLogTargetPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllLogTargetPeerParams contains all the bound params for the replace all log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllLogTargetPeer -type ReplaceAllLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.LogTargets - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllLogTargetPeerParams() beforehand. -func (o *ReplaceAllLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTargets - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllLogTargetPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllLogTargetPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllLogTargetPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_all_log_target_peer_responses.go b/operations/log_target/replace_all_log_target_peer_responses.go deleted file mode 100644 index e88bef9a..00000000 --- a/operations/log_target/replace_all_log_target_peer_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllLogTargetPeerOKCode is the HTTP code returned for type ReplaceAllLogTargetPeerOK -const ReplaceAllLogTargetPeerOKCode int = 200 - -/* -ReplaceAllLogTargetPeerOK All Log Target lines replaced - -swagger:response replaceAllLogTargetPeerOK -*/ -type ReplaceAllLogTargetPeerOK struct { - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetPeerOK creates ReplaceAllLogTargetPeerOK with default headers values -func NewReplaceAllLogTargetPeerOK() *ReplaceAllLogTargetPeerOK { - - return &ReplaceAllLogTargetPeerOK{} -} - -// WithPayload adds the payload to the replace all log target peer o k response -func (o *ReplaceAllLogTargetPeerOK) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target peer o k response -func (o *ReplaceAllLogTargetPeerOK) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetPeerAcceptedCode is the HTTP code returned for type ReplaceAllLogTargetPeerAccepted -const ReplaceAllLogTargetPeerAcceptedCode int = 202 - -/* -ReplaceAllLogTargetPeerAccepted Configuration change accepted and reload requested - -swagger:response replaceAllLogTargetPeerAccepted -*/ -type ReplaceAllLogTargetPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.LogTargets `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetPeerAccepted creates ReplaceAllLogTargetPeerAccepted with default headers values -func NewReplaceAllLogTargetPeerAccepted() *ReplaceAllLogTargetPeerAccepted { - - return &ReplaceAllLogTargetPeerAccepted{} -} - -// WithReloadID adds the reloadId to the replace all log target peer accepted response -func (o *ReplaceAllLogTargetPeerAccepted) WithReloadID(reloadID string) *ReplaceAllLogTargetPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all log target peer accepted response -func (o *ReplaceAllLogTargetPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all log target peer accepted response -func (o *ReplaceAllLogTargetPeerAccepted) WithPayload(payload models.LogTargets) *ReplaceAllLogTargetPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target peer accepted response -func (o *ReplaceAllLogTargetPeerAccepted) SetPayload(payload models.LogTargets) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.LogTargets{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllLogTargetPeerBadRequestCode is the HTTP code returned for type ReplaceAllLogTargetPeerBadRequest -const ReplaceAllLogTargetPeerBadRequestCode int = 400 - -/* -ReplaceAllLogTargetPeerBadRequest Bad request - -swagger:response replaceAllLogTargetPeerBadRequest -*/ -type ReplaceAllLogTargetPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetPeerBadRequest creates ReplaceAllLogTargetPeerBadRequest with default headers values -func NewReplaceAllLogTargetPeerBadRequest() *ReplaceAllLogTargetPeerBadRequest { - - return &ReplaceAllLogTargetPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target peer bad request response -func (o *ReplaceAllLogTargetPeerBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target peer bad request response -func (o *ReplaceAllLogTargetPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target peer bad request response -func (o *ReplaceAllLogTargetPeerBadRequest) WithPayload(payload *models.Error) *ReplaceAllLogTargetPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target peer bad request response -func (o *ReplaceAllLogTargetPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllLogTargetPeerDefault General Error - -swagger:response replaceAllLogTargetPeerDefault -*/ -type ReplaceAllLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllLogTargetPeerDefault creates ReplaceAllLogTargetPeerDefault with default headers values -func NewReplaceAllLogTargetPeerDefault(code int) *ReplaceAllLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) WithStatusCode(code int) *ReplaceAllLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) WithPayload(payload *models.Error) *ReplaceAllLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all log target peer default response -func (o *ReplaceAllLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_all_log_target_peer_urlbuilder.go b/operations/log_target/replace_all_log_target_peer_urlbuilder.go deleted file mode 100644 index f9e4c53b..00000000 --- a/operations/log_target/replace_all_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllLogTargetPeerURL generates an URL for the replace all log target peer operation -type ReplaceAllLogTargetPeerURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetPeerURL) WithBasePath(bp string) *ReplaceAllLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_backend.go b/operations/log_target/replace_log_target_backend.go deleted file mode 100644 index 37285f70..00000000 --- a/operations/log_target/replace_log_target_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetBackendHandlerFunc turns a function with the right signature into a replace log target backend handler -type ReplaceLogTargetBackendHandlerFunc func(ReplaceLogTargetBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetBackendHandlerFunc) Handle(params ReplaceLogTargetBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetBackendHandler interface for that can handle valid replace log target backend params -type ReplaceLogTargetBackendHandler interface { - Handle(ReplaceLogTargetBackendParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetBackend creates a new http.Handler for the replace log target backend operation -func NewReplaceLogTargetBackend(ctx *middleware.Context, handler ReplaceLogTargetBackendHandler) *ReplaceLogTargetBackend { - return &ReplaceLogTargetBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/log_targets/{index} LogTarget replaceLogTargetBackend - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetBackend struct { - Context *middleware.Context - Handler ReplaceLogTargetBackendHandler -} - -func (o *ReplaceLogTargetBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_backend_parameters.go b/operations/log_target/replace_log_target_backend_parameters.go deleted file mode 100644 index 41bc5ff0..00000000 --- a/operations/log_target/replace_log_target_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetBackendParams creates a new ReplaceLogTargetBackendParams object -// with the default values initialized. -func NewReplaceLogTargetBackendParams() ReplaceLogTargetBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetBackendParams contains all the bound params for the replace log target backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetBackend -type ReplaceLogTargetBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetBackendParams() beforehand. -func (o *ReplaceLogTargetBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceLogTargetBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_backend_responses.go b/operations/log_target/replace_log_target_backend_responses.go deleted file mode 100644 index 8aa2455c..00000000 --- a/operations/log_target/replace_log_target_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetBackendOKCode is the HTTP code returned for type ReplaceLogTargetBackendOK -const ReplaceLogTargetBackendOKCode int = 200 - -/* -ReplaceLogTargetBackendOK Log Target replaced - -swagger:response replaceLogTargetBackendOK -*/ -type ReplaceLogTargetBackendOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetBackendOK creates ReplaceLogTargetBackendOK with default headers values -func NewReplaceLogTargetBackendOK() *ReplaceLogTargetBackendOK { - - return &ReplaceLogTargetBackendOK{} -} - -// WithPayload adds the payload to the replace log target backend o k response -func (o *ReplaceLogTargetBackendOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target backend o k response -func (o *ReplaceLogTargetBackendOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetBackendAcceptedCode is the HTTP code returned for type ReplaceLogTargetBackendAccepted -const ReplaceLogTargetBackendAcceptedCode int = 202 - -/* -ReplaceLogTargetBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetBackendAccepted -*/ -type ReplaceLogTargetBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetBackendAccepted creates ReplaceLogTargetBackendAccepted with default headers values -func NewReplaceLogTargetBackendAccepted() *ReplaceLogTargetBackendAccepted { - - return &ReplaceLogTargetBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target backend accepted response -func (o *ReplaceLogTargetBackendAccepted) WithReloadID(reloadID string) *ReplaceLogTargetBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target backend accepted response -func (o *ReplaceLogTargetBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target backend accepted response -func (o *ReplaceLogTargetBackendAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target backend accepted response -func (o *ReplaceLogTargetBackendAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetBackendBadRequestCode is the HTTP code returned for type ReplaceLogTargetBackendBadRequest -const ReplaceLogTargetBackendBadRequestCode int = 400 - -/* -ReplaceLogTargetBackendBadRequest Bad request - -swagger:response replaceLogTargetBackendBadRequest -*/ -type ReplaceLogTargetBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetBackendBadRequest creates ReplaceLogTargetBackendBadRequest with default headers values -func NewReplaceLogTargetBackendBadRequest() *ReplaceLogTargetBackendBadRequest { - - return &ReplaceLogTargetBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target backend bad request response -func (o *ReplaceLogTargetBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target backend bad request response -func (o *ReplaceLogTargetBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target backend bad request response -func (o *ReplaceLogTargetBackendBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target backend bad request response -func (o *ReplaceLogTargetBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetBackendNotFoundCode is the HTTP code returned for type ReplaceLogTargetBackendNotFound -const ReplaceLogTargetBackendNotFoundCode int = 404 - -/* -ReplaceLogTargetBackendNotFound The specified resource was not found - -swagger:response replaceLogTargetBackendNotFound -*/ -type ReplaceLogTargetBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetBackendNotFound creates ReplaceLogTargetBackendNotFound with default headers values -func NewReplaceLogTargetBackendNotFound() *ReplaceLogTargetBackendNotFound { - - return &ReplaceLogTargetBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target backend not found response -func (o *ReplaceLogTargetBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target backend not found response -func (o *ReplaceLogTargetBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target backend not found response -func (o *ReplaceLogTargetBackendNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target backend not found response -func (o *ReplaceLogTargetBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetBackendDefault General Error - -swagger:response replaceLogTargetBackendDefault -*/ -type ReplaceLogTargetBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetBackendDefault creates ReplaceLogTargetBackendDefault with default headers values -func NewReplaceLogTargetBackendDefault(code int) *ReplaceLogTargetBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) WithStatusCode(code int) *ReplaceLogTargetBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) WithPayload(payload *models.Error) *ReplaceLogTargetBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target backend default response -func (o *ReplaceLogTargetBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_backend_urlbuilder.go b/operations/log_target/replace_log_target_backend_urlbuilder.go deleted file mode 100644 index d33879da..00000000 --- a/operations/log_target/replace_log_target_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetBackendURL generates an URL for the replace log target backend operation -type ReplaceLogTargetBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetBackendURL) WithBasePath(bp string) *ReplaceLogTargetBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceLogTargetBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_defaults.go b/operations/log_target/replace_log_target_defaults.go deleted file mode 100644 index 2804786c..00000000 --- a/operations/log_target/replace_log_target_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetDefaultsHandlerFunc turns a function with the right signature into a replace log target defaults handler -type ReplaceLogTargetDefaultsHandlerFunc func(ReplaceLogTargetDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetDefaultsHandlerFunc) Handle(params ReplaceLogTargetDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetDefaultsHandler interface for that can handle valid replace log target defaults params -type ReplaceLogTargetDefaultsHandler interface { - Handle(ReplaceLogTargetDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetDefaults creates a new http.Handler for the replace log target defaults operation -func NewReplaceLogTargetDefaults(ctx *middleware.Context, handler ReplaceLogTargetDefaultsHandler) *ReplaceLogTargetDefaults { - return &ReplaceLogTargetDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index} LogTarget replaceLogTargetDefaults - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetDefaults struct { - Context *middleware.Context - Handler ReplaceLogTargetDefaultsHandler -} - -func (o *ReplaceLogTargetDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_defaults_parameters.go b/operations/log_target/replace_log_target_defaults_parameters.go deleted file mode 100644 index 4236fbdb..00000000 --- a/operations/log_target/replace_log_target_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetDefaultsParams creates a new ReplaceLogTargetDefaultsParams object -// with the default values initialized. -func NewReplaceLogTargetDefaultsParams() ReplaceLogTargetDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetDefaultsParams contains all the bound params for the replace log target defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetDefaults -type ReplaceLogTargetDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetDefaultsParams() beforehand. -func (o *ReplaceLogTargetDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceLogTargetDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_defaults_responses.go b/operations/log_target/replace_log_target_defaults_responses.go deleted file mode 100644 index 001b0112..00000000 --- a/operations/log_target/replace_log_target_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetDefaultsOKCode is the HTTP code returned for type ReplaceLogTargetDefaultsOK -const ReplaceLogTargetDefaultsOKCode int = 200 - -/* -ReplaceLogTargetDefaultsOK Log Target replaced - -swagger:response replaceLogTargetDefaultsOK -*/ -type ReplaceLogTargetDefaultsOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetDefaultsOK creates ReplaceLogTargetDefaultsOK with default headers values -func NewReplaceLogTargetDefaultsOK() *ReplaceLogTargetDefaultsOK { - - return &ReplaceLogTargetDefaultsOK{} -} - -// WithPayload adds the payload to the replace log target defaults o k response -func (o *ReplaceLogTargetDefaultsOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target defaults o k response -func (o *ReplaceLogTargetDefaultsOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetDefaultsAcceptedCode is the HTTP code returned for type ReplaceLogTargetDefaultsAccepted -const ReplaceLogTargetDefaultsAcceptedCode int = 202 - -/* -ReplaceLogTargetDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetDefaultsAccepted -*/ -type ReplaceLogTargetDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetDefaultsAccepted creates ReplaceLogTargetDefaultsAccepted with default headers values -func NewReplaceLogTargetDefaultsAccepted() *ReplaceLogTargetDefaultsAccepted { - - return &ReplaceLogTargetDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target defaults accepted response -func (o *ReplaceLogTargetDefaultsAccepted) WithReloadID(reloadID string) *ReplaceLogTargetDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target defaults accepted response -func (o *ReplaceLogTargetDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target defaults accepted response -func (o *ReplaceLogTargetDefaultsAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target defaults accepted response -func (o *ReplaceLogTargetDefaultsAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetDefaultsBadRequestCode is the HTTP code returned for type ReplaceLogTargetDefaultsBadRequest -const ReplaceLogTargetDefaultsBadRequestCode int = 400 - -/* -ReplaceLogTargetDefaultsBadRequest Bad request - -swagger:response replaceLogTargetDefaultsBadRequest -*/ -type ReplaceLogTargetDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetDefaultsBadRequest creates ReplaceLogTargetDefaultsBadRequest with default headers values -func NewReplaceLogTargetDefaultsBadRequest() *ReplaceLogTargetDefaultsBadRequest { - - return &ReplaceLogTargetDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target defaults bad request response -func (o *ReplaceLogTargetDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target defaults bad request response -func (o *ReplaceLogTargetDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target defaults bad request response -func (o *ReplaceLogTargetDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target defaults bad request response -func (o *ReplaceLogTargetDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetDefaultsNotFoundCode is the HTTP code returned for type ReplaceLogTargetDefaultsNotFound -const ReplaceLogTargetDefaultsNotFoundCode int = 404 - -/* -ReplaceLogTargetDefaultsNotFound The specified resource was not found - -swagger:response replaceLogTargetDefaultsNotFound -*/ -type ReplaceLogTargetDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetDefaultsNotFound creates ReplaceLogTargetDefaultsNotFound with default headers values -func NewReplaceLogTargetDefaultsNotFound() *ReplaceLogTargetDefaultsNotFound { - - return &ReplaceLogTargetDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target defaults not found response -func (o *ReplaceLogTargetDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target defaults not found response -func (o *ReplaceLogTargetDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target defaults not found response -func (o *ReplaceLogTargetDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target defaults not found response -func (o *ReplaceLogTargetDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetDefaultsDefault General Error - -swagger:response replaceLogTargetDefaultsDefault -*/ -type ReplaceLogTargetDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetDefaultsDefault creates ReplaceLogTargetDefaultsDefault with default headers values -func NewReplaceLogTargetDefaultsDefault(code int) *ReplaceLogTargetDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) WithStatusCode(code int) *ReplaceLogTargetDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) WithPayload(payload *models.Error) *ReplaceLogTargetDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target defaults default response -func (o *ReplaceLogTargetDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_defaults_urlbuilder.go b/operations/log_target/replace_log_target_defaults_urlbuilder.go deleted file mode 100644 index c5031d3a..00000000 --- a/operations/log_target/replace_log_target_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetDefaultsURL generates an URL for the replace log target defaults operation -type ReplaceLogTargetDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetDefaultsURL) WithBasePath(bp string) *ReplaceLogTargetDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceLogTargetDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_frontend.go b/operations/log_target/replace_log_target_frontend.go deleted file mode 100644 index c3c0bed4..00000000 --- a/operations/log_target/replace_log_target_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetFrontendHandlerFunc turns a function with the right signature into a replace log target frontend handler -type ReplaceLogTargetFrontendHandlerFunc func(ReplaceLogTargetFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetFrontendHandlerFunc) Handle(params ReplaceLogTargetFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetFrontendHandler interface for that can handle valid replace log target frontend params -type ReplaceLogTargetFrontendHandler interface { - Handle(ReplaceLogTargetFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetFrontend creates a new http.Handler for the replace log target frontend operation -func NewReplaceLogTargetFrontend(ctx *middleware.Context, handler ReplaceLogTargetFrontendHandler) *ReplaceLogTargetFrontend { - return &ReplaceLogTargetFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index} LogTarget replaceLogTargetFrontend - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetFrontend struct { - Context *middleware.Context - Handler ReplaceLogTargetFrontendHandler -} - -func (o *ReplaceLogTargetFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_frontend_parameters.go b/operations/log_target/replace_log_target_frontend_parameters.go deleted file mode 100644 index f67f2b9e..00000000 --- a/operations/log_target/replace_log_target_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetFrontendParams creates a new ReplaceLogTargetFrontendParams object -// with the default values initialized. -func NewReplaceLogTargetFrontendParams() ReplaceLogTargetFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetFrontendParams contains all the bound params for the replace log target frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetFrontend -type ReplaceLogTargetFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetFrontendParams() beforehand. -func (o *ReplaceLogTargetFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceLogTargetFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_frontend_responses.go b/operations/log_target/replace_log_target_frontend_responses.go deleted file mode 100644 index 18a784e8..00000000 --- a/operations/log_target/replace_log_target_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetFrontendOKCode is the HTTP code returned for type ReplaceLogTargetFrontendOK -const ReplaceLogTargetFrontendOKCode int = 200 - -/* -ReplaceLogTargetFrontendOK Log Target replaced - -swagger:response replaceLogTargetFrontendOK -*/ -type ReplaceLogTargetFrontendOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetFrontendOK creates ReplaceLogTargetFrontendOK with default headers values -func NewReplaceLogTargetFrontendOK() *ReplaceLogTargetFrontendOK { - - return &ReplaceLogTargetFrontendOK{} -} - -// WithPayload adds the payload to the replace log target frontend o k response -func (o *ReplaceLogTargetFrontendOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target frontend o k response -func (o *ReplaceLogTargetFrontendOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetFrontendAcceptedCode is the HTTP code returned for type ReplaceLogTargetFrontendAccepted -const ReplaceLogTargetFrontendAcceptedCode int = 202 - -/* -ReplaceLogTargetFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetFrontendAccepted -*/ -type ReplaceLogTargetFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetFrontendAccepted creates ReplaceLogTargetFrontendAccepted with default headers values -func NewReplaceLogTargetFrontendAccepted() *ReplaceLogTargetFrontendAccepted { - - return &ReplaceLogTargetFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target frontend accepted response -func (o *ReplaceLogTargetFrontendAccepted) WithReloadID(reloadID string) *ReplaceLogTargetFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target frontend accepted response -func (o *ReplaceLogTargetFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target frontend accepted response -func (o *ReplaceLogTargetFrontendAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target frontend accepted response -func (o *ReplaceLogTargetFrontendAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetFrontendBadRequestCode is the HTTP code returned for type ReplaceLogTargetFrontendBadRequest -const ReplaceLogTargetFrontendBadRequestCode int = 400 - -/* -ReplaceLogTargetFrontendBadRequest Bad request - -swagger:response replaceLogTargetFrontendBadRequest -*/ -type ReplaceLogTargetFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetFrontendBadRequest creates ReplaceLogTargetFrontendBadRequest with default headers values -func NewReplaceLogTargetFrontendBadRequest() *ReplaceLogTargetFrontendBadRequest { - - return &ReplaceLogTargetFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target frontend bad request response -func (o *ReplaceLogTargetFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target frontend bad request response -func (o *ReplaceLogTargetFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target frontend bad request response -func (o *ReplaceLogTargetFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target frontend bad request response -func (o *ReplaceLogTargetFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetFrontendNotFoundCode is the HTTP code returned for type ReplaceLogTargetFrontendNotFound -const ReplaceLogTargetFrontendNotFoundCode int = 404 - -/* -ReplaceLogTargetFrontendNotFound The specified resource was not found - -swagger:response replaceLogTargetFrontendNotFound -*/ -type ReplaceLogTargetFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetFrontendNotFound creates ReplaceLogTargetFrontendNotFound with default headers values -func NewReplaceLogTargetFrontendNotFound() *ReplaceLogTargetFrontendNotFound { - - return &ReplaceLogTargetFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target frontend not found response -func (o *ReplaceLogTargetFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target frontend not found response -func (o *ReplaceLogTargetFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target frontend not found response -func (o *ReplaceLogTargetFrontendNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target frontend not found response -func (o *ReplaceLogTargetFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetFrontendDefault General Error - -swagger:response replaceLogTargetFrontendDefault -*/ -type ReplaceLogTargetFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetFrontendDefault creates ReplaceLogTargetFrontendDefault with default headers values -func NewReplaceLogTargetFrontendDefault(code int) *ReplaceLogTargetFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) WithStatusCode(code int) *ReplaceLogTargetFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) WithPayload(payload *models.Error) *ReplaceLogTargetFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target frontend default response -func (o *ReplaceLogTargetFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_frontend_urlbuilder.go b/operations/log_target/replace_log_target_frontend_urlbuilder.go deleted file mode 100644 index 3b977b00..00000000 --- a/operations/log_target/replace_log_target_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetFrontendURL generates an URL for the replace log target frontend operation -type ReplaceLogTargetFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetFrontendURL) WithBasePath(bp string) *ReplaceLogTargetFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceLogTargetFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_global.go b/operations/log_target/replace_log_target_global.go deleted file mode 100644 index b7816b8c..00000000 --- a/operations/log_target/replace_log_target_global.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetGlobalHandlerFunc turns a function with the right signature into a replace log target global handler -type ReplaceLogTargetGlobalHandlerFunc func(ReplaceLogTargetGlobalParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetGlobalHandlerFunc) Handle(params ReplaceLogTargetGlobalParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetGlobalHandler interface for that can handle valid replace log target global params -type ReplaceLogTargetGlobalHandler interface { - Handle(ReplaceLogTargetGlobalParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetGlobal creates a new http.Handler for the replace log target global operation -func NewReplaceLogTargetGlobal(ctx *middleware.Context, handler ReplaceLogTargetGlobalHandler) *ReplaceLogTargetGlobal { - return &ReplaceLogTargetGlobal{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetGlobal swagger:route PUT /services/haproxy/configuration/global/log_targets/{index} LogTarget replaceLogTargetGlobal - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetGlobal struct { - Context *middleware.Context - Handler ReplaceLogTargetGlobalHandler -} - -func (o *ReplaceLogTargetGlobal) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetGlobalParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_global_parameters.go b/operations/log_target/replace_log_target_global_parameters.go deleted file mode 100644 index 70c7dcfe..00000000 --- a/operations/log_target/replace_log_target_global_parameters.go +++ /dev/null @@ -1,226 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetGlobalParams creates a new ReplaceLogTargetGlobalParams object -// with the default values initialized. -func NewReplaceLogTargetGlobalParams() ReplaceLogTargetGlobalParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetGlobalParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetGlobalParams contains all the bound params for the replace log target global operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetGlobal -type ReplaceLogTargetGlobalParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetGlobalParams() beforehand. -func (o *ReplaceLogTargetGlobalParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetGlobalParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetGlobalParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetGlobalParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetGlobalParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetGlobalParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_global_responses.go b/operations/log_target/replace_log_target_global_responses.go deleted file mode 100644 index a7d94906..00000000 --- a/operations/log_target/replace_log_target_global_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetGlobalOKCode is the HTTP code returned for type ReplaceLogTargetGlobalOK -const ReplaceLogTargetGlobalOKCode int = 200 - -/* -ReplaceLogTargetGlobalOK Log Target replaced - -swagger:response replaceLogTargetGlobalOK -*/ -type ReplaceLogTargetGlobalOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetGlobalOK creates ReplaceLogTargetGlobalOK with default headers values -func NewReplaceLogTargetGlobalOK() *ReplaceLogTargetGlobalOK { - - return &ReplaceLogTargetGlobalOK{} -} - -// WithPayload adds the payload to the replace log target global o k response -func (o *ReplaceLogTargetGlobalOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetGlobalOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target global o k response -func (o *ReplaceLogTargetGlobalOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetGlobalOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetGlobalAcceptedCode is the HTTP code returned for type ReplaceLogTargetGlobalAccepted -const ReplaceLogTargetGlobalAcceptedCode int = 202 - -/* -ReplaceLogTargetGlobalAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetGlobalAccepted -*/ -type ReplaceLogTargetGlobalAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetGlobalAccepted creates ReplaceLogTargetGlobalAccepted with default headers values -func NewReplaceLogTargetGlobalAccepted() *ReplaceLogTargetGlobalAccepted { - - return &ReplaceLogTargetGlobalAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target global accepted response -func (o *ReplaceLogTargetGlobalAccepted) WithReloadID(reloadID string) *ReplaceLogTargetGlobalAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target global accepted response -func (o *ReplaceLogTargetGlobalAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target global accepted response -func (o *ReplaceLogTargetGlobalAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetGlobalAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target global accepted response -func (o *ReplaceLogTargetGlobalAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetGlobalAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetGlobalBadRequestCode is the HTTP code returned for type ReplaceLogTargetGlobalBadRequest -const ReplaceLogTargetGlobalBadRequestCode int = 400 - -/* -ReplaceLogTargetGlobalBadRequest Bad request - -swagger:response replaceLogTargetGlobalBadRequest -*/ -type ReplaceLogTargetGlobalBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetGlobalBadRequest creates ReplaceLogTargetGlobalBadRequest with default headers values -func NewReplaceLogTargetGlobalBadRequest() *ReplaceLogTargetGlobalBadRequest { - - return &ReplaceLogTargetGlobalBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target global bad request response -func (o *ReplaceLogTargetGlobalBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetGlobalBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target global bad request response -func (o *ReplaceLogTargetGlobalBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target global bad request response -func (o *ReplaceLogTargetGlobalBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetGlobalBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target global bad request response -func (o *ReplaceLogTargetGlobalBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetGlobalBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetGlobalNotFoundCode is the HTTP code returned for type ReplaceLogTargetGlobalNotFound -const ReplaceLogTargetGlobalNotFoundCode int = 404 - -/* -ReplaceLogTargetGlobalNotFound The specified resource was not found - -swagger:response replaceLogTargetGlobalNotFound -*/ -type ReplaceLogTargetGlobalNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetGlobalNotFound creates ReplaceLogTargetGlobalNotFound with default headers values -func NewReplaceLogTargetGlobalNotFound() *ReplaceLogTargetGlobalNotFound { - - return &ReplaceLogTargetGlobalNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target global not found response -func (o *ReplaceLogTargetGlobalNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetGlobalNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target global not found response -func (o *ReplaceLogTargetGlobalNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target global not found response -func (o *ReplaceLogTargetGlobalNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetGlobalNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target global not found response -func (o *ReplaceLogTargetGlobalNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetGlobalNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetGlobalDefault General Error - -swagger:response replaceLogTargetGlobalDefault -*/ -type ReplaceLogTargetGlobalDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetGlobalDefault creates ReplaceLogTargetGlobalDefault with default headers values -func NewReplaceLogTargetGlobalDefault(code int) *ReplaceLogTargetGlobalDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetGlobalDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) WithStatusCode(code int) *ReplaceLogTargetGlobalDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetGlobalDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) WithPayload(payload *models.Error) *ReplaceLogTargetGlobalDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target global default response -func (o *ReplaceLogTargetGlobalDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetGlobalDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_global_urlbuilder.go b/operations/log_target/replace_log_target_global_urlbuilder.go deleted file mode 100644 index 4d94a870..00000000 --- a/operations/log_target/replace_log_target_global_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetGlobalURL generates an URL for the replace log target global operation -type ReplaceLogTargetGlobalURL struct { - Index int64 - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetGlobalURL) WithBasePath(bp string) *ReplaceLogTargetGlobalURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetGlobalURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetGlobalURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/global/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetGlobalURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetGlobalURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetGlobalURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetGlobalURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetGlobalURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetGlobalURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetGlobalURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_log_forward.go b/operations/log_target/replace_log_target_log_forward.go deleted file mode 100644 index e8276e28..00000000 --- a/operations/log_target/replace_log_target_log_forward.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetLogForwardHandlerFunc turns a function with the right signature into a replace log target log forward handler -type ReplaceLogTargetLogForwardHandlerFunc func(ReplaceLogTargetLogForwardParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetLogForwardHandlerFunc) Handle(params ReplaceLogTargetLogForwardParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetLogForwardHandler interface for that can handle valid replace log target log forward params -type ReplaceLogTargetLogForwardHandler interface { - Handle(ReplaceLogTargetLogForwardParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetLogForward creates a new http.Handler for the replace log target log forward operation -func NewReplaceLogTargetLogForward(ctx *middleware.Context, handler ReplaceLogTargetLogForwardHandler) *ReplaceLogTargetLogForward { - return &ReplaceLogTargetLogForward{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetLogForward swagger:route PUT /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index} LogTarget replaceLogTargetLogForward - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetLogForward struct { - Context *middleware.Context - Handler ReplaceLogTargetLogForwardHandler -} - -func (o *ReplaceLogTargetLogForward) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetLogForwardParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_log_forward_parameters.go b/operations/log_target/replace_log_target_log_forward_parameters.go deleted file mode 100644 index 6cf285b4..00000000 --- a/operations/log_target/replace_log_target_log_forward_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetLogForwardParams creates a new ReplaceLogTargetLogForwardParams object -// with the default values initialized. -func NewReplaceLogTargetLogForwardParams() ReplaceLogTargetLogForwardParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetLogForwardParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetLogForwardParams contains all the bound params for the replace log target log forward operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetLogForward -type ReplaceLogTargetLogForwardParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetLogForwardParams() beforehand. -func (o *ReplaceLogTargetLogForwardParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetLogForwardParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetLogForwardParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetLogForwardParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceLogTargetLogForwardParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetLogForwardParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetLogForwardParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_log_forward_responses.go b/operations/log_target/replace_log_target_log_forward_responses.go deleted file mode 100644 index 4c714d0a..00000000 --- a/operations/log_target/replace_log_target_log_forward_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetLogForwardOKCode is the HTTP code returned for type ReplaceLogTargetLogForwardOK -const ReplaceLogTargetLogForwardOKCode int = 200 - -/* -ReplaceLogTargetLogForwardOK Log Target replaced - -swagger:response replaceLogTargetLogForwardOK -*/ -type ReplaceLogTargetLogForwardOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetLogForwardOK creates ReplaceLogTargetLogForwardOK with default headers values -func NewReplaceLogTargetLogForwardOK() *ReplaceLogTargetLogForwardOK { - - return &ReplaceLogTargetLogForwardOK{} -} - -// WithPayload adds the payload to the replace log target log forward o k response -func (o *ReplaceLogTargetLogForwardOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetLogForwardOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target log forward o k response -func (o *ReplaceLogTargetLogForwardOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetLogForwardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetLogForwardAcceptedCode is the HTTP code returned for type ReplaceLogTargetLogForwardAccepted -const ReplaceLogTargetLogForwardAcceptedCode int = 202 - -/* -ReplaceLogTargetLogForwardAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetLogForwardAccepted -*/ -type ReplaceLogTargetLogForwardAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetLogForwardAccepted creates ReplaceLogTargetLogForwardAccepted with default headers values -func NewReplaceLogTargetLogForwardAccepted() *ReplaceLogTargetLogForwardAccepted { - - return &ReplaceLogTargetLogForwardAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target log forward accepted response -func (o *ReplaceLogTargetLogForwardAccepted) WithReloadID(reloadID string) *ReplaceLogTargetLogForwardAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target log forward accepted response -func (o *ReplaceLogTargetLogForwardAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target log forward accepted response -func (o *ReplaceLogTargetLogForwardAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetLogForwardAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target log forward accepted response -func (o *ReplaceLogTargetLogForwardAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetLogForwardBadRequestCode is the HTTP code returned for type ReplaceLogTargetLogForwardBadRequest -const ReplaceLogTargetLogForwardBadRequestCode int = 400 - -/* -ReplaceLogTargetLogForwardBadRequest Bad request - -swagger:response replaceLogTargetLogForwardBadRequest -*/ -type ReplaceLogTargetLogForwardBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetLogForwardBadRequest creates ReplaceLogTargetLogForwardBadRequest with default headers values -func NewReplaceLogTargetLogForwardBadRequest() *ReplaceLogTargetLogForwardBadRequest { - - return &ReplaceLogTargetLogForwardBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target log forward bad request response -func (o *ReplaceLogTargetLogForwardBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetLogForwardBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target log forward bad request response -func (o *ReplaceLogTargetLogForwardBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target log forward bad request response -func (o *ReplaceLogTargetLogForwardBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetLogForwardBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target log forward bad request response -func (o *ReplaceLogTargetLogForwardBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetLogForwardBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetLogForwardNotFoundCode is the HTTP code returned for type ReplaceLogTargetLogForwardNotFound -const ReplaceLogTargetLogForwardNotFoundCode int = 404 - -/* -ReplaceLogTargetLogForwardNotFound The specified resource was not found - -swagger:response replaceLogTargetLogForwardNotFound -*/ -type ReplaceLogTargetLogForwardNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetLogForwardNotFound creates ReplaceLogTargetLogForwardNotFound with default headers values -func NewReplaceLogTargetLogForwardNotFound() *ReplaceLogTargetLogForwardNotFound { - - return &ReplaceLogTargetLogForwardNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target log forward not found response -func (o *ReplaceLogTargetLogForwardNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetLogForwardNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target log forward not found response -func (o *ReplaceLogTargetLogForwardNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target log forward not found response -func (o *ReplaceLogTargetLogForwardNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetLogForwardNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target log forward not found response -func (o *ReplaceLogTargetLogForwardNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetLogForwardNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetLogForwardDefault General Error - -swagger:response replaceLogTargetLogForwardDefault -*/ -type ReplaceLogTargetLogForwardDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetLogForwardDefault creates ReplaceLogTargetLogForwardDefault with default headers values -func NewReplaceLogTargetLogForwardDefault(code int) *ReplaceLogTargetLogForwardDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetLogForwardDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) WithStatusCode(code int) *ReplaceLogTargetLogForwardDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetLogForwardDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) WithPayload(payload *models.Error) *ReplaceLogTargetLogForwardDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target log forward default response -func (o *ReplaceLogTargetLogForwardDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetLogForwardDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_log_forward_urlbuilder.go b/operations/log_target/replace_log_target_log_forward_urlbuilder.go deleted file mode 100644 index b10352f0..00000000 --- a/operations/log_target/replace_log_target_log_forward_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetLogForwardURL generates an URL for the replace log target log forward operation -type ReplaceLogTargetLogForwardURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetLogForwardURL) WithBasePath(bp string) *ReplaceLogTargetLogForwardURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetLogForwardURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetLogForwardURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetLogForwardURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceLogTargetLogForwardURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetLogForwardURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetLogForwardURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetLogForwardURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetLogForwardURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetLogForwardURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetLogForwardURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/log_target/replace_log_target_peer.go b/operations/log_target/replace_log_target_peer.go deleted file mode 100644 index 3c4d9287..00000000 --- a/operations/log_target/replace_log_target_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceLogTargetPeerHandlerFunc turns a function with the right signature into a replace log target peer handler -type ReplaceLogTargetPeerHandlerFunc func(ReplaceLogTargetPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceLogTargetPeerHandlerFunc) Handle(params ReplaceLogTargetPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceLogTargetPeerHandler interface for that can handle valid replace log target peer params -type ReplaceLogTargetPeerHandler interface { - Handle(ReplaceLogTargetPeerParams, interface{}) middleware.Responder -} - -// NewReplaceLogTargetPeer creates a new http.Handler for the replace log target peer operation -func NewReplaceLogTargetPeer(ctx *middleware.Context, handler ReplaceLogTargetPeerHandler) *ReplaceLogTargetPeer { - return &ReplaceLogTargetPeer{Context: ctx, Handler: handler} -} - -/* - ReplaceLogTargetPeer swagger:route PUT /services/haproxy/configuration/peers/{parent_name}/log_targets/{index} LogTarget replaceLogTargetPeer - -# Replace a Log Target - -Replaces a Log Target configuration by it's index in the specified parent. -*/ -type ReplaceLogTargetPeer struct { - Context *middleware.Context - Handler ReplaceLogTargetPeerHandler -} - -func (o *ReplaceLogTargetPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceLogTargetPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/log_target/replace_log_target_peer_parameters.go b/operations/log_target/replace_log_target_peer_parameters.go deleted file mode 100644 index 1814733a..00000000 --- a/operations/log_target/replace_log_target_peer_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceLogTargetPeerParams creates a new ReplaceLogTargetPeerParams object -// with the default values initialized. -func NewReplaceLogTargetPeerParams() ReplaceLogTargetPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceLogTargetPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceLogTargetPeerParams contains all the bound params for the replace log target peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceLogTargetPeer -type ReplaceLogTargetPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.LogTarget - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Log Target Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceLogTargetPeerParams() beforehand. -func (o *ReplaceLogTargetPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.LogTarget - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceLogTargetPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceLogTargetPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceLogTargetPeerParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceLogTargetPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceLogTargetPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceLogTargetPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/log_target/replace_log_target_peer_responses.go b/operations/log_target/replace_log_target_peer_responses.go deleted file mode 100644 index 2b2e2690..00000000 --- a/operations/log_target/replace_log_target_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceLogTargetPeerOKCode is the HTTP code returned for type ReplaceLogTargetPeerOK -const ReplaceLogTargetPeerOKCode int = 200 - -/* -ReplaceLogTargetPeerOK Log Target replaced - -swagger:response replaceLogTargetPeerOK -*/ -type ReplaceLogTargetPeerOK struct { - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetPeerOK creates ReplaceLogTargetPeerOK with default headers values -func NewReplaceLogTargetPeerOK() *ReplaceLogTargetPeerOK { - - return &ReplaceLogTargetPeerOK{} -} - -// WithPayload adds the payload to the replace log target peer o k response -func (o *ReplaceLogTargetPeerOK) WithPayload(payload *models.LogTarget) *ReplaceLogTargetPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target peer o k response -func (o *ReplaceLogTargetPeerOK) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetPeerAcceptedCode is the HTTP code returned for type ReplaceLogTargetPeerAccepted -const ReplaceLogTargetPeerAcceptedCode int = 202 - -/* -ReplaceLogTargetPeerAccepted Configuration change accepted and reload requested - -swagger:response replaceLogTargetPeerAccepted -*/ -type ReplaceLogTargetPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.LogTarget `json:"body,omitempty"` -} - -// NewReplaceLogTargetPeerAccepted creates ReplaceLogTargetPeerAccepted with default headers values -func NewReplaceLogTargetPeerAccepted() *ReplaceLogTargetPeerAccepted { - - return &ReplaceLogTargetPeerAccepted{} -} - -// WithReloadID adds the reloadId to the replace log target peer accepted response -func (o *ReplaceLogTargetPeerAccepted) WithReloadID(reloadID string) *ReplaceLogTargetPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace log target peer accepted response -func (o *ReplaceLogTargetPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace log target peer accepted response -func (o *ReplaceLogTargetPeerAccepted) WithPayload(payload *models.LogTarget) *ReplaceLogTargetPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target peer accepted response -func (o *ReplaceLogTargetPeerAccepted) SetPayload(payload *models.LogTarget) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetPeerBadRequestCode is the HTTP code returned for type ReplaceLogTargetPeerBadRequest -const ReplaceLogTargetPeerBadRequestCode int = 400 - -/* -ReplaceLogTargetPeerBadRequest Bad request - -swagger:response replaceLogTargetPeerBadRequest -*/ -type ReplaceLogTargetPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetPeerBadRequest creates ReplaceLogTargetPeerBadRequest with default headers values -func NewReplaceLogTargetPeerBadRequest() *ReplaceLogTargetPeerBadRequest { - - return &ReplaceLogTargetPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target peer bad request response -func (o *ReplaceLogTargetPeerBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target peer bad request response -func (o *ReplaceLogTargetPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target peer bad request response -func (o *ReplaceLogTargetPeerBadRequest) WithPayload(payload *models.Error) *ReplaceLogTargetPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target peer bad request response -func (o *ReplaceLogTargetPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceLogTargetPeerNotFoundCode is the HTTP code returned for type ReplaceLogTargetPeerNotFound -const ReplaceLogTargetPeerNotFoundCode int = 404 - -/* -ReplaceLogTargetPeerNotFound The specified resource was not found - -swagger:response replaceLogTargetPeerNotFound -*/ -type ReplaceLogTargetPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetPeerNotFound creates ReplaceLogTargetPeerNotFound with default headers values -func NewReplaceLogTargetPeerNotFound() *ReplaceLogTargetPeerNotFound { - - return &ReplaceLogTargetPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target peer not found response -func (o *ReplaceLogTargetPeerNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target peer not found response -func (o *ReplaceLogTargetPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target peer not found response -func (o *ReplaceLogTargetPeerNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target peer not found response -func (o *ReplaceLogTargetPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceLogTargetPeerDefault General Error - -swagger:response replaceLogTargetPeerDefault -*/ -type ReplaceLogTargetPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceLogTargetPeerDefault creates ReplaceLogTargetPeerDefault with default headers values -func NewReplaceLogTargetPeerDefault(code int) *ReplaceLogTargetPeerDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceLogTargetPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) WithStatusCode(code int) *ReplaceLogTargetPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) WithConfigurationVersion(configurationVersion string) *ReplaceLogTargetPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) WithPayload(payload *models.Error) *ReplaceLogTargetPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace log target peer default response -func (o *ReplaceLogTargetPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceLogTargetPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/log_target/replace_log_target_peer_urlbuilder.go b/operations/log_target/replace_log_target_peer_urlbuilder.go deleted file mode 100644 index 180950cb..00000000 --- a/operations/log_target/replace_log_target_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package log_target - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceLogTargetPeerURL generates an URL for the replace log target peer operation -type ReplaceLogTargetPeerURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetPeerURL) WithBasePath(bp string) *ReplaceLogTargetPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceLogTargetPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceLogTargetPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/log_targets/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceLogTargetPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceLogTargetPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceLogTargetPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceLogTargetPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceLogTargetPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceLogTargetPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceLogTargetPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceLogTargetPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailer_entry/create_mailer_entry.go b/operations/mailer_entry/create_mailer_entry.go deleted file mode 100644 index 615e693d..00000000 --- a/operations/mailer_entry/create_mailer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateMailerEntryHandlerFunc turns a function with the right signature into a create mailer entry handler -type CreateMailerEntryHandlerFunc func(CreateMailerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateMailerEntryHandlerFunc) Handle(params CreateMailerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateMailerEntryHandler interface for that can handle valid create mailer entry params -type CreateMailerEntryHandler interface { - Handle(CreateMailerEntryParams, interface{}) middleware.Responder -} - -// NewCreateMailerEntry creates a new http.Handler for the create mailer entry operation -func NewCreateMailerEntry(ctx *middleware.Context, handler CreateMailerEntryHandler) *CreateMailerEntry { - return &CreateMailerEntry{Context: ctx, Handler: handler} -} - -/* - CreateMailerEntry swagger:route POST /services/haproxy/configuration/mailer_entries MailerEntry createMailerEntry - -Add a new mailer_entry - -Adds a new mailer entry to the specified mailers section in the configuration file. -*/ -type CreateMailerEntry struct { - Context *middleware.Context - Handler CreateMailerEntryHandler -} - -func (o *CreateMailerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateMailerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailer_entry/create_mailer_entry_parameters.go b/operations/mailer_entry/create_mailer_entry_parameters.go deleted file mode 100644 index 677b9217..00000000 --- a/operations/mailer_entry/create_mailer_entry_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateMailerEntryParams creates a new CreateMailerEntryParams object -// with the default values initialized. -func NewCreateMailerEntryParams() CreateMailerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateMailerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateMailerEntryParams contains all the bound params for the create mailer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters createMailerEntry -type CreateMailerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.MailerEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent mailers section name - Required: true - In: query - */ - MailersSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateMailerEntryParams() beforehand. -func (o *CreateMailerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MailerEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qMailersSection, qhkMailersSection, _ := qs.GetOK("mailers_section") - if err := o.bindMailersSection(qMailersSection, qhkMailersSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateMailerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateMailerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindMailersSection binds and validates parameter MailersSection from query. -func (o *CreateMailerEntryParams) bindMailersSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("mailers_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("mailers_section", "query", raw); err != nil { - return err - } - o.MailersSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateMailerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateMailerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailer_entry/create_mailer_entry_responses.go b/operations/mailer_entry/create_mailer_entry_responses.go deleted file mode 100644 index a33d0bc5..00000000 --- a/operations/mailer_entry/create_mailer_entry_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateMailerEntryCreatedCode is the HTTP code returned for type CreateMailerEntryCreated -const CreateMailerEntryCreatedCode int = 201 - -/* -CreateMailerEntryCreated MailerEntry created - -swagger:response createMailerEntryCreated -*/ -type CreateMailerEntryCreated struct { - - /* - In: Body - */ - Payload *models.MailerEntry `json:"body,omitempty"` -} - -// NewCreateMailerEntryCreated creates CreateMailerEntryCreated with default headers values -func NewCreateMailerEntryCreated() *CreateMailerEntryCreated { - - return &CreateMailerEntryCreated{} -} - -// WithPayload adds the payload to the create mailer entry created response -func (o *CreateMailerEntryCreated) WithPayload(payload *models.MailerEntry) *CreateMailerEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailer entry created response -func (o *CreateMailerEntryCreated) SetPayload(payload *models.MailerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailerEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailerEntryAcceptedCode is the HTTP code returned for type CreateMailerEntryAccepted -const CreateMailerEntryAcceptedCode int = 202 - -/* -CreateMailerEntryAccepted Configuration change accepted and reload requested - -swagger:response createMailerEntryAccepted -*/ -type CreateMailerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.MailerEntry `json:"body,omitempty"` -} - -// NewCreateMailerEntryAccepted creates CreateMailerEntryAccepted with default headers values -func NewCreateMailerEntryAccepted() *CreateMailerEntryAccepted { - - return &CreateMailerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the create mailer entry accepted response -func (o *CreateMailerEntryAccepted) WithReloadID(reloadID string) *CreateMailerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create mailer entry accepted response -func (o *CreateMailerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create mailer entry accepted response -func (o *CreateMailerEntryAccepted) WithPayload(payload *models.MailerEntry) *CreateMailerEntryAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailer entry accepted response -func (o *CreateMailerEntryAccepted) SetPayload(payload *models.MailerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailerEntryBadRequestCode is the HTTP code returned for type CreateMailerEntryBadRequest -const CreateMailerEntryBadRequestCode int = 400 - -/* -CreateMailerEntryBadRequest Bad request - -swagger:response createMailerEntryBadRequest -*/ -type CreateMailerEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailerEntryBadRequest creates CreateMailerEntryBadRequest with default headers values -func NewCreateMailerEntryBadRequest() *CreateMailerEntryBadRequest { - - return &CreateMailerEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create mailer entry bad request response -func (o *CreateMailerEntryBadRequest) WithConfigurationVersion(configurationVersion string) *CreateMailerEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailer entry bad request response -func (o *CreateMailerEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailer entry bad request response -func (o *CreateMailerEntryBadRequest) WithPayload(payload *models.Error) *CreateMailerEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailer entry bad request response -func (o *CreateMailerEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailerEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailerEntryConflictCode is the HTTP code returned for type CreateMailerEntryConflict -const CreateMailerEntryConflictCode int = 409 - -/* -CreateMailerEntryConflict The specified resource already exists - -swagger:response createMailerEntryConflict -*/ -type CreateMailerEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailerEntryConflict creates CreateMailerEntryConflict with default headers values -func NewCreateMailerEntryConflict() *CreateMailerEntryConflict { - - return &CreateMailerEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create mailer entry conflict response -func (o *CreateMailerEntryConflict) WithConfigurationVersion(configurationVersion string) *CreateMailerEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailer entry conflict response -func (o *CreateMailerEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailer entry conflict response -func (o *CreateMailerEntryConflict) WithPayload(payload *models.Error) *CreateMailerEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailer entry conflict response -func (o *CreateMailerEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailerEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateMailerEntryDefault General Error - -swagger:response createMailerEntryDefault -*/ -type CreateMailerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailerEntryDefault creates CreateMailerEntryDefault with default headers values -func NewCreateMailerEntryDefault(code int) *CreateMailerEntryDefault { - if code <= 0 { - code = 500 - } - - return &CreateMailerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create mailer entry default response -func (o *CreateMailerEntryDefault) WithStatusCode(code int) *CreateMailerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create mailer entry default response -func (o *CreateMailerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create mailer entry default response -func (o *CreateMailerEntryDefault) WithConfigurationVersion(configurationVersion string) *CreateMailerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailer entry default response -func (o *CreateMailerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailer entry default response -func (o *CreateMailerEntryDefault) WithPayload(payload *models.Error) *CreateMailerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailer entry default response -func (o *CreateMailerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailer_entry/create_mailer_entry_urlbuilder.go b/operations/mailer_entry/create_mailer_entry_urlbuilder.go deleted file mode 100644 index 43de58e5..00000000 --- a/operations/mailer_entry/create_mailer_entry_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateMailerEntryURL generates an URL for the create mailer entry operation -type CreateMailerEntryURL struct { - ForceReload *bool - MailersSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateMailerEntryURL) WithBasePath(bp string) *CreateMailerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateMailerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateMailerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailer_entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - mailersSectionQ := o.MailersSection - if mailersSectionQ != "" { - qs.Set("mailers_section", mailersSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateMailerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateMailerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateMailerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateMailerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateMailerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateMailerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailer_entry/delete_mailer_entry.go b/operations/mailer_entry/delete_mailer_entry.go deleted file mode 100644 index cc140eae..00000000 --- a/operations/mailer_entry/delete_mailer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteMailerEntryHandlerFunc turns a function with the right signature into a delete mailer entry handler -type DeleteMailerEntryHandlerFunc func(DeleteMailerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteMailerEntryHandlerFunc) Handle(params DeleteMailerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteMailerEntryHandler interface for that can handle valid delete mailer entry params -type DeleteMailerEntryHandler interface { - Handle(DeleteMailerEntryParams, interface{}) middleware.Responder -} - -// NewDeleteMailerEntry creates a new http.Handler for the delete mailer entry operation -func NewDeleteMailerEntry(ctx *middleware.Context, handler DeleteMailerEntryHandler) *DeleteMailerEntry { - return &DeleteMailerEntry{Context: ctx, Handler: handler} -} - -/* - DeleteMailerEntry swagger:route DELETE /services/haproxy/configuration/mailer_entries/{name} MailerEntry deleteMailerEntry - -Delete a mailer_entry - -Deletes a mailer entry configuration by it's name in the specified mailers section. -*/ -type DeleteMailerEntry struct { - Context *middleware.Context - Handler DeleteMailerEntryHandler -} - -func (o *DeleteMailerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteMailerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailer_entry/delete_mailer_entry_parameters.go b/operations/mailer_entry/delete_mailer_entry_parameters.go deleted file mode 100644 index 4d159376..00000000 --- a/operations/mailer_entry/delete_mailer_entry_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteMailerEntryParams creates a new DeleteMailerEntryParams object -// with the default values initialized. -func NewDeleteMailerEntryParams() DeleteMailerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteMailerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteMailerEntryParams contains all the bound params for the delete mailer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteMailerEntry -type DeleteMailerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent mailers section name - Required: true - In: query - */ - MailersSection string - /*MailerEntry name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteMailerEntryParams() beforehand. -func (o *DeleteMailerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qMailersSection, qhkMailersSection, _ := qs.GetOK("mailers_section") - if err := o.bindMailersSection(qMailersSection, qhkMailersSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteMailerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteMailerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindMailersSection binds and validates parameter MailersSection from query. -func (o *DeleteMailerEntryParams) bindMailersSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("mailers_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("mailers_section", "query", raw); err != nil { - return err - } - o.MailersSection = raw - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteMailerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteMailerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteMailerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailer_entry/delete_mailer_entry_responses.go b/operations/mailer_entry/delete_mailer_entry_responses.go deleted file mode 100644 index a148a3aa..00000000 --- a/operations/mailer_entry/delete_mailer_entry_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteMailerEntryAcceptedCode is the HTTP code returned for type DeleteMailerEntryAccepted -const DeleteMailerEntryAcceptedCode int = 202 - -/* -DeleteMailerEntryAccepted Configuration change accepted and reload requested - -swagger:response deleteMailerEntryAccepted -*/ -type DeleteMailerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteMailerEntryAccepted creates DeleteMailerEntryAccepted with default headers values -func NewDeleteMailerEntryAccepted() *DeleteMailerEntryAccepted { - - return &DeleteMailerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the delete mailer entry accepted response -func (o *DeleteMailerEntryAccepted) WithReloadID(reloadID string) *DeleteMailerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete mailer entry accepted response -func (o *DeleteMailerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteMailerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteMailerEntryNoContentCode is the HTTP code returned for type DeleteMailerEntryNoContent -const DeleteMailerEntryNoContentCode int = 204 - -/* -DeleteMailerEntryNoContent MailerEntry deleted - -swagger:response deleteMailerEntryNoContent -*/ -type DeleteMailerEntryNoContent struct { -} - -// NewDeleteMailerEntryNoContent creates DeleteMailerEntryNoContent with default headers values -func NewDeleteMailerEntryNoContent() *DeleteMailerEntryNoContent { - - return &DeleteMailerEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeleteMailerEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteMailerEntryNotFoundCode is the HTTP code returned for type DeleteMailerEntryNotFound -const DeleteMailerEntryNotFoundCode int = 404 - -/* -DeleteMailerEntryNotFound The specified resource was not found - -swagger:response deleteMailerEntryNotFound -*/ -type DeleteMailerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteMailerEntryNotFound creates DeleteMailerEntryNotFound with default headers values -func NewDeleteMailerEntryNotFound() *DeleteMailerEntryNotFound { - - return &DeleteMailerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete mailer entry not found response -func (o *DeleteMailerEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeleteMailerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete mailer entry not found response -func (o *DeleteMailerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete mailer entry not found response -func (o *DeleteMailerEntryNotFound) WithPayload(payload *models.Error) *DeleteMailerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete mailer entry not found response -func (o *DeleteMailerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteMailerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteMailerEntryDefault General Error - -swagger:response deleteMailerEntryDefault -*/ -type DeleteMailerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteMailerEntryDefault creates DeleteMailerEntryDefault with default headers values -func NewDeleteMailerEntryDefault(code int) *DeleteMailerEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeleteMailerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) WithStatusCode(code int) *DeleteMailerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) WithConfigurationVersion(configurationVersion string) *DeleteMailerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) WithPayload(payload *models.Error) *DeleteMailerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete mailer entry default response -func (o *DeleteMailerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteMailerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailer_entry/delete_mailer_entry_urlbuilder.go b/operations/mailer_entry/delete_mailer_entry_urlbuilder.go deleted file mode 100644 index 27c8c66d..00000000 --- a/operations/mailer_entry/delete_mailer_entry_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteMailerEntryURL generates an URL for the delete mailer entry operation -type DeleteMailerEntryURL struct { - Name string - - ForceReload *bool - MailersSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteMailerEntryURL) WithBasePath(bp string) *DeleteMailerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteMailerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteMailerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteMailerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - mailersSectionQ := o.MailersSection - if mailersSectionQ != "" { - qs.Set("mailers_section", mailersSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteMailerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteMailerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteMailerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteMailerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteMailerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteMailerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailer_entry/get_mailer_entries.go b/operations/mailer_entry/get_mailer_entries.go deleted file mode 100644 index e540ba96..00000000 --- a/operations/mailer_entry/get_mailer_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetMailerEntriesHandlerFunc turns a function with the right signature into a get mailer entries handler -type GetMailerEntriesHandlerFunc func(GetMailerEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMailerEntriesHandlerFunc) Handle(params GetMailerEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetMailerEntriesHandler interface for that can handle valid get mailer entries params -type GetMailerEntriesHandler interface { - Handle(GetMailerEntriesParams, interface{}) middleware.Responder -} - -// NewGetMailerEntries creates a new http.Handler for the get mailer entries operation -func NewGetMailerEntries(ctx *middleware.Context, handler GetMailerEntriesHandler) *GetMailerEntries { - return &GetMailerEntries{Context: ctx, Handler: handler} -} - -/* - GetMailerEntries swagger:route GET /services/haproxy/configuration/mailer_entries MailerEntry getMailerEntries - -Return an array of mailer_entries - -Returns an array of all the mailer_entries configured in the specified mailers section. -*/ -type GetMailerEntries struct { - Context *middleware.Context - Handler GetMailerEntriesHandler -} - -func (o *GetMailerEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMailerEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailer_entry/get_mailer_entries_parameters.go b/operations/mailer_entry/get_mailer_entries_parameters.go deleted file mode 100644 index dc8105bb..00000000 --- a/operations/mailer_entry/get_mailer_entries_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetMailerEntriesParams creates a new GetMailerEntriesParams object -// -// There are no default values defined in the spec. -func NewGetMailerEntriesParams() GetMailerEntriesParams { - - return GetMailerEntriesParams{} -} - -// GetMailerEntriesParams contains all the bound params for the get mailer entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters getMailerEntries -type GetMailerEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent mailers section name - Required: true - In: query - */ - MailersSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMailerEntriesParams() beforehand. -func (o *GetMailerEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qMailersSection, qhkMailersSection, _ := qs.GetOK("mailers_section") - if err := o.bindMailersSection(qMailersSection, qhkMailersSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindMailersSection binds and validates parameter MailersSection from query. -func (o *GetMailerEntriesParams) bindMailersSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("mailers_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("mailers_section", "query", raw); err != nil { - return err - } - o.MailersSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetMailerEntriesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/mailer_entry/get_mailer_entries_responses.go b/operations/mailer_entry/get_mailer_entries_responses.go deleted file mode 100644 index 88ed2818..00000000 --- a/operations/mailer_entry/get_mailer_entries_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetMailerEntriesOKCode is the HTTP code returned for type GetMailerEntriesOK -const GetMailerEntriesOKCode int = 200 - -/* -GetMailerEntriesOK Successful operation - -swagger:response getMailerEntriesOK -*/ -type GetMailerEntriesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.MailerEntries `json:"body,omitempty"` -} - -// NewGetMailerEntriesOK creates GetMailerEntriesOK with default headers values -func NewGetMailerEntriesOK() *GetMailerEntriesOK { - - return &GetMailerEntriesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailer entries o k response -func (o *GetMailerEntriesOK) WithConfigurationVersion(configurationVersion string) *GetMailerEntriesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailer entries o k response -func (o *GetMailerEntriesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailer entries o k response -func (o *GetMailerEntriesOK) WithPayload(payload models.MailerEntries) *GetMailerEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailer entries o k response -func (o *GetMailerEntriesOK) SetPayload(payload models.MailerEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailerEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.MailerEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetMailerEntriesDefault General Error - -swagger:response getMailerEntriesDefault -*/ -type GetMailerEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailerEntriesDefault creates GetMailerEntriesDefault with default headers values -func NewGetMailerEntriesDefault(code int) *GetMailerEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetMailerEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get mailer entries default response -func (o *GetMailerEntriesDefault) WithStatusCode(code int) *GetMailerEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get mailer entries default response -func (o *GetMailerEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get mailer entries default response -func (o *GetMailerEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetMailerEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailer entries default response -func (o *GetMailerEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailer entries default response -func (o *GetMailerEntriesDefault) WithPayload(payload *models.Error) *GetMailerEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailer entries default response -func (o *GetMailerEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailerEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailer_entry/get_mailer_entries_urlbuilder.go b/operations/mailer_entry/get_mailer_entries_urlbuilder.go deleted file mode 100644 index 4cf696ce..00000000 --- a/operations/mailer_entry/get_mailer_entries_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetMailerEntriesURL generates an URL for the get mailer entries operation -type GetMailerEntriesURL struct { - MailersSection string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailerEntriesURL) WithBasePath(bp string) *GetMailerEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailerEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMailerEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailer_entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - mailersSectionQ := o.MailersSection - if mailersSectionQ != "" { - qs.Set("mailers_section", mailersSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMailerEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMailerEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMailerEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMailerEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMailerEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMailerEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailer_entry/get_mailer_entry.go b/operations/mailer_entry/get_mailer_entry.go deleted file mode 100644 index 5dd89522..00000000 --- a/operations/mailer_entry/get_mailer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetMailerEntryHandlerFunc turns a function with the right signature into a get mailer entry handler -type GetMailerEntryHandlerFunc func(GetMailerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMailerEntryHandlerFunc) Handle(params GetMailerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetMailerEntryHandler interface for that can handle valid get mailer entry params -type GetMailerEntryHandler interface { - Handle(GetMailerEntryParams, interface{}) middleware.Responder -} - -// NewGetMailerEntry creates a new http.Handler for the get mailer entry operation -func NewGetMailerEntry(ctx *middleware.Context, handler GetMailerEntryHandler) *GetMailerEntry { - return &GetMailerEntry{Context: ctx, Handler: handler} -} - -/* - GetMailerEntry swagger:route GET /services/haproxy/configuration/mailer_entries/{name} MailerEntry getMailerEntry - -Return one mailer_entry - -Returns one mailer_entry configuration by it's name in the specified mailers section. -*/ -type GetMailerEntry struct { - Context *middleware.Context - Handler GetMailerEntryHandler -} - -func (o *GetMailerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMailerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailer_entry/get_mailer_entry_parameters.go b/operations/mailer_entry/get_mailer_entry_parameters.go deleted file mode 100644 index a7d60ca3..00000000 --- a/operations/mailer_entry/get_mailer_entry_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetMailerEntryParams creates a new GetMailerEntryParams object -// -// There are no default values defined in the spec. -func NewGetMailerEntryParams() GetMailerEntryParams { - - return GetMailerEntryParams{} -} - -// GetMailerEntryParams contains all the bound params for the get mailer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters getMailerEntry -type GetMailerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent mailers name - Required: true - In: query - */ - MailersSection string - /*MailerEntry name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMailerEntryParams() beforehand. -func (o *GetMailerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qMailersSection, qhkMailersSection, _ := qs.GetOK("mailers_section") - if err := o.bindMailersSection(qMailersSection, qhkMailersSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindMailersSection binds and validates parameter MailersSection from query. -func (o *GetMailerEntryParams) bindMailersSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("mailers_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("mailers_section", "query", raw); err != nil { - return err - } - o.MailersSection = raw - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetMailerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetMailerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/mailer_entry/get_mailer_entry_responses.go b/operations/mailer_entry/get_mailer_entry_responses.go deleted file mode 100644 index 393169c8..00000000 --- a/operations/mailer_entry/get_mailer_entry_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetMailerEntryOKCode is the HTTP code returned for type GetMailerEntryOK -const GetMailerEntryOKCode int = 200 - -/* -GetMailerEntryOK Successful operation - -swagger:response getMailerEntryOK -*/ -type GetMailerEntryOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.MailerEntry `json:"body,omitempty"` -} - -// NewGetMailerEntryOK creates GetMailerEntryOK with default headers values -func NewGetMailerEntryOK() *GetMailerEntryOK { - - return &GetMailerEntryOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailer entry o k response -func (o *GetMailerEntryOK) WithConfigurationVersion(configurationVersion string) *GetMailerEntryOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailer entry o k response -func (o *GetMailerEntryOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailer entry o k response -func (o *GetMailerEntryOK) WithPayload(payload *models.MailerEntry) *GetMailerEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailer entry o k response -func (o *GetMailerEntryOK) SetPayload(payload *models.MailerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailerEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetMailerEntryNotFoundCode is the HTTP code returned for type GetMailerEntryNotFound -const GetMailerEntryNotFoundCode int = 404 - -/* -GetMailerEntryNotFound The specified resource already exists - -swagger:response getMailerEntryNotFound -*/ -type GetMailerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailerEntryNotFound creates GetMailerEntryNotFound with default headers values -func NewGetMailerEntryNotFound() *GetMailerEntryNotFound { - - return &GetMailerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailer entry not found response -func (o *GetMailerEntryNotFound) WithConfigurationVersion(configurationVersion string) *GetMailerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailer entry not found response -func (o *GetMailerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailer entry not found response -func (o *GetMailerEntryNotFound) WithPayload(payload *models.Error) *GetMailerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailer entry not found response -func (o *GetMailerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetMailerEntryDefault General Error - -swagger:response getMailerEntryDefault -*/ -type GetMailerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailerEntryDefault creates GetMailerEntryDefault with default headers values -func NewGetMailerEntryDefault(code int) *GetMailerEntryDefault { - if code <= 0 { - code = 500 - } - - return &GetMailerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get mailer entry default response -func (o *GetMailerEntryDefault) WithStatusCode(code int) *GetMailerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get mailer entry default response -func (o *GetMailerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get mailer entry default response -func (o *GetMailerEntryDefault) WithConfigurationVersion(configurationVersion string) *GetMailerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailer entry default response -func (o *GetMailerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailer entry default response -func (o *GetMailerEntryDefault) WithPayload(payload *models.Error) *GetMailerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailer entry default response -func (o *GetMailerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailer_entry/get_mailer_entry_urlbuilder.go b/operations/mailer_entry/get_mailer_entry_urlbuilder.go deleted file mode 100644 index d19c9ca4..00000000 --- a/operations/mailer_entry/get_mailer_entry_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetMailerEntryURL generates an URL for the get mailer entry operation -type GetMailerEntryURL struct { - Name string - - MailersSection string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailerEntryURL) WithBasePath(bp string) *GetMailerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMailerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetMailerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - mailersSectionQ := o.MailersSection - if mailersSectionQ != "" { - qs.Set("mailers_section", mailersSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMailerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMailerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMailerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMailerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMailerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMailerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailer_entry/replace_mailer_entry.go b/operations/mailer_entry/replace_mailer_entry.go deleted file mode 100644 index f9adec72..00000000 --- a/operations/mailer_entry/replace_mailer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceMailerEntryHandlerFunc turns a function with the right signature into a replace mailer entry handler -type ReplaceMailerEntryHandlerFunc func(ReplaceMailerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceMailerEntryHandlerFunc) Handle(params ReplaceMailerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceMailerEntryHandler interface for that can handle valid replace mailer entry params -type ReplaceMailerEntryHandler interface { - Handle(ReplaceMailerEntryParams, interface{}) middleware.Responder -} - -// NewReplaceMailerEntry creates a new http.Handler for the replace mailer entry operation -func NewReplaceMailerEntry(ctx *middleware.Context, handler ReplaceMailerEntryHandler) *ReplaceMailerEntry { - return &ReplaceMailerEntry{Context: ctx, Handler: handler} -} - -/* - ReplaceMailerEntry swagger:route PUT /services/haproxy/configuration/mailer_entries/{name} MailerEntry replaceMailerEntry - -Replace a mailer_entry - -Replaces a mailer entry configuration by it's name in the specified mailers section. -*/ -type ReplaceMailerEntry struct { - Context *middleware.Context - Handler ReplaceMailerEntryHandler -} - -func (o *ReplaceMailerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceMailerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailer_entry/replace_mailer_entry_parameters.go b/operations/mailer_entry/replace_mailer_entry_parameters.go deleted file mode 100644 index eef48741..00000000 --- a/operations/mailer_entry/replace_mailer_entry_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceMailerEntryParams creates a new ReplaceMailerEntryParams object -// with the default values initialized. -func NewReplaceMailerEntryParams() ReplaceMailerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceMailerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceMailerEntryParams contains all the bound params for the replace mailer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceMailerEntry -type ReplaceMailerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.MailerEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent mailers section name - Required: true - In: query - */ - MailersSection string - /*MailerEntry name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceMailerEntryParams() beforehand. -func (o *ReplaceMailerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MailerEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qMailersSection, qhkMailersSection, _ := qs.GetOK("mailers_section") - if err := o.bindMailersSection(qMailersSection, qhkMailersSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceMailerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceMailerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindMailersSection binds and validates parameter MailersSection from query. -func (o *ReplaceMailerEntryParams) bindMailersSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("mailers_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("mailers_section", "query", raw); err != nil { - return err - } - o.MailersSection = raw - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceMailerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceMailerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceMailerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailer_entry/replace_mailer_entry_responses.go b/operations/mailer_entry/replace_mailer_entry_responses.go deleted file mode 100644 index 8b4092f5..00000000 --- a/operations/mailer_entry/replace_mailer_entry_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceMailerEntryOKCode is the HTTP code returned for type ReplaceMailerEntryOK -const ReplaceMailerEntryOKCode int = 200 - -/* -ReplaceMailerEntryOK MailerEntry replaced - -swagger:response replaceMailerEntryOK -*/ -type ReplaceMailerEntryOK struct { - - /* - In: Body - */ - Payload *models.MailerEntry `json:"body,omitempty"` -} - -// NewReplaceMailerEntryOK creates ReplaceMailerEntryOK with default headers values -func NewReplaceMailerEntryOK() *ReplaceMailerEntryOK { - - return &ReplaceMailerEntryOK{} -} - -// WithPayload adds the payload to the replace mailer entry o k response -func (o *ReplaceMailerEntryOK) WithPayload(payload *models.MailerEntry) *ReplaceMailerEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace mailer entry o k response -func (o *ReplaceMailerEntryOK) SetPayload(payload *models.MailerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceMailerEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceMailerEntryAcceptedCode is the HTTP code returned for type ReplaceMailerEntryAccepted -const ReplaceMailerEntryAcceptedCode int = 202 - -/* -ReplaceMailerEntryAccepted Configuration change accepted and reload requested - -swagger:response replaceMailerEntryAccepted -*/ -type ReplaceMailerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.MailerEntry `json:"body,omitempty"` -} - -// NewReplaceMailerEntryAccepted creates ReplaceMailerEntryAccepted with default headers values -func NewReplaceMailerEntryAccepted() *ReplaceMailerEntryAccepted { - - return &ReplaceMailerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the replace mailer entry accepted response -func (o *ReplaceMailerEntryAccepted) WithReloadID(reloadID string) *ReplaceMailerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace mailer entry accepted response -func (o *ReplaceMailerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace mailer entry accepted response -func (o *ReplaceMailerEntryAccepted) WithPayload(payload *models.MailerEntry) *ReplaceMailerEntryAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace mailer entry accepted response -func (o *ReplaceMailerEntryAccepted) SetPayload(payload *models.MailerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceMailerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceMailerEntryBadRequestCode is the HTTP code returned for type ReplaceMailerEntryBadRequest -const ReplaceMailerEntryBadRequestCode int = 400 - -/* -ReplaceMailerEntryBadRequest Bad request - -swagger:response replaceMailerEntryBadRequest -*/ -type ReplaceMailerEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceMailerEntryBadRequest creates ReplaceMailerEntryBadRequest with default headers values -func NewReplaceMailerEntryBadRequest() *ReplaceMailerEntryBadRequest { - - return &ReplaceMailerEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace mailer entry bad request response -func (o *ReplaceMailerEntryBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceMailerEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace mailer entry bad request response -func (o *ReplaceMailerEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace mailer entry bad request response -func (o *ReplaceMailerEntryBadRequest) WithPayload(payload *models.Error) *ReplaceMailerEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace mailer entry bad request response -func (o *ReplaceMailerEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceMailerEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceMailerEntryNotFoundCode is the HTTP code returned for type ReplaceMailerEntryNotFound -const ReplaceMailerEntryNotFoundCode int = 404 - -/* -ReplaceMailerEntryNotFound The specified resource was not found - -swagger:response replaceMailerEntryNotFound -*/ -type ReplaceMailerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceMailerEntryNotFound creates ReplaceMailerEntryNotFound with default headers values -func NewReplaceMailerEntryNotFound() *ReplaceMailerEntryNotFound { - - return &ReplaceMailerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace mailer entry not found response -func (o *ReplaceMailerEntryNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceMailerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace mailer entry not found response -func (o *ReplaceMailerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace mailer entry not found response -func (o *ReplaceMailerEntryNotFound) WithPayload(payload *models.Error) *ReplaceMailerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace mailer entry not found response -func (o *ReplaceMailerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceMailerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceMailerEntryDefault General Error - -swagger:response replaceMailerEntryDefault -*/ -type ReplaceMailerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceMailerEntryDefault creates ReplaceMailerEntryDefault with default headers values -func NewReplaceMailerEntryDefault(code int) *ReplaceMailerEntryDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceMailerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) WithStatusCode(code int) *ReplaceMailerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) WithConfigurationVersion(configurationVersion string) *ReplaceMailerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) WithPayload(payload *models.Error) *ReplaceMailerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace mailer entry default response -func (o *ReplaceMailerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceMailerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailer_entry/replace_mailer_entry_urlbuilder.go b/operations/mailer_entry/replace_mailer_entry_urlbuilder.go deleted file mode 100644 index 7619a4bf..00000000 --- a/operations/mailer_entry/replace_mailer_entry_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceMailerEntryURL generates an URL for the replace mailer entry operation -type ReplaceMailerEntryURL struct { - Name string - - ForceReload *bool - MailersSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceMailerEntryURL) WithBasePath(bp string) *ReplaceMailerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceMailerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceMailerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceMailerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - mailersSectionQ := o.MailersSection - if mailersSectionQ != "" { - qs.Set("mailers_section", mailersSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceMailerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceMailerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceMailerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceMailerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceMailerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceMailerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailers/create_mailers_section.go b/operations/mailers/create_mailers_section.go deleted file mode 100644 index 4b7e825a..00000000 --- a/operations/mailers/create_mailers_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateMailersSectionHandlerFunc turns a function with the right signature into a create mailers section handler -type CreateMailersSectionHandlerFunc func(CreateMailersSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateMailersSectionHandlerFunc) Handle(params CreateMailersSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateMailersSectionHandler interface for that can handle valid create mailers section params -type CreateMailersSectionHandler interface { - Handle(CreateMailersSectionParams, interface{}) middleware.Responder -} - -// NewCreateMailersSection creates a new http.Handler for the create mailers section operation -func NewCreateMailersSection(ctx *middleware.Context, handler CreateMailersSectionHandler) *CreateMailersSection { - return &CreateMailersSection{Context: ctx, Handler: handler} -} - -/* - CreateMailersSection swagger:route POST /services/haproxy/configuration/mailers_section Mailers createMailersSection - -# Add a new Mailers section - -Creates a new empty Mailers section -*/ -type CreateMailersSection struct { - Context *middleware.Context - Handler CreateMailersSectionHandler -} - -func (o *CreateMailersSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateMailersSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailers/create_mailers_section_parameters.go b/operations/mailers/create_mailers_section_parameters.go deleted file mode 100644 index f72584ec..00000000 --- a/operations/mailers/create_mailers_section_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateMailersSectionParams creates a new CreateMailersSectionParams object -// with the default values initialized. -func NewCreateMailersSectionParams() CreateMailersSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateMailersSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateMailersSectionParams contains all the bound params for the create mailers section operation -// typically these are obtained from a http.Request -// -// swagger:parameters createMailersSection -type CreateMailersSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.MailersSection - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateMailersSectionParams() beforehand. -func (o *CreateMailersSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MailersSection - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateMailersSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateMailersSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateMailersSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateMailersSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailers/create_mailers_section_responses.go b/operations/mailers/create_mailers_section_responses.go deleted file mode 100644 index 5721ff83..00000000 --- a/operations/mailers/create_mailers_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateMailersSectionCreatedCode is the HTTP code returned for type CreateMailersSectionCreated -const CreateMailersSectionCreatedCode int = 201 - -/* -CreateMailersSectionCreated Mailers created - -swagger:response createMailersSectionCreated -*/ -type CreateMailersSectionCreated struct { - - /* - In: Body - */ - Payload *models.MailersSection `json:"body,omitempty"` -} - -// NewCreateMailersSectionCreated creates CreateMailersSectionCreated with default headers values -func NewCreateMailersSectionCreated() *CreateMailersSectionCreated { - - return &CreateMailersSectionCreated{} -} - -// WithPayload adds the payload to the create mailers section created response -func (o *CreateMailersSectionCreated) WithPayload(payload *models.MailersSection) *CreateMailersSectionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailers section created response -func (o *CreateMailersSectionCreated) SetPayload(payload *models.MailersSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailersSectionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailersSectionAcceptedCode is the HTTP code returned for type CreateMailersSectionAccepted -const CreateMailersSectionAcceptedCode int = 202 - -/* -CreateMailersSectionAccepted Configuration change accepted and reload requested - -swagger:response createMailersSectionAccepted -*/ -type CreateMailersSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.MailersSection `json:"body,omitempty"` -} - -// NewCreateMailersSectionAccepted creates CreateMailersSectionAccepted with default headers values -func NewCreateMailersSectionAccepted() *CreateMailersSectionAccepted { - - return &CreateMailersSectionAccepted{} -} - -// WithReloadID adds the reloadId to the create mailers section accepted response -func (o *CreateMailersSectionAccepted) WithReloadID(reloadID string) *CreateMailersSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create mailers section accepted response -func (o *CreateMailersSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create mailers section accepted response -func (o *CreateMailersSectionAccepted) WithPayload(payload *models.MailersSection) *CreateMailersSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailers section accepted response -func (o *CreateMailersSectionAccepted) SetPayload(payload *models.MailersSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailersSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailersSectionBadRequestCode is the HTTP code returned for type CreateMailersSectionBadRequest -const CreateMailersSectionBadRequestCode int = 400 - -/* -CreateMailersSectionBadRequest Bad request - -swagger:response createMailersSectionBadRequest -*/ -type CreateMailersSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailersSectionBadRequest creates CreateMailersSectionBadRequest with default headers values -func NewCreateMailersSectionBadRequest() *CreateMailersSectionBadRequest { - - return &CreateMailersSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create mailers section bad request response -func (o *CreateMailersSectionBadRequest) WithConfigurationVersion(configurationVersion string) *CreateMailersSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailers section bad request response -func (o *CreateMailersSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailers section bad request response -func (o *CreateMailersSectionBadRequest) WithPayload(payload *models.Error) *CreateMailersSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailers section bad request response -func (o *CreateMailersSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailersSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateMailersSectionConflictCode is the HTTP code returned for type CreateMailersSectionConflict -const CreateMailersSectionConflictCode int = 409 - -/* -CreateMailersSectionConflict The specified resource already exists - -swagger:response createMailersSectionConflict -*/ -type CreateMailersSectionConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailersSectionConflict creates CreateMailersSectionConflict with default headers values -func NewCreateMailersSectionConflict() *CreateMailersSectionConflict { - - return &CreateMailersSectionConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create mailers section conflict response -func (o *CreateMailersSectionConflict) WithConfigurationVersion(configurationVersion string) *CreateMailersSectionConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailers section conflict response -func (o *CreateMailersSectionConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailers section conflict response -func (o *CreateMailersSectionConflict) WithPayload(payload *models.Error) *CreateMailersSectionConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailers section conflict response -func (o *CreateMailersSectionConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailersSectionConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateMailersSectionDefault General Error - -swagger:response createMailersSectionDefault -*/ -type CreateMailersSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateMailersSectionDefault creates CreateMailersSectionDefault with default headers values -func NewCreateMailersSectionDefault(code int) *CreateMailersSectionDefault { - if code <= 0 { - code = 500 - } - - return &CreateMailersSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create mailers section default response -func (o *CreateMailersSectionDefault) WithStatusCode(code int) *CreateMailersSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create mailers section default response -func (o *CreateMailersSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create mailers section default response -func (o *CreateMailersSectionDefault) WithConfigurationVersion(configurationVersion string) *CreateMailersSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create mailers section default response -func (o *CreateMailersSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create mailers section default response -func (o *CreateMailersSectionDefault) WithPayload(payload *models.Error) *CreateMailersSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create mailers section default response -func (o *CreateMailersSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateMailersSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailers/create_mailers_section_urlbuilder.go b/operations/mailers/create_mailers_section_urlbuilder.go deleted file mode 100644 index 99143bae..00000000 --- a/operations/mailers/create_mailers_section_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateMailersSectionURL generates an URL for the create mailers section operation -type CreateMailersSectionURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateMailersSectionURL) WithBasePath(bp string) *CreateMailersSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateMailersSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateMailersSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailers_section" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateMailersSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateMailersSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateMailersSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateMailersSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateMailersSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateMailersSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailers/delete_mailers_section.go b/operations/mailers/delete_mailers_section.go deleted file mode 100644 index 27751a0e..00000000 --- a/operations/mailers/delete_mailers_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteMailersSectionHandlerFunc turns a function with the right signature into a delete mailers section handler -type DeleteMailersSectionHandlerFunc func(DeleteMailersSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteMailersSectionHandlerFunc) Handle(params DeleteMailersSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteMailersSectionHandler interface for that can handle valid delete mailers section params -type DeleteMailersSectionHandler interface { - Handle(DeleteMailersSectionParams, interface{}) middleware.Responder -} - -// NewDeleteMailersSection creates a new http.Handler for the delete mailers section operation -func NewDeleteMailersSection(ctx *middleware.Context, handler DeleteMailersSectionHandler) *DeleteMailersSection { - return &DeleteMailersSection{Context: ctx, Handler: handler} -} - -/* - DeleteMailersSection swagger:route DELETE /services/haproxy/configuration/mailers_section/{name} Mailers deleteMailersSection - -# Delete a Mailers section - -Deletes a mailers from the configuration by it's name. -*/ -type DeleteMailersSection struct { - Context *middleware.Context - Handler DeleteMailersSectionHandler -} - -func (o *DeleteMailersSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteMailersSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailers/delete_mailers_section_parameters.go b/operations/mailers/delete_mailers_section_parameters.go deleted file mode 100644 index 3a74652d..00000000 --- a/operations/mailers/delete_mailers_section_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteMailersSectionParams creates a new DeleteMailersSectionParams object -// with the default values initialized. -func NewDeleteMailersSectionParams() DeleteMailersSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteMailersSectionParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteMailersSectionParams contains all the bound params for the delete mailers section operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteMailersSection -type DeleteMailersSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Mailers name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteMailersSectionParams() beforehand. -func (o *DeleteMailersSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteMailersSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteMailersSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteMailersSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteMailersSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailers/delete_mailers_section_responses.go b/operations/mailers/delete_mailers_section_responses.go deleted file mode 100644 index 36a8629a..00000000 --- a/operations/mailers/delete_mailers_section_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteMailersSectionAcceptedCode is the HTTP code returned for type DeleteMailersSectionAccepted -const DeleteMailersSectionAcceptedCode int = 202 - -/* -DeleteMailersSectionAccepted Configuration change accepted and reload requested - -swagger:response deleteMailersSectionAccepted -*/ -type DeleteMailersSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteMailersSectionAccepted creates DeleteMailersSectionAccepted with default headers values -func NewDeleteMailersSectionAccepted() *DeleteMailersSectionAccepted { - - return &DeleteMailersSectionAccepted{} -} - -// WithReloadID adds the reloadId to the delete mailers section accepted response -func (o *DeleteMailersSectionAccepted) WithReloadID(reloadID string) *DeleteMailersSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete mailers section accepted response -func (o *DeleteMailersSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteMailersSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteMailersSectionNoContentCode is the HTTP code returned for type DeleteMailersSectionNoContent -const DeleteMailersSectionNoContentCode int = 204 - -/* -DeleteMailersSectionNoContent Mailers deleted - -swagger:response deleteMailersSectionNoContent -*/ -type DeleteMailersSectionNoContent struct { -} - -// NewDeleteMailersSectionNoContent creates DeleteMailersSectionNoContent with default headers values -func NewDeleteMailersSectionNoContent() *DeleteMailersSectionNoContent { - - return &DeleteMailersSectionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteMailersSectionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteMailersSectionNotFoundCode is the HTTP code returned for type DeleteMailersSectionNotFound -const DeleteMailersSectionNotFoundCode int = 404 - -/* -DeleteMailersSectionNotFound The specified resource was not found - -swagger:response deleteMailersSectionNotFound -*/ -type DeleteMailersSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteMailersSectionNotFound creates DeleteMailersSectionNotFound with default headers values -func NewDeleteMailersSectionNotFound() *DeleteMailersSectionNotFound { - - return &DeleteMailersSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete mailers section not found response -func (o *DeleteMailersSectionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteMailersSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete mailers section not found response -func (o *DeleteMailersSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete mailers section not found response -func (o *DeleteMailersSectionNotFound) WithPayload(payload *models.Error) *DeleteMailersSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete mailers section not found response -func (o *DeleteMailersSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteMailersSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteMailersSectionDefault General Error - -swagger:response deleteMailersSectionDefault -*/ -type DeleteMailersSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteMailersSectionDefault creates DeleteMailersSectionDefault with default headers values -func NewDeleteMailersSectionDefault(code int) *DeleteMailersSectionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteMailersSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete mailers section default response -func (o *DeleteMailersSectionDefault) WithStatusCode(code int) *DeleteMailersSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete mailers section default response -func (o *DeleteMailersSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete mailers section default response -func (o *DeleteMailersSectionDefault) WithConfigurationVersion(configurationVersion string) *DeleteMailersSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete mailers section default response -func (o *DeleteMailersSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete mailers section default response -func (o *DeleteMailersSectionDefault) WithPayload(payload *models.Error) *DeleteMailersSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete mailers section default response -func (o *DeleteMailersSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteMailersSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailers/delete_mailers_section_urlbuilder.go b/operations/mailers/delete_mailers_section_urlbuilder.go deleted file mode 100644 index e76c1149..00000000 --- a/operations/mailers/delete_mailers_section_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteMailersSectionURL generates an URL for the delete mailers section operation -type DeleteMailersSectionURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteMailersSectionURL) WithBasePath(bp string) *DeleteMailersSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteMailersSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteMailersSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailers_section/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteMailersSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteMailersSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteMailersSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteMailersSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteMailersSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteMailersSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteMailersSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailers/edit_mailers_section.go b/operations/mailers/edit_mailers_section.go deleted file mode 100644 index fa5a54b7..00000000 --- a/operations/mailers/edit_mailers_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// EditMailersSectionHandlerFunc turns a function with the right signature into a edit mailers section handler -type EditMailersSectionHandlerFunc func(EditMailersSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditMailersSectionHandlerFunc) Handle(params EditMailersSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// EditMailersSectionHandler interface for that can handle valid edit mailers section params -type EditMailersSectionHandler interface { - Handle(EditMailersSectionParams, interface{}) middleware.Responder -} - -// NewEditMailersSection creates a new http.Handler for the edit mailers section operation -func NewEditMailersSection(ctx *middleware.Context, handler EditMailersSectionHandler) *EditMailersSection { - return &EditMailersSection{Context: ctx, Handler: handler} -} - -/* - EditMailersSection swagger:route PUT /services/haproxy/configuration/mailers_section/{name} Mailers editMailersSection - -# Modify a Mailers section - -Modifies a mailers configuration by it's name. -*/ -type EditMailersSection struct { - Context *middleware.Context - Handler EditMailersSectionHandler -} - -func (o *EditMailersSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditMailersSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailers/edit_mailers_section_parameters.go b/operations/mailers/edit_mailers_section_parameters.go deleted file mode 100644 index c03d0724..00000000 --- a/operations/mailers/edit_mailers_section_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewEditMailersSectionParams creates a new EditMailersSectionParams object -// with the default values initialized. -func NewEditMailersSectionParams() EditMailersSectionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return EditMailersSectionParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// EditMailersSectionParams contains all the bound params for the edit mailers section operation -// typically these are obtained from a http.Request -// -// swagger:parameters editMailersSection -type EditMailersSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.MailersSection - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Mailers name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewEditMailersSectionParams() beforehand. -func (o *EditMailersSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MailersSection - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *EditMailersSectionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewEditMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *EditMailersSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewEditMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *EditMailersSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *EditMailersSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *EditMailersSectionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/mailers/edit_mailers_section_responses.go b/operations/mailers/edit_mailers_section_responses.go deleted file mode 100644 index 15e15c5a..00000000 --- a/operations/mailers/edit_mailers_section_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// EditMailersSectionOKCode is the HTTP code returned for type EditMailersSectionOK -const EditMailersSectionOKCode int = 200 - -/* -EditMailersSectionOK Mailers configuration updated - -swagger:response editMailersSectionOK -*/ -type EditMailersSectionOK struct { - - /* - In: Body - */ - Payload *models.MailersSection `json:"body,omitempty"` -} - -// NewEditMailersSectionOK creates EditMailersSectionOK with default headers values -func NewEditMailersSectionOK() *EditMailersSectionOK { - - return &EditMailersSectionOK{} -} - -// WithPayload adds the payload to the edit mailers section o k response -func (o *EditMailersSectionOK) WithPayload(payload *models.MailersSection) *EditMailersSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit mailers section o k response -func (o *EditMailersSectionOK) SetPayload(payload *models.MailersSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditMailersSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditMailersSectionAcceptedCode is the HTTP code returned for type EditMailersSectionAccepted -const EditMailersSectionAcceptedCode int = 202 - -/* -EditMailersSectionAccepted Configuration change accepted and reload requested - -swagger:response editMailersSectionAccepted -*/ -type EditMailersSectionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.MailersSection `json:"body,omitempty"` -} - -// NewEditMailersSectionAccepted creates EditMailersSectionAccepted with default headers values -func NewEditMailersSectionAccepted() *EditMailersSectionAccepted { - - return &EditMailersSectionAccepted{} -} - -// WithReloadID adds the reloadId to the edit mailers section accepted response -func (o *EditMailersSectionAccepted) WithReloadID(reloadID string) *EditMailersSectionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the edit mailers section accepted response -func (o *EditMailersSectionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the edit mailers section accepted response -func (o *EditMailersSectionAccepted) WithPayload(payload *models.MailersSection) *EditMailersSectionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit mailers section accepted response -func (o *EditMailersSectionAccepted) SetPayload(payload *models.MailersSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditMailersSectionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditMailersSectionBadRequestCode is the HTTP code returned for type EditMailersSectionBadRequest -const EditMailersSectionBadRequestCode int = 400 - -/* -EditMailersSectionBadRequest Bad request - -swagger:response editMailersSectionBadRequest -*/ -type EditMailersSectionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditMailersSectionBadRequest creates EditMailersSectionBadRequest with default headers values -func NewEditMailersSectionBadRequest() *EditMailersSectionBadRequest { - - return &EditMailersSectionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit mailers section bad request response -func (o *EditMailersSectionBadRequest) WithConfigurationVersion(configurationVersion string) *EditMailersSectionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit mailers section bad request response -func (o *EditMailersSectionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit mailers section bad request response -func (o *EditMailersSectionBadRequest) WithPayload(payload *models.Error) *EditMailersSectionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit mailers section bad request response -func (o *EditMailersSectionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditMailersSectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// EditMailersSectionNotFoundCode is the HTTP code returned for type EditMailersSectionNotFound -const EditMailersSectionNotFoundCode int = 404 - -/* -EditMailersSectionNotFound The specified resource was not found - -swagger:response editMailersSectionNotFound -*/ -type EditMailersSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditMailersSectionNotFound creates EditMailersSectionNotFound with default headers values -func NewEditMailersSectionNotFound() *EditMailersSectionNotFound { - - return &EditMailersSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the edit mailers section not found response -func (o *EditMailersSectionNotFound) WithConfigurationVersion(configurationVersion string) *EditMailersSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit mailers section not found response -func (o *EditMailersSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit mailers section not found response -func (o *EditMailersSectionNotFound) WithPayload(payload *models.Error) *EditMailersSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit mailers section not found response -func (o *EditMailersSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditMailersSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -EditMailersSectionDefault General Error - -swagger:response editMailersSectionDefault -*/ -type EditMailersSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewEditMailersSectionDefault creates EditMailersSectionDefault with default headers values -func NewEditMailersSectionDefault(code int) *EditMailersSectionDefault { - if code <= 0 { - code = 500 - } - - return &EditMailersSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit mailers section default response -func (o *EditMailersSectionDefault) WithStatusCode(code int) *EditMailersSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit mailers section default response -func (o *EditMailersSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the edit mailers section default response -func (o *EditMailersSectionDefault) WithConfigurationVersion(configurationVersion string) *EditMailersSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the edit mailers section default response -func (o *EditMailersSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the edit mailers section default response -func (o *EditMailersSectionDefault) WithPayload(payload *models.Error) *EditMailersSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit mailers section default response -func (o *EditMailersSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditMailersSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailers/edit_mailers_section_urlbuilder.go b/operations/mailers/edit_mailers_section_urlbuilder.go deleted file mode 100644 index c643bff5..00000000 --- a/operations/mailers/edit_mailers_section_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// EditMailersSectionURL generates an URL for the edit mailers section operation -type EditMailersSectionURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditMailersSectionURL) WithBasePath(bp string) *EditMailersSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *EditMailersSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditMailersSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailers_section/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on EditMailersSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *EditMailersSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *EditMailersSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditMailersSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditMailersSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditMailersSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *EditMailersSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailers/get_mailers_section.go b/operations/mailers/get_mailers_section.go deleted file mode 100644 index 9c2b2d22..00000000 --- a/operations/mailers/get_mailers_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetMailersSectionHandlerFunc turns a function with the right signature into a get mailers section handler -type GetMailersSectionHandlerFunc func(GetMailersSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMailersSectionHandlerFunc) Handle(params GetMailersSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetMailersSectionHandler interface for that can handle valid get mailers section params -type GetMailersSectionHandler interface { - Handle(GetMailersSectionParams, interface{}) middleware.Responder -} - -// NewGetMailersSection creates a new http.Handler for the get mailers section operation -func NewGetMailersSection(ctx *middleware.Context, handler GetMailersSectionHandler) *GetMailersSection { - return &GetMailersSection{Context: ctx, Handler: handler} -} - -/* - GetMailersSection swagger:route GET /services/haproxy/configuration/mailers_section/{name} Mailers getMailersSection - -# Return a Mailers section - -Returns one mailers configuration by it's name. -*/ -type GetMailersSection struct { - Context *middleware.Context - Handler GetMailersSectionHandler -} - -func (o *GetMailersSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMailersSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailers/get_mailers_section_parameters.go b/operations/mailers/get_mailers_section_parameters.go deleted file mode 100644 index 5fccba80..00000000 --- a/operations/mailers/get_mailers_section_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetMailersSectionParams creates a new GetMailersSectionParams object -// with the default values initialized. -func NewGetMailersSectionParams() GetMailersSectionParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetMailersSectionParams{ - FullSection: &fullSectionDefault, - } -} - -// GetMailersSectionParams contains all the bound params for the get mailers section operation -// typically these are obtained from a http.Request -// -// swagger:parameters getMailersSection -type GetMailersSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Mailers name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMailersSectionParams() beforehand. -func (o *GetMailersSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetMailersSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetMailersSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetMailersSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetMailersSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/mailers/get_mailers_section_responses.go b/operations/mailers/get_mailers_section_responses.go deleted file mode 100644 index 2b00592b..00000000 --- a/operations/mailers/get_mailers_section_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetMailersSectionOKCode is the HTTP code returned for type GetMailersSectionOK -const GetMailersSectionOKCode int = 200 - -/* -GetMailersSectionOK Successful operation - -swagger:response getMailersSectionOK -*/ -type GetMailersSectionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.MailersSection `json:"body,omitempty"` -} - -// NewGetMailersSectionOK creates GetMailersSectionOK with default headers values -func NewGetMailersSectionOK() *GetMailersSectionOK { - - return &GetMailersSectionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailers section o k response -func (o *GetMailersSectionOK) WithConfigurationVersion(configurationVersion string) *GetMailersSectionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailers section o k response -func (o *GetMailersSectionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailers section o k response -func (o *GetMailersSectionOK) WithPayload(payload *models.MailersSection) *GetMailersSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailers section o k response -func (o *GetMailersSectionOK) SetPayload(payload *models.MailersSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailersSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetMailersSectionNotFoundCode is the HTTP code returned for type GetMailersSectionNotFound -const GetMailersSectionNotFoundCode int = 404 - -/* -GetMailersSectionNotFound The specified resource was not found - -swagger:response getMailersSectionNotFound -*/ -type GetMailersSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailersSectionNotFound creates GetMailersSectionNotFound with default headers values -func NewGetMailersSectionNotFound() *GetMailersSectionNotFound { - - return &GetMailersSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailers section not found response -func (o *GetMailersSectionNotFound) WithConfigurationVersion(configurationVersion string) *GetMailersSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailers section not found response -func (o *GetMailersSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailers section not found response -func (o *GetMailersSectionNotFound) WithPayload(payload *models.Error) *GetMailersSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailers section not found response -func (o *GetMailersSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailersSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetMailersSectionDefault General Error - -swagger:response getMailersSectionDefault -*/ -type GetMailersSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailersSectionDefault creates GetMailersSectionDefault with default headers values -func NewGetMailersSectionDefault(code int) *GetMailersSectionDefault { - if code <= 0 { - code = 500 - } - - return &GetMailersSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get mailers section default response -func (o *GetMailersSectionDefault) WithStatusCode(code int) *GetMailersSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get mailers section default response -func (o *GetMailersSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get mailers section default response -func (o *GetMailersSectionDefault) WithConfigurationVersion(configurationVersion string) *GetMailersSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailers section default response -func (o *GetMailersSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailers section default response -func (o *GetMailersSectionDefault) WithPayload(payload *models.Error) *GetMailersSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailers section default response -func (o *GetMailersSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailersSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailers/get_mailers_section_urlbuilder.go b/operations/mailers/get_mailers_section_urlbuilder.go deleted file mode 100644 index 6918f6d1..00000000 --- a/operations/mailers/get_mailers_section_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetMailersSectionURL generates an URL for the get mailers section operation -type GetMailersSectionURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailersSectionURL) WithBasePath(bp string) *GetMailersSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailersSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMailersSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailers_section/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetMailersSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMailersSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMailersSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMailersSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMailersSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMailersSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMailersSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/mailers/get_mailers_sections.go b/operations/mailers/get_mailers_sections.go deleted file mode 100644 index cad4a625..00000000 --- a/operations/mailers/get_mailers_sections.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetMailersSectionsHandlerFunc turns a function with the right signature into a get mailers sections handler -type GetMailersSectionsHandlerFunc func(GetMailersSectionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetMailersSectionsHandlerFunc) Handle(params GetMailersSectionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetMailersSectionsHandler interface for that can handle valid get mailers sections params -type GetMailersSectionsHandler interface { - Handle(GetMailersSectionsParams, interface{}) middleware.Responder -} - -// NewGetMailersSections creates a new http.Handler for the get mailers sections operation -func NewGetMailersSections(ctx *middleware.Context, handler GetMailersSectionsHandler) *GetMailersSections { - return &GetMailersSections{Context: ctx, Handler: handler} -} - -/* - GetMailersSections swagger:route GET /services/haproxy/configuration/mailers_section Mailers getMailersSections - -# Return an array of mailers sections - -Returns an array of all the configured mailers in HAProxy -*/ -type GetMailersSections struct { - Context *middleware.Context - Handler GetMailersSectionsHandler -} - -func (o *GetMailersSections) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetMailersSectionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/mailers/get_mailers_sections_parameters.go b/operations/mailers/get_mailers_sections_parameters.go deleted file mode 100644 index dfe5eda3..00000000 --- a/operations/mailers/get_mailers_sections_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetMailersSectionsParams creates a new GetMailersSectionsParams object -// with the default values initialized. -func NewGetMailersSectionsParams() GetMailersSectionsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetMailersSectionsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetMailersSectionsParams contains all the bound params for the get mailers sections operation -// typically these are obtained from a http.Request -// -// swagger:parameters getMailersSections -type GetMailersSectionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetMailersSectionsParams() beforehand. -func (o *GetMailersSectionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetMailersSectionsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetMailersSectionsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetMailersSectionsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/mailers/get_mailers_sections_responses.go b/operations/mailers/get_mailers_sections_responses.go deleted file mode 100644 index 4512ee1d..00000000 --- a/operations/mailers/get_mailers_sections_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetMailersSectionsOKCode is the HTTP code returned for type GetMailersSectionsOK -const GetMailersSectionsOKCode int = 200 - -/* -GetMailersSectionsOK Successful operation - -swagger:response getMailersSectionsOK -*/ -type GetMailersSectionsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.MailersSections `json:"body,omitempty"` -} - -// NewGetMailersSectionsOK creates GetMailersSectionsOK with default headers values -func NewGetMailersSectionsOK() *GetMailersSectionsOK { - - return &GetMailersSectionsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get mailers sections o k response -func (o *GetMailersSectionsOK) WithConfigurationVersion(configurationVersion string) *GetMailersSectionsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailers sections o k response -func (o *GetMailersSectionsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailers sections o k response -func (o *GetMailersSectionsOK) WithPayload(payload models.MailersSections) *GetMailersSectionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailers sections o k response -func (o *GetMailersSectionsOK) SetPayload(payload models.MailersSections) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailersSectionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.MailersSections{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetMailersSectionsDefault General Error - -swagger:response getMailersSectionsDefault -*/ -type GetMailersSectionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetMailersSectionsDefault creates GetMailersSectionsDefault with default headers values -func NewGetMailersSectionsDefault(code int) *GetMailersSectionsDefault { - if code <= 0 { - code = 500 - } - - return &GetMailersSectionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get mailers sections default response -func (o *GetMailersSectionsDefault) WithStatusCode(code int) *GetMailersSectionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get mailers sections default response -func (o *GetMailersSectionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get mailers sections default response -func (o *GetMailersSectionsDefault) WithConfigurationVersion(configurationVersion string) *GetMailersSectionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get mailers sections default response -func (o *GetMailersSectionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get mailers sections default response -func (o *GetMailersSectionsDefault) WithPayload(payload *models.Error) *GetMailersSectionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get mailers sections default response -func (o *GetMailersSectionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetMailersSectionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/mailers/get_mailers_sections_urlbuilder.go b/operations/mailers/get_mailers_sections_urlbuilder.go deleted file mode 100644 index c4ec692a..00000000 --- a/operations/mailers/get_mailers_sections_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package mailers - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetMailersSectionsURL generates an URL for the get mailers sections operation -type GetMailersSectionsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailersSectionsURL) WithBasePath(bp string) *GetMailersSectionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetMailersSectionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetMailersSectionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/mailers_section" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetMailersSectionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetMailersSectionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetMailersSectionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetMailersSectionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetMailersSectionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetMailersSectionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/add_map_entry.go b/operations/maps/add_map_entry.go deleted file mode 100644 index bada29fb..00000000 --- a/operations/maps/add_map_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddMapEntryHandlerFunc turns a function with the right signature into a add map entry handler -type AddMapEntryHandlerFunc func(AddMapEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddMapEntryHandlerFunc) Handle(params AddMapEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddMapEntryHandler interface for that can handle valid add map entry params -type AddMapEntryHandler interface { - Handle(AddMapEntryParams, interface{}) middleware.Responder -} - -// NewAddMapEntry creates a new http.Handler for the add map entry operation -func NewAddMapEntry(ctx *middleware.Context, handler AddMapEntryHandler) *AddMapEntry { - return &AddMapEntry{Context: ctx, Handler: handler} -} - -/* - AddMapEntry swagger:route POST /services/haproxy/runtime/maps/{parent_name}/entries Maps addMapEntry - -# Adds an entry into the map file - -Adds an entry into the map file. -*/ -type AddMapEntry struct { - Context *middleware.Context - Handler AddMapEntryHandler -} - -func (o *AddMapEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddMapEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/add_map_entry_parameters.go b/operations/maps/add_map_entry_parameters.go deleted file mode 100644 index 42fe282f..00000000 --- a/operations/maps/add_map_entry_parameters.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddMapEntryParams creates a new AddMapEntryParams object -// with the default values initialized. -func NewAddMapEntryParams() AddMapEntryParams { - - var ( - // initialize parameters with default values - - forceSyncDefault = bool(false) - ) - - return AddMapEntryParams{ - ForceSync: &forceSyncDefault, - } -} - -// AddMapEntryParams contains all the bound params for the add map entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters addMapEntry -type AddMapEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.MapEntry - /*If true, immediately syncs changes to disk - In: query - Default: false - */ - ForceSync *bool - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddMapEntryParams() beforehand. -func (o *AddMapEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MapEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceSync, qhkForceSync, _ := qs.GetOK("force_sync") - if err := o.bindForceSync(qForceSync, qhkForceSync, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceSync binds and validates parameter ForceSync from query. -func (o *AddMapEntryParams) bindForceSync(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewAddMapEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_sync", "query", "bool", raw) - } - o.ForceSync = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *AddMapEntryParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/maps/add_map_entry_responses.go b/operations/maps/add_map_entry_responses.go deleted file mode 100644 index bba69c70..00000000 --- a/operations/maps/add_map_entry_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddMapEntryCreatedCode is the HTTP code returned for type AddMapEntryCreated -const AddMapEntryCreatedCode int = 201 - -/* -AddMapEntryCreated Map entry created - -swagger:response addMapEntryCreated -*/ -type AddMapEntryCreated struct { - - /* - In: Body - */ - Payload *models.MapEntry `json:"body,omitempty"` -} - -// NewAddMapEntryCreated creates AddMapEntryCreated with default headers values -func NewAddMapEntryCreated() *AddMapEntryCreated { - - return &AddMapEntryCreated{} -} - -// WithPayload adds the payload to the add map entry created response -func (o *AddMapEntryCreated) WithPayload(payload *models.MapEntry) *AddMapEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add map entry created response -func (o *AddMapEntryCreated) SetPayload(payload *models.MapEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMapEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddMapEntryBadRequestCode is the HTTP code returned for type AddMapEntryBadRequest -const AddMapEntryBadRequestCode int = 400 - -/* -AddMapEntryBadRequest Bad request - -swagger:response addMapEntryBadRequest -*/ -type AddMapEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddMapEntryBadRequest creates AddMapEntryBadRequest with default headers values -func NewAddMapEntryBadRequest() *AddMapEntryBadRequest { - - return &AddMapEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add map entry bad request response -func (o *AddMapEntryBadRequest) WithConfigurationVersion(configurationVersion string) *AddMapEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add map entry bad request response -func (o *AddMapEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add map entry bad request response -func (o *AddMapEntryBadRequest) WithPayload(payload *models.Error) *AddMapEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add map entry bad request response -func (o *AddMapEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMapEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddMapEntryConflictCode is the HTTP code returned for type AddMapEntryConflict -const AddMapEntryConflictCode int = 409 - -/* -AddMapEntryConflict The specified resource already exists - -swagger:response addMapEntryConflict -*/ -type AddMapEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddMapEntryConflict creates AddMapEntryConflict with default headers values -func NewAddMapEntryConflict() *AddMapEntryConflict { - - return &AddMapEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the add map entry conflict response -func (o *AddMapEntryConflict) WithConfigurationVersion(configurationVersion string) *AddMapEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add map entry conflict response -func (o *AddMapEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add map entry conflict response -func (o *AddMapEntryConflict) WithPayload(payload *models.Error) *AddMapEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add map entry conflict response -func (o *AddMapEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMapEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddMapEntryDefault General Error - -swagger:response addMapEntryDefault -*/ -type AddMapEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddMapEntryDefault creates AddMapEntryDefault with default headers values -func NewAddMapEntryDefault(code int) *AddMapEntryDefault { - if code <= 0 { - code = 500 - } - - return &AddMapEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add map entry default response -func (o *AddMapEntryDefault) WithStatusCode(code int) *AddMapEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add map entry default response -func (o *AddMapEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add map entry default response -func (o *AddMapEntryDefault) WithConfigurationVersion(configurationVersion string) *AddMapEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add map entry default response -func (o *AddMapEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add map entry default response -func (o *AddMapEntryDefault) WithPayload(payload *models.Error) *AddMapEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add map entry default response -func (o *AddMapEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMapEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/add_map_entry_urlbuilder.go b/operations/maps/add_map_entry_urlbuilder.go deleted file mode 100644 index 0bcd4474..00000000 --- a/operations/maps/add_map_entry_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// AddMapEntryURL generates an URL for the add map entry operation -type AddMapEntryURL struct { - ParentName string - - ForceSync *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddMapEntryURL) WithBasePath(bp string) *AddMapEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddMapEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddMapEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on AddMapEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceSyncQ string - if o.ForceSync != nil { - forceSyncQ = swag.FormatBool(*o.ForceSync) - } - if forceSyncQ != "" { - qs.Set("force_sync", forceSyncQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddMapEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddMapEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddMapEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddMapEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddMapEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddMapEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/add_payload_runtime_map.go b/operations/maps/add_payload_runtime_map.go deleted file mode 100644 index 314bc7fb..00000000 --- a/operations/maps/add_payload_runtime_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddPayloadRuntimeMapHandlerFunc turns a function with the right signature into a add payload runtime map handler -type AddPayloadRuntimeMapHandlerFunc func(AddPayloadRuntimeMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddPayloadRuntimeMapHandlerFunc) Handle(params AddPayloadRuntimeMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddPayloadRuntimeMapHandler interface for that can handle valid add payload runtime map params -type AddPayloadRuntimeMapHandler interface { - Handle(AddPayloadRuntimeMapParams, interface{}) middleware.Responder -} - -// NewAddPayloadRuntimeMap creates a new http.Handler for the add payload runtime map operation -func NewAddPayloadRuntimeMap(ctx *middleware.Context, handler AddPayloadRuntimeMapHandler) *AddPayloadRuntimeMap { - return &AddPayloadRuntimeMap{Context: ctx, Handler: handler} -} - -/* - AddPayloadRuntimeMap swagger:route PUT /services/haproxy/runtime/maps/{name} Maps addPayloadRuntimeMap - -# Add a new map payload - -Adds a new map payload. -*/ -type AddPayloadRuntimeMap struct { - Context *middleware.Context - Handler AddPayloadRuntimeMapHandler -} - -func (o *AddPayloadRuntimeMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddPayloadRuntimeMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/add_payload_runtime_map_parameters.go b/operations/maps/add_payload_runtime_map_parameters.go deleted file mode 100644 index 3d7600f5..00000000 --- a/operations/maps/add_payload_runtime_map_parameters.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddPayloadRuntimeMapParams creates a new AddPayloadRuntimeMapParams object -// with the default values initialized. -func NewAddPayloadRuntimeMapParams() AddPayloadRuntimeMapParams { - - var ( - // initialize parameters with default values - - forceSyncDefault = bool(false) - ) - - return AddPayloadRuntimeMapParams{ - ForceSync: &forceSyncDefault, - } -} - -// AddPayloadRuntimeMapParams contains all the bound params for the add payload runtime map operation -// typically these are obtained from a http.Request -// -// swagger:parameters addPayloadRuntimeMap -type AddPayloadRuntimeMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.MapEntries - /*If true, immediately syncs changes to disk - In: query - Default: false - */ - ForceSync *bool - /*Map file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddPayloadRuntimeMapParams() beforehand. -func (o *AddPayloadRuntimeMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.MapEntries - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceSync, qhkForceSync, _ := qs.GetOK("force_sync") - if err := o.bindForceSync(qForceSync, qhkForceSync, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceSync binds and validates parameter ForceSync from query. -func (o *AddPayloadRuntimeMapParams) bindForceSync(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewAddPayloadRuntimeMapParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_sync", "query", "bool", raw) - } - o.ForceSync = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *AddPayloadRuntimeMapParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/maps/add_payload_runtime_map_responses.go b/operations/maps/add_payload_runtime_map_responses.go deleted file mode 100644 index 0c3bad5f..00000000 --- a/operations/maps/add_payload_runtime_map_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddPayloadRuntimeMapCreatedCode is the HTTP code returned for type AddPayloadRuntimeMapCreated -const AddPayloadRuntimeMapCreatedCode int = 201 - -/* -AddPayloadRuntimeMapCreated Map payload added - -swagger:response addPayloadRuntimeMapCreated -*/ -type AddPayloadRuntimeMapCreated struct { - - /* - In: Body - */ - Payload models.MapEntries `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeMapCreated creates AddPayloadRuntimeMapCreated with default headers values -func NewAddPayloadRuntimeMapCreated() *AddPayloadRuntimeMapCreated { - - return &AddPayloadRuntimeMapCreated{} -} - -// WithPayload adds the payload to the add payload runtime map created response -func (o *AddPayloadRuntimeMapCreated) WithPayload(payload models.MapEntries) *AddPayloadRuntimeMapCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime map created response -func (o *AddPayloadRuntimeMapCreated) SetPayload(payload models.MapEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeMapCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.MapEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// AddPayloadRuntimeMapBadRequestCode is the HTTP code returned for type AddPayloadRuntimeMapBadRequest -const AddPayloadRuntimeMapBadRequestCode int = 400 - -/* -AddPayloadRuntimeMapBadRequest Bad request - -swagger:response addPayloadRuntimeMapBadRequest -*/ -type AddPayloadRuntimeMapBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeMapBadRequest creates AddPayloadRuntimeMapBadRequest with default headers values -func NewAddPayloadRuntimeMapBadRequest() *AddPayloadRuntimeMapBadRequest { - - return &AddPayloadRuntimeMapBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add payload runtime map bad request response -func (o *AddPayloadRuntimeMapBadRequest) WithConfigurationVersion(configurationVersion string) *AddPayloadRuntimeMapBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add payload runtime map bad request response -func (o *AddPayloadRuntimeMapBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add payload runtime map bad request response -func (o *AddPayloadRuntimeMapBadRequest) WithPayload(payload *models.Error) *AddPayloadRuntimeMapBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime map bad request response -func (o *AddPayloadRuntimeMapBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeMapBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddPayloadRuntimeMapDefault General Error - -swagger:response addPayloadRuntimeMapDefault -*/ -type AddPayloadRuntimeMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddPayloadRuntimeMapDefault creates AddPayloadRuntimeMapDefault with default headers values -func NewAddPayloadRuntimeMapDefault(code int) *AddPayloadRuntimeMapDefault { - if code <= 0 { - code = 500 - } - - return &AddPayloadRuntimeMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) WithStatusCode(code int) *AddPayloadRuntimeMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) WithConfigurationVersion(configurationVersion string) *AddPayloadRuntimeMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) WithPayload(payload *models.Error) *AddPayloadRuntimeMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add payload runtime map default response -func (o *AddPayloadRuntimeMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPayloadRuntimeMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/add_payload_runtime_map_urlbuilder.go b/operations/maps/add_payload_runtime_map_urlbuilder.go deleted file mode 100644 index d06e8b56..00000000 --- a/operations/maps/add_payload_runtime_map_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// AddPayloadRuntimeMapURL generates an URL for the add payload runtime map operation -type AddPayloadRuntimeMapURL struct { - Name string - - ForceSync *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddPayloadRuntimeMapURL) WithBasePath(bp string) *AddPayloadRuntimeMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddPayloadRuntimeMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddPayloadRuntimeMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on AddPayloadRuntimeMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceSyncQ string - if o.ForceSync != nil { - forceSyncQ = swag.FormatBool(*o.ForceSync) - } - if forceSyncQ != "" { - qs.Set("force_sync", forceSyncQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddPayloadRuntimeMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddPayloadRuntimeMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddPayloadRuntimeMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddPayloadRuntimeMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddPayloadRuntimeMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddPayloadRuntimeMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/clear_runtime_map.go b/operations/maps/clear_runtime_map.go deleted file mode 100644 index f7a1dcab..00000000 --- a/operations/maps/clear_runtime_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ClearRuntimeMapHandlerFunc turns a function with the right signature into a clear runtime map handler -type ClearRuntimeMapHandlerFunc func(ClearRuntimeMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ClearRuntimeMapHandlerFunc) Handle(params ClearRuntimeMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ClearRuntimeMapHandler interface for that can handle valid clear runtime map params -type ClearRuntimeMapHandler interface { - Handle(ClearRuntimeMapParams, interface{}) middleware.Responder -} - -// NewClearRuntimeMap creates a new http.Handler for the clear runtime map operation -func NewClearRuntimeMap(ctx *middleware.Context, handler ClearRuntimeMapHandler) *ClearRuntimeMap { - return &ClearRuntimeMap{Context: ctx, Handler: handler} -} - -/* - ClearRuntimeMap swagger:route DELETE /services/haproxy/runtime/maps/{name} Maps clearRuntimeMap - -# Remove all map entries from the map file - -Remove all map entries from the map file. -*/ -type ClearRuntimeMap struct { - Context *middleware.Context - Handler ClearRuntimeMapHandler -} - -func (o *ClearRuntimeMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewClearRuntimeMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/clear_runtime_map_parameters.go b/operations/maps/clear_runtime_map_parameters.go deleted file mode 100644 index f7ff5e02..00000000 --- a/operations/maps/clear_runtime_map_parameters.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewClearRuntimeMapParams creates a new ClearRuntimeMapParams object -// with the default values initialized. -func NewClearRuntimeMapParams() ClearRuntimeMapParams { - - var ( - // initialize parameters with default values - - forceSyncDefault = bool(false) - ) - - return ClearRuntimeMapParams{ - ForceSync: &forceSyncDefault, - } -} - -// ClearRuntimeMapParams contains all the bound params for the clear runtime map operation -// typically these are obtained from a http.Request -// -// swagger:parameters clearRuntimeMap -type ClearRuntimeMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If true, deletes file from disk - In: query - */ - ForceDelete *bool - /*If true, immediately syncs changes to disk - In: query - Default: false - */ - ForceSync *bool - /*Map file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewClearRuntimeMapParams() beforehand. -func (o *ClearRuntimeMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceDelete, qhkForceDelete, _ := qs.GetOK("forceDelete") - if err := o.bindForceDelete(qForceDelete, qhkForceDelete, route.Formats); err != nil { - res = append(res, err) - } - - qForceSync, qhkForceSync, _ := qs.GetOK("force_sync") - if err := o.bindForceSync(qForceSync, qhkForceSync, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceDelete binds and validates parameter ForceDelete from query. -func (o *ClearRuntimeMapParams) bindForceDelete(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("forceDelete", "query", "bool", raw) - } - o.ForceDelete = &value - - return nil -} - -// bindForceSync binds and validates parameter ForceSync from query. -func (o *ClearRuntimeMapParams) bindForceSync(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewClearRuntimeMapParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_sync", "query", "bool", raw) - } - o.ForceSync = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ClearRuntimeMapParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/maps/clear_runtime_map_responses.go b/operations/maps/clear_runtime_map_responses.go deleted file mode 100644 index 2f571c5c..00000000 --- a/operations/maps/clear_runtime_map_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ClearRuntimeMapNoContentCode is the HTTP code returned for type ClearRuntimeMapNoContent -const ClearRuntimeMapNoContentCode int = 204 - -/* -ClearRuntimeMapNoContent All map entries deleted - -swagger:response clearRuntimeMapNoContent -*/ -type ClearRuntimeMapNoContent struct { -} - -// NewClearRuntimeMapNoContent creates ClearRuntimeMapNoContent with default headers values -func NewClearRuntimeMapNoContent() *ClearRuntimeMapNoContent { - - return &ClearRuntimeMapNoContent{} -} - -// WriteResponse to the client -func (o *ClearRuntimeMapNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// ClearRuntimeMapNotFoundCode is the HTTP code returned for type ClearRuntimeMapNotFound -const ClearRuntimeMapNotFoundCode int = 404 - -/* -ClearRuntimeMapNotFound The specified resource was not found - -swagger:response clearRuntimeMapNotFound -*/ -type ClearRuntimeMapNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewClearRuntimeMapNotFound creates ClearRuntimeMapNotFound with default headers values -func NewClearRuntimeMapNotFound() *ClearRuntimeMapNotFound { - - return &ClearRuntimeMapNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the clear runtime map not found response -func (o *ClearRuntimeMapNotFound) WithConfigurationVersion(configurationVersion string) *ClearRuntimeMapNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the clear runtime map not found response -func (o *ClearRuntimeMapNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the clear runtime map not found response -func (o *ClearRuntimeMapNotFound) WithPayload(payload *models.Error) *ClearRuntimeMapNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the clear runtime map not found response -func (o *ClearRuntimeMapNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ClearRuntimeMapNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ClearRuntimeMapDefault General Error - -swagger:response clearRuntimeMapDefault -*/ -type ClearRuntimeMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewClearRuntimeMapDefault creates ClearRuntimeMapDefault with default headers values -func NewClearRuntimeMapDefault(code int) *ClearRuntimeMapDefault { - if code <= 0 { - code = 500 - } - - return &ClearRuntimeMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the clear runtime map default response -func (o *ClearRuntimeMapDefault) WithStatusCode(code int) *ClearRuntimeMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the clear runtime map default response -func (o *ClearRuntimeMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the clear runtime map default response -func (o *ClearRuntimeMapDefault) WithConfigurationVersion(configurationVersion string) *ClearRuntimeMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the clear runtime map default response -func (o *ClearRuntimeMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the clear runtime map default response -func (o *ClearRuntimeMapDefault) WithPayload(payload *models.Error) *ClearRuntimeMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the clear runtime map default response -func (o *ClearRuntimeMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ClearRuntimeMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/clear_runtime_map_urlbuilder.go b/operations/maps/clear_runtime_map_urlbuilder.go deleted file mode 100644 index 91b4982d..00000000 --- a/operations/maps/clear_runtime_map_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ClearRuntimeMapURL generates an URL for the clear runtime map operation -type ClearRuntimeMapURL struct { - Name string - - ForceDelete *bool - ForceSync *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ClearRuntimeMapURL) WithBasePath(bp string) *ClearRuntimeMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ClearRuntimeMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ClearRuntimeMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ClearRuntimeMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceDeleteQ string - if o.ForceDelete != nil { - forceDeleteQ = swag.FormatBool(*o.ForceDelete) - } - if forceDeleteQ != "" { - qs.Set("forceDelete", forceDeleteQ) - } - - var forceSyncQ string - if o.ForceSync != nil { - forceSyncQ = swag.FormatBool(*o.ForceSync) - } - if forceSyncQ != "" { - qs.Set("force_sync", forceSyncQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ClearRuntimeMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ClearRuntimeMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ClearRuntimeMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ClearRuntimeMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ClearRuntimeMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ClearRuntimeMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/delete_runtime_map_entry.go b/operations/maps/delete_runtime_map_entry.go deleted file mode 100644 index 1575f312..00000000 --- a/operations/maps/delete_runtime_map_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteRuntimeMapEntryHandlerFunc turns a function with the right signature into a delete runtime map entry handler -type DeleteRuntimeMapEntryHandlerFunc func(DeleteRuntimeMapEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteRuntimeMapEntryHandlerFunc) Handle(params DeleteRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteRuntimeMapEntryHandler interface for that can handle valid delete runtime map entry params -type DeleteRuntimeMapEntryHandler interface { - Handle(DeleteRuntimeMapEntryParams, interface{}) middleware.Responder -} - -// NewDeleteRuntimeMapEntry creates a new http.Handler for the delete runtime map entry operation -func NewDeleteRuntimeMapEntry(ctx *middleware.Context, handler DeleteRuntimeMapEntryHandler) *DeleteRuntimeMapEntry { - return &DeleteRuntimeMapEntry{Context: ctx, Handler: handler} -} - -/* - DeleteRuntimeMapEntry swagger:route DELETE /services/haproxy/runtime/maps/{parent_name}/entries/{id} Maps deleteRuntimeMapEntry - -# Deletes all the map entries from the map by its id - -Delete all the map entries from the map by its id. -*/ -type DeleteRuntimeMapEntry struct { - Context *middleware.Context - Handler DeleteRuntimeMapEntryHandler -} - -func (o *DeleteRuntimeMapEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteRuntimeMapEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/delete_runtime_map_entry_parameters.go b/operations/maps/delete_runtime_map_entry_parameters.go deleted file mode 100644 index bc360d5d..00000000 --- a/operations/maps/delete_runtime_map_entry_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteRuntimeMapEntryParams creates a new DeleteRuntimeMapEntryParams object -// with the default values initialized. -func NewDeleteRuntimeMapEntryParams() DeleteRuntimeMapEntryParams { - - var ( - // initialize parameters with default values - - forceSyncDefault = bool(false) - ) - - return DeleteRuntimeMapEntryParams{ - ForceSync: &forceSyncDefault, - } -} - -// DeleteRuntimeMapEntryParams contains all the bound params for the delete runtime map entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteRuntimeMapEntry -type DeleteRuntimeMapEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If true, immediately syncs changes to disk - In: query - Default: false - */ - ForceSync *bool - /*Map id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteRuntimeMapEntryParams() beforehand. -func (o *DeleteRuntimeMapEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceSync, qhkForceSync, _ := qs.GetOK("force_sync") - if err := o.bindForceSync(qForceSync, qhkForceSync, route.Formats); err != nil { - res = append(res, err) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceSync binds and validates parameter ForceSync from query. -func (o *DeleteRuntimeMapEntryParams) bindForceSync(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteRuntimeMapEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_sync", "query", "bool", raw) - } - o.ForceSync = &value - - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteRuntimeMapEntryParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteRuntimeMapEntryParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/maps/delete_runtime_map_entry_responses.go b/operations/maps/delete_runtime_map_entry_responses.go deleted file mode 100644 index 7d891c69..00000000 --- a/operations/maps/delete_runtime_map_entry_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteRuntimeMapEntryNoContentCode is the HTTP code returned for type DeleteRuntimeMapEntryNoContent -const DeleteRuntimeMapEntryNoContentCode int = 204 - -/* -DeleteRuntimeMapEntryNoContent Map key/value deleted - -swagger:response deleteRuntimeMapEntryNoContent -*/ -type DeleteRuntimeMapEntryNoContent struct { -} - -// NewDeleteRuntimeMapEntryNoContent creates DeleteRuntimeMapEntryNoContent with default headers values -func NewDeleteRuntimeMapEntryNoContent() *DeleteRuntimeMapEntryNoContent { - - return &DeleteRuntimeMapEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeleteRuntimeMapEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteRuntimeMapEntryNotFoundCode is the HTTP code returned for type DeleteRuntimeMapEntryNotFound -const DeleteRuntimeMapEntryNotFoundCode int = 404 - -/* -DeleteRuntimeMapEntryNotFound The specified resource was not found - -swagger:response deleteRuntimeMapEntryNotFound -*/ -type DeleteRuntimeMapEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRuntimeMapEntryNotFound creates DeleteRuntimeMapEntryNotFound with default headers values -func NewDeleteRuntimeMapEntryNotFound() *DeleteRuntimeMapEntryNotFound { - - return &DeleteRuntimeMapEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete runtime map entry not found response -func (o *DeleteRuntimeMapEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeleteRuntimeMapEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete runtime map entry not found response -func (o *DeleteRuntimeMapEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete runtime map entry not found response -func (o *DeleteRuntimeMapEntryNotFound) WithPayload(payload *models.Error) *DeleteRuntimeMapEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete runtime map entry not found response -func (o *DeleteRuntimeMapEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRuntimeMapEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteRuntimeMapEntryDefault General Error - -swagger:response deleteRuntimeMapEntryDefault -*/ -type DeleteRuntimeMapEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRuntimeMapEntryDefault creates DeleteRuntimeMapEntryDefault with default headers values -func NewDeleteRuntimeMapEntryDefault(code int) *DeleteRuntimeMapEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeleteRuntimeMapEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) WithStatusCode(code int) *DeleteRuntimeMapEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) WithConfigurationVersion(configurationVersion string) *DeleteRuntimeMapEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) WithPayload(payload *models.Error) *DeleteRuntimeMapEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete runtime map entry default response -func (o *DeleteRuntimeMapEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRuntimeMapEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/delete_runtime_map_entry_urlbuilder.go b/operations/maps/delete_runtime_map_entry_urlbuilder.go deleted file mode 100644 index aeeea40e..00000000 --- a/operations/maps/delete_runtime_map_entry_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteRuntimeMapEntryURL generates an URL for the delete runtime map entry operation -type DeleteRuntimeMapEntryURL struct { - ID string - ParentName string - - ForceSync *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRuntimeMapEntryURL) WithBasePath(bp string) *DeleteRuntimeMapEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRuntimeMapEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteRuntimeMapEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{parent_name}/entries/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteRuntimeMapEntryURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteRuntimeMapEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceSyncQ string - if o.ForceSync != nil { - forceSyncQ = swag.FormatBool(*o.ForceSync) - } - if forceSyncQ != "" { - qs.Set("force_sync", forceSyncQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteRuntimeMapEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteRuntimeMapEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteRuntimeMapEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteRuntimeMapEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteRuntimeMapEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteRuntimeMapEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/get_all_runtime_map_files.go b/operations/maps/get_all_runtime_map_files.go deleted file mode 100644 index 49908536..00000000 --- a/operations/maps/get_all_runtime_map_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllRuntimeMapFilesHandlerFunc turns a function with the right signature into a get all runtime map files handler -type GetAllRuntimeMapFilesHandlerFunc func(GetAllRuntimeMapFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllRuntimeMapFilesHandlerFunc) Handle(params GetAllRuntimeMapFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllRuntimeMapFilesHandler interface for that can handle valid get all runtime map files params -type GetAllRuntimeMapFilesHandler interface { - Handle(GetAllRuntimeMapFilesParams, interface{}) middleware.Responder -} - -// NewGetAllRuntimeMapFiles creates a new http.Handler for the get all runtime map files operation -func NewGetAllRuntimeMapFiles(ctx *middleware.Context, handler GetAllRuntimeMapFilesHandler) *GetAllRuntimeMapFiles { - return &GetAllRuntimeMapFiles{Context: ctx, Handler: handler} -} - -/* - GetAllRuntimeMapFiles swagger:route GET /services/haproxy/runtime/maps Maps getAllRuntimeMapFiles - -# Return runtime map files - -Returns runtime map files. -*/ -type GetAllRuntimeMapFiles struct { - Context *middleware.Context - Handler GetAllRuntimeMapFilesHandler -} - -func (o *GetAllRuntimeMapFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllRuntimeMapFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/get_all_runtime_map_files_parameters.go b/operations/maps/get_all_runtime_map_files_parameters.go deleted file mode 100644 index ee72d0ce..00000000 --- a/operations/maps/get_all_runtime_map_files_parameters.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetAllRuntimeMapFilesParams creates a new GetAllRuntimeMapFilesParams object -// with the default values initialized. -func NewGetAllRuntimeMapFilesParams() GetAllRuntimeMapFilesParams { - - var ( - // initialize parameters with default values - - includeUnmanagedDefault = bool(false) - ) - - return GetAllRuntimeMapFilesParams{ - IncludeUnmanaged: &includeUnmanagedDefault, - } -} - -// GetAllRuntimeMapFilesParams contains all the bound params for the get all runtime map files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllRuntimeMapFiles -type GetAllRuntimeMapFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If true, also show unmanaged map files loaded in haproxy - In: query - Default: false - */ - IncludeUnmanaged *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllRuntimeMapFilesParams() beforehand. -func (o *GetAllRuntimeMapFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qIncludeUnmanaged, qhkIncludeUnmanaged, _ := qs.GetOK("include_unmanaged") - if err := o.bindIncludeUnmanaged(qIncludeUnmanaged, qhkIncludeUnmanaged, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIncludeUnmanaged binds and validates parameter IncludeUnmanaged from query. -func (o *GetAllRuntimeMapFilesParams) bindIncludeUnmanaged(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetAllRuntimeMapFilesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("include_unmanaged", "query", "bool", raw) - } - o.IncludeUnmanaged = &value - - return nil -} diff --git a/operations/maps/get_all_runtime_map_files_responses.go b/operations/maps/get_all_runtime_map_files_responses.go deleted file mode 100644 index c4a94ae2..00000000 --- a/operations/maps/get_all_runtime_map_files_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllRuntimeMapFilesOKCode is the HTTP code returned for type GetAllRuntimeMapFilesOK -const GetAllRuntimeMapFilesOKCode int = 200 - -/* -GetAllRuntimeMapFilesOK Successful operation - -swagger:response getAllRuntimeMapFilesOK -*/ -type GetAllRuntimeMapFilesOK struct { - - /* - In: Body - */ - Payload models.Maps `json:"body,omitempty"` -} - -// NewGetAllRuntimeMapFilesOK creates GetAllRuntimeMapFilesOK with default headers values -func NewGetAllRuntimeMapFilesOK() *GetAllRuntimeMapFilesOK { - - return &GetAllRuntimeMapFilesOK{} -} - -// WithPayload adds the payload to the get all runtime map files o k response -func (o *GetAllRuntimeMapFilesOK) WithPayload(payload models.Maps) *GetAllRuntimeMapFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all runtime map files o k response -func (o *GetAllRuntimeMapFilesOK) SetPayload(payload models.Maps) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllRuntimeMapFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Maps{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllRuntimeMapFilesNotFoundCode is the HTTP code returned for type GetAllRuntimeMapFilesNotFound -const GetAllRuntimeMapFilesNotFoundCode int = 404 - -/* -GetAllRuntimeMapFilesNotFound The specified resource was not found - -swagger:response getAllRuntimeMapFilesNotFound -*/ -type GetAllRuntimeMapFilesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllRuntimeMapFilesNotFound creates GetAllRuntimeMapFilesNotFound with default headers values -func NewGetAllRuntimeMapFilesNotFound() *GetAllRuntimeMapFilesNotFound { - - return &GetAllRuntimeMapFilesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all runtime map files not found response -func (o *GetAllRuntimeMapFilesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllRuntimeMapFilesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all runtime map files not found response -func (o *GetAllRuntimeMapFilesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all runtime map files not found response -func (o *GetAllRuntimeMapFilesNotFound) WithPayload(payload *models.Error) *GetAllRuntimeMapFilesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all runtime map files not found response -func (o *GetAllRuntimeMapFilesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllRuntimeMapFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllRuntimeMapFilesDefault General Error - -swagger:response getAllRuntimeMapFilesDefault -*/ -type GetAllRuntimeMapFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllRuntimeMapFilesDefault creates GetAllRuntimeMapFilesDefault with default headers values -func NewGetAllRuntimeMapFilesDefault(code int) *GetAllRuntimeMapFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllRuntimeMapFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) WithStatusCode(code int) *GetAllRuntimeMapFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllRuntimeMapFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) WithPayload(payload *models.Error) *GetAllRuntimeMapFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all runtime map files default response -func (o *GetAllRuntimeMapFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllRuntimeMapFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/get_all_runtime_map_files_urlbuilder.go b/operations/maps/get_all_runtime_map_files_urlbuilder.go deleted file mode 100644 index cb1ff251..00000000 --- a/operations/maps/get_all_runtime_map_files_urlbuilder.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetAllRuntimeMapFilesURL generates an URL for the get all runtime map files operation -type GetAllRuntimeMapFilesURL struct { - IncludeUnmanaged *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllRuntimeMapFilesURL) WithBasePath(bp string) *GetAllRuntimeMapFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllRuntimeMapFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllRuntimeMapFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var includeUnmanagedQ string - if o.IncludeUnmanaged != nil { - includeUnmanagedQ = swag.FormatBool(*o.IncludeUnmanaged) - } - if includeUnmanagedQ != "" { - qs.Set("include_unmanaged", includeUnmanagedQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllRuntimeMapFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllRuntimeMapFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllRuntimeMapFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllRuntimeMapFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllRuntimeMapFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllRuntimeMapFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/get_one_runtime_map.go b/operations/maps/get_one_runtime_map.go deleted file mode 100644 index 941e6fa0..00000000 --- a/operations/maps/get_one_runtime_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOneRuntimeMapHandlerFunc turns a function with the right signature into a get one runtime map handler -type GetOneRuntimeMapHandlerFunc func(GetOneRuntimeMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneRuntimeMapHandlerFunc) Handle(params GetOneRuntimeMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneRuntimeMapHandler interface for that can handle valid get one runtime map params -type GetOneRuntimeMapHandler interface { - Handle(GetOneRuntimeMapParams, interface{}) middleware.Responder -} - -// NewGetOneRuntimeMap creates a new http.Handler for the get one runtime map operation -func NewGetOneRuntimeMap(ctx *middleware.Context, handler GetOneRuntimeMapHandler) *GetOneRuntimeMap { - return &GetOneRuntimeMap{Context: ctx, Handler: handler} -} - -/* - GetOneRuntimeMap swagger:route GET /services/haproxy/runtime/maps/{name} Maps getOneRuntimeMap - -# Return one runtime map file - -Returns one runtime map file. -*/ -type GetOneRuntimeMap struct { - Context *middleware.Context - Handler GetOneRuntimeMapHandler -} - -func (o *GetOneRuntimeMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneRuntimeMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/get_one_runtime_map_parameters.go b/operations/maps/get_one_runtime_map_parameters.go deleted file mode 100644 index 3805121e..00000000 --- a/operations/maps/get_one_runtime_map_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneRuntimeMapParams creates a new GetOneRuntimeMapParams object -// -// There are no default values defined in the spec. -func NewGetOneRuntimeMapParams() GetOneRuntimeMapParams { - - return GetOneRuntimeMapParams{} -} - -// GetOneRuntimeMapParams contains all the bound params for the get one runtime map operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneRuntimeMap -type GetOneRuntimeMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Map file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneRuntimeMapParams() beforehand. -func (o *GetOneRuntimeMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneRuntimeMapParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/maps/get_one_runtime_map_responses.go b/operations/maps/get_one_runtime_map_responses.go deleted file mode 100644 index 6aff1597..00000000 --- a/operations/maps/get_one_runtime_map_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneRuntimeMapOKCode is the HTTP code returned for type GetOneRuntimeMapOK -const GetOneRuntimeMapOKCode int = 200 - -/* -GetOneRuntimeMapOK Successful operation - -swagger:response getOneRuntimeMapOK -*/ -type GetOneRuntimeMapOK struct { - - /* - In: Body - */ - Payload *models.Map `json:"body,omitempty"` -} - -// NewGetOneRuntimeMapOK creates GetOneRuntimeMapOK with default headers values -func NewGetOneRuntimeMapOK() *GetOneRuntimeMapOK { - - return &GetOneRuntimeMapOK{} -} - -// WithPayload adds the payload to the get one runtime map o k response -func (o *GetOneRuntimeMapOK) WithPayload(payload *models.Map) *GetOneRuntimeMapOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one runtime map o k response -func (o *GetOneRuntimeMapOK) SetPayload(payload *models.Map) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneRuntimeMapOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetOneRuntimeMapNotFoundCode is the HTTP code returned for type GetOneRuntimeMapNotFound -const GetOneRuntimeMapNotFoundCode int = 404 - -/* -GetOneRuntimeMapNotFound The specified resource was not found - -swagger:response getOneRuntimeMapNotFound -*/ -type GetOneRuntimeMapNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneRuntimeMapNotFound creates GetOneRuntimeMapNotFound with default headers values -func NewGetOneRuntimeMapNotFound() *GetOneRuntimeMapNotFound { - - return &GetOneRuntimeMapNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one runtime map not found response -func (o *GetOneRuntimeMapNotFound) WithConfigurationVersion(configurationVersion string) *GetOneRuntimeMapNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one runtime map not found response -func (o *GetOneRuntimeMapNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one runtime map not found response -func (o *GetOneRuntimeMapNotFound) WithPayload(payload *models.Error) *GetOneRuntimeMapNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one runtime map not found response -func (o *GetOneRuntimeMapNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneRuntimeMapNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneRuntimeMapDefault General Error - -swagger:response getOneRuntimeMapDefault -*/ -type GetOneRuntimeMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneRuntimeMapDefault creates GetOneRuntimeMapDefault with default headers values -func NewGetOneRuntimeMapDefault(code int) *GetOneRuntimeMapDefault { - if code <= 0 { - code = 500 - } - - return &GetOneRuntimeMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) WithStatusCode(code int) *GetOneRuntimeMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) WithConfigurationVersion(configurationVersion string) *GetOneRuntimeMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) WithPayload(payload *models.Error) *GetOneRuntimeMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one runtime map default response -func (o *GetOneRuntimeMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneRuntimeMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/get_one_runtime_map_urlbuilder.go b/operations/maps/get_one_runtime_map_urlbuilder.go deleted file mode 100644 index 74cc1b6a..00000000 --- a/operations/maps/get_one_runtime_map_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneRuntimeMapURL generates an URL for the get one runtime map operation -type GetOneRuntimeMapURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneRuntimeMapURL) WithBasePath(bp string) *GetOneRuntimeMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneRuntimeMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneRuntimeMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneRuntimeMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneRuntimeMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneRuntimeMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneRuntimeMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneRuntimeMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneRuntimeMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneRuntimeMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/get_runtime_map_entry.go b/operations/maps/get_runtime_map_entry.go deleted file mode 100644 index f985515c..00000000 --- a/operations/maps/get_runtime_map_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetRuntimeMapEntryHandlerFunc turns a function with the right signature into a get runtime map entry handler -type GetRuntimeMapEntryHandlerFunc func(GetRuntimeMapEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetRuntimeMapEntryHandlerFunc) Handle(params GetRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetRuntimeMapEntryHandler interface for that can handle valid get runtime map entry params -type GetRuntimeMapEntryHandler interface { - Handle(GetRuntimeMapEntryParams, interface{}) middleware.Responder -} - -// NewGetRuntimeMapEntry creates a new http.Handler for the get runtime map entry operation -func NewGetRuntimeMapEntry(ctx *middleware.Context, handler GetRuntimeMapEntryHandler) *GetRuntimeMapEntry { - return &GetRuntimeMapEntry{Context: ctx, Handler: handler} -} - -/* - GetRuntimeMapEntry swagger:route GET /services/haproxy/runtime/maps/{parent_name}/entries/{id} Maps getRuntimeMapEntry - -# Return one map runtime setting - -Returns one map runtime setting by it's id. -*/ -type GetRuntimeMapEntry struct { - Context *middleware.Context - Handler GetRuntimeMapEntryHandler -} - -func (o *GetRuntimeMapEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetRuntimeMapEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/get_runtime_map_entry_parameters.go b/operations/maps/get_runtime_map_entry_parameters.go deleted file mode 100644 index 99f67a04..00000000 --- a/operations/maps/get_runtime_map_entry_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetRuntimeMapEntryParams creates a new GetRuntimeMapEntryParams object -// -// There are no default values defined in the spec. -func NewGetRuntimeMapEntryParams() GetRuntimeMapEntryParams { - - return GetRuntimeMapEntryParams{} -} - -// GetRuntimeMapEntryParams contains all the bound params for the get runtime map entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters getRuntimeMapEntry -type GetRuntimeMapEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Map id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetRuntimeMapEntryParams() beforehand. -func (o *GetRuntimeMapEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetRuntimeMapEntryParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetRuntimeMapEntryParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/maps/get_runtime_map_entry_responses.go b/operations/maps/get_runtime_map_entry_responses.go deleted file mode 100644 index db5b1992..00000000 --- a/operations/maps/get_runtime_map_entry_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetRuntimeMapEntryOKCode is the HTTP code returned for type GetRuntimeMapEntryOK -const GetRuntimeMapEntryOKCode int = 200 - -/* -GetRuntimeMapEntryOK Successful operation - -swagger:response getRuntimeMapEntryOK -*/ -type GetRuntimeMapEntryOK struct { - - /* - In: Body - */ - Payload *models.MapEntry `json:"body,omitempty"` -} - -// NewGetRuntimeMapEntryOK creates GetRuntimeMapEntryOK with default headers values -func NewGetRuntimeMapEntryOK() *GetRuntimeMapEntryOK { - - return &GetRuntimeMapEntryOK{} -} - -// WithPayload adds the payload to the get runtime map entry o k response -func (o *GetRuntimeMapEntryOK) WithPayload(payload *models.MapEntry) *GetRuntimeMapEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime map entry o k response -func (o *GetRuntimeMapEntryOK) SetPayload(payload *models.MapEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeMapEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetRuntimeMapEntryNotFoundCode is the HTTP code returned for type GetRuntimeMapEntryNotFound -const GetRuntimeMapEntryNotFoundCode int = 404 - -/* -GetRuntimeMapEntryNotFound The specified resource was not found - -swagger:response getRuntimeMapEntryNotFound -*/ -type GetRuntimeMapEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRuntimeMapEntryNotFound creates GetRuntimeMapEntryNotFound with default headers values -func NewGetRuntimeMapEntryNotFound() *GetRuntimeMapEntryNotFound { - - return &GetRuntimeMapEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get runtime map entry not found response -func (o *GetRuntimeMapEntryNotFound) WithConfigurationVersion(configurationVersion string) *GetRuntimeMapEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get runtime map entry not found response -func (o *GetRuntimeMapEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get runtime map entry not found response -func (o *GetRuntimeMapEntryNotFound) WithPayload(payload *models.Error) *GetRuntimeMapEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime map entry not found response -func (o *GetRuntimeMapEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeMapEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetRuntimeMapEntryDefault General Error - -swagger:response getRuntimeMapEntryDefault -*/ -type GetRuntimeMapEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRuntimeMapEntryDefault creates GetRuntimeMapEntryDefault with default headers values -func NewGetRuntimeMapEntryDefault(code int) *GetRuntimeMapEntryDefault { - if code <= 0 { - code = 500 - } - - return &GetRuntimeMapEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) WithStatusCode(code int) *GetRuntimeMapEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) WithConfigurationVersion(configurationVersion string) *GetRuntimeMapEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) WithPayload(payload *models.Error) *GetRuntimeMapEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime map entry default response -func (o *GetRuntimeMapEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeMapEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/get_runtime_map_entry_urlbuilder.go b/operations/maps/get_runtime_map_entry_urlbuilder.go deleted file mode 100644 index 0fba709b..00000000 --- a/operations/maps/get_runtime_map_entry_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetRuntimeMapEntryURL generates an URL for the get runtime map entry operation -type GetRuntimeMapEntryURL struct { - ID string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeMapEntryURL) WithBasePath(bp string) *GetRuntimeMapEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeMapEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetRuntimeMapEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{parent_name}/entries/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetRuntimeMapEntryURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetRuntimeMapEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetRuntimeMapEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetRuntimeMapEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetRuntimeMapEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetRuntimeMapEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetRuntimeMapEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetRuntimeMapEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/replace_runtime_map_entry.go b/operations/maps/replace_runtime_map_entry.go deleted file mode 100644 index 9cfcca94..00000000 --- a/operations/maps/replace_runtime_map_entry.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ReplaceRuntimeMapEntryHandlerFunc turns a function with the right signature into a replace runtime map entry handler -type ReplaceRuntimeMapEntryHandlerFunc func(ReplaceRuntimeMapEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceRuntimeMapEntryHandlerFunc) Handle(params ReplaceRuntimeMapEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceRuntimeMapEntryHandler interface for that can handle valid replace runtime map entry params -type ReplaceRuntimeMapEntryHandler interface { - Handle(ReplaceRuntimeMapEntryParams, interface{}) middleware.Responder -} - -// NewReplaceRuntimeMapEntry creates a new http.Handler for the replace runtime map entry operation -func NewReplaceRuntimeMapEntry(ctx *middleware.Context, handler ReplaceRuntimeMapEntryHandler) *ReplaceRuntimeMapEntry { - return &ReplaceRuntimeMapEntry{Context: ctx, Handler: handler} -} - -/* - ReplaceRuntimeMapEntry swagger:route PUT /services/haproxy/runtime/maps/{parent_name}/entries/{id} Maps replaceRuntimeMapEntry - -# Replace the value corresponding to each id in a map - -Replaces the value corresponding to each id in a map. -*/ -type ReplaceRuntimeMapEntry struct { - Context *middleware.Context - Handler ReplaceRuntimeMapEntryHandler -} - -func (o *ReplaceRuntimeMapEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceRuntimeMapEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// ReplaceRuntimeMapEntryBody replace runtime map entry body -// -// swagger:model ReplaceRuntimeMapEntryBody -type ReplaceRuntimeMapEntryBody struct { - - // Map value - // Required: true - Value *string `json:"value"` -} - -// Validate validates this replace runtime map entry body -func (o *ReplaceRuntimeMapEntryBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateValue(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *ReplaceRuntimeMapEntryBody) validateValue(formats strfmt.Registry) error { - - if err := validate.Required("data"+"."+"value", "body", o.Value); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this replace runtime map entry body based on context it is used -func (o *ReplaceRuntimeMapEntryBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ReplaceRuntimeMapEntryBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ReplaceRuntimeMapEntryBody) UnmarshalBinary(b []byte) error { - var res ReplaceRuntimeMapEntryBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operations/maps/replace_runtime_map_entry_parameters.go b/operations/maps/replace_runtime_map_entry_parameters.go deleted file mode 100644 index 2c6d3eeb..00000000 --- a/operations/maps/replace_runtime_map_entry_parameters.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewReplaceRuntimeMapEntryParams creates a new ReplaceRuntimeMapEntryParams object -// with the default values initialized. -func NewReplaceRuntimeMapEntryParams() ReplaceRuntimeMapEntryParams { - - var ( - // initialize parameters with default values - - forceSyncDefault = bool(false) - ) - - return ReplaceRuntimeMapEntryParams{ - ForceSync: &forceSyncDefault, - } -} - -// ReplaceRuntimeMapEntryParams contains all the bound params for the replace runtime map entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceRuntimeMapEntry -type ReplaceRuntimeMapEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data ReplaceRuntimeMapEntryBody - /*If true, immediately syncs changes to disk - In: query - Default: false - */ - ForceSync *bool - /*Map id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceRuntimeMapEntryParams() beforehand. -func (o *ReplaceRuntimeMapEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body ReplaceRuntimeMapEntryBody - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceSync, qhkForceSync, _ := qs.GetOK("force_sync") - if err := o.bindForceSync(qForceSync, qhkForceSync, route.Formats); err != nil { - res = append(res, err) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceSync binds and validates parameter ForceSync from query. -func (o *ReplaceRuntimeMapEntryParams) bindForceSync(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceRuntimeMapEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_sync", "query", "bool", raw) - } - o.ForceSync = &value - - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *ReplaceRuntimeMapEntryParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceRuntimeMapEntryParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/maps/replace_runtime_map_entry_responses.go b/operations/maps/replace_runtime_map_entry_responses.go deleted file mode 100644 index 9856c8f3..00000000 --- a/operations/maps/replace_runtime_map_entry_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceRuntimeMapEntryOKCode is the HTTP code returned for type ReplaceRuntimeMapEntryOK -const ReplaceRuntimeMapEntryOKCode int = 200 - -/* -ReplaceRuntimeMapEntryOK Map value replaced - -swagger:response replaceRuntimeMapEntryOK -*/ -type ReplaceRuntimeMapEntryOK struct { - - /* - In: Body - */ - Payload *models.MapEntry `json:"body,omitempty"` -} - -// NewReplaceRuntimeMapEntryOK creates ReplaceRuntimeMapEntryOK with default headers values -func NewReplaceRuntimeMapEntryOK() *ReplaceRuntimeMapEntryOK { - - return &ReplaceRuntimeMapEntryOK{} -} - -// WithPayload adds the payload to the replace runtime map entry o k response -func (o *ReplaceRuntimeMapEntryOK) WithPayload(payload *models.MapEntry) *ReplaceRuntimeMapEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime map entry o k response -func (o *ReplaceRuntimeMapEntryOK) SetPayload(payload *models.MapEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeMapEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRuntimeMapEntryBadRequestCode is the HTTP code returned for type ReplaceRuntimeMapEntryBadRequest -const ReplaceRuntimeMapEntryBadRequestCode int = 400 - -/* -ReplaceRuntimeMapEntryBadRequest Bad request - -swagger:response replaceRuntimeMapEntryBadRequest -*/ -type ReplaceRuntimeMapEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeMapEntryBadRequest creates ReplaceRuntimeMapEntryBadRequest with default headers values -func NewReplaceRuntimeMapEntryBadRequest() *ReplaceRuntimeMapEntryBadRequest { - - return &ReplaceRuntimeMapEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime map entry bad request response -func (o *ReplaceRuntimeMapEntryBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeMapEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime map entry bad request response -func (o *ReplaceRuntimeMapEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime map entry bad request response -func (o *ReplaceRuntimeMapEntryBadRequest) WithPayload(payload *models.Error) *ReplaceRuntimeMapEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime map entry bad request response -func (o *ReplaceRuntimeMapEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeMapEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRuntimeMapEntryNotFoundCode is the HTTP code returned for type ReplaceRuntimeMapEntryNotFound -const ReplaceRuntimeMapEntryNotFoundCode int = 404 - -/* -ReplaceRuntimeMapEntryNotFound The specified resource was not found - -swagger:response replaceRuntimeMapEntryNotFound -*/ -type ReplaceRuntimeMapEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeMapEntryNotFound creates ReplaceRuntimeMapEntryNotFound with default headers values -func NewReplaceRuntimeMapEntryNotFound() *ReplaceRuntimeMapEntryNotFound { - - return &ReplaceRuntimeMapEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime map entry not found response -func (o *ReplaceRuntimeMapEntryNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeMapEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime map entry not found response -func (o *ReplaceRuntimeMapEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime map entry not found response -func (o *ReplaceRuntimeMapEntryNotFound) WithPayload(payload *models.Error) *ReplaceRuntimeMapEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime map entry not found response -func (o *ReplaceRuntimeMapEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeMapEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceRuntimeMapEntryDefault General Error - -swagger:response replaceRuntimeMapEntryDefault -*/ -type ReplaceRuntimeMapEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeMapEntryDefault creates ReplaceRuntimeMapEntryDefault with default headers values -func NewReplaceRuntimeMapEntryDefault(code int) *ReplaceRuntimeMapEntryDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceRuntimeMapEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) WithStatusCode(code int) *ReplaceRuntimeMapEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeMapEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) WithPayload(payload *models.Error) *ReplaceRuntimeMapEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime map entry default response -func (o *ReplaceRuntimeMapEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeMapEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/replace_runtime_map_entry_urlbuilder.go b/operations/maps/replace_runtime_map_entry_urlbuilder.go deleted file mode 100644 index bb8839fa..00000000 --- a/operations/maps/replace_runtime_map_entry_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceRuntimeMapEntryURL generates an URL for the replace runtime map entry operation -type ReplaceRuntimeMapEntryURL struct { - ID string - ParentName string - - ForceSync *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRuntimeMapEntryURL) WithBasePath(bp string) *ReplaceRuntimeMapEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRuntimeMapEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceRuntimeMapEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{parent_name}/entries/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on ReplaceRuntimeMapEntryURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceRuntimeMapEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceSyncQ string - if o.ForceSync != nil { - forceSyncQ = swag.FormatBool(*o.ForceSync) - } - if forceSyncQ != "" { - qs.Set("force_sync", forceSyncQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceRuntimeMapEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceRuntimeMapEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceRuntimeMapEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceRuntimeMapEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceRuntimeMapEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceRuntimeMapEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/maps/show_runtime_map.go b/operations/maps/show_runtime_map.go deleted file mode 100644 index 87284e75..00000000 --- a/operations/maps/show_runtime_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ShowRuntimeMapHandlerFunc turns a function with the right signature into a show runtime map handler -type ShowRuntimeMapHandlerFunc func(ShowRuntimeMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ShowRuntimeMapHandlerFunc) Handle(params ShowRuntimeMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ShowRuntimeMapHandler interface for that can handle valid show runtime map params -type ShowRuntimeMapHandler interface { - Handle(ShowRuntimeMapParams, interface{}) middleware.Responder -} - -// NewShowRuntimeMap creates a new http.Handler for the show runtime map operation -func NewShowRuntimeMap(ctx *middleware.Context, handler ShowRuntimeMapHandler) *ShowRuntimeMap { - return &ShowRuntimeMap{Context: ctx, Handler: handler} -} - -/* - ShowRuntimeMap swagger:route GET /services/haproxy/runtime/maps/{parent_name}/entries Maps showRuntimeMap - -# Return one map runtime entries - -Returns an array of all entries in a given runtime map file. -*/ -type ShowRuntimeMap struct { - Context *middleware.Context - Handler ShowRuntimeMapHandler -} - -func (o *ShowRuntimeMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewShowRuntimeMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/maps/show_runtime_map_parameters.go b/operations/maps/show_runtime_map_parameters.go deleted file mode 100644 index 1448e28b..00000000 --- a/operations/maps/show_runtime_map_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewShowRuntimeMapParams creates a new ShowRuntimeMapParams object -// -// There are no default values defined in the spec. -func NewShowRuntimeMapParams() ShowRuntimeMapParams { - - return ShowRuntimeMapParams{} -} - -// ShowRuntimeMapParams contains all the bound params for the show runtime map operation -// typically these are obtained from a http.Request -// -// swagger:parameters showRuntimeMap -type ShowRuntimeMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewShowRuntimeMapParams() beforehand. -func (o *ShowRuntimeMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ShowRuntimeMapParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/maps/show_runtime_map_responses.go b/operations/maps/show_runtime_map_responses.go deleted file mode 100644 index e1fb0d34..00000000 --- a/operations/maps/show_runtime_map_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ShowRuntimeMapOKCode is the HTTP code returned for type ShowRuntimeMapOK -const ShowRuntimeMapOKCode int = 200 - -/* -ShowRuntimeMapOK Successful operation - -swagger:response showRuntimeMapOK -*/ -type ShowRuntimeMapOK struct { - - /* - In: Body - */ - Payload models.MapEntries `json:"body,omitempty"` -} - -// NewShowRuntimeMapOK creates ShowRuntimeMapOK with default headers values -func NewShowRuntimeMapOK() *ShowRuntimeMapOK { - - return &ShowRuntimeMapOK{} -} - -// WithPayload adds the payload to the show runtime map o k response -func (o *ShowRuntimeMapOK) WithPayload(payload models.MapEntries) *ShowRuntimeMapOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the show runtime map o k response -func (o *ShowRuntimeMapOK) SetPayload(payload models.MapEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ShowRuntimeMapOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.MapEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ShowRuntimeMapNotFoundCode is the HTTP code returned for type ShowRuntimeMapNotFound -const ShowRuntimeMapNotFoundCode int = 404 - -/* -ShowRuntimeMapNotFound The specified resource was not found - -swagger:response showRuntimeMapNotFound -*/ -type ShowRuntimeMapNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewShowRuntimeMapNotFound creates ShowRuntimeMapNotFound with default headers values -func NewShowRuntimeMapNotFound() *ShowRuntimeMapNotFound { - - return &ShowRuntimeMapNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the show runtime map not found response -func (o *ShowRuntimeMapNotFound) WithConfigurationVersion(configurationVersion string) *ShowRuntimeMapNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the show runtime map not found response -func (o *ShowRuntimeMapNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the show runtime map not found response -func (o *ShowRuntimeMapNotFound) WithPayload(payload *models.Error) *ShowRuntimeMapNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the show runtime map not found response -func (o *ShowRuntimeMapNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ShowRuntimeMapNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ShowRuntimeMapDefault General Error - -swagger:response showRuntimeMapDefault -*/ -type ShowRuntimeMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewShowRuntimeMapDefault creates ShowRuntimeMapDefault with default headers values -func NewShowRuntimeMapDefault(code int) *ShowRuntimeMapDefault { - if code <= 0 { - code = 500 - } - - return &ShowRuntimeMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the show runtime map default response -func (o *ShowRuntimeMapDefault) WithStatusCode(code int) *ShowRuntimeMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the show runtime map default response -func (o *ShowRuntimeMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the show runtime map default response -func (o *ShowRuntimeMapDefault) WithConfigurationVersion(configurationVersion string) *ShowRuntimeMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the show runtime map default response -func (o *ShowRuntimeMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the show runtime map default response -func (o *ShowRuntimeMapDefault) WithPayload(payload *models.Error) *ShowRuntimeMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the show runtime map default response -func (o *ShowRuntimeMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ShowRuntimeMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/maps/show_runtime_map_urlbuilder.go b/operations/maps/show_runtime_map_urlbuilder.go deleted file mode 100644 index cf7628d8..00000000 --- a/operations/maps/show_runtime_map_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package maps - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ShowRuntimeMapURL generates an URL for the show runtime map operation -type ShowRuntimeMapURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ShowRuntimeMapURL) WithBasePath(bp string) *ShowRuntimeMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ShowRuntimeMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ShowRuntimeMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/maps/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ShowRuntimeMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ShowRuntimeMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ShowRuntimeMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ShowRuntimeMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ShowRuntimeMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ShowRuntimeMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ShowRuntimeMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/nameserver/create_nameserver.go b/operations/nameserver/create_nameserver.go deleted file mode 100644 index 022a1093..00000000 --- a/operations/nameserver/create_nameserver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateNameserverHandlerFunc turns a function with the right signature into a create nameserver handler -type CreateNameserverHandlerFunc func(CreateNameserverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateNameserverHandlerFunc) Handle(params CreateNameserverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateNameserverHandler interface for that can handle valid create nameserver params -type CreateNameserverHandler interface { - Handle(CreateNameserverParams, interface{}) middleware.Responder -} - -// NewCreateNameserver creates a new http.Handler for the create nameserver operation -func NewCreateNameserver(ctx *middleware.Context, handler CreateNameserverHandler) *CreateNameserver { - return &CreateNameserver{Context: ctx, Handler: handler} -} - -/* - CreateNameserver swagger:route POST /services/haproxy/configuration/nameservers Nameserver createNameserver - -# Add a nameserver - -Adds a new nameserver to the resolvers section. -*/ -type CreateNameserver struct { - Context *middleware.Context - Handler CreateNameserverHandler -} - -func (o *CreateNameserver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateNameserverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/nameserver/create_nameserver_parameters.go b/operations/nameserver/create_nameserver_parameters.go deleted file mode 100644 index f22446f2..00000000 --- a/operations/nameserver/create_nameserver_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateNameserverParams creates a new CreateNameserverParams object -// with the default values initialized. -func NewCreateNameserverParams() CreateNameserverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateNameserverParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateNameserverParams contains all the bound params for the create nameserver operation -// typically these are obtained from a http.Request -// -// swagger:parameters createNameserver -type CreateNameserverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Nameserver - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent resolver name - Required: true - In: query - */ - Resolver string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateNameserverParams() beforehand. -func (o *CreateNameserverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Nameserver - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qResolver, qhkResolver, _ := qs.GetOK("resolver") - if err := o.bindResolver(qResolver, qhkResolver, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateNameserverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateNameserverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindResolver binds and validates parameter Resolver from query. -func (o *CreateNameserverParams) bindResolver(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("resolver", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("resolver", "query", raw); err != nil { - return err - } - o.Resolver = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateNameserverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateNameserverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/nameserver/create_nameserver_responses.go b/operations/nameserver/create_nameserver_responses.go deleted file mode 100644 index 578b89c4..00000000 --- a/operations/nameserver/create_nameserver_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateNameserverCreatedCode is the HTTP code returned for type CreateNameserverCreated -const CreateNameserverCreatedCode int = 201 - -/* -CreateNameserverCreated Nameserver created - -swagger:response createNameserverCreated -*/ -type CreateNameserverCreated struct { - - /* - In: Body - */ - Payload *models.Nameserver `json:"body,omitempty"` -} - -// NewCreateNameserverCreated creates CreateNameserverCreated with default headers values -func NewCreateNameserverCreated() *CreateNameserverCreated { - - return &CreateNameserverCreated{} -} - -// WithPayload adds the payload to the create nameserver created response -func (o *CreateNameserverCreated) WithPayload(payload *models.Nameserver) *CreateNameserverCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create nameserver created response -func (o *CreateNameserverCreated) SetPayload(payload *models.Nameserver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNameserverCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNameserverAcceptedCode is the HTTP code returned for type CreateNameserverAccepted -const CreateNameserverAcceptedCode int = 202 - -/* -CreateNameserverAccepted Configuration change accepted and reload requested - -swagger:response createNameserverAccepted -*/ -type CreateNameserverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Nameserver `json:"body,omitempty"` -} - -// NewCreateNameserverAccepted creates CreateNameserverAccepted with default headers values -func NewCreateNameserverAccepted() *CreateNameserverAccepted { - - return &CreateNameserverAccepted{} -} - -// WithReloadID adds the reloadId to the create nameserver accepted response -func (o *CreateNameserverAccepted) WithReloadID(reloadID string) *CreateNameserverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create nameserver accepted response -func (o *CreateNameserverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create nameserver accepted response -func (o *CreateNameserverAccepted) WithPayload(payload *models.Nameserver) *CreateNameserverAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create nameserver accepted response -func (o *CreateNameserverAccepted) SetPayload(payload *models.Nameserver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNameserverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNameserverBadRequestCode is the HTTP code returned for type CreateNameserverBadRequest -const CreateNameserverBadRequestCode int = 400 - -/* -CreateNameserverBadRequest Bad request - -swagger:response createNameserverBadRequest -*/ -type CreateNameserverBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateNameserverBadRequest creates CreateNameserverBadRequest with default headers values -func NewCreateNameserverBadRequest() *CreateNameserverBadRequest { - - return &CreateNameserverBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create nameserver bad request response -func (o *CreateNameserverBadRequest) WithConfigurationVersion(configurationVersion string) *CreateNameserverBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create nameserver bad request response -func (o *CreateNameserverBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create nameserver bad request response -func (o *CreateNameserverBadRequest) WithPayload(payload *models.Error) *CreateNameserverBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create nameserver bad request response -func (o *CreateNameserverBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNameserverBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateNameserverConflictCode is the HTTP code returned for type CreateNameserverConflict -const CreateNameserverConflictCode int = 409 - -/* -CreateNameserverConflict The specified resource already exists - -swagger:response createNameserverConflict -*/ -type CreateNameserverConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateNameserverConflict creates CreateNameserverConflict with default headers values -func NewCreateNameserverConflict() *CreateNameserverConflict { - - return &CreateNameserverConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create nameserver conflict response -func (o *CreateNameserverConflict) WithConfigurationVersion(configurationVersion string) *CreateNameserverConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create nameserver conflict response -func (o *CreateNameserverConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create nameserver conflict response -func (o *CreateNameserverConflict) WithPayload(payload *models.Error) *CreateNameserverConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create nameserver conflict response -func (o *CreateNameserverConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNameserverConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateNameserverDefault General Error - -swagger:response createNameserverDefault -*/ -type CreateNameserverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateNameserverDefault creates CreateNameserverDefault with default headers values -func NewCreateNameserverDefault(code int) *CreateNameserverDefault { - if code <= 0 { - code = 500 - } - - return &CreateNameserverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create nameserver default response -func (o *CreateNameserverDefault) WithStatusCode(code int) *CreateNameserverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create nameserver default response -func (o *CreateNameserverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create nameserver default response -func (o *CreateNameserverDefault) WithConfigurationVersion(configurationVersion string) *CreateNameserverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create nameserver default response -func (o *CreateNameserverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create nameserver default response -func (o *CreateNameserverDefault) WithPayload(payload *models.Error) *CreateNameserverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create nameserver default response -func (o *CreateNameserverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateNameserverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/nameserver/create_nameserver_urlbuilder.go b/operations/nameserver/create_nameserver_urlbuilder.go deleted file mode 100644 index 97618cba..00000000 --- a/operations/nameserver/create_nameserver_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateNameserverURL generates an URL for the create nameserver operation -type CreateNameserverURL struct { - ForceReload *bool - Resolver string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateNameserverURL) WithBasePath(bp string) *CreateNameserverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateNameserverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateNameserverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/nameservers" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - resolverQ := o.Resolver - if resolverQ != "" { - qs.Set("resolver", resolverQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateNameserverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateNameserverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateNameserverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateNameserverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateNameserverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateNameserverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/nameserver/delete_nameserver.go b/operations/nameserver/delete_nameserver.go deleted file mode 100644 index 076fad3f..00000000 --- a/operations/nameserver/delete_nameserver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteNameserverHandlerFunc turns a function with the right signature into a delete nameserver handler -type DeleteNameserverHandlerFunc func(DeleteNameserverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteNameserverHandlerFunc) Handle(params DeleteNameserverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteNameserverHandler interface for that can handle valid delete nameserver params -type DeleteNameserverHandler interface { - Handle(DeleteNameserverParams, interface{}) middleware.Responder -} - -// NewDeleteNameserver creates a new http.Handler for the delete nameserver operation -func NewDeleteNameserver(ctx *middleware.Context, handler DeleteNameserverHandler) *DeleteNameserver { - return &DeleteNameserver{Context: ctx, Handler: handler} -} - -/* - DeleteNameserver swagger:route DELETE /services/haproxy/configuration/nameservers/{name} Nameserver deleteNameserver - -# Delete a nameserver - -Deletes a nameserver from the resolvers section by it's name. -*/ -type DeleteNameserver struct { - Context *middleware.Context - Handler DeleteNameserverHandler -} - -func (o *DeleteNameserver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteNameserverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/nameserver/delete_nameserver_parameters.go b/operations/nameserver/delete_nameserver_parameters.go deleted file mode 100644 index 94410ce1..00000000 --- a/operations/nameserver/delete_nameserver_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteNameserverParams creates a new DeleteNameserverParams object -// with the default values initialized. -func NewDeleteNameserverParams() DeleteNameserverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteNameserverParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteNameserverParams contains all the bound params for the delete nameserver operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteNameserver -type DeleteNameserverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Nameserver name - Required: true - In: path - */ - Name string - /*Parent resolver name - Required: true - In: query - */ - Resolver string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteNameserverParams() beforehand. -func (o *DeleteNameserverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qResolver, qhkResolver, _ := qs.GetOK("resolver") - if err := o.bindResolver(qResolver, qhkResolver, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteNameserverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteNameserverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteNameserverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindResolver binds and validates parameter Resolver from query. -func (o *DeleteNameserverParams) bindResolver(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("resolver", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("resolver", "query", raw); err != nil { - return err - } - o.Resolver = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteNameserverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteNameserverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/nameserver/delete_nameserver_responses.go b/operations/nameserver/delete_nameserver_responses.go deleted file mode 100644 index 58cf3bc8..00000000 --- a/operations/nameserver/delete_nameserver_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteNameserverAcceptedCode is the HTTP code returned for type DeleteNameserverAccepted -const DeleteNameserverAcceptedCode int = 202 - -/* -DeleteNameserverAccepted Configuration change accepted and reload requested - -swagger:response deleteNameserverAccepted -*/ -type DeleteNameserverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteNameserverAccepted creates DeleteNameserverAccepted with default headers values -func NewDeleteNameserverAccepted() *DeleteNameserverAccepted { - - return &DeleteNameserverAccepted{} -} - -// WithReloadID adds the reloadId to the delete nameserver accepted response -func (o *DeleteNameserverAccepted) WithReloadID(reloadID string) *DeleteNameserverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete nameserver accepted response -func (o *DeleteNameserverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteNameserverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteNameserverNoContentCode is the HTTP code returned for type DeleteNameserverNoContent -const DeleteNameserverNoContentCode int = 204 - -/* -DeleteNameserverNoContent Nameserver deleted - -swagger:response deleteNameserverNoContent -*/ -type DeleteNameserverNoContent struct { -} - -// NewDeleteNameserverNoContent creates DeleteNameserverNoContent with default headers values -func NewDeleteNameserverNoContent() *DeleteNameserverNoContent { - - return &DeleteNameserverNoContent{} -} - -// WriteResponse to the client -func (o *DeleteNameserverNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteNameserverNotFoundCode is the HTTP code returned for type DeleteNameserverNotFound -const DeleteNameserverNotFoundCode int = 404 - -/* -DeleteNameserverNotFound The specified resource was not found - -swagger:response deleteNameserverNotFound -*/ -type DeleteNameserverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteNameserverNotFound creates DeleteNameserverNotFound with default headers values -func NewDeleteNameserverNotFound() *DeleteNameserverNotFound { - - return &DeleteNameserverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete nameserver not found response -func (o *DeleteNameserverNotFound) WithConfigurationVersion(configurationVersion string) *DeleteNameserverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete nameserver not found response -func (o *DeleteNameserverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete nameserver not found response -func (o *DeleteNameserverNotFound) WithPayload(payload *models.Error) *DeleteNameserverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete nameserver not found response -func (o *DeleteNameserverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteNameserverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteNameserverDefault General Error - -swagger:response deleteNameserverDefault -*/ -type DeleteNameserverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteNameserverDefault creates DeleteNameserverDefault with default headers values -func NewDeleteNameserverDefault(code int) *DeleteNameserverDefault { - if code <= 0 { - code = 500 - } - - return &DeleteNameserverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete nameserver default response -func (o *DeleteNameserverDefault) WithStatusCode(code int) *DeleteNameserverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete nameserver default response -func (o *DeleteNameserverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete nameserver default response -func (o *DeleteNameserverDefault) WithConfigurationVersion(configurationVersion string) *DeleteNameserverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete nameserver default response -func (o *DeleteNameserverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete nameserver default response -func (o *DeleteNameserverDefault) WithPayload(payload *models.Error) *DeleteNameserverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete nameserver default response -func (o *DeleteNameserverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteNameserverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/nameserver/delete_nameserver_urlbuilder.go b/operations/nameserver/delete_nameserver_urlbuilder.go deleted file mode 100644 index d07831fb..00000000 --- a/operations/nameserver/delete_nameserver_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteNameserverURL generates an URL for the delete nameserver operation -type DeleteNameserverURL struct { - Name string - - ForceReload *bool - Resolver string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteNameserverURL) WithBasePath(bp string) *DeleteNameserverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteNameserverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteNameserverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/nameservers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteNameserverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - resolverQ := o.Resolver - if resolverQ != "" { - qs.Set("resolver", resolverQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteNameserverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteNameserverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteNameserverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteNameserverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteNameserverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteNameserverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/nameserver/get_nameserver.go b/operations/nameserver/get_nameserver.go deleted file mode 100644 index 33a2bc4e..00000000 --- a/operations/nameserver/get_nameserver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetNameserverHandlerFunc turns a function with the right signature into a get nameserver handler -type GetNameserverHandlerFunc func(GetNameserverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetNameserverHandlerFunc) Handle(params GetNameserverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetNameserverHandler interface for that can handle valid get nameserver params -type GetNameserverHandler interface { - Handle(GetNameserverParams, interface{}) middleware.Responder -} - -// NewGetNameserver creates a new http.Handler for the get nameserver operation -func NewGetNameserver(ctx *middleware.Context, handler GetNameserverHandler) *GetNameserver { - return &GetNameserver{Context: ctx, Handler: handler} -} - -/* - GetNameserver swagger:route GET /services/haproxy/configuration/nameservers/{name} Nameserver getNameserver - -# Return a nameserver - -Returns one nameserver configuration by it's name. -*/ -type GetNameserver struct { - Context *middleware.Context - Handler GetNameserverHandler -} - -func (o *GetNameserver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetNameserverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/nameserver/get_nameserver_parameters.go b/operations/nameserver/get_nameserver_parameters.go deleted file mode 100644 index 5cf71aa1..00000000 --- a/operations/nameserver/get_nameserver_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetNameserverParams creates a new GetNameserverParams object -// -// There are no default values defined in the spec. -func NewGetNameserverParams() GetNameserverParams { - - return GetNameserverParams{} -} - -// GetNameserverParams contains all the bound params for the get nameserver operation -// typically these are obtained from a http.Request -// -// swagger:parameters getNameserver -type GetNameserverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Nameserver name - Required: true - In: path - */ - Name string - /*Parent resolver name - Required: true - In: query - */ - Resolver string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetNameserverParams() beforehand. -func (o *GetNameserverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qResolver, qhkResolver, _ := qs.GetOK("resolver") - if err := o.bindResolver(qResolver, qhkResolver, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetNameserverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindResolver binds and validates parameter Resolver from query. -func (o *GetNameserverParams) bindResolver(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("resolver", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("resolver", "query", raw); err != nil { - return err - } - o.Resolver = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetNameserverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/nameserver/get_nameserver_responses.go b/operations/nameserver/get_nameserver_responses.go deleted file mode 100644 index ef36ee41..00000000 --- a/operations/nameserver/get_nameserver_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetNameserverOKCode is the HTTP code returned for type GetNameserverOK -const GetNameserverOKCode int = 200 - -/* -GetNameserverOK Successful operation - -swagger:response getNameserverOK -*/ -type GetNameserverOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Nameserver `json:"body,omitempty"` -} - -// NewGetNameserverOK creates GetNameserverOK with default headers values -func NewGetNameserverOK() *GetNameserverOK { - - return &GetNameserverOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get nameserver o k response -func (o *GetNameserverOK) WithConfigurationVersion(configurationVersion string) *GetNameserverOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get nameserver o k response -func (o *GetNameserverOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get nameserver o k response -func (o *GetNameserverOK) WithPayload(payload *models.Nameserver) *GetNameserverOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get nameserver o k response -func (o *GetNameserverOK) SetPayload(payload *models.Nameserver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetNameserverOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetNameserverNotFoundCode is the HTTP code returned for type GetNameserverNotFound -const GetNameserverNotFoundCode int = 404 - -/* -GetNameserverNotFound The specified resource was not found - -swagger:response getNameserverNotFound -*/ -type GetNameserverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetNameserverNotFound creates GetNameserverNotFound with default headers values -func NewGetNameserverNotFound() *GetNameserverNotFound { - - return &GetNameserverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get nameserver not found response -func (o *GetNameserverNotFound) WithConfigurationVersion(configurationVersion string) *GetNameserverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get nameserver not found response -func (o *GetNameserverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get nameserver not found response -func (o *GetNameserverNotFound) WithPayload(payload *models.Error) *GetNameserverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get nameserver not found response -func (o *GetNameserverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetNameserverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetNameserverDefault General Error - -swagger:response getNameserverDefault -*/ -type GetNameserverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetNameserverDefault creates GetNameserverDefault with default headers values -func NewGetNameserverDefault(code int) *GetNameserverDefault { - if code <= 0 { - code = 500 - } - - return &GetNameserverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get nameserver default response -func (o *GetNameserverDefault) WithStatusCode(code int) *GetNameserverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get nameserver default response -func (o *GetNameserverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get nameserver default response -func (o *GetNameserverDefault) WithConfigurationVersion(configurationVersion string) *GetNameserverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get nameserver default response -func (o *GetNameserverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get nameserver default response -func (o *GetNameserverDefault) WithPayload(payload *models.Error) *GetNameserverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get nameserver default response -func (o *GetNameserverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetNameserverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/nameserver/get_nameserver_urlbuilder.go b/operations/nameserver/get_nameserver_urlbuilder.go deleted file mode 100644 index 110d1373..00000000 --- a/operations/nameserver/get_nameserver_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetNameserverURL generates an URL for the get nameserver operation -type GetNameserverURL struct { - Name string - - Resolver string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetNameserverURL) WithBasePath(bp string) *GetNameserverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetNameserverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetNameserverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/nameservers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetNameserverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - resolverQ := o.Resolver - if resolverQ != "" { - qs.Set("resolver", resolverQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetNameserverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetNameserverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetNameserverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetNameserverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetNameserverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetNameserverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/nameserver/get_nameservers.go b/operations/nameserver/get_nameservers.go deleted file mode 100644 index 96879795..00000000 --- a/operations/nameserver/get_nameservers.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetNameserversHandlerFunc turns a function with the right signature into a get nameservers handler -type GetNameserversHandlerFunc func(GetNameserversParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetNameserversHandlerFunc) Handle(params GetNameserversParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetNameserversHandler interface for that can handle valid get nameservers params -type GetNameserversHandler interface { - Handle(GetNameserversParams, interface{}) middleware.Responder -} - -// NewGetNameservers creates a new http.Handler for the get nameservers operation -func NewGetNameservers(ctx *middleware.Context, handler GetNameserversHandler) *GetNameservers { - return &GetNameservers{Context: ctx, Handler: handler} -} - -/* - GetNameservers swagger:route GET /services/haproxy/configuration/nameservers Nameserver getNameservers - -# Return an array of nameservers - -Returns an array of all configured nameservers. -*/ -type GetNameservers struct { - Context *middleware.Context - Handler GetNameserversHandler -} - -func (o *GetNameservers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetNameserversParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/nameserver/get_nameservers_parameters.go b/operations/nameserver/get_nameservers_parameters.go deleted file mode 100644 index b36d3ec0..00000000 --- a/operations/nameserver/get_nameservers_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetNameserversParams creates a new GetNameserversParams object -// -// There are no default values defined in the spec. -func NewGetNameserversParams() GetNameserversParams { - - return GetNameserversParams{} -} - -// GetNameserversParams contains all the bound params for the get nameservers operation -// typically these are obtained from a http.Request -// -// swagger:parameters getNameservers -type GetNameserversParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent resolver name - Required: true - In: query - */ - Resolver string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetNameserversParams() beforehand. -func (o *GetNameserversParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qResolver, qhkResolver, _ := qs.GetOK("resolver") - if err := o.bindResolver(qResolver, qhkResolver, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindResolver binds and validates parameter Resolver from query. -func (o *GetNameserversParams) bindResolver(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("resolver", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("resolver", "query", raw); err != nil { - return err - } - o.Resolver = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetNameserversParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/nameserver/get_nameservers_responses.go b/operations/nameserver/get_nameservers_responses.go deleted file mode 100644 index 8624ee69..00000000 --- a/operations/nameserver/get_nameservers_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetNameserversOKCode is the HTTP code returned for type GetNameserversOK -const GetNameserversOKCode int = 200 - -/* -GetNameserversOK Successful operation - -swagger:response getNameserversOK -*/ -type GetNameserversOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Nameservers `json:"body,omitempty"` -} - -// NewGetNameserversOK creates GetNameserversOK with default headers values -func NewGetNameserversOK() *GetNameserversOK { - - return &GetNameserversOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get nameservers o k response -func (o *GetNameserversOK) WithConfigurationVersion(configurationVersion string) *GetNameserversOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get nameservers o k response -func (o *GetNameserversOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get nameservers o k response -func (o *GetNameserversOK) WithPayload(payload models.Nameservers) *GetNameserversOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get nameservers o k response -func (o *GetNameserversOK) SetPayload(payload models.Nameservers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetNameserversOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Nameservers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetNameserversDefault General Error - -swagger:response getNameserversDefault -*/ -type GetNameserversDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetNameserversDefault creates GetNameserversDefault with default headers values -func NewGetNameserversDefault(code int) *GetNameserversDefault { - if code <= 0 { - code = 500 - } - - return &GetNameserversDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get nameservers default response -func (o *GetNameserversDefault) WithStatusCode(code int) *GetNameserversDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get nameservers default response -func (o *GetNameserversDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get nameservers default response -func (o *GetNameserversDefault) WithConfigurationVersion(configurationVersion string) *GetNameserversDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get nameservers default response -func (o *GetNameserversDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get nameservers default response -func (o *GetNameserversDefault) WithPayload(payload *models.Error) *GetNameserversDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get nameservers default response -func (o *GetNameserversDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetNameserversDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/nameserver/get_nameservers_urlbuilder.go b/operations/nameserver/get_nameservers_urlbuilder.go deleted file mode 100644 index 3f243048..00000000 --- a/operations/nameserver/get_nameservers_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetNameserversURL generates an URL for the get nameservers operation -type GetNameserversURL struct { - Resolver string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetNameserversURL) WithBasePath(bp string) *GetNameserversURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetNameserversURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetNameserversURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/nameservers" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - resolverQ := o.Resolver - if resolverQ != "" { - qs.Set("resolver", resolverQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetNameserversURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetNameserversURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetNameserversURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetNameserversURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetNameserversURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetNameserversURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/nameserver/replace_nameserver.go b/operations/nameserver/replace_nameserver.go deleted file mode 100644 index 4b4de18b..00000000 --- a/operations/nameserver/replace_nameserver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceNameserverHandlerFunc turns a function with the right signature into a replace nameserver handler -type ReplaceNameserverHandlerFunc func(ReplaceNameserverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceNameserverHandlerFunc) Handle(params ReplaceNameserverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceNameserverHandler interface for that can handle valid replace nameserver params -type ReplaceNameserverHandler interface { - Handle(ReplaceNameserverParams, interface{}) middleware.Responder -} - -// NewReplaceNameserver creates a new http.Handler for the replace nameserver operation -func NewReplaceNameserver(ctx *middleware.Context, handler ReplaceNameserverHandler) *ReplaceNameserver { - return &ReplaceNameserver{Context: ctx, Handler: handler} -} - -/* - ReplaceNameserver swagger:route PUT /services/haproxy/configuration/nameservers/{name} Nameserver replaceNameserver - -# Replace a nameserver - -Replaces a nameserver configuration by it's name. -*/ -type ReplaceNameserver struct { - Context *middleware.Context - Handler ReplaceNameserverHandler -} - -func (o *ReplaceNameserver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceNameserverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/nameserver/replace_nameserver_parameters.go b/operations/nameserver/replace_nameserver_parameters.go deleted file mode 100644 index e182434f..00000000 --- a/operations/nameserver/replace_nameserver_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceNameserverParams creates a new ReplaceNameserverParams object -// with the default values initialized. -func NewReplaceNameserverParams() ReplaceNameserverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceNameserverParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceNameserverParams contains all the bound params for the replace nameserver operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceNameserver -type ReplaceNameserverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Nameserver - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Nameserver name - Required: true - In: path - */ - Name string - /*Parent resolver name - Required: true - In: query - */ - Resolver string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceNameserverParams() beforehand. -func (o *ReplaceNameserverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Nameserver - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qResolver, qhkResolver, _ := qs.GetOK("resolver") - if err := o.bindResolver(qResolver, qhkResolver, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceNameserverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceNameserverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceNameserverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindResolver binds and validates parameter Resolver from query. -func (o *ReplaceNameserverParams) bindResolver(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("resolver", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("resolver", "query", raw); err != nil { - return err - } - o.Resolver = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceNameserverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceNameserverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/nameserver/replace_nameserver_responses.go b/operations/nameserver/replace_nameserver_responses.go deleted file mode 100644 index 16236cff..00000000 --- a/operations/nameserver/replace_nameserver_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceNameserverOKCode is the HTTP code returned for type ReplaceNameserverOK -const ReplaceNameserverOKCode int = 200 - -/* -ReplaceNameserverOK Nameserver replaced - -swagger:response replaceNameserverOK -*/ -type ReplaceNameserverOK struct { - - /* - In: Body - */ - Payload *models.Nameserver `json:"body,omitempty"` -} - -// NewReplaceNameserverOK creates ReplaceNameserverOK with default headers values -func NewReplaceNameserverOK() *ReplaceNameserverOK { - - return &ReplaceNameserverOK{} -} - -// WithPayload adds the payload to the replace nameserver o k response -func (o *ReplaceNameserverOK) WithPayload(payload *models.Nameserver) *ReplaceNameserverOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace nameserver o k response -func (o *ReplaceNameserverOK) SetPayload(payload *models.Nameserver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceNameserverOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceNameserverAcceptedCode is the HTTP code returned for type ReplaceNameserverAccepted -const ReplaceNameserverAcceptedCode int = 202 - -/* -ReplaceNameserverAccepted Configuration change accepted and reload requested - -swagger:response replaceNameserverAccepted -*/ -type ReplaceNameserverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Nameserver `json:"body,omitempty"` -} - -// NewReplaceNameserverAccepted creates ReplaceNameserverAccepted with default headers values -func NewReplaceNameserverAccepted() *ReplaceNameserverAccepted { - - return &ReplaceNameserverAccepted{} -} - -// WithReloadID adds the reloadId to the replace nameserver accepted response -func (o *ReplaceNameserverAccepted) WithReloadID(reloadID string) *ReplaceNameserverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace nameserver accepted response -func (o *ReplaceNameserverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace nameserver accepted response -func (o *ReplaceNameserverAccepted) WithPayload(payload *models.Nameserver) *ReplaceNameserverAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace nameserver accepted response -func (o *ReplaceNameserverAccepted) SetPayload(payload *models.Nameserver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceNameserverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceNameserverBadRequestCode is the HTTP code returned for type ReplaceNameserverBadRequest -const ReplaceNameserverBadRequestCode int = 400 - -/* -ReplaceNameserverBadRequest Bad request - -swagger:response replaceNameserverBadRequest -*/ -type ReplaceNameserverBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceNameserverBadRequest creates ReplaceNameserverBadRequest with default headers values -func NewReplaceNameserverBadRequest() *ReplaceNameserverBadRequest { - - return &ReplaceNameserverBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace nameserver bad request response -func (o *ReplaceNameserverBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceNameserverBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace nameserver bad request response -func (o *ReplaceNameserverBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace nameserver bad request response -func (o *ReplaceNameserverBadRequest) WithPayload(payload *models.Error) *ReplaceNameserverBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace nameserver bad request response -func (o *ReplaceNameserverBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceNameserverBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceNameserverNotFoundCode is the HTTP code returned for type ReplaceNameserverNotFound -const ReplaceNameserverNotFoundCode int = 404 - -/* -ReplaceNameserverNotFound The specified resource was not found - -swagger:response replaceNameserverNotFound -*/ -type ReplaceNameserverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceNameserverNotFound creates ReplaceNameserverNotFound with default headers values -func NewReplaceNameserverNotFound() *ReplaceNameserverNotFound { - - return &ReplaceNameserverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace nameserver not found response -func (o *ReplaceNameserverNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceNameserverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace nameserver not found response -func (o *ReplaceNameserverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace nameserver not found response -func (o *ReplaceNameserverNotFound) WithPayload(payload *models.Error) *ReplaceNameserverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace nameserver not found response -func (o *ReplaceNameserverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceNameserverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceNameserverDefault General Error - -swagger:response replaceNameserverDefault -*/ -type ReplaceNameserverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceNameserverDefault creates ReplaceNameserverDefault with default headers values -func NewReplaceNameserverDefault(code int) *ReplaceNameserverDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceNameserverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace nameserver default response -func (o *ReplaceNameserverDefault) WithStatusCode(code int) *ReplaceNameserverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace nameserver default response -func (o *ReplaceNameserverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace nameserver default response -func (o *ReplaceNameserverDefault) WithConfigurationVersion(configurationVersion string) *ReplaceNameserverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace nameserver default response -func (o *ReplaceNameserverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace nameserver default response -func (o *ReplaceNameserverDefault) WithPayload(payload *models.Error) *ReplaceNameserverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace nameserver default response -func (o *ReplaceNameserverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceNameserverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/nameserver/replace_nameserver_urlbuilder.go b/operations/nameserver/replace_nameserver_urlbuilder.go deleted file mode 100644 index 00e24f90..00000000 --- a/operations/nameserver/replace_nameserver_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package nameserver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceNameserverURL generates an URL for the replace nameserver operation -type ReplaceNameserverURL struct { - Name string - - ForceReload *bool - Resolver string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceNameserverURL) WithBasePath(bp string) *ReplaceNameserverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceNameserverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceNameserverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/nameservers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceNameserverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - resolverQ := o.Resolver - if resolverQ != "" { - qs.Set("resolver", resolverQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceNameserverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceNameserverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceNameserverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceNameserverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceNameserverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceNameserverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer/create_peer.go b/operations/peer/create_peer.go deleted file mode 100644 index 3d12e587..00000000 --- a/operations/peer/create_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreatePeerHandlerFunc turns a function with the right signature into a create peer handler -type CreatePeerHandlerFunc func(CreatePeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreatePeerHandlerFunc) Handle(params CreatePeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreatePeerHandler interface for that can handle valid create peer params -type CreatePeerHandler interface { - Handle(CreatePeerParams, interface{}) middleware.Responder -} - -// NewCreatePeer creates a new http.Handler for the create peer operation -func NewCreatePeer(ctx *middleware.Context, handler CreatePeerHandler) *CreatePeer { - return &CreatePeer{Context: ctx, Handler: handler} -} - -/* - CreatePeer swagger:route POST /services/haproxy/configuration/peer_section Peer createPeer - -# Add a peer - -Adds a new peer to the configuration file. -*/ -type CreatePeer struct { - Context *middleware.Context - Handler CreatePeerHandler -} - -func (o *CreatePeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreatePeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer/create_peer_parameters.go b/operations/peer/create_peer_parameters.go deleted file mode 100644 index 9af3c92a..00000000 --- a/operations/peer/create_peer_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreatePeerParams creates a new CreatePeerParams object -// with the default values initialized. -func NewCreatePeerParams() CreatePeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreatePeerParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreatePeerParams contains all the bound params for the create peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters createPeer -type CreatePeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.PeerSection - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreatePeerParams() beforehand. -func (o *CreatePeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PeerSection - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreatePeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreatePeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreatePeerParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreatePeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreatePeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreatePeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/peer/create_peer_responses.go b/operations/peer/create_peer_responses.go deleted file mode 100644 index 4c8641f9..00000000 --- a/operations/peer/create_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreatePeerCreatedCode is the HTTP code returned for type CreatePeerCreated -const CreatePeerCreatedCode int = 201 - -/* -CreatePeerCreated Peer created - -swagger:response createPeerCreated -*/ -type CreatePeerCreated struct { - - /* - In: Body - */ - Payload *models.PeerSection `json:"body,omitempty"` -} - -// NewCreatePeerCreated creates CreatePeerCreated with default headers values -func NewCreatePeerCreated() *CreatePeerCreated { - - return &CreatePeerCreated{} -} - -// WithPayload adds the payload to the create peer created response -func (o *CreatePeerCreated) WithPayload(payload *models.PeerSection) *CreatePeerCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer created response -func (o *CreatePeerCreated) SetPayload(payload *models.PeerSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerAcceptedCode is the HTTP code returned for type CreatePeerAccepted -const CreatePeerAcceptedCode int = 202 - -/* -CreatePeerAccepted Configuration change accepted and reload requested - -swagger:response createPeerAccepted -*/ -type CreatePeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.PeerSection `json:"body,omitempty"` -} - -// NewCreatePeerAccepted creates CreatePeerAccepted with default headers values -func NewCreatePeerAccepted() *CreatePeerAccepted { - - return &CreatePeerAccepted{} -} - -// WithReloadID adds the reloadId to the create peer accepted response -func (o *CreatePeerAccepted) WithReloadID(reloadID string) *CreatePeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create peer accepted response -func (o *CreatePeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create peer accepted response -func (o *CreatePeerAccepted) WithPayload(payload *models.PeerSection) *CreatePeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer accepted response -func (o *CreatePeerAccepted) SetPayload(payload *models.PeerSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerBadRequestCode is the HTTP code returned for type CreatePeerBadRequest -const CreatePeerBadRequestCode int = 400 - -/* -CreatePeerBadRequest Bad request - -swagger:response createPeerBadRequest -*/ -type CreatePeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerBadRequest creates CreatePeerBadRequest with default headers values -func NewCreatePeerBadRequest() *CreatePeerBadRequest { - - return &CreatePeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create peer bad request response -func (o *CreatePeerBadRequest) WithConfigurationVersion(configurationVersion string) *CreatePeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer bad request response -func (o *CreatePeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer bad request response -func (o *CreatePeerBadRequest) WithPayload(payload *models.Error) *CreatePeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer bad request response -func (o *CreatePeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerConflictCode is the HTTP code returned for type CreatePeerConflict -const CreatePeerConflictCode int = 409 - -/* -CreatePeerConflict The specified resource already exists - -swagger:response createPeerConflict -*/ -type CreatePeerConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerConflict creates CreatePeerConflict with default headers values -func NewCreatePeerConflict() *CreatePeerConflict { - - return &CreatePeerConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create peer conflict response -func (o *CreatePeerConflict) WithConfigurationVersion(configurationVersion string) *CreatePeerConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer conflict response -func (o *CreatePeerConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer conflict response -func (o *CreatePeerConflict) WithPayload(payload *models.Error) *CreatePeerConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer conflict response -func (o *CreatePeerConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreatePeerDefault General Error - -swagger:response createPeerDefault -*/ -type CreatePeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerDefault creates CreatePeerDefault with default headers values -func NewCreatePeerDefault(code int) *CreatePeerDefault { - if code <= 0 { - code = 500 - } - - return &CreatePeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create peer default response -func (o *CreatePeerDefault) WithStatusCode(code int) *CreatePeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create peer default response -func (o *CreatePeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create peer default response -func (o *CreatePeerDefault) WithConfigurationVersion(configurationVersion string) *CreatePeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer default response -func (o *CreatePeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer default response -func (o *CreatePeerDefault) WithPayload(payload *models.Error) *CreatePeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer default response -func (o *CreatePeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer/create_peer_urlbuilder.go b/operations/peer/create_peer_urlbuilder.go deleted file mode 100644 index 89273e7d..00000000 --- a/operations/peer/create_peer_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreatePeerURL generates an URL for the create peer operation -type CreatePeerURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreatePeerURL) WithBasePath(bp string) *CreatePeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreatePeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreatePeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_section" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreatePeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreatePeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreatePeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreatePeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreatePeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreatePeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer/delete_peer.go b/operations/peer/delete_peer.go deleted file mode 100644 index fdc3b5f3..00000000 --- a/operations/peer/delete_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeletePeerHandlerFunc turns a function with the right signature into a delete peer handler -type DeletePeerHandlerFunc func(DeletePeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeletePeerHandlerFunc) Handle(params DeletePeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeletePeerHandler interface for that can handle valid delete peer params -type DeletePeerHandler interface { - Handle(DeletePeerParams, interface{}) middleware.Responder -} - -// NewDeletePeer creates a new http.Handler for the delete peer operation -func NewDeletePeer(ctx *middleware.Context, handler DeletePeerHandler) *DeletePeer { - return &DeletePeer{Context: ctx, Handler: handler} -} - -/* - DeletePeer swagger:route DELETE /services/haproxy/configuration/peer_section/{name} Peer deletePeer - -# Delete a peer - -Deletes a peer from the configuration by it's name. -*/ -type DeletePeer struct { - Context *middleware.Context - Handler DeletePeerHandler -} - -func (o *DeletePeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeletePeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer/delete_peer_parameters.go b/operations/peer/delete_peer_parameters.go deleted file mode 100644 index 3a662ce4..00000000 --- a/operations/peer/delete_peer_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeletePeerParams creates a new DeletePeerParams object -// with the default values initialized. -func NewDeletePeerParams() DeletePeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeletePeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeletePeerParams contains all the bound params for the delete peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters deletePeer -type DeletePeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Peer name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeletePeerParams() beforehand. -func (o *DeletePeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeletePeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeletePeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeletePeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeletePeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeletePeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/peer/delete_peer_responses.go b/operations/peer/delete_peer_responses.go deleted file mode 100644 index 4533e2f0..00000000 --- a/operations/peer/delete_peer_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeletePeerAcceptedCode is the HTTP code returned for type DeletePeerAccepted -const DeletePeerAcceptedCode int = 202 - -/* -DeletePeerAccepted Configuration change accepted and reload requested - -swagger:response deletePeerAccepted -*/ -type DeletePeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeletePeerAccepted creates DeletePeerAccepted with default headers values -func NewDeletePeerAccepted() *DeletePeerAccepted { - - return &DeletePeerAccepted{} -} - -// WithReloadID adds the reloadId to the delete peer accepted response -func (o *DeletePeerAccepted) WithReloadID(reloadID string) *DeletePeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete peer accepted response -func (o *DeletePeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeletePeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeletePeerNoContentCode is the HTTP code returned for type DeletePeerNoContent -const DeletePeerNoContentCode int = 204 - -/* -DeletePeerNoContent Peer deleted - -swagger:response deletePeerNoContent -*/ -type DeletePeerNoContent struct { -} - -// NewDeletePeerNoContent creates DeletePeerNoContent with default headers values -func NewDeletePeerNoContent() *DeletePeerNoContent { - - return &DeletePeerNoContent{} -} - -// WriteResponse to the client -func (o *DeletePeerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeletePeerNotFoundCode is the HTTP code returned for type DeletePeerNotFound -const DeletePeerNotFoundCode int = 404 - -/* -DeletePeerNotFound The specified resource was not found - -swagger:response deletePeerNotFound -*/ -type DeletePeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePeerNotFound creates DeletePeerNotFound with default headers values -func NewDeletePeerNotFound() *DeletePeerNotFound { - - return &DeletePeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete peer not found response -func (o *DeletePeerNotFound) WithConfigurationVersion(configurationVersion string) *DeletePeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete peer not found response -func (o *DeletePeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete peer not found response -func (o *DeletePeerNotFound) WithPayload(payload *models.Error) *DeletePeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete peer not found response -func (o *DeletePeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeletePeerDefault General Error - -swagger:response deletePeerDefault -*/ -type DeletePeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePeerDefault creates DeletePeerDefault with default headers values -func NewDeletePeerDefault(code int) *DeletePeerDefault { - if code <= 0 { - code = 500 - } - - return &DeletePeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete peer default response -func (o *DeletePeerDefault) WithStatusCode(code int) *DeletePeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete peer default response -func (o *DeletePeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete peer default response -func (o *DeletePeerDefault) WithConfigurationVersion(configurationVersion string) *DeletePeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete peer default response -func (o *DeletePeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete peer default response -func (o *DeletePeerDefault) WithPayload(payload *models.Error) *DeletePeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete peer default response -func (o *DeletePeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer/delete_peer_urlbuilder.go b/operations/peer/delete_peer_urlbuilder.go deleted file mode 100644 index 61f64999..00000000 --- a/operations/peer/delete_peer_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeletePeerURL generates an URL for the delete peer operation -type DeletePeerURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePeerURL) WithBasePath(bp string) *DeletePeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeletePeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_section/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeletePeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeletePeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeletePeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeletePeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeletePeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeletePeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeletePeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer/get_peer_section.go b/operations/peer/get_peer_section.go deleted file mode 100644 index 0fcdb191..00000000 --- a/operations/peer/get_peer_section.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetPeerSectionHandlerFunc turns a function with the right signature into a get peer section handler -type GetPeerSectionHandlerFunc func(GetPeerSectionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPeerSectionHandlerFunc) Handle(params GetPeerSectionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetPeerSectionHandler interface for that can handle valid get peer section params -type GetPeerSectionHandler interface { - Handle(GetPeerSectionParams, interface{}) middleware.Responder -} - -// NewGetPeerSection creates a new http.Handler for the get peer section operation -func NewGetPeerSection(ctx *middleware.Context, handler GetPeerSectionHandler) *GetPeerSection { - return &GetPeerSection{Context: ctx, Handler: handler} -} - -/* - GetPeerSection swagger:route GET /services/haproxy/configuration/peer_section/{name} Peer getPeerSection - -# Return a peer - -Returns one peer configuration by it's name. -*/ -type GetPeerSection struct { - Context *middleware.Context - Handler GetPeerSectionHandler -} - -func (o *GetPeerSection) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPeerSectionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer/get_peer_section_parameters.go b/operations/peer/get_peer_section_parameters.go deleted file mode 100644 index 65e70ee4..00000000 --- a/operations/peer/get_peer_section_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetPeerSectionParams creates a new GetPeerSectionParams object -// with the default values initialized. -func NewGetPeerSectionParams() GetPeerSectionParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetPeerSectionParams{ - FullSection: &fullSectionDefault, - } -} - -// GetPeerSectionParams contains all the bound params for the get peer section operation -// typically these are obtained from a http.Request -// -// swagger:parameters getPeerSection -type GetPeerSectionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Peer name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPeerSectionParams() beforehand. -func (o *GetPeerSectionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetPeerSectionParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetPeerSectionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetPeerSectionParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetPeerSectionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/peer/get_peer_section_responses.go b/operations/peer/get_peer_section_responses.go deleted file mode 100644 index 13e60338..00000000 --- a/operations/peer/get_peer_section_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetPeerSectionOKCode is the HTTP code returned for type GetPeerSectionOK -const GetPeerSectionOKCode int = 200 - -/* -GetPeerSectionOK Successful operation - -swagger:response getPeerSectionOK -*/ -type GetPeerSectionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.PeerSection `json:"body,omitempty"` -} - -// NewGetPeerSectionOK creates GetPeerSectionOK with default headers values -func NewGetPeerSectionOK() *GetPeerSectionOK { - - return &GetPeerSectionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer section o k response -func (o *GetPeerSectionOK) WithConfigurationVersion(configurationVersion string) *GetPeerSectionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer section o k response -func (o *GetPeerSectionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer section o k response -func (o *GetPeerSectionOK) WithPayload(payload *models.PeerSection) *GetPeerSectionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer section o k response -func (o *GetPeerSectionOK) SetPayload(payload *models.PeerSection) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerSectionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetPeerSectionNotFoundCode is the HTTP code returned for type GetPeerSectionNotFound -const GetPeerSectionNotFoundCode int = 404 - -/* -GetPeerSectionNotFound The specified resource was not found - -swagger:response getPeerSectionNotFound -*/ -type GetPeerSectionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerSectionNotFound creates GetPeerSectionNotFound with default headers values -func NewGetPeerSectionNotFound() *GetPeerSectionNotFound { - - return &GetPeerSectionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer section not found response -func (o *GetPeerSectionNotFound) WithConfigurationVersion(configurationVersion string) *GetPeerSectionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer section not found response -func (o *GetPeerSectionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer section not found response -func (o *GetPeerSectionNotFound) WithPayload(payload *models.Error) *GetPeerSectionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer section not found response -func (o *GetPeerSectionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerSectionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetPeerSectionDefault General Error - -swagger:response getPeerSectionDefault -*/ -type GetPeerSectionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerSectionDefault creates GetPeerSectionDefault with default headers values -func NewGetPeerSectionDefault(code int) *GetPeerSectionDefault { - if code <= 0 { - code = 500 - } - - return &GetPeerSectionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get peer section default response -func (o *GetPeerSectionDefault) WithStatusCode(code int) *GetPeerSectionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get peer section default response -func (o *GetPeerSectionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get peer section default response -func (o *GetPeerSectionDefault) WithConfigurationVersion(configurationVersion string) *GetPeerSectionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer section default response -func (o *GetPeerSectionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer section default response -func (o *GetPeerSectionDefault) WithPayload(payload *models.Error) *GetPeerSectionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer section default response -func (o *GetPeerSectionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerSectionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer/get_peer_section_urlbuilder.go b/operations/peer/get_peer_section_urlbuilder.go deleted file mode 100644 index 71148d32..00000000 --- a/operations/peer/get_peer_section_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetPeerSectionURL generates an URL for the get peer section operation -type GetPeerSectionURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerSectionURL) WithBasePath(bp string) *GetPeerSectionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerSectionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPeerSectionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_section/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetPeerSectionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPeerSectionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPeerSectionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPeerSectionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPeerSectionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPeerSectionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPeerSectionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer/get_peer_sections.go b/operations/peer/get_peer_sections.go deleted file mode 100644 index e7345051..00000000 --- a/operations/peer/get_peer_sections.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetPeerSectionsHandlerFunc turns a function with the right signature into a get peer sections handler -type GetPeerSectionsHandlerFunc func(GetPeerSectionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPeerSectionsHandlerFunc) Handle(params GetPeerSectionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetPeerSectionsHandler interface for that can handle valid get peer sections params -type GetPeerSectionsHandler interface { - Handle(GetPeerSectionsParams, interface{}) middleware.Responder -} - -// NewGetPeerSections creates a new http.Handler for the get peer sections operation -func NewGetPeerSections(ctx *middleware.Context, handler GetPeerSectionsHandler) *GetPeerSections { - return &GetPeerSections{Context: ctx, Handler: handler} -} - -/* - GetPeerSections swagger:route GET /services/haproxy/configuration/peer_section Peer getPeerSections - -Return an array of peer_section - -Returns an array of all configured peer_section. -*/ -type GetPeerSections struct { - Context *middleware.Context - Handler GetPeerSectionsHandler -} - -func (o *GetPeerSections) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPeerSectionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer/get_peer_sections_parameters.go b/operations/peer/get_peer_sections_parameters.go deleted file mode 100644 index 2ba328de..00000000 --- a/operations/peer/get_peer_sections_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetPeerSectionsParams creates a new GetPeerSectionsParams object -// with the default values initialized. -func NewGetPeerSectionsParams() GetPeerSectionsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetPeerSectionsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetPeerSectionsParams contains all the bound params for the get peer sections operation -// typically these are obtained from a http.Request -// -// swagger:parameters getPeerSections -type GetPeerSectionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPeerSectionsParams() beforehand. -func (o *GetPeerSectionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetPeerSectionsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetPeerSectionsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetPeerSectionsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/peer/get_peer_sections_responses.go b/operations/peer/get_peer_sections_responses.go deleted file mode 100644 index 6338d761..00000000 --- a/operations/peer/get_peer_sections_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetPeerSectionsOKCode is the HTTP code returned for type GetPeerSectionsOK -const GetPeerSectionsOKCode int = 200 - -/* -GetPeerSectionsOK Successful operation - -swagger:response getPeerSectionsOK -*/ -type GetPeerSectionsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.PeerSections `json:"body,omitempty"` -} - -// NewGetPeerSectionsOK creates GetPeerSectionsOK with default headers values -func NewGetPeerSectionsOK() *GetPeerSectionsOK { - - return &GetPeerSectionsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer sections o k response -func (o *GetPeerSectionsOK) WithConfigurationVersion(configurationVersion string) *GetPeerSectionsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer sections o k response -func (o *GetPeerSectionsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer sections o k response -func (o *GetPeerSectionsOK) WithPayload(payload models.PeerSections) *GetPeerSectionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer sections o k response -func (o *GetPeerSectionsOK) SetPayload(payload models.PeerSections) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerSectionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.PeerSections{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetPeerSectionsDefault General Error - -swagger:response getPeerSectionsDefault -*/ -type GetPeerSectionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerSectionsDefault creates GetPeerSectionsDefault with default headers values -func NewGetPeerSectionsDefault(code int) *GetPeerSectionsDefault { - if code <= 0 { - code = 500 - } - - return &GetPeerSectionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get peer sections default response -func (o *GetPeerSectionsDefault) WithStatusCode(code int) *GetPeerSectionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get peer sections default response -func (o *GetPeerSectionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get peer sections default response -func (o *GetPeerSectionsDefault) WithConfigurationVersion(configurationVersion string) *GetPeerSectionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer sections default response -func (o *GetPeerSectionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer sections default response -func (o *GetPeerSectionsDefault) WithPayload(payload *models.Error) *GetPeerSectionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer sections default response -func (o *GetPeerSectionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerSectionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer/get_peer_sections_urlbuilder.go b/operations/peer/get_peer_sections_urlbuilder.go deleted file mode 100644 index 13facf8f..00000000 --- a/operations/peer/get_peer_sections_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetPeerSectionsURL generates an URL for the get peer sections operation -type GetPeerSectionsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerSectionsURL) WithBasePath(bp string) *GetPeerSectionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerSectionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPeerSectionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_section" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPeerSectionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPeerSectionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPeerSectionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPeerSectionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPeerSectionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPeerSectionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer_entry/create_peer_entry.go b/operations/peer_entry/create_peer_entry.go deleted file mode 100644 index b6ba37b2..00000000 --- a/operations/peer_entry/create_peer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreatePeerEntryHandlerFunc turns a function with the right signature into a create peer entry handler -type CreatePeerEntryHandlerFunc func(CreatePeerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreatePeerEntryHandlerFunc) Handle(params CreatePeerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreatePeerEntryHandler interface for that can handle valid create peer entry params -type CreatePeerEntryHandler interface { - Handle(CreatePeerEntryParams, interface{}) middleware.Responder -} - -// NewCreatePeerEntry creates a new http.Handler for the create peer entry operation -func NewCreatePeerEntry(ctx *middleware.Context, handler CreatePeerEntryHandler) *CreatePeerEntry { - return &CreatePeerEntry{Context: ctx, Handler: handler} -} - -/* - CreatePeerEntry swagger:route POST /services/haproxy/configuration/peer_entries PeerEntry createPeerEntry - -Add a new peer_entry - -Adds a new peer entry in the specified peer section in the configuration file. -*/ -type CreatePeerEntry struct { - Context *middleware.Context - Handler CreatePeerEntryHandler -} - -func (o *CreatePeerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreatePeerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer_entry/create_peer_entry_parameters.go b/operations/peer_entry/create_peer_entry_parameters.go deleted file mode 100644 index bc3fae24..00000000 --- a/operations/peer_entry/create_peer_entry_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreatePeerEntryParams creates a new CreatePeerEntryParams object -// with the default values initialized. -func NewCreatePeerEntryParams() CreatePeerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreatePeerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreatePeerEntryParams contains all the bound params for the create peer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters createPeerEntry -type CreatePeerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.PeerEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent peer section name - Required: true - In: query - */ - PeerSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreatePeerEntryParams() beforehand. -func (o *CreatePeerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PeerEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qPeerSection, qhkPeerSection, _ := qs.GetOK("peer_section") - if err := o.bindPeerSection(qPeerSection, qhkPeerSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreatePeerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreatePeerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindPeerSection binds and validates parameter PeerSection from query. -func (o *CreatePeerEntryParams) bindPeerSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("peer_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("peer_section", "query", raw); err != nil { - return err - } - o.PeerSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreatePeerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreatePeerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/peer_entry/create_peer_entry_responses.go b/operations/peer_entry/create_peer_entry_responses.go deleted file mode 100644 index cdf33d77..00000000 --- a/operations/peer_entry/create_peer_entry_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreatePeerEntryCreatedCode is the HTTP code returned for type CreatePeerEntryCreated -const CreatePeerEntryCreatedCode int = 201 - -/* -CreatePeerEntryCreated PeerEntry created - -swagger:response createPeerEntryCreated -*/ -type CreatePeerEntryCreated struct { - - /* - In: Body - */ - Payload *models.PeerEntry `json:"body,omitempty"` -} - -// NewCreatePeerEntryCreated creates CreatePeerEntryCreated with default headers values -func NewCreatePeerEntryCreated() *CreatePeerEntryCreated { - - return &CreatePeerEntryCreated{} -} - -// WithPayload adds the payload to the create peer entry created response -func (o *CreatePeerEntryCreated) WithPayload(payload *models.PeerEntry) *CreatePeerEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer entry created response -func (o *CreatePeerEntryCreated) SetPayload(payload *models.PeerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerEntryAcceptedCode is the HTTP code returned for type CreatePeerEntryAccepted -const CreatePeerEntryAcceptedCode int = 202 - -/* -CreatePeerEntryAccepted Configuration change accepted and reload requested - -swagger:response createPeerEntryAccepted -*/ -type CreatePeerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.PeerEntry `json:"body,omitempty"` -} - -// NewCreatePeerEntryAccepted creates CreatePeerEntryAccepted with default headers values -func NewCreatePeerEntryAccepted() *CreatePeerEntryAccepted { - - return &CreatePeerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the create peer entry accepted response -func (o *CreatePeerEntryAccepted) WithReloadID(reloadID string) *CreatePeerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create peer entry accepted response -func (o *CreatePeerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create peer entry accepted response -func (o *CreatePeerEntryAccepted) WithPayload(payload *models.PeerEntry) *CreatePeerEntryAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer entry accepted response -func (o *CreatePeerEntryAccepted) SetPayload(payload *models.PeerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerEntryBadRequestCode is the HTTP code returned for type CreatePeerEntryBadRequest -const CreatePeerEntryBadRequestCode int = 400 - -/* -CreatePeerEntryBadRequest Bad request - -swagger:response createPeerEntryBadRequest -*/ -type CreatePeerEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerEntryBadRequest creates CreatePeerEntryBadRequest with default headers values -func NewCreatePeerEntryBadRequest() *CreatePeerEntryBadRequest { - - return &CreatePeerEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create peer entry bad request response -func (o *CreatePeerEntryBadRequest) WithConfigurationVersion(configurationVersion string) *CreatePeerEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer entry bad request response -func (o *CreatePeerEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer entry bad request response -func (o *CreatePeerEntryBadRequest) WithPayload(payload *models.Error) *CreatePeerEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer entry bad request response -func (o *CreatePeerEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreatePeerEntryConflictCode is the HTTP code returned for type CreatePeerEntryConflict -const CreatePeerEntryConflictCode int = 409 - -/* -CreatePeerEntryConflict The specified resource already exists - -swagger:response createPeerEntryConflict -*/ -type CreatePeerEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerEntryConflict creates CreatePeerEntryConflict with default headers values -func NewCreatePeerEntryConflict() *CreatePeerEntryConflict { - - return &CreatePeerEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create peer entry conflict response -func (o *CreatePeerEntryConflict) WithConfigurationVersion(configurationVersion string) *CreatePeerEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer entry conflict response -func (o *CreatePeerEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer entry conflict response -func (o *CreatePeerEntryConflict) WithPayload(payload *models.Error) *CreatePeerEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer entry conflict response -func (o *CreatePeerEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreatePeerEntryDefault General Error - -swagger:response createPeerEntryDefault -*/ -type CreatePeerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreatePeerEntryDefault creates CreatePeerEntryDefault with default headers values -func NewCreatePeerEntryDefault(code int) *CreatePeerEntryDefault { - if code <= 0 { - code = 500 - } - - return &CreatePeerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create peer entry default response -func (o *CreatePeerEntryDefault) WithStatusCode(code int) *CreatePeerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create peer entry default response -func (o *CreatePeerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create peer entry default response -func (o *CreatePeerEntryDefault) WithConfigurationVersion(configurationVersion string) *CreatePeerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create peer entry default response -func (o *CreatePeerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create peer entry default response -func (o *CreatePeerEntryDefault) WithPayload(payload *models.Error) *CreatePeerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create peer entry default response -func (o *CreatePeerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreatePeerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer_entry/create_peer_entry_urlbuilder.go b/operations/peer_entry/create_peer_entry_urlbuilder.go deleted file mode 100644 index 15feff03..00000000 --- a/operations/peer_entry/create_peer_entry_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreatePeerEntryURL generates an URL for the create peer entry operation -type CreatePeerEntryURL struct { - ForceReload *bool - PeerSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreatePeerEntryURL) WithBasePath(bp string) *CreatePeerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreatePeerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreatePeerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - peerSectionQ := o.PeerSection - if peerSectionQ != "" { - qs.Set("peer_section", peerSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreatePeerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreatePeerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreatePeerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreatePeerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreatePeerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreatePeerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer_entry/delete_peer_entry.go b/operations/peer_entry/delete_peer_entry.go deleted file mode 100644 index 63b67c60..00000000 --- a/operations/peer_entry/delete_peer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeletePeerEntryHandlerFunc turns a function with the right signature into a delete peer entry handler -type DeletePeerEntryHandlerFunc func(DeletePeerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeletePeerEntryHandlerFunc) Handle(params DeletePeerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeletePeerEntryHandler interface for that can handle valid delete peer entry params -type DeletePeerEntryHandler interface { - Handle(DeletePeerEntryParams, interface{}) middleware.Responder -} - -// NewDeletePeerEntry creates a new http.Handler for the delete peer entry operation -func NewDeletePeerEntry(ctx *middleware.Context, handler DeletePeerEntryHandler) *DeletePeerEntry { - return &DeletePeerEntry{Context: ctx, Handler: handler} -} - -/* - DeletePeerEntry swagger:route DELETE /services/haproxy/configuration/peer_entries/{name} PeerEntry deletePeerEntry - -Delete a peer_entry - -Deletes a peer entry configuration by it's name in the specified peer section. -*/ -type DeletePeerEntry struct { - Context *middleware.Context - Handler DeletePeerEntryHandler -} - -func (o *DeletePeerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeletePeerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer_entry/delete_peer_entry_parameters.go b/operations/peer_entry/delete_peer_entry_parameters.go deleted file mode 100644 index b74618a5..00000000 --- a/operations/peer_entry/delete_peer_entry_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeletePeerEntryParams creates a new DeletePeerEntryParams object -// with the default values initialized. -func NewDeletePeerEntryParams() DeletePeerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeletePeerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeletePeerEntryParams contains all the bound params for the delete peer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters deletePeerEntry -type DeletePeerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*PeerEntry name - Required: true - In: path - */ - Name string - /*Parent peers name - Required: true - In: query - */ - PeerSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeletePeerEntryParams() beforehand. -func (o *DeletePeerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qPeerSection, qhkPeerSection, _ := qs.GetOK("peer_section") - if err := o.bindPeerSection(qPeerSection, qhkPeerSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeletePeerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeletePeerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeletePeerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindPeerSection binds and validates parameter PeerSection from query. -func (o *DeletePeerEntryParams) bindPeerSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("peer_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("peer_section", "query", raw); err != nil { - return err - } - o.PeerSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeletePeerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeletePeerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/peer_entry/delete_peer_entry_responses.go b/operations/peer_entry/delete_peer_entry_responses.go deleted file mode 100644 index 4711ffed..00000000 --- a/operations/peer_entry/delete_peer_entry_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeletePeerEntryAcceptedCode is the HTTP code returned for type DeletePeerEntryAccepted -const DeletePeerEntryAcceptedCode int = 202 - -/* -DeletePeerEntryAccepted Configuration change accepted and reload requested - -swagger:response deletePeerEntryAccepted -*/ -type DeletePeerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeletePeerEntryAccepted creates DeletePeerEntryAccepted with default headers values -func NewDeletePeerEntryAccepted() *DeletePeerEntryAccepted { - - return &DeletePeerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the delete peer entry accepted response -func (o *DeletePeerEntryAccepted) WithReloadID(reloadID string) *DeletePeerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete peer entry accepted response -func (o *DeletePeerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeletePeerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeletePeerEntryNoContentCode is the HTTP code returned for type DeletePeerEntryNoContent -const DeletePeerEntryNoContentCode int = 204 - -/* -DeletePeerEntryNoContent PeerEntry deleted - -swagger:response deletePeerEntryNoContent -*/ -type DeletePeerEntryNoContent struct { -} - -// NewDeletePeerEntryNoContent creates DeletePeerEntryNoContent with default headers values -func NewDeletePeerEntryNoContent() *DeletePeerEntryNoContent { - - return &DeletePeerEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeletePeerEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeletePeerEntryNotFoundCode is the HTTP code returned for type DeletePeerEntryNotFound -const DeletePeerEntryNotFoundCode int = 404 - -/* -DeletePeerEntryNotFound The specified resource was not found - -swagger:response deletePeerEntryNotFound -*/ -type DeletePeerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePeerEntryNotFound creates DeletePeerEntryNotFound with default headers values -func NewDeletePeerEntryNotFound() *DeletePeerEntryNotFound { - - return &DeletePeerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete peer entry not found response -func (o *DeletePeerEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeletePeerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete peer entry not found response -func (o *DeletePeerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete peer entry not found response -func (o *DeletePeerEntryNotFound) WithPayload(payload *models.Error) *DeletePeerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete peer entry not found response -func (o *DeletePeerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePeerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeletePeerEntryDefault General Error - -swagger:response deletePeerEntryDefault -*/ -type DeletePeerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeletePeerEntryDefault creates DeletePeerEntryDefault with default headers values -func NewDeletePeerEntryDefault(code int) *DeletePeerEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeletePeerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete peer entry default response -func (o *DeletePeerEntryDefault) WithStatusCode(code int) *DeletePeerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete peer entry default response -func (o *DeletePeerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete peer entry default response -func (o *DeletePeerEntryDefault) WithConfigurationVersion(configurationVersion string) *DeletePeerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete peer entry default response -func (o *DeletePeerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete peer entry default response -func (o *DeletePeerEntryDefault) WithPayload(payload *models.Error) *DeletePeerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete peer entry default response -func (o *DeletePeerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeletePeerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer_entry/delete_peer_entry_urlbuilder.go b/operations/peer_entry/delete_peer_entry_urlbuilder.go deleted file mode 100644 index 5f7f0bbc..00000000 --- a/operations/peer_entry/delete_peer_entry_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeletePeerEntryURL generates an URL for the delete peer entry operation -type DeletePeerEntryURL struct { - Name string - - ForceReload *bool - PeerSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePeerEntryURL) WithBasePath(bp string) *DeletePeerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeletePeerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeletePeerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeletePeerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - peerSectionQ := o.PeerSection - if peerSectionQ != "" { - qs.Set("peer_section", peerSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeletePeerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeletePeerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeletePeerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeletePeerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeletePeerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeletePeerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer_entry/get_peer_entries.go b/operations/peer_entry/get_peer_entries.go deleted file mode 100644 index 320689cb..00000000 --- a/operations/peer_entry/get_peer_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetPeerEntriesHandlerFunc turns a function with the right signature into a get peer entries handler -type GetPeerEntriesHandlerFunc func(GetPeerEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPeerEntriesHandlerFunc) Handle(params GetPeerEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetPeerEntriesHandler interface for that can handle valid get peer entries params -type GetPeerEntriesHandler interface { - Handle(GetPeerEntriesParams, interface{}) middleware.Responder -} - -// NewGetPeerEntries creates a new http.Handler for the get peer entries operation -func NewGetPeerEntries(ctx *middleware.Context, handler GetPeerEntriesHandler) *GetPeerEntries { - return &GetPeerEntries{Context: ctx, Handler: handler} -} - -/* - GetPeerEntries swagger:route GET /services/haproxy/configuration/peer_entries PeerEntry getPeerEntries - -Return an array of peer_entries - -Returns an array of all peer_entries that are configured in specified peer section. -*/ -type GetPeerEntries struct { - Context *middleware.Context - Handler GetPeerEntriesHandler -} - -func (o *GetPeerEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPeerEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer_entry/get_peer_entries_parameters.go b/operations/peer_entry/get_peer_entries_parameters.go deleted file mode 100644 index 5789fa60..00000000 --- a/operations/peer_entry/get_peer_entries_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetPeerEntriesParams creates a new GetPeerEntriesParams object -// -// There are no default values defined in the spec. -func NewGetPeerEntriesParams() GetPeerEntriesParams { - - return GetPeerEntriesParams{} -} - -// GetPeerEntriesParams contains all the bound params for the get peer entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters getPeerEntries -type GetPeerEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent peer section name - Required: true - In: query - */ - PeerSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPeerEntriesParams() beforehand. -func (o *GetPeerEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qPeerSection, qhkPeerSection, _ := qs.GetOK("peer_section") - if err := o.bindPeerSection(qPeerSection, qhkPeerSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPeerSection binds and validates parameter PeerSection from query. -func (o *GetPeerEntriesParams) bindPeerSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("peer_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("peer_section", "query", raw); err != nil { - return err - } - o.PeerSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetPeerEntriesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/peer_entry/get_peer_entries_responses.go b/operations/peer_entry/get_peer_entries_responses.go deleted file mode 100644 index abae23aa..00000000 --- a/operations/peer_entry/get_peer_entries_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetPeerEntriesOKCode is the HTTP code returned for type GetPeerEntriesOK -const GetPeerEntriesOKCode int = 200 - -/* -GetPeerEntriesOK Successful operation - -swagger:response getPeerEntriesOK -*/ -type GetPeerEntriesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.PeerEntries `json:"body,omitempty"` -} - -// NewGetPeerEntriesOK creates GetPeerEntriesOK with default headers values -func NewGetPeerEntriesOK() *GetPeerEntriesOK { - - return &GetPeerEntriesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer entries o k response -func (o *GetPeerEntriesOK) WithConfigurationVersion(configurationVersion string) *GetPeerEntriesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer entries o k response -func (o *GetPeerEntriesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer entries o k response -func (o *GetPeerEntriesOK) WithPayload(payload models.PeerEntries) *GetPeerEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer entries o k response -func (o *GetPeerEntriesOK) SetPayload(payload models.PeerEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.PeerEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetPeerEntriesDefault General Error - -swagger:response getPeerEntriesDefault -*/ -type GetPeerEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerEntriesDefault creates GetPeerEntriesDefault with default headers values -func NewGetPeerEntriesDefault(code int) *GetPeerEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetPeerEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get peer entries default response -func (o *GetPeerEntriesDefault) WithStatusCode(code int) *GetPeerEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get peer entries default response -func (o *GetPeerEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get peer entries default response -func (o *GetPeerEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetPeerEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer entries default response -func (o *GetPeerEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer entries default response -func (o *GetPeerEntriesDefault) WithPayload(payload *models.Error) *GetPeerEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer entries default response -func (o *GetPeerEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer_entry/get_peer_entries_urlbuilder.go b/operations/peer_entry/get_peer_entries_urlbuilder.go deleted file mode 100644 index 301a0adb..00000000 --- a/operations/peer_entry/get_peer_entries_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetPeerEntriesURL generates an URL for the get peer entries operation -type GetPeerEntriesURL struct { - PeerSection string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerEntriesURL) WithBasePath(bp string) *GetPeerEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPeerEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - peerSectionQ := o.PeerSection - if peerSectionQ != "" { - qs.Set("peer_section", peerSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPeerEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPeerEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPeerEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPeerEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPeerEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPeerEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer_entry/get_peer_entry.go b/operations/peer_entry/get_peer_entry.go deleted file mode 100644 index 8cdc97ee..00000000 --- a/operations/peer_entry/get_peer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetPeerEntryHandlerFunc turns a function with the right signature into a get peer entry handler -type GetPeerEntryHandlerFunc func(GetPeerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetPeerEntryHandlerFunc) Handle(params GetPeerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetPeerEntryHandler interface for that can handle valid get peer entry params -type GetPeerEntryHandler interface { - Handle(GetPeerEntryParams, interface{}) middleware.Responder -} - -// NewGetPeerEntry creates a new http.Handler for the get peer entry operation -func NewGetPeerEntry(ctx *middleware.Context, handler GetPeerEntryHandler) *GetPeerEntry { - return &GetPeerEntry{Context: ctx, Handler: handler} -} - -/* - GetPeerEntry swagger:route GET /services/haproxy/configuration/peer_entries/{name} PeerEntry getPeerEntry - -Return one peer_entry - -Returns one peer_entry configuration by it's name in the specified peer section. -*/ -type GetPeerEntry struct { - Context *middleware.Context - Handler GetPeerEntryHandler -} - -func (o *GetPeerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetPeerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer_entry/get_peer_entry_parameters.go b/operations/peer_entry/get_peer_entry_parameters.go deleted file mode 100644 index 142a4a67..00000000 --- a/operations/peer_entry/get_peer_entry_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetPeerEntryParams creates a new GetPeerEntryParams object -// -// There are no default values defined in the spec. -func NewGetPeerEntryParams() GetPeerEntryParams { - - return GetPeerEntryParams{} -} - -// GetPeerEntryParams contains all the bound params for the get peer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters getPeerEntry -type GetPeerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*PeerEntry name - Required: true - In: path - */ - Name string - /*Parent peers name - Required: true - In: query - */ - PeerSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetPeerEntryParams() beforehand. -func (o *GetPeerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qPeerSection, qhkPeerSection, _ := qs.GetOK("peer_section") - if err := o.bindPeerSection(qPeerSection, qhkPeerSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetPeerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindPeerSection binds and validates parameter PeerSection from query. -func (o *GetPeerEntryParams) bindPeerSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("peer_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("peer_section", "query", raw); err != nil { - return err - } - o.PeerSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetPeerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/peer_entry/get_peer_entry_responses.go b/operations/peer_entry/get_peer_entry_responses.go deleted file mode 100644 index 1f68dd2f..00000000 --- a/operations/peer_entry/get_peer_entry_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetPeerEntryOKCode is the HTTP code returned for type GetPeerEntryOK -const GetPeerEntryOKCode int = 200 - -/* -GetPeerEntryOK Successful operation - -swagger:response getPeerEntryOK -*/ -type GetPeerEntryOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.PeerEntry `json:"body,omitempty"` -} - -// NewGetPeerEntryOK creates GetPeerEntryOK with default headers values -func NewGetPeerEntryOK() *GetPeerEntryOK { - - return &GetPeerEntryOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer entry o k response -func (o *GetPeerEntryOK) WithConfigurationVersion(configurationVersion string) *GetPeerEntryOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer entry o k response -func (o *GetPeerEntryOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer entry o k response -func (o *GetPeerEntryOK) WithPayload(payload *models.PeerEntry) *GetPeerEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer entry o k response -func (o *GetPeerEntryOK) SetPayload(payload *models.PeerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetPeerEntryNotFoundCode is the HTTP code returned for type GetPeerEntryNotFound -const GetPeerEntryNotFoundCode int = 404 - -/* -GetPeerEntryNotFound The specified resource already exists - -swagger:response getPeerEntryNotFound -*/ -type GetPeerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerEntryNotFound creates GetPeerEntryNotFound with default headers values -func NewGetPeerEntryNotFound() *GetPeerEntryNotFound { - - return &GetPeerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get peer entry not found response -func (o *GetPeerEntryNotFound) WithConfigurationVersion(configurationVersion string) *GetPeerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer entry not found response -func (o *GetPeerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer entry not found response -func (o *GetPeerEntryNotFound) WithPayload(payload *models.Error) *GetPeerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer entry not found response -func (o *GetPeerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetPeerEntryDefault General Error - -swagger:response getPeerEntryDefault -*/ -type GetPeerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetPeerEntryDefault creates GetPeerEntryDefault with default headers values -func NewGetPeerEntryDefault(code int) *GetPeerEntryDefault { - if code <= 0 { - code = 500 - } - - return &GetPeerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get peer entry default response -func (o *GetPeerEntryDefault) WithStatusCode(code int) *GetPeerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get peer entry default response -func (o *GetPeerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get peer entry default response -func (o *GetPeerEntryDefault) WithConfigurationVersion(configurationVersion string) *GetPeerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get peer entry default response -func (o *GetPeerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get peer entry default response -func (o *GetPeerEntryDefault) WithPayload(payload *models.Error) *GetPeerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get peer entry default response -func (o *GetPeerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetPeerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer_entry/get_peer_entry_urlbuilder.go b/operations/peer_entry/get_peer_entry_urlbuilder.go deleted file mode 100644 index 0f1f0ab0..00000000 --- a/operations/peer_entry/get_peer_entry_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetPeerEntryURL generates an URL for the get peer entry operation -type GetPeerEntryURL struct { - Name string - - PeerSection string - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerEntryURL) WithBasePath(bp string) *GetPeerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetPeerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetPeerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetPeerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - peerSectionQ := o.PeerSection - if peerSectionQ != "" { - qs.Set("peer_section", peerSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetPeerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetPeerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetPeerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetPeerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetPeerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetPeerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/peer_entry/replace_peer_entry.go b/operations/peer_entry/replace_peer_entry.go deleted file mode 100644 index 7eb4fb68..00000000 --- a/operations/peer_entry/replace_peer_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplacePeerEntryHandlerFunc turns a function with the right signature into a replace peer entry handler -type ReplacePeerEntryHandlerFunc func(ReplacePeerEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplacePeerEntryHandlerFunc) Handle(params ReplacePeerEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplacePeerEntryHandler interface for that can handle valid replace peer entry params -type ReplacePeerEntryHandler interface { - Handle(ReplacePeerEntryParams, interface{}) middleware.Responder -} - -// NewReplacePeerEntry creates a new http.Handler for the replace peer entry operation -func NewReplacePeerEntry(ctx *middleware.Context, handler ReplacePeerEntryHandler) *ReplacePeerEntry { - return &ReplacePeerEntry{Context: ctx, Handler: handler} -} - -/* - ReplacePeerEntry swagger:route PUT /services/haproxy/configuration/peer_entries/{name} PeerEntry replacePeerEntry - -Replace a peer_entry - -Replaces a peer entry configuration by it's name in the specified peer section. -*/ -type ReplacePeerEntry struct { - Context *middleware.Context - Handler ReplacePeerEntryHandler -} - -func (o *ReplacePeerEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplacePeerEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/peer_entry/replace_peer_entry_parameters.go b/operations/peer_entry/replace_peer_entry_parameters.go deleted file mode 100644 index 401d8a98..00000000 --- a/operations/peer_entry/replace_peer_entry_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplacePeerEntryParams creates a new ReplacePeerEntryParams object -// with the default values initialized. -func NewReplacePeerEntryParams() ReplacePeerEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplacePeerEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplacePeerEntryParams contains all the bound params for the replace peer entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters replacePeerEntry -type ReplacePeerEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.PeerEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*PeerEntry name - Required: true - In: path - */ - Name string - /*Parent peers name - Required: true - In: query - */ - PeerSection string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplacePeerEntryParams() beforehand. -func (o *ReplacePeerEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PeerEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qPeerSection, qhkPeerSection, _ := qs.GetOK("peer_section") - if err := o.bindPeerSection(qPeerSection, qhkPeerSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplacePeerEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplacePeerEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplacePeerEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindPeerSection binds and validates parameter PeerSection from query. -func (o *ReplacePeerEntryParams) bindPeerSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("peer_section", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("peer_section", "query", raw); err != nil { - return err - } - o.PeerSection = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplacePeerEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplacePeerEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/peer_entry/replace_peer_entry_responses.go b/operations/peer_entry/replace_peer_entry_responses.go deleted file mode 100644 index 849eba1d..00000000 --- a/operations/peer_entry/replace_peer_entry_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplacePeerEntryOKCode is the HTTP code returned for type ReplacePeerEntryOK -const ReplacePeerEntryOKCode int = 200 - -/* -ReplacePeerEntryOK PeerEntry replaced - -swagger:response replacePeerEntryOK -*/ -type ReplacePeerEntryOK struct { - - /* - In: Body - */ - Payload *models.PeerEntry `json:"body,omitempty"` -} - -// NewReplacePeerEntryOK creates ReplacePeerEntryOK with default headers values -func NewReplacePeerEntryOK() *ReplacePeerEntryOK { - - return &ReplacePeerEntryOK{} -} - -// WithPayload adds the payload to the replace peer entry o k response -func (o *ReplacePeerEntryOK) WithPayload(payload *models.PeerEntry) *ReplacePeerEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace peer entry o k response -func (o *ReplacePeerEntryOK) SetPayload(payload *models.PeerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplacePeerEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplacePeerEntryAcceptedCode is the HTTP code returned for type ReplacePeerEntryAccepted -const ReplacePeerEntryAcceptedCode int = 202 - -/* -ReplacePeerEntryAccepted Configuration change accepted and reload requested - -swagger:response replacePeerEntryAccepted -*/ -type ReplacePeerEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.PeerEntry `json:"body,omitempty"` -} - -// NewReplacePeerEntryAccepted creates ReplacePeerEntryAccepted with default headers values -func NewReplacePeerEntryAccepted() *ReplacePeerEntryAccepted { - - return &ReplacePeerEntryAccepted{} -} - -// WithReloadID adds the reloadId to the replace peer entry accepted response -func (o *ReplacePeerEntryAccepted) WithReloadID(reloadID string) *ReplacePeerEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace peer entry accepted response -func (o *ReplacePeerEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace peer entry accepted response -func (o *ReplacePeerEntryAccepted) WithPayload(payload *models.PeerEntry) *ReplacePeerEntryAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace peer entry accepted response -func (o *ReplacePeerEntryAccepted) SetPayload(payload *models.PeerEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplacePeerEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplacePeerEntryBadRequestCode is the HTTP code returned for type ReplacePeerEntryBadRequest -const ReplacePeerEntryBadRequestCode int = 400 - -/* -ReplacePeerEntryBadRequest Bad request - -swagger:response replacePeerEntryBadRequest -*/ -type ReplacePeerEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplacePeerEntryBadRequest creates ReplacePeerEntryBadRequest with default headers values -func NewReplacePeerEntryBadRequest() *ReplacePeerEntryBadRequest { - - return &ReplacePeerEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace peer entry bad request response -func (o *ReplacePeerEntryBadRequest) WithConfigurationVersion(configurationVersion string) *ReplacePeerEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace peer entry bad request response -func (o *ReplacePeerEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace peer entry bad request response -func (o *ReplacePeerEntryBadRequest) WithPayload(payload *models.Error) *ReplacePeerEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace peer entry bad request response -func (o *ReplacePeerEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplacePeerEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplacePeerEntryNotFoundCode is the HTTP code returned for type ReplacePeerEntryNotFound -const ReplacePeerEntryNotFoundCode int = 404 - -/* -ReplacePeerEntryNotFound The specified resource was not found - -swagger:response replacePeerEntryNotFound -*/ -type ReplacePeerEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplacePeerEntryNotFound creates ReplacePeerEntryNotFound with default headers values -func NewReplacePeerEntryNotFound() *ReplacePeerEntryNotFound { - - return &ReplacePeerEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace peer entry not found response -func (o *ReplacePeerEntryNotFound) WithConfigurationVersion(configurationVersion string) *ReplacePeerEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace peer entry not found response -func (o *ReplacePeerEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace peer entry not found response -func (o *ReplacePeerEntryNotFound) WithPayload(payload *models.Error) *ReplacePeerEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace peer entry not found response -func (o *ReplacePeerEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplacePeerEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplacePeerEntryDefault General Error - -swagger:response replacePeerEntryDefault -*/ -type ReplacePeerEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplacePeerEntryDefault creates ReplacePeerEntryDefault with default headers values -func NewReplacePeerEntryDefault(code int) *ReplacePeerEntryDefault { - if code <= 0 { - code = 500 - } - - return &ReplacePeerEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace peer entry default response -func (o *ReplacePeerEntryDefault) WithStatusCode(code int) *ReplacePeerEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace peer entry default response -func (o *ReplacePeerEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace peer entry default response -func (o *ReplacePeerEntryDefault) WithConfigurationVersion(configurationVersion string) *ReplacePeerEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace peer entry default response -func (o *ReplacePeerEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace peer entry default response -func (o *ReplacePeerEntryDefault) WithPayload(payload *models.Error) *ReplacePeerEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace peer entry default response -func (o *ReplacePeerEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplacePeerEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/peer_entry/replace_peer_entry_urlbuilder.go b/operations/peer_entry/replace_peer_entry_urlbuilder.go deleted file mode 100644 index 6687009b..00000000 --- a/operations/peer_entry/replace_peer_entry_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package peer_entry - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplacePeerEntryURL generates an URL for the replace peer entry operation -type ReplacePeerEntryURL struct { - Name string - - ForceReload *bool - PeerSection string - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplacePeerEntryURL) WithBasePath(bp string) *ReplacePeerEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplacePeerEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplacePeerEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peer_entries/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplacePeerEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - peerSectionQ := o.PeerSection - if peerSectionQ != "" { - qs.Set("peer_section", peerSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplacePeerEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplacePeerEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplacePeerEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplacePeerEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplacePeerEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplacePeerEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/process_manager/create_program.go b/operations/process_manager/create_program.go deleted file mode 100644 index cc971cde..00000000 --- a/operations/process_manager/create_program.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateProgramHandlerFunc turns a function with the right signature into a create program handler -type CreateProgramHandlerFunc func(CreateProgramParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateProgramHandlerFunc) Handle(params CreateProgramParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateProgramHandler interface for that can handle valid create program params -type CreateProgramHandler interface { - Handle(CreateProgramParams, interface{}) middleware.Responder -} - -// NewCreateProgram creates a new http.Handler for the create program operation -func NewCreateProgram(ctx *middleware.Context, handler CreateProgramHandler) *CreateProgram { - return &CreateProgram{Context: ctx, Handler: handler} -} - -/* - CreateProgram swagger:route POST /services/haproxy/configuration/programs ProcessManager createProgram - -# Add a program - -Adds a new program to the process-manager configuration file. -*/ -type CreateProgram struct { - Context *middleware.Context - Handler CreateProgramHandler -} - -func (o *CreateProgram) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateProgramParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/process_manager/create_program_parameters.go b/operations/process_manager/create_program_parameters.go deleted file mode 100644 index d8c28ebd..00000000 --- a/operations/process_manager/create_program_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateProgramParams creates a new CreateProgramParams object -// with the default values initialized. -func NewCreateProgramParams() CreateProgramParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateProgramParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateProgramParams contains all the bound params for the create program operation -// typically these are obtained from a http.Request -// -// swagger:parameters createProgram -type CreateProgramParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Program - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateProgramParams() beforehand. -func (o *CreateProgramParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Program - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateProgramParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateProgramParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateProgramParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateProgramParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/process_manager/create_program_responses.go b/operations/process_manager/create_program_responses.go deleted file mode 100644 index 73f767bd..00000000 --- a/operations/process_manager/create_program_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateProgramCreatedCode is the HTTP code returned for type CreateProgramCreated -const CreateProgramCreatedCode int = 201 - -/* -CreateProgramCreated Program created - -swagger:response createProgramCreated -*/ -type CreateProgramCreated struct { - - /* - In: Body - */ - Payload *models.Program `json:"body,omitempty"` -} - -// NewCreateProgramCreated creates CreateProgramCreated with default headers values -func NewCreateProgramCreated() *CreateProgramCreated { - - return &CreateProgramCreated{} -} - -// WithPayload adds the payload to the create program created response -func (o *CreateProgramCreated) WithPayload(payload *models.Program) *CreateProgramCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create program created response -func (o *CreateProgramCreated) SetPayload(payload *models.Program) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateProgramCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateProgramAcceptedCode is the HTTP code returned for type CreateProgramAccepted -const CreateProgramAcceptedCode int = 202 - -/* -CreateProgramAccepted Configuration change accepted and reload requested - -swagger:response createProgramAccepted -*/ -type CreateProgramAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Program `json:"body,omitempty"` -} - -// NewCreateProgramAccepted creates CreateProgramAccepted with default headers values -func NewCreateProgramAccepted() *CreateProgramAccepted { - - return &CreateProgramAccepted{} -} - -// WithReloadID adds the reloadId to the create program accepted response -func (o *CreateProgramAccepted) WithReloadID(reloadID string) *CreateProgramAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create program accepted response -func (o *CreateProgramAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create program accepted response -func (o *CreateProgramAccepted) WithPayload(payload *models.Program) *CreateProgramAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create program accepted response -func (o *CreateProgramAccepted) SetPayload(payload *models.Program) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateProgramAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateProgramBadRequestCode is the HTTP code returned for type CreateProgramBadRequest -const CreateProgramBadRequestCode int = 400 - -/* -CreateProgramBadRequest Bad request - -swagger:response createProgramBadRequest -*/ -type CreateProgramBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateProgramBadRequest creates CreateProgramBadRequest with default headers values -func NewCreateProgramBadRequest() *CreateProgramBadRequest { - - return &CreateProgramBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create program bad request response -func (o *CreateProgramBadRequest) WithConfigurationVersion(configurationVersion string) *CreateProgramBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create program bad request response -func (o *CreateProgramBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create program bad request response -func (o *CreateProgramBadRequest) WithPayload(payload *models.Error) *CreateProgramBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create program bad request response -func (o *CreateProgramBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateProgramBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateProgramConflictCode is the HTTP code returned for type CreateProgramConflict -const CreateProgramConflictCode int = 409 - -/* -CreateProgramConflict The specified resource already exists - -swagger:response createProgramConflict -*/ -type CreateProgramConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateProgramConflict creates CreateProgramConflict with default headers values -func NewCreateProgramConflict() *CreateProgramConflict { - - return &CreateProgramConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create program conflict response -func (o *CreateProgramConflict) WithConfigurationVersion(configurationVersion string) *CreateProgramConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create program conflict response -func (o *CreateProgramConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create program conflict response -func (o *CreateProgramConflict) WithPayload(payload *models.Error) *CreateProgramConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create program conflict response -func (o *CreateProgramConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateProgramConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateProgramDefault General Error - -swagger:response createProgramDefault -*/ -type CreateProgramDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateProgramDefault creates CreateProgramDefault with default headers values -func NewCreateProgramDefault(code int) *CreateProgramDefault { - if code <= 0 { - code = 500 - } - - return &CreateProgramDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create program default response -func (o *CreateProgramDefault) WithStatusCode(code int) *CreateProgramDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create program default response -func (o *CreateProgramDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create program default response -func (o *CreateProgramDefault) WithConfigurationVersion(configurationVersion string) *CreateProgramDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create program default response -func (o *CreateProgramDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create program default response -func (o *CreateProgramDefault) WithPayload(payload *models.Error) *CreateProgramDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create program default response -func (o *CreateProgramDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateProgramDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/process_manager/create_program_urlbuilder.go b/operations/process_manager/create_program_urlbuilder.go deleted file mode 100644 index d321c588..00000000 --- a/operations/process_manager/create_program_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateProgramURL generates an URL for the create program operation -type CreateProgramURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateProgramURL) WithBasePath(bp string) *CreateProgramURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateProgramURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateProgramURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/programs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateProgramURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateProgramURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateProgramURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateProgramURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateProgramURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateProgramURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/process_manager/delete_program.go b/operations/process_manager/delete_program.go deleted file mode 100644 index f1062db8..00000000 --- a/operations/process_manager/delete_program.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteProgramHandlerFunc turns a function with the right signature into a delete program handler -type DeleteProgramHandlerFunc func(DeleteProgramParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteProgramHandlerFunc) Handle(params DeleteProgramParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteProgramHandler interface for that can handle valid delete program params -type DeleteProgramHandler interface { - Handle(DeleteProgramParams, interface{}) middleware.Responder -} - -// NewDeleteProgram creates a new http.Handler for the delete program operation -func NewDeleteProgram(ctx *middleware.Context, handler DeleteProgramHandler) *DeleteProgram { - return &DeleteProgram{Context: ctx, Handler: handler} -} - -/* - DeleteProgram swagger:route DELETE /services/haproxy/configuration/programs/{name} ProcessManager deleteProgram - -# Delete a program - -Deletes a program from the process-manager configuration file by its name. -*/ -type DeleteProgram struct { - Context *middleware.Context - Handler DeleteProgramHandler -} - -func (o *DeleteProgram) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteProgramParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/process_manager/delete_program_parameters.go b/operations/process_manager/delete_program_parameters.go deleted file mode 100644 index 92292d93..00000000 --- a/operations/process_manager/delete_program_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteProgramParams creates a new DeleteProgramParams object -// with the default values initialized. -func NewDeleteProgramParams() DeleteProgramParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteProgramParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteProgramParams contains all the bound params for the delete program operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteProgram -type DeleteProgramParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Program name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteProgramParams() beforehand. -func (o *DeleteProgramParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteProgramParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteProgramParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteProgramParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteProgramParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteProgramParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/process_manager/delete_program_responses.go b/operations/process_manager/delete_program_responses.go deleted file mode 100644 index c72bd61a..00000000 --- a/operations/process_manager/delete_program_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteProgramAcceptedCode is the HTTP code returned for type DeleteProgramAccepted -const DeleteProgramAcceptedCode int = 202 - -/* -DeleteProgramAccepted Configuration change accepted and reload requested - -swagger:response deleteProgramAccepted -*/ -type DeleteProgramAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteProgramAccepted creates DeleteProgramAccepted with default headers values -func NewDeleteProgramAccepted() *DeleteProgramAccepted { - - return &DeleteProgramAccepted{} -} - -// WithReloadID adds the reloadId to the delete program accepted response -func (o *DeleteProgramAccepted) WithReloadID(reloadID string) *DeleteProgramAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete program accepted response -func (o *DeleteProgramAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteProgramAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteProgramNoContentCode is the HTTP code returned for type DeleteProgramNoContent -const DeleteProgramNoContentCode int = 204 - -/* -DeleteProgramNoContent Program deleted - -swagger:response deleteProgramNoContent -*/ -type DeleteProgramNoContent struct { -} - -// NewDeleteProgramNoContent creates DeleteProgramNoContent with default headers values -func NewDeleteProgramNoContent() *DeleteProgramNoContent { - - return &DeleteProgramNoContent{} -} - -// WriteResponse to the client -func (o *DeleteProgramNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteProgramNotFoundCode is the HTTP code returned for type DeleteProgramNotFound -const DeleteProgramNotFoundCode int = 404 - -/* -DeleteProgramNotFound The specified resource was not found - -swagger:response deleteProgramNotFound -*/ -type DeleteProgramNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteProgramNotFound creates DeleteProgramNotFound with default headers values -func NewDeleteProgramNotFound() *DeleteProgramNotFound { - - return &DeleteProgramNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete program not found response -func (o *DeleteProgramNotFound) WithConfigurationVersion(configurationVersion string) *DeleteProgramNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete program not found response -func (o *DeleteProgramNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete program not found response -func (o *DeleteProgramNotFound) WithPayload(payload *models.Error) *DeleteProgramNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete program not found response -func (o *DeleteProgramNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteProgramNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteProgramDefault General Error - -swagger:response deleteProgramDefault -*/ -type DeleteProgramDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteProgramDefault creates DeleteProgramDefault with default headers values -func NewDeleteProgramDefault(code int) *DeleteProgramDefault { - if code <= 0 { - code = 500 - } - - return &DeleteProgramDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete program default response -func (o *DeleteProgramDefault) WithStatusCode(code int) *DeleteProgramDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete program default response -func (o *DeleteProgramDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete program default response -func (o *DeleteProgramDefault) WithConfigurationVersion(configurationVersion string) *DeleteProgramDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete program default response -func (o *DeleteProgramDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete program default response -func (o *DeleteProgramDefault) WithPayload(payload *models.Error) *DeleteProgramDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete program default response -func (o *DeleteProgramDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteProgramDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/process_manager/delete_program_urlbuilder.go b/operations/process_manager/delete_program_urlbuilder.go deleted file mode 100644 index 359024da..00000000 --- a/operations/process_manager/delete_program_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteProgramURL generates an URL for the delete program operation -type DeleteProgramURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteProgramURL) WithBasePath(bp string) *DeleteProgramURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteProgramURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteProgramURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/programs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteProgramURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteProgramURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteProgramURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteProgramURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteProgramURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteProgramURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteProgramURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/process_manager/get_program.go b/operations/process_manager/get_program.go deleted file mode 100644 index b9a8fd81..00000000 --- a/operations/process_manager/get_program.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetProgramHandlerFunc turns a function with the right signature into a get program handler -type GetProgramHandlerFunc func(GetProgramParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetProgramHandlerFunc) Handle(params GetProgramParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetProgramHandler interface for that can handle valid get program params -type GetProgramHandler interface { - Handle(GetProgramParams, interface{}) middleware.Responder -} - -// NewGetProgram creates a new http.Handler for the get program operation -func NewGetProgram(ctx *middleware.Context, handler GetProgramHandler) *GetProgram { - return &GetProgram{Context: ctx, Handler: handler} -} - -/* - GetProgram swagger:route GET /services/haproxy/configuration/programs/{name} ProcessManager getProgram - -# Return a program - -Returns one program by its name from the process-manager configuration file. -*/ -type GetProgram struct { - Context *middleware.Context - Handler GetProgramHandler -} - -func (o *GetProgram) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetProgramParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/process_manager/get_program_parameters.go b/operations/process_manager/get_program_parameters.go deleted file mode 100644 index 6fb555e0..00000000 --- a/operations/process_manager/get_program_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetProgramParams creates a new GetProgramParams object -// -// There are no default values defined in the spec. -func NewGetProgramParams() GetProgramParams { - - return GetProgramParams{} -} - -// GetProgramParams contains all the bound params for the get program operation -// typically these are obtained from a http.Request -// -// swagger:parameters getProgram -type GetProgramParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Program name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetProgramParams() beforehand. -func (o *GetProgramParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetProgramParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetProgramParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/process_manager/get_program_responses.go b/operations/process_manager/get_program_responses.go deleted file mode 100644 index ad2515da..00000000 --- a/operations/process_manager/get_program_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetProgramOKCode is the HTTP code returned for type GetProgramOK -const GetProgramOKCode int = 200 - -/* -GetProgramOK Successful operation - -swagger:response getProgramOK -*/ -type GetProgramOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Program `json:"body,omitempty"` -} - -// NewGetProgramOK creates GetProgramOK with default headers values -func NewGetProgramOK() *GetProgramOK { - - return &GetProgramOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get program o k response -func (o *GetProgramOK) WithConfigurationVersion(configurationVersion string) *GetProgramOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get program o k response -func (o *GetProgramOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get program o k response -func (o *GetProgramOK) WithPayload(payload *models.Program) *GetProgramOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get program o k response -func (o *GetProgramOK) SetPayload(payload *models.Program) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetProgramOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetProgramNotFoundCode is the HTTP code returned for type GetProgramNotFound -const GetProgramNotFoundCode int = 404 - -/* -GetProgramNotFound The specified resource was not found - -swagger:response getProgramNotFound -*/ -type GetProgramNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetProgramNotFound creates GetProgramNotFound with default headers values -func NewGetProgramNotFound() *GetProgramNotFound { - - return &GetProgramNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get program not found response -func (o *GetProgramNotFound) WithConfigurationVersion(configurationVersion string) *GetProgramNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get program not found response -func (o *GetProgramNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get program not found response -func (o *GetProgramNotFound) WithPayload(payload *models.Error) *GetProgramNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get program not found response -func (o *GetProgramNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetProgramNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetProgramDefault General Error - -swagger:response getProgramDefault -*/ -type GetProgramDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetProgramDefault creates GetProgramDefault with default headers values -func NewGetProgramDefault(code int) *GetProgramDefault { - if code <= 0 { - code = 500 - } - - return &GetProgramDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get program default response -func (o *GetProgramDefault) WithStatusCode(code int) *GetProgramDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get program default response -func (o *GetProgramDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get program default response -func (o *GetProgramDefault) WithConfigurationVersion(configurationVersion string) *GetProgramDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get program default response -func (o *GetProgramDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get program default response -func (o *GetProgramDefault) WithPayload(payload *models.Error) *GetProgramDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get program default response -func (o *GetProgramDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetProgramDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/process_manager/get_program_urlbuilder.go b/operations/process_manager/get_program_urlbuilder.go deleted file mode 100644 index 63cdb011..00000000 --- a/operations/process_manager/get_program_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetProgramURL generates an URL for the get program operation -type GetProgramURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetProgramURL) WithBasePath(bp string) *GetProgramURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetProgramURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetProgramURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/programs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetProgramURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetProgramURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetProgramURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetProgramURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetProgramURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetProgramURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetProgramURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/process_manager/get_programs.go b/operations/process_manager/get_programs.go deleted file mode 100644 index a0d3060f..00000000 --- a/operations/process_manager/get_programs.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetProgramsHandlerFunc turns a function with the right signature into a get programs handler -type GetProgramsHandlerFunc func(GetProgramsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetProgramsHandlerFunc) Handle(params GetProgramsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetProgramsHandler interface for that can handle valid get programs params -type GetProgramsHandler interface { - Handle(GetProgramsParams, interface{}) middleware.Responder -} - -// NewGetPrograms creates a new http.Handler for the get programs operation -func NewGetPrograms(ctx *middleware.Context, handler GetProgramsHandler) *GetPrograms { - return &GetPrograms{Context: ctx, Handler: handler} -} - -/* - GetPrograms swagger:route GET /services/haproxy/configuration/programs ProcessManager getPrograms - -# Return an array of programs - -Returns an array of all configured programs in the process-manager configuration file. -*/ -type GetPrograms struct { - Context *middleware.Context - Handler GetProgramsHandler -} - -func (o *GetPrograms) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetProgramsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/process_manager/get_programs_parameters.go b/operations/process_manager/get_programs_parameters.go deleted file mode 100644 index 53a720af..00000000 --- a/operations/process_manager/get_programs_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetProgramsParams creates a new GetProgramsParams object -// -// There are no default values defined in the spec. -func NewGetProgramsParams() GetProgramsParams { - - return GetProgramsParams{} -} - -// GetProgramsParams contains all the bound params for the get programs operation -// typically these are obtained from a http.Request -// -// swagger:parameters getPrograms -type GetProgramsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetProgramsParams() beforehand. -func (o *GetProgramsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetProgramsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/process_manager/get_programs_responses.go b/operations/process_manager/get_programs_responses.go deleted file mode 100644 index ed800e78..00000000 --- a/operations/process_manager/get_programs_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetProgramsOKCode is the HTTP code returned for type GetProgramsOK -const GetProgramsOKCode int = 200 - -/* -GetProgramsOK Successful operation - -swagger:response getProgramsOK -*/ -type GetProgramsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Programs `json:"body,omitempty"` -} - -// NewGetProgramsOK creates GetProgramsOK with default headers values -func NewGetProgramsOK() *GetProgramsOK { - - return &GetProgramsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get programs o k response -func (o *GetProgramsOK) WithConfigurationVersion(configurationVersion string) *GetProgramsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get programs o k response -func (o *GetProgramsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get programs o k response -func (o *GetProgramsOK) WithPayload(payload models.Programs) *GetProgramsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get programs o k response -func (o *GetProgramsOK) SetPayload(payload models.Programs) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetProgramsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Programs{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetProgramsDefault General Error - -swagger:response getProgramsDefault -*/ -type GetProgramsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetProgramsDefault creates GetProgramsDefault with default headers values -func NewGetProgramsDefault(code int) *GetProgramsDefault { - if code <= 0 { - code = 500 - } - - return &GetProgramsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get programs default response -func (o *GetProgramsDefault) WithStatusCode(code int) *GetProgramsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get programs default response -func (o *GetProgramsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get programs default response -func (o *GetProgramsDefault) WithConfigurationVersion(configurationVersion string) *GetProgramsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get programs default response -func (o *GetProgramsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get programs default response -func (o *GetProgramsDefault) WithPayload(payload *models.Error) *GetProgramsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get programs default response -func (o *GetProgramsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetProgramsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/process_manager/get_programs_urlbuilder.go b/operations/process_manager/get_programs_urlbuilder.go deleted file mode 100644 index 0ccc1c41..00000000 --- a/operations/process_manager/get_programs_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetProgramsURL generates an URL for the get programs operation -type GetProgramsURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetProgramsURL) WithBasePath(bp string) *GetProgramsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetProgramsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetProgramsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/programs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetProgramsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetProgramsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetProgramsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetProgramsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetProgramsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetProgramsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/process_manager/replace_program.go b/operations/process_manager/replace_program.go deleted file mode 100644 index 3b5aaff9..00000000 --- a/operations/process_manager/replace_program.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceProgramHandlerFunc turns a function with the right signature into a replace program handler -type ReplaceProgramHandlerFunc func(ReplaceProgramParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceProgramHandlerFunc) Handle(params ReplaceProgramParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceProgramHandler interface for that can handle valid replace program params -type ReplaceProgramHandler interface { - Handle(ReplaceProgramParams, interface{}) middleware.Responder -} - -// NewReplaceProgram creates a new http.Handler for the replace program operation -func NewReplaceProgram(ctx *middleware.Context, handler ReplaceProgramHandler) *ReplaceProgram { - return &ReplaceProgram{Context: ctx, Handler: handler} -} - -/* - ReplaceProgram swagger:route PUT /services/haproxy/configuration/programs/{name} ProcessManager replaceProgram - -# Replace a program - -Replaces a program from the process-manager configuration by its name. -*/ -type ReplaceProgram struct { - Context *middleware.Context - Handler ReplaceProgramHandler -} - -func (o *ReplaceProgram) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceProgramParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/process_manager/replace_program_parameters.go b/operations/process_manager/replace_program_parameters.go deleted file mode 100644 index cfd4ae0d..00000000 --- a/operations/process_manager/replace_program_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceProgramParams creates a new ReplaceProgramParams object -// with the default values initialized. -func NewReplaceProgramParams() ReplaceProgramParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceProgramParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceProgramParams contains all the bound params for the replace program operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceProgram -type ReplaceProgramParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Program - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Program name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceProgramParams() beforehand. -func (o *ReplaceProgramParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Program - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceProgramParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceProgramParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceProgramParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceProgramParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceProgramParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/process_manager/replace_program_responses.go b/operations/process_manager/replace_program_responses.go deleted file mode 100644 index 8a9bb163..00000000 --- a/operations/process_manager/replace_program_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceProgramOKCode is the HTTP code returned for type ReplaceProgramOK -const ReplaceProgramOKCode int = 200 - -/* -ReplaceProgramOK Program replaced - -swagger:response replaceProgramOK -*/ -type ReplaceProgramOK struct { - - /* - In: Body - */ - Payload *models.Program `json:"body,omitempty"` -} - -// NewReplaceProgramOK creates ReplaceProgramOK with default headers values -func NewReplaceProgramOK() *ReplaceProgramOK { - - return &ReplaceProgramOK{} -} - -// WithPayload adds the payload to the replace program o k response -func (o *ReplaceProgramOK) WithPayload(payload *models.Program) *ReplaceProgramOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace program o k response -func (o *ReplaceProgramOK) SetPayload(payload *models.Program) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceProgramOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceProgramAcceptedCode is the HTTP code returned for type ReplaceProgramAccepted -const ReplaceProgramAcceptedCode int = 202 - -/* -ReplaceProgramAccepted Configuration change accepted and reload requested - -swagger:response replaceProgramAccepted -*/ -type ReplaceProgramAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Program `json:"body,omitempty"` -} - -// NewReplaceProgramAccepted creates ReplaceProgramAccepted with default headers values -func NewReplaceProgramAccepted() *ReplaceProgramAccepted { - - return &ReplaceProgramAccepted{} -} - -// WithReloadID adds the reloadId to the replace program accepted response -func (o *ReplaceProgramAccepted) WithReloadID(reloadID string) *ReplaceProgramAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace program accepted response -func (o *ReplaceProgramAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace program accepted response -func (o *ReplaceProgramAccepted) WithPayload(payload *models.Program) *ReplaceProgramAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace program accepted response -func (o *ReplaceProgramAccepted) SetPayload(payload *models.Program) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceProgramAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceProgramBadRequestCode is the HTTP code returned for type ReplaceProgramBadRequest -const ReplaceProgramBadRequestCode int = 400 - -/* -ReplaceProgramBadRequest Bad request - -swagger:response replaceProgramBadRequest -*/ -type ReplaceProgramBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceProgramBadRequest creates ReplaceProgramBadRequest with default headers values -func NewReplaceProgramBadRequest() *ReplaceProgramBadRequest { - - return &ReplaceProgramBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace program bad request response -func (o *ReplaceProgramBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceProgramBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace program bad request response -func (o *ReplaceProgramBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace program bad request response -func (o *ReplaceProgramBadRequest) WithPayload(payload *models.Error) *ReplaceProgramBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace program bad request response -func (o *ReplaceProgramBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceProgramBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceProgramNotFoundCode is the HTTP code returned for type ReplaceProgramNotFound -const ReplaceProgramNotFoundCode int = 404 - -/* -ReplaceProgramNotFound The specified resource was not found - -swagger:response replaceProgramNotFound -*/ -type ReplaceProgramNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceProgramNotFound creates ReplaceProgramNotFound with default headers values -func NewReplaceProgramNotFound() *ReplaceProgramNotFound { - - return &ReplaceProgramNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace program not found response -func (o *ReplaceProgramNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceProgramNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace program not found response -func (o *ReplaceProgramNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace program not found response -func (o *ReplaceProgramNotFound) WithPayload(payload *models.Error) *ReplaceProgramNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace program not found response -func (o *ReplaceProgramNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceProgramNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceProgramDefault General Error - -swagger:response replaceProgramDefault -*/ -type ReplaceProgramDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceProgramDefault creates ReplaceProgramDefault with default headers values -func NewReplaceProgramDefault(code int) *ReplaceProgramDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceProgramDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace program default response -func (o *ReplaceProgramDefault) WithStatusCode(code int) *ReplaceProgramDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace program default response -func (o *ReplaceProgramDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace program default response -func (o *ReplaceProgramDefault) WithConfigurationVersion(configurationVersion string) *ReplaceProgramDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace program default response -func (o *ReplaceProgramDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace program default response -func (o *ReplaceProgramDefault) WithPayload(payload *models.Error) *ReplaceProgramDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace program default response -func (o *ReplaceProgramDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceProgramDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/process_manager/replace_program_urlbuilder.go b/operations/process_manager/replace_program_urlbuilder.go deleted file mode 100644 index 09ba4217..00000000 --- a/operations/process_manager/replace_program_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package process_manager - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceProgramURL generates an URL for the replace program operation -type ReplaceProgramURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceProgramURL) WithBasePath(bp string) *ReplaceProgramURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceProgramURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceProgramURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/programs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceProgramURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceProgramURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceProgramURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceProgramURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceProgramURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceProgramURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceProgramURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_defaults.go b/operations/quic_initial_rule/create_quic_initial_rule_defaults.go deleted file mode 100644 index 47f12fa1..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a create QUIC initial rule defaults handler -type CreateQUICInitialRuleDefaultsHandlerFunc func(CreateQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateQUICInitialRuleDefaultsHandlerFunc) Handle(params CreateQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateQUICInitialRuleDefaultsHandler interface for that can handle valid create QUIC initial rule defaults params -type CreateQUICInitialRuleDefaultsHandler interface { - Handle(CreateQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateQUICInitialRuleDefaults creates a new http.Handler for the create QUIC initial rule defaults operation -func NewCreateQUICInitialRuleDefaults(ctx *middleware.Context, handler CreateQUICInitialRuleDefaultsHandler) *CreateQUICInitialRuleDefaults { - return &CreateQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateQUICInitialRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index} QUICInitialRule createQuicInitialRuleDefaults - -# Add a new QUIC Initial Rule - -Adds a new QUIC Initial Rule of the specified type in the specified parent. -*/ -type CreateQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler CreateQUICInitialRuleDefaultsHandler -} - -func (o *CreateQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/create_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index c43e6439..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateQUICInitialRuleDefaultsParams creates a new CreateQUICInitialRuleDefaultsParams object -// with the default values initialized. -func NewCreateQUICInitialRuleDefaultsParams() CreateQUICInitialRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateQUICInitialRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateQUICInitialRuleDefaultsParams contains all the bound params for the create QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createQUICInitialRuleDefaults -type CreateQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.QUICInitialRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateQUICInitialRuleDefaultsParams() beforehand. -func (o *CreateQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateQUICInitialRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateQUICInitialRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateQUICInitialRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateQUICInitialRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/create_quic_initial_rule_defaults_responses.go deleted file mode 100644 index 71e046d2..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateQUICInitialRuleDefaultsCreatedCode is the HTTP code returned for type CreateQUICInitialRuleDefaultsCreated -const CreateQUICInitialRuleDefaultsCreatedCode int = 201 - -/* -CreateQUICInitialRuleDefaultsCreated HTTP Response Rule created - -swagger:response createQuicInitialRuleDefaultsCreated -*/ -type CreateQUICInitialRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleDefaultsCreated creates CreateQUICInitialRuleDefaultsCreated with default headers values -func NewCreateQUICInitialRuleDefaultsCreated() *CreateQUICInitialRuleDefaultsCreated { - - return &CreateQUICInitialRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Quic initial rule defaults created response -func (o *CreateQUICInitialRuleDefaultsCreated) WithPayload(payload *models.QUICInitialRule) *CreateQUICInitialRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule defaults created response -func (o *CreateQUICInitialRuleDefaultsCreated) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleDefaultsAcceptedCode is the HTTP code returned for type CreateQUICInitialRuleDefaultsAccepted -const CreateQUICInitialRuleDefaultsAcceptedCode int = 202 - -/* -CreateQUICInitialRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createQuicInitialRuleDefaultsAccepted -*/ -type CreateQUICInitialRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleDefaultsAccepted creates CreateQUICInitialRuleDefaultsAccepted with default headers values -func NewCreateQUICInitialRuleDefaultsAccepted() *CreateQUICInitialRuleDefaultsAccepted { - - return &CreateQUICInitialRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Quic initial rule defaults accepted response -func (o *CreateQUICInitialRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateQUICInitialRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Quic initial rule defaults accepted response -func (o *CreateQUICInitialRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Quic initial rule defaults accepted response -func (o *CreateQUICInitialRuleDefaultsAccepted) WithPayload(payload *models.QUICInitialRule) *CreateQUICInitialRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule defaults accepted response -func (o *CreateQUICInitialRuleDefaultsAccepted) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleDefaultsBadRequestCode is the HTTP code returned for type CreateQUICInitialRuleDefaultsBadRequest -const CreateQUICInitialRuleDefaultsBadRequestCode int = 400 - -/* -CreateQUICInitialRuleDefaultsBadRequest Bad request - -swagger:response createQuicInitialRuleDefaultsBadRequest -*/ -type CreateQUICInitialRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleDefaultsBadRequest creates CreateQUICInitialRuleDefaultsBadRequest with default headers values -func NewCreateQUICInitialRuleDefaultsBadRequest() *CreateQUICInitialRuleDefaultsBadRequest { - - return &CreateQUICInitialRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Quic initial rule defaults bad request response -func (o *CreateQUICInitialRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Quic initial rule defaults bad request response -func (o *CreateQUICInitialRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Quic initial rule defaults bad request response -func (o *CreateQUICInitialRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateQUICInitialRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule defaults bad request response -func (o *CreateQUICInitialRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleDefaultsConflictCode is the HTTP code returned for type CreateQUICInitialRuleDefaultsConflict -const CreateQUICInitialRuleDefaultsConflictCode int = 409 - -/* -CreateQUICInitialRuleDefaultsConflict The specified resource already exists - -swagger:response createQuicInitialRuleDefaultsConflict -*/ -type CreateQUICInitialRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleDefaultsConflict creates CreateQUICInitialRuleDefaultsConflict with default headers values -func NewCreateQUICInitialRuleDefaultsConflict() *CreateQUICInitialRuleDefaultsConflict { - - return &CreateQUICInitialRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Quic initial rule defaults conflict response -func (o *CreateQUICInitialRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Quic initial rule defaults conflict response -func (o *CreateQUICInitialRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Quic initial rule defaults conflict response -func (o *CreateQUICInitialRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateQUICInitialRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule defaults conflict response -func (o *CreateQUICInitialRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateQUICInitialRuleDefaultsDefault General Error - -swagger:response createQuicInitialRuleDefaultsDefault -*/ -type CreateQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleDefaultsDefault creates CreateQUICInitialRuleDefaultsDefault with default headers values -func NewCreateQUICInitialRuleDefaultsDefault(code int) *CreateQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *CreateQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create QUIC initial rule defaults default response -func (o *CreateQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/create_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index 92b40b7d..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateQUICInitialRuleDefaultsURL generates an URL for the create QUIC initial rule defaults operation -type CreateQUICInitialRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateQUICInitialRuleDefaultsURL) WithBasePath(bp string) *CreateQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateQUICInitialRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_frontend.go b/operations/quic_initial_rule/create_quic_initial_rule_frontend.go deleted file mode 100644 index 162c1624..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a create QUIC initial rule frontend handler -type CreateQUICInitialRuleFrontendHandlerFunc func(CreateQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateQUICInitialRuleFrontendHandlerFunc) Handle(params CreateQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateQUICInitialRuleFrontendHandler interface for that can handle valid create QUIC initial rule frontend params -type CreateQUICInitialRuleFrontendHandler interface { - Handle(CreateQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateQUICInitialRuleFrontend creates a new http.Handler for the create QUIC initial rule frontend operation -func NewCreateQUICInitialRuleFrontend(ctx *middleware.Context, handler CreateQUICInitialRuleFrontendHandler) *CreateQUICInitialRuleFrontend { - return &CreateQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateQUICInitialRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index} QUICInitialRule createQuicInitialRuleFrontend - -# Add a new QUIC Initial Rule - -Adds a new QUIC Initial Rule of the specified type in the specified parent. -*/ -type CreateQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler CreateQUICInitialRuleFrontendHandler -} - -func (o *CreateQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/create_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index 54bc1a59..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateQUICInitialRuleFrontendParams creates a new CreateQUICInitialRuleFrontendParams object -// with the default values initialized. -func NewCreateQUICInitialRuleFrontendParams() CreateQUICInitialRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateQUICInitialRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateQUICInitialRuleFrontendParams contains all the bound params for the create QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createQUICInitialRuleFrontend -type CreateQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.QUICInitialRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateQUICInitialRuleFrontendParams() beforehand. -func (o *CreateQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateQUICInitialRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateQUICInitialRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateQUICInitialRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateQUICInitialRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/create_quic_initial_rule_frontend_responses.go deleted file mode 100644 index 2dca652f..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateQUICInitialRuleFrontendCreatedCode is the HTTP code returned for type CreateQUICInitialRuleFrontendCreated -const CreateQUICInitialRuleFrontendCreatedCode int = 201 - -/* -CreateQUICInitialRuleFrontendCreated HTTP Response Rule created - -swagger:response createQuicInitialRuleFrontendCreated -*/ -type CreateQUICInitialRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleFrontendCreated creates CreateQUICInitialRuleFrontendCreated with default headers values -func NewCreateQUICInitialRuleFrontendCreated() *CreateQUICInitialRuleFrontendCreated { - - return &CreateQUICInitialRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Quic initial rule frontend created response -func (o *CreateQUICInitialRuleFrontendCreated) WithPayload(payload *models.QUICInitialRule) *CreateQUICInitialRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule frontend created response -func (o *CreateQUICInitialRuleFrontendCreated) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleFrontendAcceptedCode is the HTTP code returned for type CreateQUICInitialRuleFrontendAccepted -const CreateQUICInitialRuleFrontendAcceptedCode int = 202 - -/* -CreateQUICInitialRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createQuicInitialRuleFrontendAccepted -*/ -type CreateQUICInitialRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleFrontendAccepted creates CreateQUICInitialRuleFrontendAccepted with default headers values -func NewCreateQUICInitialRuleFrontendAccepted() *CreateQUICInitialRuleFrontendAccepted { - - return &CreateQUICInitialRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Quic initial rule frontend accepted response -func (o *CreateQUICInitialRuleFrontendAccepted) WithReloadID(reloadID string) *CreateQUICInitialRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Quic initial rule frontend accepted response -func (o *CreateQUICInitialRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Quic initial rule frontend accepted response -func (o *CreateQUICInitialRuleFrontendAccepted) WithPayload(payload *models.QUICInitialRule) *CreateQUICInitialRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule frontend accepted response -func (o *CreateQUICInitialRuleFrontendAccepted) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleFrontendBadRequestCode is the HTTP code returned for type CreateQUICInitialRuleFrontendBadRequest -const CreateQUICInitialRuleFrontendBadRequestCode int = 400 - -/* -CreateQUICInitialRuleFrontendBadRequest Bad request - -swagger:response createQuicInitialRuleFrontendBadRequest -*/ -type CreateQUICInitialRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleFrontendBadRequest creates CreateQUICInitialRuleFrontendBadRequest with default headers values -func NewCreateQUICInitialRuleFrontendBadRequest() *CreateQUICInitialRuleFrontendBadRequest { - - return &CreateQUICInitialRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Quic initial rule frontend bad request response -func (o *CreateQUICInitialRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Quic initial rule frontend bad request response -func (o *CreateQUICInitialRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Quic initial rule frontend bad request response -func (o *CreateQUICInitialRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateQUICInitialRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule frontend bad request response -func (o *CreateQUICInitialRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateQUICInitialRuleFrontendConflictCode is the HTTP code returned for type CreateQUICInitialRuleFrontendConflict -const CreateQUICInitialRuleFrontendConflictCode int = 409 - -/* -CreateQUICInitialRuleFrontendConflict The specified resource already exists - -swagger:response createQuicInitialRuleFrontendConflict -*/ -type CreateQUICInitialRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleFrontendConflict creates CreateQUICInitialRuleFrontendConflict with default headers values -func NewCreateQUICInitialRuleFrontendConflict() *CreateQUICInitialRuleFrontendConflict { - - return &CreateQUICInitialRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Quic initial rule frontend conflict response -func (o *CreateQUICInitialRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Quic initial rule frontend conflict response -func (o *CreateQUICInitialRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Quic initial rule frontend conflict response -func (o *CreateQUICInitialRuleFrontendConflict) WithPayload(payload *models.Error) *CreateQUICInitialRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Quic initial rule frontend conflict response -func (o *CreateQUICInitialRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateQUICInitialRuleFrontendDefault General Error - -swagger:response createQuicInitialRuleFrontendDefault -*/ -type CreateQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateQUICInitialRuleFrontendDefault creates CreateQUICInitialRuleFrontendDefault with default headers values -func NewCreateQUICInitialRuleFrontendDefault(code int) *CreateQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) WithStatusCode(code int) *CreateQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *CreateQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create QUIC initial rule frontend default response -func (o *CreateQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/create_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/create_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index ca846214..00000000 --- a/operations/quic_initial_rule/create_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateQUICInitialRuleFrontendURL generates an URL for the create QUIC initial rule frontend operation -type CreateQUICInitialRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateQUICInitialRuleFrontendURL) WithBasePath(bp string) *CreateQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateQUICInitialRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_defaults.go b/operations/quic_initial_rule/delete_quic_initial_rule_defaults.go deleted file mode 100644 index 2605b2bd..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a delete QUIC initial rule defaults handler -type DeleteQUICInitialRuleDefaultsHandlerFunc func(DeleteQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteQUICInitialRuleDefaultsHandlerFunc) Handle(params DeleteQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteQUICInitialRuleDefaultsHandler interface for that can handle valid delete QUIC initial rule defaults params -type DeleteQUICInitialRuleDefaultsHandler interface { - Handle(DeleteQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteQUICInitialRuleDefaults creates a new http.Handler for the delete QUIC initial rule defaults operation -func NewDeleteQUICInitialRuleDefaults(ctx *middleware.Context, handler DeleteQUICInitialRuleDefaultsHandler) *DeleteQUICInitialRuleDefaults { - return &DeleteQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteQUICInitialRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index} QUICInitialRule deleteQuicInitialRuleDefaults - -# Delete a QUIC Initial Rule - -Deletes a QUIC Initial Rule configuration by it's index from the specified parent. -*/ -type DeleteQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler DeleteQUICInitialRuleDefaultsHandler -} - -func (o *DeleteQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/delete_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index 64dbb979..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteQUICInitialRuleDefaultsParams creates a new DeleteQUICInitialRuleDefaultsParams object -// with the default values initialized. -func NewDeleteQUICInitialRuleDefaultsParams() DeleteQUICInitialRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteQUICInitialRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteQUICInitialRuleDefaultsParams contains all the bound params for the delete QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteQUICInitialRuleDefaults -type DeleteQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteQUICInitialRuleDefaultsParams() beforehand. -func (o *DeleteQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteQUICInitialRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteQUICInitialRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteQUICInitialRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteQUICInitialRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/delete_quic_initial_rule_defaults_responses.go deleted file mode 100644 index 71609dbf..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteQUICInitialRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteQUICInitialRuleDefaultsAccepted -const DeleteQUICInitialRuleDefaultsAcceptedCode int = 202 - -/* -DeleteQUICInitialRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteQuicInitialRuleDefaultsAccepted -*/ -type DeleteQUICInitialRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteQUICInitialRuleDefaultsAccepted creates DeleteQUICInitialRuleDefaultsAccepted with default headers values -func NewDeleteQUICInitialRuleDefaultsAccepted() *DeleteQUICInitialRuleDefaultsAccepted { - - return &DeleteQUICInitialRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Quic initial rule defaults accepted response -func (o *DeleteQUICInitialRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteQUICInitialRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Quic initial rule defaults accepted response -func (o *DeleteQUICInitialRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteQUICInitialRuleDefaultsNoContentCode is the HTTP code returned for type DeleteQUICInitialRuleDefaultsNoContent -const DeleteQUICInitialRuleDefaultsNoContentCode int = 204 - -/* -DeleteQUICInitialRuleDefaultsNoContent QUIC Initial Rule deleted - -swagger:response deleteQuicInitialRuleDefaultsNoContent -*/ -type DeleteQUICInitialRuleDefaultsNoContent struct { -} - -// NewDeleteQUICInitialRuleDefaultsNoContent creates DeleteQUICInitialRuleDefaultsNoContent with default headers values -func NewDeleteQUICInitialRuleDefaultsNoContent() *DeleteQUICInitialRuleDefaultsNoContent { - - return &DeleteQUICInitialRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteQUICInitialRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteQUICInitialRuleDefaultsNotFound -const DeleteQUICInitialRuleDefaultsNotFoundCode int = 404 - -/* -DeleteQUICInitialRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteQuicInitialRuleDefaultsNotFound -*/ -type DeleteQUICInitialRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteQUICInitialRuleDefaultsNotFound creates DeleteQUICInitialRuleDefaultsNotFound with default headers values -func NewDeleteQUICInitialRuleDefaultsNotFound() *DeleteQUICInitialRuleDefaultsNotFound { - - return &DeleteQUICInitialRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Quic initial rule defaults not found response -func (o *DeleteQUICInitialRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteQUICInitialRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Quic initial rule defaults not found response -func (o *DeleteQUICInitialRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Quic initial rule defaults not found response -func (o *DeleteQUICInitialRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteQUICInitialRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Quic initial rule defaults not found response -func (o *DeleteQUICInitialRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteQUICInitialRuleDefaultsDefault General Error - -swagger:response deleteQuicInitialRuleDefaultsDefault -*/ -type DeleteQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteQUICInitialRuleDefaultsDefault creates DeleteQUICInitialRuleDefaultsDefault with default headers values -func NewDeleteQUICInitialRuleDefaultsDefault(code int) *DeleteQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *DeleteQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete QUIC initial rule defaults default response -func (o *DeleteQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/delete_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index d6ed58f1..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteQUICInitialRuleDefaultsURL generates an URL for the delete QUIC initial rule defaults operation -type DeleteQUICInitialRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteQUICInitialRuleDefaultsURL) WithBasePath(bp string) *DeleteQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteQUICInitialRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_frontend.go b/operations/quic_initial_rule/delete_quic_initial_rule_frontend.go deleted file mode 100644 index 68b24fe9..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a delete QUIC initial rule frontend handler -type DeleteQUICInitialRuleFrontendHandlerFunc func(DeleteQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteQUICInitialRuleFrontendHandlerFunc) Handle(params DeleteQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteQUICInitialRuleFrontendHandler interface for that can handle valid delete QUIC initial rule frontend params -type DeleteQUICInitialRuleFrontendHandler interface { - Handle(DeleteQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteQUICInitialRuleFrontend creates a new http.Handler for the delete QUIC initial rule frontend operation -func NewDeleteQUICInitialRuleFrontend(ctx *middleware.Context, handler DeleteQUICInitialRuleFrontendHandler) *DeleteQUICInitialRuleFrontend { - return &DeleteQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteQUICInitialRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index} QUICInitialRule deleteQuicInitialRuleFrontend - -# Delete a QUIC Initial Rule - -Deletes a QUIC Initial Rule configuration by it's index from the specified parent. -*/ -type DeleteQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler DeleteQUICInitialRuleFrontendHandler -} - -func (o *DeleteQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/delete_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index ce8f2e4e..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteQUICInitialRuleFrontendParams creates a new DeleteQUICInitialRuleFrontendParams object -// with the default values initialized. -func NewDeleteQUICInitialRuleFrontendParams() DeleteQUICInitialRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteQUICInitialRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteQUICInitialRuleFrontendParams contains all the bound params for the delete QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteQUICInitialRuleFrontend -type DeleteQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteQUICInitialRuleFrontendParams() beforehand. -func (o *DeleteQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteQUICInitialRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteQUICInitialRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteQUICInitialRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteQUICInitialRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/delete_quic_initial_rule_frontend_responses.go deleted file mode 100644 index 6f040334..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteQUICInitialRuleFrontendAcceptedCode is the HTTP code returned for type DeleteQUICInitialRuleFrontendAccepted -const DeleteQUICInitialRuleFrontendAcceptedCode int = 202 - -/* -DeleteQUICInitialRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteQuicInitialRuleFrontendAccepted -*/ -type DeleteQUICInitialRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteQUICInitialRuleFrontendAccepted creates DeleteQUICInitialRuleFrontendAccepted with default headers values -func NewDeleteQUICInitialRuleFrontendAccepted() *DeleteQUICInitialRuleFrontendAccepted { - - return &DeleteQUICInitialRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Quic initial rule frontend accepted response -func (o *DeleteQUICInitialRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteQUICInitialRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Quic initial rule frontend accepted response -func (o *DeleteQUICInitialRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteQUICInitialRuleFrontendNoContentCode is the HTTP code returned for type DeleteQUICInitialRuleFrontendNoContent -const DeleteQUICInitialRuleFrontendNoContentCode int = 204 - -/* -DeleteQUICInitialRuleFrontendNoContent QUIC Initial Rule deleted - -swagger:response deleteQuicInitialRuleFrontendNoContent -*/ -type DeleteQUICInitialRuleFrontendNoContent struct { -} - -// NewDeleteQUICInitialRuleFrontendNoContent creates DeleteQUICInitialRuleFrontendNoContent with default headers values -func NewDeleteQUICInitialRuleFrontendNoContent() *DeleteQUICInitialRuleFrontendNoContent { - - return &DeleteQUICInitialRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteQUICInitialRuleFrontendNotFoundCode is the HTTP code returned for type DeleteQUICInitialRuleFrontendNotFound -const DeleteQUICInitialRuleFrontendNotFoundCode int = 404 - -/* -DeleteQUICInitialRuleFrontendNotFound The specified resource was not found - -swagger:response deleteQuicInitialRuleFrontendNotFound -*/ -type DeleteQUICInitialRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteQUICInitialRuleFrontendNotFound creates DeleteQUICInitialRuleFrontendNotFound with default headers values -func NewDeleteQUICInitialRuleFrontendNotFound() *DeleteQUICInitialRuleFrontendNotFound { - - return &DeleteQUICInitialRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Quic initial rule frontend not found response -func (o *DeleteQUICInitialRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteQUICInitialRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Quic initial rule frontend not found response -func (o *DeleteQUICInitialRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Quic initial rule frontend not found response -func (o *DeleteQUICInitialRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteQUICInitialRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Quic initial rule frontend not found response -func (o *DeleteQUICInitialRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteQUICInitialRuleFrontendDefault General Error - -swagger:response deleteQuicInitialRuleFrontendDefault -*/ -type DeleteQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteQUICInitialRuleFrontendDefault creates DeleteQUICInitialRuleFrontendDefault with default headers values -func NewDeleteQUICInitialRuleFrontendDefault(code int) *DeleteQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) WithStatusCode(code int) *DeleteQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete QUIC initial rule frontend default response -func (o *DeleteQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/delete_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index 74446309..00000000 --- a/operations/quic_initial_rule/delete_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteQUICInitialRuleFrontendURL generates an URL for the delete QUIC initial rule frontend operation -type DeleteQUICInitialRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteQUICInitialRuleFrontendURL) WithBasePath(bp string) *DeleteQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteQUICInitialRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults.go b/operations/quic_initial_rule/get_all_quic_initial_rule_defaults.go deleted file mode 100644 index 0d117685..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a get all QUIC initial rule defaults handler -type GetAllQUICInitialRuleDefaultsHandlerFunc func(GetAllQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllQUICInitialRuleDefaultsHandlerFunc) Handle(params GetAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllQUICInitialRuleDefaultsHandler interface for that can handle valid get all QUIC initial rule defaults params -type GetAllQUICInitialRuleDefaultsHandler interface { - Handle(GetAllQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllQUICInitialRuleDefaults creates a new http.Handler for the get all QUIC initial rule defaults operation -func NewGetAllQUICInitialRuleDefaults(ctx *middleware.Context, handler GetAllQUICInitialRuleDefaultsHandler) *GetAllQUICInitialRuleDefaults { - return &GetAllQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllQUICInitialRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules QUICInitialRule getAllQuicInitialRuleDefaults - -# Return an array of all QUIC Initial rules - -Returns all QUIC Initial rules that are configured in specified parent. -*/ -type GetAllQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler GetAllQUICInitialRuleDefaultsHandler -} - -func (o *GetAllQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index 6e65f062..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllQUICInitialRuleDefaultsParams creates a new GetAllQUICInitialRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllQUICInitialRuleDefaultsParams() GetAllQUICInitialRuleDefaultsParams { - - return GetAllQUICInitialRuleDefaultsParams{} -} - -// GetAllQUICInitialRuleDefaultsParams contains all the bound params for the get all QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllQUICInitialRuleDefaults -type GetAllQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllQUICInitialRuleDefaultsParams() beforehand. -func (o *GetAllQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_responses.go deleted file mode 100644 index a27ad73a..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllQUICInitialRuleDefaultsOKCode is the HTTP code returned for type GetAllQUICInitialRuleDefaultsOK -const GetAllQUICInitialRuleDefaultsOKCode int = 200 - -/* -GetAllQUICInitialRuleDefaultsOK Successful operation - -swagger:response getAllQuicInitialRuleDefaultsOK -*/ -type GetAllQUICInitialRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewGetAllQUICInitialRuleDefaultsOK creates GetAllQUICInitialRuleDefaultsOK with default headers values -func NewGetAllQUICInitialRuleDefaultsOK() *GetAllQUICInitialRuleDefaultsOK { - - return &GetAllQUICInitialRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Quic initial rule defaults o k response -func (o *GetAllQUICInitialRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllQUICInitialRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Quic initial rule defaults o k response -func (o *GetAllQUICInitialRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Quic initial rule defaults o k response -func (o *GetAllQUICInitialRuleDefaultsOK) WithPayload(payload models.QUICInitialRules) *GetAllQUICInitialRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Quic initial rule defaults o k response -func (o *GetAllQUICInitialRuleDefaultsOK) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllQUICInitialRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllQUICInitialRuleDefaultsDefault General Error - -swagger:response getAllQuicInitialRuleDefaultsDefault -*/ -type GetAllQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllQUICInitialRuleDefaultsDefault creates GetAllQUICInitialRuleDefaultsDefault with default headers values -func NewGetAllQUICInitialRuleDefaultsDefault(code int) *GetAllQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *GetAllQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all QUIC initial rule defaults default response -func (o *GetAllQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index 55b84b9e..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllQUICInitialRuleDefaultsURL generates an URL for the get all QUIC initial rule defaults operation -type GetAllQUICInitialRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllQUICInitialRuleDefaultsURL) WithBasePath(bp string) *GetAllQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend.go b/operations/quic_initial_rule/get_all_quic_initial_rule_frontend.go deleted file mode 100644 index 41e5357d..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a get all QUIC initial rule frontend handler -type GetAllQUICInitialRuleFrontendHandlerFunc func(GetAllQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllQUICInitialRuleFrontendHandlerFunc) Handle(params GetAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllQUICInitialRuleFrontendHandler interface for that can handle valid get all QUIC initial rule frontend params -type GetAllQUICInitialRuleFrontendHandler interface { - Handle(GetAllQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllQUICInitialRuleFrontend creates a new http.Handler for the get all QUIC initial rule frontend operation -func NewGetAllQUICInitialRuleFrontend(ctx *middleware.Context, handler GetAllQUICInitialRuleFrontendHandler) *GetAllQUICInitialRuleFrontend { - return &GetAllQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllQUICInitialRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules QUICInitialRule getAllQuicInitialRuleFrontend - -# Return an array of all QUIC Initial rules - -Returns all QUIC Initial rules that are configured in specified parent. -*/ -type GetAllQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler GetAllQUICInitialRuleFrontendHandler -} - -func (o *GetAllQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index c170f28f..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllQUICInitialRuleFrontendParams creates a new GetAllQUICInitialRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllQUICInitialRuleFrontendParams() GetAllQUICInitialRuleFrontendParams { - - return GetAllQUICInitialRuleFrontendParams{} -} - -// GetAllQUICInitialRuleFrontendParams contains all the bound params for the get all QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllQUICInitialRuleFrontend -type GetAllQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllQUICInitialRuleFrontendParams() beforehand. -func (o *GetAllQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_responses.go deleted file mode 100644 index 51b2eaac..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllQUICInitialRuleFrontendOKCode is the HTTP code returned for type GetAllQUICInitialRuleFrontendOK -const GetAllQUICInitialRuleFrontendOKCode int = 200 - -/* -GetAllQUICInitialRuleFrontendOK Successful operation - -swagger:response getAllQuicInitialRuleFrontendOK -*/ -type GetAllQUICInitialRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewGetAllQUICInitialRuleFrontendOK creates GetAllQUICInitialRuleFrontendOK with default headers values -func NewGetAllQUICInitialRuleFrontendOK() *GetAllQUICInitialRuleFrontendOK { - - return &GetAllQUICInitialRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Quic initial rule frontend o k response -func (o *GetAllQUICInitialRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllQUICInitialRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Quic initial rule frontend o k response -func (o *GetAllQUICInitialRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Quic initial rule frontend o k response -func (o *GetAllQUICInitialRuleFrontendOK) WithPayload(payload models.QUICInitialRules) *GetAllQUICInitialRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Quic initial rule frontend o k response -func (o *GetAllQUICInitialRuleFrontendOK) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllQUICInitialRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllQUICInitialRuleFrontendDefault General Error - -swagger:response getAllQuicInitialRuleFrontendDefault -*/ -type GetAllQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllQUICInitialRuleFrontendDefault creates GetAllQUICInitialRuleFrontendDefault with default headers values -func NewGetAllQUICInitialRuleFrontendDefault(code int) *GetAllQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) WithStatusCode(code int) *GetAllQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all QUIC initial rule frontend default response -func (o *GetAllQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index 4f46b047..00000000 --- a/operations/quic_initial_rule/get_all_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllQUICInitialRuleFrontendURL generates an URL for the get all QUIC initial rule frontend operation -type GetAllQUICInitialRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllQUICInitialRuleFrontendURL) WithBasePath(bp string) *GetAllQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_defaults.go b/operations/quic_initial_rule/get_quic_initial_rule_defaults.go deleted file mode 100644 index 47e68c5a..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a get QUIC initial rule defaults handler -type GetQUICInitialRuleDefaultsHandlerFunc func(GetQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetQUICInitialRuleDefaultsHandlerFunc) Handle(params GetQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetQUICInitialRuleDefaultsHandler interface for that can handle valid get QUIC initial rule defaults params -type GetQUICInitialRuleDefaultsHandler interface { - Handle(GetQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetQUICInitialRuleDefaults creates a new http.Handler for the get QUIC initial rule defaults operation -func NewGetQUICInitialRuleDefaults(ctx *middleware.Context, handler GetQUICInitialRuleDefaultsHandler) *GetQUICInitialRuleDefaults { - return &GetQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetQUICInitialRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index} QUICInitialRule getQuicInitialRuleDefaults - -# Return one QUIC Initial Rule - -Returns one QUIC Initial Rule configuration by it's index in the specified parent. -*/ -type GetQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler GetQUICInitialRuleDefaultsHandler -} - -func (o *GetQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/get_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index ce1a92c5..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetQUICInitialRuleDefaultsParams creates a new GetQUICInitialRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetQUICInitialRuleDefaultsParams() GetQUICInitialRuleDefaultsParams { - - return GetQUICInitialRuleDefaultsParams{} -} - -// GetQUICInitialRuleDefaultsParams contains all the bound params for the get QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getQUICInitialRuleDefaults -type GetQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetQUICInitialRuleDefaultsParams() beforehand. -func (o *GetQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetQUICInitialRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/get_quic_initial_rule_defaults_responses.go deleted file mode 100644 index 73b676ee..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetQUICInitialRuleDefaultsOKCode is the HTTP code returned for type GetQUICInitialRuleDefaultsOK -const GetQUICInitialRuleDefaultsOKCode int = 200 - -/* -GetQUICInitialRuleDefaultsOK Successful operation - -swagger:response getQuicInitialRuleDefaultsOK -*/ -type GetQUICInitialRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleDefaultsOK creates GetQUICInitialRuleDefaultsOK with default headers values -func NewGetQUICInitialRuleDefaultsOK() *GetQUICInitialRuleDefaultsOK { - - return &GetQUICInitialRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Quic initial rule defaults o k response -func (o *GetQUICInitialRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Quic initial rule defaults o k response -func (o *GetQUICInitialRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Quic initial rule defaults o k response -func (o *GetQUICInitialRuleDefaultsOK) WithPayload(payload *models.QUICInitialRule) *GetQUICInitialRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Quic initial rule defaults o k response -func (o *GetQUICInitialRuleDefaultsOK) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetQUICInitialRuleDefaultsNotFoundCode is the HTTP code returned for type GetQUICInitialRuleDefaultsNotFound -const GetQUICInitialRuleDefaultsNotFoundCode int = 404 - -/* -GetQUICInitialRuleDefaultsNotFound The specified resource was not found - -swagger:response getQuicInitialRuleDefaultsNotFound -*/ -type GetQUICInitialRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleDefaultsNotFound creates GetQUICInitialRuleDefaultsNotFound with default headers values -func NewGetQUICInitialRuleDefaultsNotFound() *GetQUICInitialRuleDefaultsNotFound { - - return &GetQUICInitialRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Quic initial rule defaults not found response -func (o *GetQUICInitialRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Quic initial rule defaults not found response -func (o *GetQUICInitialRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Quic initial rule defaults not found response -func (o *GetQUICInitialRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetQUICInitialRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Quic initial rule defaults not found response -func (o *GetQUICInitialRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetQUICInitialRuleDefaultsDefault General Error - -swagger:response getQuicInitialRuleDefaultsDefault -*/ -type GetQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleDefaultsDefault creates GetQUICInitialRuleDefaultsDefault with default headers values -func NewGetQUICInitialRuleDefaultsDefault(code int) *GetQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *GetQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *GetQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get QUIC initial rule defaults default response -func (o *GetQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/get_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index 4df678c8..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetQUICInitialRuleDefaultsURL generates an URL for the get QUIC initial rule defaults operation -type GetQUICInitialRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetQUICInitialRuleDefaultsURL) WithBasePath(bp string) *GetQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetQUICInitialRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_frontend.go b/operations/quic_initial_rule/get_quic_initial_rule_frontend.go deleted file mode 100644 index f6b7fb02..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a get QUIC initial rule frontend handler -type GetQUICInitialRuleFrontendHandlerFunc func(GetQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetQUICInitialRuleFrontendHandlerFunc) Handle(params GetQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetQUICInitialRuleFrontendHandler interface for that can handle valid get QUIC initial rule frontend params -type GetQUICInitialRuleFrontendHandler interface { - Handle(GetQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetQUICInitialRuleFrontend creates a new http.Handler for the get QUIC initial rule frontend operation -func NewGetQUICInitialRuleFrontend(ctx *middleware.Context, handler GetQUICInitialRuleFrontendHandler) *GetQUICInitialRuleFrontend { - return &GetQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetQUICInitialRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index} QUICInitialRule getQuicInitialRuleFrontend - -# Return one QUIC Initial Rule - -Returns one QUIC Initial Rule configuration by it's index in the specified parent. -*/ -type GetQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler GetQUICInitialRuleFrontendHandler -} - -func (o *GetQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/get_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index 23e63f55..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetQUICInitialRuleFrontendParams creates a new GetQUICInitialRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetQUICInitialRuleFrontendParams() GetQUICInitialRuleFrontendParams { - - return GetQUICInitialRuleFrontendParams{} -} - -// GetQUICInitialRuleFrontendParams contains all the bound params for the get QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getQUICInitialRuleFrontend -type GetQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetQUICInitialRuleFrontendParams() beforehand. -func (o *GetQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetQUICInitialRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/get_quic_initial_rule_frontend_responses.go deleted file mode 100644 index a2d3e292..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetQUICInitialRuleFrontendOKCode is the HTTP code returned for type GetQUICInitialRuleFrontendOK -const GetQUICInitialRuleFrontendOKCode int = 200 - -/* -GetQUICInitialRuleFrontendOK Successful operation - -swagger:response getQuicInitialRuleFrontendOK -*/ -type GetQUICInitialRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleFrontendOK creates GetQUICInitialRuleFrontendOK with default headers values -func NewGetQUICInitialRuleFrontendOK() *GetQUICInitialRuleFrontendOK { - - return &GetQUICInitialRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Quic initial rule frontend o k response -func (o *GetQUICInitialRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Quic initial rule frontend o k response -func (o *GetQUICInitialRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Quic initial rule frontend o k response -func (o *GetQUICInitialRuleFrontendOK) WithPayload(payload *models.QUICInitialRule) *GetQUICInitialRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Quic initial rule frontend o k response -func (o *GetQUICInitialRuleFrontendOK) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetQUICInitialRuleFrontendNotFoundCode is the HTTP code returned for type GetQUICInitialRuleFrontendNotFound -const GetQUICInitialRuleFrontendNotFoundCode int = 404 - -/* -GetQUICInitialRuleFrontendNotFound The specified resource was not found - -swagger:response getQuicInitialRuleFrontendNotFound -*/ -type GetQUICInitialRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleFrontendNotFound creates GetQUICInitialRuleFrontendNotFound with default headers values -func NewGetQUICInitialRuleFrontendNotFound() *GetQUICInitialRuleFrontendNotFound { - - return &GetQUICInitialRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Quic initial rule frontend not found response -func (o *GetQUICInitialRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Quic initial rule frontend not found response -func (o *GetQUICInitialRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Quic initial rule frontend not found response -func (o *GetQUICInitialRuleFrontendNotFound) WithPayload(payload *models.Error) *GetQUICInitialRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Quic initial rule frontend not found response -func (o *GetQUICInitialRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetQUICInitialRuleFrontendDefault General Error - -swagger:response getQuicInitialRuleFrontendDefault -*/ -type GetQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetQUICInitialRuleFrontendDefault creates GetQUICInitialRuleFrontendDefault with default headers values -func NewGetQUICInitialRuleFrontendDefault(code int) *GetQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) WithStatusCode(code int) *GetQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *GetQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get QUIC initial rule frontend default response -func (o *GetQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/get_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/get_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index 75fdae7f..00000000 --- a/operations/quic_initial_rule/get_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetQUICInitialRuleFrontendURL generates an URL for the get QUIC initial rule frontend operation -type GetQUICInitialRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetQUICInitialRuleFrontendURL) WithBasePath(bp string) *GetQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetQUICInitialRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults.go deleted file mode 100644 index 073f695d..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a replace all QUIC initial rule defaults handler -type ReplaceAllQUICInitialRuleDefaultsHandlerFunc func(ReplaceAllQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllQUICInitialRuleDefaultsHandlerFunc) Handle(params ReplaceAllQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllQUICInitialRuleDefaultsHandler interface for that can handle valid replace all QUIC initial rule defaults params -type ReplaceAllQUICInitialRuleDefaultsHandler interface { - Handle(ReplaceAllQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllQUICInitialRuleDefaults creates a new http.Handler for the replace all QUIC initial rule defaults operation -func NewReplaceAllQUICInitialRuleDefaults(ctx *middleware.Context, handler ReplaceAllQUICInitialRuleDefaultsHandler) *ReplaceAllQUICInitialRuleDefaults { - return &ReplaceAllQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllQUICInitialRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules QUICInitialRule replaceAllQuicInitialRuleDefaults - -# Replace an QUIC Initial rules list - -Replaces a whole list of QUIC Initial rules with the list given in parameter -*/ -type ReplaceAllQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllQUICInitialRuleDefaultsHandler -} - -func (o *ReplaceAllQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index f20ec7f3..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllQUICInitialRuleDefaultsParams creates a new ReplaceAllQUICInitialRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllQUICInitialRuleDefaultsParams() ReplaceAllQUICInitialRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllQUICInitialRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllQUICInitialRuleDefaultsParams contains all the bound params for the replace all QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllQUICInitialRuleDefaults -type ReplaceAllQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.QUICInitialRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllQUICInitialRuleDefaultsParams() beforehand. -func (o *ReplaceAllQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllQUICInitialRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllQUICInitialRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllQUICInitialRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_responses.go deleted file mode 100644 index 995b2816..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllQUICInitialRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllQUICInitialRuleDefaultsOK -const ReplaceAllQUICInitialRuleDefaultsOKCode int = 200 - -/* -ReplaceAllQUICInitialRuleDefaultsOK All TTP After Response Rules lines replaced - -swagger:response replaceAllQuicInitialRuleDefaultsOK -*/ -type ReplaceAllQUICInitialRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleDefaultsOK creates ReplaceAllQUICInitialRuleDefaultsOK with default headers values -func NewReplaceAllQUICInitialRuleDefaultsOK() *ReplaceAllQUICInitialRuleDefaultsOK { - - return &ReplaceAllQUICInitialRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Quic initial rule defaults o k response -func (o *ReplaceAllQUICInitialRuleDefaultsOK) WithPayload(payload models.QUICInitialRules) *ReplaceAllQUICInitialRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule defaults o k response -func (o *ReplaceAllQUICInitialRuleDefaultsOK) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllQUICInitialRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllQUICInitialRuleDefaultsAccepted -const ReplaceAllQUICInitialRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllQUICInitialRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllQuicInitialRuleDefaultsAccepted -*/ -type ReplaceAllQUICInitialRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleDefaultsAccepted creates ReplaceAllQUICInitialRuleDefaultsAccepted with default headers values -func NewReplaceAllQUICInitialRuleDefaultsAccepted() *ReplaceAllQUICInitialRuleDefaultsAccepted { - - return &ReplaceAllQUICInitialRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Quic initial rule defaults accepted response -func (o *ReplaceAllQUICInitialRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllQUICInitialRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Quic initial rule defaults accepted response -func (o *ReplaceAllQUICInitialRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Quic initial rule defaults accepted response -func (o *ReplaceAllQUICInitialRuleDefaultsAccepted) WithPayload(payload models.QUICInitialRules) *ReplaceAllQUICInitialRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule defaults accepted response -func (o *ReplaceAllQUICInitialRuleDefaultsAccepted) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllQUICInitialRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllQUICInitialRuleDefaultsBadRequest -const ReplaceAllQUICInitialRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllQUICInitialRuleDefaultsBadRequest Bad request - -swagger:response replaceAllQuicInitialRuleDefaultsBadRequest -*/ -type ReplaceAllQUICInitialRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleDefaultsBadRequest creates ReplaceAllQUICInitialRuleDefaultsBadRequest with default headers values -func NewReplaceAllQUICInitialRuleDefaultsBadRequest() *ReplaceAllQUICInitialRuleDefaultsBadRequest { - - return &ReplaceAllQUICInitialRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Quic initial rule defaults bad request response -func (o *ReplaceAllQUICInitialRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllQUICInitialRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Quic initial rule defaults bad request response -func (o *ReplaceAllQUICInitialRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Quic initial rule defaults bad request response -func (o *ReplaceAllQUICInitialRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllQUICInitialRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule defaults bad request response -func (o *ReplaceAllQUICInitialRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllQUICInitialRuleDefaultsDefault General Error - -swagger:response replaceAllQuicInitialRuleDefaultsDefault -*/ -type ReplaceAllQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleDefaultsDefault creates ReplaceAllQUICInitialRuleDefaultsDefault with default headers values -func NewReplaceAllQUICInitialRuleDefaultsDefault(code int) *ReplaceAllQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all QUIC initial rule defaults default response -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index efcffd87..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllQUICInitialRuleDefaultsURL generates an URL for the replace all QUIC initial rule defaults operation -type ReplaceAllQUICInitialRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllQUICInitialRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend.go deleted file mode 100644 index 45c79cf9..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a replace all QUIC initial rule frontend handler -type ReplaceAllQUICInitialRuleFrontendHandlerFunc func(ReplaceAllQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllQUICInitialRuleFrontendHandlerFunc) Handle(params ReplaceAllQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllQUICInitialRuleFrontendHandler interface for that can handle valid replace all QUIC initial rule frontend params -type ReplaceAllQUICInitialRuleFrontendHandler interface { - Handle(ReplaceAllQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllQUICInitialRuleFrontend creates a new http.Handler for the replace all QUIC initial rule frontend operation -func NewReplaceAllQUICInitialRuleFrontend(ctx *middleware.Context, handler ReplaceAllQUICInitialRuleFrontendHandler) *ReplaceAllQUICInitialRuleFrontend { - return &ReplaceAllQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllQUICInitialRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules QUICInitialRule replaceAllQuicInitialRuleFrontend - -# Replace an QUIC Initial rules list - -Replaces a whole list of QUIC Initial rules with the list given in parameter -*/ -type ReplaceAllQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllQUICInitialRuleFrontendHandler -} - -func (o *ReplaceAllQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index f79b9fca..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllQUICInitialRuleFrontendParams creates a new ReplaceAllQUICInitialRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllQUICInitialRuleFrontendParams() ReplaceAllQUICInitialRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllQUICInitialRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllQUICInitialRuleFrontendParams contains all the bound params for the replace all QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllQUICInitialRuleFrontend -type ReplaceAllQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.QUICInitialRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllQUICInitialRuleFrontendParams() beforehand. -func (o *ReplaceAllQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllQUICInitialRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllQUICInitialRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllQUICInitialRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_responses.go deleted file mode 100644 index d7da4873..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllQUICInitialRuleFrontendOKCode is the HTTP code returned for type ReplaceAllQUICInitialRuleFrontendOK -const ReplaceAllQUICInitialRuleFrontendOKCode int = 200 - -/* -ReplaceAllQUICInitialRuleFrontendOK All TTP After Response Rules lines replaced - -swagger:response replaceAllQuicInitialRuleFrontendOK -*/ -type ReplaceAllQUICInitialRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleFrontendOK creates ReplaceAllQUICInitialRuleFrontendOK with default headers values -func NewReplaceAllQUICInitialRuleFrontendOK() *ReplaceAllQUICInitialRuleFrontendOK { - - return &ReplaceAllQUICInitialRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Quic initial rule frontend o k response -func (o *ReplaceAllQUICInitialRuleFrontendOK) WithPayload(payload models.QUICInitialRules) *ReplaceAllQUICInitialRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule frontend o k response -func (o *ReplaceAllQUICInitialRuleFrontendOK) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllQUICInitialRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllQUICInitialRuleFrontendAccepted -const ReplaceAllQUICInitialRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllQUICInitialRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllQuicInitialRuleFrontendAccepted -*/ -type ReplaceAllQUICInitialRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.QUICInitialRules `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleFrontendAccepted creates ReplaceAllQUICInitialRuleFrontendAccepted with default headers values -func NewReplaceAllQUICInitialRuleFrontendAccepted() *ReplaceAllQUICInitialRuleFrontendAccepted { - - return &ReplaceAllQUICInitialRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Quic initial rule frontend accepted response -func (o *ReplaceAllQUICInitialRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllQUICInitialRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Quic initial rule frontend accepted response -func (o *ReplaceAllQUICInitialRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Quic initial rule frontend accepted response -func (o *ReplaceAllQUICInitialRuleFrontendAccepted) WithPayload(payload models.QUICInitialRules) *ReplaceAllQUICInitialRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule frontend accepted response -func (o *ReplaceAllQUICInitialRuleFrontendAccepted) SetPayload(payload models.QUICInitialRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.QUICInitialRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllQUICInitialRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllQUICInitialRuleFrontendBadRequest -const ReplaceAllQUICInitialRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllQUICInitialRuleFrontendBadRequest Bad request - -swagger:response replaceAllQuicInitialRuleFrontendBadRequest -*/ -type ReplaceAllQUICInitialRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleFrontendBadRequest creates ReplaceAllQUICInitialRuleFrontendBadRequest with default headers values -func NewReplaceAllQUICInitialRuleFrontendBadRequest() *ReplaceAllQUICInitialRuleFrontendBadRequest { - - return &ReplaceAllQUICInitialRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Quic initial rule frontend bad request response -func (o *ReplaceAllQUICInitialRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllQUICInitialRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Quic initial rule frontend bad request response -func (o *ReplaceAllQUICInitialRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Quic initial rule frontend bad request response -func (o *ReplaceAllQUICInitialRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllQUICInitialRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Quic initial rule frontend bad request response -func (o *ReplaceAllQUICInitialRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllQUICInitialRuleFrontendDefault General Error - -swagger:response replaceAllQuicInitialRuleFrontendDefault -*/ -type ReplaceAllQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllQUICInitialRuleFrontendDefault creates ReplaceAllQUICInitialRuleFrontendDefault with default headers values -func NewReplaceAllQUICInitialRuleFrontendDefault(code int) *ReplaceAllQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all QUIC initial rule frontend default response -func (o *ReplaceAllQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index efd6e300..00000000 --- a/operations/quic_initial_rule/replace_all_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllQUICInitialRuleFrontendURL generates an URL for the replace all QUIC initial rule frontend operation -type ReplaceAllQUICInitialRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllQUICInitialRuleFrontendURL) WithBasePath(bp string) *ReplaceAllQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_defaults.go b/operations/quic_initial_rule/replace_quic_initial_rule_defaults.go deleted file mode 100644 index bc0582e9..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceQUICInitialRuleDefaultsHandlerFunc turns a function with the right signature into a replace QUIC initial rule defaults handler -type ReplaceQUICInitialRuleDefaultsHandlerFunc func(ReplaceQUICInitialRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceQUICInitialRuleDefaultsHandlerFunc) Handle(params ReplaceQUICInitialRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceQUICInitialRuleDefaultsHandler interface for that can handle valid replace QUIC initial rule defaults params -type ReplaceQUICInitialRuleDefaultsHandler interface { - Handle(ReplaceQUICInitialRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceQUICInitialRuleDefaults creates a new http.Handler for the replace QUIC initial rule defaults operation -func NewReplaceQUICInitialRuleDefaults(ctx *middleware.Context, handler ReplaceQUICInitialRuleDefaultsHandler) *ReplaceQUICInitialRuleDefaults { - return &ReplaceQUICInitialRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceQUICInitialRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index} QUICInitialRule replaceQuicInitialRuleDefaults - -# Replace a QUIC Initial Rule - -Replaces a QUIC Initial Rule configuration by it's index in the specified parent. -*/ -type ReplaceQUICInitialRuleDefaults struct { - Context *middleware.Context - Handler ReplaceQUICInitialRuleDefaultsHandler -} - -func (o *ReplaceQUICInitialRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceQUICInitialRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_parameters.go b/operations/quic_initial_rule/replace_quic_initial_rule_defaults_parameters.go deleted file mode 100644 index b75eb5ec..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceQUICInitialRuleDefaultsParams creates a new ReplaceQUICInitialRuleDefaultsParams object -// with the default values initialized. -func NewReplaceQUICInitialRuleDefaultsParams() ReplaceQUICInitialRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceQUICInitialRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceQUICInitialRuleDefaultsParams contains all the bound params for the replace QUIC initial rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceQUICInitialRuleDefaults -type ReplaceQUICInitialRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.QUICInitialRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceQUICInitialRuleDefaultsParams() beforehand. -func (o *ReplaceQUICInitialRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceQUICInitialRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceQUICInitialRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceQUICInitialRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceQUICInitialRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceQUICInitialRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceQUICInitialRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_responses.go b/operations/quic_initial_rule/replace_quic_initial_rule_defaults_responses.go deleted file mode 100644 index 0cc5661d..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceQUICInitialRuleDefaultsOKCode is the HTTP code returned for type ReplaceQUICInitialRuleDefaultsOK -const ReplaceQUICInitialRuleDefaultsOKCode int = 200 - -/* -ReplaceQUICInitialRuleDefaultsOK QUIC Initial Rule replaced - -swagger:response replaceQuicInitialRuleDefaultsOK -*/ -type ReplaceQUICInitialRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleDefaultsOK creates ReplaceQUICInitialRuleDefaultsOK with default headers values -func NewReplaceQUICInitialRuleDefaultsOK() *ReplaceQUICInitialRuleDefaultsOK { - - return &ReplaceQUICInitialRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Quic initial rule defaults o k response -func (o *ReplaceQUICInitialRuleDefaultsOK) WithPayload(payload *models.QUICInitialRule) *ReplaceQUICInitialRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule defaults o k response -func (o *ReplaceQUICInitialRuleDefaultsOK) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceQUICInitialRuleDefaultsAccepted -const ReplaceQUICInitialRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceQUICInitialRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceQuicInitialRuleDefaultsAccepted -*/ -type ReplaceQUICInitialRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleDefaultsAccepted creates ReplaceQUICInitialRuleDefaultsAccepted with default headers values -func NewReplaceQUICInitialRuleDefaultsAccepted() *ReplaceQUICInitialRuleDefaultsAccepted { - - return &ReplaceQUICInitialRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Quic initial rule defaults accepted response -func (o *ReplaceQUICInitialRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceQUICInitialRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Quic initial rule defaults accepted response -func (o *ReplaceQUICInitialRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Quic initial rule defaults accepted response -func (o *ReplaceQUICInitialRuleDefaultsAccepted) WithPayload(payload *models.QUICInitialRule) *ReplaceQUICInitialRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule defaults accepted response -func (o *ReplaceQUICInitialRuleDefaultsAccepted) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceQUICInitialRuleDefaultsBadRequest -const ReplaceQUICInitialRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceQUICInitialRuleDefaultsBadRequest Bad request - -swagger:response replaceQuicInitialRuleDefaultsBadRequest -*/ -type ReplaceQUICInitialRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleDefaultsBadRequest creates ReplaceQUICInitialRuleDefaultsBadRequest with default headers values -func NewReplaceQUICInitialRuleDefaultsBadRequest() *ReplaceQUICInitialRuleDefaultsBadRequest { - - return &ReplaceQUICInitialRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Quic initial rule defaults bad request response -func (o *ReplaceQUICInitialRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Quic initial rule defaults bad request response -func (o *ReplaceQUICInitialRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Quic initial rule defaults bad request response -func (o *ReplaceQUICInitialRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule defaults bad request response -func (o *ReplaceQUICInitialRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceQUICInitialRuleDefaultsNotFound -const ReplaceQUICInitialRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceQUICInitialRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceQuicInitialRuleDefaultsNotFound -*/ -type ReplaceQUICInitialRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleDefaultsNotFound creates ReplaceQUICInitialRuleDefaultsNotFound with default headers values -func NewReplaceQUICInitialRuleDefaultsNotFound() *ReplaceQUICInitialRuleDefaultsNotFound { - - return &ReplaceQUICInitialRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Quic initial rule defaults not found response -func (o *ReplaceQUICInitialRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Quic initial rule defaults not found response -func (o *ReplaceQUICInitialRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Quic initial rule defaults not found response -func (o *ReplaceQUICInitialRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule defaults not found response -func (o *ReplaceQUICInitialRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceQUICInitialRuleDefaultsDefault General Error - -swagger:response replaceQuicInitialRuleDefaultsDefault -*/ -type ReplaceQUICInitialRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleDefaultsDefault creates ReplaceQUICInitialRuleDefaultsDefault with default headers values -func NewReplaceQUICInitialRuleDefaultsDefault(code int) *ReplaceQUICInitialRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceQUICInitialRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) WithStatusCode(code int) *ReplaceQUICInitialRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace QUIC initial rule defaults default response -func (o *ReplaceQUICInitialRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_urlbuilder.go b/operations/quic_initial_rule/replace_quic_initial_rule_defaults_urlbuilder.go deleted file mode 100644 index b4211dbf..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceQUICInitialRuleDefaultsURL generates an URL for the replace QUIC initial rule defaults operation -type ReplaceQUICInitialRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceQUICInitialRuleDefaultsURL) WithBasePath(bp string) *ReplaceQUICInitialRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceQUICInitialRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceQUICInitialRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceQUICInitialRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceQUICInitialRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceQUICInitialRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceQUICInitialRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceQUICInitialRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceQUICInitialRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceQUICInitialRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceQUICInitialRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_frontend.go b/operations/quic_initial_rule/replace_quic_initial_rule_frontend.go deleted file mode 100644 index 8a986a08..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceQUICInitialRuleFrontendHandlerFunc turns a function with the right signature into a replace QUIC initial rule frontend handler -type ReplaceQUICInitialRuleFrontendHandlerFunc func(ReplaceQUICInitialRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceQUICInitialRuleFrontendHandlerFunc) Handle(params ReplaceQUICInitialRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceQUICInitialRuleFrontendHandler interface for that can handle valid replace QUIC initial rule frontend params -type ReplaceQUICInitialRuleFrontendHandler interface { - Handle(ReplaceQUICInitialRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceQUICInitialRuleFrontend creates a new http.Handler for the replace QUIC initial rule frontend operation -func NewReplaceQUICInitialRuleFrontend(ctx *middleware.Context, handler ReplaceQUICInitialRuleFrontendHandler) *ReplaceQUICInitialRuleFrontend { - return &ReplaceQUICInitialRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceQUICInitialRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index} QUICInitialRule replaceQuicInitialRuleFrontend - -# Replace a QUIC Initial Rule - -Replaces a QUIC Initial Rule configuration by it's index in the specified parent. -*/ -type ReplaceQUICInitialRuleFrontend struct { - Context *middleware.Context - Handler ReplaceQUICInitialRuleFrontendHandler -} - -func (o *ReplaceQUICInitialRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceQUICInitialRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_parameters.go b/operations/quic_initial_rule/replace_quic_initial_rule_frontend_parameters.go deleted file mode 100644 index fc787cc3..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceQUICInitialRuleFrontendParams creates a new ReplaceQUICInitialRuleFrontendParams object -// with the default values initialized. -func NewReplaceQUICInitialRuleFrontendParams() ReplaceQUICInitialRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceQUICInitialRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceQUICInitialRuleFrontendParams contains all the bound params for the replace QUIC initial rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceQUICInitialRuleFrontend -type ReplaceQUICInitialRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.QUICInitialRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*QUIC Initial Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceQUICInitialRuleFrontendParams() beforehand. -func (o *ReplaceQUICInitialRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.QUICInitialRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceQUICInitialRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceQUICInitialRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceQUICInitialRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceQUICInitialRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceQUICInitialRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceQUICInitialRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_responses.go b/operations/quic_initial_rule/replace_quic_initial_rule_frontend_responses.go deleted file mode 100644 index bc0440cd..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceQUICInitialRuleFrontendOKCode is the HTTP code returned for type ReplaceQUICInitialRuleFrontendOK -const ReplaceQUICInitialRuleFrontendOKCode int = 200 - -/* -ReplaceQUICInitialRuleFrontendOK QUIC Initial Rule replaced - -swagger:response replaceQuicInitialRuleFrontendOK -*/ -type ReplaceQUICInitialRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleFrontendOK creates ReplaceQUICInitialRuleFrontendOK with default headers values -func NewReplaceQUICInitialRuleFrontendOK() *ReplaceQUICInitialRuleFrontendOK { - - return &ReplaceQUICInitialRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Quic initial rule frontend o k response -func (o *ReplaceQUICInitialRuleFrontendOK) WithPayload(payload *models.QUICInitialRule) *ReplaceQUICInitialRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule frontend o k response -func (o *ReplaceQUICInitialRuleFrontendOK) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceQUICInitialRuleFrontendAccepted -const ReplaceQUICInitialRuleFrontendAcceptedCode int = 202 - -/* -ReplaceQUICInitialRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceQuicInitialRuleFrontendAccepted -*/ -type ReplaceQUICInitialRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.QUICInitialRule `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleFrontendAccepted creates ReplaceQUICInitialRuleFrontendAccepted with default headers values -func NewReplaceQUICInitialRuleFrontendAccepted() *ReplaceQUICInitialRuleFrontendAccepted { - - return &ReplaceQUICInitialRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Quic initial rule frontend accepted response -func (o *ReplaceQUICInitialRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceQUICInitialRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Quic initial rule frontend accepted response -func (o *ReplaceQUICInitialRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Quic initial rule frontend accepted response -func (o *ReplaceQUICInitialRuleFrontendAccepted) WithPayload(payload *models.QUICInitialRule) *ReplaceQUICInitialRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule frontend accepted response -func (o *ReplaceQUICInitialRuleFrontendAccepted) SetPayload(payload *models.QUICInitialRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceQUICInitialRuleFrontendBadRequest -const ReplaceQUICInitialRuleFrontendBadRequestCode int = 400 - -/* -ReplaceQUICInitialRuleFrontendBadRequest Bad request - -swagger:response replaceQuicInitialRuleFrontendBadRequest -*/ -type ReplaceQUICInitialRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleFrontendBadRequest creates ReplaceQUICInitialRuleFrontendBadRequest with default headers values -func NewReplaceQUICInitialRuleFrontendBadRequest() *ReplaceQUICInitialRuleFrontendBadRequest { - - return &ReplaceQUICInitialRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Quic initial rule frontend bad request response -func (o *ReplaceQUICInitialRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Quic initial rule frontend bad request response -func (o *ReplaceQUICInitialRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Quic initial rule frontend bad request response -func (o *ReplaceQUICInitialRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule frontend bad request response -func (o *ReplaceQUICInitialRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceQUICInitialRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceQUICInitialRuleFrontendNotFound -const ReplaceQUICInitialRuleFrontendNotFoundCode int = 404 - -/* -ReplaceQUICInitialRuleFrontendNotFound The specified resource was not found - -swagger:response replaceQuicInitialRuleFrontendNotFound -*/ -type ReplaceQUICInitialRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleFrontendNotFound creates ReplaceQUICInitialRuleFrontendNotFound with default headers values -func NewReplaceQUICInitialRuleFrontendNotFound() *ReplaceQUICInitialRuleFrontendNotFound { - - return &ReplaceQUICInitialRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Quic initial rule frontend not found response -func (o *ReplaceQUICInitialRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Quic initial rule frontend not found response -func (o *ReplaceQUICInitialRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Quic initial rule frontend not found response -func (o *ReplaceQUICInitialRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Quic initial rule frontend not found response -func (o *ReplaceQUICInitialRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceQUICInitialRuleFrontendDefault General Error - -swagger:response replaceQuicInitialRuleFrontendDefault -*/ -type ReplaceQUICInitialRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceQUICInitialRuleFrontendDefault creates ReplaceQUICInitialRuleFrontendDefault with default headers values -func NewReplaceQUICInitialRuleFrontendDefault(code int) *ReplaceQUICInitialRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceQUICInitialRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) WithStatusCode(code int) *ReplaceQUICInitialRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceQUICInitialRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceQUICInitialRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace QUIC initial rule frontend default response -func (o *ReplaceQUICInitialRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceQUICInitialRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_urlbuilder.go b/operations/quic_initial_rule/replace_quic_initial_rule_frontend_urlbuilder.go deleted file mode 100644 index f1c0e21a..00000000 --- a/operations/quic_initial_rule/replace_quic_initial_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package quic_initial_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceQUICInitialRuleFrontendURL generates an URL for the replace QUIC initial rule frontend operation -type ReplaceQUICInitialRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceQUICInitialRuleFrontendURL) WithBasePath(bp string) *ReplaceQUICInitialRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceQUICInitialRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceQUICInitialRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceQUICInitialRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceQUICInitialRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceQUICInitialRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceQUICInitialRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceQUICInitialRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceQUICInitialRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceQUICInitialRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceQUICInitialRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/reloads/get_reload.go b/operations/reloads/get_reload.go deleted file mode 100644 index 61401e83..00000000 --- a/operations/reloads/get_reload.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetReloadHandlerFunc turns a function with the right signature into a get reload handler -type GetReloadHandlerFunc func(GetReloadParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetReloadHandlerFunc) Handle(params GetReloadParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetReloadHandler interface for that can handle valid get reload params -type GetReloadHandler interface { - Handle(GetReloadParams, interface{}) middleware.Responder -} - -// NewGetReload creates a new http.Handler for the get reload operation -func NewGetReload(ctx *middleware.Context, handler GetReloadHandler) *GetReload { - return &GetReload{Context: ctx, Handler: handler} -} - -/* - GetReload swagger:route GET /services/haproxy/reloads/{id} Reloads getReload - -# Return one HAProxy reload status - -Returns one HAProxy reload status. -*/ -type GetReload struct { - Context *middleware.Context - Handler GetReloadHandler -} - -func (o *GetReload) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetReloadParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/reloads/get_reload_parameters.go b/operations/reloads/get_reload_parameters.go deleted file mode 100644 index bf3393fc..00000000 --- a/operations/reloads/get_reload_parameters.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetReloadParams creates a new GetReloadParams object -// -// There are no default values defined in the spec. -func NewGetReloadParams() GetReloadParams { - - return GetReloadParams{} -} - -// GetReloadParams contains all the bound params for the get reload operation -// typically these are obtained from a http.Request -// -// swagger:parameters getReload -type GetReloadParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Reload id - Required: true - Pattern: ^\d{4}-\d{2}-\d{2}-\d+$ - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetReloadParams() beforehand. -func (o *GetReloadParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetReloadParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - if err := o.validateID(formats); err != nil { - return err - } - - return nil -} - -// validateID carries on validations for parameter ID -func (o *GetReloadParams) validateID(formats strfmt.Registry) error { - - if err := validate.Pattern("id", "path", o.ID, `^\d{4}-\d{2}-\d{2}-\d+$`); err != nil { - return err - } - - return nil -} diff --git a/operations/reloads/get_reload_responses.go b/operations/reloads/get_reload_responses.go deleted file mode 100644 index b517beae..00000000 --- a/operations/reloads/get_reload_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetReloadOKCode is the HTTP code returned for type GetReloadOK -const GetReloadOKCode int = 200 - -/* -GetReloadOK Successful operation - -swagger:response getReloadOK -*/ -type GetReloadOK struct { - - /* - In: Body - */ - Payload *models.Reload `json:"body,omitempty"` -} - -// NewGetReloadOK creates GetReloadOK with default headers values -func NewGetReloadOK() *GetReloadOK { - - return &GetReloadOK{} -} - -// WithPayload adds the payload to the get reload o k response -func (o *GetReloadOK) WithPayload(payload *models.Reload) *GetReloadOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get reload o k response -func (o *GetReloadOK) SetPayload(payload *models.Reload) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetReloadOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetReloadNotFoundCode is the HTTP code returned for type GetReloadNotFound -const GetReloadNotFoundCode int = 404 - -/* -GetReloadNotFound The specified resource was not found - -swagger:response getReloadNotFound -*/ -type GetReloadNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetReloadNotFound creates GetReloadNotFound with default headers values -func NewGetReloadNotFound() *GetReloadNotFound { - - return &GetReloadNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get reload not found response -func (o *GetReloadNotFound) WithConfigurationVersion(configurationVersion string) *GetReloadNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get reload not found response -func (o *GetReloadNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get reload not found response -func (o *GetReloadNotFound) WithPayload(payload *models.Error) *GetReloadNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get reload not found response -func (o *GetReloadNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetReloadNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetReloadDefault General Error - -swagger:response getReloadDefault -*/ -type GetReloadDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetReloadDefault creates GetReloadDefault with default headers values -func NewGetReloadDefault(code int) *GetReloadDefault { - if code <= 0 { - code = 500 - } - - return &GetReloadDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get reload default response -func (o *GetReloadDefault) WithStatusCode(code int) *GetReloadDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get reload default response -func (o *GetReloadDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get reload default response -func (o *GetReloadDefault) WithConfigurationVersion(configurationVersion string) *GetReloadDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get reload default response -func (o *GetReloadDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get reload default response -func (o *GetReloadDefault) WithPayload(payload *models.Error) *GetReloadDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get reload default response -func (o *GetReloadDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetReloadDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/reloads/get_reload_urlbuilder.go b/operations/reloads/get_reload_urlbuilder.go deleted file mode 100644 index 54dc0f0e..00000000 --- a/operations/reloads/get_reload_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetReloadURL generates an URL for the get reload operation -type GetReloadURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetReloadURL) WithBasePath(bp string) *GetReloadURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetReloadURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetReloadURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/reloads/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetReloadURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetReloadURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetReloadURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetReloadURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetReloadURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetReloadURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetReloadURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/reloads/get_reloads.go b/operations/reloads/get_reloads.go deleted file mode 100644 index 8151af9d..00000000 --- a/operations/reloads/get_reloads.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetReloadsHandlerFunc turns a function with the right signature into a get reloads handler -type GetReloadsHandlerFunc func(GetReloadsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetReloadsHandlerFunc) Handle(params GetReloadsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetReloadsHandler interface for that can handle valid get reloads params -type GetReloadsHandler interface { - Handle(GetReloadsParams, interface{}) middleware.Responder -} - -// NewGetReloads creates a new http.Handler for the get reloads operation -func NewGetReloads(ctx *middleware.Context, handler GetReloadsHandler) *GetReloads { - return &GetReloads{Context: ctx, Handler: handler} -} - -/* - GetReloads swagger:route GET /services/haproxy/reloads Reloads getReloads - -Return list of HAProxy Reloads. - -Returns a list of HAProxy reloads. -*/ -type GetReloads struct { - Context *middleware.Context - Handler GetReloadsHandler -} - -func (o *GetReloads) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetReloadsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/reloads/get_reloads_parameters.go b/operations/reloads/get_reloads_parameters.go deleted file mode 100644 index 677d27d8..00000000 --- a/operations/reloads/get_reloads_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetReloadsParams creates a new GetReloadsParams object -// -// There are no default values defined in the spec. -func NewGetReloadsParams() GetReloadsParams { - - return GetReloadsParams{} -} - -// GetReloadsParams contains all the bound params for the get reloads operation -// typically these are obtained from a http.Request -// -// swagger:parameters getReloads -type GetReloadsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetReloadsParams() beforehand. -func (o *GetReloadsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/reloads/get_reloads_responses.go b/operations/reloads/get_reloads_responses.go deleted file mode 100644 index 5db1e148..00000000 --- a/operations/reloads/get_reloads_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetReloadsOKCode is the HTTP code returned for type GetReloadsOK -const GetReloadsOKCode int = 200 - -/* -GetReloadsOK Success - -swagger:response getReloadsOK -*/ -type GetReloadsOK struct { - - /* - In: Body - */ - Payload models.Reloads `json:"body,omitempty"` -} - -// NewGetReloadsOK creates GetReloadsOK with default headers values -func NewGetReloadsOK() *GetReloadsOK { - - return &GetReloadsOK{} -} - -// WithPayload adds the payload to the get reloads o k response -func (o *GetReloadsOK) WithPayload(payload models.Reloads) *GetReloadsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get reloads o k response -func (o *GetReloadsOK) SetPayload(payload models.Reloads) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetReloadsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Reloads{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetReloadsDefault General Error - -swagger:response getReloadsDefault -*/ -type GetReloadsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetReloadsDefault creates GetReloadsDefault with default headers values -func NewGetReloadsDefault(code int) *GetReloadsDefault { - if code <= 0 { - code = 500 - } - - return &GetReloadsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get reloads default response -func (o *GetReloadsDefault) WithStatusCode(code int) *GetReloadsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get reloads default response -func (o *GetReloadsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get reloads default response -func (o *GetReloadsDefault) WithConfigurationVersion(configurationVersion string) *GetReloadsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get reloads default response -func (o *GetReloadsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get reloads default response -func (o *GetReloadsDefault) WithPayload(payload *models.Error) *GetReloadsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get reloads default response -func (o *GetReloadsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetReloadsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/reloads/get_reloads_urlbuilder.go b/operations/reloads/get_reloads_urlbuilder.go deleted file mode 100644 index 80c592e4..00000000 --- a/operations/reloads/get_reloads_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package reloads - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetReloadsURL generates an URL for the get reloads operation -type GetReloadsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetReloadsURL) WithBasePath(bp string) *GetReloadsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetReloadsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetReloadsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/reloads" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetReloadsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetReloadsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetReloadsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetReloadsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetReloadsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetReloadsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/resolver/create_resolver.go b/operations/resolver/create_resolver.go deleted file mode 100644 index c0dd9538..00000000 --- a/operations/resolver/create_resolver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateResolverHandlerFunc turns a function with the right signature into a create resolver handler -type CreateResolverHandlerFunc func(CreateResolverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateResolverHandlerFunc) Handle(params CreateResolverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateResolverHandler interface for that can handle valid create resolver params -type CreateResolverHandler interface { - Handle(CreateResolverParams, interface{}) middleware.Responder -} - -// NewCreateResolver creates a new http.Handler for the create resolver operation -func NewCreateResolver(ctx *middleware.Context, handler CreateResolverHandler) *CreateResolver { - return &CreateResolver{Context: ctx, Handler: handler} -} - -/* - CreateResolver swagger:route POST /services/haproxy/configuration/resolvers Resolver createResolver - -# Add a resolver - -Adds a new resolver section to the configuration file. -*/ -type CreateResolver struct { - Context *middleware.Context - Handler CreateResolverHandler -} - -func (o *CreateResolver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateResolverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/resolver/create_resolver_parameters.go b/operations/resolver/create_resolver_parameters.go deleted file mode 100644 index 50970553..00000000 --- a/operations/resolver/create_resolver_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateResolverParams creates a new CreateResolverParams object -// with the default values initialized. -func NewCreateResolverParams() CreateResolverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateResolverParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateResolverParams contains all the bound params for the create resolver operation -// typically these are obtained from a http.Request -// -// swagger:parameters createResolver -type CreateResolverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Resolver - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateResolverParams() beforehand. -func (o *CreateResolverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Resolver - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateResolverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateResolverParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateResolverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateResolverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/resolver/create_resolver_responses.go b/operations/resolver/create_resolver_responses.go deleted file mode 100644 index bf10b333..00000000 --- a/operations/resolver/create_resolver_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateResolverCreatedCode is the HTTP code returned for type CreateResolverCreated -const CreateResolverCreatedCode int = 201 - -/* -CreateResolverCreated Resolver created - -swagger:response createResolverCreated -*/ -type CreateResolverCreated struct { - - /* - In: Body - */ - Payload *models.Resolver `json:"body,omitempty"` -} - -// NewCreateResolverCreated creates CreateResolverCreated with default headers values -func NewCreateResolverCreated() *CreateResolverCreated { - - return &CreateResolverCreated{} -} - -// WithPayload adds the payload to the create resolver created response -func (o *CreateResolverCreated) WithPayload(payload *models.Resolver) *CreateResolverCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create resolver created response -func (o *CreateResolverCreated) SetPayload(payload *models.Resolver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateResolverCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateResolverAcceptedCode is the HTTP code returned for type CreateResolverAccepted -const CreateResolverAcceptedCode int = 202 - -/* -CreateResolverAccepted Configuration change accepted and reload requested - -swagger:response createResolverAccepted -*/ -type CreateResolverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Resolver `json:"body,omitempty"` -} - -// NewCreateResolverAccepted creates CreateResolverAccepted with default headers values -func NewCreateResolverAccepted() *CreateResolverAccepted { - - return &CreateResolverAccepted{} -} - -// WithReloadID adds the reloadId to the create resolver accepted response -func (o *CreateResolverAccepted) WithReloadID(reloadID string) *CreateResolverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create resolver accepted response -func (o *CreateResolverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create resolver accepted response -func (o *CreateResolverAccepted) WithPayload(payload *models.Resolver) *CreateResolverAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create resolver accepted response -func (o *CreateResolverAccepted) SetPayload(payload *models.Resolver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateResolverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateResolverBadRequestCode is the HTTP code returned for type CreateResolverBadRequest -const CreateResolverBadRequestCode int = 400 - -/* -CreateResolverBadRequest Bad request - -swagger:response createResolverBadRequest -*/ -type CreateResolverBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateResolverBadRequest creates CreateResolverBadRequest with default headers values -func NewCreateResolverBadRequest() *CreateResolverBadRequest { - - return &CreateResolverBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create resolver bad request response -func (o *CreateResolverBadRequest) WithConfigurationVersion(configurationVersion string) *CreateResolverBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create resolver bad request response -func (o *CreateResolverBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create resolver bad request response -func (o *CreateResolverBadRequest) WithPayload(payload *models.Error) *CreateResolverBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create resolver bad request response -func (o *CreateResolverBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateResolverBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateResolverConflictCode is the HTTP code returned for type CreateResolverConflict -const CreateResolverConflictCode int = 409 - -/* -CreateResolverConflict The specified resource already exists - -swagger:response createResolverConflict -*/ -type CreateResolverConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateResolverConflict creates CreateResolverConflict with default headers values -func NewCreateResolverConflict() *CreateResolverConflict { - - return &CreateResolverConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create resolver conflict response -func (o *CreateResolverConflict) WithConfigurationVersion(configurationVersion string) *CreateResolverConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create resolver conflict response -func (o *CreateResolverConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create resolver conflict response -func (o *CreateResolverConflict) WithPayload(payload *models.Error) *CreateResolverConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create resolver conflict response -func (o *CreateResolverConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateResolverConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateResolverDefault General Error - -swagger:response createResolverDefault -*/ -type CreateResolverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateResolverDefault creates CreateResolverDefault with default headers values -func NewCreateResolverDefault(code int) *CreateResolverDefault { - if code <= 0 { - code = 500 - } - - return &CreateResolverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create resolver default response -func (o *CreateResolverDefault) WithStatusCode(code int) *CreateResolverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create resolver default response -func (o *CreateResolverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create resolver default response -func (o *CreateResolverDefault) WithConfigurationVersion(configurationVersion string) *CreateResolverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create resolver default response -func (o *CreateResolverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create resolver default response -func (o *CreateResolverDefault) WithPayload(payload *models.Error) *CreateResolverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create resolver default response -func (o *CreateResolverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateResolverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/resolver/create_resolver_urlbuilder.go b/operations/resolver/create_resolver_urlbuilder.go deleted file mode 100644 index f90853a4..00000000 --- a/operations/resolver/create_resolver_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateResolverURL generates an URL for the create resolver operation -type CreateResolverURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateResolverURL) WithBasePath(bp string) *CreateResolverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateResolverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateResolverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/resolvers" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateResolverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateResolverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateResolverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateResolverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateResolverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateResolverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/resolver/delete_resolver.go b/operations/resolver/delete_resolver.go deleted file mode 100644 index f58b004f..00000000 --- a/operations/resolver/delete_resolver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteResolverHandlerFunc turns a function with the right signature into a delete resolver handler -type DeleteResolverHandlerFunc func(DeleteResolverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteResolverHandlerFunc) Handle(params DeleteResolverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteResolverHandler interface for that can handle valid delete resolver params -type DeleteResolverHandler interface { - Handle(DeleteResolverParams, interface{}) middleware.Responder -} - -// NewDeleteResolver creates a new http.Handler for the delete resolver operation -func NewDeleteResolver(ctx *middleware.Context, handler DeleteResolverHandler) *DeleteResolver { - return &DeleteResolver{Context: ctx, Handler: handler} -} - -/* - DeleteResolver swagger:route DELETE /services/haproxy/configuration/resolvers/{name} Resolver deleteResolver - -# Delete a resolver - -Deletes a resolver from the configuration by it's name. -*/ -type DeleteResolver struct { - Context *middleware.Context - Handler DeleteResolverHandler -} - -func (o *DeleteResolver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteResolverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/resolver/delete_resolver_parameters.go b/operations/resolver/delete_resolver_parameters.go deleted file mode 100644 index 175324a4..00000000 --- a/operations/resolver/delete_resolver_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteResolverParams creates a new DeleteResolverParams object -// with the default values initialized. -func NewDeleteResolverParams() DeleteResolverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteResolverParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteResolverParams contains all the bound params for the delete resolver operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteResolver -type DeleteResolverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Resolver name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteResolverParams() beforehand. -func (o *DeleteResolverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteResolverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteResolverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteResolverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteResolverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/resolver/delete_resolver_responses.go b/operations/resolver/delete_resolver_responses.go deleted file mode 100644 index 0404f81d..00000000 --- a/operations/resolver/delete_resolver_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteResolverAcceptedCode is the HTTP code returned for type DeleteResolverAccepted -const DeleteResolverAcceptedCode int = 202 - -/* -DeleteResolverAccepted Configuration change accepted and reload requested - -swagger:response deleteResolverAccepted -*/ -type DeleteResolverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteResolverAccepted creates DeleteResolverAccepted with default headers values -func NewDeleteResolverAccepted() *DeleteResolverAccepted { - - return &DeleteResolverAccepted{} -} - -// WithReloadID adds the reloadId to the delete resolver accepted response -func (o *DeleteResolverAccepted) WithReloadID(reloadID string) *DeleteResolverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete resolver accepted response -func (o *DeleteResolverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteResolverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteResolverNoContentCode is the HTTP code returned for type DeleteResolverNoContent -const DeleteResolverNoContentCode int = 204 - -/* -DeleteResolverNoContent Resolver deleted - -swagger:response deleteResolverNoContent -*/ -type DeleteResolverNoContent struct { -} - -// NewDeleteResolverNoContent creates DeleteResolverNoContent with default headers values -func NewDeleteResolverNoContent() *DeleteResolverNoContent { - - return &DeleteResolverNoContent{} -} - -// WriteResponse to the client -func (o *DeleteResolverNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteResolverNotFoundCode is the HTTP code returned for type DeleteResolverNotFound -const DeleteResolverNotFoundCode int = 404 - -/* -DeleteResolverNotFound The specified resource was not found - -swagger:response deleteResolverNotFound -*/ -type DeleteResolverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteResolverNotFound creates DeleteResolverNotFound with default headers values -func NewDeleteResolverNotFound() *DeleteResolverNotFound { - - return &DeleteResolverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete resolver not found response -func (o *DeleteResolverNotFound) WithConfigurationVersion(configurationVersion string) *DeleteResolverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete resolver not found response -func (o *DeleteResolverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete resolver not found response -func (o *DeleteResolverNotFound) WithPayload(payload *models.Error) *DeleteResolverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete resolver not found response -func (o *DeleteResolverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteResolverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteResolverDefault General Error - -swagger:response deleteResolverDefault -*/ -type DeleteResolverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteResolverDefault creates DeleteResolverDefault with default headers values -func NewDeleteResolverDefault(code int) *DeleteResolverDefault { - if code <= 0 { - code = 500 - } - - return &DeleteResolverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete resolver default response -func (o *DeleteResolverDefault) WithStatusCode(code int) *DeleteResolverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete resolver default response -func (o *DeleteResolverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete resolver default response -func (o *DeleteResolverDefault) WithConfigurationVersion(configurationVersion string) *DeleteResolverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete resolver default response -func (o *DeleteResolverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete resolver default response -func (o *DeleteResolverDefault) WithPayload(payload *models.Error) *DeleteResolverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete resolver default response -func (o *DeleteResolverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteResolverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/resolver/delete_resolver_urlbuilder.go b/operations/resolver/delete_resolver_urlbuilder.go deleted file mode 100644 index 83caa6da..00000000 --- a/operations/resolver/delete_resolver_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteResolverURL generates an URL for the delete resolver operation -type DeleteResolverURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteResolverURL) WithBasePath(bp string) *DeleteResolverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteResolverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteResolverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/resolvers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteResolverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteResolverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteResolverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteResolverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteResolverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteResolverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteResolverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/resolver/get_resolver.go b/operations/resolver/get_resolver.go deleted file mode 100644 index 08605344..00000000 --- a/operations/resolver/get_resolver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetResolverHandlerFunc turns a function with the right signature into a get resolver handler -type GetResolverHandlerFunc func(GetResolverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetResolverHandlerFunc) Handle(params GetResolverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetResolverHandler interface for that can handle valid get resolver params -type GetResolverHandler interface { - Handle(GetResolverParams, interface{}) middleware.Responder -} - -// NewGetResolver creates a new http.Handler for the get resolver operation -func NewGetResolver(ctx *middleware.Context, handler GetResolverHandler) *GetResolver { - return &GetResolver{Context: ctx, Handler: handler} -} - -/* - GetResolver swagger:route GET /services/haproxy/configuration/resolvers/{name} Resolver getResolver - -# Return a resolver - -Returns one resolver section configuration by it's name. -*/ -type GetResolver struct { - Context *middleware.Context - Handler GetResolverHandler -} - -func (o *GetResolver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetResolverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/resolver/get_resolver_parameters.go b/operations/resolver/get_resolver_parameters.go deleted file mode 100644 index 16448d51..00000000 --- a/operations/resolver/get_resolver_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetResolverParams creates a new GetResolverParams object -// with the default values initialized. -func NewGetResolverParams() GetResolverParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetResolverParams{ - FullSection: &fullSectionDefault, - } -} - -// GetResolverParams contains all the bound params for the get resolver operation -// typically these are obtained from a http.Request -// -// swagger:parameters getResolver -type GetResolverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Resolver name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetResolverParams() beforehand. -func (o *GetResolverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetResolverParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetResolverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetResolverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/resolver/get_resolver_responses.go b/operations/resolver/get_resolver_responses.go deleted file mode 100644 index 69ef0588..00000000 --- a/operations/resolver/get_resolver_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetResolverOKCode is the HTTP code returned for type GetResolverOK -const GetResolverOKCode int = 200 - -/* -GetResolverOK Successful operation - -swagger:response getResolverOK -*/ -type GetResolverOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Resolver `json:"body,omitempty"` -} - -// NewGetResolverOK creates GetResolverOK with default headers values -func NewGetResolverOK() *GetResolverOK { - - return &GetResolverOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get resolver o k response -func (o *GetResolverOK) WithConfigurationVersion(configurationVersion string) *GetResolverOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get resolver o k response -func (o *GetResolverOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get resolver o k response -func (o *GetResolverOK) WithPayload(payload *models.Resolver) *GetResolverOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resolver o k response -func (o *GetResolverOK) SetPayload(payload *models.Resolver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResolverOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetResolverNotFoundCode is the HTTP code returned for type GetResolverNotFound -const GetResolverNotFoundCode int = 404 - -/* -GetResolverNotFound The specified resource was not found - -swagger:response getResolverNotFound -*/ -type GetResolverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetResolverNotFound creates GetResolverNotFound with default headers values -func NewGetResolverNotFound() *GetResolverNotFound { - - return &GetResolverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get resolver not found response -func (o *GetResolverNotFound) WithConfigurationVersion(configurationVersion string) *GetResolverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get resolver not found response -func (o *GetResolverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get resolver not found response -func (o *GetResolverNotFound) WithPayload(payload *models.Error) *GetResolverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resolver not found response -func (o *GetResolverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResolverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetResolverDefault General Error - -swagger:response getResolverDefault -*/ -type GetResolverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetResolverDefault creates GetResolverDefault with default headers values -func NewGetResolverDefault(code int) *GetResolverDefault { - if code <= 0 { - code = 500 - } - - return &GetResolverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get resolver default response -func (o *GetResolverDefault) WithStatusCode(code int) *GetResolverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get resolver default response -func (o *GetResolverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get resolver default response -func (o *GetResolverDefault) WithConfigurationVersion(configurationVersion string) *GetResolverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get resolver default response -func (o *GetResolverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get resolver default response -func (o *GetResolverDefault) WithPayload(payload *models.Error) *GetResolverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resolver default response -func (o *GetResolverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResolverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/resolver/get_resolver_urlbuilder.go b/operations/resolver/get_resolver_urlbuilder.go deleted file mode 100644 index 233c5178..00000000 --- a/operations/resolver/get_resolver_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetResolverURL generates an URL for the get resolver operation -type GetResolverURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResolverURL) WithBasePath(bp string) *GetResolverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResolverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetResolverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/resolvers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetResolverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetResolverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetResolverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetResolverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetResolverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetResolverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetResolverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/resolver/get_resolvers.go b/operations/resolver/get_resolvers.go deleted file mode 100644 index c808345c..00000000 --- a/operations/resolver/get_resolvers.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetResolversHandlerFunc turns a function with the right signature into a get resolvers handler -type GetResolversHandlerFunc func(GetResolversParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetResolversHandlerFunc) Handle(params GetResolversParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetResolversHandler interface for that can handle valid get resolvers params -type GetResolversHandler interface { - Handle(GetResolversParams, interface{}) middleware.Responder -} - -// NewGetResolvers creates a new http.Handler for the get resolvers operation -func NewGetResolvers(ctx *middleware.Context, handler GetResolversHandler) *GetResolvers { - return &GetResolvers{Context: ctx, Handler: handler} -} - -/* - GetResolvers swagger:route GET /services/haproxy/configuration/resolvers Resolver getResolvers - -# Return an array of resolvers - -Returns an array of all configured resolvers. -*/ -type GetResolvers struct { - Context *middleware.Context - Handler GetResolversHandler -} - -func (o *GetResolvers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetResolversParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/resolver/get_resolvers_parameters.go b/operations/resolver/get_resolvers_parameters.go deleted file mode 100644 index df1cb244..00000000 --- a/operations/resolver/get_resolvers_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetResolversParams creates a new GetResolversParams object -// with the default values initialized. -func NewGetResolversParams() GetResolversParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetResolversParams{ - FullSection: &fullSectionDefault, - } -} - -// GetResolversParams contains all the bound params for the get resolvers operation -// typically these are obtained from a http.Request -// -// swagger:parameters getResolvers -type GetResolversParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetResolversParams() beforehand. -func (o *GetResolversParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetResolversParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetResolversParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetResolversParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/resolver/get_resolvers_responses.go b/operations/resolver/get_resolvers_responses.go deleted file mode 100644 index 2f114fb7..00000000 --- a/operations/resolver/get_resolvers_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetResolversOKCode is the HTTP code returned for type GetResolversOK -const GetResolversOKCode int = 200 - -/* -GetResolversOK Successful operation - -swagger:response getResolversOK -*/ -type GetResolversOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Resolvers `json:"body,omitempty"` -} - -// NewGetResolversOK creates GetResolversOK with default headers values -func NewGetResolversOK() *GetResolversOK { - - return &GetResolversOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get resolvers o k response -func (o *GetResolversOK) WithConfigurationVersion(configurationVersion string) *GetResolversOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get resolvers o k response -func (o *GetResolversOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get resolvers o k response -func (o *GetResolversOK) WithPayload(payload models.Resolvers) *GetResolversOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resolvers o k response -func (o *GetResolversOK) SetPayload(payload models.Resolvers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResolversOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Resolvers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetResolversDefault General Error - -swagger:response getResolversDefault -*/ -type GetResolversDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetResolversDefault creates GetResolversDefault with default headers values -func NewGetResolversDefault(code int) *GetResolversDefault { - if code <= 0 { - code = 500 - } - - return &GetResolversDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get resolvers default response -func (o *GetResolversDefault) WithStatusCode(code int) *GetResolversDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get resolvers default response -func (o *GetResolversDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get resolvers default response -func (o *GetResolversDefault) WithConfigurationVersion(configurationVersion string) *GetResolversDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get resolvers default response -func (o *GetResolversDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get resolvers default response -func (o *GetResolversDefault) WithPayload(payload *models.Error) *GetResolversDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get resolvers default response -func (o *GetResolversDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetResolversDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/resolver/get_resolvers_urlbuilder.go b/operations/resolver/get_resolvers_urlbuilder.go deleted file mode 100644 index ac57da6e..00000000 --- a/operations/resolver/get_resolvers_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetResolversURL generates an URL for the get resolvers operation -type GetResolversURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResolversURL) WithBasePath(bp string) *GetResolversURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetResolversURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetResolversURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/resolvers" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetResolversURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetResolversURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetResolversURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetResolversURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetResolversURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetResolversURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/resolver/replace_resolver.go b/operations/resolver/replace_resolver.go deleted file mode 100644 index 342b1793..00000000 --- a/operations/resolver/replace_resolver.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceResolverHandlerFunc turns a function with the right signature into a replace resolver handler -type ReplaceResolverHandlerFunc func(ReplaceResolverParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceResolverHandlerFunc) Handle(params ReplaceResolverParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceResolverHandler interface for that can handle valid replace resolver params -type ReplaceResolverHandler interface { - Handle(ReplaceResolverParams, interface{}) middleware.Responder -} - -// NewReplaceResolver creates a new http.Handler for the replace resolver operation -func NewReplaceResolver(ctx *middleware.Context, handler ReplaceResolverHandler) *ReplaceResolver { - return &ReplaceResolver{Context: ctx, Handler: handler} -} - -/* - ReplaceResolver swagger:route PUT /services/haproxy/configuration/resolvers/{name} Resolver replaceResolver - -# Replace a resolver - -Replaces a resolver configuration by it's name. -*/ -type ReplaceResolver struct { - Context *middleware.Context - Handler ReplaceResolverHandler -} - -func (o *ReplaceResolver) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceResolverParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/resolver/replace_resolver_parameters.go b/operations/resolver/replace_resolver_parameters.go deleted file mode 100644 index 73ddeb16..00000000 --- a/operations/resolver/replace_resolver_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceResolverParams creates a new ReplaceResolverParams object -// with the default values initialized. -func NewReplaceResolverParams() ReplaceResolverParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceResolverParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceResolverParams contains all the bound params for the replace resolver operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceResolver -type ReplaceResolverParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Resolver - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Resolver name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceResolverParams() beforehand. -func (o *ReplaceResolverParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Resolver - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceResolverParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceResolverParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceResolverParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceResolverParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceResolverParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceResolverParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/resolver/replace_resolver_responses.go b/operations/resolver/replace_resolver_responses.go deleted file mode 100644 index e08cfbba..00000000 --- a/operations/resolver/replace_resolver_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceResolverOKCode is the HTTP code returned for type ReplaceResolverOK -const ReplaceResolverOKCode int = 200 - -/* -ReplaceResolverOK Resolver replaced - -swagger:response replaceResolverOK -*/ -type ReplaceResolverOK struct { - - /* - In: Body - */ - Payload *models.Resolver `json:"body,omitempty"` -} - -// NewReplaceResolverOK creates ReplaceResolverOK with default headers values -func NewReplaceResolverOK() *ReplaceResolverOK { - - return &ReplaceResolverOK{} -} - -// WithPayload adds the payload to the replace resolver o k response -func (o *ReplaceResolverOK) WithPayload(payload *models.Resolver) *ReplaceResolverOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace resolver o k response -func (o *ReplaceResolverOK) SetPayload(payload *models.Resolver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceResolverOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceResolverAcceptedCode is the HTTP code returned for type ReplaceResolverAccepted -const ReplaceResolverAcceptedCode int = 202 - -/* -ReplaceResolverAccepted Configuration change accepted and reload requested - -swagger:response replaceResolverAccepted -*/ -type ReplaceResolverAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Resolver `json:"body,omitempty"` -} - -// NewReplaceResolverAccepted creates ReplaceResolverAccepted with default headers values -func NewReplaceResolverAccepted() *ReplaceResolverAccepted { - - return &ReplaceResolverAccepted{} -} - -// WithReloadID adds the reloadId to the replace resolver accepted response -func (o *ReplaceResolverAccepted) WithReloadID(reloadID string) *ReplaceResolverAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace resolver accepted response -func (o *ReplaceResolverAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace resolver accepted response -func (o *ReplaceResolverAccepted) WithPayload(payload *models.Resolver) *ReplaceResolverAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace resolver accepted response -func (o *ReplaceResolverAccepted) SetPayload(payload *models.Resolver) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceResolverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceResolverBadRequestCode is the HTTP code returned for type ReplaceResolverBadRequest -const ReplaceResolverBadRequestCode int = 400 - -/* -ReplaceResolverBadRequest Bad request - -swagger:response replaceResolverBadRequest -*/ -type ReplaceResolverBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceResolverBadRequest creates ReplaceResolverBadRequest with default headers values -func NewReplaceResolverBadRequest() *ReplaceResolverBadRequest { - - return &ReplaceResolverBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace resolver bad request response -func (o *ReplaceResolverBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceResolverBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace resolver bad request response -func (o *ReplaceResolverBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace resolver bad request response -func (o *ReplaceResolverBadRequest) WithPayload(payload *models.Error) *ReplaceResolverBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace resolver bad request response -func (o *ReplaceResolverBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceResolverBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceResolverNotFoundCode is the HTTP code returned for type ReplaceResolverNotFound -const ReplaceResolverNotFoundCode int = 404 - -/* -ReplaceResolverNotFound The specified resource was not found - -swagger:response replaceResolverNotFound -*/ -type ReplaceResolverNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceResolverNotFound creates ReplaceResolverNotFound with default headers values -func NewReplaceResolverNotFound() *ReplaceResolverNotFound { - - return &ReplaceResolverNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace resolver not found response -func (o *ReplaceResolverNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceResolverNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace resolver not found response -func (o *ReplaceResolverNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace resolver not found response -func (o *ReplaceResolverNotFound) WithPayload(payload *models.Error) *ReplaceResolverNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace resolver not found response -func (o *ReplaceResolverNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceResolverNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceResolverDefault General Error - -swagger:response replaceResolverDefault -*/ -type ReplaceResolverDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceResolverDefault creates ReplaceResolverDefault with default headers values -func NewReplaceResolverDefault(code int) *ReplaceResolverDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceResolverDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace resolver default response -func (o *ReplaceResolverDefault) WithStatusCode(code int) *ReplaceResolverDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace resolver default response -func (o *ReplaceResolverDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace resolver default response -func (o *ReplaceResolverDefault) WithConfigurationVersion(configurationVersion string) *ReplaceResolverDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace resolver default response -func (o *ReplaceResolverDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace resolver default response -func (o *ReplaceResolverDefault) WithPayload(payload *models.Error) *ReplaceResolverDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace resolver default response -func (o *ReplaceResolverDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceResolverDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/resolver/replace_resolver_urlbuilder.go b/operations/resolver/replace_resolver_urlbuilder.go deleted file mode 100644 index 14dfdc97..00000000 --- a/operations/resolver/replace_resolver_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package resolver - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceResolverURL generates an URL for the replace resolver operation -type ReplaceResolverURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceResolverURL) WithBasePath(bp string) *ReplaceResolverURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceResolverURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceResolverURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/resolvers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceResolverURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceResolverURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceResolverURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceResolverURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceResolverURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceResolverURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceResolverURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/ring/create_ring.go b/operations/ring/create_ring.go deleted file mode 100644 index 55dd5bca..00000000 --- a/operations/ring/create_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateRingHandlerFunc turns a function with the right signature into a create ring handler -type CreateRingHandlerFunc func(CreateRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateRingHandlerFunc) Handle(params CreateRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateRingHandler interface for that can handle valid create ring params -type CreateRingHandler interface { - Handle(CreateRingParams, interface{}) middleware.Responder -} - -// NewCreateRing creates a new http.Handler for the create ring operation -func NewCreateRing(ctx *middleware.Context, handler CreateRingHandler) *CreateRing { - return &CreateRing{Context: ctx, Handler: handler} -} - -/* - CreateRing swagger:route POST /services/haproxy/configuration/rings Ring createRing - -# Add a ring - -Adds a new ring to the configuration file. -*/ -type CreateRing struct { - Context *middleware.Context - Handler CreateRingHandler -} - -func (o *CreateRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/ring/create_ring_parameters.go b/operations/ring/create_ring_parameters.go deleted file mode 100644 index 5580841f..00000000 --- a/operations/ring/create_ring_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateRingParams creates a new CreateRingParams object -// with the default values initialized. -func NewCreateRingParams() CreateRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateRingParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateRingParams contains all the bound params for the create ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters createRing -type CreateRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Ring - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateRingParams() beforehand. -func (o *CreateRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Ring - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateRingParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/ring/create_ring_responses.go b/operations/ring/create_ring_responses.go deleted file mode 100644 index e87270af..00000000 --- a/operations/ring/create_ring_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateRingCreatedCode is the HTTP code returned for type CreateRingCreated -const CreateRingCreatedCode int = 201 - -/* -CreateRingCreated Ring created - -swagger:response createRingCreated -*/ -type CreateRingCreated struct { - - /* - In: Body - */ - Payload *models.Ring `json:"body,omitempty"` -} - -// NewCreateRingCreated creates CreateRingCreated with default headers values -func NewCreateRingCreated() *CreateRingCreated { - - return &CreateRingCreated{} -} - -// WithPayload adds the payload to the create ring created response -func (o *CreateRingCreated) WithPayload(payload *models.Ring) *CreateRingCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ring created response -func (o *CreateRingCreated) SetPayload(payload *models.Ring) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateRingCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateRingAcceptedCode is the HTTP code returned for type CreateRingAccepted -const CreateRingAcceptedCode int = 202 - -/* -CreateRingAccepted Configuration change accepted and reload requested - -swagger:response createRingAccepted -*/ -type CreateRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Ring `json:"body,omitempty"` -} - -// NewCreateRingAccepted creates CreateRingAccepted with default headers values -func NewCreateRingAccepted() *CreateRingAccepted { - - return &CreateRingAccepted{} -} - -// WithReloadID adds the reloadId to the create ring accepted response -func (o *CreateRingAccepted) WithReloadID(reloadID string) *CreateRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create ring accepted response -func (o *CreateRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create ring accepted response -func (o *CreateRingAccepted) WithPayload(payload *models.Ring) *CreateRingAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ring accepted response -func (o *CreateRingAccepted) SetPayload(payload *models.Ring) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateRingBadRequestCode is the HTTP code returned for type CreateRingBadRequest -const CreateRingBadRequestCode int = 400 - -/* -CreateRingBadRequest Bad request - -swagger:response createRingBadRequest -*/ -type CreateRingBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateRingBadRequest creates CreateRingBadRequest with default headers values -func NewCreateRingBadRequest() *CreateRingBadRequest { - - return &CreateRingBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create ring bad request response -func (o *CreateRingBadRequest) WithConfigurationVersion(configurationVersion string) *CreateRingBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ring bad request response -func (o *CreateRingBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ring bad request response -func (o *CreateRingBadRequest) WithPayload(payload *models.Error) *CreateRingBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ring bad request response -func (o *CreateRingBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateRingBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateRingConflictCode is the HTTP code returned for type CreateRingConflict -const CreateRingConflictCode int = 409 - -/* -CreateRingConflict The specified resource already exists - -swagger:response createRingConflict -*/ -type CreateRingConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateRingConflict creates CreateRingConflict with default headers values -func NewCreateRingConflict() *CreateRingConflict { - - return &CreateRingConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create ring conflict response -func (o *CreateRingConflict) WithConfigurationVersion(configurationVersion string) *CreateRingConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ring conflict response -func (o *CreateRingConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ring conflict response -func (o *CreateRingConflict) WithPayload(payload *models.Error) *CreateRingConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ring conflict response -func (o *CreateRingConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateRingConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateRingDefault General Error - -swagger:response createRingDefault -*/ -type CreateRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateRingDefault creates CreateRingDefault with default headers values -func NewCreateRingDefault(code int) *CreateRingDefault { - if code <= 0 { - code = 500 - } - - return &CreateRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create ring default response -func (o *CreateRingDefault) WithStatusCode(code int) *CreateRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create ring default response -func (o *CreateRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create ring default response -func (o *CreateRingDefault) WithConfigurationVersion(configurationVersion string) *CreateRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ring default response -func (o *CreateRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ring default response -func (o *CreateRingDefault) WithPayload(payload *models.Error) *CreateRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ring default response -func (o *CreateRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/ring/create_ring_urlbuilder.go b/operations/ring/create_ring_urlbuilder.go deleted file mode 100644 index 6897eb4d..00000000 --- a/operations/ring/create_ring_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateRingURL generates an URL for the create ring operation -type CreateRingURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateRingURL) WithBasePath(bp string) *CreateRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/ring/delete_ring.go b/operations/ring/delete_ring.go deleted file mode 100644 index 4baeeb3e..00000000 --- a/operations/ring/delete_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteRingHandlerFunc turns a function with the right signature into a delete ring handler -type DeleteRingHandlerFunc func(DeleteRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteRingHandlerFunc) Handle(params DeleteRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteRingHandler interface for that can handle valid delete ring params -type DeleteRingHandler interface { - Handle(DeleteRingParams, interface{}) middleware.Responder -} - -// NewDeleteRing creates a new http.Handler for the delete ring operation -func NewDeleteRing(ctx *middleware.Context, handler DeleteRingHandler) *DeleteRing { - return &DeleteRing{Context: ctx, Handler: handler} -} - -/* - DeleteRing swagger:route DELETE /services/haproxy/configuration/rings/{name} Ring deleteRing - -# Delete a ring - -Deletes a ring from the configuration by it's name. -*/ -type DeleteRing struct { - Context *middleware.Context - Handler DeleteRingHandler -} - -func (o *DeleteRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/ring/delete_ring_parameters.go b/operations/ring/delete_ring_parameters.go deleted file mode 100644 index e26d812c..00000000 --- a/operations/ring/delete_ring_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteRingParams creates a new DeleteRingParams object -// with the default values initialized. -func NewDeleteRingParams() DeleteRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteRingParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteRingParams contains all the bound params for the delete ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteRing -type DeleteRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Ring name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteRingParams() beforehand. -func (o *DeleteRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/ring/delete_ring_responses.go b/operations/ring/delete_ring_responses.go deleted file mode 100644 index 1eba0a88..00000000 --- a/operations/ring/delete_ring_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteRingAcceptedCode is the HTTP code returned for type DeleteRingAccepted -const DeleteRingAcceptedCode int = 202 - -/* -DeleteRingAccepted Configuration change accepted and reload requested - -swagger:response deleteRingAccepted -*/ -type DeleteRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteRingAccepted creates DeleteRingAccepted with default headers values -func NewDeleteRingAccepted() *DeleteRingAccepted { - - return &DeleteRingAccepted{} -} - -// WithReloadID adds the reloadId to the delete ring accepted response -func (o *DeleteRingAccepted) WithReloadID(reloadID string) *DeleteRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete ring accepted response -func (o *DeleteRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteRingNoContentCode is the HTTP code returned for type DeleteRingNoContent -const DeleteRingNoContentCode int = 204 - -/* -DeleteRingNoContent Ring deleted - -swagger:response deleteRingNoContent -*/ -type DeleteRingNoContent struct { -} - -// NewDeleteRingNoContent creates DeleteRingNoContent with default headers values -func NewDeleteRingNoContent() *DeleteRingNoContent { - - return &DeleteRingNoContent{} -} - -// WriteResponse to the client -func (o *DeleteRingNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteRingNotFoundCode is the HTTP code returned for type DeleteRingNotFound -const DeleteRingNotFoundCode int = 404 - -/* -DeleteRingNotFound The specified resource was not found - -swagger:response deleteRingNotFound -*/ -type DeleteRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRingNotFound creates DeleteRingNotFound with default headers values -func NewDeleteRingNotFound() *DeleteRingNotFound { - - return &DeleteRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete ring not found response -func (o *DeleteRingNotFound) WithConfigurationVersion(configurationVersion string) *DeleteRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete ring not found response -func (o *DeleteRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete ring not found response -func (o *DeleteRingNotFound) WithPayload(payload *models.Error) *DeleteRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete ring not found response -func (o *DeleteRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteRingDefault General Error - -swagger:response deleteRingDefault -*/ -type DeleteRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRingDefault creates DeleteRingDefault with default headers values -func NewDeleteRingDefault(code int) *DeleteRingDefault { - if code <= 0 { - code = 500 - } - - return &DeleteRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete ring default response -func (o *DeleteRingDefault) WithStatusCode(code int) *DeleteRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete ring default response -func (o *DeleteRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete ring default response -func (o *DeleteRingDefault) WithConfigurationVersion(configurationVersion string) *DeleteRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete ring default response -func (o *DeleteRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete ring default response -func (o *DeleteRingDefault) WithPayload(payload *models.Error) *DeleteRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete ring default response -func (o *DeleteRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/ring/delete_ring_urlbuilder.go b/operations/ring/delete_ring_urlbuilder.go deleted file mode 100644 index bd1def2f..00000000 --- a/operations/ring/delete_ring_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteRingURL generates an URL for the delete ring operation -type DeleteRingURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRingURL) WithBasePath(bp string) *DeleteRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/ring/get_ring.go b/operations/ring/get_ring.go deleted file mode 100644 index 0a20122d..00000000 --- a/operations/ring/get_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetRingHandlerFunc turns a function with the right signature into a get ring handler -type GetRingHandlerFunc func(GetRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetRingHandlerFunc) Handle(params GetRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetRingHandler interface for that can handle valid get ring params -type GetRingHandler interface { - Handle(GetRingParams, interface{}) middleware.Responder -} - -// NewGetRing creates a new http.Handler for the get ring operation -func NewGetRing(ctx *middleware.Context, handler GetRingHandler) *GetRing { - return &GetRing{Context: ctx, Handler: handler} -} - -/* - GetRing swagger:route GET /services/haproxy/configuration/rings/{name} Ring getRing - -# Return a ring - -Returns one ring configuration by it's name. -*/ -type GetRing struct { - Context *middleware.Context - Handler GetRingHandler -} - -func (o *GetRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/ring/get_ring_parameters.go b/operations/ring/get_ring_parameters.go deleted file mode 100644 index b77e59b7..00000000 --- a/operations/ring/get_ring_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetRingParams creates a new GetRingParams object -// with the default values initialized. -func NewGetRingParams() GetRingParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetRingParams{ - FullSection: &fullSectionDefault, - } -} - -// GetRingParams contains all the bound params for the get ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters getRing -type GetRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Ring name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetRingParams() beforehand. -func (o *GetRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetRingParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/ring/get_ring_responses.go b/operations/ring/get_ring_responses.go deleted file mode 100644 index 82669dc7..00000000 --- a/operations/ring/get_ring_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetRingOKCode is the HTTP code returned for type GetRingOK -const GetRingOKCode int = 200 - -/* -GetRingOK Successful operation - -swagger:response getRingOK -*/ -type GetRingOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Ring `json:"body,omitempty"` -} - -// NewGetRingOK creates GetRingOK with default headers values -func NewGetRingOK() *GetRingOK { - - return &GetRingOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get ring o k response -func (o *GetRingOK) WithConfigurationVersion(configurationVersion string) *GetRingOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ring o k response -func (o *GetRingOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ring o k response -func (o *GetRingOK) WithPayload(payload *models.Ring) *GetRingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ring o k response -func (o *GetRingOK) SetPayload(payload *models.Ring) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetRingNotFoundCode is the HTTP code returned for type GetRingNotFound -const GetRingNotFoundCode int = 404 - -/* -GetRingNotFound The specified resource was not found - -swagger:response getRingNotFound -*/ -type GetRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRingNotFound creates GetRingNotFound with default headers values -func NewGetRingNotFound() *GetRingNotFound { - - return &GetRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get ring not found response -func (o *GetRingNotFound) WithConfigurationVersion(configurationVersion string) *GetRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ring not found response -func (o *GetRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ring not found response -func (o *GetRingNotFound) WithPayload(payload *models.Error) *GetRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ring not found response -func (o *GetRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetRingDefault General Error - -swagger:response getRingDefault -*/ -type GetRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRingDefault creates GetRingDefault with default headers values -func NewGetRingDefault(code int) *GetRingDefault { - if code <= 0 { - code = 500 - } - - return &GetRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get ring default response -func (o *GetRingDefault) WithStatusCode(code int) *GetRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get ring default response -func (o *GetRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get ring default response -func (o *GetRingDefault) WithConfigurationVersion(configurationVersion string) *GetRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ring default response -func (o *GetRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ring default response -func (o *GetRingDefault) WithPayload(payload *models.Error) *GetRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ring default response -func (o *GetRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/ring/get_ring_urlbuilder.go b/operations/ring/get_ring_urlbuilder.go deleted file mode 100644 index ce712eb2..00000000 --- a/operations/ring/get_ring_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetRingURL generates an URL for the get ring operation -type GetRingURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRingURL) WithBasePath(bp string) *GetRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/ring/get_rings.go b/operations/ring/get_rings.go deleted file mode 100644 index d810ebe7..00000000 --- a/operations/ring/get_rings.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetRingsHandlerFunc turns a function with the right signature into a get rings handler -type GetRingsHandlerFunc func(GetRingsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetRingsHandlerFunc) Handle(params GetRingsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetRingsHandler interface for that can handle valid get rings params -type GetRingsHandler interface { - Handle(GetRingsParams, interface{}) middleware.Responder -} - -// NewGetRings creates a new http.Handler for the get rings operation -func NewGetRings(ctx *middleware.Context, handler GetRingsHandler) *GetRings { - return &GetRings{Context: ctx, Handler: handler} -} - -/* - GetRings swagger:route GET /services/haproxy/configuration/rings Ring getRings - -# Return an array of rings - -Returns an array of all configured rings. -*/ -type GetRings struct { - Context *middleware.Context - Handler GetRingsHandler -} - -func (o *GetRings) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetRingsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/ring/get_rings_parameters.go b/operations/ring/get_rings_parameters.go deleted file mode 100644 index d88df8ab..00000000 --- a/operations/ring/get_rings_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetRingsParams creates a new GetRingsParams object -// with the default values initialized. -func NewGetRingsParams() GetRingsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetRingsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetRingsParams contains all the bound params for the get rings operation -// typically these are obtained from a http.Request -// -// swagger:parameters getRings -type GetRingsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetRingsParams() beforehand. -func (o *GetRingsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetRingsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetRingsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetRingsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/ring/get_rings_responses.go b/operations/ring/get_rings_responses.go deleted file mode 100644 index 64315331..00000000 --- a/operations/ring/get_rings_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetRingsOKCode is the HTTP code returned for type GetRingsOK -const GetRingsOKCode int = 200 - -/* -GetRingsOK Successful operation - -swagger:response getRingsOK -*/ -type GetRingsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Rings `json:"body,omitempty"` -} - -// NewGetRingsOK creates GetRingsOK with default headers values -func NewGetRingsOK() *GetRingsOK { - - return &GetRingsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get rings o k response -func (o *GetRingsOK) WithConfigurationVersion(configurationVersion string) *GetRingsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get rings o k response -func (o *GetRingsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get rings o k response -func (o *GetRingsOK) WithPayload(payload models.Rings) *GetRingsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get rings o k response -func (o *GetRingsOK) SetPayload(payload models.Rings) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRingsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Rings{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetRingsDefault General Error - -swagger:response getRingsDefault -*/ -type GetRingsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRingsDefault creates GetRingsDefault with default headers values -func NewGetRingsDefault(code int) *GetRingsDefault { - if code <= 0 { - code = 500 - } - - return &GetRingsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get rings default response -func (o *GetRingsDefault) WithStatusCode(code int) *GetRingsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get rings default response -func (o *GetRingsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get rings default response -func (o *GetRingsDefault) WithConfigurationVersion(configurationVersion string) *GetRingsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get rings default response -func (o *GetRingsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get rings default response -func (o *GetRingsDefault) WithPayload(payload *models.Error) *GetRingsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get rings default response -func (o *GetRingsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRingsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/ring/get_rings_urlbuilder.go b/operations/ring/get_rings_urlbuilder.go deleted file mode 100644 index ba3e87d0..00000000 --- a/operations/ring/get_rings_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetRingsURL generates an URL for the get rings operation -type GetRingsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRingsURL) WithBasePath(bp string) *GetRingsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRingsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetRingsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetRingsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetRingsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetRingsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetRingsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetRingsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetRingsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/ring/replace_ring.go b/operations/ring/replace_ring.go deleted file mode 100644 index 1845648b..00000000 --- a/operations/ring/replace_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceRingHandlerFunc turns a function with the right signature into a replace ring handler -type ReplaceRingHandlerFunc func(ReplaceRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceRingHandlerFunc) Handle(params ReplaceRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceRingHandler interface for that can handle valid replace ring params -type ReplaceRingHandler interface { - Handle(ReplaceRingParams, interface{}) middleware.Responder -} - -// NewReplaceRing creates a new http.Handler for the replace ring operation -func NewReplaceRing(ctx *middleware.Context, handler ReplaceRingHandler) *ReplaceRing { - return &ReplaceRing{Context: ctx, Handler: handler} -} - -/* - ReplaceRing swagger:route PUT /services/haproxy/configuration/rings/{name} Ring replaceRing - -# Replace a ring - -Replaces a ring configuration by it's name. -*/ -type ReplaceRing struct { - Context *middleware.Context - Handler ReplaceRingHandler -} - -func (o *ReplaceRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/ring/replace_ring_parameters.go b/operations/ring/replace_ring_parameters.go deleted file mode 100644 index 6586289f..00000000 --- a/operations/ring/replace_ring_parameters.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceRingParams creates a new ReplaceRingParams object -// with the default values initialized. -func NewReplaceRingParams() ReplaceRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceRingParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceRingParams contains all the bound params for the replace ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceRing -type ReplaceRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Ring - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Ring name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceRingParams() beforehand. -func (o *ReplaceRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Ring - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceRingParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/ring/replace_ring_responses.go b/operations/ring/replace_ring_responses.go deleted file mode 100644 index 6ea5b533..00000000 --- a/operations/ring/replace_ring_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceRingOKCode is the HTTP code returned for type ReplaceRingOK -const ReplaceRingOKCode int = 200 - -/* -ReplaceRingOK Ring replaced - -swagger:response replaceRingOK -*/ -type ReplaceRingOK struct { - - /* - In: Body - */ - Payload *models.Ring `json:"body,omitempty"` -} - -// NewReplaceRingOK creates ReplaceRingOK with default headers values -func NewReplaceRingOK() *ReplaceRingOK { - - return &ReplaceRingOK{} -} - -// WithPayload adds the payload to the replace ring o k response -func (o *ReplaceRingOK) WithPayload(payload *models.Ring) *ReplaceRingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace ring o k response -func (o *ReplaceRingOK) SetPayload(payload *models.Ring) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRingAcceptedCode is the HTTP code returned for type ReplaceRingAccepted -const ReplaceRingAcceptedCode int = 202 - -/* -ReplaceRingAccepted Configuration change accepted and reload requested - -swagger:response replaceRingAccepted -*/ -type ReplaceRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Ring `json:"body,omitempty"` -} - -// NewReplaceRingAccepted creates ReplaceRingAccepted with default headers values -func NewReplaceRingAccepted() *ReplaceRingAccepted { - - return &ReplaceRingAccepted{} -} - -// WithReloadID adds the reloadId to the replace ring accepted response -func (o *ReplaceRingAccepted) WithReloadID(reloadID string) *ReplaceRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace ring accepted response -func (o *ReplaceRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace ring accepted response -func (o *ReplaceRingAccepted) WithPayload(payload *models.Ring) *ReplaceRingAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace ring accepted response -func (o *ReplaceRingAccepted) SetPayload(payload *models.Ring) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRingBadRequestCode is the HTTP code returned for type ReplaceRingBadRequest -const ReplaceRingBadRequestCode int = 400 - -/* -ReplaceRingBadRequest Bad request - -swagger:response replaceRingBadRequest -*/ -type ReplaceRingBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRingBadRequest creates ReplaceRingBadRequest with default headers values -func NewReplaceRingBadRequest() *ReplaceRingBadRequest { - - return &ReplaceRingBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace ring bad request response -func (o *ReplaceRingBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceRingBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace ring bad request response -func (o *ReplaceRingBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace ring bad request response -func (o *ReplaceRingBadRequest) WithPayload(payload *models.Error) *ReplaceRingBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace ring bad request response -func (o *ReplaceRingBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRingBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRingNotFoundCode is the HTTP code returned for type ReplaceRingNotFound -const ReplaceRingNotFoundCode int = 404 - -/* -ReplaceRingNotFound The specified resource was not found - -swagger:response replaceRingNotFound -*/ -type ReplaceRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRingNotFound creates ReplaceRingNotFound with default headers values -func NewReplaceRingNotFound() *ReplaceRingNotFound { - - return &ReplaceRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace ring not found response -func (o *ReplaceRingNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace ring not found response -func (o *ReplaceRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace ring not found response -func (o *ReplaceRingNotFound) WithPayload(payload *models.Error) *ReplaceRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace ring not found response -func (o *ReplaceRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceRingDefault General Error - -swagger:response replaceRingDefault -*/ -type ReplaceRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRingDefault creates ReplaceRingDefault with default headers values -func NewReplaceRingDefault(code int) *ReplaceRingDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace ring default response -func (o *ReplaceRingDefault) WithStatusCode(code int) *ReplaceRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace ring default response -func (o *ReplaceRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace ring default response -func (o *ReplaceRingDefault) WithConfigurationVersion(configurationVersion string) *ReplaceRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace ring default response -func (o *ReplaceRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace ring default response -func (o *ReplaceRingDefault) WithPayload(payload *models.Error) *ReplaceRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace ring default response -func (o *ReplaceRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/ring/replace_ring_urlbuilder.go b/operations/ring/replace_ring_urlbuilder.go deleted file mode 100644 index 53a8be87..00000000 --- a/operations/ring/replace_ring_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package ring - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceRingURL generates an URL for the replace ring operation -type ReplaceRingURL struct { - Name string - - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRingURL) WithBasePath(bp string) *ReplaceRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_front_use/create_s_s_l_front_use.go b/operations/s_s_l_front_use/create_s_s_l_front_use.go deleted file mode 100644 index f7955843..00000000 --- a/operations/s_s_l_front_use/create_s_s_l_front_use.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSSLFrontUseHandlerFunc turns a function with the right signature into a create s s l front use handler -type CreateSSLFrontUseHandlerFunc func(CreateSSLFrontUseParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSSLFrontUseHandlerFunc) Handle(params CreateSSLFrontUseParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSSLFrontUseHandler interface for that can handle valid create s s l front use params -type CreateSSLFrontUseHandler interface { - Handle(CreateSSLFrontUseParams, interface{}) middleware.Responder -} - -// NewCreateSSLFrontUse creates a new http.Handler for the create s s l front use operation -func NewCreateSSLFrontUse(ctx *middleware.Context, handler CreateSSLFrontUseHandler) *CreateSSLFrontUse { - return &CreateSSLFrontUse{Context: ctx, Handler: handler} -} - -/* - CreateSSLFrontUse swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses SSLFrontUse createSSLFrontUse - -# Add a new SSLFrontUse - -Adds a new SSLFrontUse in the specified frontend in the configuration file. -*/ -type CreateSSLFrontUse struct { - Context *middleware.Context - Handler CreateSSLFrontUseHandler -} - -func (o *CreateSSLFrontUse) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSSLFrontUseParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_front_use/create_s_s_l_front_use_parameters.go b/operations/s_s_l_front_use/create_s_s_l_front_use_parameters.go deleted file mode 100644 index 56ab506d..00000000 --- a/operations/s_s_l_front_use/create_s_s_l_front_use_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSSLFrontUseParams creates a new CreateSSLFrontUseParams object -// with the default values initialized. -func NewCreateSSLFrontUseParams() CreateSSLFrontUseParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateSSLFrontUseParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateSSLFrontUseParams contains all the bound params for the create s s l front use operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSSLFrontUse -type CreateSSLFrontUseParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SSLFrontUse - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSSLFrontUseParams() beforehand. -func (o *CreateSSLFrontUseParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SSLFrontUse - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateSSLFrontUseParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateSSLFrontUseParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateSSLFrontUseParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSSLFrontUseParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSSLFrontUseParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/s_s_l_front_use/create_s_s_l_front_use_responses.go b/operations/s_s_l_front_use/create_s_s_l_front_use_responses.go deleted file mode 100644 index 06abccf1..00000000 --- a/operations/s_s_l_front_use/create_s_s_l_front_use_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSSLFrontUseCreatedCode is the HTTP code returned for type CreateSSLFrontUseCreated -const CreateSSLFrontUseCreatedCode int = 201 - -/* -CreateSSLFrontUseCreated SSLFrontUse created - -swagger:response createSSLFrontUseCreated -*/ -type CreateSSLFrontUseCreated struct { - - /* - In: Body - */ - Payload *models.SSLFrontUse `json:"body,omitempty"` -} - -// NewCreateSSLFrontUseCreated creates CreateSSLFrontUseCreated with default headers values -func NewCreateSSLFrontUseCreated() *CreateSSLFrontUseCreated { - - return &CreateSSLFrontUseCreated{} -} - -// WithPayload adds the payload to the create s s l front use created response -func (o *CreateSSLFrontUseCreated) WithPayload(payload *models.SSLFrontUse) *CreateSSLFrontUseCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create s s l front use created response -func (o *CreateSSLFrontUseCreated) SetPayload(payload *models.SSLFrontUse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSSLFrontUseCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSSLFrontUseAcceptedCode is the HTTP code returned for type CreateSSLFrontUseAccepted -const CreateSSLFrontUseAcceptedCode int = 202 - -/* -CreateSSLFrontUseAccepted Configuration change accepted and reload requested - -swagger:response createSSLFrontUseAccepted -*/ -type CreateSSLFrontUseAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SSLFrontUse `json:"body,omitempty"` -} - -// NewCreateSSLFrontUseAccepted creates CreateSSLFrontUseAccepted with default headers values -func NewCreateSSLFrontUseAccepted() *CreateSSLFrontUseAccepted { - - return &CreateSSLFrontUseAccepted{} -} - -// WithReloadID adds the reloadId to the create s s l front use accepted response -func (o *CreateSSLFrontUseAccepted) WithReloadID(reloadID string) *CreateSSLFrontUseAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create s s l front use accepted response -func (o *CreateSSLFrontUseAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create s s l front use accepted response -func (o *CreateSSLFrontUseAccepted) WithPayload(payload *models.SSLFrontUse) *CreateSSLFrontUseAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create s s l front use accepted response -func (o *CreateSSLFrontUseAccepted) SetPayload(payload *models.SSLFrontUse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSSLFrontUseAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSSLFrontUseBadRequestCode is the HTTP code returned for type CreateSSLFrontUseBadRequest -const CreateSSLFrontUseBadRequestCode int = 400 - -/* -CreateSSLFrontUseBadRequest Bad request - -swagger:response createSSLFrontUseBadRequest -*/ -type CreateSSLFrontUseBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSSLFrontUseBadRequest creates CreateSSLFrontUseBadRequest with default headers values -func NewCreateSSLFrontUseBadRequest() *CreateSSLFrontUseBadRequest { - - return &CreateSSLFrontUseBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create s s l front use bad request response -func (o *CreateSSLFrontUseBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSSLFrontUseBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create s s l front use bad request response -func (o *CreateSSLFrontUseBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create s s l front use bad request response -func (o *CreateSSLFrontUseBadRequest) WithPayload(payload *models.Error) *CreateSSLFrontUseBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create s s l front use bad request response -func (o *CreateSSLFrontUseBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSSLFrontUseBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSSLFrontUseConflictCode is the HTTP code returned for type CreateSSLFrontUseConflict -const CreateSSLFrontUseConflictCode int = 409 - -/* -CreateSSLFrontUseConflict The specified resource already exists - -swagger:response createSSLFrontUseConflict -*/ -type CreateSSLFrontUseConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSSLFrontUseConflict creates CreateSSLFrontUseConflict with default headers values -func NewCreateSSLFrontUseConflict() *CreateSSLFrontUseConflict { - - return &CreateSSLFrontUseConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create s s l front use conflict response -func (o *CreateSSLFrontUseConflict) WithConfigurationVersion(configurationVersion string) *CreateSSLFrontUseConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create s s l front use conflict response -func (o *CreateSSLFrontUseConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create s s l front use conflict response -func (o *CreateSSLFrontUseConflict) WithPayload(payload *models.Error) *CreateSSLFrontUseConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create s s l front use conflict response -func (o *CreateSSLFrontUseConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSSLFrontUseConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSSLFrontUseDefault General Error - -swagger:response createSSLFrontUseDefault -*/ -type CreateSSLFrontUseDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSSLFrontUseDefault creates CreateSSLFrontUseDefault with default headers values -func NewCreateSSLFrontUseDefault(code int) *CreateSSLFrontUseDefault { - if code <= 0 { - code = 500 - } - - return &CreateSSLFrontUseDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) WithStatusCode(code int) *CreateSSLFrontUseDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) WithConfigurationVersion(configurationVersion string) *CreateSSLFrontUseDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) WithPayload(payload *models.Error) *CreateSSLFrontUseDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create s s l front use default response -func (o *CreateSSLFrontUseDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSSLFrontUseDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_front_use/create_s_s_l_front_use_urlbuilder.go b/operations/s_s_l_front_use/create_s_s_l_front_use_urlbuilder.go deleted file mode 100644 index d4a553a2..00000000 --- a/operations/s_s_l_front_use/create_s_s_l_front_use_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateSSLFrontUseURL generates an URL for the create s s l front use operation -type CreateSSLFrontUseURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSSLFrontUseURL) WithBasePath(bp string) *CreateSSLFrontUseURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSSLFrontUseURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSSLFrontUseURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateSSLFrontUseURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSSLFrontUseURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSSLFrontUseURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSSLFrontUseURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSSLFrontUseURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSSLFrontUseURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSSLFrontUseURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_front_use/delete_s_s_l_front_use.go b/operations/s_s_l_front_use/delete_s_s_l_front_use.go deleted file mode 100644 index fbad73e6..00000000 --- a/operations/s_s_l_front_use/delete_s_s_l_front_use.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSSLFrontUseHandlerFunc turns a function with the right signature into a delete s s l front use handler -type DeleteSSLFrontUseHandlerFunc func(DeleteSSLFrontUseParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSSLFrontUseHandlerFunc) Handle(params DeleteSSLFrontUseParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSSLFrontUseHandler interface for that can handle valid delete s s l front use params -type DeleteSSLFrontUseHandler interface { - Handle(DeleteSSLFrontUseParams, interface{}) middleware.Responder -} - -// NewDeleteSSLFrontUse creates a new http.Handler for the delete s s l front use operation -func NewDeleteSSLFrontUse(ctx *middleware.Context, handler DeleteSSLFrontUseHandler) *DeleteSSLFrontUse { - return &DeleteSSLFrontUse{Context: ctx, Handler: handler} -} - -/* - DeleteSSLFrontUse swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index} SSLFrontUse deleteSSLFrontUse - -# Delete an SSLFrontUse - -Deletes an SSLFrontUse configuration by its index in the specified frontend. -*/ -type DeleteSSLFrontUse struct { - Context *middleware.Context - Handler DeleteSSLFrontUseHandler -} - -func (o *DeleteSSLFrontUse) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSSLFrontUseParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_front_use/delete_s_s_l_front_use_parameters.go b/operations/s_s_l_front_use/delete_s_s_l_front_use_parameters.go deleted file mode 100644 index afa39255..00000000 --- a/operations/s_s_l_front_use/delete_s_s_l_front_use_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSSLFrontUseParams creates a new DeleteSSLFrontUseParams object -// with the default values initialized. -func NewDeleteSSLFrontUseParams() DeleteSSLFrontUseParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteSSLFrontUseParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteSSLFrontUseParams contains all the bound params for the delete s s l front use operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSSLFrontUse -type DeleteSSLFrontUseParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*SSLFrontUse index (zero-based) - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSSLFrontUseParams() beforehand. -func (o *DeleteSSLFrontUseParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteSSLFrontUseParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteSSLFrontUseParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteSSLFrontUseParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSSLFrontUseParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSSLFrontUseParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSSLFrontUseParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/s_s_l_front_use/delete_s_s_l_front_use_responses.go b/operations/s_s_l_front_use/delete_s_s_l_front_use_responses.go deleted file mode 100644 index 85e0115c..00000000 --- a/operations/s_s_l_front_use/delete_s_s_l_front_use_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSSLFrontUseAcceptedCode is the HTTP code returned for type DeleteSSLFrontUseAccepted -const DeleteSSLFrontUseAcceptedCode int = 202 - -/* -DeleteSSLFrontUseAccepted Configuration change accepted and reload requested - -swagger:response deleteSSLFrontUseAccepted -*/ -type DeleteSSLFrontUseAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteSSLFrontUseAccepted creates DeleteSSLFrontUseAccepted with default headers values -func NewDeleteSSLFrontUseAccepted() *DeleteSSLFrontUseAccepted { - - return &DeleteSSLFrontUseAccepted{} -} - -// WithReloadID adds the reloadId to the delete s s l front use accepted response -func (o *DeleteSSLFrontUseAccepted) WithReloadID(reloadID string) *DeleteSSLFrontUseAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete s s l front use accepted response -func (o *DeleteSSLFrontUseAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteSSLFrontUseAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteSSLFrontUseNoContentCode is the HTTP code returned for type DeleteSSLFrontUseNoContent -const DeleteSSLFrontUseNoContentCode int = 204 - -/* -DeleteSSLFrontUseNoContent SSLFrontUse deleted - -swagger:response deleteSSLFrontUseNoContent -*/ -type DeleteSSLFrontUseNoContent struct { -} - -// NewDeleteSSLFrontUseNoContent creates DeleteSSLFrontUseNoContent with default headers values -func NewDeleteSSLFrontUseNoContent() *DeleteSSLFrontUseNoContent { - - return &DeleteSSLFrontUseNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSSLFrontUseNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSSLFrontUseNotFoundCode is the HTTP code returned for type DeleteSSLFrontUseNotFound -const DeleteSSLFrontUseNotFoundCode int = 404 - -/* -DeleteSSLFrontUseNotFound The specified resource was not found - -swagger:response deleteSSLFrontUseNotFound -*/ -type DeleteSSLFrontUseNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSSLFrontUseNotFound creates DeleteSSLFrontUseNotFound with default headers values -func NewDeleteSSLFrontUseNotFound() *DeleteSSLFrontUseNotFound { - - return &DeleteSSLFrontUseNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete s s l front use not found response -func (o *DeleteSSLFrontUseNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSSLFrontUseNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete s s l front use not found response -func (o *DeleteSSLFrontUseNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete s s l front use not found response -func (o *DeleteSSLFrontUseNotFound) WithPayload(payload *models.Error) *DeleteSSLFrontUseNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete s s l front use not found response -func (o *DeleteSSLFrontUseNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSSLFrontUseNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSSLFrontUseDefault General Error - -swagger:response deleteSSLFrontUseDefault -*/ -type DeleteSSLFrontUseDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSSLFrontUseDefault creates DeleteSSLFrontUseDefault with default headers values -func NewDeleteSSLFrontUseDefault(code int) *DeleteSSLFrontUseDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSSLFrontUseDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) WithStatusCode(code int) *DeleteSSLFrontUseDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) WithConfigurationVersion(configurationVersion string) *DeleteSSLFrontUseDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) WithPayload(payload *models.Error) *DeleteSSLFrontUseDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete s s l front use default response -func (o *DeleteSSLFrontUseDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSSLFrontUseDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_front_use/delete_s_s_l_front_use_urlbuilder.go b/operations/s_s_l_front_use/delete_s_s_l_front_use_urlbuilder.go deleted file mode 100644 index cc4a6ad6..00000000 --- a/operations/s_s_l_front_use/delete_s_s_l_front_use_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSSLFrontUseURL generates an URL for the delete s s l front use operation -type DeleteSSLFrontUseURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSSLFrontUseURL) WithBasePath(bp string) *DeleteSSLFrontUseURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSSLFrontUseURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSSLFrontUseURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteSSLFrontUseURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSSLFrontUseURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSSLFrontUseURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSSLFrontUseURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSSLFrontUseURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSSLFrontUseURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSSLFrontUseURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSSLFrontUseURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_front_use/get_all_s_s_l_front_uses.go b/operations/s_s_l_front_use/get_all_s_s_l_front_uses.go deleted file mode 100644 index 23785594..00000000 --- a/operations/s_s_l_front_use/get_all_s_s_l_front_uses.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSSLFrontUsesHandlerFunc turns a function with the right signature into a get all s s l front uses handler -type GetAllSSLFrontUsesHandlerFunc func(GetAllSSLFrontUsesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSSLFrontUsesHandlerFunc) Handle(params GetAllSSLFrontUsesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSSLFrontUsesHandler interface for that can handle valid get all s s l front uses params -type GetAllSSLFrontUsesHandler interface { - Handle(GetAllSSLFrontUsesParams, interface{}) middleware.Responder -} - -// NewGetAllSSLFrontUses creates a new http.Handler for the get all s s l front uses operation -func NewGetAllSSLFrontUses(ctx *middleware.Context, handler GetAllSSLFrontUsesHandler) *GetAllSSLFrontUses { - return &GetAllSSLFrontUses{Context: ctx, Handler: handler} -} - -/* - GetAllSSLFrontUses swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses SSLFrontUse getAllSSLFrontUses - -# Return an array of SSLFrontUses - -Returns an array of all SSLFrontUses that are configured in specified frontend. -*/ -type GetAllSSLFrontUses struct { - Context *middleware.Context - Handler GetAllSSLFrontUsesHandler -} - -func (o *GetAllSSLFrontUses) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSSLFrontUsesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_parameters.go b/operations/s_s_l_front_use/get_all_s_s_l_front_uses_parameters.go deleted file mode 100644 index 523398b6..00000000 --- a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllSSLFrontUsesParams creates a new GetAllSSLFrontUsesParams object -// -// There are no default values defined in the spec. -func NewGetAllSSLFrontUsesParams() GetAllSSLFrontUsesParams { - - return GetAllSSLFrontUsesParams{} -} - -// GetAllSSLFrontUsesParams contains all the bound params for the get all s s l front uses operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSSLFrontUses -type GetAllSSLFrontUsesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSSLFrontUsesParams() beforehand. -func (o *GetAllSSLFrontUsesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSSLFrontUsesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllSSLFrontUsesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_responses.go b/operations/s_s_l_front_use/get_all_s_s_l_front_uses_responses.go deleted file mode 100644 index 16e00b6f..00000000 --- a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSSLFrontUsesOKCode is the HTTP code returned for type GetAllSSLFrontUsesOK -const GetAllSSLFrontUsesOKCode int = 200 - -/* -GetAllSSLFrontUsesOK Successful operation - -swagger:response getAllSSLFrontUsesOK -*/ -type GetAllSSLFrontUsesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SSLFrontUses `json:"body,omitempty"` -} - -// NewGetAllSSLFrontUsesOK creates GetAllSSLFrontUsesOK with default headers values -func NewGetAllSSLFrontUsesOK() *GetAllSSLFrontUsesOK { - - return &GetAllSSLFrontUsesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all s s l front uses o k response -func (o *GetAllSSLFrontUsesOK) WithConfigurationVersion(configurationVersion string) *GetAllSSLFrontUsesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all s s l front uses o k response -func (o *GetAllSSLFrontUsesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all s s l front uses o k response -func (o *GetAllSSLFrontUsesOK) WithPayload(payload models.SSLFrontUses) *GetAllSSLFrontUsesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all s s l front uses o k response -func (o *GetAllSSLFrontUsesOK) SetPayload(payload models.SSLFrontUses) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSSLFrontUsesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SSLFrontUses{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSSLFrontUsesDefault General Error - -swagger:response getAllSSLFrontUsesDefault -*/ -type GetAllSSLFrontUsesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSSLFrontUsesDefault creates GetAllSSLFrontUsesDefault with default headers values -func NewGetAllSSLFrontUsesDefault(code int) *GetAllSSLFrontUsesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSSLFrontUsesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) WithStatusCode(code int) *GetAllSSLFrontUsesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) WithConfigurationVersion(configurationVersion string) *GetAllSSLFrontUsesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) WithPayload(payload *models.Error) *GetAllSSLFrontUsesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all s s l front uses default response -func (o *GetAllSSLFrontUsesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSSLFrontUsesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_urlbuilder.go b/operations/s_s_l_front_use/get_all_s_s_l_front_uses_urlbuilder.go deleted file mode 100644 index b472655d..00000000 --- a/operations/s_s_l_front_use/get_all_s_s_l_front_uses_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSSLFrontUsesURL generates an URL for the get all s s l front uses operation -type GetAllSSLFrontUsesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSSLFrontUsesURL) WithBasePath(bp string) *GetAllSSLFrontUsesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSSLFrontUsesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSSLFrontUsesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSSLFrontUsesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSSLFrontUsesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSSLFrontUsesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSSLFrontUsesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSSLFrontUsesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSSLFrontUsesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSSLFrontUsesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_front_use/get_s_s_l_front_use.go b/operations/s_s_l_front_use/get_s_s_l_front_use.go deleted file mode 100644 index 0872eb2b..00000000 --- a/operations/s_s_l_front_use/get_s_s_l_front_use.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSSLFrontUseHandlerFunc turns a function with the right signature into a get s s l front use handler -type GetSSLFrontUseHandlerFunc func(GetSSLFrontUseParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSSLFrontUseHandlerFunc) Handle(params GetSSLFrontUseParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSSLFrontUseHandler interface for that can handle valid get s s l front use params -type GetSSLFrontUseHandler interface { - Handle(GetSSLFrontUseParams, interface{}) middleware.Responder -} - -// NewGetSSLFrontUse creates a new http.Handler for the get s s l front use operation -func NewGetSSLFrontUse(ctx *middleware.Context, handler GetSSLFrontUseHandler) *GetSSLFrontUse { - return &GetSSLFrontUse{Context: ctx, Handler: handler} -} - -/* - GetSSLFrontUse swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index} SSLFrontUse getSSLFrontUse - -# Return one SSLFrontUse - -Returns one SSLFrontUse configuration by its index in the specified frontend. -*/ -type GetSSLFrontUse struct { - Context *middleware.Context - Handler GetSSLFrontUseHandler -} - -func (o *GetSSLFrontUse) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSSLFrontUseParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_front_use/get_s_s_l_front_use_parameters.go b/operations/s_s_l_front_use/get_s_s_l_front_use_parameters.go deleted file mode 100644 index 06688e6a..00000000 --- a/operations/s_s_l_front_use/get_s_s_l_front_use_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetSSLFrontUseParams creates a new GetSSLFrontUseParams object -// -// There are no default values defined in the spec. -func NewGetSSLFrontUseParams() GetSSLFrontUseParams { - - return GetSSLFrontUseParams{} -} - -// GetSSLFrontUseParams contains all the bound params for the get s s l front use operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSSLFrontUse -type GetSSLFrontUseParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSLFrontUse index (zero-based) - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSSLFrontUseParams() beforehand. -func (o *GetSSLFrontUseParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetSSLFrontUseParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSSLFrontUseParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSSLFrontUseParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/s_s_l_front_use/get_s_s_l_front_use_responses.go b/operations/s_s_l_front_use/get_s_s_l_front_use_responses.go deleted file mode 100644 index e5e4fa6a..00000000 --- a/operations/s_s_l_front_use/get_s_s_l_front_use_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSSLFrontUseOKCode is the HTTP code returned for type GetSSLFrontUseOK -const GetSSLFrontUseOKCode int = 200 - -/* -GetSSLFrontUseOK Successful operation - -swagger:response getSSLFrontUseOK -*/ -type GetSSLFrontUseOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.SSLFrontUse `json:"body,omitempty"` -} - -// NewGetSSLFrontUseOK creates GetSSLFrontUseOK with default headers values -func NewGetSSLFrontUseOK() *GetSSLFrontUseOK { - - return &GetSSLFrontUseOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get s s l front use o k response -func (o *GetSSLFrontUseOK) WithConfigurationVersion(configurationVersion string) *GetSSLFrontUseOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get s s l front use o k response -func (o *GetSSLFrontUseOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get s s l front use o k response -func (o *GetSSLFrontUseOK) WithPayload(payload *models.SSLFrontUse) *GetSSLFrontUseOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get s s l front use o k response -func (o *GetSSLFrontUseOK) SetPayload(payload *models.SSLFrontUse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSSLFrontUseOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSSLFrontUseNotFoundCode is the HTTP code returned for type GetSSLFrontUseNotFound -const GetSSLFrontUseNotFoundCode int = 404 - -/* -GetSSLFrontUseNotFound The specified resource already exists - -swagger:response getSSLFrontUseNotFound -*/ -type GetSSLFrontUseNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSSLFrontUseNotFound creates GetSSLFrontUseNotFound with default headers values -func NewGetSSLFrontUseNotFound() *GetSSLFrontUseNotFound { - - return &GetSSLFrontUseNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get s s l front use not found response -func (o *GetSSLFrontUseNotFound) WithConfigurationVersion(configurationVersion string) *GetSSLFrontUseNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get s s l front use not found response -func (o *GetSSLFrontUseNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get s s l front use not found response -func (o *GetSSLFrontUseNotFound) WithPayload(payload *models.Error) *GetSSLFrontUseNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get s s l front use not found response -func (o *GetSSLFrontUseNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSSLFrontUseNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSSLFrontUseDefault General Error - -swagger:response getSSLFrontUseDefault -*/ -type GetSSLFrontUseDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSSLFrontUseDefault creates GetSSLFrontUseDefault with default headers values -func NewGetSSLFrontUseDefault(code int) *GetSSLFrontUseDefault { - if code <= 0 { - code = 500 - } - - return &GetSSLFrontUseDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get s s l front use default response -func (o *GetSSLFrontUseDefault) WithStatusCode(code int) *GetSSLFrontUseDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get s s l front use default response -func (o *GetSSLFrontUseDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get s s l front use default response -func (o *GetSSLFrontUseDefault) WithConfigurationVersion(configurationVersion string) *GetSSLFrontUseDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get s s l front use default response -func (o *GetSSLFrontUseDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get s s l front use default response -func (o *GetSSLFrontUseDefault) WithPayload(payload *models.Error) *GetSSLFrontUseDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get s s l front use default response -func (o *GetSSLFrontUseDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSSLFrontUseDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_front_use/get_s_s_l_front_use_urlbuilder.go b/operations/s_s_l_front_use/get_s_s_l_front_use_urlbuilder.go deleted file mode 100644 index 2762fcac..00000000 --- a/operations/s_s_l_front_use/get_s_s_l_front_use_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetSSLFrontUseURL generates an URL for the get s s l front use operation -type GetSSLFrontUseURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSSLFrontUseURL) WithBasePath(bp string) *GetSSLFrontUseURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSSLFrontUseURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSSLFrontUseURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetSSLFrontUseURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSSLFrontUseURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSSLFrontUseURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSSLFrontUseURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSSLFrontUseURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSSLFrontUseURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSSLFrontUseURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSSLFrontUseURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_front_use/replace_s_s_l_front_use.go b/operations/s_s_l_front_use/replace_s_s_l_front_use.go deleted file mode 100644 index 55ade515..00000000 --- a/operations/s_s_l_front_use/replace_s_s_l_front_use.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceSSLFrontUseHandlerFunc turns a function with the right signature into a replace s s l front use handler -type ReplaceSSLFrontUseHandlerFunc func(ReplaceSSLFrontUseParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceSSLFrontUseHandlerFunc) Handle(params ReplaceSSLFrontUseParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceSSLFrontUseHandler interface for that can handle valid replace s s l front use params -type ReplaceSSLFrontUseHandler interface { - Handle(ReplaceSSLFrontUseParams, interface{}) middleware.Responder -} - -// NewReplaceSSLFrontUse creates a new http.Handler for the replace s s l front use operation -func NewReplaceSSLFrontUse(ctx *middleware.Context, handler ReplaceSSLFrontUseHandler) *ReplaceSSLFrontUse { - return &ReplaceSSLFrontUse{Context: ctx, Handler: handler} -} - -/* - ReplaceSSLFrontUse swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index} SSLFrontUse replaceSSLFrontUse - -# Replace an SSLFrontUse - -Replaces an SSLFrontUse configuration by its index in the specified frontend. -*/ -type ReplaceSSLFrontUse struct { - Context *middleware.Context - Handler ReplaceSSLFrontUseHandler -} - -func (o *ReplaceSSLFrontUse) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceSSLFrontUseParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_front_use/replace_s_s_l_front_use_parameters.go b/operations/s_s_l_front_use/replace_s_s_l_front_use_parameters.go deleted file mode 100644 index a7633591..00000000 --- a/operations/s_s_l_front_use/replace_s_s_l_front_use_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceSSLFrontUseParams creates a new ReplaceSSLFrontUseParams object -// with the default values initialized. -func NewReplaceSSLFrontUseParams() ReplaceSSLFrontUseParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceSSLFrontUseParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceSSLFrontUseParams contains all the bound params for the replace s s l front use operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceSSLFrontUse -type ReplaceSSLFrontUseParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SSLFrontUse - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*SSLFrontUse index (zero-based) - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceSSLFrontUseParams() beforehand. -func (o *ReplaceSSLFrontUseParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SSLFrontUse - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceSSLFrontUseParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceSSLFrontUseParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceSSLFrontUseParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceSSLFrontUseParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceSSLFrontUseParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceSSLFrontUseParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/s_s_l_front_use/replace_s_s_l_front_use_responses.go b/operations/s_s_l_front_use/replace_s_s_l_front_use_responses.go deleted file mode 100644 index 6c1e5b5c..00000000 --- a/operations/s_s_l_front_use/replace_s_s_l_front_use_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceSSLFrontUseOKCode is the HTTP code returned for type ReplaceSSLFrontUseOK -const ReplaceSSLFrontUseOKCode int = 200 - -/* -ReplaceSSLFrontUseOK SSLFrontUse replaced - -swagger:response replaceSSLFrontUseOK -*/ -type ReplaceSSLFrontUseOK struct { - - /* - In: Body - */ - Payload *models.SSLFrontUse `json:"body,omitempty"` -} - -// NewReplaceSSLFrontUseOK creates ReplaceSSLFrontUseOK with default headers values -func NewReplaceSSLFrontUseOK() *ReplaceSSLFrontUseOK { - - return &ReplaceSSLFrontUseOK{} -} - -// WithPayload adds the payload to the replace s s l front use o k response -func (o *ReplaceSSLFrontUseOK) WithPayload(payload *models.SSLFrontUse) *ReplaceSSLFrontUseOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace s s l front use o k response -func (o *ReplaceSSLFrontUseOK) SetPayload(payload *models.SSLFrontUse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSSLFrontUseOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSSLFrontUseAcceptedCode is the HTTP code returned for type ReplaceSSLFrontUseAccepted -const ReplaceSSLFrontUseAcceptedCode int = 202 - -/* -ReplaceSSLFrontUseAccepted Configuration change accepted and reload requested - -swagger:response replaceSSLFrontUseAccepted -*/ -type ReplaceSSLFrontUseAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SSLFrontUse `json:"body,omitempty"` -} - -// NewReplaceSSLFrontUseAccepted creates ReplaceSSLFrontUseAccepted with default headers values -func NewReplaceSSLFrontUseAccepted() *ReplaceSSLFrontUseAccepted { - - return &ReplaceSSLFrontUseAccepted{} -} - -// WithReloadID adds the reloadId to the replace s s l front use accepted response -func (o *ReplaceSSLFrontUseAccepted) WithReloadID(reloadID string) *ReplaceSSLFrontUseAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace s s l front use accepted response -func (o *ReplaceSSLFrontUseAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace s s l front use accepted response -func (o *ReplaceSSLFrontUseAccepted) WithPayload(payload *models.SSLFrontUse) *ReplaceSSLFrontUseAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace s s l front use accepted response -func (o *ReplaceSSLFrontUseAccepted) SetPayload(payload *models.SSLFrontUse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSSLFrontUseAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSSLFrontUseBadRequestCode is the HTTP code returned for type ReplaceSSLFrontUseBadRequest -const ReplaceSSLFrontUseBadRequestCode int = 400 - -/* -ReplaceSSLFrontUseBadRequest Bad request - -swagger:response replaceSSLFrontUseBadRequest -*/ -type ReplaceSSLFrontUseBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSSLFrontUseBadRequest creates ReplaceSSLFrontUseBadRequest with default headers values -func NewReplaceSSLFrontUseBadRequest() *ReplaceSSLFrontUseBadRequest { - - return &ReplaceSSLFrontUseBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace s s l front use bad request response -func (o *ReplaceSSLFrontUseBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceSSLFrontUseBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace s s l front use bad request response -func (o *ReplaceSSLFrontUseBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace s s l front use bad request response -func (o *ReplaceSSLFrontUseBadRequest) WithPayload(payload *models.Error) *ReplaceSSLFrontUseBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace s s l front use bad request response -func (o *ReplaceSSLFrontUseBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSSLFrontUseBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSSLFrontUseNotFoundCode is the HTTP code returned for type ReplaceSSLFrontUseNotFound -const ReplaceSSLFrontUseNotFoundCode int = 404 - -/* -ReplaceSSLFrontUseNotFound The specified resource was not found - -swagger:response replaceSSLFrontUseNotFound -*/ -type ReplaceSSLFrontUseNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSSLFrontUseNotFound creates ReplaceSSLFrontUseNotFound with default headers values -func NewReplaceSSLFrontUseNotFound() *ReplaceSSLFrontUseNotFound { - - return &ReplaceSSLFrontUseNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace s s l front use not found response -func (o *ReplaceSSLFrontUseNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceSSLFrontUseNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace s s l front use not found response -func (o *ReplaceSSLFrontUseNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace s s l front use not found response -func (o *ReplaceSSLFrontUseNotFound) WithPayload(payload *models.Error) *ReplaceSSLFrontUseNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace s s l front use not found response -func (o *ReplaceSSLFrontUseNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSSLFrontUseNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceSSLFrontUseDefault General Error - -swagger:response replaceSSLFrontUseDefault -*/ -type ReplaceSSLFrontUseDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSSLFrontUseDefault creates ReplaceSSLFrontUseDefault with default headers values -func NewReplaceSSLFrontUseDefault(code int) *ReplaceSSLFrontUseDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceSSLFrontUseDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) WithStatusCode(code int) *ReplaceSSLFrontUseDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) WithConfigurationVersion(configurationVersion string) *ReplaceSSLFrontUseDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) WithPayload(payload *models.Error) *ReplaceSSLFrontUseDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace s s l front use default response -func (o *ReplaceSSLFrontUseDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSSLFrontUseDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_front_use/replace_s_s_l_front_use_urlbuilder.go b/operations/s_s_l_front_use/replace_s_s_l_front_use_urlbuilder.go deleted file mode 100644 index 91e89d77..00000000 --- a/operations/s_s_l_front_use/replace_s_s_l_front_use_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_front_use - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceSSLFrontUseURL generates an URL for the replace s s l front use operation -type ReplaceSSLFrontUseURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSSLFrontUseURL) WithBasePath(bp string) *ReplaceSSLFrontUseURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSSLFrontUseURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceSSLFrontUseURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceSSLFrontUseURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceSSLFrontUseURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceSSLFrontUseURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceSSLFrontUseURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceSSLFrontUseURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceSSLFrontUseURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceSSLFrontUseURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceSSLFrontUseURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/add_ca_entry.go b/operations/s_s_l_runtime/add_ca_entry.go deleted file mode 100644 index fd4932d3..00000000 --- a/operations/s_s_l_runtime/add_ca_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddCaEntryHandlerFunc turns a function with the right signature into a add ca entry handler -type AddCaEntryHandlerFunc func(AddCaEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddCaEntryHandlerFunc) Handle(params AddCaEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddCaEntryHandler interface for that can handle valid add ca entry params -type AddCaEntryHandler interface { - Handle(AddCaEntryParams, interface{}) middleware.Responder -} - -// NewAddCaEntry creates a new http.Handler for the add ca entry operation -func NewAddCaEntry(ctx *middleware.Context, handler AddCaEntryHandler) *AddCaEntry { - return &AddCaEntry{Context: ctx, Handler: handler} -} - -/* - AddCaEntry swagger:route POST /services/haproxy/runtime/ssl_ca_files/{name}/entries SSLRuntime addCaEntry - -# Add a certificate to a CA file - -Adds an entry to an existing CA file using the runtime socket. -*/ -type AddCaEntry struct { - Context *middleware.Context - Handler AddCaEntryHandler -} - -func (o *AddCaEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddCaEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/add_ca_entry_parameters.go b/operations/s_s_l_runtime/add_ca_entry_parameters.go deleted file mode 100644 index 1c9ba040..00000000 --- a/operations/s_s_l_runtime/add_ca_entry_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// AddCaEntryMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var AddCaEntryMaxParseMemory int64 = 32 << 20 - -// NewAddCaEntryParams creates a new AddCaEntryParams object -// -// There are no default values defined in the spec. -func NewAddCaEntryParams() AddCaEntryParams { - - return AddCaEntryParams{} -} - -// AddCaEntryParams contains all the bound params for the add ca entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters addCaEntry -type AddCaEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Payload of the cert entry - Required: true - In: formData - */ - FileUpload io.ReadCloser - /*SSL CA file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddCaEntryParams() beforehand. -func (o *AddCaEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(AddCaEntryMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *AddCaEntryParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *AddCaEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/add_ca_entry_responses.go b/operations/s_s_l_runtime/add_ca_entry_responses.go deleted file mode 100644 index 7701bb92..00000000 --- a/operations/s_s_l_runtime/add_ca_entry_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddCaEntryCreatedCode is the HTTP code returned for type AddCaEntryCreated -const AddCaEntryCreatedCode int = 201 - -/* -AddCaEntryCreated Successful operation - -swagger:response addCaEntryCreated -*/ -type AddCaEntryCreated struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewAddCaEntryCreated creates AddCaEntryCreated with default headers values -func NewAddCaEntryCreated() *AddCaEntryCreated { - - return &AddCaEntryCreated{} -} - -// WithPayload adds the payload to the add ca entry created response -func (o *AddCaEntryCreated) WithPayload(payload *models.SslCertificate) *AddCaEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add ca entry created response -func (o *AddCaEntryCreated) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCaEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddCaEntryNotFoundCode is the HTTP code returned for type AddCaEntryNotFound -const AddCaEntryNotFoundCode int = 404 - -/* -AddCaEntryNotFound The specified resource was not found - -swagger:response addCaEntryNotFound -*/ -type AddCaEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddCaEntryNotFound creates AddCaEntryNotFound with default headers values -func NewAddCaEntryNotFound() *AddCaEntryNotFound { - - return &AddCaEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the add ca entry not found response -func (o *AddCaEntryNotFound) WithConfigurationVersion(configurationVersion string) *AddCaEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add ca entry not found response -func (o *AddCaEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add ca entry not found response -func (o *AddCaEntryNotFound) WithPayload(payload *models.Error) *AddCaEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add ca entry not found response -func (o *AddCaEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCaEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddCaEntryDefault General Error - -swagger:response addCaEntryDefault -*/ -type AddCaEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddCaEntryDefault creates AddCaEntryDefault with default headers values -func NewAddCaEntryDefault(code int) *AddCaEntryDefault { - if code <= 0 { - code = 500 - } - - return &AddCaEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add ca entry default response -func (o *AddCaEntryDefault) WithStatusCode(code int) *AddCaEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add ca entry default response -func (o *AddCaEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add ca entry default response -func (o *AddCaEntryDefault) WithConfigurationVersion(configurationVersion string) *AddCaEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add ca entry default response -func (o *AddCaEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add ca entry default response -func (o *AddCaEntryDefault) WithPayload(payload *models.Error) *AddCaEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add ca entry default response -func (o *AddCaEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCaEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/add_ca_entry_urlbuilder.go b/operations/s_s_l_runtime/add_ca_entry_urlbuilder.go deleted file mode 100644 index add4e240..00000000 --- a/operations/s_s_l_runtime/add_ca_entry_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// AddCaEntryURL generates an URL for the add ca entry operation -type AddCaEntryURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddCaEntryURL) WithBasePath(bp string) *AddCaEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddCaEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddCaEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files/{name}/entries" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on AddCaEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddCaEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddCaEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddCaEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddCaEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddCaEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddCaEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/add_crt_list_entry.go b/operations/s_s_l_runtime/add_crt_list_entry.go deleted file mode 100644 index 72fb4df2..00000000 --- a/operations/s_s_l_runtime/add_crt_list_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddCrtListEntryHandlerFunc turns a function with the right signature into a add crt list entry handler -type AddCrtListEntryHandlerFunc func(AddCrtListEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddCrtListEntryHandlerFunc) Handle(params AddCrtListEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddCrtListEntryHandler interface for that can handle valid add crt list entry params -type AddCrtListEntryHandler interface { - Handle(AddCrtListEntryParams, interface{}) middleware.Responder -} - -// NewAddCrtListEntry creates a new http.Handler for the add crt list entry operation -func NewAddCrtListEntry(ctx *middleware.Context, handler AddCrtListEntryHandler) *AddCrtListEntry { - return &AddCrtListEntry{Context: ctx, Handler: handler} -} - -/* - AddCrtListEntry swagger:route POST /services/haproxy/runtime/ssl_crt_lists/entries SSLRuntime addCrtListEntry - -# Add an entry into a crt-list - -Appends an entry to the given crt-list using the runtime socket. -*/ -type AddCrtListEntry struct { - Context *middleware.Context - Handler AddCrtListEntryHandler -} - -func (o *AddCrtListEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddCrtListEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/add_crt_list_entry_parameters.go b/operations/s_s_l_runtime/add_crt_list_entry_parameters.go deleted file mode 100644 index 1abba27b..00000000 --- a/operations/s_s_l_runtime/add_crt_list_entry_parameters.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddCrtListEntryParams creates a new AddCrtListEntryParams object -// -// There are no default values defined in the spec. -func NewAddCrtListEntryParams() AddCrtListEntryParams { - - return AddCrtListEntryParams{} -} - -// AddCrtListEntryParams contains all the bound params for the add crt list entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters addCrtListEntry -type AddCrtListEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SslCrtListEntry - /*SSL crt-list filename - Required: true - In: query - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddCrtListEntryParams() beforehand. -func (o *AddCrtListEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SslCrtListEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qName, qhkName, _ := qs.GetOK("name") - if err := o.bindName(qName, qhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from query. -func (o *AddCrtListEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("name", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("name", "query", raw); err != nil { - return err - } - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/add_crt_list_entry_responses.go b/operations/s_s_l_runtime/add_crt_list_entry_responses.go deleted file mode 100644 index cb100ec1..00000000 --- a/operations/s_s_l_runtime/add_crt_list_entry_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddCrtListEntryCreatedCode is the HTTP code returned for type AddCrtListEntryCreated -const AddCrtListEntryCreatedCode int = 201 - -/* -AddCrtListEntryCreated Successful operation - -swagger:response addCrtListEntryCreated -*/ -type AddCrtListEntryCreated struct { -} - -// NewAddCrtListEntryCreated creates AddCrtListEntryCreated with default headers values -func NewAddCrtListEntryCreated() *AddCrtListEntryCreated { - - return &AddCrtListEntryCreated{} -} - -// WriteResponse to the client -func (o *AddCrtListEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -// AddCrtListEntryBadRequestCode is the HTTP code returned for type AddCrtListEntryBadRequest -const AddCrtListEntryBadRequestCode int = 400 - -/* -AddCrtListEntryBadRequest Bad request - -swagger:response addCrtListEntryBadRequest -*/ -type AddCrtListEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddCrtListEntryBadRequest creates AddCrtListEntryBadRequest with default headers values -func NewAddCrtListEntryBadRequest() *AddCrtListEntryBadRequest { - - return &AddCrtListEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add crt list entry bad request response -func (o *AddCrtListEntryBadRequest) WithConfigurationVersion(configurationVersion string) *AddCrtListEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add crt list entry bad request response -func (o *AddCrtListEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add crt list entry bad request response -func (o *AddCrtListEntryBadRequest) WithPayload(payload *models.Error) *AddCrtListEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add crt list entry bad request response -func (o *AddCrtListEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCrtListEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddCrtListEntryConflictCode is the HTTP code returned for type AddCrtListEntryConflict -const AddCrtListEntryConflictCode int = 409 - -/* -AddCrtListEntryConflict The specified resource already exists - -swagger:response addCrtListEntryConflict -*/ -type AddCrtListEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddCrtListEntryConflict creates AddCrtListEntryConflict with default headers values -func NewAddCrtListEntryConflict() *AddCrtListEntryConflict { - - return &AddCrtListEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the add crt list entry conflict response -func (o *AddCrtListEntryConflict) WithConfigurationVersion(configurationVersion string) *AddCrtListEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add crt list entry conflict response -func (o *AddCrtListEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add crt list entry conflict response -func (o *AddCrtListEntryConflict) WithPayload(payload *models.Error) *AddCrtListEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add crt list entry conflict response -func (o *AddCrtListEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCrtListEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddCrtListEntryDefault General Error - -swagger:response addCrtListEntryDefault -*/ -type AddCrtListEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddCrtListEntryDefault creates AddCrtListEntryDefault with default headers values -func NewAddCrtListEntryDefault(code int) *AddCrtListEntryDefault { - if code <= 0 { - code = 500 - } - - return &AddCrtListEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add crt list entry default response -func (o *AddCrtListEntryDefault) WithStatusCode(code int) *AddCrtListEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add crt list entry default response -func (o *AddCrtListEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add crt list entry default response -func (o *AddCrtListEntryDefault) WithConfigurationVersion(configurationVersion string) *AddCrtListEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add crt list entry default response -func (o *AddCrtListEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add crt list entry default response -func (o *AddCrtListEntryDefault) WithPayload(payload *models.Error) *AddCrtListEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add crt list entry default response -func (o *AddCrtListEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddCrtListEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/add_crt_list_entry_urlbuilder.go b/operations/s_s_l_runtime/add_crt_list_entry_urlbuilder.go deleted file mode 100644 index 9a25a122..00000000 --- a/operations/s_s_l_runtime/add_crt_list_entry_urlbuilder.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// AddCrtListEntryURL generates an URL for the add crt list entry operation -type AddCrtListEntryURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddCrtListEntryURL) WithBasePath(bp string) *AddCrtListEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddCrtListEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddCrtListEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crt_lists/entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - nameQ := o.Name - if nameQ != "" { - qs.Set("name", nameQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddCrtListEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddCrtListEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddCrtListEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddCrtListEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddCrtListEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddCrtListEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/create_ca_file.go b/operations/s_s_l_runtime/create_ca_file.go deleted file mode 100644 index d1117220..00000000 --- a/operations/s_s_l_runtime/create_ca_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCaFileHandlerFunc turns a function with the right signature into a create ca file handler -type CreateCaFileHandlerFunc func(CreateCaFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCaFileHandlerFunc) Handle(params CreateCaFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCaFileHandler interface for that can handle valid create ca file params -type CreateCaFileHandler interface { - Handle(CreateCaFileParams, interface{}) middleware.Responder -} - -// NewCreateCaFile creates a new http.Handler for the create ca file operation -func NewCreateCaFile(ctx *middleware.Context, handler CreateCaFileHandler) *CreateCaFile { - return &CreateCaFile{Context: ctx, Handler: handler} -} - -/* - CreateCaFile swagger:route POST /services/haproxy/runtime/ssl_ca_files SSLRuntime createCaFile - -# Creates a new SSL CA file - -Creates a new SSL CA file using the runtime socket. -*/ -type CreateCaFile struct { - Context *middleware.Context - Handler CreateCaFileHandler -} - -func (o *CreateCaFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCaFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/create_ca_file_parameters.go b/operations/s_s_l_runtime/create_ca_file_parameters.go deleted file mode 100644 index 39a671d5..00000000 --- a/operations/s_s_l_runtime/create_ca_file_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateCaFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateCaFileMaxParseMemory int64 = 32 << 20 - -// NewCreateCaFileParams creates a new CreateCaFileParams object -// -// There are no default values defined in the spec. -func NewCreateCaFileParams() CreateCaFileParams { - - return CreateCaFileParams{} -} - -// CreateCaFileParams contains all the bound params for the create ca file operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCaFile -type CreateCaFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*CA certificate file - Required: true - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCaFileParams() beforehand. -func (o *CreateCaFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateCaFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateCaFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/s_s_l_runtime/create_ca_file_responses.go b/operations/s_s_l_runtime/create_ca_file_responses.go deleted file mode 100644 index 732283af..00000000 --- a/operations/s_s_l_runtime/create_ca_file_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCaFileCreatedCode is the HTTP code returned for type CreateCaFileCreated -const CreateCaFileCreatedCode int = 201 - -/* -CreateCaFileCreated SSL CA file created - -swagger:response createCaFileCreated -*/ -type CreateCaFileCreated struct { -} - -// NewCreateCaFileCreated creates CreateCaFileCreated with default headers values -func NewCreateCaFileCreated() *CreateCaFileCreated { - - return &CreateCaFileCreated{} -} - -// WriteResponse to the client -func (o *CreateCaFileCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -// CreateCaFileBadRequestCode is the HTTP code returned for type CreateCaFileBadRequest -const CreateCaFileBadRequestCode int = 400 - -/* -CreateCaFileBadRequest Bad request - -swagger:response createCaFileBadRequest -*/ -type CreateCaFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCaFileBadRequest creates CreateCaFileBadRequest with default headers values -func NewCreateCaFileBadRequest() *CreateCaFileBadRequest { - - return &CreateCaFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create ca file bad request response -func (o *CreateCaFileBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCaFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ca file bad request response -func (o *CreateCaFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ca file bad request response -func (o *CreateCaFileBadRequest) WithPayload(payload *models.Error) *CreateCaFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ca file bad request response -func (o *CreateCaFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCaFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCaFileConflictCode is the HTTP code returned for type CreateCaFileConflict -const CreateCaFileConflictCode int = 409 - -/* -CreateCaFileConflict The specified resource already exists - -swagger:response createCaFileConflict -*/ -type CreateCaFileConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCaFileConflict creates CreateCaFileConflict with default headers values -func NewCreateCaFileConflict() *CreateCaFileConflict { - - return &CreateCaFileConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create ca file conflict response -func (o *CreateCaFileConflict) WithConfigurationVersion(configurationVersion string) *CreateCaFileConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ca file conflict response -func (o *CreateCaFileConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ca file conflict response -func (o *CreateCaFileConflict) WithPayload(payload *models.Error) *CreateCaFileConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ca file conflict response -func (o *CreateCaFileConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCaFileConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCaFileDefault General Error - -swagger:response createCaFileDefault -*/ -type CreateCaFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCaFileDefault creates CreateCaFileDefault with default headers values -func NewCreateCaFileDefault(code int) *CreateCaFileDefault { - if code <= 0 { - code = 500 - } - - return &CreateCaFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create ca file default response -func (o *CreateCaFileDefault) WithStatusCode(code int) *CreateCaFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create ca file default response -func (o *CreateCaFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create ca file default response -func (o *CreateCaFileDefault) WithConfigurationVersion(configurationVersion string) *CreateCaFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create ca file default response -func (o *CreateCaFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create ca file default response -func (o *CreateCaFileDefault) WithPayload(payload *models.Error) *CreateCaFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create ca file default response -func (o *CreateCaFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCaFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/create_ca_file_urlbuilder.go b/operations/s_s_l_runtime/create_ca_file_urlbuilder.go deleted file mode 100644 index 39847f08..00000000 --- a/operations/s_s_l_runtime/create_ca_file_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateCaFileURL generates an URL for the create ca file operation -type CreateCaFileURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCaFileURL) WithBasePath(bp string) *CreateCaFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCaFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCaFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCaFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCaFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCaFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCaFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCaFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCaFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/create_cert.go b/operations/s_s_l_runtime/create_cert.go deleted file mode 100644 index 16f4ed2f..00000000 --- a/operations/s_s_l_runtime/create_cert.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCertHandlerFunc turns a function with the right signature into a create cert handler -type CreateCertHandlerFunc func(CreateCertParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCertHandlerFunc) Handle(params CreateCertParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCertHandler interface for that can handle valid create cert params -type CreateCertHandler interface { - Handle(CreateCertParams, interface{}) middleware.Responder -} - -// NewCreateCert creates a new http.Handler for the create cert operation -func NewCreateCert(ctx *middleware.Context, handler CreateCertHandler) *CreateCert { - return &CreateCert{Context: ctx, Handler: handler} -} - -/* - CreateCert swagger:route POST /services/haproxy/runtime/ssl_certs SSLRuntime createCert - -# Create a new SSL certificate file - -Creates a new SSL certificate file using the runtime socket. -*/ -type CreateCert struct { - Context *middleware.Context - Handler CreateCertHandler -} - -func (o *CreateCert) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCertParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/create_cert_parameters.go b/operations/s_s_l_runtime/create_cert_parameters.go deleted file mode 100644 index 3ee87a25..00000000 --- a/operations/s_s_l_runtime/create_cert_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateCertMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateCertMaxParseMemory int64 = 32 << 20 - -// NewCreateCertParams creates a new CreateCertParams object -// -// There are no default values defined in the spec. -func NewCreateCertParams() CreateCertParams { - - return CreateCertParams{} -} - -// CreateCertParams contains all the bound params for the create cert operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCert -type CreateCertParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate file - Required: true - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCertParams() beforehand. -func (o *CreateCertParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateCertMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateCertParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/s_s_l_runtime/create_cert_responses.go b/operations/s_s_l_runtime/create_cert_responses.go deleted file mode 100644 index 1360ccd0..00000000 --- a/operations/s_s_l_runtime/create_cert_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCertCreatedCode is the HTTP code returned for type CreateCertCreated -const CreateCertCreatedCode int = 201 - -/* -CreateCertCreated Certificate created - -swagger:response createCertCreated -*/ -type CreateCertCreated struct { -} - -// NewCreateCertCreated creates CreateCertCreated with default headers values -func NewCreateCertCreated() *CreateCertCreated { - - return &CreateCertCreated{} -} - -// WriteResponse to the client -func (o *CreateCertCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -// CreateCertBadRequestCode is the HTTP code returned for type CreateCertBadRequest -const CreateCertBadRequestCode int = 400 - -/* -CreateCertBadRequest Bad request - -swagger:response createCertBadRequest -*/ -type CreateCertBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCertBadRequest creates CreateCertBadRequest with default headers values -func NewCreateCertBadRequest() *CreateCertBadRequest { - - return &CreateCertBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create cert bad request response -func (o *CreateCertBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCertBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cert bad request response -func (o *CreateCertBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cert bad request response -func (o *CreateCertBadRequest) WithPayload(payload *models.Error) *CreateCertBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cert bad request response -func (o *CreateCertBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCertBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCertConflictCode is the HTTP code returned for type CreateCertConflict -const CreateCertConflictCode int = 409 - -/* -CreateCertConflict The specified resource already exists - -swagger:response createCertConflict -*/ -type CreateCertConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCertConflict creates CreateCertConflict with default headers values -func NewCreateCertConflict() *CreateCertConflict { - - return &CreateCertConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create cert conflict response -func (o *CreateCertConflict) WithConfigurationVersion(configurationVersion string) *CreateCertConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cert conflict response -func (o *CreateCertConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cert conflict response -func (o *CreateCertConflict) WithPayload(payload *models.Error) *CreateCertConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cert conflict response -func (o *CreateCertConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCertConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCertDefault General Error - -swagger:response createCertDefault -*/ -type CreateCertDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCertDefault creates CreateCertDefault with default headers values -func NewCreateCertDefault(code int) *CreateCertDefault { - if code <= 0 { - code = 500 - } - - return &CreateCertDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create cert default response -func (o *CreateCertDefault) WithStatusCode(code int) *CreateCertDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create cert default response -func (o *CreateCertDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create cert default response -func (o *CreateCertDefault) WithConfigurationVersion(configurationVersion string) *CreateCertDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create cert default response -func (o *CreateCertDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create cert default response -func (o *CreateCertDefault) WithPayload(payload *models.Error) *CreateCertDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create cert default response -func (o *CreateCertDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCertDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/create_cert_urlbuilder.go b/operations/s_s_l_runtime/create_cert_urlbuilder.go deleted file mode 100644 index d496b244..00000000 --- a/operations/s_s_l_runtime/create_cert_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateCertURL generates an URL for the create cert operation -type CreateCertURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCertURL) WithBasePath(bp string) *CreateCertURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCertURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCertURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_certs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCertURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCertURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCertURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCertURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCertURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCertURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/create_crl.go b/operations/s_s_l_runtime/create_crl.go deleted file mode 100644 index a9538173..00000000 --- a/operations/s_s_l_runtime/create_crl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateCrlHandlerFunc turns a function with the right signature into a create crl handler -type CreateCrlHandlerFunc func(CreateCrlParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateCrlHandlerFunc) Handle(params CreateCrlParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateCrlHandler interface for that can handle valid create crl params -type CreateCrlHandler interface { - Handle(CreateCrlParams, interface{}) middleware.Responder -} - -// NewCreateCrl creates a new http.Handler for the create crl operation -func NewCreateCrl(ctx *middleware.Context, handler CreateCrlHandler) *CreateCrl { - return &CreateCrl{Context: ctx, Handler: handler} -} - -/* - CreateCrl swagger:route POST /services/haproxy/runtime/ssl_crl_files SSLRuntime createCrl - -# Create a new CRL file - -Creates a new CRL file with its contents using the runtime socket. -*/ -type CreateCrl struct { - Context *middleware.Context - Handler CreateCrlHandler -} - -func (o *CreateCrl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateCrlParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/create_crl_parameters.go b/operations/s_s_l_runtime/create_crl_parameters.go deleted file mode 100644 index e3550f50..00000000 --- a/operations/s_s_l_runtime/create_crl_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateCrlMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateCrlMaxParseMemory int64 = 32 << 20 - -// NewCreateCrlParams creates a new CreateCrlParams object -// -// There are no default values defined in the spec. -func NewCreateCrlParams() CreateCrlParams { - - return CreateCrlParams{} -} - -// CreateCrlParams contains all the bound params for the create crl operation -// typically these are obtained from a http.Request -// -// swagger:parameters createCrl -type CreateCrlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*CRL file - Required: true - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateCrlParams() beforehand. -func (o *CreateCrlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateCrlMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateCrlParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/s_s_l_runtime/create_crl_responses.go b/operations/s_s_l_runtime/create_crl_responses.go deleted file mode 100644 index e7879e5a..00000000 --- a/operations/s_s_l_runtime/create_crl_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateCrlCreatedCode is the HTTP code returned for type CreateCrlCreated -const CreateCrlCreatedCode int = 201 - -/* -CreateCrlCreated CRL file created - -swagger:response createCrlCreated -*/ -type CreateCrlCreated struct { -} - -// NewCreateCrlCreated creates CreateCrlCreated with default headers values -func NewCreateCrlCreated() *CreateCrlCreated { - - return &CreateCrlCreated{} -} - -// WriteResponse to the client -func (o *CreateCrlCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -// CreateCrlBadRequestCode is the HTTP code returned for type CreateCrlBadRequest -const CreateCrlBadRequestCode int = 400 - -/* -CreateCrlBadRequest Bad request - -swagger:response createCrlBadRequest -*/ -type CreateCrlBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrlBadRequest creates CreateCrlBadRequest with default headers values -func NewCreateCrlBadRequest() *CreateCrlBadRequest { - - return &CreateCrlBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crl bad request response -func (o *CreateCrlBadRequest) WithConfigurationVersion(configurationVersion string) *CreateCrlBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crl bad request response -func (o *CreateCrlBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crl bad request response -func (o *CreateCrlBadRequest) WithPayload(payload *models.Error) *CreateCrlBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crl bad request response -func (o *CreateCrlBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrlBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateCrlConflictCode is the HTTP code returned for type CreateCrlConflict -const CreateCrlConflictCode int = 409 - -/* -CreateCrlConflict The specified resource already exists - -swagger:response createCrlConflict -*/ -type CreateCrlConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrlConflict creates CreateCrlConflict with default headers values -func NewCreateCrlConflict() *CreateCrlConflict { - - return &CreateCrlConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create crl conflict response -func (o *CreateCrlConflict) WithConfigurationVersion(configurationVersion string) *CreateCrlConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crl conflict response -func (o *CreateCrlConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crl conflict response -func (o *CreateCrlConflict) WithPayload(payload *models.Error) *CreateCrlConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crl conflict response -func (o *CreateCrlConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrlConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateCrlDefault General Error - -swagger:response createCrlDefault -*/ -type CreateCrlDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateCrlDefault creates CreateCrlDefault with default headers values -func NewCreateCrlDefault(code int) *CreateCrlDefault { - if code <= 0 { - code = 500 - } - - return &CreateCrlDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create crl default response -func (o *CreateCrlDefault) WithStatusCode(code int) *CreateCrlDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create crl default response -func (o *CreateCrlDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create crl default response -func (o *CreateCrlDefault) WithConfigurationVersion(configurationVersion string) *CreateCrlDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create crl default response -func (o *CreateCrlDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create crl default response -func (o *CreateCrlDefault) WithPayload(payload *models.Error) *CreateCrlDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create crl default response -func (o *CreateCrlDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateCrlDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/create_crl_urlbuilder.go b/operations/s_s_l_runtime/create_crl_urlbuilder.go deleted file mode 100644 index e2f3b0aa..00000000 --- a/operations/s_s_l_runtime/create_crl_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateCrlURL generates an URL for the create crl operation -type CreateCrlURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrlURL) WithBasePath(bp string) *CreateCrlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateCrlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateCrlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crl_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateCrlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateCrlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateCrlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateCrlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateCrlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateCrlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/delete_ca_file.go b/operations/s_s_l_runtime/delete_ca_file.go deleted file mode 100644 index f46b2c4e..00000000 --- a/operations/s_s_l_runtime/delete_ca_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCaFileHandlerFunc turns a function with the right signature into a delete ca file handler -type DeleteCaFileHandlerFunc func(DeleteCaFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCaFileHandlerFunc) Handle(params DeleteCaFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCaFileHandler interface for that can handle valid delete ca file params -type DeleteCaFileHandler interface { - Handle(DeleteCaFileParams, interface{}) middleware.Responder -} - -// NewDeleteCaFile creates a new http.Handler for the delete ca file operation -func NewDeleteCaFile(ctx *middleware.Context, handler DeleteCaFileHandler) *DeleteCaFile { - return &DeleteCaFile{Context: ctx, Handler: handler} -} - -/* - DeleteCaFile swagger:route DELETE /services/haproxy/runtime/ssl_ca_files/{name} SSLRuntime deleteCaFile - -# Deletes a CA file - -Deletes a CA file -*/ -type DeleteCaFile struct { - Context *middleware.Context - Handler DeleteCaFileHandler -} - -func (o *DeleteCaFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCaFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/delete_ca_file_parameters.go b/operations/s_s_l_runtime/delete_ca_file_parameters.go deleted file mode 100644 index d615cd2e..00000000 --- a/operations/s_s_l_runtime/delete_ca_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteCaFileParams creates a new DeleteCaFileParams object -// -// There are no default values defined in the spec. -func NewDeleteCaFileParams() DeleteCaFileParams { - - return DeleteCaFileParams{} -} - -// DeleteCaFileParams contains all the bound params for the delete ca file operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCaFile -type DeleteCaFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL CA file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCaFileParams() beforehand. -func (o *DeleteCaFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteCaFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/delete_ca_file_responses.go b/operations/s_s_l_runtime/delete_ca_file_responses.go deleted file mode 100644 index b206f778..00000000 --- a/operations/s_s_l_runtime/delete_ca_file_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCaFileNoContentCode is the HTTP code returned for type DeleteCaFileNoContent -const DeleteCaFileNoContentCode int = 204 - -/* -DeleteCaFileNoContent SSL CA deleted - -swagger:response deleteCaFileNoContent -*/ -type DeleteCaFileNoContent struct { -} - -// NewDeleteCaFileNoContent creates DeleteCaFileNoContent with default headers values -func NewDeleteCaFileNoContent() *DeleteCaFileNoContent { - - return &DeleteCaFileNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCaFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCaFileBadRequestCode is the HTTP code returned for type DeleteCaFileBadRequest -const DeleteCaFileBadRequestCode int = 400 - -/* -DeleteCaFileBadRequest Bad request - -swagger:response deleteCaFileBadRequest -*/ -type DeleteCaFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCaFileBadRequest creates DeleteCaFileBadRequest with default headers values -func NewDeleteCaFileBadRequest() *DeleteCaFileBadRequest { - - return &DeleteCaFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete ca file bad request response -func (o *DeleteCaFileBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteCaFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete ca file bad request response -func (o *DeleteCaFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete ca file bad request response -func (o *DeleteCaFileBadRequest) WithPayload(payload *models.Error) *DeleteCaFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete ca file bad request response -func (o *DeleteCaFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCaFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCaFileDefault General Error - -swagger:response deleteCaFileDefault -*/ -type DeleteCaFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCaFileDefault creates DeleteCaFileDefault with default headers values -func NewDeleteCaFileDefault(code int) *DeleteCaFileDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCaFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete ca file default response -func (o *DeleteCaFileDefault) WithStatusCode(code int) *DeleteCaFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete ca file default response -func (o *DeleteCaFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete ca file default response -func (o *DeleteCaFileDefault) WithConfigurationVersion(configurationVersion string) *DeleteCaFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete ca file default response -func (o *DeleteCaFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete ca file default response -func (o *DeleteCaFileDefault) WithPayload(payload *models.Error) *DeleteCaFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete ca file default response -func (o *DeleteCaFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCaFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/delete_ca_file_urlbuilder.go b/operations/s_s_l_runtime/delete_ca_file_urlbuilder.go deleted file mode 100644 index 552a8cff..00000000 --- a/operations/s_s_l_runtime/delete_ca_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteCaFileURL generates an URL for the delete ca file operation -type DeleteCaFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCaFileURL) WithBasePath(bp string) *DeleteCaFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCaFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCaFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteCaFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCaFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCaFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCaFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCaFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCaFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCaFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/delete_cert.go b/operations/s_s_l_runtime/delete_cert.go deleted file mode 100644 index 2f8ce9d0..00000000 --- a/operations/s_s_l_runtime/delete_cert.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCertHandlerFunc turns a function with the right signature into a delete cert handler -type DeleteCertHandlerFunc func(DeleteCertParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCertHandlerFunc) Handle(params DeleteCertParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCertHandler interface for that can handle valid delete cert params -type DeleteCertHandler interface { - Handle(DeleteCertParams, interface{}) middleware.Responder -} - -// NewDeleteCert creates a new http.Handler for the delete cert operation -func NewDeleteCert(ctx *middleware.Context, handler DeleteCertHandler) *DeleteCert { - return &DeleteCert{Context: ctx, Handler: handler} -} - -/* - DeleteCert swagger:route DELETE /services/haproxy/runtime/ssl_certs/{name} SSLRuntime deleteCert - -# Delete a certificate - -Deletes a certificate using the runtime socket. -*/ -type DeleteCert struct { - Context *middleware.Context - Handler DeleteCertHandler -} - -func (o *DeleteCert) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCertParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/delete_cert_parameters.go b/operations/s_s_l_runtime/delete_cert_parameters.go deleted file mode 100644 index ac1f0001..00000000 --- a/operations/s_s_l_runtime/delete_cert_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteCertParams creates a new DeleteCertParams object -// -// There are no default values defined in the spec. -func NewDeleteCertParams() DeleteCertParams { - - return DeleteCertParams{} -} - -// DeleteCertParams contains all the bound params for the delete cert operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCert -type DeleteCertParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL certificate name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCertParams() beforehand. -func (o *DeleteCertParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteCertParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/delete_cert_responses.go b/operations/s_s_l_runtime/delete_cert_responses.go deleted file mode 100644 index d6ef7aca..00000000 --- a/operations/s_s_l_runtime/delete_cert_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCertNoContentCode is the HTTP code returned for type DeleteCertNoContent -const DeleteCertNoContentCode int = 204 - -/* -DeleteCertNoContent File deleted - -swagger:response deleteCertNoContent -*/ -type DeleteCertNoContent struct { -} - -// NewDeleteCertNoContent creates DeleteCertNoContent with default headers values -func NewDeleteCertNoContent() *DeleteCertNoContent { - - return &DeleteCertNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCertNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCertBadRequestCode is the HTTP code returned for type DeleteCertBadRequest -const DeleteCertBadRequestCode int = 400 - -/* -DeleteCertBadRequest Bad request - -swagger:response deleteCertBadRequest -*/ -type DeleteCertBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCertBadRequest creates DeleteCertBadRequest with default headers values -func NewDeleteCertBadRequest() *DeleteCertBadRequest { - - return &DeleteCertBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete cert bad request response -func (o *DeleteCertBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteCertBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete cert bad request response -func (o *DeleteCertBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete cert bad request response -func (o *DeleteCertBadRequest) WithPayload(payload *models.Error) *DeleteCertBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete cert bad request response -func (o *DeleteCertBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCertBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCertDefault General Error - -swagger:response deleteCertDefault -*/ -type DeleteCertDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCertDefault creates DeleteCertDefault with default headers values -func NewDeleteCertDefault(code int) *DeleteCertDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCertDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete cert default response -func (o *DeleteCertDefault) WithStatusCode(code int) *DeleteCertDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete cert default response -func (o *DeleteCertDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete cert default response -func (o *DeleteCertDefault) WithConfigurationVersion(configurationVersion string) *DeleteCertDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete cert default response -func (o *DeleteCertDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete cert default response -func (o *DeleteCertDefault) WithPayload(payload *models.Error) *DeleteCertDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete cert default response -func (o *DeleteCertDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCertDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/delete_cert_urlbuilder.go b/operations/s_s_l_runtime/delete_cert_urlbuilder.go deleted file mode 100644 index 7c6bf389..00000000 --- a/operations/s_s_l_runtime/delete_cert_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteCertURL generates an URL for the delete cert operation -type DeleteCertURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCertURL) WithBasePath(bp string) *DeleteCertURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCertURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCertURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_certs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteCertURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCertURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCertURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCertURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCertURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCertURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCertURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/delete_crl.go b/operations/s_s_l_runtime/delete_crl.go deleted file mode 100644 index 5209af61..00000000 --- a/operations/s_s_l_runtime/delete_crl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCrlHandlerFunc turns a function with the right signature into a delete crl handler -type DeleteCrlHandlerFunc func(DeleteCrlParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCrlHandlerFunc) Handle(params DeleteCrlParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCrlHandler interface for that can handle valid delete crl params -type DeleteCrlHandler interface { - Handle(DeleteCrlParams, interface{}) middleware.Responder -} - -// NewDeleteCrl creates a new http.Handler for the delete crl operation -func NewDeleteCrl(ctx *middleware.Context, handler DeleteCrlHandler) *DeleteCrl { - return &DeleteCrl{Context: ctx, Handler: handler} -} - -/* - DeleteCrl swagger:route DELETE /services/haproxy/runtime/ssl_crl_files/{name} SSLRuntime deleteCrl - -# Delete a CRL file - -Deletes a CRL file using the runtime socket. -*/ -type DeleteCrl struct { - Context *middleware.Context - Handler DeleteCrlHandler -} - -func (o *DeleteCrl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCrlParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/delete_crl_parameters.go b/operations/s_s_l_runtime/delete_crl_parameters.go deleted file mode 100644 index 58b11f14..00000000 --- a/operations/s_s_l_runtime/delete_crl_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteCrlParams creates a new DeleteCrlParams object -// -// There are no default values defined in the spec. -func NewDeleteCrlParams() DeleteCrlParams { - - return DeleteCrlParams{} -} - -// DeleteCrlParams contains all the bound params for the delete crl operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCrl -type DeleteCrlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*CRL file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCrlParams() beforehand. -func (o *DeleteCrlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteCrlParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/delete_crl_responses.go b/operations/s_s_l_runtime/delete_crl_responses.go deleted file mode 100644 index 3b92e898..00000000 --- a/operations/s_s_l_runtime/delete_crl_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCrlNoContentCode is the HTTP code returned for type DeleteCrlNoContent -const DeleteCrlNoContentCode int = 204 - -/* -DeleteCrlNoContent File deleted - -swagger:response deleteCrlNoContent -*/ -type DeleteCrlNoContent struct { -} - -// NewDeleteCrlNoContent creates DeleteCrlNoContent with default headers values -func NewDeleteCrlNoContent() *DeleteCrlNoContent { - - return &DeleteCrlNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCrlNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCrlBadRequestCode is the HTTP code returned for type DeleteCrlBadRequest -const DeleteCrlBadRequestCode int = 400 - -/* -DeleteCrlBadRequest Bad request - -swagger:response deleteCrlBadRequest -*/ -type DeleteCrlBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrlBadRequest creates DeleteCrlBadRequest with default headers values -func NewDeleteCrlBadRequest() *DeleteCrlBadRequest { - - return &DeleteCrlBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete crl bad request response -func (o *DeleteCrlBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteCrlBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crl bad request response -func (o *DeleteCrlBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crl bad request response -func (o *DeleteCrlBadRequest) WithPayload(payload *models.Error) *DeleteCrlBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crl bad request response -func (o *DeleteCrlBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrlBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCrlDefault General Error - -swagger:response deleteCrlDefault -*/ -type DeleteCrlDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrlDefault creates DeleteCrlDefault with default headers values -func NewDeleteCrlDefault(code int) *DeleteCrlDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCrlDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete crl default response -func (o *DeleteCrlDefault) WithStatusCode(code int) *DeleteCrlDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete crl default response -func (o *DeleteCrlDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete crl default response -func (o *DeleteCrlDefault) WithConfigurationVersion(configurationVersion string) *DeleteCrlDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crl default response -func (o *DeleteCrlDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crl default response -func (o *DeleteCrlDefault) WithPayload(payload *models.Error) *DeleteCrlDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crl default response -func (o *DeleteCrlDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrlDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/delete_crl_urlbuilder.go b/operations/s_s_l_runtime/delete_crl_urlbuilder.go deleted file mode 100644 index 95cccf86..00000000 --- a/operations/s_s_l_runtime/delete_crl_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteCrlURL generates an URL for the delete crl operation -type DeleteCrlURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrlURL) WithBasePath(bp string) *DeleteCrlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCrlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crl_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteCrlURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCrlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCrlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCrlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCrlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCrlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCrlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/delete_crt_list_entry.go b/operations/s_s_l_runtime/delete_crt_list_entry.go deleted file mode 100644 index 0f004d09..00000000 --- a/operations/s_s_l_runtime/delete_crt_list_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteCrtListEntryHandlerFunc turns a function with the right signature into a delete crt list entry handler -type DeleteCrtListEntryHandlerFunc func(DeleteCrtListEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteCrtListEntryHandlerFunc) Handle(params DeleteCrtListEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteCrtListEntryHandler interface for that can handle valid delete crt list entry params -type DeleteCrtListEntryHandler interface { - Handle(DeleteCrtListEntryParams, interface{}) middleware.Responder -} - -// NewDeleteCrtListEntry creates a new http.Handler for the delete crt list entry operation -func NewDeleteCrtListEntry(ctx *middleware.Context, handler DeleteCrtListEntryHandler) *DeleteCrtListEntry { - return &DeleteCrtListEntry{Context: ctx, Handler: handler} -} - -/* - DeleteCrtListEntry swagger:route DELETE /services/haproxy/runtime/ssl_crt_lists/entries SSLRuntime deleteCrtListEntry - -# Delete an entry from a crt-list - -Deletes a single entry from the given crt-list using the runtime socket. -*/ -type DeleteCrtListEntry struct { - Context *middleware.Context - Handler DeleteCrtListEntryHandler -} - -func (o *DeleteCrtListEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteCrtListEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/delete_crt_list_entry_parameters.go b/operations/s_s_l_runtime/delete_crt_list_entry_parameters.go deleted file mode 100644 index 15c5ead0..00000000 --- a/operations/s_s_l_runtime/delete_crt_list_entry_parameters.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteCrtListEntryParams creates a new DeleteCrtListEntryParams object -// -// There are no default values defined in the spec. -func NewDeleteCrtListEntryParams() DeleteCrtListEntryParams { - - return DeleteCrtListEntryParams{} -} - -// DeleteCrtListEntryParams contains all the bound params for the delete crt list entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteCrtListEntry -type DeleteCrtListEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL cert entry name - Required: true - In: query - */ - CertFile string - /*The line number where the entry is located, in case several entries share the same certificate. - Minimum: 1 - In: query - */ - LineNumber *int64 - /*SSL crt list name - Required: true - In: query - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteCrtListEntryParams() beforehand. -func (o *DeleteCrtListEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCertFile, qhkCertFile, _ := qs.GetOK("cert_file") - if err := o.bindCertFile(qCertFile, qhkCertFile, route.Formats); err != nil { - res = append(res, err) - } - - qLineNumber, qhkLineNumber, _ := qs.GetOK("line_number") - if err := o.bindLineNumber(qLineNumber, qhkLineNumber, route.Formats); err != nil { - res = append(res, err) - } - - qName, qhkName, _ := qs.GetOK("name") - if err := o.bindName(qName, qhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertFile binds and validates parameter CertFile from query. -func (o *DeleteCrtListEntryParams) bindCertFile(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("cert_file", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("cert_file", "query", raw); err != nil { - return err - } - o.CertFile = raw - - return nil -} - -// bindLineNumber binds and validates parameter LineNumber from query. -func (o *DeleteCrtListEntryParams) bindLineNumber(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("line_number", "query", "int64", raw) - } - o.LineNumber = &value - - if err := o.validateLineNumber(formats); err != nil { - return err - } - - return nil -} - -// validateLineNumber carries on validations for parameter LineNumber -func (o *DeleteCrtListEntryParams) validateLineNumber(formats strfmt.Registry) error { - - if err := validate.MinimumInt("line_number", "query", *o.LineNumber, 1, false); err != nil { - return err - } - - return nil -} - -// bindName binds and validates parameter Name from query. -func (o *DeleteCrtListEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("name", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("name", "query", raw); err != nil { - return err - } - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/delete_crt_list_entry_responses.go b/operations/s_s_l_runtime/delete_crt_list_entry_responses.go deleted file mode 100644 index 420bb7b7..00000000 --- a/operations/s_s_l_runtime/delete_crt_list_entry_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteCrtListEntryNoContentCode is the HTTP code returned for type DeleteCrtListEntryNoContent -const DeleteCrtListEntryNoContentCode int = 204 - -/* -DeleteCrtListEntryNoContent Successful operation - -swagger:response deleteCrtListEntryNoContent -*/ -type DeleteCrtListEntryNoContent struct { -} - -// NewDeleteCrtListEntryNoContent creates DeleteCrtListEntryNoContent with default headers values -func NewDeleteCrtListEntryNoContent() *DeleteCrtListEntryNoContent { - - return &DeleteCrtListEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeleteCrtListEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteCrtListEntryBadRequestCode is the HTTP code returned for type DeleteCrtListEntryBadRequest -const DeleteCrtListEntryBadRequestCode int = 400 - -/* -DeleteCrtListEntryBadRequest Bad request - -swagger:response deleteCrtListEntryBadRequest -*/ -type DeleteCrtListEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtListEntryBadRequest creates DeleteCrtListEntryBadRequest with default headers values -func NewDeleteCrtListEntryBadRequest() *DeleteCrtListEntryBadRequest { - - return &DeleteCrtListEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt list entry bad request response -func (o *DeleteCrtListEntryBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteCrtListEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt list entry bad request response -func (o *DeleteCrtListEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt list entry bad request response -func (o *DeleteCrtListEntryBadRequest) WithPayload(payload *models.Error) *DeleteCrtListEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt list entry bad request response -func (o *DeleteCrtListEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtListEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteCrtListEntryNotFoundCode is the HTTP code returned for type DeleteCrtListEntryNotFound -const DeleteCrtListEntryNotFoundCode int = 404 - -/* -DeleteCrtListEntryNotFound The specified resource was not found - -swagger:response deleteCrtListEntryNotFound -*/ -type DeleteCrtListEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtListEntryNotFound creates DeleteCrtListEntryNotFound with default headers values -func NewDeleteCrtListEntryNotFound() *DeleteCrtListEntryNotFound { - - return &DeleteCrtListEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt list entry not found response -func (o *DeleteCrtListEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeleteCrtListEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt list entry not found response -func (o *DeleteCrtListEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt list entry not found response -func (o *DeleteCrtListEntryNotFound) WithPayload(payload *models.Error) *DeleteCrtListEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt list entry not found response -func (o *DeleteCrtListEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtListEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteCrtListEntryDefault General Error - -swagger:response deleteCrtListEntryDefault -*/ -type DeleteCrtListEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteCrtListEntryDefault creates DeleteCrtListEntryDefault with default headers values -func NewDeleteCrtListEntryDefault(code int) *DeleteCrtListEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeleteCrtListEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) WithStatusCode(code int) *DeleteCrtListEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) WithConfigurationVersion(configurationVersion string) *DeleteCrtListEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) WithPayload(payload *models.Error) *DeleteCrtListEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete crt list entry default response -func (o *DeleteCrtListEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteCrtListEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/delete_crt_list_entry_urlbuilder.go b/operations/s_s_l_runtime/delete_crt_list_entry_urlbuilder.go deleted file mode 100644 index 30246069..00000000 --- a/operations/s_s_l_runtime/delete_crt_list_entry_urlbuilder.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// DeleteCrtListEntryURL generates an URL for the delete crt list entry operation -type DeleteCrtListEntryURL struct { - CertFile string - LineNumber *int64 - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtListEntryURL) WithBasePath(bp string) *DeleteCrtListEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteCrtListEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteCrtListEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crt_lists/entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - certFileQ := o.CertFile - if certFileQ != "" { - qs.Set("cert_file", certFileQ) - } - - var lineNumberQ string - if o.LineNumber != nil { - lineNumberQ = swag.FormatInt64(*o.LineNumber) - } - if lineNumberQ != "" { - qs.Set("line_number", lineNumberQ) - } - - nameQ := o.Name - if nameQ != "" { - qs.Set("name", nameQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteCrtListEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteCrtListEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteCrtListEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteCrtListEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteCrtListEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteCrtListEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_all_ca_files.go b/operations/s_s_l_runtime/get_all_ca_files.go deleted file mode 100644 index 433b6ec1..00000000 --- a/operations/s_s_l_runtime/get_all_ca_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllCaFilesHandlerFunc turns a function with the right signature into a get all ca files handler -type GetAllCaFilesHandlerFunc func(GetAllCaFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllCaFilesHandlerFunc) Handle(params GetAllCaFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllCaFilesHandler interface for that can handle valid get all ca files params -type GetAllCaFilesHandler interface { - Handle(GetAllCaFilesParams, interface{}) middleware.Responder -} - -// NewGetAllCaFiles creates a new http.Handler for the get all ca files operation -func NewGetAllCaFiles(ctx *middleware.Context, handler GetAllCaFilesHandler) *GetAllCaFiles { - return &GetAllCaFiles{Context: ctx, Handler: handler} -} - -/* - GetAllCaFiles swagger:route GET /services/haproxy/runtime/ssl_ca_files SSLRuntime getAllCaFiles - -# Return an array of all SSL CA files - -Returns all SSL CA files using the runtime socket. -*/ -type GetAllCaFiles struct { - Context *middleware.Context - Handler GetAllCaFilesHandler -} - -func (o *GetAllCaFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllCaFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_all_ca_files_parameters.go b/operations/s_s_l_runtime/get_all_ca_files_parameters.go deleted file mode 100644 index 9ff7b51c..00000000 --- a/operations/s_s_l_runtime/get_all_ca_files_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllCaFilesParams creates a new GetAllCaFilesParams object -// -// There are no default values defined in the spec. -func NewGetAllCaFilesParams() GetAllCaFilesParams { - - return GetAllCaFilesParams{} -} - -// GetAllCaFilesParams contains all the bound params for the get all ca files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllCaFiles -type GetAllCaFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllCaFilesParams() beforehand. -func (o *GetAllCaFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/s_s_l_runtime/get_all_ca_files_responses.go b/operations/s_s_l_runtime/get_all_ca_files_responses.go deleted file mode 100644 index 69f3ea4b..00000000 --- a/operations/s_s_l_runtime/get_all_ca_files_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllCaFilesOKCode is the HTTP code returned for type GetAllCaFilesOK -const GetAllCaFilesOKCode int = 200 - -/* -GetAllCaFilesOK Successful operation - -swagger:response getAllCaFilesOK -*/ -type GetAllCaFilesOK struct { - - /* - In: Body - */ - Payload models.SslCaFiles `json:"body,omitempty"` -} - -// NewGetAllCaFilesOK creates GetAllCaFilesOK with default headers values -func NewGetAllCaFilesOK() *GetAllCaFilesOK { - - return &GetAllCaFilesOK{} -} - -// WithPayload adds the payload to the get all ca files o k response -func (o *GetAllCaFilesOK) WithPayload(payload models.SslCaFiles) *GetAllCaFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all ca files o k response -func (o *GetAllCaFilesOK) SetPayload(payload models.SslCaFiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCaFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCaFiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllCaFilesDefault General Error - -swagger:response getAllCaFilesDefault -*/ -type GetAllCaFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllCaFilesDefault creates GetAllCaFilesDefault with default headers values -func NewGetAllCaFilesDefault(code int) *GetAllCaFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllCaFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all ca files default response -func (o *GetAllCaFilesDefault) WithStatusCode(code int) *GetAllCaFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all ca files default response -func (o *GetAllCaFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all ca files default response -func (o *GetAllCaFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllCaFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all ca files default response -func (o *GetAllCaFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all ca files default response -func (o *GetAllCaFilesDefault) WithPayload(payload *models.Error) *GetAllCaFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all ca files default response -func (o *GetAllCaFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCaFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_all_ca_files_urlbuilder.go b/operations/s_s_l_runtime/get_all_ca_files_urlbuilder.go deleted file mode 100644 index 19cf80e4..00000000 --- a/operations/s_s_l_runtime/get_all_ca_files_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllCaFilesURL generates an URL for the get all ca files operation -type GetAllCaFilesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCaFilesURL) WithBasePath(bp string) *GetAllCaFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCaFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllCaFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllCaFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllCaFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllCaFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllCaFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllCaFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllCaFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_all_certs.go b/operations/s_s_l_runtime/get_all_certs.go deleted file mode 100644 index 6b0e40cd..00000000 --- a/operations/s_s_l_runtime/get_all_certs.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllCertsHandlerFunc turns a function with the right signature into a get all certs handler -type GetAllCertsHandlerFunc func(GetAllCertsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllCertsHandlerFunc) Handle(params GetAllCertsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllCertsHandler interface for that can handle valid get all certs params -type GetAllCertsHandler interface { - Handle(GetAllCertsParams, interface{}) middleware.Responder -} - -// NewGetAllCerts creates a new http.Handler for the get all certs operation -func NewGetAllCerts(ctx *middleware.Context, handler GetAllCertsHandler) *GetAllCerts { - return &GetAllCerts{Context: ctx, Handler: handler} -} - -/* - GetAllCerts swagger:route GET /services/haproxy/runtime/ssl_certs SSLRuntime getAllCerts - -# Return a list of SSL certificate files - -Returns certificate files descriptions from runtime. -*/ -type GetAllCerts struct { - Context *middleware.Context - Handler GetAllCertsHandler -} - -func (o *GetAllCerts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllCertsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_all_certs_parameters.go b/operations/s_s_l_runtime/get_all_certs_parameters.go deleted file mode 100644 index ffc76108..00000000 --- a/operations/s_s_l_runtime/get_all_certs_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllCertsParams creates a new GetAllCertsParams object -// -// There are no default values defined in the spec. -func NewGetAllCertsParams() GetAllCertsParams { - - return GetAllCertsParams{} -} - -// GetAllCertsParams contains all the bound params for the get all certs operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllCerts -type GetAllCertsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllCertsParams() beforehand. -func (o *GetAllCertsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/s_s_l_runtime/get_all_certs_responses.go b/operations/s_s_l_runtime/get_all_certs_responses.go deleted file mode 100644 index 13f4051b..00000000 --- a/operations/s_s_l_runtime/get_all_certs_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllCertsOKCode is the HTTP code returned for type GetAllCertsOK -const GetAllCertsOKCode int = 200 - -/* -GetAllCertsOK Successful operation - -swagger:response getAllCertsOK -*/ -type GetAllCertsOK struct { - - /* - In: Body - */ - Payload models.SslCertificates `json:"body,omitempty"` -} - -// NewGetAllCertsOK creates GetAllCertsOK with default headers values -func NewGetAllCertsOK() *GetAllCertsOK { - - return &GetAllCertsOK{} -} - -// WithPayload adds the payload to the get all certs o k response -func (o *GetAllCertsOK) WithPayload(payload models.SslCertificates) *GetAllCertsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all certs o k response -func (o *GetAllCertsOK) SetPayload(payload models.SslCertificates) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCertsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCertificates{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllCertsDefault General Error - -swagger:response getAllCertsDefault -*/ -type GetAllCertsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllCertsDefault creates GetAllCertsDefault with default headers values -func NewGetAllCertsDefault(code int) *GetAllCertsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllCertsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all certs default response -func (o *GetAllCertsDefault) WithStatusCode(code int) *GetAllCertsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all certs default response -func (o *GetAllCertsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all certs default response -func (o *GetAllCertsDefault) WithConfigurationVersion(configurationVersion string) *GetAllCertsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all certs default response -func (o *GetAllCertsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all certs default response -func (o *GetAllCertsDefault) WithPayload(payload *models.Error) *GetAllCertsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all certs default response -func (o *GetAllCertsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCertsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_all_certs_urlbuilder.go b/operations/s_s_l_runtime/get_all_certs_urlbuilder.go deleted file mode 100644 index aafe5920..00000000 --- a/operations/s_s_l_runtime/get_all_certs_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllCertsURL generates an URL for the get all certs operation -type GetAllCertsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCertsURL) WithBasePath(bp string) *GetAllCertsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCertsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllCertsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_certs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllCertsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllCertsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllCertsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllCertsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllCertsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllCertsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_all_crl.go b/operations/s_s_l_runtime/get_all_crl.go deleted file mode 100644 index 7c6125c7..00000000 --- a/operations/s_s_l_runtime/get_all_crl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllCrlHandlerFunc turns a function with the right signature into a get all crl handler -type GetAllCrlHandlerFunc func(GetAllCrlParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllCrlHandlerFunc) Handle(params GetAllCrlParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllCrlHandler interface for that can handle valid get all crl params -type GetAllCrlHandler interface { - Handle(GetAllCrlParams, interface{}) middleware.Responder -} - -// NewGetAllCrl creates a new http.Handler for the get all crl operation -func NewGetAllCrl(ctx *middleware.Context, handler GetAllCrlHandler) *GetAllCrl { - return &GetAllCrl{Context: ctx, Handler: handler} -} - -/* - GetAllCrl swagger:route GET /services/haproxy/runtime/ssl_crl_files SSLRuntime getAllCrl - -# Return an array of all the CRL files - -Returns all the certificate revocation list files using the runtime socket. -*/ -type GetAllCrl struct { - Context *middleware.Context - Handler GetAllCrlHandler -} - -func (o *GetAllCrl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllCrlParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_all_crl_parameters.go b/operations/s_s_l_runtime/get_all_crl_parameters.go deleted file mode 100644 index d0b15220..00000000 --- a/operations/s_s_l_runtime/get_all_crl_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllCrlParams creates a new GetAllCrlParams object -// -// There are no default values defined in the spec. -func NewGetAllCrlParams() GetAllCrlParams { - - return GetAllCrlParams{} -} - -// GetAllCrlParams contains all the bound params for the get all crl operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllCrl -type GetAllCrlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllCrlParams() beforehand. -func (o *GetAllCrlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/s_s_l_runtime/get_all_crl_responses.go b/operations/s_s_l_runtime/get_all_crl_responses.go deleted file mode 100644 index 68c950cd..00000000 --- a/operations/s_s_l_runtime/get_all_crl_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllCrlOKCode is the HTTP code returned for type GetAllCrlOK -const GetAllCrlOKCode int = 200 - -/* -GetAllCrlOK Successful operation - -swagger:response getAllCrlOK -*/ -type GetAllCrlOK struct { - - /* - In: Body - */ - Payload models.SslCrls `json:"body,omitempty"` -} - -// NewGetAllCrlOK creates GetAllCrlOK with default headers values -func NewGetAllCrlOK() *GetAllCrlOK { - - return &GetAllCrlOK{} -} - -// WithPayload adds the payload to the get all crl o k response -func (o *GetAllCrlOK) WithPayload(payload models.SslCrls) *GetAllCrlOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crl o k response -func (o *GetAllCrlOK) SetPayload(payload models.SslCrls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrlOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllCrlDefault General Error - -swagger:response getAllCrlDefault -*/ -type GetAllCrlDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllCrlDefault creates GetAllCrlDefault with default headers values -func NewGetAllCrlDefault(code int) *GetAllCrlDefault { - if code <= 0 { - code = 500 - } - - return &GetAllCrlDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all crl default response -func (o *GetAllCrlDefault) WithStatusCode(code int) *GetAllCrlDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all crl default response -func (o *GetAllCrlDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all crl default response -func (o *GetAllCrlDefault) WithConfigurationVersion(configurationVersion string) *GetAllCrlDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all crl default response -func (o *GetAllCrlDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all crl default response -func (o *GetAllCrlDefault) WithPayload(payload *models.Error) *GetAllCrlDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crl default response -func (o *GetAllCrlDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrlDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_all_crl_urlbuilder.go b/operations/s_s_l_runtime/get_all_crl_urlbuilder.go deleted file mode 100644 index af859305..00000000 --- a/operations/s_s_l_runtime/get_all_crl_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllCrlURL generates an URL for the get all crl operation -type GetAllCrlURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrlURL) WithBasePath(bp string) *GetAllCrlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllCrlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crl_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllCrlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllCrlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllCrlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllCrlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllCrlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllCrlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_all_crt_list_entries.go b/operations/s_s_l_runtime/get_all_crt_list_entries.go deleted file mode 100644 index a9668905..00000000 --- a/operations/s_s_l_runtime/get_all_crt_list_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllCrtListEntriesHandlerFunc turns a function with the right signature into a get all crt list entries handler -type GetAllCrtListEntriesHandlerFunc func(GetAllCrtListEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllCrtListEntriesHandlerFunc) Handle(params GetAllCrtListEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllCrtListEntriesHandler interface for that can handle valid get all crt list entries params -type GetAllCrtListEntriesHandler interface { - Handle(GetAllCrtListEntriesParams, interface{}) middleware.Responder -} - -// NewGetAllCrtListEntries creates a new http.Handler for the get all crt list entries operation -func NewGetAllCrtListEntries(ctx *middleware.Context, handler GetAllCrtListEntriesHandler) *GetAllCrtListEntries { - return &GetAllCrtListEntries{Context: ctx, Handler: handler} -} - -/* - GetAllCrtListEntries swagger:route GET /services/haproxy/runtime/ssl_crt_lists/entries SSLRuntime getAllCrtListEntries - -# Get all the entries inside a crt-list - -Returns an array of entries present inside the given crt-list file. Their index can be used to delete them. -*/ -type GetAllCrtListEntries struct { - Context *middleware.Context - Handler GetAllCrtListEntriesHandler -} - -func (o *GetAllCrtListEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllCrtListEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_all_crt_list_entries_parameters.go b/operations/s_s_l_runtime/get_all_crt_list_entries_parameters.go deleted file mode 100644 index 6bfaf35e..00000000 --- a/operations/s_s_l_runtime/get_all_crt_list_entries_parameters.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetAllCrtListEntriesParams creates a new GetAllCrtListEntriesParams object -// -// There are no default values defined in the spec. -func NewGetAllCrtListEntriesParams() GetAllCrtListEntriesParams { - - return GetAllCrtListEntriesParams{} -} - -// GetAllCrtListEntriesParams contains all the bound params for the get all crt list entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllCrtListEntries -type GetAllCrtListEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL crt-list filename - Required: true - In: query - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllCrtListEntriesParams() beforehand. -func (o *GetAllCrtListEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qName, qhkName, _ := qs.GetOK("name") - if err := o.bindName(qName, qhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from query. -func (o *GetAllCrtListEntriesParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("name", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("name", "query", raw); err != nil { - return err - } - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/get_all_crt_list_entries_responses.go b/operations/s_s_l_runtime/get_all_crt_list_entries_responses.go deleted file mode 100644 index fd93dc05..00000000 --- a/operations/s_s_l_runtime/get_all_crt_list_entries_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllCrtListEntriesOKCode is the HTTP code returned for type GetAllCrtListEntriesOK -const GetAllCrtListEntriesOKCode int = 200 - -/* -GetAllCrtListEntriesOK Successful operation - -swagger:response getAllCrtListEntriesOK -*/ -type GetAllCrtListEntriesOK struct { - - /* - In: Body - */ - Payload models.SslCrtListEntries `json:"body,omitempty"` -} - -// NewGetAllCrtListEntriesOK creates GetAllCrtListEntriesOK with default headers values -func NewGetAllCrtListEntriesOK() *GetAllCrtListEntriesOK { - - return &GetAllCrtListEntriesOK{} -} - -// WithPayload adds the payload to the get all crt list entries o k response -func (o *GetAllCrtListEntriesOK) WithPayload(payload models.SslCrtListEntries) *GetAllCrtListEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crt list entries o k response -func (o *GetAllCrtListEntriesOK) SetPayload(payload models.SslCrtListEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrtListEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrtListEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllCrtListEntriesDefault General Error - -swagger:response getAllCrtListEntriesDefault -*/ -type GetAllCrtListEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllCrtListEntriesDefault creates GetAllCrtListEntriesDefault with default headers values -func NewGetAllCrtListEntriesDefault(code int) *GetAllCrtListEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllCrtListEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) WithStatusCode(code int) *GetAllCrtListEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetAllCrtListEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) WithPayload(payload *models.Error) *GetAllCrtListEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crt list entries default response -func (o *GetAllCrtListEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrtListEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_all_crt_list_entries_urlbuilder.go b/operations/s_s_l_runtime/get_all_crt_list_entries_urlbuilder.go deleted file mode 100644 index e5770430..00000000 --- a/operations/s_s_l_runtime/get_all_crt_list_entries_urlbuilder.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllCrtListEntriesURL generates an URL for the get all crt list entries operation -type GetAllCrtListEntriesURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrtListEntriesURL) WithBasePath(bp string) *GetAllCrtListEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrtListEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllCrtListEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crt_lists/entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - nameQ := o.Name - if nameQ != "" { - qs.Set("name", nameQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllCrtListEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllCrtListEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllCrtListEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllCrtListEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllCrtListEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllCrtListEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_all_crt_lists.go b/operations/s_s_l_runtime/get_all_crt_lists.go deleted file mode 100644 index 4d621cd2..00000000 --- a/operations/s_s_l_runtime/get_all_crt_lists.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllCrtListsHandlerFunc turns a function with the right signature into a get all crt lists handler -type GetAllCrtListsHandlerFunc func(GetAllCrtListsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllCrtListsHandlerFunc) Handle(params GetAllCrtListsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllCrtListsHandler interface for that can handle valid get all crt lists params -type GetAllCrtListsHandler interface { - Handle(GetAllCrtListsParams, interface{}) middleware.Responder -} - -// NewGetAllCrtLists creates a new http.Handler for the get all crt lists operation -func NewGetAllCrtLists(ctx *middleware.Context, handler GetAllCrtListsHandler) *GetAllCrtLists { - return &GetAllCrtLists{Context: ctx, Handler: handler} -} - -/* - GetAllCrtLists swagger:route GET /services/haproxy/runtime/ssl_crt_lists SSLRuntime getAllCrtLists - -# Get the list of all crt-list files - -Returns an array of crt-list file descriptions from runtime. -*/ -type GetAllCrtLists struct { - Context *middleware.Context - Handler GetAllCrtListsHandler -} - -func (o *GetAllCrtLists) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllCrtListsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_all_crt_lists_parameters.go b/operations/s_s_l_runtime/get_all_crt_lists_parameters.go deleted file mode 100644 index 31246576..00000000 --- a/operations/s_s_l_runtime/get_all_crt_lists_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllCrtListsParams creates a new GetAllCrtListsParams object -// -// There are no default values defined in the spec. -func NewGetAllCrtListsParams() GetAllCrtListsParams { - - return GetAllCrtListsParams{} -} - -// GetAllCrtListsParams contains all the bound params for the get all crt lists operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllCrtLists -type GetAllCrtListsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllCrtListsParams() beforehand. -func (o *GetAllCrtListsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/s_s_l_runtime/get_all_crt_lists_responses.go b/operations/s_s_l_runtime/get_all_crt_lists_responses.go deleted file mode 100644 index ed514b7d..00000000 --- a/operations/s_s_l_runtime/get_all_crt_lists_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllCrtListsOKCode is the HTTP code returned for type GetAllCrtListsOK -const GetAllCrtListsOKCode int = 200 - -/* -GetAllCrtListsOK Successful operation - -swagger:response getAllCrtListsOK -*/ -type GetAllCrtListsOK struct { - - /* - In: Body - */ - Payload models.SslCrtLists `json:"body,omitempty"` -} - -// NewGetAllCrtListsOK creates GetAllCrtListsOK with default headers values -func NewGetAllCrtListsOK() *GetAllCrtListsOK { - - return &GetAllCrtListsOK{} -} - -// WithPayload adds the payload to the get all crt lists o k response -func (o *GetAllCrtListsOK) WithPayload(payload models.SslCrtLists) *GetAllCrtListsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crt lists o k response -func (o *GetAllCrtListsOK) SetPayload(payload models.SslCrtLists) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrtListsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrtLists{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllCrtListsDefault General Error - -swagger:response getAllCrtListsDefault -*/ -type GetAllCrtListsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllCrtListsDefault creates GetAllCrtListsDefault with default headers values -func NewGetAllCrtListsDefault(code int) *GetAllCrtListsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllCrtListsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all crt lists default response -func (o *GetAllCrtListsDefault) WithStatusCode(code int) *GetAllCrtListsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all crt lists default response -func (o *GetAllCrtListsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all crt lists default response -func (o *GetAllCrtListsDefault) WithConfigurationVersion(configurationVersion string) *GetAllCrtListsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all crt lists default response -func (o *GetAllCrtListsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all crt lists default response -func (o *GetAllCrtListsDefault) WithPayload(payload *models.Error) *GetAllCrtListsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all crt lists default response -func (o *GetAllCrtListsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllCrtListsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_all_crt_lists_urlbuilder.go b/operations/s_s_l_runtime/get_all_crt_lists_urlbuilder.go deleted file mode 100644 index e07794ca..00000000 --- a/operations/s_s_l_runtime/get_all_crt_lists_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllCrtListsURL generates an URL for the get all crt lists operation -type GetAllCrtListsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrtListsURL) WithBasePath(bp string) *GetAllCrtListsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllCrtListsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllCrtListsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crt_lists" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllCrtListsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllCrtListsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllCrtListsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllCrtListsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllCrtListsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllCrtListsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_ca_entry.go b/operations/s_s_l_runtime/get_ca_entry.go deleted file mode 100644 index fdb84f61..00000000 --- a/operations/s_s_l_runtime/get_ca_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCaEntryHandlerFunc turns a function with the right signature into a get ca entry handler -type GetCaEntryHandlerFunc func(GetCaEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCaEntryHandlerFunc) Handle(params GetCaEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCaEntryHandler interface for that can handle valid get ca entry params -type GetCaEntryHandler interface { - Handle(GetCaEntryParams, interface{}) middleware.Responder -} - -// NewGetCaEntry creates a new http.Handler for the get ca entry operation -func NewGetCaEntry(ctx *middleware.Context, handler GetCaEntryHandler) *GetCaEntry { - return &GetCaEntry{Context: ctx, Handler: handler} -} - -/* - GetCaEntry swagger:route GET /services/haproxy/runtime/ssl_ca_files/{name}/entries/{index} SSLRuntime getCaEntry - -# Return an SSL CA file cert entry - -Returns an SSL CA file cert entry. -*/ -type GetCaEntry struct { - Context *middleware.Context - Handler GetCaEntryHandler -} - -func (o *GetCaEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCaEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_ca_entry_parameters.go b/operations/s_s_l_runtime/get_ca_entry_parameters.go deleted file mode 100644 index c012263a..00000000 --- a/operations/s_s_l_runtime/get_ca_entry_parameters.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetCaEntryParams creates a new GetCaEntryParams object -// -// There are no default values defined in the spec. -func NewGetCaEntryParams() GetCaEntryParams { - - return GetCaEntryParams{} -} - -// GetCaEntryParams contains all the bound params for the get ca entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCaEntry -type GetCaEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL CA file index - Required: true - Minimum: 0 - In: path - */ - Index int64 - /*SSL CA file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCaEntryParams() beforehand. -func (o *GetCaEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetCaEntryParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - if err := o.validateIndex(formats); err != nil { - return err - } - - return nil -} - -// validateIndex carries on validations for parameter Index -func (o *GetCaEntryParams) validateIndex(formats strfmt.Registry) error { - - if err := validate.MinimumInt("index", "path", o.Index, 0, false); err != nil { - return err - } - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCaEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/get_ca_entry_responses.go b/operations/s_s_l_runtime/get_ca_entry_responses.go deleted file mode 100644 index 62b9fb95..00000000 --- a/operations/s_s_l_runtime/get_ca_entry_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCaEntryOKCode is the HTTP code returned for type GetCaEntryOK -const GetCaEntryOKCode int = 200 - -/* -GetCaEntryOK Successful operation - -swagger:response getCaEntryOK -*/ -type GetCaEntryOK struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewGetCaEntryOK creates GetCaEntryOK with default headers values -func NewGetCaEntryOK() *GetCaEntryOK { - - return &GetCaEntryOK{} -} - -// WithPayload adds the payload to the get ca entry o k response -func (o *GetCaEntryOK) WithPayload(payload *models.SslCertificate) *GetCaEntryOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca entry o k response -func (o *GetCaEntryOK) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaEntryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetCaEntryNotFoundCode is the HTTP code returned for type GetCaEntryNotFound -const GetCaEntryNotFoundCode int = 404 - -/* -GetCaEntryNotFound The specified resource was not found - -swagger:response getCaEntryNotFound -*/ -type GetCaEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCaEntryNotFound creates GetCaEntryNotFound with default headers values -func NewGetCaEntryNotFound() *GetCaEntryNotFound { - - return &GetCaEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get ca entry not found response -func (o *GetCaEntryNotFound) WithConfigurationVersion(configurationVersion string) *GetCaEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ca entry not found response -func (o *GetCaEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ca entry not found response -func (o *GetCaEntryNotFound) WithPayload(payload *models.Error) *GetCaEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca entry not found response -func (o *GetCaEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCaEntryDefault General Error - -swagger:response getCaEntryDefault -*/ -type GetCaEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCaEntryDefault creates GetCaEntryDefault with default headers values -func NewGetCaEntryDefault(code int) *GetCaEntryDefault { - if code <= 0 { - code = 500 - } - - return &GetCaEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get ca entry default response -func (o *GetCaEntryDefault) WithStatusCode(code int) *GetCaEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get ca entry default response -func (o *GetCaEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get ca entry default response -func (o *GetCaEntryDefault) WithConfigurationVersion(configurationVersion string) *GetCaEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ca entry default response -func (o *GetCaEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ca entry default response -func (o *GetCaEntryDefault) WithPayload(payload *models.Error) *GetCaEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca entry default response -func (o *GetCaEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_ca_entry_urlbuilder.go b/operations/s_s_l_runtime/get_ca_entry_urlbuilder.go deleted file mode 100644 index f75296b1..00000000 --- a/operations/s_s_l_runtime/get_ca_entry_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetCaEntryURL generates an URL for the get ca entry operation -type GetCaEntryURL struct { - Index int64 - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCaEntryURL) WithBasePath(bp string) *GetCaEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCaEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCaEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetCaEntryURL") - } - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCaEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCaEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCaEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCaEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCaEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCaEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCaEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_ca_file.go b/operations/s_s_l_runtime/get_ca_file.go deleted file mode 100644 index e90cbc21..00000000 --- a/operations/s_s_l_runtime/get_ca_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCaFileHandlerFunc turns a function with the right signature into a get ca file handler -type GetCaFileHandlerFunc func(GetCaFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCaFileHandlerFunc) Handle(params GetCaFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCaFileHandler interface for that can handle valid get ca file params -type GetCaFileHandler interface { - Handle(GetCaFileParams, interface{}) middleware.Responder -} - -// NewGetCaFile creates a new http.Handler for the get ca file operation -func NewGetCaFile(ctx *middleware.Context, handler GetCaFileHandler) *GetCaFile { - return &GetCaFile{Context: ctx, Handler: handler} -} - -/* - GetCaFile swagger:route GET /services/haproxy/runtime/ssl_ca_files/{name} SSLRuntime getCaFile - -# Return an SSL CA file - -Returns an SSL CA file by name using the runtime socket. -*/ -type GetCaFile struct { - Context *middleware.Context - Handler GetCaFileHandler -} - -func (o *GetCaFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCaFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_ca_file_parameters.go b/operations/s_s_l_runtime/get_ca_file_parameters.go deleted file mode 100644 index 10615eb1..00000000 --- a/operations/s_s_l_runtime/get_ca_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCaFileParams creates a new GetCaFileParams object -// -// There are no default values defined in the spec. -func NewGetCaFileParams() GetCaFileParams { - - return GetCaFileParams{} -} - -// GetCaFileParams contains all the bound params for the get ca file operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCaFile -type GetCaFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL CA file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCaFileParams() beforehand. -func (o *GetCaFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCaFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/get_ca_file_responses.go b/operations/s_s_l_runtime/get_ca_file_responses.go deleted file mode 100644 index 9a602137..00000000 --- a/operations/s_s_l_runtime/get_ca_file_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCaFileOKCode is the HTTP code returned for type GetCaFileOK -const GetCaFileOKCode int = 200 - -/* -GetCaFileOK Successful operation - -swagger:response getCaFileOK -*/ -type GetCaFileOK struct { - - /* - In: Body - */ - Payload *models.SslCaFile `json:"body,omitempty"` -} - -// NewGetCaFileOK creates GetCaFileOK with default headers values -func NewGetCaFileOK() *GetCaFileOK { - - return &GetCaFileOK{} -} - -// WithPayload adds the payload to the get ca file o k response -func (o *GetCaFileOK) WithPayload(payload *models.SslCaFile) *GetCaFileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca file o k response -func (o *GetCaFileOK) SetPayload(payload *models.SslCaFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetCaFileNotFoundCode is the HTTP code returned for type GetCaFileNotFound -const GetCaFileNotFoundCode int = 404 - -/* -GetCaFileNotFound The specified resource was not found - -swagger:response getCaFileNotFound -*/ -type GetCaFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCaFileNotFound creates GetCaFileNotFound with default headers values -func NewGetCaFileNotFound() *GetCaFileNotFound { - - return &GetCaFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get ca file not found response -func (o *GetCaFileNotFound) WithConfigurationVersion(configurationVersion string) *GetCaFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ca file not found response -func (o *GetCaFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ca file not found response -func (o *GetCaFileNotFound) WithPayload(payload *models.Error) *GetCaFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca file not found response -func (o *GetCaFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCaFileDefault General Error - -swagger:response getCaFileDefault -*/ -type GetCaFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCaFileDefault creates GetCaFileDefault with default headers values -func NewGetCaFileDefault(code int) *GetCaFileDefault { - if code <= 0 { - code = 500 - } - - return &GetCaFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get ca file default response -func (o *GetCaFileDefault) WithStatusCode(code int) *GetCaFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get ca file default response -func (o *GetCaFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get ca file default response -func (o *GetCaFileDefault) WithConfigurationVersion(configurationVersion string) *GetCaFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get ca file default response -func (o *GetCaFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get ca file default response -func (o *GetCaFileDefault) WithPayload(payload *models.Error) *GetCaFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get ca file default response -func (o *GetCaFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCaFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_ca_file_urlbuilder.go b/operations/s_s_l_runtime/get_ca_file_urlbuilder.go deleted file mode 100644 index 68ec3139..00000000 --- a/operations/s_s_l_runtime/get_ca_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetCaFileURL generates an URL for the get ca file operation -type GetCaFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCaFileURL) WithBasePath(bp string) *GetCaFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCaFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCaFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCaFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCaFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCaFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCaFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCaFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCaFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCaFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_cert.go b/operations/s_s_l_runtime/get_cert.go deleted file mode 100644 index 38d8f7b0..00000000 --- a/operations/s_s_l_runtime/get_cert.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCertHandlerFunc turns a function with the right signature into a get cert handler -type GetCertHandlerFunc func(GetCertParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCertHandlerFunc) Handle(params GetCertParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCertHandler interface for that can handle valid get cert params -type GetCertHandler interface { - Handle(GetCertParams, interface{}) middleware.Responder -} - -// NewGetCert creates a new http.Handler for the get cert operation -func NewGetCert(ctx *middleware.Context, handler GetCertHandler) *GetCert { - return &GetCert{Context: ctx, Handler: handler} -} - -/* - GetCert swagger:route GET /services/haproxy/runtime/ssl_certs/{name} SSLRuntime getCert - -# Return one structured certificate - -Returns one structured certificate using the runtime socket. -*/ -type GetCert struct { - Context *middleware.Context - Handler GetCertHandler -} - -func (o *GetCert) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCertParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_cert_parameters.go b/operations/s_s_l_runtime/get_cert_parameters.go deleted file mode 100644 index 7c80231f..00000000 --- a/operations/s_s_l_runtime/get_cert_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetCertParams creates a new GetCertParams object -// -// There are no default values defined in the spec. -func NewGetCertParams() GetCertParams { - - return GetCertParams{} -} - -// GetCertParams contains all the bound params for the get cert operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCert -type GetCertParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL certificate name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCertParams() beforehand. -func (o *GetCertParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCertParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/get_cert_responses.go b/operations/s_s_l_runtime/get_cert_responses.go deleted file mode 100644 index aa0864d5..00000000 --- a/operations/s_s_l_runtime/get_cert_responses.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCertOKCode is the HTTP code returned for type GetCertOK -const GetCertOKCode int = 200 - -/* -GetCertOK Successful operation - -swagger:response getCertOK -*/ -type GetCertOK struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewGetCertOK creates GetCertOK with default headers values -func NewGetCertOK() *GetCertOK { - - return &GetCertOK{} -} - -// WithPayload adds the payload to the get cert o k response -func (o *GetCertOK) WithPayload(payload *models.SslCertificate) *GetCertOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cert o k response -func (o *GetCertOK) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCertOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCertDefault General Error - -swagger:response getCertDefault -*/ -type GetCertDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCertDefault creates GetCertDefault with default headers values -func NewGetCertDefault(code int) *GetCertDefault { - if code <= 0 { - code = 500 - } - - return &GetCertDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get cert default response -func (o *GetCertDefault) WithStatusCode(code int) *GetCertDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get cert default response -func (o *GetCertDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get cert default response -func (o *GetCertDefault) WithConfigurationVersion(configurationVersion string) *GetCertDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get cert default response -func (o *GetCertDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get cert default response -func (o *GetCertDefault) WithPayload(payload *models.Error) *GetCertDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get cert default response -func (o *GetCertDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCertDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_cert_urlbuilder.go b/operations/s_s_l_runtime/get_cert_urlbuilder.go deleted file mode 100644 index 78e9789e..00000000 --- a/operations/s_s_l_runtime/get_cert_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetCertURL generates an URL for the get cert operation -type GetCertURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCertURL) WithBasePath(bp string) *GetCertURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCertURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCertURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_certs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCertURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCertURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCertURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCertURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCertURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCertURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCertURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/get_crl.go b/operations/s_s_l_runtime/get_crl.go deleted file mode 100644 index 7d130a6d..00000000 --- a/operations/s_s_l_runtime/get_crl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetCrlHandlerFunc turns a function with the right signature into a get crl handler -type GetCrlHandlerFunc func(GetCrlParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetCrlHandlerFunc) Handle(params GetCrlParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetCrlHandler interface for that can handle valid get crl params -type GetCrlHandler interface { - Handle(GetCrlParams, interface{}) middleware.Responder -} - -// NewGetCrl creates a new http.Handler for the get crl operation -func NewGetCrl(ctx *middleware.Context, handler GetCrlHandler) *GetCrl { - return &GetCrl{Context: ctx, Handler: handler} -} - -/* - GetCrl swagger:route GET /services/haproxy/runtime/ssl_crl_files/{name} SSLRuntime getCrl - -# Get the contents of a CRL file - -Returns one or all entries in a CRL file using the runtime socket. -*/ -type GetCrl struct { - Context *middleware.Context - Handler GetCrlHandler -} - -func (o *GetCrl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetCrlParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/get_crl_parameters.go b/operations/s_s_l_runtime/get_crl_parameters.go deleted file mode 100644 index 9bd39538..00000000 --- a/operations/s_s_l_runtime/get_crl_parameters.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewGetCrlParams creates a new GetCrlParams object -// -// There are no default values defined in the spec. -func NewGetCrlParams() GetCrlParams { - - return GetCrlParams{} -} - -// GetCrlParams contains all the bound params for the get crl operation -// typically these are obtained from a http.Request -// -// swagger:parameters getCrl -type GetCrlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Entry index to return. Starts at 1. If not provided, all entries are returned. - Minimum: 1 - In: query - */ - Index *int64 - /*CRL file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetCrlParams() beforehand. -func (o *GetCrlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qIndex, qhkIndex, _ := qs.GetOK("index") - if err := o.bindIndex(qIndex, qhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from query. -func (o *GetCrlParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "query", "int64", raw) - } - o.Index = &value - - if err := o.validateIndex(formats); err != nil { - return err - } - - return nil -} - -// validateIndex carries on validations for parameter Index -func (o *GetCrlParams) validateIndex(formats strfmt.Registry) error { - - if err := validate.MinimumInt("index", "query", *o.Index, 1, false); err != nil { - return err - } - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetCrlParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/get_crl_responses.go b/operations/s_s_l_runtime/get_crl_responses.go deleted file mode 100644 index 3cb69a76..00000000 --- a/operations/s_s_l_runtime/get_crl_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetCrlOKCode is the HTTP code returned for type GetCrlOK -const GetCrlOKCode int = 200 - -/* -GetCrlOK Successful operation - -swagger:response getCrlOK -*/ -type GetCrlOK struct { - - /* - In: Body - */ - Payload models.SslCrlEntries `json:"body,omitempty"` -} - -// NewGetCrlOK creates GetCrlOK with default headers values -func NewGetCrlOK() *GetCrlOK { - - return &GetCrlOK{} -} - -// WithPayload adds the payload to the get crl o k response -func (o *GetCrlOK) WithPayload(payload models.SslCrlEntries) *GetCrlOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crl o k response -func (o *GetCrlOK) SetPayload(payload models.SslCrlEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrlOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrlEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetCrlNotFoundCode is the HTTP code returned for type GetCrlNotFound -const GetCrlNotFoundCode int = 404 - -/* -GetCrlNotFound The specified resource was not found - -swagger:response getCrlNotFound -*/ -type GetCrlNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrlNotFound creates GetCrlNotFound with default headers values -func NewGetCrlNotFound() *GetCrlNotFound { - - return &GetCrlNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get crl not found response -func (o *GetCrlNotFound) WithConfigurationVersion(configurationVersion string) *GetCrlNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crl not found response -func (o *GetCrlNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crl not found response -func (o *GetCrlNotFound) WithPayload(payload *models.Error) *GetCrlNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crl not found response -func (o *GetCrlNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrlNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetCrlDefault General Error - -swagger:response getCrlDefault -*/ -type GetCrlDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetCrlDefault creates GetCrlDefault with default headers values -func NewGetCrlDefault(code int) *GetCrlDefault { - if code <= 0 { - code = 500 - } - - return &GetCrlDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get crl default response -func (o *GetCrlDefault) WithStatusCode(code int) *GetCrlDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get crl default response -func (o *GetCrlDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get crl default response -func (o *GetCrlDefault) WithConfigurationVersion(configurationVersion string) *GetCrlDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get crl default response -func (o *GetCrlDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get crl default response -func (o *GetCrlDefault) WithPayload(payload *models.Error) *GetCrlDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get crl default response -func (o *GetCrlDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetCrlDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/get_crl_urlbuilder.go b/operations/s_s_l_runtime/get_crl_urlbuilder.go deleted file mode 100644 index 2a62d65a..00000000 --- a/operations/s_s_l_runtime/get_crl_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetCrlURL generates an URL for the get crl operation -type GetCrlURL struct { - Name string - - Index *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrlURL) WithBasePath(bp string) *GetCrlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetCrlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetCrlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crl_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetCrlURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var indexQ string - if o.Index != nil { - indexQ = swag.FormatInt64(*o.Index) - } - if indexQ != "" { - qs.Set("index", indexQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetCrlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetCrlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetCrlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetCrlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetCrlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetCrlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/replace_cert.go b/operations/s_s_l_runtime/replace_cert.go deleted file mode 100644 index f9521261..00000000 --- a/operations/s_s_l_runtime/replace_cert.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceCertHandlerFunc turns a function with the right signature into a replace cert handler -type ReplaceCertHandlerFunc func(ReplaceCertParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceCertHandlerFunc) Handle(params ReplaceCertParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceCertHandler interface for that can handle valid replace cert params -type ReplaceCertHandler interface { - Handle(ReplaceCertParams, interface{}) middleware.Responder -} - -// NewReplaceCert creates a new http.Handler for the replace cert operation -func NewReplaceCert(ctx *middleware.Context, handler ReplaceCertHandler) *ReplaceCert { - return &ReplaceCert{Context: ctx, Handler: handler} -} - -/* - ReplaceCert swagger:route PUT /services/haproxy/runtime/ssl_certs/{name} SSLRuntime replaceCert - -# Replace the contents of a certificate - -Sets a certificate payload using the runtime socket. -*/ -type ReplaceCert struct { - Context *middleware.Context - Handler ReplaceCertHandler -} - -func (o *ReplaceCert) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceCertParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/replace_cert_parameters.go b/operations/s_s_l_runtime/replace_cert_parameters.go deleted file mode 100644 index 05478796..00000000 --- a/operations/s_s_l_runtime/replace_cert_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// ReplaceCertMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var ReplaceCertMaxParseMemory int64 = 32 << 20 - -// NewReplaceCertParams creates a new ReplaceCertParams object -// -// There are no default values defined in the spec. -func NewReplaceCertParams() ReplaceCertParams { - - return ReplaceCertParams{} -} - -// ReplaceCertParams contains all the bound params for the replace cert operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceCert -type ReplaceCertParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: formData - */ - FileUpload io.ReadCloser - /*SSL certificate name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceCertParams() beforehand. -func (o *ReplaceCertParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(ReplaceCertMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *ReplaceCertParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceCertParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/replace_cert_responses.go b/operations/s_s_l_runtime/replace_cert_responses.go deleted file mode 100644 index 32e3ecac..00000000 --- a/operations/s_s_l_runtime/replace_cert_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceCertOKCode is the HTTP code returned for type ReplaceCertOK -const ReplaceCertOKCode int = 200 - -/* -ReplaceCertOK File updated - -swagger:response replaceCertOK -*/ -type ReplaceCertOK struct { -} - -// NewReplaceCertOK creates ReplaceCertOK with default headers values -func NewReplaceCertOK() *ReplaceCertOK { - - return &ReplaceCertOK{} -} - -// WriteResponse to the client -func (o *ReplaceCertOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -// ReplaceCertBadRequestCode is the HTTP code returned for type ReplaceCertBadRequest -const ReplaceCertBadRequestCode int = 400 - -/* -ReplaceCertBadRequest Bad request - -swagger:response replaceCertBadRequest -*/ -type ReplaceCertBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCertBadRequest creates ReplaceCertBadRequest with default headers values -func NewReplaceCertBadRequest() *ReplaceCertBadRequest { - - return &ReplaceCertBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace cert bad request response -func (o *ReplaceCertBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceCertBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace cert bad request response -func (o *ReplaceCertBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace cert bad request response -func (o *ReplaceCertBadRequest) WithPayload(payload *models.Error) *ReplaceCertBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cert bad request response -func (o *ReplaceCertBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCertBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceCertDefault General Error - -swagger:response replaceCertDefault -*/ -type ReplaceCertDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCertDefault creates ReplaceCertDefault with default headers values -func NewReplaceCertDefault(code int) *ReplaceCertDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceCertDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace cert default response -func (o *ReplaceCertDefault) WithStatusCode(code int) *ReplaceCertDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace cert default response -func (o *ReplaceCertDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace cert default response -func (o *ReplaceCertDefault) WithConfigurationVersion(configurationVersion string) *ReplaceCertDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace cert default response -func (o *ReplaceCertDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace cert default response -func (o *ReplaceCertDefault) WithPayload(payload *models.Error) *ReplaceCertDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace cert default response -func (o *ReplaceCertDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCertDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/replace_cert_urlbuilder.go b/operations/s_s_l_runtime/replace_cert_urlbuilder.go deleted file mode 100644 index 001c9da8..00000000 --- a/operations/s_s_l_runtime/replace_cert_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ReplaceCertURL generates an URL for the replace cert operation -type ReplaceCertURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCertURL) WithBasePath(bp string) *ReplaceCertURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCertURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceCertURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_certs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceCertURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceCertURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceCertURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceCertURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceCertURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceCertURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceCertURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/replace_crl.go b/operations/s_s_l_runtime/replace_crl.go deleted file mode 100644 index f849983d..00000000 --- a/operations/s_s_l_runtime/replace_crl.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceCrlHandlerFunc turns a function with the right signature into a replace crl handler -type ReplaceCrlHandlerFunc func(ReplaceCrlParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceCrlHandlerFunc) Handle(params ReplaceCrlParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceCrlHandler interface for that can handle valid replace crl params -type ReplaceCrlHandler interface { - Handle(ReplaceCrlParams, interface{}) middleware.Responder -} - -// NewReplaceCrl creates a new http.Handler for the replace crl operation -func NewReplaceCrl(ctx *middleware.Context, handler ReplaceCrlHandler) *ReplaceCrl { - return &ReplaceCrl{Context: ctx, Handler: handler} -} - -/* - ReplaceCrl swagger:route PUT /services/haproxy/runtime/ssl_crl_files/{name} SSLRuntime replaceCrl - -# Replace the contents of a CRL file - -Replaces the contents of a CRL file using the runtime socket. -*/ -type ReplaceCrl struct { - Context *middleware.Context - Handler ReplaceCrlHandler -} - -func (o *ReplaceCrl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceCrlParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/replace_crl_parameters.go b/operations/s_s_l_runtime/replace_crl_parameters.go deleted file mode 100644 index 8a31f685..00000000 --- a/operations/s_s_l_runtime/replace_crl_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// ReplaceCrlMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var ReplaceCrlMaxParseMemory int64 = 32 << 20 - -// NewReplaceCrlParams creates a new ReplaceCrlParams object -// -// There are no default values defined in the spec. -func NewReplaceCrlParams() ReplaceCrlParams { - - return ReplaceCrlParams{} -} - -// ReplaceCrlParams contains all the bound params for the replace crl operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceCrl -type ReplaceCrlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*CRL file contents - Required: true - In: formData - */ - FileUpload io.ReadCloser - /*CRL file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceCrlParams() beforehand. -func (o *ReplaceCrlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(ReplaceCrlMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *ReplaceCrlParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceCrlParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/replace_crl_responses.go b/operations/s_s_l_runtime/replace_crl_responses.go deleted file mode 100644 index 1741ec34..00000000 --- a/operations/s_s_l_runtime/replace_crl_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceCrlOKCode is the HTTP code returned for type ReplaceCrlOK -const ReplaceCrlOKCode int = 200 - -/* -ReplaceCrlOK File modified - -swagger:response replaceCrlOK -*/ -type ReplaceCrlOK struct { -} - -// NewReplaceCrlOK creates ReplaceCrlOK with default headers values -func NewReplaceCrlOK() *ReplaceCrlOK { - - return &ReplaceCrlOK{} -} - -// WriteResponse to the client -func (o *ReplaceCrlOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -// ReplaceCrlBadRequestCode is the HTTP code returned for type ReplaceCrlBadRequest -const ReplaceCrlBadRequestCode int = 400 - -/* -ReplaceCrlBadRequest Bad request - -swagger:response replaceCrlBadRequest -*/ -type ReplaceCrlBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCrlBadRequest creates ReplaceCrlBadRequest with default headers values -func NewReplaceCrlBadRequest() *ReplaceCrlBadRequest { - - return &ReplaceCrlBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace crl bad request response -func (o *ReplaceCrlBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceCrlBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace crl bad request response -func (o *ReplaceCrlBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace crl bad request response -func (o *ReplaceCrlBadRequest) WithPayload(payload *models.Error) *ReplaceCrlBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crl bad request response -func (o *ReplaceCrlBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrlBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceCrlDefault General Error - -swagger:response replaceCrlDefault -*/ -type ReplaceCrlDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceCrlDefault creates ReplaceCrlDefault with default headers values -func NewReplaceCrlDefault(code int) *ReplaceCrlDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceCrlDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace crl default response -func (o *ReplaceCrlDefault) WithStatusCode(code int) *ReplaceCrlDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace crl default response -func (o *ReplaceCrlDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace crl default response -func (o *ReplaceCrlDefault) WithConfigurationVersion(configurationVersion string) *ReplaceCrlDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace crl default response -func (o *ReplaceCrlDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace crl default response -func (o *ReplaceCrlDefault) WithPayload(payload *models.Error) *ReplaceCrlDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace crl default response -func (o *ReplaceCrlDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceCrlDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/replace_crl_urlbuilder.go b/operations/s_s_l_runtime/replace_crl_urlbuilder.go deleted file mode 100644 index 2ab67563..00000000 --- a/operations/s_s_l_runtime/replace_crl_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ReplaceCrlURL generates an URL for the replace crl operation -type ReplaceCrlURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCrlURL) WithBasePath(bp string) *ReplaceCrlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceCrlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceCrlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_crl_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceCrlURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceCrlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceCrlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceCrlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceCrlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceCrlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceCrlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/s_s_l_runtime/set_ca_file.go b/operations/s_s_l_runtime/set_ca_file.go deleted file mode 100644 index 26cbd904..00000000 --- a/operations/s_s_l_runtime/set_ca_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// SetCaFileHandlerFunc turns a function with the right signature into a set ca file handler -type SetCaFileHandlerFunc func(SetCaFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetCaFileHandlerFunc) Handle(params SetCaFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// SetCaFileHandler interface for that can handle valid set ca file params -type SetCaFileHandler interface { - Handle(SetCaFileParams, interface{}) middleware.Responder -} - -// NewSetCaFile creates a new http.Handler for the set ca file operation -func NewSetCaFile(ctx *middleware.Context, handler SetCaFileHandler) *SetCaFile { - return &SetCaFile{Context: ctx, Handler: handler} -} - -/* - SetCaFile swagger:route PUT /services/haproxy/runtime/ssl_ca_files/{name} SSLRuntime setCaFile - -# Update the contents of a CA file - -Replace the contents of a CA file using the runtime socket. -*/ -type SetCaFile struct { - Context *middleware.Context - Handler SetCaFileHandler -} - -func (o *SetCaFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetCaFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/s_s_l_runtime/set_ca_file_parameters.go b/operations/s_s_l_runtime/set_ca_file_parameters.go deleted file mode 100644 index 947cec04..00000000 --- a/operations/s_s_l_runtime/set_ca_file_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// SetCaFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var SetCaFileMaxParseMemory int64 = 32 << 20 - -// NewSetCaFileParams creates a new SetCaFileParams object -// -// There are no default values defined in the spec. -func NewSetCaFileParams() SetCaFileParams { - - return SetCaFileParams{} -} - -// SetCaFileParams contains all the bound params for the set ca file operation -// typically these are obtained from a http.Request -// -// swagger:parameters setCaFile -type SetCaFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: formData - */ - FileUpload io.ReadCloser - /*SSL CA file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSetCaFileParams() beforehand. -func (o *SetCaFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(SetCaFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *SetCaFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *SetCaFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/s_s_l_runtime/set_ca_file_responses.go b/operations/s_s_l_runtime/set_ca_file_responses.go deleted file mode 100644 index 9f451375..00000000 --- a/operations/s_s_l_runtime/set_ca_file_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// SetCaFileOKCode is the HTTP code returned for type SetCaFileOK -const SetCaFileOKCode int = 200 - -/* -SetCaFileOK SSL CA payload added - -swagger:response setCaFileOK -*/ -type SetCaFileOK struct { -} - -// NewSetCaFileOK creates SetCaFileOK with default headers values -func NewSetCaFileOK() *SetCaFileOK { - - return &SetCaFileOK{} -} - -// WriteResponse to the client -func (o *SetCaFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -// SetCaFileBadRequestCode is the HTTP code returned for type SetCaFileBadRequest -const SetCaFileBadRequestCode int = 400 - -/* -SetCaFileBadRequest Bad request - -swagger:response setCaFileBadRequest -*/ -type SetCaFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetCaFileBadRequest creates SetCaFileBadRequest with default headers values -func NewSetCaFileBadRequest() *SetCaFileBadRequest { - - return &SetCaFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the set ca file bad request response -func (o *SetCaFileBadRequest) WithConfigurationVersion(configurationVersion string) *SetCaFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the set ca file bad request response -func (o *SetCaFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the set ca file bad request response -func (o *SetCaFileBadRequest) WithPayload(payload *models.Error) *SetCaFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set ca file bad request response -func (o *SetCaFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetCaFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -SetCaFileDefault General Error - -swagger:response setCaFileDefault -*/ -type SetCaFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetCaFileDefault creates SetCaFileDefault with default headers values -func NewSetCaFileDefault(code int) *SetCaFileDefault { - if code <= 0 { - code = 500 - } - - return &SetCaFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set ca file default response -func (o *SetCaFileDefault) WithStatusCode(code int) *SetCaFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set ca file default response -func (o *SetCaFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the set ca file default response -func (o *SetCaFileDefault) WithConfigurationVersion(configurationVersion string) *SetCaFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the set ca file default response -func (o *SetCaFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the set ca file default response -func (o *SetCaFileDefault) WithPayload(payload *models.Error) *SetCaFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set ca file default response -func (o *SetCaFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetCaFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/s_s_l_runtime/set_ca_file_urlbuilder.go b/operations/s_s_l_runtime/set_ca_file_urlbuilder.go deleted file mode 100644 index b2177ff1..00000000 --- a/operations/s_s_l_runtime/set_ca_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package s_s_l_runtime - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SetCaFileURL generates an URL for the set ca file operation -type SetCaFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetCaFileURL) WithBasePath(bp string) *SetCaFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetCaFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetCaFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/ssl_ca_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on SetCaFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetCaFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SetCaFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetCaFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetCaFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetCaFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SetCaFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/add_runtime_server.go b/operations/server/add_runtime_server.go deleted file mode 100644 index f6028ff6..00000000 --- a/operations/server/add_runtime_server.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// AddRuntimeServerHandlerFunc turns a function with the right signature into a add runtime server handler -type AddRuntimeServerHandlerFunc func(AddRuntimeServerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddRuntimeServerHandlerFunc) Handle(params AddRuntimeServerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// AddRuntimeServerHandler interface for that can handle valid add runtime server params -type AddRuntimeServerHandler interface { - Handle(AddRuntimeServerParams, interface{}) middleware.Responder -} - -// NewAddRuntimeServer creates a new http.Handler for the add runtime server operation -func NewAddRuntimeServer(ctx *middleware.Context, handler AddRuntimeServerHandler) *AddRuntimeServer { - return &AddRuntimeServer{Context: ctx, Handler: handler} -} - -/* - AddRuntimeServer swagger:route POST /services/haproxy/runtime/backends/{parent_name}/servers Server addRuntimeServer - -# Adds a new server to a backend - -Adds a new server to the specified backend -*/ -type AddRuntimeServer struct { - Context *middleware.Context - Handler AddRuntimeServerHandler -} - -func (o *AddRuntimeServer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddRuntimeServerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/add_runtime_server_parameters.go b/operations/server/add_runtime_server_parameters.go deleted file mode 100644 index 279d8777..00000000 --- a/operations/server/add_runtime_server_parameters.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewAddRuntimeServerParams creates a new AddRuntimeServerParams object -// -// There are no default values defined in the spec. -func NewAddRuntimeServerParams() AddRuntimeServerParams { - - return AddRuntimeServerParams{} -} - -// AddRuntimeServerParams contains all the bound params for the add runtime server operation -// typically these are obtained from a http.Request -// -// swagger:parameters addRuntimeServer -type AddRuntimeServerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.RuntimeAddServer - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewAddRuntimeServerParams() beforehand. -func (o *AddRuntimeServerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.RuntimeAddServer - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *AddRuntimeServerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/server/add_runtime_server_responses.go b/operations/server/add_runtime_server_responses.go deleted file mode 100644 index 989b10f3..00000000 --- a/operations/server/add_runtime_server_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// AddRuntimeServerCreatedCode is the HTTP code returned for type AddRuntimeServerCreated -const AddRuntimeServerCreatedCode int = 201 - -/* -AddRuntimeServerCreated Server added - -swagger:response addRuntimeServerCreated -*/ -type AddRuntimeServerCreated struct { - - /* - In: Body - */ - Payload *models.RuntimeAddServer `json:"body,omitempty"` -} - -// NewAddRuntimeServerCreated creates AddRuntimeServerCreated with default headers values -func NewAddRuntimeServerCreated() *AddRuntimeServerCreated { - - return &AddRuntimeServerCreated{} -} - -// WithPayload adds the payload to the add runtime server created response -func (o *AddRuntimeServerCreated) WithPayload(payload *models.RuntimeAddServer) *AddRuntimeServerCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add runtime server created response -func (o *AddRuntimeServerCreated) SetPayload(payload *models.RuntimeAddServer) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRuntimeServerCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddRuntimeServerBadRequestCode is the HTTP code returned for type AddRuntimeServerBadRequest -const AddRuntimeServerBadRequestCode int = 400 - -/* -AddRuntimeServerBadRequest Bad request - -swagger:response addRuntimeServerBadRequest -*/ -type AddRuntimeServerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddRuntimeServerBadRequest creates AddRuntimeServerBadRequest with default headers values -func NewAddRuntimeServerBadRequest() *AddRuntimeServerBadRequest { - - return &AddRuntimeServerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the add runtime server bad request response -func (o *AddRuntimeServerBadRequest) WithConfigurationVersion(configurationVersion string) *AddRuntimeServerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add runtime server bad request response -func (o *AddRuntimeServerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add runtime server bad request response -func (o *AddRuntimeServerBadRequest) WithPayload(payload *models.Error) *AddRuntimeServerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add runtime server bad request response -func (o *AddRuntimeServerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRuntimeServerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddRuntimeServerNotFoundCode is the HTTP code returned for type AddRuntimeServerNotFound -const AddRuntimeServerNotFoundCode int = 404 - -/* -AddRuntimeServerNotFound The specified resource was not found - -swagger:response addRuntimeServerNotFound -*/ -type AddRuntimeServerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddRuntimeServerNotFound creates AddRuntimeServerNotFound with default headers values -func NewAddRuntimeServerNotFound() *AddRuntimeServerNotFound { - - return &AddRuntimeServerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the add runtime server not found response -func (o *AddRuntimeServerNotFound) WithConfigurationVersion(configurationVersion string) *AddRuntimeServerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add runtime server not found response -func (o *AddRuntimeServerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add runtime server not found response -func (o *AddRuntimeServerNotFound) WithPayload(payload *models.Error) *AddRuntimeServerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add runtime server not found response -func (o *AddRuntimeServerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRuntimeServerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// AddRuntimeServerConflictCode is the HTTP code returned for type AddRuntimeServerConflict -const AddRuntimeServerConflictCode int = 409 - -/* -AddRuntimeServerConflict The specified resource already exists - -swagger:response addRuntimeServerConflict -*/ -type AddRuntimeServerConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddRuntimeServerConflict creates AddRuntimeServerConflict with default headers values -func NewAddRuntimeServerConflict() *AddRuntimeServerConflict { - - return &AddRuntimeServerConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the add runtime server conflict response -func (o *AddRuntimeServerConflict) WithConfigurationVersion(configurationVersion string) *AddRuntimeServerConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add runtime server conflict response -func (o *AddRuntimeServerConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add runtime server conflict response -func (o *AddRuntimeServerConflict) WithPayload(payload *models.Error) *AddRuntimeServerConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add runtime server conflict response -func (o *AddRuntimeServerConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRuntimeServerConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddRuntimeServerDefault General Error - -swagger:response addRuntimeServerDefault -*/ -type AddRuntimeServerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewAddRuntimeServerDefault creates AddRuntimeServerDefault with default headers values -func NewAddRuntimeServerDefault(code int) *AddRuntimeServerDefault { - if code <= 0 { - code = 500 - } - - return &AddRuntimeServerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add runtime server default response -func (o *AddRuntimeServerDefault) WithStatusCode(code int) *AddRuntimeServerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add runtime server default response -func (o *AddRuntimeServerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the add runtime server default response -func (o *AddRuntimeServerDefault) WithConfigurationVersion(configurationVersion string) *AddRuntimeServerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the add runtime server default response -func (o *AddRuntimeServerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the add runtime server default response -func (o *AddRuntimeServerDefault) WithPayload(payload *models.Error) *AddRuntimeServerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add runtime server default response -func (o *AddRuntimeServerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRuntimeServerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/add_runtime_server_urlbuilder.go b/operations/server/add_runtime_server_urlbuilder.go deleted file mode 100644 index 1f69e2f1..00000000 --- a/operations/server/add_runtime_server_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// AddRuntimeServerURL generates an URL for the add runtime server operation -type AddRuntimeServerURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddRuntimeServerURL) WithBasePath(bp string) *AddRuntimeServerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *AddRuntimeServerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddRuntimeServerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/backends/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on AddRuntimeServerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *AddRuntimeServerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *AddRuntimeServerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddRuntimeServerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddRuntimeServerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddRuntimeServerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *AddRuntimeServerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/create_server_backend.go b/operations/server/create_server_backend.go deleted file mode 100644 index 62fa1764..00000000 --- a/operations/server/create_server_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateServerBackendHandlerFunc turns a function with the right signature into a create server backend handler -type CreateServerBackendHandlerFunc func(CreateServerBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServerBackendHandlerFunc) Handle(params CreateServerBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateServerBackendHandler interface for that can handle valid create server backend params -type CreateServerBackendHandler interface { - Handle(CreateServerBackendParams, interface{}) middleware.Responder -} - -// NewCreateServerBackend creates a new http.Handler for the create server backend operation -func NewCreateServerBackend(ctx *middleware.Context, handler CreateServerBackendHandler) *CreateServerBackend { - return &CreateServerBackend{Context: ctx, Handler: handler} -} - -/* - CreateServerBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/servers Server createServerBackend - -# Add a new server - -Adds a new server in the specified backend in the configuration file. -*/ -type CreateServerBackend struct { - Context *middleware.Context - Handler CreateServerBackendHandler -} - -func (o *CreateServerBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServerBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/create_server_backend_parameters.go b/operations/server/create_server_backend_parameters.go deleted file mode 100644 index b09ed44a..00000000 --- a/operations/server/create_server_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateServerBackendParams creates a new CreateServerBackendParams object -// with the default values initialized. -func NewCreateServerBackendParams() CreateServerBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateServerBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateServerBackendParams contains all the bound params for the create server backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createServerBackend -type CreateServerBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateServerBackendParams() beforehand. -func (o *CreateServerBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateServerBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateServerBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateServerBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateServerBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateServerBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/create_server_backend_responses.go b/operations/server/create_server_backend_responses.go deleted file mode 100644 index ddf7d83b..00000000 --- a/operations/server/create_server_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateServerBackendCreatedCode is the HTTP code returned for type CreateServerBackendCreated -const CreateServerBackendCreatedCode int = 201 - -/* -CreateServerBackendCreated Server created - -swagger:response createServerBackendCreated -*/ -type CreateServerBackendCreated struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerBackendCreated creates CreateServerBackendCreated with default headers values -func NewCreateServerBackendCreated() *CreateServerBackendCreated { - - return &CreateServerBackendCreated{} -} - -// WithPayload adds the payload to the create server backend created response -func (o *CreateServerBackendCreated) WithPayload(payload *models.Server) *CreateServerBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server backend created response -func (o *CreateServerBackendCreated) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerBackendAcceptedCode is the HTTP code returned for type CreateServerBackendAccepted -const CreateServerBackendAcceptedCode int = 202 - -/* -CreateServerBackendAccepted Configuration change accepted and reload requested - -swagger:response createServerBackendAccepted -*/ -type CreateServerBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerBackendAccepted creates CreateServerBackendAccepted with default headers values -func NewCreateServerBackendAccepted() *CreateServerBackendAccepted { - - return &CreateServerBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create server backend accepted response -func (o *CreateServerBackendAccepted) WithReloadID(reloadID string) *CreateServerBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create server backend accepted response -func (o *CreateServerBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create server backend accepted response -func (o *CreateServerBackendAccepted) WithPayload(payload *models.Server) *CreateServerBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server backend accepted response -func (o *CreateServerBackendAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerBackendBadRequestCode is the HTTP code returned for type CreateServerBackendBadRequest -const CreateServerBackendBadRequestCode int = 400 - -/* -CreateServerBackendBadRequest Bad request - -swagger:response createServerBackendBadRequest -*/ -type CreateServerBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerBackendBadRequest creates CreateServerBackendBadRequest with default headers values -func NewCreateServerBackendBadRequest() *CreateServerBackendBadRequest { - - return &CreateServerBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server backend bad request response -func (o *CreateServerBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateServerBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server backend bad request response -func (o *CreateServerBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server backend bad request response -func (o *CreateServerBackendBadRequest) WithPayload(payload *models.Error) *CreateServerBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server backend bad request response -func (o *CreateServerBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerBackendConflictCode is the HTTP code returned for type CreateServerBackendConflict -const CreateServerBackendConflictCode int = 409 - -/* -CreateServerBackendConflict The specified resource already exists - -swagger:response createServerBackendConflict -*/ -type CreateServerBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerBackendConflict creates CreateServerBackendConflict with default headers values -func NewCreateServerBackendConflict() *CreateServerBackendConflict { - - return &CreateServerBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server backend conflict response -func (o *CreateServerBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateServerBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server backend conflict response -func (o *CreateServerBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server backend conflict response -func (o *CreateServerBackendConflict) WithPayload(payload *models.Error) *CreateServerBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server backend conflict response -func (o *CreateServerBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServerBackendDefault General Error - -swagger:response createServerBackendDefault -*/ -type CreateServerBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerBackendDefault creates CreateServerBackendDefault with default headers values -func NewCreateServerBackendDefault(code int) *CreateServerBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateServerBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create server backend default response -func (o *CreateServerBackendDefault) WithStatusCode(code int) *CreateServerBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create server backend default response -func (o *CreateServerBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create server backend default response -func (o *CreateServerBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateServerBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server backend default response -func (o *CreateServerBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server backend default response -func (o *CreateServerBackendDefault) WithPayload(payload *models.Error) *CreateServerBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server backend default response -func (o *CreateServerBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/create_server_backend_urlbuilder.go b/operations/server/create_server_backend_urlbuilder.go deleted file mode 100644 index 2f434fe7..00000000 --- a/operations/server/create_server_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateServerBackendURL generates an URL for the create server backend operation -type CreateServerBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerBackendURL) WithBasePath(bp string) *CreateServerBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServerBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateServerBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateServerBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateServerBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServerBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServerBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServerBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateServerBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/create_server_peer.go b/operations/server/create_server_peer.go deleted file mode 100644 index 40d8ae9d..00000000 --- a/operations/server/create_server_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateServerPeerHandlerFunc turns a function with the right signature into a create server peer handler -type CreateServerPeerHandlerFunc func(CreateServerPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServerPeerHandlerFunc) Handle(params CreateServerPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateServerPeerHandler interface for that can handle valid create server peer params -type CreateServerPeerHandler interface { - Handle(CreateServerPeerParams, interface{}) middleware.Responder -} - -// NewCreateServerPeer creates a new http.Handler for the create server peer operation -func NewCreateServerPeer(ctx *middleware.Context, handler CreateServerPeerHandler) *CreateServerPeer { - return &CreateServerPeer{Context: ctx, Handler: handler} -} - -/* - CreateServerPeer swagger:route POST /services/haproxy/configuration/peers/{parent_name}/servers Server createServerPeer - -# Add a new server - -Adds a new server in the specified backend in the configuration file. -*/ -type CreateServerPeer struct { - Context *middleware.Context - Handler CreateServerPeerHandler -} - -func (o *CreateServerPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServerPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/create_server_peer_parameters.go b/operations/server/create_server_peer_parameters.go deleted file mode 100644 index 2b37d5da..00000000 --- a/operations/server/create_server_peer_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateServerPeerParams creates a new CreateServerPeerParams object -// with the default values initialized. -func NewCreateServerPeerParams() CreateServerPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateServerPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateServerPeerParams contains all the bound params for the create server peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters createServerPeer -type CreateServerPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateServerPeerParams() beforehand. -func (o *CreateServerPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateServerPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateServerPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateServerPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateServerPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateServerPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/create_server_peer_responses.go b/operations/server/create_server_peer_responses.go deleted file mode 100644 index 6cbefe7e..00000000 --- a/operations/server/create_server_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateServerPeerCreatedCode is the HTTP code returned for type CreateServerPeerCreated -const CreateServerPeerCreatedCode int = 201 - -/* -CreateServerPeerCreated Server created - -swagger:response createServerPeerCreated -*/ -type CreateServerPeerCreated struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerPeerCreated creates CreateServerPeerCreated with default headers values -func NewCreateServerPeerCreated() *CreateServerPeerCreated { - - return &CreateServerPeerCreated{} -} - -// WithPayload adds the payload to the create server peer created response -func (o *CreateServerPeerCreated) WithPayload(payload *models.Server) *CreateServerPeerCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server peer created response -func (o *CreateServerPeerCreated) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerPeerCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerPeerAcceptedCode is the HTTP code returned for type CreateServerPeerAccepted -const CreateServerPeerAcceptedCode int = 202 - -/* -CreateServerPeerAccepted Configuration change accepted and reload requested - -swagger:response createServerPeerAccepted -*/ -type CreateServerPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerPeerAccepted creates CreateServerPeerAccepted with default headers values -func NewCreateServerPeerAccepted() *CreateServerPeerAccepted { - - return &CreateServerPeerAccepted{} -} - -// WithReloadID adds the reloadId to the create server peer accepted response -func (o *CreateServerPeerAccepted) WithReloadID(reloadID string) *CreateServerPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create server peer accepted response -func (o *CreateServerPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create server peer accepted response -func (o *CreateServerPeerAccepted) WithPayload(payload *models.Server) *CreateServerPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server peer accepted response -func (o *CreateServerPeerAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerPeerBadRequestCode is the HTTP code returned for type CreateServerPeerBadRequest -const CreateServerPeerBadRequestCode int = 400 - -/* -CreateServerPeerBadRequest Bad request - -swagger:response createServerPeerBadRequest -*/ -type CreateServerPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerPeerBadRequest creates CreateServerPeerBadRequest with default headers values -func NewCreateServerPeerBadRequest() *CreateServerPeerBadRequest { - - return &CreateServerPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server peer bad request response -func (o *CreateServerPeerBadRequest) WithConfigurationVersion(configurationVersion string) *CreateServerPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server peer bad request response -func (o *CreateServerPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server peer bad request response -func (o *CreateServerPeerBadRequest) WithPayload(payload *models.Error) *CreateServerPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server peer bad request response -func (o *CreateServerPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerPeerConflictCode is the HTTP code returned for type CreateServerPeerConflict -const CreateServerPeerConflictCode int = 409 - -/* -CreateServerPeerConflict The specified resource already exists - -swagger:response createServerPeerConflict -*/ -type CreateServerPeerConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerPeerConflict creates CreateServerPeerConflict with default headers values -func NewCreateServerPeerConflict() *CreateServerPeerConflict { - - return &CreateServerPeerConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server peer conflict response -func (o *CreateServerPeerConflict) WithConfigurationVersion(configurationVersion string) *CreateServerPeerConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server peer conflict response -func (o *CreateServerPeerConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server peer conflict response -func (o *CreateServerPeerConflict) WithPayload(payload *models.Error) *CreateServerPeerConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server peer conflict response -func (o *CreateServerPeerConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerPeerConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServerPeerDefault General Error - -swagger:response createServerPeerDefault -*/ -type CreateServerPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerPeerDefault creates CreateServerPeerDefault with default headers values -func NewCreateServerPeerDefault(code int) *CreateServerPeerDefault { - if code <= 0 { - code = 500 - } - - return &CreateServerPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create server peer default response -func (o *CreateServerPeerDefault) WithStatusCode(code int) *CreateServerPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create server peer default response -func (o *CreateServerPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create server peer default response -func (o *CreateServerPeerDefault) WithConfigurationVersion(configurationVersion string) *CreateServerPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server peer default response -func (o *CreateServerPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server peer default response -func (o *CreateServerPeerDefault) WithPayload(payload *models.Error) *CreateServerPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server peer default response -func (o *CreateServerPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/create_server_peer_urlbuilder.go b/operations/server/create_server_peer_urlbuilder.go deleted file mode 100644 index 5b2d939e..00000000 --- a/operations/server/create_server_peer_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateServerPeerURL generates an URL for the create server peer operation -type CreateServerPeerURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerPeerURL) WithBasePath(bp string) *CreateServerPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServerPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateServerPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateServerPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateServerPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServerPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServerPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServerPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateServerPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/create_server_ring.go b/operations/server/create_server_ring.go deleted file mode 100644 index bb982d34..00000000 --- a/operations/server/create_server_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateServerRingHandlerFunc turns a function with the right signature into a create server ring handler -type CreateServerRingHandlerFunc func(CreateServerRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServerRingHandlerFunc) Handle(params CreateServerRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateServerRingHandler interface for that can handle valid create server ring params -type CreateServerRingHandler interface { - Handle(CreateServerRingParams, interface{}) middleware.Responder -} - -// NewCreateServerRing creates a new http.Handler for the create server ring operation -func NewCreateServerRing(ctx *middleware.Context, handler CreateServerRingHandler) *CreateServerRing { - return &CreateServerRing{Context: ctx, Handler: handler} -} - -/* - CreateServerRing swagger:route POST /services/haproxy/configuration/rings/{parent_name}/servers Server createServerRing - -# Add a new server - -Adds a new server in the specified backend in the configuration file. -*/ -type CreateServerRing struct { - Context *middleware.Context - Handler CreateServerRingHandler -} - -func (o *CreateServerRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServerRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/create_server_ring_parameters.go b/operations/server/create_server_ring_parameters.go deleted file mode 100644 index e3683e1f..00000000 --- a/operations/server/create_server_ring_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateServerRingParams creates a new CreateServerRingParams object -// with the default values initialized. -func NewCreateServerRingParams() CreateServerRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateServerRingParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateServerRingParams contains all the bound params for the create server ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters createServerRing -type CreateServerRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateServerRingParams() beforehand. -func (o *CreateServerRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateServerRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateServerRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateServerRingParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateServerRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateServerRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/create_server_ring_responses.go b/operations/server/create_server_ring_responses.go deleted file mode 100644 index 8eabe3a8..00000000 --- a/operations/server/create_server_ring_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateServerRingCreatedCode is the HTTP code returned for type CreateServerRingCreated -const CreateServerRingCreatedCode int = 201 - -/* -CreateServerRingCreated Server created - -swagger:response createServerRingCreated -*/ -type CreateServerRingCreated struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerRingCreated creates CreateServerRingCreated with default headers values -func NewCreateServerRingCreated() *CreateServerRingCreated { - - return &CreateServerRingCreated{} -} - -// WithPayload adds the payload to the create server ring created response -func (o *CreateServerRingCreated) WithPayload(payload *models.Server) *CreateServerRingCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server ring created response -func (o *CreateServerRingCreated) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerRingCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerRingAcceptedCode is the HTTP code returned for type CreateServerRingAccepted -const CreateServerRingAcceptedCode int = 202 - -/* -CreateServerRingAccepted Configuration change accepted and reload requested - -swagger:response createServerRingAccepted -*/ -type CreateServerRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewCreateServerRingAccepted creates CreateServerRingAccepted with default headers values -func NewCreateServerRingAccepted() *CreateServerRingAccepted { - - return &CreateServerRingAccepted{} -} - -// WithReloadID adds the reloadId to the create server ring accepted response -func (o *CreateServerRingAccepted) WithReloadID(reloadID string) *CreateServerRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create server ring accepted response -func (o *CreateServerRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create server ring accepted response -func (o *CreateServerRingAccepted) WithPayload(payload *models.Server) *CreateServerRingAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server ring accepted response -func (o *CreateServerRingAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerRingBadRequestCode is the HTTP code returned for type CreateServerRingBadRequest -const CreateServerRingBadRequestCode int = 400 - -/* -CreateServerRingBadRequest Bad request - -swagger:response createServerRingBadRequest -*/ -type CreateServerRingBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerRingBadRequest creates CreateServerRingBadRequest with default headers values -func NewCreateServerRingBadRequest() *CreateServerRingBadRequest { - - return &CreateServerRingBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server ring bad request response -func (o *CreateServerRingBadRequest) WithConfigurationVersion(configurationVersion string) *CreateServerRingBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server ring bad request response -func (o *CreateServerRingBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server ring bad request response -func (o *CreateServerRingBadRequest) WithPayload(payload *models.Error) *CreateServerRingBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server ring bad request response -func (o *CreateServerRingBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerRingBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerRingConflictCode is the HTTP code returned for type CreateServerRingConflict -const CreateServerRingConflictCode int = 409 - -/* -CreateServerRingConflict The specified resource already exists - -swagger:response createServerRingConflict -*/ -type CreateServerRingConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerRingConflict creates CreateServerRingConflict with default headers values -func NewCreateServerRingConflict() *CreateServerRingConflict { - - return &CreateServerRingConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server ring conflict response -func (o *CreateServerRingConflict) WithConfigurationVersion(configurationVersion string) *CreateServerRingConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server ring conflict response -func (o *CreateServerRingConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server ring conflict response -func (o *CreateServerRingConflict) WithPayload(payload *models.Error) *CreateServerRingConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server ring conflict response -func (o *CreateServerRingConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerRingConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServerRingDefault General Error - -swagger:response createServerRingDefault -*/ -type CreateServerRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerRingDefault creates CreateServerRingDefault with default headers values -func NewCreateServerRingDefault(code int) *CreateServerRingDefault { - if code <= 0 { - code = 500 - } - - return &CreateServerRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create server ring default response -func (o *CreateServerRingDefault) WithStatusCode(code int) *CreateServerRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create server ring default response -func (o *CreateServerRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create server ring default response -func (o *CreateServerRingDefault) WithConfigurationVersion(configurationVersion string) *CreateServerRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server ring default response -func (o *CreateServerRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server ring default response -func (o *CreateServerRingDefault) WithPayload(payload *models.Error) *CreateServerRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server ring default response -func (o *CreateServerRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/create_server_ring_urlbuilder.go b/operations/server/create_server_ring_urlbuilder.go deleted file mode 100644 index be100cd8..00000000 --- a/operations/server/create_server_ring_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateServerRingURL generates an URL for the create server ring operation -type CreateServerRingURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerRingURL) WithBasePath(bp string) *CreateServerRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServerRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateServerRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateServerRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateServerRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServerRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServerRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServerRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateServerRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/delete_runtime_server.go b/operations/server/delete_runtime_server.go deleted file mode 100644 index b423e9c9..00000000 --- a/operations/server/delete_runtime_server.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteRuntimeServerHandlerFunc turns a function with the right signature into a delete runtime server handler -type DeleteRuntimeServerHandlerFunc func(DeleteRuntimeServerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteRuntimeServerHandlerFunc) Handle(params DeleteRuntimeServerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteRuntimeServerHandler interface for that can handle valid delete runtime server params -type DeleteRuntimeServerHandler interface { - Handle(DeleteRuntimeServerParams, interface{}) middleware.Responder -} - -// NewDeleteRuntimeServer creates a new http.Handler for the delete runtime server operation -func NewDeleteRuntimeServer(ctx *middleware.Context, handler DeleteRuntimeServerHandler) *DeleteRuntimeServer { - return &DeleteRuntimeServer{Context: ctx, Handler: handler} -} - -/* - DeleteRuntimeServer swagger:route DELETE /services/haproxy/runtime/backends/{parent_name}/servers/{name} Server deleteRuntimeServer - -# Deletes a server from a backend - -Deletes a server from the specified backend -*/ -type DeleteRuntimeServer struct { - Context *middleware.Context - Handler DeleteRuntimeServerHandler -} - -func (o *DeleteRuntimeServer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteRuntimeServerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/delete_runtime_server_parameters.go b/operations/server/delete_runtime_server_parameters.go deleted file mode 100644 index ec68099b..00000000 --- a/operations/server/delete_runtime_server_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteRuntimeServerParams creates a new DeleteRuntimeServerParams object -// -// There are no default values defined in the spec. -func NewDeleteRuntimeServerParams() DeleteRuntimeServerParams { - - return DeleteRuntimeServerParams{} -} - -// DeleteRuntimeServerParams contains all the bound params for the delete runtime server operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteRuntimeServer -type DeleteRuntimeServerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteRuntimeServerParams() beforehand. -func (o *DeleteRuntimeServerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteRuntimeServerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteRuntimeServerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/server/delete_runtime_server_responses.go b/operations/server/delete_runtime_server_responses.go deleted file mode 100644 index c183c98a..00000000 --- a/operations/server/delete_runtime_server_responses.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteRuntimeServerNoContentCode is the HTTP code returned for type DeleteRuntimeServerNoContent -const DeleteRuntimeServerNoContentCode int = 204 - -/* -DeleteRuntimeServerNoContent Server deleted - -swagger:response deleteRuntimeServerNoContent -*/ -type DeleteRuntimeServerNoContent struct { -} - -// NewDeleteRuntimeServerNoContent creates DeleteRuntimeServerNoContent with default headers values -func NewDeleteRuntimeServerNoContent() *DeleteRuntimeServerNoContent { - - return &DeleteRuntimeServerNoContent{} -} - -// WriteResponse to the client -func (o *DeleteRuntimeServerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteRuntimeServerBadRequestCode is the HTTP code returned for type DeleteRuntimeServerBadRequest -const DeleteRuntimeServerBadRequestCode int = 400 - -/* -DeleteRuntimeServerBadRequest Bad request - -swagger:response deleteRuntimeServerBadRequest -*/ -type DeleteRuntimeServerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRuntimeServerBadRequest creates DeleteRuntimeServerBadRequest with default headers values -func NewDeleteRuntimeServerBadRequest() *DeleteRuntimeServerBadRequest { - - return &DeleteRuntimeServerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete runtime server bad request response -func (o *DeleteRuntimeServerBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteRuntimeServerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete runtime server bad request response -func (o *DeleteRuntimeServerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete runtime server bad request response -func (o *DeleteRuntimeServerBadRequest) WithPayload(payload *models.Error) *DeleteRuntimeServerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete runtime server bad request response -func (o *DeleteRuntimeServerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRuntimeServerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteRuntimeServerNotFoundCode is the HTTP code returned for type DeleteRuntimeServerNotFound -const DeleteRuntimeServerNotFoundCode int = 404 - -/* -DeleteRuntimeServerNotFound The specified resource was not found - -swagger:response deleteRuntimeServerNotFound -*/ -type DeleteRuntimeServerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRuntimeServerNotFound creates DeleteRuntimeServerNotFound with default headers values -func NewDeleteRuntimeServerNotFound() *DeleteRuntimeServerNotFound { - - return &DeleteRuntimeServerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete runtime server not found response -func (o *DeleteRuntimeServerNotFound) WithConfigurationVersion(configurationVersion string) *DeleteRuntimeServerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete runtime server not found response -func (o *DeleteRuntimeServerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete runtime server not found response -func (o *DeleteRuntimeServerNotFound) WithPayload(payload *models.Error) *DeleteRuntimeServerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete runtime server not found response -func (o *DeleteRuntimeServerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRuntimeServerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteRuntimeServerDefault General Error - -swagger:response deleteRuntimeServerDefault -*/ -type DeleteRuntimeServerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteRuntimeServerDefault creates DeleteRuntimeServerDefault with default headers values -func NewDeleteRuntimeServerDefault(code int) *DeleteRuntimeServerDefault { - if code <= 0 { - code = 500 - } - - return &DeleteRuntimeServerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) WithStatusCode(code int) *DeleteRuntimeServerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) WithConfigurationVersion(configurationVersion string) *DeleteRuntimeServerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) WithPayload(payload *models.Error) *DeleteRuntimeServerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete runtime server default response -func (o *DeleteRuntimeServerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRuntimeServerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/delete_runtime_server_urlbuilder.go b/operations/server/delete_runtime_server_urlbuilder.go deleted file mode 100644 index 41660d61..00000000 --- a/operations/server/delete_runtime_server_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteRuntimeServerURL generates an URL for the delete runtime server operation -type DeleteRuntimeServerURL struct { - Name string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRuntimeServerURL) WithBasePath(bp string) *DeleteRuntimeServerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteRuntimeServerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteRuntimeServerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteRuntimeServerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteRuntimeServerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteRuntimeServerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteRuntimeServerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteRuntimeServerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteRuntimeServerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteRuntimeServerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteRuntimeServerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/delete_server_backend.go b/operations/server/delete_server_backend.go deleted file mode 100644 index 674f1c64..00000000 --- a/operations/server/delete_server_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServerBackendHandlerFunc turns a function with the right signature into a delete server backend handler -type DeleteServerBackendHandlerFunc func(DeleteServerBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServerBackendHandlerFunc) Handle(params DeleteServerBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServerBackendHandler interface for that can handle valid delete server backend params -type DeleteServerBackendHandler interface { - Handle(DeleteServerBackendParams, interface{}) middleware.Responder -} - -// NewDeleteServerBackend creates a new http.Handler for the delete server backend operation -func NewDeleteServerBackend(ctx *middleware.Context, handler DeleteServerBackendHandler) *DeleteServerBackend { - return &DeleteServerBackend{Context: ctx, Handler: handler} -} - -/* - DeleteServerBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/servers/{name} Server deleteServerBackend - -# Delete a server - -Deletes a server configuration by it's name in the specified backend. -*/ -type DeleteServerBackend struct { - Context *middleware.Context - Handler DeleteServerBackendHandler -} - -func (o *DeleteServerBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServerBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/delete_server_backend_parameters.go b/operations/server/delete_server_backend_parameters.go deleted file mode 100644 index d6b2c147..00000000 --- a/operations/server/delete_server_backend_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServerBackendParams creates a new DeleteServerBackendParams object -// with the default values initialized. -func NewDeleteServerBackendParams() DeleteServerBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteServerBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteServerBackendParams contains all the bound params for the delete server backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteServerBackend -type DeleteServerBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServerBackendParams() beforehand. -func (o *DeleteServerBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteServerBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteServerBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteServerBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServerBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteServerBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteServerBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/delete_server_backend_responses.go b/operations/server/delete_server_backend_responses.go deleted file mode 100644 index b7f7909e..00000000 --- a/operations/server/delete_server_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServerBackendAcceptedCode is the HTTP code returned for type DeleteServerBackendAccepted -const DeleteServerBackendAcceptedCode int = 202 - -/* -DeleteServerBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteServerBackendAccepted -*/ -type DeleteServerBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteServerBackendAccepted creates DeleteServerBackendAccepted with default headers values -func NewDeleteServerBackendAccepted() *DeleteServerBackendAccepted { - - return &DeleteServerBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete server backend accepted response -func (o *DeleteServerBackendAccepted) WithReloadID(reloadID string) *DeleteServerBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete server backend accepted response -func (o *DeleteServerBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteServerBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteServerBackendNoContentCode is the HTTP code returned for type DeleteServerBackendNoContent -const DeleteServerBackendNoContentCode int = 204 - -/* -DeleteServerBackendNoContent Server deleted - -swagger:response deleteServerBackendNoContent -*/ -type DeleteServerBackendNoContent struct { -} - -// NewDeleteServerBackendNoContent creates DeleteServerBackendNoContent with default headers values -func NewDeleteServerBackendNoContent() *DeleteServerBackendNoContent { - - return &DeleteServerBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServerBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServerBackendNotFoundCode is the HTTP code returned for type DeleteServerBackendNotFound -const DeleteServerBackendNotFoundCode int = 404 - -/* -DeleteServerBackendNotFound The specified resource was not found - -swagger:response deleteServerBackendNotFound -*/ -type DeleteServerBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerBackendNotFound creates DeleteServerBackendNotFound with default headers values -func NewDeleteServerBackendNotFound() *DeleteServerBackendNotFound { - - return &DeleteServerBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete server backend not found response -func (o *DeleteServerBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServerBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server backend not found response -func (o *DeleteServerBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server backend not found response -func (o *DeleteServerBackendNotFound) WithPayload(payload *models.Error) *DeleteServerBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server backend not found response -func (o *DeleteServerBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServerBackendDefault General Error - -swagger:response deleteServerBackendDefault -*/ -type DeleteServerBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerBackendDefault creates DeleteServerBackendDefault with default headers values -func NewDeleteServerBackendDefault(code int) *DeleteServerBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServerBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete server backend default response -func (o *DeleteServerBackendDefault) WithStatusCode(code int) *DeleteServerBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete server backend default response -func (o *DeleteServerBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete server backend default response -func (o *DeleteServerBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteServerBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server backend default response -func (o *DeleteServerBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server backend default response -func (o *DeleteServerBackendDefault) WithPayload(payload *models.Error) *DeleteServerBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server backend default response -func (o *DeleteServerBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/delete_server_backend_urlbuilder.go b/operations/server/delete_server_backend_urlbuilder.go deleted file mode 100644 index a5d0310a..00000000 --- a/operations/server/delete_server_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteServerBackendURL generates an URL for the delete server backend operation -type DeleteServerBackendURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerBackendURL) WithBasePath(bp string) *DeleteServerBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServerBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteServerBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServerBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServerBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServerBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServerBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServerBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServerBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServerBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/delete_server_peer.go b/operations/server/delete_server_peer.go deleted file mode 100644 index c28f13a3..00000000 --- a/operations/server/delete_server_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServerPeerHandlerFunc turns a function with the right signature into a delete server peer handler -type DeleteServerPeerHandlerFunc func(DeleteServerPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServerPeerHandlerFunc) Handle(params DeleteServerPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServerPeerHandler interface for that can handle valid delete server peer params -type DeleteServerPeerHandler interface { - Handle(DeleteServerPeerParams, interface{}) middleware.Responder -} - -// NewDeleteServerPeer creates a new http.Handler for the delete server peer operation -func NewDeleteServerPeer(ctx *middleware.Context, handler DeleteServerPeerHandler) *DeleteServerPeer { - return &DeleteServerPeer{Context: ctx, Handler: handler} -} - -/* - DeleteServerPeer swagger:route DELETE /services/haproxy/configuration/peers/{parent_name}/servers/{name} Server deleteServerPeer - -# Delete a server - -Deletes a server configuration by it's name in the specified backend. -*/ -type DeleteServerPeer struct { - Context *middleware.Context - Handler DeleteServerPeerHandler -} - -func (o *DeleteServerPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServerPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/delete_server_peer_parameters.go b/operations/server/delete_server_peer_parameters.go deleted file mode 100644 index 82d2f6d9..00000000 --- a/operations/server/delete_server_peer_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServerPeerParams creates a new DeleteServerPeerParams object -// with the default values initialized. -func NewDeleteServerPeerParams() DeleteServerPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteServerPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteServerPeerParams contains all the bound params for the delete server peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteServerPeer -type DeleteServerPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServerPeerParams() beforehand. -func (o *DeleteServerPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteServerPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteServerPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteServerPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServerPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteServerPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteServerPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/delete_server_peer_responses.go b/operations/server/delete_server_peer_responses.go deleted file mode 100644 index d710f89a..00000000 --- a/operations/server/delete_server_peer_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServerPeerAcceptedCode is the HTTP code returned for type DeleteServerPeerAccepted -const DeleteServerPeerAcceptedCode int = 202 - -/* -DeleteServerPeerAccepted Configuration change accepted and reload requested - -swagger:response deleteServerPeerAccepted -*/ -type DeleteServerPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteServerPeerAccepted creates DeleteServerPeerAccepted with default headers values -func NewDeleteServerPeerAccepted() *DeleteServerPeerAccepted { - - return &DeleteServerPeerAccepted{} -} - -// WithReloadID adds the reloadId to the delete server peer accepted response -func (o *DeleteServerPeerAccepted) WithReloadID(reloadID string) *DeleteServerPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete server peer accepted response -func (o *DeleteServerPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteServerPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteServerPeerNoContentCode is the HTTP code returned for type DeleteServerPeerNoContent -const DeleteServerPeerNoContentCode int = 204 - -/* -DeleteServerPeerNoContent Server deleted - -swagger:response deleteServerPeerNoContent -*/ -type DeleteServerPeerNoContent struct { -} - -// NewDeleteServerPeerNoContent creates DeleteServerPeerNoContent with default headers values -func NewDeleteServerPeerNoContent() *DeleteServerPeerNoContent { - - return &DeleteServerPeerNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServerPeerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServerPeerNotFoundCode is the HTTP code returned for type DeleteServerPeerNotFound -const DeleteServerPeerNotFoundCode int = 404 - -/* -DeleteServerPeerNotFound The specified resource was not found - -swagger:response deleteServerPeerNotFound -*/ -type DeleteServerPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerPeerNotFound creates DeleteServerPeerNotFound with default headers values -func NewDeleteServerPeerNotFound() *DeleteServerPeerNotFound { - - return &DeleteServerPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete server peer not found response -func (o *DeleteServerPeerNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServerPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server peer not found response -func (o *DeleteServerPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server peer not found response -func (o *DeleteServerPeerNotFound) WithPayload(payload *models.Error) *DeleteServerPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server peer not found response -func (o *DeleteServerPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServerPeerDefault General Error - -swagger:response deleteServerPeerDefault -*/ -type DeleteServerPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerPeerDefault creates DeleteServerPeerDefault with default headers values -func NewDeleteServerPeerDefault(code int) *DeleteServerPeerDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServerPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete server peer default response -func (o *DeleteServerPeerDefault) WithStatusCode(code int) *DeleteServerPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete server peer default response -func (o *DeleteServerPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete server peer default response -func (o *DeleteServerPeerDefault) WithConfigurationVersion(configurationVersion string) *DeleteServerPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server peer default response -func (o *DeleteServerPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server peer default response -func (o *DeleteServerPeerDefault) WithPayload(payload *models.Error) *DeleteServerPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server peer default response -func (o *DeleteServerPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/delete_server_peer_urlbuilder.go b/operations/server/delete_server_peer_urlbuilder.go deleted file mode 100644 index e8bd22c3..00000000 --- a/operations/server/delete_server_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteServerPeerURL generates an URL for the delete server peer operation -type DeleteServerPeerURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerPeerURL) WithBasePath(bp string) *DeleteServerPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServerPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteServerPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServerPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServerPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServerPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServerPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServerPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServerPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServerPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/delete_server_ring.go b/operations/server/delete_server_ring.go deleted file mode 100644 index 9512739b..00000000 --- a/operations/server/delete_server_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServerRingHandlerFunc turns a function with the right signature into a delete server ring handler -type DeleteServerRingHandlerFunc func(DeleteServerRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServerRingHandlerFunc) Handle(params DeleteServerRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServerRingHandler interface for that can handle valid delete server ring params -type DeleteServerRingHandler interface { - Handle(DeleteServerRingParams, interface{}) middleware.Responder -} - -// NewDeleteServerRing creates a new http.Handler for the delete server ring operation -func NewDeleteServerRing(ctx *middleware.Context, handler DeleteServerRingHandler) *DeleteServerRing { - return &DeleteServerRing{Context: ctx, Handler: handler} -} - -/* - DeleteServerRing swagger:route DELETE /services/haproxy/configuration/rings/{parent_name}/servers/{name} Server deleteServerRing - -# Delete a server - -Deletes a server configuration by it's name in the specified backend. -*/ -type DeleteServerRing struct { - Context *middleware.Context - Handler DeleteServerRingHandler -} - -func (o *DeleteServerRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServerRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/delete_server_ring_parameters.go b/operations/server/delete_server_ring_parameters.go deleted file mode 100644 index 50207734..00000000 --- a/operations/server/delete_server_ring_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServerRingParams creates a new DeleteServerRingParams object -// with the default values initialized. -func NewDeleteServerRingParams() DeleteServerRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteServerRingParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteServerRingParams contains all the bound params for the delete server ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteServerRing -type DeleteServerRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServerRingParams() beforehand. -func (o *DeleteServerRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteServerRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteServerRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteServerRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServerRingParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteServerRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteServerRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/delete_server_ring_responses.go b/operations/server/delete_server_ring_responses.go deleted file mode 100644 index ab08093f..00000000 --- a/operations/server/delete_server_ring_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServerRingAcceptedCode is the HTTP code returned for type DeleteServerRingAccepted -const DeleteServerRingAcceptedCode int = 202 - -/* -DeleteServerRingAccepted Configuration change accepted and reload requested - -swagger:response deleteServerRingAccepted -*/ -type DeleteServerRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteServerRingAccepted creates DeleteServerRingAccepted with default headers values -func NewDeleteServerRingAccepted() *DeleteServerRingAccepted { - - return &DeleteServerRingAccepted{} -} - -// WithReloadID adds the reloadId to the delete server ring accepted response -func (o *DeleteServerRingAccepted) WithReloadID(reloadID string) *DeleteServerRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete server ring accepted response -func (o *DeleteServerRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteServerRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteServerRingNoContentCode is the HTTP code returned for type DeleteServerRingNoContent -const DeleteServerRingNoContentCode int = 204 - -/* -DeleteServerRingNoContent Server deleted - -swagger:response deleteServerRingNoContent -*/ -type DeleteServerRingNoContent struct { -} - -// NewDeleteServerRingNoContent creates DeleteServerRingNoContent with default headers values -func NewDeleteServerRingNoContent() *DeleteServerRingNoContent { - - return &DeleteServerRingNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServerRingNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServerRingNotFoundCode is the HTTP code returned for type DeleteServerRingNotFound -const DeleteServerRingNotFoundCode int = 404 - -/* -DeleteServerRingNotFound The specified resource was not found - -swagger:response deleteServerRingNotFound -*/ -type DeleteServerRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerRingNotFound creates DeleteServerRingNotFound with default headers values -func NewDeleteServerRingNotFound() *DeleteServerRingNotFound { - - return &DeleteServerRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete server ring not found response -func (o *DeleteServerRingNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServerRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server ring not found response -func (o *DeleteServerRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server ring not found response -func (o *DeleteServerRingNotFound) WithPayload(payload *models.Error) *DeleteServerRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server ring not found response -func (o *DeleteServerRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServerRingDefault General Error - -swagger:response deleteServerRingDefault -*/ -type DeleteServerRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerRingDefault creates DeleteServerRingDefault with default headers values -func NewDeleteServerRingDefault(code int) *DeleteServerRingDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServerRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete server ring default response -func (o *DeleteServerRingDefault) WithStatusCode(code int) *DeleteServerRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete server ring default response -func (o *DeleteServerRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete server ring default response -func (o *DeleteServerRingDefault) WithConfigurationVersion(configurationVersion string) *DeleteServerRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server ring default response -func (o *DeleteServerRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server ring default response -func (o *DeleteServerRingDefault) WithPayload(payload *models.Error) *DeleteServerRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server ring default response -func (o *DeleteServerRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/delete_server_ring_urlbuilder.go b/operations/server/delete_server_ring_urlbuilder.go deleted file mode 100644 index 39570019..00000000 --- a/operations/server/delete_server_ring_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteServerRingURL generates an URL for the delete server ring operation -type DeleteServerRingURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerRingURL) WithBasePath(bp string) *DeleteServerRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServerRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteServerRingURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServerRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServerRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServerRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServerRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServerRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServerRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServerRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_all_runtime_server.go b/operations/server/get_all_runtime_server.go deleted file mode 100644 index 06b74e2e..00000000 --- a/operations/server/get_all_runtime_server.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllRuntimeServerHandlerFunc turns a function with the right signature into a get all runtime server handler -type GetAllRuntimeServerHandlerFunc func(GetAllRuntimeServerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllRuntimeServerHandlerFunc) Handle(params GetAllRuntimeServerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllRuntimeServerHandler interface for that can handle valid get all runtime server params -type GetAllRuntimeServerHandler interface { - Handle(GetAllRuntimeServerParams, interface{}) middleware.Responder -} - -// NewGetAllRuntimeServer creates a new http.Handler for the get all runtime server operation -func NewGetAllRuntimeServer(ctx *middleware.Context, handler GetAllRuntimeServerHandler) *GetAllRuntimeServer { - return &GetAllRuntimeServer{Context: ctx, Handler: handler} -} - -/* - GetAllRuntimeServer swagger:route GET /services/haproxy/runtime/backends/{parent_name}/servers Server getAllRuntimeServer - -Return an array of runtime servers' settings - -Returns an array of all servers' runtime settings. -*/ -type GetAllRuntimeServer struct { - Context *middleware.Context - Handler GetAllRuntimeServerHandler -} - -func (o *GetAllRuntimeServer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllRuntimeServerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_all_runtime_server_parameters.go b/operations/server/get_all_runtime_server_parameters.go deleted file mode 100644 index 3694a36c..00000000 --- a/operations/server/get_all_runtime_server_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllRuntimeServerParams creates a new GetAllRuntimeServerParams object -// -// There are no default values defined in the spec. -func NewGetAllRuntimeServerParams() GetAllRuntimeServerParams { - - return GetAllRuntimeServerParams{} -} - -// GetAllRuntimeServerParams contains all the bound params for the get all runtime server operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllRuntimeServer -type GetAllRuntimeServerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllRuntimeServerParams() beforehand. -func (o *GetAllRuntimeServerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllRuntimeServerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/server/get_all_runtime_server_responses.go b/operations/server/get_all_runtime_server_responses.go deleted file mode 100644 index 5c0df832..00000000 --- a/operations/server/get_all_runtime_server_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllRuntimeServerOKCode is the HTTP code returned for type GetAllRuntimeServerOK -const GetAllRuntimeServerOKCode int = 200 - -/* -GetAllRuntimeServerOK Successful operation - -swagger:response getAllRuntimeServerOK -*/ -type GetAllRuntimeServerOK struct { - - /* - In: Body - */ - Payload models.RuntimeServers `json:"body,omitempty"` -} - -// NewGetAllRuntimeServerOK creates GetAllRuntimeServerOK with default headers values -func NewGetAllRuntimeServerOK() *GetAllRuntimeServerOK { - - return &GetAllRuntimeServerOK{} -} - -// WithPayload adds the payload to the get all runtime server o k response -func (o *GetAllRuntimeServerOK) WithPayload(payload models.RuntimeServers) *GetAllRuntimeServerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all runtime server o k response -func (o *GetAllRuntimeServerOK) SetPayload(payload models.RuntimeServers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllRuntimeServerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.RuntimeServers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllRuntimeServerDefault General Error - -swagger:response getAllRuntimeServerDefault -*/ -type GetAllRuntimeServerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllRuntimeServerDefault creates GetAllRuntimeServerDefault with default headers values -func NewGetAllRuntimeServerDefault(code int) *GetAllRuntimeServerDefault { - if code <= 0 { - code = 500 - } - - return &GetAllRuntimeServerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) WithStatusCode(code int) *GetAllRuntimeServerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) WithConfigurationVersion(configurationVersion string) *GetAllRuntimeServerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) WithPayload(payload *models.Error) *GetAllRuntimeServerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all runtime server default response -func (o *GetAllRuntimeServerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllRuntimeServerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_all_runtime_server_urlbuilder.go b/operations/server/get_all_runtime_server_urlbuilder.go deleted file mode 100644 index 8d36a8a4..00000000 --- a/operations/server/get_all_runtime_server_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllRuntimeServerURL generates an URL for the get all runtime server operation -type GetAllRuntimeServerURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllRuntimeServerURL) WithBasePath(bp string) *GetAllRuntimeServerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllRuntimeServerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllRuntimeServerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/backends/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllRuntimeServerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllRuntimeServerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllRuntimeServerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllRuntimeServerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllRuntimeServerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllRuntimeServerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllRuntimeServerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_all_server_backend.go b/operations/server/get_all_server_backend.go deleted file mode 100644 index ec714158..00000000 --- a/operations/server/get_all_server_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllServerBackendHandlerFunc turns a function with the right signature into a get all server backend handler -type GetAllServerBackendHandlerFunc func(GetAllServerBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllServerBackendHandlerFunc) Handle(params GetAllServerBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllServerBackendHandler interface for that can handle valid get all server backend params -type GetAllServerBackendHandler interface { - Handle(GetAllServerBackendParams, interface{}) middleware.Responder -} - -// NewGetAllServerBackend creates a new http.Handler for the get all server backend operation -func NewGetAllServerBackend(ctx *middleware.Context, handler GetAllServerBackendHandler) *GetAllServerBackend { - return &GetAllServerBackend{Context: ctx, Handler: handler} -} - -/* - GetAllServerBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/servers Server getAllServerBackend - -# Return an array of servers - -Returns an array of all servers that are configured in specified backend. -*/ -type GetAllServerBackend struct { - Context *middleware.Context - Handler GetAllServerBackendHandler -} - -func (o *GetAllServerBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllServerBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_all_server_backend_parameters.go b/operations/server/get_all_server_backend_parameters.go deleted file mode 100644 index 90a9b74a..00000000 --- a/operations/server/get_all_server_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllServerBackendParams creates a new GetAllServerBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllServerBackendParams() GetAllServerBackendParams { - - return GetAllServerBackendParams{} -} - -// GetAllServerBackendParams contains all the bound params for the get all server backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllServerBackend -type GetAllServerBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllServerBackendParams() beforehand. -func (o *GetAllServerBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllServerBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllServerBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_all_server_backend_responses.go b/operations/server/get_all_server_backend_responses.go deleted file mode 100644 index 3e760c43..00000000 --- a/operations/server/get_all_server_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllServerBackendOKCode is the HTTP code returned for type GetAllServerBackendOK -const GetAllServerBackendOKCode int = 200 - -/* -GetAllServerBackendOK Successful operation - -swagger:response getAllServerBackendOK -*/ -type GetAllServerBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Servers `json:"body,omitempty"` -} - -// NewGetAllServerBackendOK creates GetAllServerBackendOK with default headers values -func NewGetAllServerBackendOK() *GetAllServerBackendOK { - - return &GetAllServerBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all server backend o k response -func (o *GetAllServerBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllServerBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server backend o k response -func (o *GetAllServerBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server backend o k response -func (o *GetAllServerBackendOK) WithPayload(payload models.Servers) *GetAllServerBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server backend o k response -func (o *GetAllServerBackendOK) SetPayload(payload models.Servers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Servers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllServerBackendDefault General Error - -swagger:response getAllServerBackendDefault -*/ -type GetAllServerBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllServerBackendDefault creates GetAllServerBackendDefault with default headers values -func NewGetAllServerBackendDefault(code int) *GetAllServerBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllServerBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all server backend default response -func (o *GetAllServerBackendDefault) WithStatusCode(code int) *GetAllServerBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all server backend default response -func (o *GetAllServerBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all server backend default response -func (o *GetAllServerBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllServerBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server backend default response -func (o *GetAllServerBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server backend default response -func (o *GetAllServerBackendDefault) WithPayload(payload *models.Error) *GetAllServerBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server backend default response -func (o *GetAllServerBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_all_server_backend_urlbuilder.go b/operations/server/get_all_server_backend_urlbuilder.go deleted file mode 100644 index 1b1c8791..00000000 --- a/operations/server/get_all_server_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllServerBackendURL generates an URL for the get all server backend operation -type GetAllServerBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerBackendURL) WithBasePath(bp string) *GetAllServerBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllServerBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllServerBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllServerBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllServerBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllServerBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllServerBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllServerBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllServerBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_all_server_peer.go b/operations/server/get_all_server_peer.go deleted file mode 100644 index f6dd3d89..00000000 --- a/operations/server/get_all_server_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllServerPeerHandlerFunc turns a function with the right signature into a get all server peer handler -type GetAllServerPeerHandlerFunc func(GetAllServerPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllServerPeerHandlerFunc) Handle(params GetAllServerPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllServerPeerHandler interface for that can handle valid get all server peer params -type GetAllServerPeerHandler interface { - Handle(GetAllServerPeerParams, interface{}) middleware.Responder -} - -// NewGetAllServerPeer creates a new http.Handler for the get all server peer operation -func NewGetAllServerPeer(ctx *middleware.Context, handler GetAllServerPeerHandler) *GetAllServerPeer { - return &GetAllServerPeer{Context: ctx, Handler: handler} -} - -/* - GetAllServerPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/servers Server getAllServerPeer - -# Return an array of servers - -Returns an array of all servers that are configured in specified backend. -*/ -type GetAllServerPeer struct { - Context *middleware.Context - Handler GetAllServerPeerHandler -} - -func (o *GetAllServerPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllServerPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_all_server_peer_parameters.go b/operations/server/get_all_server_peer_parameters.go deleted file mode 100644 index acad0f2a..00000000 --- a/operations/server/get_all_server_peer_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllServerPeerParams creates a new GetAllServerPeerParams object -// -// There are no default values defined in the spec. -func NewGetAllServerPeerParams() GetAllServerPeerParams { - - return GetAllServerPeerParams{} -} - -// GetAllServerPeerParams contains all the bound params for the get all server peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllServerPeer -type GetAllServerPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllServerPeerParams() beforehand. -func (o *GetAllServerPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllServerPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllServerPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_all_server_peer_responses.go b/operations/server/get_all_server_peer_responses.go deleted file mode 100644 index 26275761..00000000 --- a/operations/server/get_all_server_peer_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllServerPeerOKCode is the HTTP code returned for type GetAllServerPeerOK -const GetAllServerPeerOKCode int = 200 - -/* -GetAllServerPeerOK Successful operation - -swagger:response getAllServerPeerOK -*/ -type GetAllServerPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Servers `json:"body,omitempty"` -} - -// NewGetAllServerPeerOK creates GetAllServerPeerOK with default headers values -func NewGetAllServerPeerOK() *GetAllServerPeerOK { - - return &GetAllServerPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all server peer o k response -func (o *GetAllServerPeerOK) WithConfigurationVersion(configurationVersion string) *GetAllServerPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server peer o k response -func (o *GetAllServerPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server peer o k response -func (o *GetAllServerPeerOK) WithPayload(payload models.Servers) *GetAllServerPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server peer o k response -func (o *GetAllServerPeerOK) SetPayload(payload models.Servers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Servers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllServerPeerDefault General Error - -swagger:response getAllServerPeerDefault -*/ -type GetAllServerPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllServerPeerDefault creates GetAllServerPeerDefault with default headers values -func NewGetAllServerPeerDefault(code int) *GetAllServerPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetAllServerPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all server peer default response -func (o *GetAllServerPeerDefault) WithStatusCode(code int) *GetAllServerPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all server peer default response -func (o *GetAllServerPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all server peer default response -func (o *GetAllServerPeerDefault) WithConfigurationVersion(configurationVersion string) *GetAllServerPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server peer default response -func (o *GetAllServerPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server peer default response -func (o *GetAllServerPeerDefault) WithPayload(payload *models.Error) *GetAllServerPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server peer default response -func (o *GetAllServerPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_all_server_peer_urlbuilder.go b/operations/server/get_all_server_peer_urlbuilder.go deleted file mode 100644 index 1335ae40..00000000 --- a/operations/server/get_all_server_peer_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllServerPeerURL generates an URL for the get all server peer operation -type GetAllServerPeerURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerPeerURL) WithBasePath(bp string) *GetAllServerPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllServerPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllServerPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllServerPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllServerPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllServerPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllServerPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllServerPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllServerPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_all_server_ring.go b/operations/server/get_all_server_ring.go deleted file mode 100644 index e8481acf..00000000 --- a/operations/server/get_all_server_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllServerRingHandlerFunc turns a function with the right signature into a get all server ring handler -type GetAllServerRingHandlerFunc func(GetAllServerRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllServerRingHandlerFunc) Handle(params GetAllServerRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllServerRingHandler interface for that can handle valid get all server ring params -type GetAllServerRingHandler interface { - Handle(GetAllServerRingParams, interface{}) middleware.Responder -} - -// NewGetAllServerRing creates a new http.Handler for the get all server ring operation -func NewGetAllServerRing(ctx *middleware.Context, handler GetAllServerRingHandler) *GetAllServerRing { - return &GetAllServerRing{Context: ctx, Handler: handler} -} - -/* - GetAllServerRing swagger:route GET /services/haproxy/configuration/rings/{parent_name}/servers Server getAllServerRing - -# Return an array of servers - -Returns an array of all servers that are configured in specified backend. -*/ -type GetAllServerRing struct { - Context *middleware.Context - Handler GetAllServerRingHandler -} - -func (o *GetAllServerRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllServerRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_all_server_ring_parameters.go b/operations/server/get_all_server_ring_parameters.go deleted file mode 100644 index 260cf427..00000000 --- a/operations/server/get_all_server_ring_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllServerRingParams creates a new GetAllServerRingParams object -// -// There are no default values defined in the spec. -func NewGetAllServerRingParams() GetAllServerRingParams { - - return GetAllServerRingParams{} -} - -// GetAllServerRingParams contains all the bound params for the get all server ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllServerRing -type GetAllServerRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllServerRingParams() beforehand. -func (o *GetAllServerRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllServerRingParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllServerRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_all_server_ring_responses.go b/operations/server/get_all_server_ring_responses.go deleted file mode 100644 index f5d7d93c..00000000 --- a/operations/server/get_all_server_ring_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllServerRingOKCode is the HTTP code returned for type GetAllServerRingOK -const GetAllServerRingOKCode int = 200 - -/* -GetAllServerRingOK Successful operation - -swagger:response getAllServerRingOK -*/ -type GetAllServerRingOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Servers `json:"body,omitempty"` -} - -// NewGetAllServerRingOK creates GetAllServerRingOK with default headers values -func NewGetAllServerRingOK() *GetAllServerRingOK { - - return &GetAllServerRingOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all server ring o k response -func (o *GetAllServerRingOK) WithConfigurationVersion(configurationVersion string) *GetAllServerRingOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server ring o k response -func (o *GetAllServerRingOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server ring o k response -func (o *GetAllServerRingOK) WithPayload(payload models.Servers) *GetAllServerRingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server ring o k response -func (o *GetAllServerRingOK) SetPayload(payload models.Servers) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerRingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Servers{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllServerRingDefault General Error - -swagger:response getAllServerRingDefault -*/ -type GetAllServerRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllServerRingDefault creates GetAllServerRingDefault with default headers values -func NewGetAllServerRingDefault(code int) *GetAllServerRingDefault { - if code <= 0 { - code = 500 - } - - return &GetAllServerRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all server ring default response -func (o *GetAllServerRingDefault) WithStatusCode(code int) *GetAllServerRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all server ring default response -func (o *GetAllServerRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all server ring default response -func (o *GetAllServerRingDefault) WithConfigurationVersion(configurationVersion string) *GetAllServerRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all server ring default response -func (o *GetAllServerRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all server ring default response -func (o *GetAllServerRingDefault) WithPayload(payload *models.Error) *GetAllServerRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all server ring default response -func (o *GetAllServerRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllServerRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_all_server_ring_urlbuilder.go b/operations/server/get_all_server_ring_urlbuilder.go deleted file mode 100644 index 3b4ef843..00000000 --- a/operations/server/get_all_server_ring_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllServerRingURL generates an URL for the get all server ring operation -type GetAllServerRingURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerRingURL) WithBasePath(bp string) *GetAllServerRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllServerRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllServerRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{parent_name}/servers" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllServerRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllServerRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllServerRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllServerRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllServerRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllServerRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllServerRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_runtime_server.go b/operations/server/get_runtime_server.go deleted file mode 100644 index e0eba4bc..00000000 --- a/operations/server/get_runtime_server.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetRuntimeServerHandlerFunc turns a function with the right signature into a get runtime server handler -type GetRuntimeServerHandlerFunc func(GetRuntimeServerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetRuntimeServerHandlerFunc) Handle(params GetRuntimeServerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetRuntimeServerHandler interface for that can handle valid get runtime server params -type GetRuntimeServerHandler interface { - Handle(GetRuntimeServerParams, interface{}) middleware.Responder -} - -// NewGetRuntimeServer creates a new http.Handler for the get runtime server operation -func NewGetRuntimeServer(ctx *middleware.Context, handler GetRuntimeServerHandler) *GetRuntimeServer { - return &GetRuntimeServer{Context: ctx, Handler: handler} -} - -/* - GetRuntimeServer swagger:route GET /services/haproxy/runtime/backends/{parent_name}/servers/{name} Server getRuntimeServer - -# Return one server runtime settings - -Returns one server runtime settings by it's name in the specified backend. -*/ -type GetRuntimeServer struct { - Context *middleware.Context - Handler GetRuntimeServerHandler -} - -func (o *GetRuntimeServer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetRuntimeServerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_runtime_server_parameters.go b/operations/server/get_runtime_server_parameters.go deleted file mode 100644 index fbf48706..00000000 --- a/operations/server/get_runtime_server_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetRuntimeServerParams creates a new GetRuntimeServerParams object -// -// There are no default values defined in the spec. -func NewGetRuntimeServerParams() GetRuntimeServerParams { - - return GetRuntimeServerParams{} -} - -// GetRuntimeServerParams contains all the bound params for the get runtime server operation -// typically these are obtained from a http.Request -// -// swagger:parameters getRuntimeServer -type GetRuntimeServerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetRuntimeServerParams() beforehand. -func (o *GetRuntimeServerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetRuntimeServerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetRuntimeServerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/server/get_runtime_server_responses.go b/operations/server/get_runtime_server_responses.go deleted file mode 100644 index e94ff044..00000000 --- a/operations/server/get_runtime_server_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetRuntimeServerOKCode is the HTTP code returned for type GetRuntimeServerOK -const GetRuntimeServerOKCode int = 200 - -/* -GetRuntimeServerOK Successful operation - -swagger:response getRuntimeServerOK -*/ -type GetRuntimeServerOK struct { - - /* - In: Body - */ - Payload *models.RuntimeServer `json:"body,omitempty"` -} - -// NewGetRuntimeServerOK creates GetRuntimeServerOK with default headers values -func NewGetRuntimeServerOK() *GetRuntimeServerOK { - - return &GetRuntimeServerOK{} -} - -// WithPayload adds the payload to the get runtime server o k response -func (o *GetRuntimeServerOK) WithPayload(payload *models.RuntimeServer) *GetRuntimeServerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime server o k response -func (o *GetRuntimeServerOK) SetPayload(payload *models.RuntimeServer) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeServerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetRuntimeServerNotFoundCode is the HTTP code returned for type GetRuntimeServerNotFound -const GetRuntimeServerNotFoundCode int = 404 - -/* -GetRuntimeServerNotFound The specified resource was not found - -swagger:response getRuntimeServerNotFound -*/ -type GetRuntimeServerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRuntimeServerNotFound creates GetRuntimeServerNotFound with default headers values -func NewGetRuntimeServerNotFound() *GetRuntimeServerNotFound { - - return &GetRuntimeServerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get runtime server not found response -func (o *GetRuntimeServerNotFound) WithConfigurationVersion(configurationVersion string) *GetRuntimeServerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get runtime server not found response -func (o *GetRuntimeServerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get runtime server not found response -func (o *GetRuntimeServerNotFound) WithPayload(payload *models.Error) *GetRuntimeServerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime server not found response -func (o *GetRuntimeServerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeServerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetRuntimeServerDefault General Error - -swagger:response getRuntimeServerDefault -*/ -type GetRuntimeServerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetRuntimeServerDefault creates GetRuntimeServerDefault with default headers values -func NewGetRuntimeServerDefault(code int) *GetRuntimeServerDefault { - if code <= 0 { - code = 500 - } - - return &GetRuntimeServerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get runtime server default response -func (o *GetRuntimeServerDefault) WithStatusCode(code int) *GetRuntimeServerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get runtime server default response -func (o *GetRuntimeServerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get runtime server default response -func (o *GetRuntimeServerDefault) WithConfigurationVersion(configurationVersion string) *GetRuntimeServerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get runtime server default response -func (o *GetRuntimeServerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get runtime server default response -func (o *GetRuntimeServerDefault) WithPayload(payload *models.Error) *GetRuntimeServerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get runtime server default response -func (o *GetRuntimeServerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetRuntimeServerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_runtime_server_urlbuilder.go b/operations/server/get_runtime_server_urlbuilder.go deleted file mode 100644 index cb0e5ed9..00000000 --- a/operations/server/get_runtime_server_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetRuntimeServerURL generates an URL for the get runtime server operation -type GetRuntimeServerURL struct { - Name string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeServerURL) WithBasePath(bp string) *GetRuntimeServerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetRuntimeServerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetRuntimeServerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetRuntimeServerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetRuntimeServerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetRuntimeServerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetRuntimeServerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetRuntimeServerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetRuntimeServerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetRuntimeServerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetRuntimeServerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_server_backend.go b/operations/server/get_server_backend.go deleted file mode 100644 index 04e97a1f..00000000 --- a/operations/server/get_server_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerBackendHandlerFunc turns a function with the right signature into a get server backend handler -type GetServerBackendHandlerFunc func(GetServerBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerBackendHandlerFunc) Handle(params GetServerBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerBackendHandler interface for that can handle valid get server backend params -type GetServerBackendHandler interface { - Handle(GetServerBackendParams, interface{}) middleware.Responder -} - -// NewGetServerBackend creates a new http.Handler for the get server backend operation -func NewGetServerBackend(ctx *middleware.Context, handler GetServerBackendHandler) *GetServerBackend { - return &GetServerBackend{Context: ctx, Handler: handler} -} - -/* - GetServerBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/servers/{name} Server getServerBackend - -# Return one server - -Returns one server configuration by it's name in the specified backend. -*/ -type GetServerBackend struct { - Context *middleware.Context - Handler GetServerBackendHandler -} - -func (o *GetServerBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_server_backend_parameters.go b/operations/server/get_server_backend_parameters.go deleted file mode 100644 index 9db9eae2..00000000 --- a/operations/server/get_server_backend_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerBackendParams creates a new GetServerBackendParams object -// -// There are no default values defined in the spec. -func NewGetServerBackendParams() GetServerBackendParams { - - return GetServerBackendParams{} -} - -// GetServerBackendParams contains all the bound params for the get server backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerBackend -type GetServerBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerBackendParams() beforehand. -func (o *GetServerBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetServerBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_server_backend_responses.go b/operations/server/get_server_backend_responses.go deleted file mode 100644 index 9d69de2c..00000000 --- a/operations/server/get_server_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerBackendOKCode is the HTTP code returned for type GetServerBackendOK -const GetServerBackendOKCode int = 200 - -/* -GetServerBackendOK Successful operation - -swagger:response getServerBackendOK -*/ -type GetServerBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewGetServerBackendOK creates GetServerBackendOK with default headers values -func NewGetServerBackendOK() *GetServerBackendOK { - - return &GetServerBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server backend o k response -func (o *GetServerBackendOK) WithConfigurationVersion(configurationVersion string) *GetServerBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server backend o k response -func (o *GetServerBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server backend o k response -func (o *GetServerBackendOK) WithPayload(payload *models.Server) *GetServerBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server backend o k response -func (o *GetServerBackendOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServerBackendNotFoundCode is the HTTP code returned for type GetServerBackendNotFound -const GetServerBackendNotFoundCode int = 404 - -/* -GetServerBackendNotFound The specified resource was not found - -swagger:response getServerBackendNotFound -*/ -type GetServerBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerBackendNotFound creates GetServerBackendNotFound with default headers values -func NewGetServerBackendNotFound() *GetServerBackendNotFound { - - return &GetServerBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server backend not found response -func (o *GetServerBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetServerBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server backend not found response -func (o *GetServerBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server backend not found response -func (o *GetServerBackendNotFound) WithPayload(payload *models.Error) *GetServerBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server backend not found response -func (o *GetServerBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServerBackendDefault General Error - -swagger:response getServerBackendDefault -*/ -type GetServerBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerBackendDefault creates GetServerBackendDefault with default headers values -func NewGetServerBackendDefault(code int) *GetServerBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetServerBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server backend default response -func (o *GetServerBackendDefault) WithStatusCode(code int) *GetServerBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server backend default response -func (o *GetServerBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server backend default response -func (o *GetServerBackendDefault) WithConfigurationVersion(configurationVersion string) *GetServerBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server backend default response -func (o *GetServerBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server backend default response -func (o *GetServerBackendDefault) WithPayload(payload *models.Error) *GetServerBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server backend default response -func (o *GetServerBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_server_backend_urlbuilder.go b/operations/server/get_server_backend_urlbuilder.go deleted file mode 100644 index 14c2f79b..00000000 --- a/operations/server/get_server_backend_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerBackendURL generates an URL for the get server backend operation -type GetServerBackendURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerBackendURL) WithBasePath(bp string) *GetServerBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetServerBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_server_peer.go b/operations/server/get_server_peer.go deleted file mode 100644 index a400e7bd..00000000 --- a/operations/server/get_server_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerPeerHandlerFunc turns a function with the right signature into a get server peer handler -type GetServerPeerHandlerFunc func(GetServerPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerPeerHandlerFunc) Handle(params GetServerPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerPeerHandler interface for that can handle valid get server peer params -type GetServerPeerHandler interface { - Handle(GetServerPeerParams, interface{}) middleware.Responder -} - -// NewGetServerPeer creates a new http.Handler for the get server peer operation -func NewGetServerPeer(ctx *middleware.Context, handler GetServerPeerHandler) *GetServerPeer { - return &GetServerPeer{Context: ctx, Handler: handler} -} - -/* - GetServerPeer swagger:route GET /services/haproxy/configuration/peers/{parent_name}/servers/{name} Server getServerPeer - -# Return one server - -Returns one server configuration by it's name in the specified backend. -*/ -type GetServerPeer struct { - Context *middleware.Context - Handler GetServerPeerHandler -} - -func (o *GetServerPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_server_peer_parameters.go b/operations/server/get_server_peer_parameters.go deleted file mode 100644 index 314b5649..00000000 --- a/operations/server/get_server_peer_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerPeerParams creates a new GetServerPeerParams object -// -// There are no default values defined in the spec. -func NewGetServerPeerParams() GetServerPeerParams { - - return GetServerPeerParams{} -} - -// GetServerPeerParams contains all the bound params for the get server peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerPeer -type GetServerPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerPeerParams() beforehand. -func (o *GetServerPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetServerPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_server_peer_responses.go b/operations/server/get_server_peer_responses.go deleted file mode 100644 index 0aa0b929..00000000 --- a/operations/server/get_server_peer_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerPeerOKCode is the HTTP code returned for type GetServerPeerOK -const GetServerPeerOKCode int = 200 - -/* -GetServerPeerOK Successful operation - -swagger:response getServerPeerOK -*/ -type GetServerPeerOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewGetServerPeerOK creates GetServerPeerOK with default headers values -func NewGetServerPeerOK() *GetServerPeerOK { - - return &GetServerPeerOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server peer o k response -func (o *GetServerPeerOK) WithConfigurationVersion(configurationVersion string) *GetServerPeerOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server peer o k response -func (o *GetServerPeerOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server peer o k response -func (o *GetServerPeerOK) WithPayload(payload *models.Server) *GetServerPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server peer o k response -func (o *GetServerPeerOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServerPeerNotFoundCode is the HTTP code returned for type GetServerPeerNotFound -const GetServerPeerNotFoundCode int = 404 - -/* -GetServerPeerNotFound The specified resource was not found - -swagger:response getServerPeerNotFound -*/ -type GetServerPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerPeerNotFound creates GetServerPeerNotFound with default headers values -func NewGetServerPeerNotFound() *GetServerPeerNotFound { - - return &GetServerPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server peer not found response -func (o *GetServerPeerNotFound) WithConfigurationVersion(configurationVersion string) *GetServerPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server peer not found response -func (o *GetServerPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server peer not found response -func (o *GetServerPeerNotFound) WithPayload(payload *models.Error) *GetServerPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server peer not found response -func (o *GetServerPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServerPeerDefault General Error - -swagger:response getServerPeerDefault -*/ -type GetServerPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerPeerDefault creates GetServerPeerDefault with default headers values -func NewGetServerPeerDefault(code int) *GetServerPeerDefault { - if code <= 0 { - code = 500 - } - - return &GetServerPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server peer default response -func (o *GetServerPeerDefault) WithStatusCode(code int) *GetServerPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server peer default response -func (o *GetServerPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server peer default response -func (o *GetServerPeerDefault) WithConfigurationVersion(configurationVersion string) *GetServerPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server peer default response -func (o *GetServerPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server peer default response -func (o *GetServerPeerDefault) WithPayload(payload *models.Error) *GetServerPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server peer default response -func (o *GetServerPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_server_peer_urlbuilder.go b/operations/server/get_server_peer_urlbuilder.go deleted file mode 100644 index 544f0e96..00000000 --- a/operations/server/get_server_peer_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerPeerURL generates an URL for the get server peer operation -type GetServerPeerURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerPeerURL) WithBasePath(bp string) *GetServerPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetServerPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/get_server_ring.go b/operations/server/get_server_ring.go deleted file mode 100644 index 4248d874..00000000 --- a/operations/server/get_server_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerRingHandlerFunc turns a function with the right signature into a get server ring handler -type GetServerRingHandlerFunc func(GetServerRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerRingHandlerFunc) Handle(params GetServerRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerRingHandler interface for that can handle valid get server ring params -type GetServerRingHandler interface { - Handle(GetServerRingParams, interface{}) middleware.Responder -} - -// NewGetServerRing creates a new http.Handler for the get server ring operation -func NewGetServerRing(ctx *middleware.Context, handler GetServerRingHandler) *GetServerRing { - return &GetServerRing{Context: ctx, Handler: handler} -} - -/* - GetServerRing swagger:route GET /services/haproxy/configuration/rings/{parent_name}/servers/{name} Server getServerRing - -# Return one server - -Returns one server configuration by it's name in the specified backend. -*/ -type GetServerRing struct { - Context *middleware.Context - Handler GetServerRingHandler -} - -func (o *GetServerRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/get_server_ring_parameters.go b/operations/server/get_server_ring_parameters.go deleted file mode 100644 index ebf089f3..00000000 --- a/operations/server/get_server_ring_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerRingParams creates a new GetServerRingParams object -// -// There are no default values defined in the spec. -func NewGetServerRingParams() GetServerRingParams { - - return GetServerRingParams{} -} - -// GetServerRingParams contains all the bound params for the get server ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerRing -type GetServerRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerRingParams() beforehand. -func (o *GetServerRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetServerRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerRingParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server/get_server_ring_responses.go b/operations/server/get_server_ring_responses.go deleted file mode 100644 index 3a49f251..00000000 --- a/operations/server/get_server_ring_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerRingOKCode is the HTTP code returned for type GetServerRingOK -const GetServerRingOKCode int = 200 - -/* -GetServerRingOK Successful operation - -swagger:response getServerRingOK -*/ -type GetServerRingOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewGetServerRingOK creates GetServerRingOK with default headers values -func NewGetServerRingOK() *GetServerRingOK { - - return &GetServerRingOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server ring o k response -func (o *GetServerRingOK) WithConfigurationVersion(configurationVersion string) *GetServerRingOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server ring o k response -func (o *GetServerRingOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server ring o k response -func (o *GetServerRingOK) WithPayload(payload *models.Server) *GetServerRingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server ring o k response -func (o *GetServerRingOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerRingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServerRingNotFoundCode is the HTTP code returned for type GetServerRingNotFound -const GetServerRingNotFoundCode int = 404 - -/* -GetServerRingNotFound The specified resource was not found - -swagger:response getServerRingNotFound -*/ -type GetServerRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerRingNotFound creates GetServerRingNotFound with default headers values -func NewGetServerRingNotFound() *GetServerRingNotFound { - - return &GetServerRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server ring not found response -func (o *GetServerRingNotFound) WithConfigurationVersion(configurationVersion string) *GetServerRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server ring not found response -func (o *GetServerRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server ring not found response -func (o *GetServerRingNotFound) WithPayload(payload *models.Error) *GetServerRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server ring not found response -func (o *GetServerRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServerRingDefault General Error - -swagger:response getServerRingDefault -*/ -type GetServerRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerRingDefault creates GetServerRingDefault with default headers values -func NewGetServerRingDefault(code int) *GetServerRingDefault { - if code <= 0 { - code = 500 - } - - return &GetServerRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server ring default response -func (o *GetServerRingDefault) WithStatusCode(code int) *GetServerRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server ring default response -func (o *GetServerRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server ring default response -func (o *GetServerRingDefault) WithConfigurationVersion(configurationVersion string) *GetServerRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server ring default response -func (o *GetServerRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server ring default response -func (o *GetServerRingDefault) WithPayload(payload *models.Error) *GetServerRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server ring default response -func (o *GetServerRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/get_server_ring_urlbuilder.go b/operations/server/get_server_ring_urlbuilder.go deleted file mode 100644 index be9228d9..00000000 --- a/operations/server/get_server_ring_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerRingURL generates an URL for the get server ring operation -type GetServerRingURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerRingURL) WithBasePath(bp string) *GetServerRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetServerRingURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/replace_runtime_server.go b/operations/server/replace_runtime_server.go deleted file mode 100644 index c5c49326..00000000 --- a/operations/server/replace_runtime_server.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceRuntimeServerHandlerFunc turns a function with the right signature into a replace runtime server handler -type ReplaceRuntimeServerHandlerFunc func(ReplaceRuntimeServerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceRuntimeServerHandlerFunc) Handle(params ReplaceRuntimeServerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceRuntimeServerHandler interface for that can handle valid replace runtime server params -type ReplaceRuntimeServerHandler interface { - Handle(ReplaceRuntimeServerParams, interface{}) middleware.Responder -} - -// NewReplaceRuntimeServer creates a new http.Handler for the replace runtime server operation -func NewReplaceRuntimeServer(ctx *middleware.Context, handler ReplaceRuntimeServerHandler) *ReplaceRuntimeServer { - return &ReplaceRuntimeServer{Context: ctx, Handler: handler} -} - -/* - ReplaceRuntimeServer swagger:route PUT /services/haproxy/runtime/backends/{parent_name}/servers/{name} Server replaceRuntimeServer - -# Replace server transient settings - -Replaces a server transient settings by it's name in the specified backend. -*/ -type ReplaceRuntimeServer struct { - Context *middleware.Context - Handler ReplaceRuntimeServerHandler -} - -func (o *ReplaceRuntimeServer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceRuntimeServerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/replace_runtime_server_parameters.go b/operations/server/replace_runtime_server_parameters.go deleted file mode 100644 index 21fd8a27..00000000 --- a/operations/server/replace_runtime_server_parameters.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceRuntimeServerParams creates a new ReplaceRuntimeServerParams object -// -// There are no default values defined in the spec. -func NewReplaceRuntimeServerParams() ReplaceRuntimeServerParams { - - return ReplaceRuntimeServerParams{} -} - -// ReplaceRuntimeServerParams contains all the bound params for the replace runtime server operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceRuntimeServer -type ReplaceRuntimeServerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.RuntimeServer - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceRuntimeServerParams() beforehand. -func (o *ReplaceRuntimeServerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.RuntimeServer - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceRuntimeServerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceRuntimeServerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/server/replace_runtime_server_responses.go b/operations/server/replace_runtime_server_responses.go deleted file mode 100644 index 3f1010d5..00000000 --- a/operations/server/replace_runtime_server_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceRuntimeServerOKCode is the HTTP code returned for type ReplaceRuntimeServerOK -const ReplaceRuntimeServerOKCode int = 200 - -/* -ReplaceRuntimeServerOK Server transient settings replaced - -swagger:response replaceRuntimeServerOK -*/ -type ReplaceRuntimeServerOK struct { - - /* - In: Body - */ - Payload *models.RuntimeServer `json:"body,omitempty"` -} - -// NewReplaceRuntimeServerOK creates ReplaceRuntimeServerOK with default headers values -func NewReplaceRuntimeServerOK() *ReplaceRuntimeServerOK { - - return &ReplaceRuntimeServerOK{} -} - -// WithPayload adds the payload to the replace runtime server o k response -func (o *ReplaceRuntimeServerOK) WithPayload(payload *models.RuntimeServer) *ReplaceRuntimeServerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime server o k response -func (o *ReplaceRuntimeServerOK) SetPayload(payload *models.RuntimeServer) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeServerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRuntimeServerBadRequestCode is the HTTP code returned for type ReplaceRuntimeServerBadRequest -const ReplaceRuntimeServerBadRequestCode int = 400 - -/* -ReplaceRuntimeServerBadRequest Bad request - -swagger:response replaceRuntimeServerBadRequest -*/ -type ReplaceRuntimeServerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeServerBadRequest creates ReplaceRuntimeServerBadRequest with default headers values -func NewReplaceRuntimeServerBadRequest() *ReplaceRuntimeServerBadRequest { - - return &ReplaceRuntimeServerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime server bad request response -func (o *ReplaceRuntimeServerBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeServerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime server bad request response -func (o *ReplaceRuntimeServerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime server bad request response -func (o *ReplaceRuntimeServerBadRequest) WithPayload(payload *models.Error) *ReplaceRuntimeServerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime server bad request response -func (o *ReplaceRuntimeServerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeServerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceRuntimeServerNotFoundCode is the HTTP code returned for type ReplaceRuntimeServerNotFound -const ReplaceRuntimeServerNotFoundCode int = 404 - -/* -ReplaceRuntimeServerNotFound The specified resource was not found - -swagger:response replaceRuntimeServerNotFound -*/ -type ReplaceRuntimeServerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeServerNotFound creates ReplaceRuntimeServerNotFound with default headers values -func NewReplaceRuntimeServerNotFound() *ReplaceRuntimeServerNotFound { - - return &ReplaceRuntimeServerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime server not found response -func (o *ReplaceRuntimeServerNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeServerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime server not found response -func (o *ReplaceRuntimeServerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime server not found response -func (o *ReplaceRuntimeServerNotFound) WithPayload(payload *models.Error) *ReplaceRuntimeServerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime server not found response -func (o *ReplaceRuntimeServerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeServerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceRuntimeServerDefault General Error - -swagger:response replaceRuntimeServerDefault -*/ -type ReplaceRuntimeServerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceRuntimeServerDefault creates ReplaceRuntimeServerDefault with default headers values -func NewReplaceRuntimeServerDefault(code int) *ReplaceRuntimeServerDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceRuntimeServerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) WithStatusCode(code int) *ReplaceRuntimeServerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) WithConfigurationVersion(configurationVersion string) *ReplaceRuntimeServerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) WithPayload(payload *models.Error) *ReplaceRuntimeServerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace runtime server default response -func (o *ReplaceRuntimeServerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceRuntimeServerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/replace_runtime_server_urlbuilder.go b/operations/server/replace_runtime_server_urlbuilder.go deleted file mode 100644 index af0b6292..00000000 --- a/operations/server/replace_runtime_server_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ReplaceRuntimeServerURL generates an URL for the replace runtime server operation -type ReplaceRuntimeServerURL struct { - Name string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRuntimeServerURL) WithBasePath(bp string) *ReplaceRuntimeServerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceRuntimeServerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceRuntimeServerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceRuntimeServerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceRuntimeServerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceRuntimeServerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceRuntimeServerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceRuntimeServerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceRuntimeServerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceRuntimeServerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceRuntimeServerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/replace_server_backend.go b/operations/server/replace_server_backend.go deleted file mode 100644 index 2625f055..00000000 --- a/operations/server/replace_server_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerBackendHandlerFunc turns a function with the right signature into a replace server backend handler -type ReplaceServerBackendHandlerFunc func(ReplaceServerBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerBackendHandlerFunc) Handle(params ReplaceServerBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerBackendHandler interface for that can handle valid replace server backend params -type ReplaceServerBackendHandler interface { - Handle(ReplaceServerBackendParams, interface{}) middleware.Responder -} - -// NewReplaceServerBackend creates a new http.Handler for the replace server backend operation -func NewReplaceServerBackend(ctx *middleware.Context, handler ReplaceServerBackendHandler) *ReplaceServerBackend { - return &ReplaceServerBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceServerBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/servers/{name} Server replaceServerBackend - -# Replace a server - -Replaces a server configuration by it's name in the specified backend. -*/ -type ReplaceServerBackend struct { - Context *middleware.Context - Handler ReplaceServerBackendHandler -} - -func (o *ReplaceServerBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/replace_server_backend_parameters.go b/operations/server/replace_server_backend_parameters.go deleted file mode 100644 index 816221fb..00000000 --- a/operations/server/replace_server_backend_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerBackendParams creates a new ReplaceServerBackendParams object -// with the default values initialized. -func NewReplaceServerBackendParams() ReplaceServerBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerBackendParams contains all the bound params for the replace server backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerBackend -type ReplaceServerBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerBackendParams() beforehand. -func (o *ReplaceServerBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceServerBackendParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/replace_server_backend_responses.go b/operations/server/replace_server_backend_responses.go deleted file mode 100644 index 117c855f..00000000 --- a/operations/server/replace_server_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerBackendOKCode is the HTTP code returned for type ReplaceServerBackendOK -const ReplaceServerBackendOKCode int = 200 - -/* -ReplaceServerBackendOK Server replaced - -swagger:response replaceServerBackendOK -*/ -type ReplaceServerBackendOK struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerBackendOK creates ReplaceServerBackendOK with default headers values -func NewReplaceServerBackendOK() *ReplaceServerBackendOK { - - return &ReplaceServerBackendOK{} -} - -// WithPayload adds the payload to the replace server backend o k response -func (o *ReplaceServerBackendOK) WithPayload(payload *models.Server) *ReplaceServerBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server backend o k response -func (o *ReplaceServerBackendOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerBackendAcceptedCode is the HTTP code returned for type ReplaceServerBackendAccepted -const ReplaceServerBackendAcceptedCode int = 202 - -/* -ReplaceServerBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceServerBackendAccepted -*/ -type ReplaceServerBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerBackendAccepted creates ReplaceServerBackendAccepted with default headers values -func NewReplaceServerBackendAccepted() *ReplaceServerBackendAccepted { - - return &ReplaceServerBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace server backend accepted response -func (o *ReplaceServerBackendAccepted) WithReloadID(reloadID string) *ReplaceServerBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server backend accepted response -func (o *ReplaceServerBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server backend accepted response -func (o *ReplaceServerBackendAccepted) WithPayload(payload *models.Server) *ReplaceServerBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server backend accepted response -func (o *ReplaceServerBackendAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerBackendBadRequestCode is the HTTP code returned for type ReplaceServerBackendBadRequest -const ReplaceServerBackendBadRequestCode int = 400 - -/* -ReplaceServerBackendBadRequest Bad request - -swagger:response replaceServerBackendBadRequest -*/ -type ReplaceServerBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerBackendBadRequest creates ReplaceServerBackendBadRequest with default headers values -func NewReplaceServerBackendBadRequest() *ReplaceServerBackendBadRequest { - - return &ReplaceServerBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server backend bad request response -func (o *ReplaceServerBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server backend bad request response -func (o *ReplaceServerBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server backend bad request response -func (o *ReplaceServerBackendBadRequest) WithPayload(payload *models.Error) *ReplaceServerBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server backend bad request response -func (o *ReplaceServerBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerBackendNotFoundCode is the HTTP code returned for type ReplaceServerBackendNotFound -const ReplaceServerBackendNotFoundCode int = 404 - -/* -ReplaceServerBackendNotFound The specified resource was not found - -swagger:response replaceServerBackendNotFound -*/ -type ReplaceServerBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerBackendNotFound creates ReplaceServerBackendNotFound with default headers values -func NewReplaceServerBackendNotFound() *ReplaceServerBackendNotFound { - - return &ReplaceServerBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server backend not found response -func (o *ReplaceServerBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceServerBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server backend not found response -func (o *ReplaceServerBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server backend not found response -func (o *ReplaceServerBackendNotFound) WithPayload(payload *models.Error) *ReplaceServerBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server backend not found response -func (o *ReplaceServerBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerBackendDefault General Error - -swagger:response replaceServerBackendDefault -*/ -type ReplaceServerBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerBackendDefault creates ReplaceServerBackendDefault with default headers values -func NewReplaceServerBackendDefault(code int) *ReplaceServerBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server backend default response -func (o *ReplaceServerBackendDefault) WithStatusCode(code int) *ReplaceServerBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server backend default response -func (o *ReplaceServerBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server backend default response -func (o *ReplaceServerBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server backend default response -func (o *ReplaceServerBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server backend default response -func (o *ReplaceServerBackendDefault) WithPayload(payload *models.Error) *ReplaceServerBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server backend default response -func (o *ReplaceServerBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/replace_server_backend_urlbuilder.go b/operations/server/replace_server_backend_urlbuilder.go deleted file mode 100644 index 5470aa21..00000000 --- a/operations/server/replace_server_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerBackendURL generates an URL for the replace server backend operation -type ReplaceServerBackendURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerBackendURL) WithBasePath(bp string) *ReplaceServerBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceServerBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/replace_server_peer.go b/operations/server/replace_server_peer.go deleted file mode 100644 index 9b0251e6..00000000 --- a/operations/server/replace_server_peer.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerPeerHandlerFunc turns a function with the right signature into a replace server peer handler -type ReplaceServerPeerHandlerFunc func(ReplaceServerPeerParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerPeerHandlerFunc) Handle(params ReplaceServerPeerParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerPeerHandler interface for that can handle valid replace server peer params -type ReplaceServerPeerHandler interface { - Handle(ReplaceServerPeerParams, interface{}) middleware.Responder -} - -// NewReplaceServerPeer creates a new http.Handler for the replace server peer operation -func NewReplaceServerPeer(ctx *middleware.Context, handler ReplaceServerPeerHandler) *ReplaceServerPeer { - return &ReplaceServerPeer{Context: ctx, Handler: handler} -} - -/* - ReplaceServerPeer swagger:route PUT /services/haproxy/configuration/peers/{parent_name}/servers/{name} Server replaceServerPeer - -# Replace a server - -Replaces a server configuration by it's name in the specified backend. -*/ -type ReplaceServerPeer struct { - Context *middleware.Context - Handler ReplaceServerPeerHandler -} - -func (o *ReplaceServerPeer) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerPeerParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/replace_server_peer_parameters.go b/operations/server/replace_server_peer_parameters.go deleted file mode 100644 index 8149b2de..00000000 --- a/operations/server/replace_server_peer_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerPeerParams creates a new ReplaceServerPeerParams object -// with the default values initialized. -func NewReplaceServerPeerParams() ReplaceServerPeerParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerPeerParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerPeerParams contains all the bound params for the replace server peer operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerPeer -type ReplaceServerPeerParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerPeerParams() beforehand. -func (o *ReplaceServerPeerParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerPeerParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerPeerParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceServerPeerParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerPeerParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerPeerParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerPeerParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/replace_server_peer_responses.go b/operations/server/replace_server_peer_responses.go deleted file mode 100644 index 8767893e..00000000 --- a/operations/server/replace_server_peer_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerPeerOKCode is the HTTP code returned for type ReplaceServerPeerOK -const ReplaceServerPeerOKCode int = 200 - -/* -ReplaceServerPeerOK Server replaced - -swagger:response replaceServerPeerOK -*/ -type ReplaceServerPeerOK struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerPeerOK creates ReplaceServerPeerOK with default headers values -func NewReplaceServerPeerOK() *ReplaceServerPeerOK { - - return &ReplaceServerPeerOK{} -} - -// WithPayload adds the payload to the replace server peer o k response -func (o *ReplaceServerPeerOK) WithPayload(payload *models.Server) *ReplaceServerPeerOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server peer o k response -func (o *ReplaceServerPeerOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerPeerOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerPeerAcceptedCode is the HTTP code returned for type ReplaceServerPeerAccepted -const ReplaceServerPeerAcceptedCode int = 202 - -/* -ReplaceServerPeerAccepted Configuration change accepted and reload requested - -swagger:response replaceServerPeerAccepted -*/ -type ReplaceServerPeerAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerPeerAccepted creates ReplaceServerPeerAccepted with default headers values -func NewReplaceServerPeerAccepted() *ReplaceServerPeerAccepted { - - return &ReplaceServerPeerAccepted{} -} - -// WithReloadID adds the reloadId to the replace server peer accepted response -func (o *ReplaceServerPeerAccepted) WithReloadID(reloadID string) *ReplaceServerPeerAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server peer accepted response -func (o *ReplaceServerPeerAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server peer accepted response -func (o *ReplaceServerPeerAccepted) WithPayload(payload *models.Server) *ReplaceServerPeerAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server peer accepted response -func (o *ReplaceServerPeerAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerPeerAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerPeerBadRequestCode is the HTTP code returned for type ReplaceServerPeerBadRequest -const ReplaceServerPeerBadRequestCode int = 400 - -/* -ReplaceServerPeerBadRequest Bad request - -swagger:response replaceServerPeerBadRequest -*/ -type ReplaceServerPeerBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerPeerBadRequest creates ReplaceServerPeerBadRequest with default headers values -func NewReplaceServerPeerBadRequest() *ReplaceServerPeerBadRequest { - - return &ReplaceServerPeerBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server peer bad request response -func (o *ReplaceServerPeerBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerPeerBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server peer bad request response -func (o *ReplaceServerPeerBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server peer bad request response -func (o *ReplaceServerPeerBadRequest) WithPayload(payload *models.Error) *ReplaceServerPeerBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server peer bad request response -func (o *ReplaceServerPeerBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerPeerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerPeerNotFoundCode is the HTTP code returned for type ReplaceServerPeerNotFound -const ReplaceServerPeerNotFoundCode int = 404 - -/* -ReplaceServerPeerNotFound The specified resource was not found - -swagger:response replaceServerPeerNotFound -*/ -type ReplaceServerPeerNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerPeerNotFound creates ReplaceServerPeerNotFound with default headers values -func NewReplaceServerPeerNotFound() *ReplaceServerPeerNotFound { - - return &ReplaceServerPeerNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server peer not found response -func (o *ReplaceServerPeerNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceServerPeerNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server peer not found response -func (o *ReplaceServerPeerNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server peer not found response -func (o *ReplaceServerPeerNotFound) WithPayload(payload *models.Error) *ReplaceServerPeerNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server peer not found response -func (o *ReplaceServerPeerNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerPeerNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerPeerDefault General Error - -swagger:response replaceServerPeerDefault -*/ -type ReplaceServerPeerDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerPeerDefault creates ReplaceServerPeerDefault with default headers values -func NewReplaceServerPeerDefault(code int) *ReplaceServerPeerDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerPeerDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server peer default response -func (o *ReplaceServerPeerDefault) WithStatusCode(code int) *ReplaceServerPeerDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server peer default response -func (o *ReplaceServerPeerDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server peer default response -func (o *ReplaceServerPeerDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerPeerDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server peer default response -func (o *ReplaceServerPeerDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server peer default response -func (o *ReplaceServerPeerDefault) WithPayload(payload *models.Error) *ReplaceServerPeerDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server peer default response -func (o *ReplaceServerPeerDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerPeerDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/replace_server_peer_urlbuilder.go b/operations/server/replace_server_peer_urlbuilder.go deleted file mode 100644 index 3d325281..00000000 --- a/operations/server/replace_server_peer_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerPeerURL generates an URL for the replace server peer operation -type ReplaceServerPeerURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerPeerURL) WithBasePath(bp string) *ReplaceServerPeerURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerPeerURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerPeerURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceServerPeerURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerPeerURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerPeerURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerPeerURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerPeerURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerPeerURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerPeerURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerPeerURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server/replace_server_ring.go b/operations/server/replace_server_ring.go deleted file mode 100644 index 3b9055a2..00000000 --- a/operations/server/replace_server_ring.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerRingHandlerFunc turns a function with the right signature into a replace server ring handler -type ReplaceServerRingHandlerFunc func(ReplaceServerRingParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerRingHandlerFunc) Handle(params ReplaceServerRingParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerRingHandler interface for that can handle valid replace server ring params -type ReplaceServerRingHandler interface { - Handle(ReplaceServerRingParams, interface{}) middleware.Responder -} - -// NewReplaceServerRing creates a new http.Handler for the replace server ring operation -func NewReplaceServerRing(ctx *middleware.Context, handler ReplaceServerRingHandler) *ReplaceServerRing { - return &ReplaceServerRing{Context: ctx, Handler: handler} -} - -/* - ReplaceServerRing swagger:route PUT /services/haproxy/configuration/rings/{parent_name}/servers/{name} Server replaceServerRing - -# Replace a server - -Replaces a server configuration by it's name in the specified backend. -*/ -type ReplaceServerRing struct { - Context *middleware.Context - Handler ReplaceServerRingHandler -} - -func (o *ReplaceServerRing) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerRingParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server/replace_server_ring_parameters.go b/operations/server/replace_server_ring_parameters.go deleted file mode 100644 index 542aa0fc..00000000 --- a/operations/server/replace_server_ring_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerRingParams creates a new ReplaceServerRingParams object -// with the default values initialized. -func NewReplaceServerRingParams() ReplaceServerRingParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerRingParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerRingParams contains all the bound params for the replace server ring operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerRing -type ReplaceServerRingParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Server - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Server name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerRingParams() beforehand. -func (o *ReplaceServerRingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Server - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerRingParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerRingParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceServerRingParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerRingParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerRingParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerRingParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server/replace_server_ring_responses.go b/operations/server/replace_server_ring_responses.go deleted file mode 100644 index 420a9c61..00000000 --- a/operations/server/replace_server_ring_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerRingOKCode is the HTTP code returned for type ReplaceServerRingOK -const ReplaceServerRingOKCode int = 200 - -/* -ReplaceServerRingOK Server replaced - -swagger:response replaceServerRingOK -*/ -type ReplaceServerRingOK struct { - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerRingOK creates ReplaceServerRingOK with default headers values -func NewReplaceServerRingOK() *ReplaceServerRingOK { - - return &ReplaceServerRingOK{} -} - -// WithPayload adds the payload to the replace server ring o k response -func (o *ReplaceServerRingOK) WithPayload(payload *models.Server) *ReplaceServerRingOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server ring o k response -func (o *ReplaceServerRingOK) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerRingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerRingAcceptedCode is the HTTP code returned for type ReplaceServerRingAccepted -const ReplaceServerRingAcceptedCode int = 202 - -/* -ReplaceServerRingAccepted Configuration change accepted and reload requested - -swagger:response replaceServerRingAccepted -*/ -type ReplaceServerRingAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Server `json:"body,omitempty"` -} - -// NewReplaceServerRingAccepted creates ReplaceServerRingAccepted with default headers values -func NewReplaceServerRingAccepted() *ReplaceServerRingAccepted { - - return &ReplaceServerRingAccepted{} -} - -// WithReloadID adds the reloadId to the replace server ring accepted response -func (o *ReplaceServerRingAccepted) WithReloadID(reloadID string) *ReplaceServerRingAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server ring accepted response -func (o *ReplaceServerRingAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server ring accepted response -func (o *ReplaceServerRingAccepted) WithPayload(payload *models.Server) *ReplaceServerRingAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server ring accepted response -func (o *ReplaceServerRingAccepted) SetPayload(payload *models.Server) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerRingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerRingBadRequestCode is the HTTP code returned for type ReplaceServerRingBadRequest -const ReplaceServerRingBadRequestCode int = 400 - -/* -ReplaceServerRingBadRequest Bad request - -swagger:response replaceServerRingBadRequest -*/ -type ReplaceServerRingBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerRingBadRequest creates ReplaceServerRingBadRequest with default headers values -func NewReplaceServerRingBadRequest() *ReplaceServerRingBadRequest { - - return &ReplaceServerRingBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server ring bad request response -func (o *ReplaceServerRingBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerRingBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server ring bad request response -func (o *ReplaceServerRingBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server ring bad request response -func (o *ReplaceServerRingBadRequest) WithPayload(payload *models.Error) *ReplaceServerRingBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server ring bad request response -func (o *ReplaceServerRingBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerRingBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerRingNotFoundCode is the HTTP code returned for type ReplaceServerRingNotFound -const ReplaceServerRingNotFoundCode int = 404 - -/* -ReplaceServerRingNotFound The specified resource was not found - -swagger:response replaceServerRingNotFound -*/ -type ReplaceServerRingNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerRingNotFound creates ReplaceServerRingNotFound with default headers values -func NewReplaceServerRingNotFound() *ReplaceServerRingNotFound { - - return &ReplaceServerRingNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server ring not found response -func (o *ReplaceServerRingNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceServerRingNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server ring not found response -func (o *ReplaceServerRingNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server ring not found response -func (o *ReplaceServerRingNotFound) WithPayload(payload *models.Error) *ReplaceServerRingNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server ring not found response -func (o *ReplaceServerRingNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerRingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerRingDefault General Error - -swagger:response replaceServerRingDefault -*/ -type ReplaceServerRingDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerRingDefault creates ReplaceServerRingDefault with default headers values -func NewReplaceServerRingDefault(code int) *ReplaceServerRingDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerRingDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server ring default response -func (o *ReplaceServerRingDefault) WithStatusCode(code int) *ReplaceServerRingDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server ring default response -func (o *ReplaceServerRingDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server ring default response -func (o *ReplaceServerRingDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerRingDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server ring default response -func (o *ReplaceServerRingDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server ring default response -func (o *ReplaceServerRingDefault) WithPayload(payload *models.Error) *ReplaceServerRingDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server ring default response -func (o *ReplaceServerRingDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerRingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server/replace_server_ring_urlbuilder.go b/operations/server/replace_server_ring_urlbuilder.go deleted file mode 100644 index edc27772..00000000 --- a/operations/server/replace_server_ring_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerRingURL generates an URL for the replace server ring operation -type ReplaceServerRingURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerRingURL) WithBasePath(bp string) *ReplaceServerRingURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerRingURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerRingURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/rings/{parent_name}/servers/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceServerRingURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerRingURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerRingURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerRingURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerRingURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerRingURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerRingURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerRingURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/create_server_switching_rule.go b/operations/server_switching_rule/create_server_switching_rule.go deleted file mode 100644 index 34c56405..00000000 --- a/operations/server_switching_rule/create_server_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateServerSwitchingRuleHandlerFunc turns a function with the right signature into a create server switching rule handler -type CreateServerSwitchingRuleHandlerFunc func(CreateServerSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServerSwitchingRuleHandlerFunc) Handle(params CreateServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateServerSwitchingRuleHandler interface for that can handle valid create server switching rule params -type CreateServerSwitchingRuleHandler interface { - Handle(CreateServerSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewCreateServerSwitchingRule creates a new http.Handler for the create server switching rule operation -func NewCreateServerSwitchingRule(ctx *middleware.Context, handler CreateServerSwitchingRuleHandler) *CreateServerSwitchingRule { - return &CreateServerSwitchingRule{Context: ctx, Handler: handler} -} - -/* - CreateServerSwitchingRule swagger:route POST /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index} ServerSwitchingRule createServerSwitchingRule - -# Add a new Server Switching Rule - -Adds a new Server Switching Rule of the specified type in the specified backend. -*/ -type CreateServerSwitchingRule struct { - Context *middleware.Context - Handler CreateServerSwitchingRuleHandler -} - -func (o *CreateServerSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServerSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/create_server_switching_rule_parameters.go b/operations/server_switching_rule/create_server_switching_rule_parameters.go deleted file mode 100644 index d9db693a..00000000 --- a/operations/server_switching_rule/create_server_switching_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateServerSwitchingRuleParams creates a new CreateServerSwitchingRuleParams object -// with the default values initialized. -func NewCreateServerSwitchingRuleParams() CreateServerSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateServerSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateServerSwitchingRuleParams contains all the bound params for the create server switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters createServerSwitchingRule -type CreateServerSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ServerSwitchingRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateServerSwitchingRuleParams() beforehand. -func (o *CreateServerSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ServerSwitchingRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateServerSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateServerSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateServerSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateServerSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateServerSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateServerSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_switching_rule/create_server_switching_rule_responses.go b/operations/server_switching_rule/create_server_switching_rule_responses.go deleted file mode 100644 index 7a8a879b..00000000 --- a/operations/server_switching_rule/create_server_switching_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateServerSwitchingRuleCreatedCode is the HTTP code returned for type CreateServerSwitchingRuleCreated -const CreateServerSwitchingRuleCreatedCode int = 201 - -/* -CreateServerSwitchingRuleCreated Server Switching Rule created - -swagger:response createServerSwitchingRuleCreated -*/ -type CreateServerSwitchingRuleCreated struct { - - /* - In: Body - */ - Payload *models.ServerSwitchingRule `json:"body,omitempty"` -} - -// NewCreateServerSwitchingRuleCreated creates CreateServerSwitchingRuleCreated with default headers values -func NewCreateServerSwitchingRuleCreated() *CreateServerSwitchingRuleCreated { - - return &CreateServerSwitchingRuleCreated{} -} - -// WithPayload adds the payload to the create server switching rule created response -func (o *CreateServerSwitchingRuleCreated) WithPayload(payload *models.ServerSwitchingRule) *CreateServerSwitchingRuleCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server switching rule created response -func (o *CreateServerSwitchingRuleCreated) SetPayload(payload *models.ServerSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerSwitchingRuleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerSwitchingRuleAcceptedCode is the HTTP code returned for type CreateServerSwitchingRuleAccepted -const CreateServerSwitchingRuleAcceptedCode int = 202 - -/* -CreateServerSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response createServerSwitchingRuleAccepted -*/ -type CreateServerSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ServerSwitchingRule `json:"body,omitempty"` -} - -// NewCreateServerSwitchingRuleAccepted creates CreateServerSwitchingRuleAccepted with default headers values -func NewCreateServerSwitchingRuleAccepted() *CreateServerSwitchingRuleAccepted { - - return &CreateServerSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the create server switching rule accepted response -func (o *CreateServerSwitchingRuleAccepted) WithReloadID(reloadID string) *CreateServerSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create server switching rule accepted response -func (o *CreateServerSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create server switching rule accepted response -func (o *CreateServerSwitchingRuleAccepted) WithPayload(payload *models.ServerSwitchingRule) *CreateServerSwitchingRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server switching rule accepted response -func (o *CreateServerSwitchingRuleAccepted) SetPayload(payload *models.ServerSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerSwitchingRuleBadRequestCode is the HTTP code returned for type CreateServerSwitchingRuleBadRequest -const CreateServerSwitchingRuleBadRequestCode int = 400 - -/* -CreateServerSwitchingRuleBadRequest Bad request - -swagger:response createServerSwitchingRuleBadRequest -*/ -type CreateServerSwitchingRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerSwitchingRuleBadRequest creates CreateServerSwitchingRuleBadRequest with default headers values -func NewCreateServerSwitchingRuleBadRequest() *CreateServerSwitchingRuleBadRequest { - - return &CreateServerSwitchingRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server switching rule bad request response -func (o *CreateServerSwitchingRuleBadRequest) WithConfigurationVersion(configurationVersion string) *CreateServerSwitchingRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server switching rule bad request response -func (o *CreateServerSwitchingRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server switching rule bad request response -func (o *CreateServerSwitchingRuleBadRequest) WithPayload(payload *models.Error) *CreateServerSwitchingRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server switching rule bad request response -func (o *CreateServerSwitchingRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerSwitchingRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerSwitchingRuleConflictCode is the HTTP code returned for type CreateServerSwitchingRuleConflict -const CreateServerSwitchingRuleConflictCode int = 409 - -/* -CreateServerSwitchingRuleConflict The specified resource already exists - -swagger:response createServerSwitchingRuleConflict -*/ -type CreateServerSwitchingRuleConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerSwitchingRuleConflict creates CreateServerSwitchingRuleConflict with default headers values -func NewCreateServerSwitchingRuleConflict() *CreateServerSwitchingRuleConflict { - - return &CreateServerSwitchingRuleConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server switching rule conflict response -func (o *CreateServerSwitchingRuleConflict) WithConfigurationVersion(configurationVersion string) *CreateServerSwitchingRuleConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server switching rule conflict response -func (o *CreateServerSwitchingRuleConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server switching rule conflict response -func (o *CreateServerSwitchingRuleConflict) WithPayload(payload *models.Error) *CreateServerSwitchingRuleConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server switching rule conflict response -func (o *CreateServerSwitchingRuleConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerSwitchingRuleConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServerSwitchingRuleDefault General Error - -swagger:response createServerSwitchingRuleDefault -*/ -type CreateServerSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerSwitchingRuleDefault creates CreateServerSwitchingRuleDefault with default headers values -func NewCreateServerSwitchingRuleDefault(code int) *CreateServerSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &CreateServerSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) WithStatusCode(code int) *CreateServerSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *CreateServerSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) WithPayload(payload *models.Error) *CreateServerSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server switching rule default response -func (o *CreateServerSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/create_server_switching_rule_urlbuilder.go b/operations/server_switching_rule/create_server_switching_rule_urlbuilder.go deleted file mode 100644 index 99afacfc..00000000 --- a/operations/server_switching_rule/create_server_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateServerSwitchingRuleURL generates an URL for the create server switching rule operation -type CreateServerSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerSwitchingRuleURL) WithBasePath(bp string) *CreateServerSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServerSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateServerSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateServerSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateServerSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateServerSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServerSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServerSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServerSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateServerSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/delete_server_switching_rule.go b/operations/server_switching_rule/delete_server_switching_rule.go deleted file mode 100644 index bb31f4c3..00000000 --- a/operations/server_switching_rule/delete_server_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServerSwitchingRuleHandlerFunc turns a function with the right signature into a delete server switching rule handler -type DeleteServerSwitchingRuleHandlerFunc func(DeleteServerSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServerSwitchingRuleHandlerFunc) Handle(params DeleteServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServerSwitchingRuleHandler interface for that can handle valid delete server switching rule params -type DeleteServerSwitchingRuleHandler interface { - Handle(DeleteServerSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewDeleteServerSwitchingRule creates a new http.Handler for the delete server switching rule operation -func NewDeleteServerSwitchingRule(ctx *middleware.Context, handler DeleteServerSwitchingRuleHandler) *DeleteServerSwitchingRule { - return &DeleteServerSwitchingRule{Context: ctx, Handler: handler} -} - -/* - DeleteServerSwitchingRule swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index} ServerSwitchingRule deleteServerSwitchingRule - -# Delete a Server Switching Rule - -Deletes a Server Switching Rule configuration by it's index from the specified backend. -*/ -type DeleteServerSwitchingRule struct { - Context *middleware.Context - Handler DeleteServerSwitchingRuleHandler -} - -func (o *DeleteServerSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServerSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/delete_server_switching_rule_parameters.go b/operations/server_switching_rule/delete_server_switching_rule_parameters.go deleted file mode 100644 index 9524aabf..00000000 --- a/operations/server_switching_rule/delete_server_switching_rule_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServerSwitchingRuleParams creates a new DeleteServerSwitchingRuleParams object -// with the default values initialized. -func NewDeleteServerSwitchingRuleParams() DeleteServerSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteServerSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteServerSwitchingRuleParams contains all the bound params for the delete server switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteServerSwitchingRule -type DeleteServerSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServerSwitchingRuleParams() beforehand. -func (o *DeleteServerSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteServerSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteServerSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteServerSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServerSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteServerSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteServerSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_switching_rule/delete_server_switching_rule_responses.go b/operations/server_switching_rule/delete_server_switching_rule_responses.go deleted file mode 100644 index 23fd47af..00000000 --- a/operations/server_switching_rule/delete_server_switching_rule_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServerSwitchingRuleAcceptedCode is the HTTP code returned for type DeleteServerSwitchingRuleAccepted -const DeleteServerSwitchingRuleAcceptedCode int = 202 - -/* -DeleteServerSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response deleteServerSwitchingRuleAccepted -*/ -type DeleteServerSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteServerSwitchingRuleAccepted creates DeleteServerSwitchingRuleAccepted with default headers values -func NewDeleteServerSwitchingRuleAccepted() *DeleteServerSwitchingRuleAccepted { - - return &DeleteServerSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the delete server switching rule accepted response -func (o *DeleteServerSwitchingRuleAccepted) WithReloadID(reloadID string) *DeleteServerSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete server switching rule accepted response -func (o *DeleteServerSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteServerSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteServerSwitchingRuleNoContentCode is the HTTP code returned for type DeleteServerSwitchingRuleNoContent -const DeleteServerSwitchingRuleNoContentCode int = 204 - -/* -DeleteServerSwitchingRuleNoContent Server Switching Rule deleted - -swagger:response deleteServerSwitchingRuleNoContent -*/ -type DeleteServerSwitchingRuleNoContent struct { -} - -// NewDeleteServerSwitchingRuleNoContent creates DeleteServerSwitchingRuleNoContent with default headers values -func NewDeleteServerSwitchingRuleNoContent() *DeleteServerSwitchingRuleNoContent { - - return &DeleteServerSwitchingRuleNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServerSwitchingRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServerSwitchingRuleNotFoundCode is the HTTP code returned for type DeleteServerSwitchingRuleNotFound -const DeleteServerSwitchingRuleNotFoundCode int = 404 - -/* -DeleteServerSwitchingRuleNotFound The specified resource was not found - -swagger:response deleteServerSwitchingRuleNotFound -*/ -type DeleteServerSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerSwitchingRuleNotFound creates DeleteServerSwitchingRuleNotFound with default headers values -func NewDeleteServerSwitchingRuleNotFound() *DeleteServerSwitchingRuleNotFound { - - return &DeleteServerSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete server switching rule not found response -func (o *DeleteServerSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServerSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server switching rule not found response -func (o *DeleteServerSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server switching rule not found response -func (o *DeleteServerSwitchingRuleNotFound) WithPayload(payload *models.Error) *DeleteServerSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server switching rule not found response -func (o *DeleteServerSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServerSwitchingRuleDefault General Error - -swagger:response deleteServerSwitchingRuleDefault -*/ -type DeleteServerSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerSwitchingRuleDefault creates DeleteServerSwitchingRuleDefault with default headers values -func NewDeleteServerSwitchingRuleDefault(code int) *DeleteServerSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServerSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) WithStatusCode(code int) *DeleteServerSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *DeleteServerSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) WithPayload(payload *models.Error) *DeleteServerSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server switching rule default response -func (o *DeleteServerSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/delete_server_switching_rule_urlbuilder.go b/operations/server_switching_rule/delete_server_switching_rule_urlbuilder.go deleted file mode 100644 index f8bf3f7c..00000000 --- a/operations/server_switching_rule/delete_server_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteServerSwitchingRuleURL generates an URL for the delete server switching rule operation -type DeleteServerSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerSwitchingRuleURL) WithBasePath(bp string) *DeleteServerSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServerSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteServerSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServerSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServerSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServerSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServerSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServerSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServerSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServerSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/get_server_switching_rule.go b/operations/server_switching_rule/get_server_switching_rule.go deleted file mode 100644 index 80f407b4..00000000 --- a/operations/server_switching_rule/get_server_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerSwitchingRuleHandlerFunc turns a function with the right signature into a get server switching rule handler -type GetServerSwitchingRuleHandlerFunc func(GetServerSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerSwitchingRuleHandlerFunc) Handle(params GetServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerSwitchingRuleHandler interface for that can handle valid get server switching rule params -type GetServerSwitchingRuleHandler interface { - Handle(GetServerSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewGetServerSwitchingRule creates a new http.Handler for the get server switching rule operation -func NewGetServerSwitchingRule(ctx *middleware.Context, handler GetServerSwitchingRuleHandler) *GetServerSwitchingRule { - return &GetServerSwitchingRule{Context: ctx, Handler: handler} -} - -/* - GetServerSwitchingRule swagger:route GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index} ServerSwitchingRule getServerSwitchingRule - -# Return one Server Switching Rule - -Returns one Server Switching Rule configuration by it's index in the specified backend. -*/ -type GetServerSwitchingRule struct { - Context *middleware.Context - Handler GetServerSwitchingRuleHandler -} - -func (o *GetServerSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/get_server_switching_rule_parameters.go b/operations/server_switching_rule/get_server_switching_rule_parameters.go deleted file mode 100644 index b2060b50..00000000 --- a/operations/server_switching_rule/get_server_switching_rule_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetServerSwitchingRuleParams creates a new GetServerSwitchingRuleParams object -// -// There are no default values defined in the spec. -func NewGetServerSwitchingRuleParams() GetServerSwitchingRuleParams { - - return GetServerSwitchingRuleParams{} -} - -// GetServerSwitchingRuleParams contains all the bound params for the get server switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerSwitchingRule -type GetServerSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerSwitchingRuleParams() beforehand. -func (o *GetServerSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetServerSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server_switching_rule/get_server_switching_rule_responses.go b/operations/server_switching_rule/get_server_switching_rule_responses.go deleted file mode 100644 index ec4dbfc1..00000000 --- a/operations/server_switching_rule/get_server_switching_rule_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerSwitchingRuleOKCode is the HTTP code returned for type GetServerSwitchingRuleOK -const GetServerSwitchingRuleOKCode int = 200 - -/* -GetServerSwitchingRuleOK Successful operation - -swagger:response getServerSwitchingRuleOK -*/ -type GetServerSwitchingRuleOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ServerSwitchingRule `json:"body,omitempty"` -} - -// NewGetServerSwitchingRuleOK creates GetServerSwitchingRuleOK with default headers values -func NewGetServerSwitchingRuleOK() *GetServerSwitchingRuleOK { - - return &GetServerSwitchingRuleOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server switching rule o k response -func (o *GetServerSwitchingRuleOK) WithConfigurationVersion(configurationVersion string) *GetServerSwitchingRuleOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server switching rule o k response -func (o *GetServerSwitchingRuleOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server switching rule o k response -func (o *GetServerSwitchingRuleOK) WithPayload(payload *models.ServerSwitchingRule) *GetServerSwitchingRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server switching rule o k response -func (o *GetServerSwitchingRuleOK) SetPayload(payload *models.ServerSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerSwitchingRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServerSwitchingRuleNotFoundCode is the HTTP code returned for type GetServerSwitchingRuleNotFound -const GetServerSwitchingRuleNotFoundCode int = 404 - -/* -GetServerSwitchingRuleNotFound The specified resource was not found - -swagger:response getServerSwitchingRuleNotFound -*/ -type GetServerSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerSwitchingRuleNotFound creates GetServerSwitchingRuleNotFound with default headers values -func NewGetServerSwitchingRuleNotFound() *GetServerSwitchingRuleNotFound { - - return &GetServerSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server switching rule not found response -func (o *GetServerSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *GetServerSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server switching rule not found response -func (o *GetServerSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server switching rule not found response -func (o *GetServerSwitchingRuleNotFound) WithPayload(payload *models.Error) *GetServerSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server switching rule not found response -func (o *GetServerSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServerSwitchingRuleDefault General Error - -swagger:response getServerSwitchingRuleDefault -*/ -type GetServerSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerSwitchingRuleDefault creates GetServerSwitchingRuleDefault with default headers values -func NewGetServerSwitchingRuleDefault(code int) *GetServerSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &GetServerSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) WithStatusCode(code int) *GetServerSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *GetServerSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) WithPayload(payload *models.Error) *GetServerSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server switching rule default response -func (o *GetServerSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/get_server_switching_rule_urlbuilder.go b/operations/server_switching_rule/get_server_switching_rule_urlbuilder.go deleted file mode 100644 index fac69270..00000000 --- a/operations/server_switching_rule/get_server_switching_rule_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetServerSwitchingRuleURL generates an URL for the get server switching rule operation -type GetServerSwitchingRuleURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerSwitchingRuleURL) WithBasePath(bp string) *GetServerSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetServerSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/get_server_switching_rules.go b/operations/server_switching_rule/get_server_switching_rules.go deleted file mode 100644 index c0ac5106..00000000 --- a/operations/server_switching_rule/get_server_switching_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerSwitchingRulesHandlerFunc turns a function with the right signature into a get server switching rules handler -type GetServerSwitchingRulesHandlerFunc func(GetServerSwitchingRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerSwitchingRulesHandlerFunc) Handle(params GetServerSwitchingRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerSwitchingRulesHandler interface for that can handle valid get server switching rules params -type GetServerSwitchingRulesHandler interface { - Handle(GetServerSwitchingRulesParams, interface{}) middleware.Responder -} - -// NewGetServerSwitchingRules creates a new http.Handler for the get server switching rules operation -func NewGetServerSwitchingRules(ctx *middleware.Context, handler GetServerSwitchingRulesHandler) *GetServerSwitchingRules { - return &GetServerSwitchingRules{Context: ctx, Handler: handler} -} - -/* - GetServerSwitchingRules swagger:route GET /services/haproxy/configuration/backends/{parent_name}/server_switching_rules ServerSwitchingRule getServerSwitchingRules - -# Return an array of all Server Switching Rules - -Returns all Backend Switching Rules that are configured in specified backend. -*/ -type GetServerSwitchingRules struct { - Context *middleware.Context - Handler GetServerSwitchingRulesHandler -} - -func (o *GetServerSwitchingRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerSwitchingRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/get_server_switching_rules_parameters.go b/operations/server_switching_rule/get_server_switching_rules_parameters.go deleted file mode 100644 index b5ef8ec4..00000000 --- a/operations/server_switching_rule/get_server_switching_rules_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerSwitchingRulesParams creates a new GetServerSwitchingRulesParams object -// -// There are no default values defined in the spec. -func NewGetServerSwitchingRulesParams() GetServerSwitchingRulesParams { - - return GetServerSwitchingRulesParams{} -} - -// GetServerSwitchingRulesParams contains all the bound params for the get server switching rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerSwitchingRules -type GetServerSwitchingRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerSwitchingRulesParams() beforehand. -func (o *GetServerSwitchingRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerSwitchingRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerSwitchingRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server_switching_rule/get_server_switching_rules_responses.go b/operations/server_switching_rule/get_server_switching_rules_responses.go deleted file mode 100644 index 7b654c3a..00000000 --- a/operations/server_switching_rule/get_server_switching_rules_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerSwitchingRulesOKCode is the HTTP code returned for type GetServerSwitchingRulesOK -const GetServerSwitchingRulesOKCode int = 200 - -/* -GetServerSwitchingRulesOK Successful operation - -swagger:response getServerSwitchingRulesOK -*/ -type GetServerSwitchingRulesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.ServerSwitchingRules `json:"body,omitempty"` -} - -// NewGetServerSwitchingRulesOK creates GetServerSwitchingRulesOK with default headers values -func NewGetServerSwitchingRulesOK() *GetServerSwitchingRulesOK { - - return &GetServerSwitchingRulesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server switching rules o k response -func (o *GetServerSwitchingRulesOK) WithConfigurationVersion(configurationVersion string) *GetServerSwitchingRulesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server switching rules o k response -func (o *GetServerSwitchingRulesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server switching rules o k response -func (o *GetServerSwitchingRulesOK) WithPayload(payload models.ServerSwitchingRules) *GetServerSwitchingRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server switching rules o k response -func (o *GetServerSwitchingRulesOK) SetPayload(payload models.ServerSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerSwitchingRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServerSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetServerSwitchingRulesDefault General Error - -swagger:response getServerSwitchingRulesDefault -*/ -type GetServerSwitchingRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerSwitchingRulesDefault creates GetServerSwitchingRulesDefault with default headers values -func NewGetServerSwitchingRulesDefault(code int) *GetServerSwitchingRulesDefault { - if code <= 0 { - code = 500 - } - - return &GetServerSwitchingRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) WithStatusCode(code int) *GetServerSwitchingRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) WithConfigurationVersion(configurationVersion string) *GetServerSwitchingRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) WithPayload(payload *models.Error) *GetServerSwitchingRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server switching rules default response -func (o *GetServerSwitchingRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerSwitchingRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/get_server_switching_rules_urlbuilder.go b/operations/server_switching_rule/get_server_switching_rules_urlbuilder.go deleted file mode 100644 index 9f8f0ad9..00000000 --- a/operations/server_switching_rule/get_server_switching_rules_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerSwitchingRulesURL generates an URL for the get server switching rules operation -type GetServerSwitchingRulesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerSwitchingRulesURL) WithBasePath(bp string) *GetServerSwitchingRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerSwitchingRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerSwitchingRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerSwitchingRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerSwitchingRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerSwitchingRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerSwitchingRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerSwitchingRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerSwitchingRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerSwitchingRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/replace_server_switching_rule.go b/operations/server_switching_rule/replace_server_switching_rule.go deleted file mode 100644 index 2205ef3f..00000000 --- a/operations/server_switching_rule/replace_server_switching_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerSwitchingRuleHandlerFunc turns a function with the right signature into a replace server switching rule handler -type ReplaceServerSwitchingRuleHandlerFunc func(ReplaceServerSwitchingRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerSwitchingRuleHandlerFunc) Handle(params ReplaceServerSwitchingRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerSwitchingRuleHandler interface for that can handle valid replace server switching rule params -type ReplaceServerSwitchingRuleHandler interface { - Handle(ReplaceServerSwitchingRuleParams, interface{}) middleware.Responder -} - -// NewReplaceServerSwitchingRule creates a new http.Handler for the replace server switching rule operation -func NewReplaceServerSwitchingRule(ctx *middleware.Context, handler ReplaceServerSwitchingRuleHandler) *ReplaceServerSwitchingRule { - return &ReplaceServerSwitchingRule{Context: ctx, Handler: handler} -} - -/* - ReplaceServerSwitchingRule swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index} ServerSwitchingRule replaceServerSwitchingRule - -# Replace a Server Switching Rule - -Replaces a Server Switching Rule configuration by it's index in the specified backend. -*/ -type ReplaceServerSwitchingRule struct { - Context *middleware.Context - Handler ReplaceServerSwitchingRuleHandler -} - -func (o *ReplaceServerSwitchingRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerSwitchingRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/replace_server_switching_rule_parameters.go b/operations/server_switching_rule/replace_server_switching_rule_parameters.go deleted file mode 100644 index 5b138025..00000000 --- a/operations/server_switching_rule/replace_server_switching_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerSwitchingRuleParams creates a new ReplaceServerSwitchingRuleParams object -// with the default values initialized. -func NewReplaceServerSwitchingRuleParams() ReplaceServerSwitchingRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerSwitchingRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerSwitchingRuleParams contains all the bound params for the replace server switching rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerSwitchingRule -type ReplaceServerSwitchingRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ServerSwitchingRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Switching Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerSwitchingRuleParams() beforehand. -func (o *ReplaceServerSwitchingRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ServerSwitchingRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerSwitchingRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerSwitchingRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceServerSwitchingRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerSwitchingRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerSwitchingRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerSwitchingRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_switching_rule/replace_server_switching_rule_responses.go b/operations/server_switching_rule/replace_server_switching_rule_responses.go deleted file mode 100644 index e92b93bd..00000000 --- a/operations/server_switching_rule/replace_server_switching_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerSwitchingRuleOKCode is the HTTP code returned for type ReplaceServerSwitchingRuleOK -const ReplaceServerSwitchingRuleOKCode int = 200 - -/* -ReplaceServerSwitchingRuleOK Server Switching Rule replaced - -swagger:response replaceServerSwitchingRuleOK -*/ -type ReplaceServerSwitchingRuleOK struct { - - /* - In: Body - */ - Payload *models.ServerSwitchingRule `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRuleOK creates ReplaceServerSwitchingRuleOK with default headers values -func NewReplaceServerSwitchingRuleOK() *ReplaceServerSwitchingRuleOK { - - return &ReplaceServerSwitchingRuleOK{} -} - -// WithPayload adds the payload to the replace server switching rule o k response -func (o *ReplaceServerSwitchingRuleOK) WithPayload(payload *models.ServerSwitchingRule) *ReplaceServerSwitchingRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rule o k response -func (o *ReplaceServerSwitchingRuleOK) SetPayload(payload *models.ServerSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerSwitchingRuleAcceptedCode is the HTTP code returned for type ReplaceServerSwitchingRuleAccepted -const ReplaceServerSwitchingRuleAcceptedCode int = 202 - -/* -ReplaceServerSwitchingRuleAccepted Configuration change accepted and reload requested - -swagger:response replaceServerSwitchingRuleAccepted -*/ -type ReplaceServerSwitchingRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ServerSwitchingRule `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRuleAccepted creates ReplaceServerSwitchingRuleAccepted with default headers values -func NewReplaceServerSwitchingRuleAccepted() *ReplaceServerSwitchingRuleAccepted { - - return &ReplaceServerSwitchingRuleAccepted{} -} - -// WithReloadID adds the reloadId to the replace server switching rule accepted response -func (o *ReplaceServerSwitchingRuleAccepted) WithReloadID(reloadID string) *ReplaceServerSwitchingRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server switching rule accepted response -func (o *ReplaceServerSwitchingRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server switching rule accepted response -func (o *ReplaceServerSwitchingRuleAccepted) WithPayload(payload *models.ServerSwitchingRule) *ReplaceServerSwitchingRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rule accepted response -func (o *ReplaceServerSwitchingRuleAccepted) SetPayload(payload *models.ServerSwitchingRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerSwitchingRuleBadRequestCode is the HTTP code returned for type ReplaceServerSwitchingRuleBadRequest -const ReplaceServerSwitchingRuleBadRequestCode int = 400 - -/* -ReplaceServerSwitchingRuleBadRequest Bad request - -swagger:response replaceServerSwitchingRuleBadRequest -*/ -type ReplaceServerSwitchingRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRuleBadRequest creates ReplaceServerSwitchingRuleBadRequest with default headers values -func NewReplaceServerSwitchingRuleBadRequest() *ReplaceServerSwitchingRuleBadRequest { - - return &ReplaceServerSwitchingRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server switching rule bad request response -func (o *ReplaceServerSwitchingRuleBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerSwitchingRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server switching rule bad request response -func (o *ReplaceServerSwitchingRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server switching rule bad request response -func (o *ReplaceServerSwitchingRuleBadRequest) WithPayload(payload *models.Error) *ReplaceServerSwitchingRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rule bad request response -func (o *ReplaceServerSwitchingRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerSwitchingRuleNotFoundCode is the HTTP code returned for type ReplaceServerSwitchingRuleNotFound -const ReplaceServerSwitchingRuleNotFoundCode int = 404 - -/* -ReplaceServerSwitchingRuleNotFound The specified resource was not found - -swagger:response replaceServerSwitchingRuleNotFound -*/ -type ReplaceServerSwitchingRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRuleNotFound creates ReplaceServerSwitchingRuleNotFound with default headers values -func NewReplaceServerSwitchingRuleNotFound() *ReplaceServerSwitchingRuleNotFound { - - return &ReplaceServerSwitchingRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server switching rule not found response -func (o *ReplaceServerSwitchingRuleNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceServerSwitchingRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server switching rule not found response -func (o *ReplaceServerSwitchingRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server switching rule not found response -func (o *ReplaceServerSwitchingRuleNotFound) WithPayload(payload *models.Error) *ReplaceServerSwitchingRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rule not found response -func (o *ReplaceServerSwitchingRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerSwitchingRuleDefault General Error - -swagger:response replaceServerSwitchingRuleDefault -*/ -type ReplaceServerSwitchingRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRuleDefault creates ReplaceServerSwitchingRuleDefault with default headers values -func NewReplaceServerSwitchingRuleDefault(code int) *ReplaceServerSwitchingRuleDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerSwitchingRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) WithStatusCode(code int) *ReplaceServerSwitchingRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerSwitchingRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) WithPayload(payload *models.Error) *ReplaceServerSwitchingRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rule default response -func (o *ReplaceServerSwitchingRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/replace_server_switching_rule_urlbuilder.go b/operations/server_switching_rule/replace_server_switching_rule_urlbuilder.go deleted file mode 100644 index 9c6357b3..00000000 --- a/operations/server_switching_rule/replace_server_switching_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerSwitchingRuleURL generates an URL for the replace server switching rule operation -type ReplaceServerSwitchingRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerSwitchingRuleURL) WithBasePath(bp string) *ReplaceServerSwitchingRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerSwitchingRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerSwitchingRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceServerSwitchingRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerSwitchingRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerSwitchingRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerSwitchingRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerSwitchingRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerSwitchingRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerSwitchingRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerSwitchingRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_switching_rule/replace_server_switching_rules.go b/operations/server_switching_rule/replace_server_switching_rules.go deleted file mode 100644 index 9b04b316..00000000 --- a/operations/server_switching_rule/replace_server_switching_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerSwitchingRulesHandlerFunc turns a function with the right signature into a replace server switching rules handler -type ReplaceServerSwitchingRulesHandlerFunc func(ReplaceServerSwitchingRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerSwitchingRulesHandlerFunc) Handle(params ReplaceServerSwitchingRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerSwitchingRulesHandler interface for that can handle valid replace server switching rules params -type ReplaceServerSwitchingRulesHandler interface { - Handle(ReplaceServerSwitchingRulesParams, interface{}) middleware.Responder -} - -// NewReplaceServerSwitchingRules creates a new http.Handler for the replace server switching rules operation -func NewReplaceServerSwitchingRules(ctx *middleware.Context, handler ReplaceServerSwitchingRulesHandler) *ReplaceServerSwitchingRules { - return &ReplaceServerSwitchingRules{Context: ctx, Handler: handler} -} - -/* - ReplaceServerSwitchingRules swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/server_switching_rules ServerSwitchingRule replaceServerSwitchingRules - -# Replace an Server Switching Rule list - -Replaces a whole list of Server Switching Rules with the list given in parameter -*/ -type ReplaceServerSwitchingRules struct { - Context *middleware.Context - Handler ReplaceServerSwitchingRulesHandler -} - -func (o *ReplaceServerSwitchingRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerSwitchingRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_switching_rule/replace_server_switching_rules_parameters.go b/operations/server_switching_rule/replace_server_switching_rules_parameters.go deleted file mode 100644 index 2dcfd584..00000000 --- a/operations/server_switching_rule/replace_server_switching_rules_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerSwitchingRulesParams creates a new ReplaceServerSwitchingRulesParams object -// with the default values initialized. -func NewReplaceServerSwitchingRulesParams() ReplaceServerSwitchingRulesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerSwitchingRulesParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerSwitchingRulesParams contains all the bound params for the replace server switching rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerSwitchingRules -type ReplaceServerSwitchingRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.ServerSwitchingRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerSwitchingRulesParams() beforehand. -func (o *ReplaceServerSwitchingRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ServerSwitchingRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerSwitchingRulesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerSwitchingRulesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerSwitchingRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerSwitchingRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerSwitchingRulesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_switching_rule/replace_server_switching_rules_responses.go b/operations/server_switching_rule/replace_server_switching_rules_responses.go deleted file mode 100644 index 4c1fdd6a..00000000 --- a/operations/server_switching_rule/replace_server_switching_rules_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerSwitchingRulesOKCode is the HTTP code returned for type ReplaceServerSwitchingRulesOK -const ReplaceServerSwitchingRulesOKCode int = 200 - -/* -ReplaceServerSwitchingRulesOK All Server Switching Rule lines replaced - -swagger:response replaceServerSwitchingRulesOK -*/ -type ReplaceServerSwitchingRulesOK struct { - - /* - In: Body - */ - Payload models.ServerSwitchingRules `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRulesOK creates ReplaceServerSwitchingRulesOK with default headers values -func NewReplaceServerSwitchingRulesOK() *ReplaceServerSwitchingRulesOK { - - return &ReplaceServerSwitchingRulesOK{} -} - -// WithPayload adds the payload to the replace server switching rules o k response -func (o *ReplaceServerSwitchingRulesOK) WithPayload(payload models.ServerSwitchingRules) *ReplaceServerSwitchingRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rules o k response -func (o *ReplaceServerSwitchingRulesOK) SetPayload(payload models.ServerSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServerSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceServerSwitchingRulesAcceptedCode is the HTTP code returned for type ReplaceServerSwitchingRulesAccepted -const ReplaceServerSwitchingRulesAcceptedCode int = 202 - -/* -ReplaceServerSwitchingRulesAccepted Configuration change accepted and reload requested - -swagger:response replaceServerSwitchingRulesAccepted -*/ -type ReplaceServerSwitchingRulesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.ServerSwitchingRules `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRulesAccepted creates ReplaceServerSwitchingRulesAccepted with default headers values -func NewReplaceServerSwitchingRulesAccepted() *ReplaceServerSwitchingRulesAccepted { - - return &ReplaceServerSwitchingRulesAccepted{} -} - -// WithReloadID adds the reloadId to the replace server switching rules accepted response -func (o *ReplaceServerSwitchingRulesAccepted) WithReloadID(reloadID string) *ReplaceServerSwitchingRulesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server switching rules accepted response -func (o *ReplaceServerSwitchingRulesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server switching rules accepted response -func (o *ReplaceServerSwitchingRulesAccepted) WithPayload(payload models.ServerSwitchingRules) *ReplaceServerSwitchingRulesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rules accepted response -func (o *ReplaceServerSwitchingRulesAccepted) SetPayload(payload models.ServerSwitchingRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRulesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServerSwitchingRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceServerSwitchingRulesBadRequestCode is the HTTP code returned for type ReplaceServerSwitchingRulesBadRequest -const ReplaceServerSwitchingRulesBadRequestCode int = 400 - -/* -ReplaceServerSwitchingRulesBadRequest Bad request - -swagger:response replaceServerSwitchingRulesBadRequest -*/ -type ReplaceServerSwitchingRulesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRulesBadRequest creates ReplaceServerSwitchingRulesBadRequest with default headers values -func NewReplaceServerSwitchingRulesBadRequest() *ReplaceServerSwitchingRulesBadRequest { - - return &ReplaceServerSwitchingRulesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server switching rules bad request response -func (o *ReplaceServerSwitchingRulesBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerSwitchingRulesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server switching rules bad request response -func (o *ReplaceServerSwitchingRulesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server switching rules bad request response -func (o *ReplaceServerSwitchingRulesBadRequest) WithPayload(payload *models.Error) *ReplaceServerSwitchingRulesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rules bad request response -func (o *ReplaceServerSwitchingRulesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRulesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerSwitchingRulesDefault General Error - -swagger:response replaceServerSwitchingRulesDefault -*/ -type ReplaceServerSwitchingRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerSwitchingRulesDefault creates ReplaceServerSwitchingRulesDefault with default headers values -func NewReplaceServerSwitchingRulesDefault(code int) *ReplaceServerSwitchingRulesDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerSwitchingRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) WithStatusCode(code int) *ReplaceServerSwitchingRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerSwitchingRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) WithPayload(payload *models.Error) *ReplaceServerSwitchingRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server switching rules default response -func (o *ReplaceServerSwitchingRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerSwitchingRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_switching_rule/replace_server_switching_rules_urlbuilder.go b/operations/server_switching_rule/replace_server_switching_rules_urlbuilder.go deleted file mode 100644 index 30b6406d..00000000 --- a/operations/server_switching_rule/replace_server_switching_rules_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_switching_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerSwitchingRulesURL generates an URL for the replace server switching rules operation -type ReplaceServerSwitchingRulesURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerSwitchingRulesURL) WithBasePath(bp string) *ReplaceServerSwitchingRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerSwitchingRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerSwitchingRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_switching_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerSwitchingRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerSwitchingRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerSwitchingRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerSwitchingRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerSwitchingRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerSwitchingRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerSwitchingRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_template/create_server_template.go b/operations/server_template/create_server_template.go deleted file mode 100644 index cd1bae1b..00000000 --- a/operations/server_template/create_server_template.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateServerTemplateHandlerFunc turns a function with the right signature into a create server template handler -type CreateServerTemplateHandlerFunc func(CreateServerTemplateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServerTemplateHandlerFunc) Handle(params CreateServerTemplateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateServerTemplateHandler interface for that can handle valid create server template params -type CreateServerTemplateHandler interface { - Handle(CreateServerTemplateParams, interface{}) middleware.Responder -} - -// NewCreateServerTemplate creates a new http.Handler for the create server template operation -func NewCreateServerTemplate(ctx *middleware.Context, handler CreateServerTemplateHandler) *CreateServerTemplate { - return &CreateServerTemplate{Context: ctx, Handler: handler} -} - -/* - CreateServerTemplate swagger:route POST /services/haproxy/configuration/backends/{parent_name}/server_templates ServerTemplate createServerTemplate - -# Add a new server template - -Adds a new server template in the specified backend in the configuration file. -*/ -type CreateServerTemplate struct { - Context *middleware.Context - Handler CreateServerTemplateHandler -} - -func (o *CreateServerTemplate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServerTemplateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_template/create_server_template_parameters.go b/operations/server_template/create_server_template_parameters.go deleted file mode 100644 index 96e43990..00000000 --- a/operations/server_template/create_server_template_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateServerTemplateParams creates a new CreateServerTemplateParams object -// with the default values initialized. -func NewCreateServerTemplateParams() CreateServerTemplateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateServerTemplateParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateServerTemplateParams contains all the bound params for the create server template operation -// typically these are obtained from a http.Request -// -// swagger:parameters createServerTemplate -type CreateServerTemplateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ServerTemplate - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateServerTemplateParams() beforehand. -func (o *CreateServerTemplateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ServerTemplate - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateServerTemplateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateServerTemplateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateServerTemplateParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateServerTemplateParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateServerTemplateParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_template/create_server_template_responses.go b/operations/server_template/create_server_template_responses.go deleted file mode 100644 index f77ae071..00000000 --- a/operations/server_template/create_server_template_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateServerTemplateCreatedCode is the HTTP code returned for type CreateServerTemplateCreated -const CreateServerTemplateCreatedCode int = 201 - -/* -CreateServerTemplateCreated Server template created - -swagger:response createServerTemplateCreated -*/ -type CreateServerTemplateCreated struct { - - /* - In: Body - */ - Payload *models.ServerTemplate `json:"body,omitempty"` -} - -// NewCreateServerTemplateCreated creates CreateServerTemplateCreated with default headers values -func NewCreateServerTemplateCreated() *CreateServerTemplateCreated { - - return &CreateServerTemplateCreated{} -} - -// WithPayload adds the payload to the create server template created response -func (o *CreateServerTemplateCreated) WithPayload(payload *models.ServerTemplate) *CreateServerTemplateCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server template created response -func (o *CreateServerTemplateCreated) SetPayload(payload *models.ServerTemplate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerTemplateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerTemplateAcceptedCode is the HTTP code returned for type CreateServerTemplateAccepted -const CreateServerTemplateAcceptedCode int = 202 - -/* -CreateServerTemplateAccepted Configuration change accepted and reload requested - -swagger:response createServerTemplateAccepted -*/ -type CreateServerTemplateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ServerTemplate `json:"body,omitempty"` -} - -// NewCreateServerTemplateAccepted creates CreateServerTemplateAccepted with default headers values -func NewCreateServerTemplateAccepted() *CreateServerTemplateAccepted { - - return &CreateServerTemplateAccepted{} -} - -// WithReloadID adds the reloadId to the create server template accepted response -func (o *CreateServerTemplateAccepted) WithReloadID(reloadID string) *CreateServerTemplateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create server template accepted response -func (o *CreateServerTemplateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create server template accepted response -func (o *CreateServerTemplateAccepted) WithPayload(payload *models.ServerTemplate) *CreateServerTemplateAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server template accepted response -func (o *CreateServerTemplateAccepted) SetPayload(payload *models.ServerTemplate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerTemplateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerTemplateBadRequestCode is the HTTP code returned for type CreateServerTemplateBadRequest -const CreateServerTemplateBadRequestCode int = 400 - -/* -CreateServerTemplateBadRequest Bad request - -swagger:response createServerTemplateBadRequest -*/ -type CreateServerTemplateBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerTemplateBadRequest creates CreateServerTemplateBadRequest with default headers values -func NewCreateServerTemplateBadRequest() *CreateServerTemplateBadRequest { - - return &CreateServerTemplateBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server template bad request response -func (o *CreateServerTemplateBadRequest) WithConfigurationVersion(configurationVersion string) *CreateServerTemplateBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server template bad request response -func (o *CreateServerTemplateBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server template bad request response -func (o *CreateServerTemplateBadRequest) WithPayload(payload *models.Error) *CreateServerTemplateBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server template bad request response -func (o *CreateServerTemplateBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerTemplateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateServerTemplateConflictCode is the HTTP code returned for type CreateServerTemplateConflict -const CreateServerTemplateConflictCode int = 409 - -/* -CreateServerTemplateConflict The specified resource already exists - -swagger:response createServerTemplateConflict -*/ -type CreateServerTemplateConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerTemplateConflict creates CreateServerTemplateConflict with default headers values -func NewCreateServerTemplateConflict() *CreateServerTemplateConflict { - - return &CreateServerTemplateConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create server template conflict response -func (o *CreateServerTemplateConflict) WithConfigurationVersion(configurationVersion string) *CreateServerTemplateConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server template conflict response -func (o *CreateServerTemplateConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server template conflict response -func (o *CreateServerTemplateConflict) WithPayload(payload *models.Error) *CreateServerTemplateConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server template conflict response -func (o *CreateServerTemplateConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerTemplateConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServerTemplateDefault General Error - -swagger:response createServerTemplateDefault -*/ -type CreateServerTemplateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateServerTemplateDefault creates CreateServerTemplateDefault with default headers values -func NewCreateServerTemplateDefault(code int) *CreateServerTemplateDefault { - if code <= 0 { - code = 500 - } - - return &CreateServerTemplateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create server template default response -func (o *CreateServerTemplateDefault) WithStatusCode(code int) *CreateServerTemplateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create server template default response -func (o *CreateServerTemplateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create server template default response -func (o *CreateServerTemplateDefault) WithConfigurationVersion(configurationVersion string) *CreateServerTemplateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create server template default response -func (o *CreateServerTemplateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create server template default response -func (o *CreateServerTemplateDefault) WithPayload(payload *models.Error) *CreateServerTemplateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create server template default response -func (o *CreateServerTemplateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServerTemplateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_template/create_server_template_urlbuilder.go b/operations/server_template/create_server_template_urlbuilder.go deleted file mode 100644 index 0504794c..00000000 --- a/operations/server_template/create_server_template_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateServerTemplateURL generates an URL for the create server template operation -type CreateServerTemplateURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerTemplateURL) WithBasePath(bp string) *CreateServerTemplateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateServerTemplateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServerTemplateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_templates" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateServerTemplateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateServerTemplateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateServerTemplateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServerTemplateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServerTemplateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServerTemplateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateServerTemplateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_template/delete_server_template.go b/operations/server_template/delete_server_template.go deleted file mode 100644 index 68051868..00000000 --- a/operations/server_template/delete_server_template.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteServerTemplateHandlerFunc turns a function with the right signature into a delete server template handler -type DeleteServerTemplateHandlerFunc func(DeleteServerTemplateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServerTemplateHandlerFunc) Handle(params DeleteServerTemplateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteServerTemplateHandler interface for that can handle valid delete server template params -type DeleteServerTemplateHandler interface { - Handle(DeleteServerTemplateParams, interface{}) middleware.Responder -} - -// NewDeleteServerTemplate creates a new http.Handler for the delete server template operation -func NewDeleteServerTemplate(ctx *middleware.Context, handler DeleteServerTemplateHandler) *DeleteServerTemplate { - return &DeleteServerTemplate{Context: ctx, Handler: handler} -} - -/* - DeleteServerTemplate swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix} ServerTemplate deleteServerTemplate - -# Delete a server template - -Deletes a server template configuration by it's prefix in the specified backend. -*/ -type DeleteServerTemplate struct { - Context *middleware.Context - Handler DeleteServerTemplateHandler -} - -func (o *DeleteServerTemplate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServerTemplateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_template/delete_server_template_parameters.go b/operations/server_template/delete_server_template_parameters.go deleted file mode 100644 index 174599c1..00000000 --- a/operations/server_template/delete_server_template_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteServerTemplateParams creates a new DeleteServerTemplateParams object -// with the default values initialized. -func NewDeleteServerTemplateParams() DeleteServerTemplateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteServerTemplateParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteServerTemplateParams contains all the bound params for the delete server template operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteServerTemplate -type DeleteServerTemplateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*Server template prefix - Required: true - In: path - */ - Prefix string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteServerTemplateParams() beforehand. -func (o *DeleteServerTemplateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rPrefix, rhkPrefix, _ := route.Params.GetOK("prefix") - if err := o.bindPrefix(rPrefix, rhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteServerTemplateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteServerTemplateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteServerTemplateParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from path. -func (o *DeleteServerTemplateParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Prefix = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteServerTemplateParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteServerTemplateParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_template/delete_server_template_responses.go b/operations/server_template/delete_server_template_responses.go deleted file mode 100644 index 20b0f13b..00000000 --- a/operations/server_template/delete_server_template_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteServerTemplateAcceptedCode is the HTTP code returned for type DeleteServerTemplateAccepted -const DeleteServerTemplateAcceptedCode int = 202 - -/* -DeleteServerTemplateAccepted Configuration change accepted and reload requested - -swagger:response deleteServerTemplateAccepted -*/ -type DeleteServerTemplateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteServerTemplateAccepted creates DeleteServerTemplateAccepted with default headers values -func NewDeleteServerTemplateAccepted() *DeleteServerTemplateAccepted { - - return &DeleteServerTemplateAccepted{} -} - -// WithReloadID adds the reloadId to the delete server template accepted response -func (o *DeleteServerTemplateAccepted) WithReloadID(reloadID string) *DeleteServerTemplateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete server template accepted response -func (o *DeleteServerTemplateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteServerTemplateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteServerTemplateNoContentCode is the HTTP code returned for type DeleteServerTemplateNoContent -const DeleteServerTemplateNoContentCode int = 204 - -/* -DeleteServerTemplateNoContent Server template deleted - -swagger:response deleteServerTemplateNoContent -*/ -type DeleteServerTemplateNoContent struct { -} - -// NewDeleteServerTemplateNoContent creates DeleteServerTemplateNoContent with default headers values -func NewDeleteServerTemplateNoContent() *DeleteServerTemplateNoContent { - - return &DeleteServerTemplateNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServerTemplateNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteServerTemplateNotFoundCode is the HTTP code returned for type DeleteServerTemplateNotFound -const DeleteServerTemplateNotFoundCode int = 404 - -/* -DeleteServerTemplateNotFound The specified resource was not found - -swagger:response deleteServerTemplateNotFound -*/ -type DeleteServerTemplateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerTemplateNotFound creates DeleteServerTemplateNotFound with default headers values -func NewDeleteServerTemplateNotFound() *DeleteServerTemplateNotFound { - - return &DeleteServerTemplateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete server template not found response -func (o *DeleteServerTemplateNotFound) WithConfigurationVersion(configurationVersion string) *DeleteServerTemplateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server template not found response -func (o *DeleteServerTemplateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server template not found response -func (o *DeleteServerTemplateNotFound) WithPayload(payload *models.Error) *DeleteServerTemplateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server template not found response -func (o *DeleteServerTemplateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerTemplateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteServerTemplateDefault General Error - -swagger:response deleteServerTemplateDefault -*/ -type DeleteServerTemplateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteServerTemplateDefault creates DeleteServerTemplateDefault with default headers values -func NewDeleteServerTemplateDefault(code int) *DeleteServerTemplateDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServerTemplateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete server template default response -func (o *DeleteServerTemplateDefault) WithStatusCode(code int) *DeleteServerTemplateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete server template default response -func (o *DeleteServerTemplateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete server template default response -func (o *DeleteServerTemplateDefault) WithConfigurationVersion(configurationVersion string) *DeleteServerTemplateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete server template default response -func (o *DeleteServerTemplateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete server template default response -func (o *DeleteServerTemplateDefault) WithPayload(payload *models.Error) *DeleteServerTemplateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete server template default response -func (o *DeleteServerTemplateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServerTemplateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_template/delete_server_template_urlbuilder.go b/operations/server_template/delete_server_template_urlbuilder.go deleted file mode 100644 index 9684ee34..00000000 --- a/operations/server_template/delete_server_template_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteServerTemplateURL generates an URL for the delete server template operation -type DeleteServerTemplateURL struct { - ParentName string - Prefix string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerTemplateURL) WithBasePath(bp string) *DeleteServerTemplateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteServerTemplateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServerTemplateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteServerTemplateURL") - } - - prefix := o.Prefix - if prefix != "" { - _path = strings.Replace(_path, "{prefix}", prefix, -1) - } else { - return nil, errors.New("prefix is required on DeleteServerTemplateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteServerTemplateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteServerTemplateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServerTemplateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServerTemplateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServerTemplateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteServerTemplateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_template/get_server_template.go b/operations/server_template/get_server_template.go deleted file mode 100644 index 65cb73db..00000000 --- a/operations/server_template/get_server_template.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerTemplateHandlerFunc turns a function with the right signature into a get server template handler -type GetServerTemplateHandlerFunc func(GetServerTemplateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerTemplateHandlerFunc) Handle(params GetServerTemplateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerTemplateHandler interface for that can handle valid get server template params -type GetServerTemplateHandler interface { - Handle(GetServerTemplateParams, interface{}) middleware.Responder -} - -// NewGetServerTemplate creates a new http.Handler for the get server template operation -func NewGetServerTemplate(ctx *middleware.Context, handler GetServerTemplateHandler) *GetServerTemplate { - return &GetServerTemplate{Context: ctx, Handler: handler} -} - -/* - GetServerTemplate swagger:route GET /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix} ServerTemplate getServerTemplate - -# Return one server template - -Returns one server template configuration by it's prefix in the specified backend. -*/ -type GetServerTemplate struct { - Context *middleware.Context - Handler GetServerTemplateHandler -} - -func (o *GetServerTemplate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerTemplateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_template/get_server_template_parameters.go b/operations/server_template/get_server_template_parameters.go deleted file mode 100644 index e7925320..00000000 --- a/operations/server_template/get_server_template_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerTemplateParams creates a new GetServerTemplateParams object -// -// There are no default values defined in the spec. -func NewGetServerTemplateParams() GetServerTemplateParams { - - return GetServerTemplateParams{} -} - -// GetServerTemplateParams contains all the bound params for the get server template operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerTemplate -type GetServerTemplateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Server template prefix - Required: true - In: path - */ - Prefix string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerTemplateParams() beforehand. -func (o *GetServerTemplateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rPrefix, rhkPrefix, _ := route.Params.GetOK("prefix") - if err := o.bindPrefix(rPrefix, rhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerTemplateParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from path. -func (o *GetServerTemplateParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Prefix = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerTemplateParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server_template/get_server_template_responses.go b/operations/server_template/get_server_template_responses.go deleted file mode 100644 index 35eceb46..00000000 --- a/operations/server_template/get_server_template_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerTemplateOKCode is the HTTP code returned for type GetServerTemplateOK -const GetServerTemplateOKCode int = 200 - -/* -GetServerTemplateOK Successful operation - -swagger:response getServerTemplateOK -*/ -type GetServerTemplateOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.ServerTemplate `json:"body,omitempty"` -} - -// NewGetServerTemplateOK creates GetServerTemplateOK with default headers values -func NewGetServerTemplateOK() *GetServerTemplateOK { - - return &GetServerTemplateOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server template o k response -func (o *GetServerTemplateOK) WithConfigurationVersion(configurationVersion string) *GetServerTemplateOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server template o k response -func (o *GetServerTemplateOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server template o k response -func (o *GetServerTemplateOK) WithPayload(payload *models.ServerTemplate) *GetServerTemplateOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server template o k response -func (o *GetServerTemplateOK) SetPayload(payload *models.ServerTemplate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerTemplateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetServerTemplateNotFoundCode is the HTTP code returned for type GetServerTemplateNotFound -const GetServerTemplateNotFoundCode int = 404 - -/* -GetServerTemplateNotFound The specified resource was not found - -swagger:response getServerTemplateNotFound -*/ -type GetServerTemplateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerTemplateNotFound creates GetServerTemplateNotFound with default headers values -func NewGetServerTemplateNotFound() *GetServerTemplateNotFound { - - return &GetServerTemplateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server template not found response -func (o *GetServerTemplateNotFound) WithConfigurationVersion(configurationVersion string) *GetServerTemplateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server template not found response -func (o *GetServerTemplateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server template not found response -func (o *GetServerTemplateNotFound) WithPayload(payload *models.Error) *GetServerTemplateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server template not found response -func (o *GetServerTemplateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerTemplateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetServerTemplateDefault General Error - -swagger:response getServerTemplateDefault -*/ -type GetServerTemplateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerTemplateDefault creates GetServerTemplateDefault with default headers values -func NewGetServerTemplateDefault(code int) *GetServerTemplateDefault { - if code <= 0 { - code = 500 - } - - return &GetServerTemplateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server template default response -func (o *GetServerTemplateDefault) WithStatusCode(code int) *GetServerTemplateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server template default response -func (o *GetServerTemplateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server template default response -func (o *GetServerTemplateDefault) WithConfigurationVersion(configurationVersion string) *GetServerTemplateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server template default response -func (o *GetServerTemplateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server template default response -func (o *GetServerTemplateDefault) WithPayload(payload *models.Error) *GetServerTemplateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server template default response -func (o *GetServerTemplateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerTemplateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_template/get_server_template_urlbuilder.go b/operations/server_template/get_server_template_urlbuilder.go deleted file mode 100644 index 1a0771cb..00000000 --- a/operations/server_template/get_server_template_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerTemplateURL generates an URL for the get server template operation -type GetServerTemplateURL struct { - ParentName string - Prefix string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerTemplateURL) WithBasePath(bp string) *GetServerTemplateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerTemplateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerTemplateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerTemplateURL") - } - - prefix := o.Prefix - if prefix != "" { - _path = strings.Replace(_path, "{prefix}", prefix, -1) - } else { - return nil, errors.New("prefix is required on GetServerTemplateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerTemplateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerTemplateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerTemplateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerTemplateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerTemplateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerTemplateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_template/get_server_templates.go b/operations/server_template/get_server_templates.go deleted file mode 100644 index 62ab94f1..00000000 --- a/operations/server_template/get_server_templates.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetServerTemplatesHandlerFunc turns a function with the right signature into a get server templates handler -type GetServerTemplatesHandlerFunc func(GetServerTemplatesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServerTemplatesHandlerFunc) Handle(params GetServerTemplatesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetServerTemplatesHandler interface for that can handle valid get server templates params -type GetServerTemplatesHandler interface { - Handle(GetServerTemplatesParams, interface{}) middleware.Responder -} - -// NewGetServerTemplates creates a new http.Handler for the get server templates operation -func NewGetServerTemplates(ctx *middleware.Context, handler GetServerTemplatesHandler) *GetServerTemplates { - return &GetServerTemplates{Context: ctx, Handler: handler} -} - -/* - GetServerTemplates swagger:route GET /services/haproxy/configuration/backends/{parent_name}/server_templates ServerTemplate getServerTemplates - -# Return an array of server templates - -Returns an array of all server templates that are configured in specified backend. -*/ -type GetServerTemplates struct { - Context *middleware.Context - Handler GetServerTemplatesHandler -} - -func (o *GetServerTemplates) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServerTemplatesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_template/get_server_templates_parameters.go b/operations/server_template/get_server_templates_parameters.go deleted file mode 100644 index 06b3a7c3..00000000 --- a/operations/server_template/get_server_templates_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetServerTemplatesParams creates a new GetServerTemplatesParams object -// -// There are no default values defined in the spec. -func NewGetServerTemplatesParams() GetServerTemplatesParams { - - return GetServerTemplatesParams{} -} - -// GetServerTemplatesParams contains all the bound params for the get server templates operation -// typically these are obtained from a http.Request -// -// swagger:parameters getServerTemplates -type GetServerTemplatesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetServerTemplatesParams() beforehand. -func (o *GetServerTemplatesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetServerTemplatesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetServerTemplatesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/server_template/get_server_templates_responses.go b/operations/server_template/get_server_templates_responses.go deleted file mode 100644 index 46e5e733..00000000 --- a/operations/server_template/get_server_templates_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetServerTemplatesOKCode is the HTTP code returned for type GetServerTemplatesOK -const GetServerTemplatesOKCode int = 200 - -/* -GetServerTemplatesOK Successful operation - -swagger:response getServerTemplatesOK -*/ -type GetServerTemplatesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.ServerTemplates `json:"body,omitempty"` -} - -// NewGetServerTemplatesOK creates GetServerTemplatesOK with default headers values -func NewGetServerTemplatesOK() *GetServerTemplatesOK { - - return &GetServerTemplatesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get server templates o k response -func (o *GetServerTemplatesOK) WithConfigurationVersion(configurationVersion string) *GetServerTemplatesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server templates o k response -func (o *GetServerTemplatesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server templates o k response -func (o *GetServerTemplatesOK) WithPayload(payload models.ServerTemplates) *GetServerTemplatesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server templates o k response -func (o *GetServerTemplatesOK) SetPayload(payload models.ServerTemplates) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerTemplatesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServerTemplates{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetServerTemplatesDefault General Error - -swagger:response getServerTemplatesDefault -*/ -type GetServerTemplatesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetServerTemplatesDefault creates GetServerTemplatesDefault with default headers values -func NewGetServerTemplatesDefault(code int) *GetServerTemplatesDefault { - if code <= 0 { - code = 500 - } - - return &GetServerTemplatesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get server templates default response -func (o *GetServerTemplatesDefault) WithStatusCode(code int) *GetServerTemplatesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get server templates default response -func (o *GetServerTemplatesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get server templates default response -func (o *GetServerTemplatesDefault) WithConfigurationVersion(configurationVersion string) *GetServerTemplatesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get server templates default response -func (o *GetServerTemplatesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get server templates default response -func (o *GetServerTemplatesDefault) WithPayload(payload *models.Error) *GetServerTemplatesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get server templates default response -func (o *GetServerTemplatesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServerTemplatesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_template/get_server_templates_urlbuilder.go b/operations/server_template/get_server_templates_urlbuilder.go deleted file mode 100644 index a7b153e8..00000000 --- a/operations/server_template/get_server_templates_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetServerTemplatesURL generates an URL for the get server templates operation -type GetServerTemplatesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerTemplatesURL) WithBasePath(bp string) *GetServerTemplatesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetServerTemplatesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServerTemplatesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_templates" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetServerTemplatesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetServerTemplatesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetServerTemplatesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServerTemplatesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServerTemplatesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServerTemplatesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetServerTemplatesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/server_template/replace_server_template.go b/operations/server_template/replace_server_template.go deleted file mode 100644 index c899fe0f..00000000 --- a/operations/server_template/replace_server_template.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceServerTemplateHandlerFunc turns a function with the right signature into a replace server template handler -type ReplaceServerTemplateHandlerFunc func(ReplaceServerTemplateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceServerTemplateHandlerFunc) Handle(params ReplaceServerTemplateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceServerTemplateHandler interface for that can handle valid replace server template params -type ReplaceServerTemplateHandler interface { - Handle(ReplaceServerTemplateParams, interface{}) middleware.Responder -} - -// NewReplaceServerTemplate creates a new http.Handler for the replace server template operation -func NewReplaceServerTemplate(ctx *middleware.Context, handler ReplaceServerTemplateHandler) *ReplaceServerTemplate { - return &ReplaceServerTemplate{Context: ctx, Handler: handler} -} - -/* - ReplaceServerTemplate swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix} ServerTemplate replaceServerTemplate - -# Replace a server template - -Replaces a server template configuration by it's prefix in the specified backend. -*/ -type ReplaceServerTemplate struct { - Context *middleware.Context - Handler ReplaceServerTemplateHandler -} - -func (o *ReplaceServerTemplate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceServerTemplateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/server_template/replace_server_template_parameters.go b/operations/server_template/replace_server_template_parameters.go deleted file mode 100644 index 01aa8802..00000000 --- a/operations/server_template/replace_server_template_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceServerTemplateParams creates a new ReplaceServerTemplateParams object -// with the default values initialized. -func NewReplaceServerTemplateParams() ReplaceServerTemplateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceServerTemplateParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceServerTemplateParams contains all the bound params for the replace server template operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceServerTemplate -type ReplaceServerTemplateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.ServerTemplate - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*Server template prefix - Required: true - In: path - */ - Prefix string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceServerTemplateParams() beforehand. -func (o *ReplaceServerTemplateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ServerTemplate - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rPrefix, rhkPrefix, _ := route.Params.GetOK("prefix") - if err := o.bindPrefix(rPrefix, rhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceServerTemplateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceServerTemplateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceServerTemplateParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from path. -func (o *ReplaceServerTemplateParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Prefix = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceServerTemplateParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceServerTemplateParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/server_template/replace_server_template_responses.go b/operations/server_template/replace_server_template_responses.go deleted file mode 100644 index 68e085d0..00000000 --- a/operations/server_template/replace_server_template_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceServerTemplateOKCode is the HTTP code returned for type ReplaceServerTemplateOK -const ReplaceServerTemplateOKCode int = 200 - -/* -ReplaceServerTemplateOK Server template replaced - -swagger:response replaceServerTemplateOK -*/ -type ReplaceServerTemplateOK struct { - - /* - In: Body - */ - Payload *models.ServerTemplate `json:"body,omitempty"` -} - -// NewReplaceServerTemplateOK creates ReplaceServerTemplateOK with default headers values -func NewReplaceServerTemplateOK() *ReplaceServerTemplateOK { - - return &ReplaceServerTemplateOK{} -} - -// WithPayload adds the payload to the replace server template o k response -func (o *ReplaceServerTemplateOK) WithPayload(payload *models.ServerTemplate) *ReplaceServerTemplateOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server template o k response -func (o *ReplaceServerTemplateOK) SetPayload(payload *models.ServerTemplate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerTemplateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerTemplateAcceptedCode is the HTTP code returned for type ReplaceServerTemplateAccepted -const ReplaceServerTemplateAcceptedCode int = 202 - -/* -ReplaceServerTemplateAccepted Configuration change accepted and reload requested - -swagger:response replaceServerTemplateAccepted -*/ -type ReplaceServerTemplateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.ServerTemplate `json:"body,omitempty"` -} - -// NewReplaceServerTemplateAccepted creates ReplaceServerTemplateAccepted with default headers values -func NewReplaceServerTemplateAccepted() *ReplaceServerTemplateAccepted { - - return &ReplaceServerTemplateAccepted{} -} - -// WithReloadID adds the reloadId to the replace server template accepted response -func (o *ReplaceServerTemplateAccepted) WithReloadID(reloadID string) *ReplaceServerTemplateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace server template accepted response -func (o *ReplaceServerTemplateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace server template accepted response -func (o *ReplaceServerTemplateAccepted) WithPayload(payload *models.ServerTemplate) *ReplaceServerTemplateAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server template accepted response -func (o *ReplaceServerTemplateAccepted) SetPayload(payload *models.ServerTemplate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerTemplateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerTemplateBadRequestCode is the HTTP code returned for type ReplaceServerTemplateBadRequest -const ReplaceServerTemplateBadRequestCode int = 400 - -/* -ReplaceServerTemplateBadRequest Bad request - -swagger:response replaceServerTemplateBadRequest -*/ -type ReplaceServerTemplateBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerTemplateBadRequest creates ReplaceServerTemplateBadRequest with default headers values -func NewReplaceServerTemplateBadRequest() *ReplaceServerTemplateBadRequest { - - return &ReplaceServerTemplateBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server template bad request response -func (o *ReplaceServerTemplateBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceServerTemplateBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server template bad request response -func (o *ReplaceServerTemplateBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server template bad request response -func (o *ReplaceServerTemplateBadRequest) WithPayload(payload *models.Error) *ReplaceServerTemplateBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server template bad request response -func (o *ReplaceServerTemplateBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerTemplateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceServerTemplateNotFoundCode is the HTTP code returned for type ReplaceServerTemplateNotFound -const ReplaceServerTemplateNotFoundCode int = 404 - -/* -ReplaceServerTemplateNotFound The specified resource was not found - -swagger:response replaceServerTemplateNotFound -*/ -type ReplaceServerTemplateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerTemplateNotFound creates ReplaceServerTemplateNotFound with default headers values -func NewReplaceServerTemplateNotFound() *ReplaceServerTemplateNotFound { - - return &ReplaceServerTemplateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace server template not found response -func (o *ReplaceServerTemplateNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceServerTemplateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server template not found response -func (o *ReplaceServerTemplateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server template not found response -func (o *ReplaceServerTemplateNotFound) WithPayload(payload *models.Error) *ReplaceServerTemplateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server template not found response -func (o *ReplaceServerTemplateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerTemplateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceServerTemplateDefault General Error - -swagger:response replaceServerTemplateDefault -*/ -type ReplaceServerTemplateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceServerTemplateDefault creates ReplaceServerTemplateDefault with default headers values -func NewReplaceServerTemplateDefault(code int) *ReplaceServerTemplateDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceServerTemplateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace server template default response -func (o *ReplaceServerTemplateDefault) WithStatusCode(code int) *ReplaceServerTemplateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace server template default response -func (o *ReplaceServerTemplateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace server template default response -func (o *ReplaceServerTemplateDefault) WithConfigurationVersion(configurationVersion string) *ReplaceServerTemplateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace server template default response -func (o *ReplaceServerTemplateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace server template default response -func (o *ReplaceServerTemplateDefault) WithPayload(payload *models.Error) *ReplaceServerTemplateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace server template default response -func (o *ReplaceServerTemplateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceServerTemplateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/server_template/replace_server_template_urlbuilder.go b/operations/server_template/replace_server_template_urlbuilder.go deleted file mode 100644 index 3a33f270..00000000 --- a/operations/server_template/replace_server_template_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package server_template - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceServerTemplateURL generates an URL for the replace server template operation -type ReplaceServerTemplateURL struct { - ParentName string - Prefix string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerTemplateURL) WithBasePath(bp string) *ReplaceServerTemplateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceServerTemplateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceServerTemplateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceServerTemplateURL") - } - - prefix := o.Prefix - if prefix != "" { - _path = strings.Replace(_path, "{prefix}", prefix, -1) - } else { - return nil, errors.New("prefix is required on ReplaceServerTemplateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceServerTemplateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceServerTemplateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceServerTemplateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceServerTemplateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceServerTemplateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceServerTemplateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/create_a_w_s_region.go b/operations/service_discovery/create_a_w_s_region.go deleted file mode 100644 index 8cdfe650..00000000 --- a/operations/service_discovery/create_a_w_s_region.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateAWSRegionHandlerFunc turns a function with the right signature into a create a w s region handler -type CreateAWSRegionHandlerFunc func(CreateAWSRegionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateAWSRegionHandlerFunc) Handle(params CreateAWSRegionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateAWSRegionHandler interface for that can handle valid create a w s region params -type CreateAWSRegionHandler interface { - Handle(CreateAWSRegionParams, interface{}) middleware.Responder -} - -// NewCreateAWSRegion creates a new http.Handler for the create a w s region operation -func NewCreateAWSRegion(ctx *middleware.Context, handler CreateAWSRegionHandler) *CreateAWSRegion { - return &CreateAWSRegion{Context: ctx, Handler: handler} -} - -/* - CreateAWSRegion swagger:route POST /service_discovery/aws ServiceDiscovery createAWSRegion - -# Add a new AWS region - -Add a new AWS region. -Credentials are not required in case Dataplane API is running in an EC2 instance with proper IAM role attached. -*/ -type CreateAWSRegion struct { - Context *middleware.Context - Handler CreateAWSRegionHandler -} - -func (o *CreateAWSRegion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateAWSRegionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/create_a_w_s_region_parameters.go b/operations/service_discovery/create_a_w_s_region_parameters.go deleted file mode 100644 index ecd3afb7..00000000 --- a/operations/service_discovery/create_a_w_s_region_parameters.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateAWSRegionParams creates a new CreateAWSRegionParams object -// -// There are no default values defined in the spec. -func NewCreateAWSRegionParams() CreateAWSRegionParams { - - return CreateAWSRegionParams{} -} - -// CreateAWSRegionParams contains all the bound params for the create a w s region operation -// typically these are obtained from a http.Request -// -// swagger:parameters createAWSRegion -type CreateAWSRegionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.AwsRegion -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateAWSRegionParams() beforehand. -func (o *CreateAWSRegionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.AwsRegion - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/service_discovery/create_a_w_s_region_responses.go b/operations/service_discovery/create_a_w_s_region_responses.go deleted file mode 100644 index beea8307..00000000 --- a/operations/service_discovery/create_a_w_s_region_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateAWSRegionCreatedCode is the HTTP code returned for type CreateAWSRegionCreated -const CreateAWSRegionCreatedCode int = 201 - -/* -CreateAWSRegionCreated Resource created - -swagger:response createAWSRegionCreated -*/ -type CreateAWSRegionCreated struct { - - /* - In: Body - */ - Payload *models.AwsRegion `json:"body,omitempty"` -} - -// NewCreateAWSRegionCreated creates CreateAWSRegionCreated with default headers values -func NewCreateAWSRegionCreated() *CreateAWSRegionCreated { - - return &CreateAWSRegionCreated{} -} - -// WithPayload adds the payload to the create a w s region created response -func (o *CreateAWSRegionCreated) WithPayload(payload *models.AwsRegion) *CreateAWSRegionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a w s region created response -func (o *CreateAWSRegionCreated) SetPayload(payload *models.AwsRegion) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAWSRegionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateAWSRegionBadRequestCode is the HTTP code returned for type CreateAWSRegionBadRequest -const CreateAWSRegionBadRequestCode int = 400 - -/* -CreateAWSRegionBadRequest Bad request - -swagger:response createAWSRegionBadRequest -*/ -type CreateAWSRegionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAWSRegionBadRequest creates CreateAWSRegionBadRequest with default headers values -func NewCreateAWSRegionBadRequest() *CreateAWSRegionBadRequest { - - return &CreateAWSRegionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create a w s region bad request response -func (o *CreateAWSRegionBadRequest) WithConfigurationVersion(configurationVersion string) *CreateAWSRegionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create a w s region bad request response -func (o *CreateAWSRegionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create a w s region bad request response -func (o *CreateAWSRegionBadRequest) WithPayload(payload *models.Error) *CreateAWSRegionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a w s region bad request response -func (o *CreateAWSRegionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAWSRegionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateAWSRegionConflictCode is the HTTP code returned for type CreateAWSRegionConflict -const CreateAWSRegionConflictCode int = 409 - -/* -CreateAWSRegionConflict The specified resource already exists - -swagger:response createAWSRegionConflict -*/ -type CreateAWSRegionConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAWSRegionConflict creates CreateAWSRegionConflict with default headers values -func NewCreateAWSRegionConflict() *CreateAWSRegionConflict { - - return &CreateAWSRegionConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create a w s region conflict response -func (o *CreateAWSRegionConflict) WithConfigurationVersion(configurationVersion string) *CreateAWSRegionConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create a w s region conflict response -func (o *CreateAWSRegionConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create a w s region conflict response -func (o *CreateAWSRegionConflict) WithPayload(payload *models.Error) *CreateAWSRegionConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a w s region conflict response -func (o *CreateAWSRegionConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAWSRegionConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateAWSRegionDefault General Error - -swagger:response createAWSRegionDefault -*/ -type CreateAWSRegionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateAWSRegionDefault creates CreateAWSRegionDefault with default headers values -func NewCreateAWSRegionDefault(code int) *CreateAWSRegionDefault { - if code <= 0 { - code = 500 - } - - return &CreateAWSRegionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create a w s region default response -func (o *CreateAWSRegionDefault) WithStatusCode(code int) *CreateAWSRegionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create a w s region default response -func (o *CreateAWSRegionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create a w s region default response -func (o *CreateAWSRegionDefault) WithConfigurationVersion(configurationVersion string) *CreateAWSRegionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create a w s region default response -func (o *CreateAWSRegionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create a w s region default response -func (o *CreateAWSRegionDefault) WithPayload(payload *models.Error) *CreateAWSRegionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a w s region default response -func (o *CreateAWSRegionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAWSRegionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/create_a_w_s_region_urlbuilder.go b/operations/service_discovery/create_a_w_s_region_urlbuilder.go deleted file mode 100644 index e346f5c8..00000000 --- a/operations/service_discovery/create_a_w_s_region_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateAWSRegionURL generates an URL for the create a w s region operation -type CreateAWSRegionURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateAWSRegionURL) WithBasePath(bp string) *CreateAWSRegionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateAWSRegionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateAWSRegionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/aws" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateAWSRegionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateAWSRegionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateAWSRegionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateAWSRegionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateAWSRegionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateAWSRegionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/create_consul.go b/operations/service_discovery/create_consul.go deleted file mode 100644 index adf1a8db..00000000 --- a/operations/service_discovery/create_consul.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateConsulHandlerFunc turns a function with the right signature into a create consul handler -type CreateConsulHandlerFunc func(CreateConsulParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateConsulHandlerFunc) Handle(params CreateConsulParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateConsulHandler interface for that can handle valid create consul params -type CreateConsulHandler interface { - Handle(CreateConsulParams, interface{}) middleware.Responder -} - -// NewCreateConsul creates a new http.Handler for the create consul operation -func NewCreateConsul(ctx *middleware.Context, handler CreateConsulHandler) *CreateConsul { - return &CreateConsul{Context: ctx, Handler: handler} -} - -/* - CreateConsul swagger:route POST /service_discovery/consul ServiceDiscovery createConsul - -# Add a new Consul server - -Adds a new Consul server. -*/ -type CreateConsul struct { - Context *middleware.Context - Handler CreateConsulHandler -} - -func (o *CreateConsul) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateConsulParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/create_consul_parameters.go b/operations/service_discovery/create_consul_parameters.go deleted file mode 100644 index 5ab49ad7..00000000 --- a/operations/service_discovery/create_consul_parameters.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateConsulParams creates a new CreateConsulParams object -// -// There are no default values defined in the spec. -func NewCreateConsulParams() CreateConsulParams { - - return CreateConsulParams{} -} - -// CreateConsulParams contains all the bound params for the create consul operation -// typically these are obtained from a http.Request -// -// swagger:parameters createConsul -type CreateConsulParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Consul -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateConsulParams() beforehand. -func (o *CreateConsulParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Consul - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/service_discovery/create_consul_responses.go b/operations/service_discovery/create_consul_responses.go deleted file mode 100644 index 1e1ec03c..00000000 --- a/operations/service_discovery/create_consul_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateConsulCreatedCode is the HTTP code returned for type CreateConsulCreated -const CreateConsulCreatedCode int = 201 - -/* -CreateConsulCreated Consul created - -swagger:response createConsulCreated -*/ -type CreateConsulCreated struct { - - /* - In: Body - */ - Payload *models.Consul `json:"body,omitempty"` -} - -// NewCreateConsulCreated creates CreateConsulCreated with default headers values -func NewCreateConsulCreated() *CreateConsulCreated { - - return &CreateConsulCreated{} -} - -// WithPayload adds the payload to the create consul created response -func (o *CreateConsulCreated) WithPayload(payload *models.Consul) *CreateConsulCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create consul created response -func (o *CreateConsulCreated) SetPayload(payload *models.Consul) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConsulCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateConsulBadRequestCode is the HTTP code returned for type CreateConsulBadRequest -const CreateConsulBadRequestCode int = 400 - -/* -CreateConsulBadRequest Bad request - -swagger:response createConsulBadRequest -*/ -type CreateConsulBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateConsulBadRequest creates CreateConsulBadRequest with default headers values -func NewCreateConsulBadRequest() *CreateConsulBadRequest { - - return &CreateConsulBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create consul bad request response -func (o *CreateConsulBadRequest) WithConfigurationVersion(configurationVersion string) *CreateConsulBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create consul bad request response -func (o *CreateConsulBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create consul bad request response -func (o *CreateConsulBadRequest) WithPayload(payload *models.Error) *CreateConsulBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create consul bad request response -func (o *CreateConsulBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConsulBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateConsulConflictCode is the HTTP code returned for type CreateConsulConflict -const CreateConsulConflictCode int = 409 - -/* -CreateConsulConflict The specified resource already exists - -swagger:response createConsulConflict -*/ -type CreateConsulConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateConsulConflict creates CreateConsulConflict with default headers values -func NewCreateConsulConflict() *CreateConsulConflict { - - return &CreateConsulConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create consul conflict response -func (o *CreateConsulConflict) WithConfigurationVersion(configurationVersion string) *CreateConsulConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create consul conflict response -func (o *CreateConsulConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create consul conflict response -func (o *CreateConsulConflict) WithPayload(payload *models.Error) *CreateConsulConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create consul conflict response -func (o *CreateConsulConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConsulConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateConsulDefault General Error - -swagger:response createConsulDefault -*/ -type CreateConsulDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateConsulDefault creates CreateConsulDefault with default headers values -func NewCreateConsulDefault(code int) *CreateConsulDefault { - if code <= 0 { - code = 500 - } - - return &CreateConsulDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create consul default response -func (o *CreateConsulDefault) WithStatusCode(code int) *CreateConsulDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create consul default response -func (o *CreateConsulDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create consul default response -func (o *CreateConsulDefault) WithConfigurationVersion(configurationVersion string) *CreateConsulDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create consul default response -func (o *CreateConsulDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create consul default response -func (o *CreateConsulDefault) WithPayload(payload *models.Error) *CreateConsulDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create consul default response -func (o *CreateConsulDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConsulDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/create_consul_urlbuilder.go b/operations/service_discovery/create_consul_urlbuilder.go deleted file mode 100644 index 40a391ba..00000000 --- a/operations/service_discovery/create_consul_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateConsulURL generates an URL for the create consul operation -type CreateConsulURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateConsulURL) WithBasePath(bp string) *CreateConsulURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateConsulURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateConsulURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/consul" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateConsulURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateConsulURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateConsulURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateConsulURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateConsulURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateConsulURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/delete_a_w_s_region.go b/operations/service_discovery/delete_a_w_s_region.go deleted file mode 100644 index b77b07f5..00000000 --- a/operations/service_discovery/delete_a_w_s_region.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteAWSRegionHandlerFunc turns a function with the right signature into a delete a w s region handler -type DeleteAWSRegionHandlerFunc func(DeleteAWSRegionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteAWSRegionHandlerFunc) Handle(params DeleteAWSRegionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteAWSRegionHandler interface for that can handle valid delete a w s region params -type DeleteAWSRegionHandler interface { - Handle(DeleteAWSRegionParams, interface{}) middleware.Responder -} - -// NewDeleteAWSRegion creates a new http.Handler for the delete a w s region operation -func NewDeleteAWSRegion(ctx *middleware.Context, handler DeleteAWSRegionHandler) *DeleteAWSRegion { - return &DeleteAWSRegion{Context: ctx, Handler: handler} -} - -/* - DeleteAWSRegion swagger:route DELETE /service_discovery/aws/{id} ServiceDiscovery deleteAWSRegion - -# Delete an AWS region - -Delete an AWS region configuration by it's id. -*/ -type DeleteAWSRegion struct { - Context *middleware.Context - Handler DeleteAWSRegionHandler -} - -func (o *DeleteAWSRegion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteAWSRegionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/delete_a_w_s_region_parameters.go b/operations/service_discovery/delete_a_w_s_region_parameters.go deleted file mode 100644 index 4af97dd3..00000000 --- a/operations/service_discovery/delete_a_w_s_region_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteAWSRegionParams creates a new DeleteAWSRegionParams object -// -// There are no default values defined in the spec. -func NewDeleteAWSRegionParams() DeleteAWSRegionParams { - - return DeleteAWSRegionParams{} -} - -// DeleteAWSRegionParams contains all the bound params for the delete a w s region operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteAWSRegion -type DeleteAWSRegionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*AWS region ID - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteAWSRegionParams() beforehand. -func (o *DeleteAWSRegionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteAWSRegionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/delete_a_w_s_region_responses.go b/operations/service_discovery/delete_a_w_s_region_responses.go deleted file mode 100644 index 47364ebd..00000000 --- a/operations/service_discovery/delete_a_w_s_region_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteAWSRegionNoContentCode is the HTTP code returned for type DeleteAWSRegionNoContent -const DeleteAWSRegionNoContentCode int = 204 - -/* -DeleteAWSRegionNoContent Resource deleted - -swagger:response deleteAWSRegionNoContent -*/ -type DeleteAWSRegionNoContent struct { -} - -// NewDeleteAWSRegionNoContent creates DeleteAWSRegionNoContent with default headers values -func NewDeleteAWSRegionNoContent() *DeleteAWSRegionNoContent { - - return &DeleteAWSRegionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteAWSRegionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteAWSRegionNotFoundCode is the HTTP code returned for type DeleteAWSRegionNotFound -const DeleteAWSRegionNotFoundCode int = 404 - -/* -DeleteAWSRegionNotFound The specified resource was not found - -swagger:response deleteAWSRegionNotFound -*/ -type DeleteAWSRegionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteAWSRegionNotFound creates DeleteAWSRegionNotFound with default headers values -func NewDeleteAWSRegionNotFound() *DeleteAWSRegionNotFound { - - return &DeleteAWSRegionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete a w s region not found response -func (o *DeleteAWSRegionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteAWSRegionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete a w s region not found response -func (o *DeleteAWSRegionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete a w s region not found response -func (o *DeleteAWSRegionNotFound) WithPayload(payload *models.Error) *DeleteAWSRegionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete a w s region not found response -func (o *DeleteAWSRegionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAWSRegionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteAWSRegionDefault General Error - -swagger:response deleteAWSRegionDefault -*/ -type DeleteAWSRegionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteAWSRegionDefault creates DeleteAWSRegionDefault with default headers values -func NewDeleteAWSRegionDefault(code int) *DeleteAWSRegionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteAWSRegionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete a w s region default response -func (o *DeleteAWSRegionDefault) WithStatusCode(code int) *DeleteAWSRegionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete a w s region default response -func (o *DeleteAWSRegionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete a w s region default response -func (o *DeleteAWSRegionDefault) WithConfigurationVersion(configurationVersion string) *DeleteAWSRegionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete a w s region default response -func (o *DeleteAWSRegionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete a w s region default response -func (o *DeleteAWSRegionDefault) WithPayload(payload *models.Error) *DeleteAWSRegionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete a w s region default response -func (o *DeleteAWSRegionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAWSRegionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/delete_a_w_s_region_urlbuilder.go b/operations/service_discovery/delete_a_w_s_region_urlbuilder.go deleted file mode 100644 index 5f00ecd8..00000000 --- a/operations/service_discovery/delete_a_w_s_region_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteAWSRegionURL generates an URL for the delete a w s region operation -type DeleteAWSRegionURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteAWSRegionURL) WithBasePath(bp string) *DeleteAWSRegionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteAWSRegionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteAWSRegionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/aws/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteAWSRegionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteAWSRegionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteAWSRegionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteAWSRegionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteAWSRegionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteAWSRegionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteAWSRegionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/delete_consul.go b/operations/service_discovery/delete_consul.go deleted file mode 100644 index 473a5f62..00000000 --- a/operations/service_discovery/delete_consul.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteConsulHandlerFunc turns a function with the right signature into a delete consul handler -type DeleteConsulHandlerFunc func(DeleteConsulParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteConsulHandlerFunc) Handle(params DeleteConsulParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteConsulHandler interface for that can handle valid delete consul params -type DeleteConsulHandler interface { - Handle(DeleteConsulParams, interface{}) middleware.Responder -} - -// NewDeleteConsul creates a new http.Handler for the delete consul operation -func NewDeleteConsul(ctx *middleware.Context, handler DeleteConsulHandler) *DeleteConsul { - return &DeleteConsul{Context: ctx, Handler: handler} -} - -/* - DeleteConsul swagger:route DELETE /service_discovery/consul/{id} ServiceDiscovery deleteConsul - -# Delete a Consul server - -Deletes a Consul server configuration by it's id. -*/ -type DeleteConsul struct { - Context *middleware.Context - Handler DeleteConsulHandler -} - -func (o *DeleteConsul) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteConsulParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/delete_consul_parameters.go b/operations/service_discovery/delete_consul_parameters.go deleted file mode 100644 index 6584bb65..00000000 --- a/operations/service_discovery/delete_consul_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteConsulParams creates a new DeleteConsulParams object -// -// There are no default values defined in the spec. -func NewDeleteConsulParams() DeleteConsulParams { - - return DeleteConsulParams{} -} - -// DeleteConsulParams contains all the bound params for the delete consul operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteConsul -type DeleteConsulParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Consul server Index - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteConsulParams() beforehand. -func (o *DeleteConsulParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteConsulParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/delete_consul_responses.go b/operations/service_discovery/delete_consul_responses.go deleted file mode 100644 index 8641b0e8..00000000 --- a/operations/service_discovery/delete_consul_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteConsulNoContentCode is the HTTP code returned for type DeleteConsulNoContent -const DeleteConsulNoContentCode int = 204 - -/* -DeleteConsulNoContent Consul server deleted - -swagger:response deleteConsulNoContent -*/ -type DeleteConsulNoContent struct { -} - -// NewDeleteConsulNoContent creates DeleteConsulNoContent with default headers values -func NewDeleteConsulNoContent() *DeleteConsulNoContent { - - return &DeleteConsulNoContent{} -} - -// WriteResponse to the client -func (o *DeleteConsulNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteConsulNotFoundCode is the HTTP code returned for type DeleteConsulNotFound -const DeleteConsulNotFoundCode int = 404 - -/* -DeleteConsulNotFound The specified resource was not found - -swagger:response deleteConsulNotFound -*/ -type DeleteConsulNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConsulNotFound creates DeleteConsulNotFound with default headers values -func NewDeleteConsulNotFound() *DeleteConsulNotFound { - - return &DeleteConsulNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete consul not found response -func (o *DeleteConsulNotFound) WithConfigurationVersion(configurationVersion string) *DeleteConsulNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete consul not found response -func (o *DeleteConsulNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete consul not found response -func (o *DeleteConsulNotFound) WithPayload(payload *models.Error) *DeleteConsulNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete consul not found response -func (o *DeleteConsulNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConsulNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteConsulDefault General Error - -swagger:response deleteConsulDefault -*/ -type DeleteConsulDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteConsulDefault creates DeleteConsulDefault with default headers values -func NewDeleteConsulDefault(code int) *DeleteConsulDefault { - if code <= 0 { - code = 500 - } - - return &DeleteConsulDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete consul default response -func (o *DeleteConsulDefault) WithStatusCode(code int) *DeleteConsulDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete consul default response -func (o *DeleteConsulDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete consul default response -func (o *DeleteConsulDefault) WithConfigurationVersion(configurationVersion string) *DeleteConsulDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete consul default response -func (o *DeleteConsulDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete consul default response -func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete consul default response -func (o *DeleteConsulDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConsulDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/delete_consul_urlbuilder.go b/operations/service_discovery/delete_consul_urlbuilder.go deleted file mode 100644 index 8be789ed..00000000 --- a/operations/service_discovery/delete_consul_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteConsulURL generates an URL for the delete consul operation -type DeleteConsulURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteConsulURL) WithBasePath(bp string) *DeleteConsulURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteConsulURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteConsulURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/consul/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteConsulURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteConsulURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteConsulURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteConsulURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteConsulURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteConsulURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteConsulURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/get_a_w_s_region.go b/operations/service_discovery/get_a_w_s_region.go deleted file mode 100644 index c1126233..00000000 --- a/operations/service_discovery/get_a_w_s_region.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAWSRegionHandlerFunc turns a function with the right signature into a get a w s region handler -type GetAWSRegionHandlerFunc func(GetAWSRegionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAWSRegionHandlerFunc) Handle(params GetAWSRegionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAWSRegionHandler interface for that can handle valid get a w s region params -type GetAWSRegionHandler interface { - Handle(GetAWSRegionParams, interface{}) middleware.Responder -} - -// NewGetAWSRegion creates a new http.Handler for the get a w s region operation -func NewGetAWSRegion(ctx *middleware.Context, handler GetAWSRegionHandler) *GetAWSRegion { - return &GetAWSRegion{Context: ctx, Handler: handler} -} - -/* - GetAWSRegion swagger:route GET /service_discovery/aws/{id} ServiceDiscovery getAWSRegion - -# Return an AWS region - -Return one AWS Region configuration by it's id. -*/ -type GetAWSRegion struct { - Context *middleware.Context - Handler GetAWSRegionHandler -} - -func (o *GetAWSRegion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAWSRegionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/get_a_w_s_region_parameters.go b/operations/service_discovery/get_a_w_s_region_parameters.go deleted file mode 100644 index 4f856613..00000000 --- a/operations/service_discovery/get_a_w_s_region_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAWSRegionParams creates a new GetAWSRegionParams object -// -// There are no default values defined in the spec. -func NewGetAWSRegionParams() GetAWSRegionParams { - - return GetAWSRegionParams{} -} - -// GetAWSRegionParams contains all the bound params for the get a w s region operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAWSRegion -type GetAWSRegionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*AWS region id - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAWSRegionParams() beforehand. -func (o *GetAWSRegionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetAWSRegionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/get_a_w_s_region_responses.go b/operations/service_discovery/get_a_w_s_region_responses.go deleted file mode 100644 index 9383e63a..00000000 --- a/operations/service_discovery/get_a_w_s_region_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAWSRegionOKCode is the HTTP code returned for type GetAWSRegionOK -const GetAWSRegionOKCode int = 200 - -/* -GetAWSRegionOK Successful operation - -swagger:response getAWSRegionOK -*/ -type GetAWSRegionOK struct { - - /* - In: Body - */ - Payload *models.AwsRegion `json:"body,omitempty"` -} - -// NewGetAWSRegionOK creates GetAWSRegionOK with default headers values -func NewGetAWSRegionOK() *GetAWSRegionOK { - - return &GetAWSRegionOK{} -} - -// WithPayload adds the payload to the get a w s region o k response -func (o *GetAWSRegionOK) WithPayload(payload *models.AwsRegion) *GetAWSRegionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get a w s region o k response -func (o *GetAWSRegionOK) SetPayload(payload *models.AwsRegion) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAWSRegionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetAWSRegionNotFoundCode is the HTTP code returned for type GetAWSRegionNotFound -const GetAWSRegionNotFoundCode int = 404 - -/* -GetAWSRegionNotFound The specified resource was not found - -swagger:response getAWSRegionNotFound -*/ -type GetAWSRegionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAWSRegionNotFound creates GetAWSRegionNotFound with default headers values -func NewGetAWSRegionNotFound() *GetAWSRegionNotFound { - - return &GetAWSRegionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get a w s region not found response -func (o *GetAWSRegionNotFound) WithConfigurationVersion(configurationVersion string) *GetAWSRegionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get a w s region not found response -func (o *GetAWSRegionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get a w s region not found response -func (o *GetAWSRegionNotFound) WithPayload(payload *models.Error) *GetAWSRegionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get a w s region not found response -func (o *GetAWSRegionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAWSRegionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAWSRegionDefault General Error - -swagger:response getAWSRegionDefault -*/ -type GetAWSRegionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAWSRegionDefault creates GetAWSRegionDefault with default headers values -func NewGetAWSRegionDefault(code int) *GetAWSRegionDefault { - if code <= 0 { - code = 500 - } - - return &GetAWSRegionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get a w s region default response -func (o *GetAWSRegionDefault) WithStatusCode(code int) *GetAWSRegionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get a w s region default response -func (o *GetAWSRegionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get a w s region default response -func (o *GetAWSRegionDefault) WithConfigurationVersion(configurationVersion string) *GetAWSRegionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get a w s region default response -func (o *GetAWSRegionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get a w s region default response -func (o *GetAWSRegionDefault) WithPayload(payload *models.Error) *GetAWSRegionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get a w s region default response -func (o *GetAWSRegionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAWSRegionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/get_a_w_s_region_urlbuilder.go b/operations/service_discovery/get_a_w_s_region_urlbuilder.go deleted file mode 100644 index 363cd8fd..00000000 --- a/operations/service_discovery/get_a_w_s_region_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAWSRegionURL generates an URL for the get a w s region operation -type GetAWSRegionURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAWSRegionURL) WithBasePath(bp string) *GetAWSRegionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAWSRegionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAWSRegionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/aws/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetAWSRegionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAWSRegionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAWSRegionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAWSRegionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAWSRegionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAWSRegionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAWSRegionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/get_a_w_s_regions.go b/operations/service_discovery/get_a_w_s_regions.go deleted file mode 100644 index 81c8d0d2..00000000 --- a/operations/service_discovery/get_a_w_s_regions.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAWSRegionsHandlerFunc turns a function with the right signature into a get a w s regions handler -type GetAWSRegionsHandlerFunc func(GetAWSRegionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAWSRegionsHandlerFunc) Handle(params GetAWSRegionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAWSRegionsHandler interface for that can handle valid get a w s regions params -type GetAWSRegionsHandler interface { - Handle(GetAWSRegionsParams, interface{}) middleware.Responder -} - -// NewGetAWSRegions creates a new http.Handler for the get a w s regions operation -func NewGetAWSRegions(ctx *middleware.Context, handler GetAWSRegionsHandler) *GetAWSRegions { - return &GetAWSRegions{Context: ctx, Handler: handler} -} - -/* - GetAWSRegions swagger:route GET /service_discovery/aws ServiceDiscovery getAWSRegions - -# Return an array of all configured AWS regions - -Return all configured AWS regions. -*/ -type GetAWSRegions struct { - Context *middleware.Context - Handler GetAWSRegionsHandler -} - -func (o *GetAWSRegions) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAWSRegionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/get_a_w_s_regions_parameters.go b/operations/service_discovery/get_a_w_s_regions_parameters.go deleted file mode 100644 index ad93d8be..00000000 --- a/operations/service_discovery/get_a_w_s_regions_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAWSRegionsParams creates a new GetAWSRegionsParams object -// -// There are no default values defined in the spec. -func NewGetAWSRegionsParams() GetAWSRegionsParams { - - return GetAWSRegionsParams{} -} - -// GetAWSRegionsParams contains all the bound params for the get a w s regions operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAWSRegions -type GetAWSRegionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAWSRegionsParams() beforehand. -func (o *GetAWSRegionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/service_discovery/get_a_w_s_regions_responses.go b/operations/service_discovery/get_a_w_s_regions_responses.go deleted file mode 100644 index 9ee4e7ca..00000000 --- a/operations/service_discovery/get_a_w_s_regions_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAWSRegionsOKCode is the HTTP code returned for type GetAWSRegionsOK -const GetAWSRegionsOKCode int = 200 - -/* -GetAWSRegionsOK Successful operation - -swagger:response getAWSRegionsOK -*/ -type GetAWSRegionsOK struct { - - /* - In: Body - */ - Payload models.AwsRegions `json:"body,omitempty"` -} - -// NewGetAWSRegionsOK creates GetAWSRegionsOK with default headers values -func NewGetAWSRegionsOK() *GetAWSRegionsOK { - - return &GetAWSRegionsOK{} -} - -// WithPayload adds the payload to the get a w s regions o k response -func (o *GetAWSRegionsOK) WithPayload(payload models.AwsRegions) *GetAWSRegionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get a w s regions o k response -func (o *GetAWSRegionsOK) SetPayload(payload models.AwsRegions) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAWSRegionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.AwsRegions{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAWSRegionsDefault General Error - -swagger:response getAWSRegionsDefault -*/ -type GetAWSRegionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAWSRegionsDefault creates GetAWSRegionsDefault with default headers values -func NewGetAWSRegionsDefault(code int) *GetAWSRegionsDefault { - if code <= 0 { - code = 500 - } - - return &GetAWSRegionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get a w s regions default response -func (o *GetAWSRegionsDefault) WithStatusCode(code int) *GetAWSRegionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get a w s regions default response -func (o *GetAWSRegionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get a w s regions default response -func (o *GetAWSRegionsDefault) WithConfigurationVersion(configurationVersion string) *GetAWSRegionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get a w s regions default response -func (o *GetAWSRegionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get a w s regions default response -func (o *GetAWSRegionsDefault) WithPayload(payload *models.Error) *GetAWSRegionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get a w s regions default response -func (o *GetAWSRegionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAWSRegionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/get_a_w_s_regions_urlbuilder.go b/operations/service_discovery/get_a_w_s_regions_urlbuilder.go deleted file mode 100644 index 51369a4f..00000000 --- a/operations/service_discovery/get_a_w_s_regions_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAWSRegionsURL generates an URL for the get a w s regions operation -type GetAWSRegionsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAWSRegionsURL) WithBasePath(bp string) *GetAWSRegionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAWSRegionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAWSRegionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/aws" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAWSRegionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAWSRegionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAWSRegionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAWSRegionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAWSRegionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAWSRegionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/get_consul.go b/operations/service_discovery/get_consul.go deleted file mode 100644 index 6dd839e7..00000000 --- a/operations/service_discovery/get_consul.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetConsulHandlerFunc turns a function with the right signature into a get consul handler -type GetConsulHandlerFunc func(GetConsulParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetConsulHandlerFunc) Handle(params GetConsulParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetConsulHandler interface for that can handle valid get consul params -type GetConsulHandler interface { - Handle(GetConsulParams, interface{}) middleware.Responder -} - -// NewGetConsul creates a new http.Handler for the get consul operation -func NewGetConsul(ctx *middleware.Context, handler GetConsulHandler) *GetConsul { - return &GetConsul{Context: ctx, Handler: handler} -} - -/* - GetConsul swagger:route GET /service_discovery/consul/{id} ServiceDiscovery getConsul - -# Return one Consul server - -Returns one Consul server configuration by it's id. -*/ -type GetConsul struct { - Context *middleware.Context - Handler GetConsulHandler -} - -func (o *GetConsul) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetConsulParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/get_consul_parameters.go b/operations/service_discovery/get_consul_parameters.go deleted file mode 100644 index 02938d18..00000000 --- a/operations/service_discovery/get_consul_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetConsulParams creates a new GetConsulParams object -// -// There are no default values defined in the spec. -func NewGetConsulParams() GetConsulParams { - - return GetConsulParams{} -} - -// GetConsulParams contains all the bound params for the get consul operation -// typically these are obtained from a http.Request -// -// swagger:parameters getConsul -type GetConsulParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Consul server id - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetConsulParams() beforehand. -func (o *GetConsulParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetConsulParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/get_consul_responses.go b/operations/service_discovery/get_consul_responses.go deleted file mode 100644 index 69288298..00000000 --- a/operations/service_discovery/get_consul_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetConsulOKCode is the HTTP code returned for type GetConsulOK -const GetConsulOKCode int = 200 - -/* -GetConsulOK Successful operation - -swagger:response getConsulOK -*/ -type GetConsulOK struct { - - /* - In: Body - */ - Payload *models.Consul `json:"body,omitempty"` -} - -// NewGetConsulOK creates GetConsulOK with default headers values -func NewGetConsulOK() *GetConsulOK { - - return &GetConsulOK{} -} - -// WithPayload adds the payload to the get consul o k response -func (o *GetConsulOK) WithPayload(payload *models.Consul) *GetConsulOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get consul o k response -func (o *GetConsulOK) SetPayload(payload *models.Consul) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConsulOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetConsulNotFoundCode is the HTTP code returned for type GetConsulNotFound -const GetConsulNotFoundCode int = 404 - -/* -GetConsulNotFound The specified resource was not found - -swagger:response getConsulNotFound -*/ -type GetConsulNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConsulNotFound creates GetConsulNotFound with default headers values -func NewGetConsulNotFound() *GetConsulNotFound { - - return &GetConsulNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get consul not found response -func (o *GetConsulNotFound) WithConfigurationVersion(configurationVersion string) *GetConsulNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get consul not found response -func (o *GetConsulNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get consul not found response -func (o *GetConsulNotFound) WithPayload(payload *models.Error) *GetConsulNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get consul not found response -func (o *GetConsulNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConsulNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetConsulDefault General Error - -swagger:response getConsulDefault -*/ -type GetConsulDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConsulDefault creates GetConsulDefault with default headers values -func NewGetConsulDefault(code int) *GetConsulDefault { - if code <= 0 { - code = 500 - } - - return &GetConsulDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get consul default response -func (o *GetConsulDefault) WithStatusCode(code int) *GetConsulDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get consul default response -func (o *GetConsulDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get consul default response -func (o *GetConsulDefault) WithConfigurationVersion(configurationVersion string) *GetConsulDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get consul default response -func (o *GetConsulDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get consul default response -func (o *GetConsulDefault) WithPayload(payload *models.Error) *GetConsulDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get consul default response -func (o *GetConsulDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConsulDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/get_consul_urlbuilder.go b/operations/service_discovery/get_consul_urlbuilder.go deleted file mode 100644 index 67b838ef..00000000 --- a/operations/service_discovery/get_consul_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetConsulURL generates an URL for the get consul operation -type GetConsulURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConsulURL) WithBasePath(bp string) *GetConsulURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConsulURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetConsulURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/consul/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetConsulURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetConsulURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetConsulURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetConsulURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetConsulURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetConsulURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetConsulURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/get_consuls.go b/operations/service_discovery/get_consuls.go deleted file mode 100644 index a05d187d..00000000 --- a/operations/service_discovery/get_consuls.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetConsulsHandlerFunc turns a function with the right signature into a get consuls handler -type GetConsulsHandlerFunc func(GetConsulsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetConsulsHandlerFunc) Handle(params GetConsulsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetConsulsHandler interface for that can handle valid get consuls params -type GetConsulsHandler interface { - Handle(GetConsulsParams, interface{}) middleware.Responder -} - -// NewGetConsuls creates a new http.Handler for the get consuls operation -func NewGetConsuls(ctx *middleware.Context, handler GetConsulsHandler) *GetConsuls { - return &GetConsuls{Context: ctx, Handler: handler} -} - -/* - GetConsuls swagger:route GET /service_discovery/consul ServiceDiscovery getConsuls - -# Return an array of all configured Consul servers - -Returns all configured Consul servers. -*/ -type GetConsuls struct { - Context *middleware.Context - Handler GetConsulsHandler -} - -func (o *GetConsuls) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetConsulsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/get_consuls_parameters.go b/operations/service_discovery/get_consuls_parameters.go deleted file mode 100644 index 14c80468..00000000 --- a/operations/service_discovery/get_consuls_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetConsulsParams creates a new GetConsulsParams object -// -// There are no default values defined in the spec. -func NewGetConsulsParams() GetConsulsParams { - - return GetConsulsParams{} -} - -// GetConsulsParams contains all the bound params for the get consuls operation -// typically these are obtained from a http.Request -// -// swagger:parameters getConsuls -type GetConsulsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetConsulsParams() beforehand. -func (o *GetConsulsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/service_discovery/get_consuls_responses.go b/operations/service_discovery/get_consuls_responses.go deleted file mode 100644 index b43fd2f3..00000000 --- a/operations/service_discovery/get_consuls_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetConsulsOKCode is the HTTP code returned for type GetConsulsOK -const GetConsulsOKCode int = 200 - -/* -GetConsulsOK Successful operation - -swagger:response getConsulsOK -*/ -type GetConsulsOK struct { - - /* - In: Body - */ - Payload models.Consuls `json:"body,omitempty"` -} - -// NewGetConsulsOK creates GetConsulsOK with default headers values -func NewGetConsulsOK() *GetConsulsOK { - - return &GetConsulsOK{} -} - -// WithPayload adds the payload to the get consuls o k response -func (o *GetConsulsOK) WithPayload(payload models.Consuls) *GetConsulsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get consuls o k response -func (o *GetConsulsOK) SetPayload(payload models.Consuls) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConsulsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Consuls{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetConsulsDefault General Error - -swagger:response getConsulsDefault -*/ -type GetConsulsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetConsulsDefault creates GetConsulsDefault with default headers values -func NewGetConsulsDefault(code int) *GetConsulsDefault { - if code <= 0 { - code = 500 - } - - return &GetConsulsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get consuls default response -func (o *GetConsulsDefault) WithStatusCode(code int) *GetConsulsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get consuls default response -func (o *GetConsulsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get consuls default response -func (o *GetConsulsDefault) WithConfigurationVersion(configurationVersion string) *GetConsulsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get consuls default response -func (o *GetConsulsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get consuls default response -func (o *GetConsulsDefault) WithPayload(payload *models.Error) *GetConsulsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get consuls default response -func (o *GetConsulsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConsulsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/get_consuls_urlbuilder.go b/operations/service_discovery/get_consuls_urlbuilder.go deleted file mode 100644 index 7984adc2..00000000 --- a/operations/service_discovery/get_consuls_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetConsulsURL generates an URL for the get consuls operation -type GetConsulsURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConsulsURL) WithBasePath(bp string) *GetConsulsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetConsulsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetConsulsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/consul" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetConsulsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetConsulsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetConsulsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetConsulsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetConsulsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetConsulsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/replace_a_w_s_region.go b/operations/service_discovery/replace_a_w_s_region.go deleted file mode 100644 index 966351be..00000000 --- a/operations/service_discovery/replace_a_w_s_region.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAWSRegionHandlerFunc turns a function with the right signature into a replace a w s region handler -type ReplaceAWSRegionHandlerFunc func(ReplaceAWSRegionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAWSRegionHandlerFunc) Handle(params ReplaceAWSRegionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAWSRegionHandler interface for that can handle valid replace a w s region params -type ReplaceAWSRegionHandler interface { - Handle(ReplaceAWSRegionParams, interface{}) middleware.Responder -} - -// NewReplaceAWSRegion creates a new http.Handler for the replace a w s region operation -func NewReplaceAWSRegion(ctx *middleware.Context, handler ReplaceAWSRegionHandler) *ReplaceAWSRegion { - return &ReplaceAWSRegion{Context: ctx, Handler: handler} -} - -/* - ReplaceAWSRegion swagger:route PUT /service_discovery/aws/{id} ServiceDiscovery replaceAWSRegion - -# Replace an AWS region - -Replace an AWS region configuration by its id. -*/ -type ReplaceAWSRegion struct { - Context *middleware.Context - Handler ReplaceAWSRegionHandler -} - -func (o *ReplaceAWSRegion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAWSRegionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/replace_a_w_s_region_parameters.go b/operations/service_discovery/replace_a_w_s_region_parameters.go deleted file mode 100644 index 4420b391..00000000 --- a/operations/service_discovery/replace_a_w_s_region_parameters.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAWSRegionParams creates a new ReplaceAWSRegionParams object -// -// There are no default values defined in the spec. -func NewReplaceAWSRegionParams() ReplaceAWSRegionParams { - - return ReplaceAWSRegionParams{} -} - -// ReplaceAWSRegionParams contains all the bound params for the replace a w s region operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAWSRegion -type ReplaceAWSRegionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.AwsRegion - /*AWS Region ID - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAWSRegionParams() beforehand. -func (o *ReplaceAWSRegionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.AwsRegion - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *ReplaceAWSRegionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/replace_a_w_s_region_responses.go b/operations/service_discovery/replace_a_w_s_region_responses.go deleted file mode 100644 index cd6441f3..00000000 --- a/operations/service_discovery/replace_a_w_s_region_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAWSRegionOKCode is the HTTP code returned for type ReplaceAWSRegionOK -const ReplaceAWSRegionOKCode int = 200 - -/* -ReplaceAWSRegionOK Resource updated - -swagger:response replaceAWSRegionOK -*/ -type ReplaceAWSRegionOK struct { - - /* - In: Body - */ - Payload *models.AwsRegion `json:"body,omitempty"` -} - -// NewReplaceAWSRegionOK creates ReplaceAWSRegionOK with default headers values -func NewReplaceAWSRegionOK() *ReplaceAWSRegionOK { - - return &ReplaceAWSRegionOK{} -} - -// WithPayload adds the payload to the replace a w s region o k response -func (o *ReplaceAWSRegionOK) WithPayload(payload *models.AwsRegion) *ReplaceAWSRegionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace a w s region o k response -func (o *ReplaceAWSRegionOK) SetPayload(payload *models.AwsRegion) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAWSRegionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceAWSRegionBadRequestCode is the HTTP code returned for type ReplaceAWSRegionBadRequest -const ReplaceAWSRegionBadRequestCode int = 400 - -/* -ReplaceAWSRegionBadRequest Bad request - -swagger:response replaceAWSRegionBadRequest -*/ -type ReplaceAWSRegionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAWSRegionBadRequest creates ReplaceAWSRegionBadRequest with default headers values -func NewReplaceAWSRegionBadRequest() *ReplaceAWSRegionBadRequest { - - return &ReplaceAWSRegionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace a w s region bad request response -func (o *ReplaceAWSRegionBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAWSRegionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace a w s region bad request response -func (o *ReplaceAWSRegionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace a w s region bad request response -func (o *ReplaceAWSRegionBadRequest) WithPayload(payload *models.Error) *ReplaceAWSRegionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace a w s region bad request response -func (o *ReplaceAWSRegionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAWSRegionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceAWSRegionNotFoundCode is the HTTP code returned for type ReplaceAWSRegionNotFound -const ReplaceAWSRegionNotFoundCode int = 404 - -/* -ReplaceAWSRegionNotFound The specified resource was not found - -swagger:response replaceAWSRegionNotFound -*/ -type ReplaceAWSRegionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAWSRegionNotFound creates ReplaceAWSRegionNotFound with default headers values -func NewReplaceAWSRegionNotFound() *ReplaceAWSRegionNotFound { - - return &ReplaceAWSRegionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace a w s region not found response -func (o *ReplaceAWSRegionNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceAWSRegionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace a w s region not found response -func (o *ReplaceAWSRegionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace a w s region not found response -func (o *ReplaceAWSRegionNotFound) WithPayload(payload *models.Error) *ReplaceAWSRegionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace a w s region not found response -func (o *ReplaceAWSRegionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAWSRegionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAWSRegionDefault General Error - -swagger:response replaceAWSRegionDefault -*/ -type ReplaceAWSRegionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAWSRegionDefault creates ReplaceAWSRegionDefault with default headers values -func NewReplaceAWSRegionDefault(code int) *ReplaceAWSRegionDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAWSRegionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) WithStatusCode(code int) *ReplaceAWSRegionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAWSRegionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) WithPayload(payload *models.Error) *ReplaceAWSRegionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace a w s region default response -func (o *ReplaceAWSRegionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAWSRegionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/replace_a_w_s_region_urlbuilder.go b/operations/service_discovery/replace_a_w_s_region_urlbuilder.go deleted file mode 100644 index 7debc427..00000000 --- a/operations/service_discovery/replace_a_w_s_region_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ReplaceAWSRegionURL generates an URL for the replace a w s region operation -type ReplaceAWSRegionURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAWSRegionURL) WithBasePath(bp string) *ReplaceAWSRegionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAWSRegionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAWSRegionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/aws/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on ReplaceAWSRegionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAWSRegionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAWSRegionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAWSRegionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAWSRegionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAWSRegionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAWSRegionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/service_discovery/replace_consul.go b/operations/service_discovery/replace_consul.go deleted file mode 100644 index 233083cb..00000000 --- a/operations/service_discovery/replace_consul.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceConsulHandlerFunc turns a function with the right signature into a replace consul handler -type ReplaceConsulHandlerFunc func(ReplaceConsulParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceConsulHandlerFunc) Handle(params ReplaceConsulParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceConsulHandler interface for that can handle valid replace consul params -type ReplaceConsulHandler interface { - Handle(ReplaceConsulParams, interface{}) middleware.Responder -} - -// NewReplaceConsul creates a new http.Handler for the replace consul operation -func NewReplaceConsul(ctx *middleware.Context, handler ReplaceConsulHandler) *ReplaceConsul { - return &ReplaceConsul{Context: ctx, Handler: handler} -} - -/* - ReplaceConsul swagger:route PUT /service_discovery/consul/{id} ServiceDiscovery replaceConsul - -# Replace a Consul server - -Replaces a Consul server configuration by it's id. -*/ -type ReplaceConsul struct { - Context *middleware.Context - Handler ReplaceConsulHandler -} - -func (o *ReplaceConsul) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceConsulParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/service_discovery/replace_consul_parameters.go b/operations/service_discovery/replace_consul_parameters.go deleted file mode 100644 index a583f78f..00000000 --- a/operations/service_discovery/replace_consul_parameters.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceConsulParams creates a new ReplaceConsulParams object -// -// There are no default values defined in the spec. -func NewReplaceConsulParams() ReplaceConsulParams { - - return ReplaceConsulParams{} -} - -// ReplaceConsulParams contains all the bound params for the replace consul operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceConsul -type ReplaceConsulParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Consul - /*Consul Index - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceConsulParams() beforehand. -func (o *ReplaceConsulParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Consul - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *ReplaceConsulParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/service_discovery/replace_consul_responses.go b/operations/service_discovery/replace_consul_responses.go deleted file mode 100644 index 24b08cb3..00000000 --- a/operations/service_discovery/replace_consul_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceConsulOKCode is the HTTP code returned for type ReplaceConsulOK -const ReplaceConsulOKCode int = 200 - -/* -ReplaceConsulOK Consul server replaced - -swagger:response replaceConsulOK -*/ -type ReplaceConsulOK struct { - - /* - In: Body - */ - Payload *models.Consul `json:"body,omitempty"` -} - -// NewReplaceConsulOK creates ReplaceConsulOK with default headers values -func NewReplaceConsulOK() *ReplaceConsulOK { - - return &ReplaceConsulOK{} -} - -// WithPayload adds the payload to the replace consul o k response -func (o *ReplaceConsulOK) WithPayload(payload *models.Consul) *ReplaceConsulOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace consul o k response -func (o *ReplaceConsulOK) SetPayload(payload *models.Consul) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceConsulOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceConsulBadRequestCode is the HTTP code returned for type ReplaceConsulBadRequest -const ReplaceConsulBadRequestCode int = 400 - -/* -ReplaceConsulBadRequest Bad request - -swagger:response replaceConsulBadRequest -*/ -type ReplaceConsulBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceConsulBadRequest creates ReplaceConsulBadRequest with default headers values -func NewReplaceConsulBadRequest() *ReplaceConsulBadRequest { - - return &ReplaceConsulBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace consul bad request response -func (o *ReplaceConsulBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceConsulBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace consul bad request response -func (o *ReplaceConsulBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace consul bad request response -func (o *ReplaceConsulBadRequest) WithPayload(payload *models.Error) *ReplaceConsulBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace consul bad request response -func (o *ReplaceConsulBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceConsulBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceConsulNotFoundCode is the HTTP code returned for type ReplaceConsulNotFound -const ReplaceConsulNotFoundCode int = 404 - -/* -ReplaceConsulNotFound The specified resource was not found - -swagger:response replaceConsulNotFound -*/ -type ReplaceConsulNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceConsulNotFound creates ReplaceConsulNotFound with default headers values -func NewReplaceConsulNotFound() *ReplaceConsulNotFound { - - return &ReplaceConsulNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace consul not found response -func (o *ReplaceConsulNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceConsulNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace consul not found response -func (o *ReplaceConsulNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace consul not found response -func (o *ReplaceConsulNotFound) WithPayload(payload *models.Error) *ReplaceConsulNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace consul not found response -func (o *ReplaceConsulNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceConsulNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceConsulDefault General Error - -swagger:response replaceConsulDefault -*/ -type ReplaceConsulDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceConsulDefault creates ReplaceConsulDefault with default headers values -func NewReplaceConsulDefault(code int) *ReplaceConsulDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceConsulDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace consul default response -func (o *ReplaceConsulDefault) WithStatusCode(code int) *ReplaceConsulDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace consul default response -func (o *ReplaceConsulDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace consul default response -func (o *ReplaceConsulDefault) WithConfigurationVersion(configurationVersion string) *ReplaceConsulDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace consul default response -func (o *ReplaceConsulDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace consul default response -func (o *ReplaceConsulDefault) WithPayload(payload *models.Error) *ReplaceConsulDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace consul default response -func (o *ReplaceConsulDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceConsulDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/service_discovery/replace_consul_urlbuilder.go b/operations/service_discovery/replace_consul_urlbuilder.go deleted file mode 100644 index 4b325830..00000000 --- a/operations/service_discovery/replace_consul_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package service_discovery - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// ReplaceConsulURL generates an URL for the replace consul operation -type ReplaceConsulURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceConsulURL) WithBasePath(bp string) *ReplaceConsulURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceConsulURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceConsulURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service_discovery/consul/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on ReplaceConsulURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceConsulURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceConsulURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceConsulURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceConsulURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceConsulURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceConsulURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/sites/create_site.go b/operations/sites/create_site.go deleted file mode 100644 index d806c830..00000000 --- a/operations/sites/create_site.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSiteHandlerFunc turns a function with the right signature into a create site handler -type CreateSiteHandlerFunc func(CreateSiteParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSiteHandlerFunc) Handle(params CreateSiteParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSiteHandler interface for that can handle valid create site params -type CreateSiteHandler interface { - Handle(CreateSiteParams, interface{}) middleware.Responder -} - -// NewCreateSite creates a new http.Handler for the create site operation -func NewCreateSite(ctx *middleware.Context, handler CreateSiteHandler) *CreateSite { - return &CreateSite{Context: ctx, Handler: handler} -} - -/* - CreateSite swagger:route POST /services/haproxy/sites Sites createSite - -# Add a site - -Adds a new site to the configuration file. -*/ -type CreateSite struct { - Context *middleware.Context - Handler CreateSiteHandler -} - -func (o *CreateSite) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSiteParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/sites/create_site_parameters.go b/operations/sites/create_site_parameters.go deleted file mode 100644 index d511ad29..00000000 --- a/operations/sites/create_site_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSiteParams creates a new CreateSiteParams object -// with the default values initialized. -func NewCreateSiteParams() CreateSiteParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateSiteParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateSiteParams contains all the bound params for the create site operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSite -type CreateSiteParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Site - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSiteParams() beforehand. -func (o *CreateSiteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Site - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateSiteParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateSiteParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSiteParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSiteParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/sites/create_site_responses.go b/operations/sites/create_site_responses.go deleted file mode 100644 index 78297363..00000000 --- a/operations/sites/create_site_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSiteCreatedCode is the HTTP code returned for type CreateSiteCreated -const CreateSiteCreatedCode int = 201 - -/* -CreateSiteCreated Site created - -swagger:response createSiteCreated -*/ -type CreateSiteCreated struct { - - /* - In: Body - */ - Payload *models.Site `json:"body,omitempty"` -} - -// NewCreateSiteCreated creates CreateSiteCreated with default headers values -func NewCreateSiteCreated() *CreateSiteCreated { - - return &CreateSiteCreated{} -} - -// WithPayload adds the payload to the create site created response -func (o *CreateSiteCreated) WithPayload(payload *models.Site) *CreateSiteCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create site created response -func (o *CreateSiteCreated) SetPayload(payload *models.Site) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSiteCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSiteAcceptedCode is the HTTP code returned for type CreateSiteAccepted -const CreateSiteAcceptedCode int = 202 - -/* -CreateSiteAccepted Configuration change accepted and reload requested - -swagger:response createSiteAccepted -*/ -type CreateSiteAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Site `json:"body,omitempty"` -} - -// NewCreateSiteAccepted creates CreateSiteAccepted with default headers values -func NewCreateSiteAccepted() *CreateSiteAccepted { - - return &CreateSiteAccepted{} -} - -// WithReloadID adds the reloadId to the create site accepted response -func (o *CreateSiteAccepted) WithReloadID(reloadID string) *CreateSiteAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create site accepted response -func (o *CreateSiteAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create site accepted response -func (o *CreateSiteAccepted) WithPayload(payload *models.Site) *CreateSiteAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create site accepted response -func (o *CreateSiteAccepted) SetPayload(payload *models.Site) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSiteAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSiteBadRequestCode is the HTTP code returned for type CreateSiteBadRequest -const CreateSiteBadRequestCode int = 400 - -/* -CreateSiteBadRequest Bad request - -swagger:response createSiteBadRequest -*/ -type CreateSiteBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSiteBadRequest creates CreateSiteBadRequest with default headers values -func NewCreateSiteBadRequest() *CreateSiteBadRequest { - - return &CreateSiteBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create site bad request response -func (o *CreateSiteBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSiteBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create site bad request response -func (o *CreateSiteBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create site bad request response -func (o *CreateSiteBadRequest) WithPayload(payload *models.Error) *CreateSiteBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create site bad request response -func (o *CreateSiteBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSiteBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSiteConflictCode is the HTTP code returned for type CreateSiteConflict -const CreateSiteConflictCode int = 409 - -/* -CreateSiteConflict The specified resource already exists - -swagger:response createSiteConflict -*/ -type CreateSiteConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSiteConflict creates CreateSiteConflict with default headers values -func NewCreateSiteConflict() *CreateSiteConflict { - - return &CreateSiteConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create site conflict response -func (o *CreateSiteConflict) WithConfigurationVersion(configurationVersion string) *CreateSiteConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create site conflict response -func (o *CreateSiteConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create site conflict response -func (o *CreateSiteConflict) WithPayload(payload *models.Error) *CreateSiteConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create site conflict response -func (o *CreateSiteConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSiteConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSiteDefault General Error - -swagger:response createSiteDefault -*/ -type CreateSiteDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSiteDefault creates CreateSiteDefault with default headers values -func NewCreateSiteDefault(code int) *CreateSiteDefault { - if code <= 0 { - code = 500 - } - - return &CreateSiteDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create site default response -func (o *CreateSiteDefault) WithStatusCode(code int) *CreateSiteDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create site default response -func (o *CreateSiteDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create site default response -func (o *CreateSiteDefault) WithConfigurationVersion(configurationVersion string) *CreateSiteDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create site default response -func (o *CreateSiteDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create site default response -func (o *CreateSiteDefault) WithPayload(payload *models.Error) *CreateSiteDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create site default response -func (o *CreateSiteDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSiteDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/sites/create_site_urlbuilder.go b/operations/sites/create_site_urlbuilder.go deleted file mode 100644 index 9c9892d8..00000000 --- a/operations/sites/create_site_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateSiteURL generates an URL for the create site operation -type CreateSiteURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSiteURL) WithBasePath(bp string) *CreateSiteURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSiteURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSiteURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/sites" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSiteURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSiteURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSiteURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSiteURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSiteURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSiteURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/sites/delete_site.go b/operations/sites/delete_site.go deleted file mode 100644 index db8f6717..00000000 --- a/operations/sites/delete_site.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSiteHandlerFunc turns a function with the right signature into a delete site handler -type DeleteSiteHandlerFunc func(DeleteSiteParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSiteHandlerFunc) Handle(params DeleteSiteParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSiteHandler interface for that can handle valid delete site params -type DeleteSiteHandler interface { - Handle(DeleteSiteParams, interface{}) middleware.Responder -} - -// NewDeleteSite creates a new http.Handler for the delete site operation -func NewDeleteSite(ctx *middleware.Context, handler DeleteSiteHandler) *DeleteSite { - return &DeleteSite{Context: ctx, Handler: handler} -} - -/* - DeleteSite swagger:route DELETE /services/haproxy/sites/{name} Sites deleteSite - -# Delete a site - -Deletes a site from the configuration by it's name. -*/ -type DeleteSite struct { - Context *middleware.Context - Handler DeleteSiteHandler -} - -func (o *DeleteSite) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSiteParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/sites/delete_site_parameters.go b/operations/sites/delete_site_parameters.go deleted file mode 100644 index 470df2f2..00000000 --- a/operations/sites/delete_site_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSiteParams creates a new DeleteSiteParams object -// with the default values initialized. -func NewDeleteSiteParams() DeleteSiteParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteSiteParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteSiteParams contains all the bound params for the delete site operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSite -type DeleteSiteParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Site frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSiteParams() beforehand. -func (o *DeleteSiteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteSiteParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteSiteParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSiteParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSiteParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSiteParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/sites/delete_site_responses.go b/operations/sites/delete_site_responses.go deleted file mode 100644 index f9a50791..00000000 --- a/operations/sites/delete_site_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSiteAcceptedCode is the HTTP code returned for type DeleteSiteAccepted -const DeleteSiteAcceptedCode int = 202 - -/* -DeleteSiteAccepted Configuration change accepted and reload requested - -swagger:response deleteSiteAccepted -*/ -type DeleteSiteAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteSiteAccepted creates DeleteSiteAccepted with default headers values -func NewDeleteSiteAccepted() *DeleteSiteAccepted { - - return &DeleteSiteAccepted{} -} - -// WithReloadID adds the reloadId to the delete site accepted response -func (o *DeleteSiteAccepted) WithReloadID(reloadID string) *DeleteSiteAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete site accepted response -func (o *DeleteSiteAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteSiteAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteSiteNoContentCode is the HTTP code returned for type DeleteSiteNoContent -const DeleteSiteNoContentCode int = 204 - -/* -DeleteSiteNoContent Site deleted - -swagger:response deleteSiteNoContent -*/ -type DeleteSiteNoContent struct { -} - -// NewDeleteSiteNoContent creates DeleteSiteNoContent with default headers values -func NewDeleteSiteNoContent() *DeleteSiteNoContent { - - return &DeleteSiteNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSiteNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSiteNotFoundCode is the HTTP code returned for type DeleteSiteNotFound -const DeleteSiteNotFoundCode int = 404 - -/* -DeleteSiteNotFound The specified resource was not found - -swagger:response deleteSiteNotFound -*/ -type DeleteSiteNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSiteNotFound creates DeleteSiteNotFound with default headers values -func NewDeleteSiteNotFound() *DeleteSiteNotFound { - - return &DeleteSiteNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete site not found response -func (o *DeleteSiteNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSiteNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete site not found response -func (o *DeleteSiteNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete site not found response -func (o *DeleteSiteNotFound) WithPayload(payload *models.Error) *DeleteSiteNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete site not found response -func (o *DeleteSiteNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSiteNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSiteDefault General Error - -swagger:response deleteSiteDefault -*/ -type DeleteSiteDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSiteDefault creates DeleteSiteDefault with default headers values -func NewDeleteSiteDefault(code int) *DeleteSiteDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSiteDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete site default response -func (o *DeleteSiteDefault) WithStatusCode(code int) *DeleteSiteDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete site default response -func (o *DeleteSiteDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete site default response -func (o *DeleteSiteDefault) WithConfigurationVersion(configurationVersion string) *DeleteSiteDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete site default response -func (o *DeleteSiteDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete site default response -func (o *DeleteSiteDefault) WithPayload(payload *models.Error) *DeleteSiteDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete site default response -func (o *DeleteSiteDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSiteDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/sites/delete_site_urlbuilder.go b/operations/sites/delete_site_urlbuilder.go deleted file mode 100644 index c4370c31..00000000 --- a/operations/sites/delete_site_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSiteURL generates an URL for the delete site operation -type DeleteSiteURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSiteURL) WithBasePath(bp string) *DeleteSiteURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSiteURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSiteURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/sites/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSiteURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSiteURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSiteURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSiteURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSiteURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSiteURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSiteURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/sites/get_site.go b/operations/sites/get_site.go deleted file mode 100644 index 61a9f5c4..00000000 --- a/operations/sites/get_site.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSiteHandlerFunc turns a function with the right signature into a get site handler -type GetSiteHandlerFunc func(GetSiteParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSiteHandlerFunc) Handle(params GetSiteParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSiteHandler interface for that can handle valid get site params -type GetSiteHandler interface { - Handle(GetSiteParams, interface{}) middleware.Responder -} - -// NewGetSite creates a new http.Handler for the get site operation -func NewGetSite(ctx *middleware.Context, handler GetSiteHandler) *GetSite { - return &GetSite{Context: ctx, Handler: handler} -} - -/* - GetSite swagger:route GET /services/haproxy/sites/{name} Sites getSite - -# Return a site - -Returns one site configuration by it's name. -*/ -type GetSite struct { - Context *middleware.Context - Handler GetSiteHandler -} - -func (o *GetSite) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSiteParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/sites/get_site_parameters.go b/operations/sites/get_site_parameters.go deleted file mode 100644 index 398b3fbb..00000000 --- a/operations/sites/get_site_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSiteParams creates a new GetSiteParams object -// -// There are no default values defined in the spec. -func NewGetSiteParams() GetSiteParams { - - return GetSiteParams{} -} - -// GetSiteParams contains all the bound params for the get site operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSite -type GetSiteParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Site frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSiteParams() beforehand. -func (o *GetSiteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetSiteParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSiteParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/sites/get_site_responses.go b/operations/sites/get_site_responses.go deleted file mode 100644 index 7ef9d6f2..00000000 --- a/operations/sites/get_site_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSiteOKCode is the HTTP code returned for type GetSiteOK -const GetSiteOKCode int = 200 - -/* -GetSiteOK Successful operation - -swagger:response getSiteOK -*/ -type GetSiteOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Site `json:"body,omitempty"` -} - -// NewGetSiteOK creates GetSiteOK with default headers values -func NewGetSiteOK() *GetSiteOK { - - return &GetSiteOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get site o k response -func (o *GetSiteOK) WithConfigurationVersion(configurationVersion string) *GetSiteOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get site o k response -func (o *GetSiteOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get site o k response -func (o *GetSiteOK) WithPayload(payload *models.Site) *GetSiteOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get site o k response -func (o *GetSiteOK) SetPayload(payload *models.Site) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSiteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSiteNotFoundCode is the HTTP code returned for type GetSiteNotFound -const GetSiteNotFoundCode int = 404 - -/* -GetSiteNotFound The specified resource was not found - -swagger:response getSiteNotFound -*/ -type GetSiteNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSiteNotFound creates GetSiteNotFound with default headers values -func NewGetSiteNotFound() *GetSiteNotFound { - - return &GetSiteNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get site not found response -func (o *GetSiteNotFound) WithConfigurationVersion(configurationVersion string) *GetSiteNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get site not found response -func (o *GetSiteNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get site not found response -func (o *GetSiteNotFound) WithPayload(payload *models.Error) *GetSiteNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get site not found response -func (o *GetSiteNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSiteNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSiteDefault General Error - -swagger:response getSiteDefault -*/ -type GetSiteDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSiteDefault creates GetSiteDefault with default headers values -func NewGetSiteDefault(code int) *GetSiteDefault { - if code <= 0 { - code = 500 - } - - return &GetSiteDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get site default response -func (o *GetSiteDefault) WithStatusCode(code int) *GetSiteDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get site default response -func (o *GetSiteDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get site default response -func (o *GetSiteDefault) WithConfigurationVersion(configurationVersion string) *GetSiteDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get site default response -func (o *GetSiteDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get site default response -func (o *GetSiteDefault) WithPayload(payload *models.Error) *GetSiteDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get site default response -func (o *GetSiteDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSiteDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/sites/get_site_urlbuilder.go b/operations/sites/get_site_urlbuilder.go deleted file mode 100644 index 368da85d..00000000 --- a/operations/sites/get_site_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSiteURL generates an URL for the get site operation -type GetSiteURL struct { - Name string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSiteURL) WithBasePath(bp string) *GetSiteURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSiteURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSiteURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/sites/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSiteURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSiteURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSiteURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSiteURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSiteURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSiteURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSiteURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/sites/get_sites.go b/operations/sites/get_sites.go deleted file mode 100644 index 92fefa95..00000000 --- a/operations/sites/get_sites.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSitesHandlerFunc turns a function with the right signature into a get sites handler -type GetSitesHandlerFunc func(GetSitesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSitesHandlerFunc) Handle(params GetSitesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSitesHandler interface for that can handle valid get sites params -type GetSitesHandler interface { - Handle(GetSitesParams, interface{}) middleware.Responder -} - -// NewGetSites creates a new http.Handler for the get sites operation -func NewGetSites(ctx *middleware.Context, handler GetSitesHandler) *GetSites { - return &GetSites{Context: ctx, Handler: handler} -} - -/* - GetSites swagger:route GET /services/haproxy/sites Sites getSites - -# Return an array of sites - -Returns an array of all configured sites. -*/ -type GetSites struct { - Context *middleware.Context - Handler GetSitesHandler -} - -func (o *GetSites) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSitesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/sites/get_sites_parameters.go b/operations/sites/get_sites_parameters.go deleted file mode 100644 index a517bd83..00000000 --- a/operations/sites/get_sites_parameters.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSitesParams creates a new GetSitesParams object -// -// There are no default values defined in the spec. -func NewGetSitesParams() GetSitesParams { - - return GetSitesParams{} -} - -// GetSitesParams contains all the bound params for the get sites operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSites -type GetSitesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSitesParams() beforehand. -func (o *GetSitesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSitesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/sites/get_sites_responses.go b/operations/sites/get_sites_responses.go deleted file mode 100644 index fc23289c..00000000 --- a/operations/sites/get_sites_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSitesOKCode is the HTTP code returned for type GetSitesOK -const GetSitesOKCode int = 200 - -/* -GetSitesOK Successful operation - -swagger:response getSitesOK -*/ -type GetSitesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Sites `json:"body,omitempty"` -} - -// NewGetSitesOK creates GetSitesOK with default headers values -func NewGetSitesOK() *GetSitesOK { - - return &GetSitesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get sites o k response -func (o *GetSitesOK) WithConfigurationVersion(configurationVersion string) *GetSitesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get sites o k response -func (o *GetSitesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get sites o k response -func (o *GetSitesOK) WithPayload(payload models.Sites) *GetSitesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get sites o k response -func (o *GetSitesOK) SetPayload(payload models.Sites) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSitesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Sites{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetSitesDefault General Error - -swagger:response getSitesDefault -*/ -type GetSitesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSitesDefault creates GetSitesDefault with default headers values -func NewGetSitesDefault(code int) *GetSitesDefault { - if code <= 0 { - code = 500 - } - - return &GetSitesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get sites default response -func (o *GetSitesDefault) WithStatusCode(code int) *GetSitesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get sites default response -func (o *GetSitesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get sites default response -func (o *GetSitesDefault) WithConfigurationVersion(configurationVersion string) *GetSitesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get sites default response -func (o *GetSitesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get sites default response -func (o *GetSitesDefault) WithPayload(payload *models.Error) *GetSitesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get sites default response -func (o *GetSitesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSitesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/sites/get_sites_urlbuilder.go b/operations/sites/get_sites_urlbuilder.go deleted file mode 100644 index bb73d878..00000000 --- a/operations/sites/get_sites_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetSitesURL generates an URL for the get sites operation -type GetSitesURL struct { - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSitesURL) WithBasePath(bp string) *GetSitesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSitesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSitesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/sites" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSitesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSitesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSitesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSitesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSitesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSitesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/sites/replace_site.go b/operations/sites/replace_site.go deleted file mode 100644 index b1e37e85..00000000 --- a/operations/sites/replace_site.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceSiteHandlerFunc turns a function with the right signature into a replace site handler -type ReplaceSiteHandlerFunc func(ReplaceSiteParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceSiteHandlerFunc) Handle(params ReplaceSiteParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceSiteHandler interface for that can handle valid replace site params -type ReplaceSiteHandler interface { - Handle(ReplaceSiteParams, interface{}) middleware.Responder -} - -// NewReplaceSite creates a new http.Handler for the replace site operation -func NewReplaceSite(ctx *middleware.Context, handler ReplaceSiteHandler) *ReplaceSite { - return &ReplaceSite{Context: ctx, Handler: handler} -} - -/* - ReplaceSite swagger:route PUT /services/haproxy/sites/{name} Sites replaceSite - -# Replace a site - -Replaces a site configuration by it's name. -*/ -type ReplaceSite struct { - Context *middleware.Context - Handler ReplaceSiteHandler -} - -func (o *ReplaceSite) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceSiteParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/sites/replace_site_parameters.go b/operations/sites/replace_site_parameters.go deleted file mode 100644 index 5b6a449a..00000000 --- a/operations/sites/replace_site_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceSiteParams creates a new ReplaceSiteParams object -// with the default values initialized. -func NewReplaceSiteParams() ReplaceSiteParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceSiteParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceSiteParams contains all the bound params for the replace site operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceSite -type ReplaceSiteParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Site - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Site frontend name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceSiteParams() beforehand. -func (o *ReplaceSiteParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Site - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceSiteParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceSiteParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceSiteParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceSiteParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceSiteParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/sites/replace_site_responses.go b/operations/sites/replace_site_responses.go deleted file mode 100644 index 08501e57..00000000 --- a/operations/sites/replace_site_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceSiteOKCode is the HTTP code returned for type ReplaceSiteOK -const ReplaceSiteOKCode int = 200 - -/* -ReplaceSiteOK Site replaced - -swagger:response replaceSiteOK -*/ -type ReplaceSiteOK struct { - - /* - In: Body - */ - Payload *models.Site `json:"body,omitempty"` -} - -// NewReplaceSiteOK creates ReplaceSiteOK with default headers values -func NewReplaceSiteOK() *ReplaceSiteOK { - - return &ReplaceSiteOK{} -} - -// WithPayload adds the payload to the replace site o k response -func (o *ReplaceSiteOK) WithPayload(payload *models.Site) *ReplaceSiteOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace site o k response -func (o *ReplaceSiteOK) SetPayload(payload *models.Site) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSiteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSiteAcceptedCode is the HTTP code returned for type ReplaceSiteAccepted -const ReplaceSiteAcceptedCode int = 202 - -/* -ReplaceSiteAccepted Configuration change accepted and reload requested - -swagger:response replaceSiteAccepted -*/ -type ReplaceSiteAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Site `json:"body,omitempty"` -} - -// NewReplaceSiteAccepted creates ReplaceSiteAccepted with default headers values -func NewReplaceSiteAccepted() *ReplaceSiteAccepted { - - return &ReplaceSiteAccepted{} -} - -// WithReloadID adds the reloadId to the replace site accepted response -func (o *ReplaceSiteAccepted) WithReloadID(reloadID string) *ReplaceSiteAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace site accepted response -func (o *ReplaceSiteAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace site accepted response -func (o *ReplaceSiteAccepted) WithPayload(payload *models.Site) *ReplaceSiteAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace site accepted response -func (o *ReplaceSiteAccepted) SetPayload(payload *models.Site) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSiteAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSiteBadRequestCode is the HTTP code returned for type ReplaceSiteBadRequest -const ReplaceSiteBadRequestCode int = 400 - -/* -ReplaceSiteBadRequest Bad request - -swagger:response replaceSiteBadRequest -*/ -type ReplaceSiteBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSiteBadRequest creates ReplaceSiteBadRequest with default headers values -func NewReplaceSiteBadRequest() *ReplaceSiteBadRequest { - - return &ReplaceSiteBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace site bad request response -func (o *ReplaceSiteBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceSiteBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace site bad request response -func (o *ReplaceSiteBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace site bad request response -func (o *ReplaceSiteBadRequest) WithPayload(payload *models.Error) *ReplaceSiteBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace site bad request response -func (o *ReplaceSiteBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSiteBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSiteNotFoundCode is the HTTP code returned for type ReplaceSiteNotFound -const ReplaceSiteNotFoundCode int = 404 - -/* -ReplaceSiteNotFound The specified resource was not found - -swagger:response replaceSiteNotFound -*/ -type ReplaceSiteNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSiteNotFound creates ReplaceSiteNotFound with default headers values -func NewReplaceSiteNotFound() *ReplaceSiteNotFound { - - return &ReplaceSiteNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace site not found response -func (o *ReplaceSiteNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceSiteNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace site not found response -func (o *ReplaceSiteNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace site not found response -func (o *ReplaceSiteNotFound) WithPayload(payload *models.Error) *ReplaceSiteNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace site not found response -func (o *ReplaceSiteNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSiteNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceSiteDefault General Error - -swagger:response replaceSiteDefault -*/ -type ReplaceSiteDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSiteDefault creates ReplaceSiteDefault with default headers values -func NewReplaceSiteDefault(code int) *ReplaceSiteDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceSiteDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace site default response -func (o *ReplaceSiteDefault) WithStatusCode(code int) *ReplaceSiteDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace site default response -func (o *ReplaceSiteDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace site default response -func (o *ReplaceSiteDefault) WithConfigurationVersion(configurationVersion string) *ReplaceSiteDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace site default response -func (o *ReplaceSiteDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace site default response -func (o *ReplaceSiteDefault) WithPayload(payload *models.Error) *ReplaceSiteDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace site default response -func (o *ReplaceSiteDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSiteDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/sites/replace_site_urlbuilder.go b/operations/sites/replace_site_urlbuilder.go deleted file mode 100644 index 158a42aa..00000000 --- a/operations/sites/replace_site_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sites - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceSiteURL generates an URL for the replace site operation -type ReplaceSiteURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSiteURL) WithBasePath(bp string) *ReplaceSiteURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSiteURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceSiteURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/sites/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceSiteURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceSiteURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceSiteURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceSiteURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceSiteURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceSiteURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceSiteURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/specification/get_specification.go b/operations/specification/get_specification.go deleted file mode 100644 index d2098e5c..00000000 --- a/operations/specification/get_specification.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpecificationHandlerFunc turns a function with the right signature into a get specification handler -type GetSpecificationHandlerFunc func(GetSpecificationParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpecificationHandlerFunc) Handle(params GetSpecificationParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpecificationHandler interface for that can handle valid get specification params -type GetSpecificationHandler interface { - Handle(GetSpecificationParams, interface{}) middleware.Responder -} - -// NewGetSpecification creates a new http.Handler for the get specification operation -func NewGetSpecification(ctx *middleware.Context, handler GetSpecificationHandler) *GetSpecification { - return &GetSpecification{Context: ctx, Handler: handler} -} - -/* - GetSpecification swagger:route GET /specification Specification getSpecification - -# Data Plane API Specification - -Return Data Plane API OpenAPI specification -*/ -type GetSpecification struct { - Context *middleware.Context - Handler GetSpecificationHandler -} - -func (o *GetSpecification) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpecificationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/specification/get_specification_parameters.go b/operations/specification/get_specification_parameters.go deleted file mode 100644 index 6fe336b6..00000000 --- a/operations/specification/get_specification_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetSpecificationParams creates a new GetSpecificationParams object -// -// There are no default values defined in the spec. -func NewGetSpecificationParams() GetSpecificationParams { - - return GetSpecificationParams{} -} - -// GetSpecificationParams contains all the bound params for the get specification operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpecification -type GetSpecificationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpecificationParams() beforehand. -func (o *GetSpecificationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/specification/get_specification_responses.go b/operations/specification/get_specification_responses.go deleted file mode 100644 index ac1bc547..00000000 --- a/operations/specification/get_specification_responses.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpecificationOKCode is the HTTP code returned for type GetSpecificationOK -const GetSpecificationOKCode int = 200 - -/* -GetSpecificationOK Success - -swagger:response getSpecificationOK -*/ -type GetSpecificationOK struct { - - /* - In: Body - */ - Payload interface{} `json:"body,omitempty"` -} - -// NewGetSpecificationOK creates GetSpecificationOK with default headers values -func NewGetSpecificationOK() *GetSpecificationOK { - - return &GetSpecificationOK{} -} - -// WithPayload adds the payload to the get specification o k response -func (o *GetSpecificationOK) WithPayload(payload interface{}) *GetSpecificationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get specification o k response -func (o *GetSpecificationOK) SetPayload(payload interface{}) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpecificationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetSpecificationDefault General Error - -swagger:response getSpecificationDefault -*/ -type GetSpecificationDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpecificationDefault creates GetSpecificationDefault with default headers values -func NewGetSpecificationDefault(code int) *GetSpecificationDefault { - if code <= 0 { - code = 500 - } - - return &GetSpecificationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get specification default response -func (o *GetSpecificationDefault) WithStatusCode(code int) *GetSpecificationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get specification default response -func (o *GetSpecificationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get specification default response -func (o *GetSpecificationDefault) WithConfigurationVersion(configurationVersion string) *GetSpecificationDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get specification default response -func (o *GetSpecificationDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get specification default response -func (o *GetSpecificationDefault) WithPayload(payload *models.Error) *GetSpecificationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get specification default response -func (o *GetSpecificationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpecificationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/specification/get_specification_urlbuilder.go b/operations/specification/get_specification_urlbuilder.go deleted file mode 100644 index 86e513da..00000000 --- a/operations/specification/get_specification_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetSpecificationURL generates an URL for the get specification operation -type GetSpecificationURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpecificationURL) WithBasePath(bp string) *GetSpecificationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpecificationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpecificationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/specification" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpecificationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpecificationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpecificationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpecificationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpecificationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpecificationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/specification_openapiv3/get_openapiv3_specification.go b/operations/specification_openapiv3/get_openapiv3_specification.go deleted file mode 100644 index a230b44c..00000000 --- a/operations/specification_openapiv3/get_openapiv3_specification.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification_openapiv3 - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOpenapiv3SpecificationHandlerFunc turns a function with the right signature into a get openapiv3 specification handler -type GetOpenapiv3SpecificationHandlerFunc func(GetOpenapiv3SpecificationParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOpenapiv3SpecificationHandlerFunc) Handle(params GetOpenapiv3SpecificationParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOpenapiv3SpecificationHandler interface for that can handle valid get openapiv3 specification params -type GetOpenapiv3SpecificationHandler interface { - Handle(GetOpenapiv3SpecificationParams, interface{}) middleware.Responder -} - -// NewGetOpenapiv3Specification creates a new http.Handler for the get openapiv3 specification operation -func NewGetOpenapiv3Specification(ctx *middleware.Context, handler GetOpenapiv3SpecificationHandler) *GetOpenapiv3Specification { - return &GetOpenapiv3Specification{Context: ctx, Handler: handler} -} - -/* - GetOpenapiv3Specification swagger:route GET /specification_openapiv3 SpecificationOpenapiv3 getOpenapiv3Specification - -# Data Plane API v3 Specification - -Return Data Plane API OpenAPI v3 specification -*/ -type GetOpenapiv3Specification struct { - Context *middleware.Context - Handler GetOpenapiv3SpecificationHandler -} - -func (o *GetOpenapiv3Specification) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOpenapiv3SpecificationParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/specification_openapiv3/get_openapiv3_specification_parameters.go b/operations/specification_openapiv3/get_openapiv3_specification_parameters.go deleted file mode 100644 index 233ae5a3..00000000 --- a/operations/specification_openapiv3/get_openapiv3_specification_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification_openapiv3 - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetOpenapiv3SpecificationParams creates a new GetOpenapiv3SpecificationParams object -// -// There are no default values defined in the spec. -func NewGetOpenapiv3SpecificationParams() GetOpenapiv3SpecificationParams { - - return GetOpenapiv3SpecificationParams{} -} - -// GetOpenapiv3SpecificationParams contains all the bound params for the get openapiv3 specification operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOpenapiv3Specification -type GetOpenapiv3SpecificationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOpenapiv3SpecificationParams() beforehand. -func (o *GetOpenapiv3SpecificationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/specification_openapiv3/get_openapiv3_specification_responses.go b/operations/specification_openapiv3/get_openapiv3_specification_responses.go deleted file mode 100644 index 5dd2ac48..00000000 --- a/operations/specification_openapiv3/get_openapiv3_specification_responses.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification_openapiv3 - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOpenapiv3SpecificationOKCode is the HTTP code returned for type GetOpenapiv3SpecificationOK -const GetOpenapiv3SpecificationOKCode int = 200 - -/* -GetOpenapiv3SpecificationOK Success - -swagger:response getOpenapiv3SpecificationOK -*/ -type GetOpenapiv3SpecificationOK struct { - - /* - In: Body - */ - Payload interface{} `json:"body,omitempty"` -} - -// NewGetOpenapiv3SpecificationOK creates GetOpenapiv3SpecificationOK with default headers values -func NewGetOpenapiv3SpecificationOK() *GetOpenapiv3SpecificationOK { - - return &GetOpenapiv3SpecificationOK{} -} - -// WithPayload adds the payload to the get openapiv3 specification o k response -func (o *GetOpenapiv3SpecificationOK) WithPayload(payload interface{}) *GetOpenapiv3SpecificationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get openapiv3 specification o k response -func (o *GetOpenapiv3SpecificationOK) SetPayload(payload interface{}) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOpenapiv3SpecificationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetOpenapiv3SpecificationDefault General Error - -swagger:response getOpenapiv3SpecificationDefault -*/ -type GetOpenapiv3SpecificationDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOpenapiv3SpecificationDefault creates GetOpenapiv3SpecificationDefault with default headers values -func NewGetOpenapiv3SpecificationDefault(code int) *GetOpenapiv3SpecificationDefault { - if code <= 0 { - code = 500 - } - - return &GetOpenapiv3SpecificationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) WithStatusCode(code int) *GetOpenapiv3SpecificationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) WithConfigurationVersion(configurationVersion string) *GetOpenapiv3SpecificationDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) WithPayload(payload *models.Error) *GetOpenapiv3SpecificationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get openapiv3 specification default response -func (o *GetOpenapiv3SpecificationDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOpenapiv3SpecificationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/specification_openapiv3/get_openapiv3_specification_urlbuilder.go b/operations/specification_openapiv3/get_openapiv3_specification_urlbuilder.go deleted file mode 100644 index b5ae907f..00000000 --- a/operations/specification_openapiv3/get_openapiv3_specification_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package specification_openapiv3 - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetOpenapiv3SpecificationURL generates an URL for the get openapiv3 specification operation -type GetOpenapiv3SpecificationURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOpenapiv3SpecificationURL) WithBasePath(bp string) *GetOpenapiv3SpecificationURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOpenapiv3SpecificationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOpenapiv3SpecificationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/specification_openapiv3" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOpenapiv3SpecificationURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOpenapiv3SpecificationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOpenapiv3SpecificationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOpenapiv3SpecificationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOpenapiv3SpecificationURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOpenapiv3SpecificationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/create_spoe.go b/operations/spoe/create_spoe.go deleted file mode 100644 index 4b2e2481..00000000 --- a/operations/spoe/create_spoe.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeHandlerFunc turns a function with the right signature into a create spoe handler -type CreateSpoeHandlerFunc func(CreateSpoeParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSpoeHandlerFunc) Handle(params CreateSpoeParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSpoeHandler interface for that can handle valid create spoe params -type CreateSpoeHandler interface { - Handle(CreateSpoeParams, interface{}) middleware.Responder -} - -// NewCreateSpoe creates a new http.Handler for the create spoe operation -func NewCreateSpoe(ctx *middleware.Context, handler CreateSpoeHandler) *CreateSpoe { - return &CreateSpoe{Context: ctx, Handler: handler} -} - -/* - CreateSpoe swagger:route POST /services/haproxy/spoe/spoe_files Spoe createSpoe - -# Creates SPOE file with its entries - -Creates SPOE file with its entries. -*/ -type CreateSpoe struct { - Context *middleware.Context - Handler CreateSpoeHandler -} - -func (o *CreateSpoe) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSpoeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/create_spoe_agent.go b/operations/spoe/create_spoe_agent.go deleted file mode 100644 index 6e770fbe..00000000 --- a/operations/spoe/create_spoe_agent.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeAgentHandlerFunc turns a function with the right signature into a create spoe agent handler -type CreateSpoeAgentHandlerFunc func(CreateSpoeAgentParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSpoeAgentHandlerFunc) Handle(params CreateSpoeAgentParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSpoeAgentHandler interface for that can handle valid create spoe agent params -type CreateSpoeAgentHandler interface { - Handle(CreateSpoeAgentParams, interface{}) middleware.Responder -} - -// NewCreateSpoeAgent creates a new http.Handler for the create spoe agent operation -func NewCreateSpoeAgent(ctx *middleware.Context, handler CreateSpoeAgentHandler) *CreateSpoeAgent { - return &CreateSpoeAgent{Context: ctx, Handler: handler} -} - -/* - CreateSpoeAgent swagger:route POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents Spoe createSpoeAgent - -# Add a new spoe agent to scope - -Adds a new spoe agent to the spoe scope. -*/ -type CreateSpoeAgent struct { - Context *middleware.Context - Handler CreateSpoeAgentHandler -} - -func (o *CreateSpoeAgent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSpoeAgentParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/create_spoe_agent_parameters.go b/operations/spoe/create_spoe_agent_parameters.go deleted file mode 100644 index f5b6011f..00000000 --- a/operations/spoe/create_spoe_agent_parameters.go +++ /dev/null @@ -1,204 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSpoeAgentParams creates a new CreateSpoeAgentParams object -// -// There are no default values defined in the spec. -func NewCreateSpoeAgentParams() CreateSpoeAgentParams { - - return CreateSpoeAgentParams{} -} - -// CreateSpoeAgentParams contains all the bound params for the create spoe agent operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSpoeAgent -type CreateSpoeAgentParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeAgent - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSpoeAgentParams() beforehand. -func (o *CreateSpoeAgentParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeAgent - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateSpoeAgentParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *CreateSpoeAgentParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSpoeAgentParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSpoeAgentParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/create_spoe_agent_responses.go b/operations/spoe/create_spoe_agent_responses.go deleted file mode 100644 index d985d6fa..00000000 --- a/operations/spoe/create_spoe_agent_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSpoeAgentCreatedCode is the HTTP code returned for type CreateSpoeAgentCreated -const CreateSpoeAgentCreatedCode int = 201 - -/* -CreateSpoeAgentCreated Spoe agent created - -swagger:response createSpoeAgentCreated -*/ -type CreateSpoeAgentCreated struct { - - /* - In: Body - */ - Payload *models.SpoeAgent `json:"body,omitempty"` -} - -// NewCreateSpoeAgentCreated creates CreateSpoeAgentCreated with default headers values -func NewCreateSpoeAgentCreated() *CreateSpoeAgentCreated { - - return &CreateSpoeAgentCreated{} -} - -// WithPayload adds the payload to the create spoe agent created response -func (o *CreateSpoeAgentCreated) WithPayload(payload *models.SpoeAgent) *CreateSpoeAgentCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe agent created response -func (o *CreateSpoeAgentCreated) SetPayload(payload *models.SpoeAgent) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeAgentCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeAgentBadRequestCode is the HTTP code returned for type CreateSpoeAgentBadRequest -const CreateSpoeAgentBadRequestCode int = 400 - -/* -CreateSpoeAgentBadRequest Bad request - -swagger:response createSpoeAgentBadRequest -*/ -type CreateSpoeAgentBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeAgentBadRequest creates CreateSpoeAgentBadRequest with default headers values -func NewCreateSpoeAgentBadRequest() *CreateSpoeAgentBadRequest { - - return &CreateSpoeAgentBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe agent bad request response -func (o *CreateSpoeAgentBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSpoeAgentBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe agent bad request response -func (o *CreateSpoeAgentBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe agent bad request response -func (o *CreateSpoeAgentBadRequest) WithPayload(payload *models.Error) *CreateSpoeAgentBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe agent bad request response -func (o *CreateSpoeAgentBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeAgentBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeAgentConflictCode is the HTTP code returned for type CreateSpoeAgentConflict -const CreateSpoeAgentConflictCode int = 409 - -/* -CreateSpoeAgentConflict The specified resource already exists - -swagger:response createSpoeAgentConflict -*/ -type CreateSpoeAgentConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeAgentConflict creates CreateSpoeAgentConflict with default headers values -func NewCreateSpoeAgentConflict() *CreateSpoeAgentConflict { - - return &CreateSpoeAgentConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe agent conflict response -func (o *CreateSpoeAgentConflict) WithConfigurationVersion(configurationVersion string) *CreateSpoeAgentConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe agent conflict response -func (o *CreateSpoeAgentConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe agent conflict response -func (o *CreateSpoeAgentConflict) WithPayload(payload *models.Error) *CreateSpoeAgentConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe agent conflict response -func (o *CreateSpoeAgentConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeAgentConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSpoeAgentDefault General Error - -swagger:response createSpoeAgentDefault -*/ -type CreateSpoeAgentDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeAgentDefault creates CreateSpoeAgentDefault with default headers values -func NewCreateSpoeAgentDefault(code int) *CreateSpoeAgentDefault { - if code <= 0 { - code = 500 - } - - return &CreateSpoeAgentDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create spoe agent default response -func (o *CreateSpoeAgentDefault) WithStatusCode(code int) *CreateSpoeAgentDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create spoe agent default response -func (o *CreateSpoeAgentDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe agent default response -func (o *CreateSpoeAgentDefault) WithConfigurationVersion(configurationVersion string) *CreateSpoeAgentDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe agent default response -func (o *CreateSpoeAgentDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe agent default response -func (o *CreateSpoeAgentDefault) WithPayload(payload *models.Error) *CreateSpoeAgentDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe agent default response -func (o *CreateSpoeAgentDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeAgentDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/create_spoe_agent_urlbuilder.go b/operations/spoe/create_spoe_agent_urlbuilder.go deleted file mode 100644 index 60656fd5..00000000 --- a/operations/spoe/create_spoe_agent_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateSpoeAgentURL generates an URL for the create spoe agent operation -type CreateSpoeAgentURL struct { - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeAgentURL) WithBasePath(bp string) *CreateSpoeAgentURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeAgentURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSpoeAgentURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateSpoeAgentURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on CreateSpoeAgentURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSpoeAgentURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSpoeAgentURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSpoeAgentURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSpoeAgentURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSpoeAgentURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSpoeAgentURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/create_spoe_group.go b/operations/spoe/create_spoe_group.go deleted file mode 100644 index 1b21e5a7..00000000 --- a/operations/spoe/create_spoe_group.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeGroupHandlerFunc turns a function with the right signature into a create spoe group handler -type CreateSpoeGroupHandlerFunc func(CreateSpoeGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSpoeGroupHandlerFunc) Handle(params CreateSpoeGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSpoeGroupHandler interface for that can handle valid create spoe group params -type CreateSpoeGroupHandler interface { - Handle(CreateSpoeGroupParams, interface{}) middleware.Responder -} - -// NewCreateSpoeGroup creates a new http.Handler for the create spoe group operation -func NewCreateSpoeGroup(ctx *middleware.Context, handler CreateSpoeGroupHandler) *CreateSpoeGroup { - return &CreateSpoeGroup{Context: ctx, Handler: handler} -} - -/* - CreateSpoeGroup swagger:route POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups Spoe createSpoeGroup - -# Add a new SPOE groups - -Adds a new SPOE groups to the SPOE scope. -*/ -type CreateSpoeGroup struct { - Context *middleware.Context - Handler CreateSpoeGroupHandler -} - -func (o *CreateSpoeGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSpoeGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/create_spoe_group_parameters.go b/operations/spoe/create_spoe_group_parameters.go deleted file mode 100644 index 68c6fbd8..00000000 --- a/operations/spoe/create_spoe_group_parameters.go +++ /dev/null @@ -1,204 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSpoeGroupParams creates a new CreateSpoeGroupParams object -// -// There are no default values defined in the spec. -func NewCreateSpoeGroupParams() CreateSpoeGroupParams { - - return CreateSpoeGroupParams{} -} - -// CreateSpoeGroupParams contains all the bound params for the create spoe group operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSpoeGroup -type CreateSpoeGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeGroup - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSpoeGroupParams() beforehand. -func (o *CreateSpoeGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeGroup - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateSpoeGroupParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *CreateSpoeGroupParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSpoeGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSpoeGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/create_spoe_group_responses.go b/operations/spoe/create_spoe_group_responses.go deleted file mode 100644 index 4dbd3592..00000000 --- a/operations/spoe/create_spoe_group_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSpoeGroupCreatedCode is the HTTP code returned for type CreateSpoeGroupCreated -const CreateSpoeGroupCreatedCode int = 201 - -/* -CreateSpoeGroupCreated Spoe groups created - -swagger:response createSpoeGroupCreated -*/ -type CreateSpoeGroupCreated struct { - - /* - In: Body - */ - Payload *models.SpoeGroup `json:"body,omitempty"` -} - -// NewCreateSpoeGroupCreated creates CreateSpoeGroupCreated with default headers values -func NewCreateSpoeGroupCreated() *CreateSpoeGroupCreated { - - return &CreateSpoeGroupCreated{} -} - -// WithPayload adds the payload to the create spoe group created response -func (o *CreateSpoeGroupCreated) WithPayload(payload *models.SpoeGroup) *CreateSpoeGroupCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe group created response -func (o *CreateSpoeGroupCreated) SetPayload(payload *models.SpoeGroup) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeGroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeGroupBadRequestCode is the HTTP code returned for type CreateSpoeGroupBadRequest -const CreateSpoeGroupBadRequestCode int = 400 - -/* -CreateSpoeGroupBadRequest Bad request - -swagger:response createSpoeGroupBadRequest -*/ -type CreateSpoeGroupBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeGroupBadRequest creates CreateSpoeGroupBadRequest with default headers values -func NewCreateSpoeGroupBadRequest() *CreateSpoeGroupBadRequest { - - return &CreateSpoeGroupBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe group bad request response -func (o *CreateSpoeGroupBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSpoeGroupBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe group bad request response -func (o *CreateSpoeGroupBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe group bad request response -func (o *CreateSpoeGroupBadRequest) WithPayload(payload *models.Error) *CreateSpoeGroupBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe group bad request response -func (o *CreateSpoeGroupBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeGroupConflictCode is the HTTP code returned for type CreateSpoeGroupConflict -const CreateSpoeGroupConflictCode int = 409 - -/* -CreateSpoeGroupConflict The specified resource already exists - -swagger:response createSpoeGroupConflict -*/ -type CreateSpoeGroupConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeGroupConflict creates CreateSpoeGroupConflict with default headers values -func NewCreateSpoeGroupConflict() *CreateSpoeGroupConflict { - - return &CreateSpoeGroupConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe group conflict response -func (o *CreateSpoeGroupConflict) WithConfigurationVersion(configurationVersion string) *CreateSpoeGroupConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe group conflict response -func (o *CreateSpoeGroupConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe group conflict response -func (o *CreateSpoeGroupConflict) WithPayload(payload *models.Error) *CreateSpoeGroupConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe group conflict response -func (o *CreateSpoeGroupConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeGroupConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSpoeGroupDefault General Error - -swagger:response createSpoeGroupDefault -*/ -type CreateSpoeGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeGroupDefault creates CreateSpoeGroupDefault with default headers values -func NewCreateSpoeGroupDefault(code int) *CreateSpoeGroupDefault { - if code <= 0 { - code = 500 - } - - return &CreateSpoeGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create spoe group default response -func (o *CreateSpoeGroupDefault) WithStatusCode(code int) *CreateSpoeGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create spoe group default response -func (o *CreateSpoeGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe group default response -func (o *CreateSpoeGroupDefault) WithConfigurationVersion(configurationVersion string) *CreateSpoeGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe group default response -func (o *CreateSpoeGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe group default response -func (o *CreateSpoeGroupDefault) WithPayload(payload *models.Error) *CreateSpoeGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe group default response -func (o *CreateSpoeGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/create_spoe_group_urlbuilder.go b/operations/spoe/create_spoe_group_urlbuilder.go deleted file mode 100644 index 6620d042..00000000 --- a/operations/spoe/create_spoe_group_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateSpoeGroupURL generates an URL for the create spoe group operation -type CreateSpoeGroupURL struct { - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeGroupURL) WithBasePath(bp string) *CreateSpoeGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSpoeGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateSpoeGroupURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on CreateSpoeGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSpoeGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSpoeGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSpoeGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSpoeGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSpoeGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSpoeGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/create_spoe_message.go b/operations/spoe/create_spoe_message.go deleted file mode 100644 index 64bfb4c9..00000000 --- a/operations/spoe/create_spoe_message.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeMessageHandlerFunc turns a function with the right signature into a create spoe message handler -type CreateSpoeMessageHandlerFunc func(CreateSpoeMessageParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSpoeMessageHandlerFunc) Handle(params CreateSpoeMessageParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSpoeMessageHandler interface for that can handle valid create spoe message params -type CreateSpoeMessageHandler interface { - Handle(CreateSpoeMessageParams, interface{}) middleware.Responder -} - -// NewCreateSpoeMessage creates a new http.Handler for the create spoe message operation -func NewCreateSpoeMessage(ctx *middleware.Context, handler CreateSpoeMessageHandler) *CreateSpoeMessage { - return &CreateSpoeMessage{Context: ctx, Handler: handler} -} - -/* - CreateSpoeMessage swagger:route POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages Spoe createSpoeMessage - -# Add a new spoe message to scope - -Adds a new spoe message to the spoe scope. -*/ -type CreateSpoeMessage struct { - Context *middleware.Context - Handler CreateSpoeMessageHandler -} - -func (o *CreateSpoeMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSpoeMessageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/create_spoe_message_parameters.go b/operations/spoe/create_spoe_message_parameters.go deleted file mode 100644 index e40e8c7f..00000000 --- a/operations/spoe/create_spoe_message_parameters.go +++ /dev/null @@ -1,204 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSpoeMessageParams creates a new CreateSpoeMessageParams object -// -// There are no default values defined in the spec. -func NewCreateSpoeMessageParams() CreateSpoeMessageParams { - - return CreateSpoeMessageParams{} -} - -// CreateSpoeMessageParams contains all the bound params for the create spoe message operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSpoeMessage -type CreateSpoeMessageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeMessage - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSpoeMessageParams() beforehand. -func (o *CreateSpoeMessageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeMessage - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateSpoeMessageParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *CreateSpoeMessageParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSpoeMessageParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSpoeMessageParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/create_spoe_message_responses.go b/operations/spoe/create_spoe_message_responses.go deleted file mode 100644 index 0a0c14d4..00000000 --- a/operations/spoe/create_spoe_message_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSpoeMessageCreatedCode is the HTTP code returned for type CreateSpoeMessageCreated -const CreateSpoeMessageCreatedCode int = 201 - -/* -CreateSpoeMessageCreated Spoe message created - -swagger:response createSpoeMessageCreated -*/ -type CreateSpoeMessageCreated struct { - - /* - In: Body - */ - Payload *models.SpoeMessage `json:"body,omitempty"` -} - -// NewCreateSpoeMessageCreated creates CreateSpoeMessageCreated with default headers values -func NewCreateSpoeMessageCreated() *CreateSpoeMessageCreated { - - return &CreateSpoeMessageCreated{} -} - -// WithPayload adds the payload to the create spoe message created response -func (o *CreateSpoeMessageCreated) WithPayload(payload *models.SpoeMessage) *CreateSpoeMessageCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe message created response -func (o *CreateSpoeMessageCreated) SetPayload(payload *models.SpoeMessage) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeMessageCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeMessageBadRequestCode is the HTTP code returned for type CreateSpoeMessageBadRequest -const CreateSpoeMessageBadRequestCode int = 400 - -/* -CreateSpoeMessageBadRequest Bad request - -swagger:response createSpoeMessageBadRequest -*/ -type CreateSpoeMessageBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeMessageBadRequest creates CreateSpoeMessageBadRequest with default headers values -func NewCreateSpoeMessageBadRequest() *CreateSpoeMessageBadRequest { - - return &CreateSpoeMessageBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe message bad request response -func (o *CreateSpoeMessageBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSpoeMessageBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe message bad request response -func (o *CreateSpoeMessageBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe message bad request response -func (o *CreateSpoeMessageBadRequest) WithPayload(payload *models.Error) *CreateSpoeMessageBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe message bad request response -func (o *CreateSpoeMessageBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeMessageBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeMessageConflictCode is the HTTP code returned for type CreateSpoeMessageConflict -const CreateSpoeMessageConflictCode int = 409 - -/* -CreateSpoeMessageConflict The specified resource already exists - -swagger:response createSpoeMessageConflict -*/ -type CreateSpoeMessageConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeMessageConflict creates CreateSpoeMessageConflict with default headers values -func NewCreateSpoeMessageConflict() *CreateSpoeMessageConflict { - - return &CreateSpoeMessageConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe message conflict response -func (o *CreateSpoeMessageConflict) WithConfigurationVersion(configurationVersion string) *CreateSpoeMessageConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe message conflict response -func (o *CreateSpoeMessageConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe message conflict response -func (o *CreateSpoeMessageConflict) WithPayload(payload *models.Error) *CreateSpoeMessageConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe message conflict response -func (o *CreateSpoeMessageConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeMessageConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSpoeMessageDefault General Error - -swagger:response createSpoeMessageDefault -*/ -type CreateSpoeMessageDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeMessageDefault creates CreateSpoeMessageDefault with default headers values -func NewCreateSpoeMessageDefault(code int) *CreateSpoeMessageDefault { - if code <= 0 { - code = 500 - } - - return &CreateSpoeMessageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create spoe message default response -func (o *CreateSpoeMessageDefault) WithStatusCode(code int) *CreateSpoeMessageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create spoe message default response -func (o *CreateSpoeMessageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe message default response -func (o *CreateSpoeMessageDefault) WithConfigurationVersion(configurationVersion string) *CreateSpoeMessageDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe message default response -func (o *CreateSpoeMessageDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe message default response -func (o *CreateSpoeMessageDefault) WithPayload(payload *models.Error) *CreateSpoeMessageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe message default response -func (o *CreateSpoeMessageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeMessageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/create_spoe_message_urlbuilder.go b/operations/spoe/create_spoe_message_urlbuilder.go deleted file mode 100644 index 376beffd..00000000 --- a/operations/spoe/create_spoe_message_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateSpoeMessageURL generates an URL for the create spoe message operation -type CreateSpoeMessageURL struct { - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeMessageURL) WithBasePath(bp string) *CreateSpoeMessageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeMessageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSpoeMessageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateSpoeMessageURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on CreateSpoeMessageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSpoeMessageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSpoeMessageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSpoeMessageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSpoeMessageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSpoeMessageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSpoeMessageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/create_spoe_parameters.go b/operations/spoe/create_spoe_parameters.go deleted file mode 100644 index ef69231d..00000000 --- a/operations/spoe/create_spoe_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateSpoeMaxParseMemory int64 = 32 << 20 - -// NewCreateSpoeParams creates a new CreateSpoeParams object -// -// There are no default values defined in the spec. -func NewCreateSpoeParams() CreateSpoeParams { - - return CreateSpoeParams{} -} - -// CreateSpoeParams contains all the bound params for the create spoe operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSpoe -type CreateSpoeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*The spoe file to upload - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSpoeParams() beforehand. -func (o *CreateSpoeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateSpoeMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateSpoeParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/spoe/create_spoe_responses.go b/operations/spoe/create_spoe_responses.go deleted file mode 100644 index 571bef79..00000000 --- a/operations/spoe/create_spoe_responses.go +++ /dev/null @@ -1,287 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSpoeCreatedCode is the HTTP code returned for type CreateSpoeCreated -const CreateSpoeCreatedCode int = 201 - -/* -CreateSpoeCreated SPOE file created with its entries - -swagger:response createSpoeCreated -*/ -type CreateSpoeCreated struct { - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewCreateSpoeCreated creates CreateSpoeCreated with default headers values -func NewCreateSpoeCreated() *CreateSpoeCreated { - - return &CreateSpoeCreated{} -} - -// WithPayload adds the payload to the create spoe created response -func (o *CreateSpoeCreated) WithPayload(payload string) *CreateSpoeCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe created response -func (o *CreateSpoeCreated) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// CreateSpoeBadRequestCode is the HTTP code returned for type CreateSpoeBadRequest -const CreateSpoeBadRequestCode int = 400 - -/* -CreateSpoeBadRequest Bad request - -swagger:response createSpoeBadRequest -*/ -type CreateSpoeBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeBadRequest creates CreateSpoeBadRequest with default headers values -func NewCreateSpoeBadRequest() *CreateSpoeBadRequest { - - return &CreateSpoeBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe bad request response -func (o *CreateSpoeBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSpoeBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe bad request response -func (o *CreateSpoeBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe bad request response -func (o *CreateSpoeBadRequest) WithPayload(payload *models.Error) *CreateSpoeBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe bad request response -func (o *CreateSpoeBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeConflictCode is the HTTP code returned for type CreateSpoeConflict -const CreateSpoeConflictCode int = 409 - -/* -CreateSpoeConflict The specified resource already exists - -swagger:response createSpoeConflict -*/ -type CreateSpoeConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeConflict creates CreateSpoeConflict with default headers values -func NewCreateSpoeConflict() *CreateSpoeConflict { - - return &CreateSpoeConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe conflict response -func (o *CreateSpoeConflict) WithConfigurationVersion(configurationVersion string) *CreateSpoeConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe conflict response -func (o *CreateSpoeConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe conflict response -func (o *CreateSpoeConflict) WithPayload(payload *models.Error) *CreateSpoeConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe conflict response -func (o *CreateSpoeConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSpoeDefault General Error - -swagger:response createSpoeDefault -*/ -type CreateSpoeDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeDefault creates CreateSpoeDefault with default headers values -func NewCreateSpoeDefault(code int) *CreateSpoeDefault { - if code <= 0 { - code = 500 - } - - return &CreateSpoeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create spoe default response -func (o *CreateSpoeDefault) WithStatusCode(code int) *CreateSpoeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create spoe default response -func (o *CreateSpoeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe default response -func (o *CreateSpoeDefault) WithConfigurationVersion(configurationVersion string) *CreateSpoeDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe default response -func (o *CreateSpoeDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe default response -func (o *CreateSpoeDefault) WithPayload(payload *models.Error) *CreateSpoeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe default response -func (o *CreateSpoeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/create_spoe_scope.go b/operations/spoe/create_spoe_scope.go deleted file mode 100644 index 43207283..00000000 --- a/operations/spoe/create_spoe_scope.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateSpoeScopeHandlerFunc turns a function with the right signature into a create spoe scope handler -type CreateSpoeScopeHandlerFunc func(CreateSpoeScopeParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateSpoeScopeHandlerFunc) Handle(params CreateSpoeScopeParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateSpoeScopeHandler interface for that can handle valid create spoe scope params -type CreateSpoeScopeHandler interface { - Handle(CreateSpoeScopeParams, interface{}) middleware.Responder -} - -// NewCreateSpoeScope creates a new http.Handler for the create spoe scope operation -func NewCreateSpoeScope(ctx *middleware.Context, handler CreateSpoeScopeHandler) *CreateSpoeScope { - return &CreateSpoeScope{Context: ctx, Handler: handler} -} - -/* - CreateSpoeScope swagger:route POST /services/haproxy/spoe/spoe_files/{parent_name}/scopes Spoe createSpoeScope - -# Add a new spoe scope - -Adds a new spoe scope. -*/ -type CreateSpoeScope struct { - Context *middleware.Context - Handler CreateSpoeScopeHandler -} - -func (o *CreateSpoeScope) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateSpoeScopeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/create_spoe_scope_parameters.go b/operations/spoe/create_spoe_scope_parameters.go deleted file mode 100644 index 271c52db..00000000 --- a/operations/spoe/create_spoe_scope_parameters.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateSpoeScopeParams creates a new CreateSpoeScopeParams object -// -// There are no default values defined in the spec. -func NewCreateSpoeScopeParams() CreateSpoeScopeParams { - - return CreateSpoeScopeParams{} -} - -// CreateSpoeScopeParams contains all the bound params for the create spoe scope operation -// typically these are obtained from a http.Request -// -// swagger:parameters createSpoeScope -type CreateSpoeScopeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.SpoeScope - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateSpoeScopeParams() beforehand. -func (o *CreateSpoeScopeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeScope - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateSpoeScopeParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateSpoeScopeParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateSpoeScopeParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/create_spoe_scope_responses.go b/operations/spoe/create_spoe_scope_responses.go deleted file mode 100644 index 48ea63c2..00000000 --- a/operations/spoe/create_spoe_scope_responses.go +++ /dev/null @@ -1,287 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateSpoeScopeCreatedCode is the HTTP code returned for type CreateSpoeScopeCreated -const CreateSpoeScopeCreatedCode int = 201 - -/* -CreateSpoeScopeCreated Spoe scope created - -swagger:response createSpoeScopeCreated -*/ -type CreateSpoeScopeCreated struct { - - /* - In: Body - */ - Payload models.SpoeScope `json:"body,omitempty"` -} - -// NewCreateSpoeScopeCreated creates CreateSpoeScopeCreated with default headers values -func NewCreateSpoeScopeCreated() *CreateSpoeScopeCreated { - - return &CreateSpoeScopeCreated{} -} - -// WithPayload adds the payload to the create spoe scope created response -func (o *CreateSpoeScopeCreated) WithPayload(payload models.SpoeScope) *CreateSpoeScopeCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe scope created response -func (o *CreateSpoeScopeCreated) SetPayload(payload models.SpoeScope) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeScopeCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// CreateSpoeScopeBadRequestCode is the HTTP code returned for type CreateSpoeScopeBadRequest -const CreateSpoeScopeBadRequestCode int = 400 - -/* -CreateSpoeScopeBadRequest Bad request - -swagger:response createSpoeScopeBadRequest -*/ -type CreateSpoeScopeBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeScopeBadRequest creates CreateSpoeScopeBadRequest with default headers values -func NewCreateSpoeScopeBadRequest() *CreateSpoeScopeBadRequest { - - return &CreateSpoeScopeBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe scope bad request response -func (o *CreateSpoeScopeBadRequest) WithConfigurationVersion(configurationVersion string) *CreateSpoeScopeBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe scope bad request response -func (o *CreateSpoeScopeBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe scope bad request response -func (o *CreateSpoeScopeBadRequest) WithPayload(payload *models.Error) *CreateSpoeScopeBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe scope bad request response -func (o *CreateSpoeScopeBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeScopeBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateSpoeScopeConflictCode is the HTTP code returned for type CreateSpoeScopeConflict -const CreateSpoeScopeConflictCode int = 409 - -/* -CreateSpoeScopeConflict The specified resource already exists - -swagger:response createSpoeScopeConflict -*/ -type CreateSpoeScopeConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeScopeConflict creates CreateSpoeScopeConflict with default headers values -func NewCreateSpoeScopeConflict() *CreateSpoeScopeConflict { - - return &CreateSpoeScopeConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe scope conflict response -func (o *CreateSpoeScopeConflict) WithConfigurationVersion(configurationVersion string) *CreateSpoeScopeConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe scope conflict response -func (o *CreateSpoeScopeConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe scope conflict response -func (o *CreateSpoeScopeConflict) WithPayload(payload *models.Error) *CreateSpoeScopeConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe scope conflict response -func (o *CreateSpoeScopeConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeScopeConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateSpoeScopeDefault General Error - -swagger:response createSpoeScopeDefault -*/ -type CreateSpoeScopeDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateSpoeScopeDefault creates CreateSpoeScopeDefault with default headers values -func NewCreateSpoeScopeDefault(code int) *CreateSpoeScopeDefault { - if code <= 0 { - code = 500 - } - - return &CreateSpoeScopeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create spoe scope default response -func (o *CreateSpoeScopeDefault) WithStatusCode(code int) *CreateSpoeScopeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create spoe scope default response -func (o *CreateSpoeScopeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create spoe scope default response -func (o *CreateSpoeScopeDefault) WithConfigurationVersion(configurationVersion string) *CreateSpoeScopeDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create spoe scope default response -func (o *CreateSpoeScopeDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create spoe scope default response -func (o *CreateSpoeScopeDefault) WithPayload(payload *models.Error) *CreateSpoeScopeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create spoe scope default response -func (o *CreateSpoeScopeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateSpoeScopeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/create_spoe_scope_urlbuilder.go b/operations/spoe/create_spoe_scope_urlbuilder.go deleted file mode 100644 index e26da246..00000000 --- a/operations/spoe/create_spoe_scope_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateSpoeScopeURL generates an URL for the create spoe scope operation -type CreateSpoeScopeURL struct { - ParentName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeScopeURL) WithBasePath(bp string) *CreateSpoeScopeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeScopeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSpoeScopeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateSpoeScopeURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSpoeScopeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSpoeScopeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSpoeScopeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSpoeScopeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSpoeScopeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSpoeScopeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/create_spoe_urlbuilder.go b/operations/spoe/create_spoe_urlbuilder.go deleted file mode 100644 index a6b81d78..00000000 --- a/operations/spoe/create_spoe_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateSpoeURL generates an URL for the create spoe operation -type CreateSpoeURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeURL) WithBasePath(bp string) *CreateSpoeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateSpoeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateSpoeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateSpoeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateSpoeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateSpoeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateSpoeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateSpoeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateSpoeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/delete_spoe_agent.go b/operations/spoe/delete_spoe_agent.go deleted file mode 100644 index 88384e38..00000000 --- a/operations/spoe/delete_spoe_agent.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeAgentHandlerFunc turns a function with the right signature into a delete spoe agent handler -type DeleteSpoeAgentHandlerFunc func(DeleteSpoeAgentParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeAgentHandlerFunc) Handle(params DeleteSpoeAgentParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeAgentHandler interface for that can handle valid delete spoe agent params -type DeleteSpoeAgentHandler interface { - Handle(DeleteSpoeAgentParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeAgent creates a new http.Handler for the delete spoe agent operation -func NewDeleteSpoeAgent(ctx *middleware.Context, handler DeleteSpoeAgentHandler) *DeleteSpoeAgent { - return &DeleteSpoeAgent{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeAgent swagger:route DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name} Spoe deleteSpoeAgent - -# Delete a SPOE agent - -Deletes a SPOE agent from the configuration in one SPOE scope. -*/ -type DeleteSpoeAgent struct { - Context *middleware.Context - Handler DeleteSpoeAgentHandler -} - -func (o *DeleteSpoeAgent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeAgentParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/delete_spoe_agent_parameters.go b/operations/spoe/delete_spoe_agent_parameters.go deleted file mode 100644 index edd90454..00000000 --- a/operations/spoe/delete_spoe_agent_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSpoeAgentParams creates a new DeleteSpoeAgentParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeAgentParams() DeleteSpoeAgentParams { - - return DeleteSpoeAgentParams{} -} - -// DeleteSpoeAgentParams contains all the bound params for the delete spoe agent operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeAgent -type DeleteSpoeAgentParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe agent name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeAgentParams() beforehand. -func (o *DeleteSpoeAgentParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSpoeAgentParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSpoeAgentParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *DeleteSpoeAgentParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSpoeAgentParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSpoeAgentParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/delete_spoe_agent_responses.go b/operations/spoe/delete_spoe_agent_responses.go deleted file mode 100644 index afcf6277..00000000 --- a/operations/spoe/delete_spoe_agent_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeAgentNoContentCode is the HTTP code returned for type DeleteSpoeAgentNoContent -const DeleteSpoeAgentNoContentCode int = 204 - -/* -DeleteSpoeAgentNoContent Spoe agent deleted - -swagger:response deleteSpoeAgentNoContent -*/ -type DeleteSpoeAgentNoContent struct { -} - -// NewDeleteSpoeAgentNoContent creates DeleteSpoeAgentNoContent with default headers values -func NewDeleteSpoeAgentNoContent() *DeleteSpoeAgentNoContent { - - return &DeleteSpoeAgentNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeAgentNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeAgentNotFoundCode is the HTTP code returned for type DeleteSpoeAgentNotFound -const DeleteSpoeAgentNotFoundCode int = 404 - -/* -DeleteSpoeAgentNotFound The specified resource was not found - -swagger:response deleteSpoeAgentNotFound -*/ -type DeleteSpoeAgentNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeAgentNotFound creates DeleteSpoeAgentNotFound with default headers values -func NewDeleteSpoeAgentNotFound() *DeleteSpoeAgentNotFound { - - return &DeleteSpoeAgentNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe agent not found response -func (o *DeleteSpoeAgentNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeAgentNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe agent not found response -func (o *DeleteSpoeAgentNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe agent not found response -func (o *DeleteSpoeAgentNotFound) WithPayload(payload *models.Error) *DeleteSpoeAgentNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe agent not found response -func (o *DeleteSpoeAgentNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeAgentNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeAgentDefault General Error - -swagger:response deleteSpoeAgentDefault -*/ -type DeleteSpoeAgentDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeAgentDefault creates DeleteSpoeAgentDefault with default headers values -func NewDeleteSpoeAgentDefault(code int) *DeleteSpoeAgentDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeAgentDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) WithStatusCode(code int) *DeleteSpoeAgentDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeAgentDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) WithPayload(payload *models.Error) *DeleteSpoeAgentDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe agent default response -func (o *DeleteSpoeAgentDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeAgentDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/delete_spoe_agent_urlbuilder.go b/operations/spoe/delete_spoe_agent_urlbuilder.go deleted file mode 100644 index 1db74430..00000000 --- a/operations/spoe/delete_spoe_agent_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSpoeAgentURL generates an URL for the delete spoe agent operation -type DeleteSpoeAgentURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeAgentURL) WithBasePath(bp string) *DeleteSpoeAgentURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeAgentURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeAgentURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSpoeAgentURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSpoeAgentURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on DeleteSpoeAgentURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeAgentURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeAgentURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeAgentURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeAgentURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeAgentURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeAgentURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/delete_spoe_file.go b/operations/spoe/delete_spoe_file.go deleted file mode 100644 index f1acbd35..00000000 --- a/operations/spoe/delete_spoe_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeFileHandlerFunc turns a function with the right signature into a delete spoe file handler -type DeleteSpoeFileHandlerFunc func(DeleteSpoeFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeFileHandlerFunc) Handle(params DeleteSpoeFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeFileHandler interface for that can handle valid delete spoe file params -type DeleteSpoeFileHandler interface { - Handle(DeleteSpoeFileParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeFile creates a new http.Handler for the delete spoe file operation -func NewDeleteSpoeFile(ctx *middleware.Context, handler DeleteSpoeFileHandler) *DeleteSpoeFile { - return &DeleteSpoeFile{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeFile swagger:route DELETE /services/haproxy/spoe/spoe_files/{name} Spoe deleteSpoeFile - -# Delete SPOE file - -Deletes SPOE file. -*/ -type DeleteSpoeFile struct { - Context *middleware.Context - Handler DeleteSpoeFileHandler -} - -func (o *DeleteSpoeFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/delete_spoe_file_parameters.go b/operations/spoe/delete_spoe_file_parameters.go deleted file mode 100644 index bbc0a8ec..00000000 --- a/operations/spoe/delete_spoe_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteSpoeFileParams creates a new DeleteSpoeFileParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeFileParams() DeleteSpoeFileParams { - - return DeleteSpoeFileParams{} -} - -// DeleteSpoeFileParams contains all the bound params for the delete spoe file operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeFile -type DeleteSpoeFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SPOE file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeFileParams() beforehand. -func (o *DeleteSpoeFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSpoeFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/spoe/delete_spoe_file_responses.go b/operations/spoe/delete_spoe_file_responses.go deleted file mode 100644 index cfd4a1ed..00000000 --- a/operations/spoe/delete_spoe_file_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeFileNoContentCode is the HTTP code returned for type DeleteSpoeFileNoContent -const DeleteSpoeFileNoContentCode int = 204 - -/* -DeleteSpoeFileNoContent SPOE file deleted - -swagger:response deleteSpoeFileNoContent -*/ -type DeleteSpoeFileNoContent struct { -} - -// NewDeleteSpoeFileNoContent creates DeleteSpoeFileNoContent with default headers values -func NewDeleteSpoeFileNoContent() *DeleteSpoeFileNoContent { - - return &DeleteSpoeFileNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeFileNotFoundCode is the HTTP code returned for type DeleteSpoeFileNotFound -const DeleteSpoeFileNotFoundCode int = 404 - -/* -DeleteSpoeFileNotFound The specified resource was not found - -swagger:response deleteSpoeFileNotFound -*/ -type DeleteSpoeFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeFileNotFound creates DeleteSpoeFileNotFound with default headers values -func NewDeleteSpoeFileNotFound() *DeleteSpoeFileNotFound { - - return &DeleteSpoeFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe file not found response -func (o *DeleteSpoeFileNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe file not found response -func (o *DeleteSpoeFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe file not found response -func (o *DeleteSpoeFileNotFound) WithPayload(payload *models.Error) *DeleteSpoeFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe file not found response -func (o *DeleteSpoeFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeFileDefault General Error - -swagger:response deleteSpoeFileDefault -*/ -type DeleteSpoeFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeFileDefault creates DeleteSpoeFileDefault with default headers values -func NewDeleteSpoeFileDefault(code int) *DeleteSpoeFileDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe file default response -func (o *DeleteSpoeFileDefault) WithStatusCode(code int) *DeleteSpoeFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe file default response -func (o *DeleteSpoeFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe file default response -func (o *DeleteSpoeFileDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe file default response -func (o *DeleteSpoeFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe file default response -func (o *DeleteSpoeFileDefault) WithPayload(payload *models.Error) *DeleteSpoeFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe file default response -func (o *DeleteSpoeFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/delete_spoe_file_urlbuilder.go b/operations/spoe/delete_spoe_file_urlbuilder.go deleted file mode 100644 index f88e4dee..00000000 --- a/operations/spoe/delete_spoe_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteSpoeFileURL generates an URL for the delete spoe file operation -type DeleteSpoeFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeFileURL) WithBasePath(bp string) *DeleteSpoeFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSpoeFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/delete_spoe_group.go b/operations/spoe/delete_spoe_group.go deleted file mode 100644 index 42260916..00000000 --- a/operations/spoe/delete_spoe_group.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeGroupHandlerFunc turns a function with the right signature into a delete spoe group handler -type DeleteSpoeGroupHandlerFunc func(DeleteSpoeGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeGroupHandlerFunc) Handle(params DeleteSpoeGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeGroupHandler interface for that can handle valid delete spoe group params -type DeleteSpoeGroupHandler interface { - Handle(DeleteSpoeGroupParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeGroup creates a new http.Handler for the delete spoe group operation -func NewDeleteSpoeGroup(ctx *middleware.Context, handler DeleteSpoeGroupHandler) *DeleteSpoeGroup { - return &DeleteSpoeGroup{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeGroup swagger:route DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name} Spoe deleteSpoeGroup - -# Delete a SPOE groups - -Deletes a SPOE groups from the one SPOE scope. -*/ -type DeleteSpoeGroup struct { - Context *middleware.Context - Handler DeleteSpoeGroupHandler -} - -func (o *DeleteSpoeGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/delete_spoe_group_parameters.go b/operations/spoe/delete_spoe_group_parameters.go deleted file mode 100644 index 640fffbf..00000000 --- a/operations/spoe/delete_spoe_group_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSpoeGroupParams creates a new DeleteSpoeGroupParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeGroupParams() DeleteSpoeGroupParams { - - return DeleteSpoeGroupParams{} -} - -// DeleteSpoeGroupParams contains all the bound params for the delete spoe group operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeGroup -type DeleteSpoeGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe group name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeGroupParams() beforehand. -func (o *DeleteSpoeGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSpoeGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSpoeGroupParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *DeleteSpoeGroupParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSpoeGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSpoeGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/delete_spoe_group_responses.go b/operations/spoe/delete_spoe_group_responses.go deleted file mode 100644 index cf39598e..00000000 --- a/operations/spoe/delete_spoe_group_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeGroupNoContentCode is the HTTP code returned for type DeleteSpoeGroupNoContent -const DeleteSpoeGroupNoContentCode int = 204 - -/* -DeleteSpoeGroupNoContent Spoe group deleted - -swagger:response deleteSpoeGroupNoContent -*/ -type DeleteSpoeGroupNoContent struct { -} - -// NewDeleteSpoeGroupNoContent creates DeleteSpoeGroupNoContent with default headers values -func NewDeleteSpoeGroupNoContent() *DeleteSpoeGroupNoContent { - - return &DeleteSpoeGroupNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeGroupNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeGroupNotFoundCode is the HTTP code returned for type DeleteSpoeGroupNotFound -const DeleteSpoeGroupNotFoundCode int = 404 - -/* -DeleteSpoeGroupNotFound The specified resource was not found - -swagger:response deleteSpoeGroupNotFound -*/ -type DeleteSpoeGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeGroupNotFound creates DeleteSpoeGroupNotFound with default headers values -func NewDeleteSpoeGroupNotFound() *DeleteSpoeGroupNotFound { - - return &DeleteSpoeGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe group not found response -func (o *DeleteSpoeGroupNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe group not found response -func (o *DeleteSpoeGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe group not found response -func (o *DeleteSpoeGroupNotFound) WithPayload(payload *models.Error) *DeleteSpoeGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe group not found response -func (o *DeleteSpoeGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeGroupDefault General Error - -swagger:response deleteSpoeGroupDefault -*/ -type DeleteSpoeGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeGroupDefault creates DeleteSpoeGroupDefault with default headers values -func NewDeleteSpoeGroupDefault(code int) *DeleteSpoeGroupDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) WithStatusCode(code int) *DeleteSpoeGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) WithPayload(payload *models.Error) *DeleteSpoeGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe group default response -func (o *DeleteSpoeGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/delete_spoe_group_urlbuilder.go b/operations/spoe/delete_spoe_group_urlbuilder.go deleted file mode 100644 index 952be1a9..00000000 --- a/operations/spoe/delete_spoe_group_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSpoeGroupURL generates an URL for the delete spoe group operation -type DeleteSpoeGroupURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeGroupURL) WithBasePath(bp string) *DeleteSpoeGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSpoeGroupURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSpoeGroupURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on DeleteSpoeGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/delete_spoe_message.go b/operations/spoe/delete_spoe_message.go deleted file mode 100644 index 7bcbe5b8..00000000 --- a/operations/spoe/delete_spoe_message.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeMessageHandlerFunc turns a function with the right signature into a delete spoe message handler -type DeleteSpoeMessageHandlerFunc func(DeleteSpoeMessageParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeMessageHandlerFunc) Handle(params DeleteSpoeMessageParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeMessageHandler interface for that can handle valid delete spoe message params -type DeleteSpoeMessageHandler interface { - Handle(DeleteSpoeMessageParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeMessage creates a new http.Handler for the delete spoe message operation -func NewDeleteSpoeMessage(ctx *middleware.Context, handler DeleteSpoeMessageHandler) *DeleteSpoeMessage { - return &DeleteSpoeMessage{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeMessage swagger:route DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name} Spoe deleteSpoeMessage - -# Delete a spoe message - -Deletes a spoe message from the SPOE scope. -*/ -type DeleteSpoeMessage struct { - Context *middleware.Context - Handler DeleteSpoeMessageHandler -} - -func (o *DeleteSpoeMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeMessageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/delete_spoe_message_parameters.go b/operations/spoe/delete_spoe_message_parameters.go deleted file mode 100644 index b5d25b11..00000000 --- a/operations/spoe/delete_spoe_message_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSpoeMessageParams creates a new DeleteSpoeMessageParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeMessageParams() DeleteSpoeMessageParams { - - return DeleteSpoeMessageParams{} -} - -// DeleteSpoeMessageParams contains all the bound params for the delete spoe message operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeMessage -type DeleteSpoeMessageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe message name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeMessageParams() beforehand. -func (o *DeleteSpoeMessageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSpoeMessageParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSpoeMessageParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *DeleteSpoeMessageParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSpoeMessageParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSpoeMessageParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/delete_spoe_message_responses.go b/operations/spoe/delete_spoe_message_responses.go deleted file mode 100644 index 0283771d..00000000 --- a/operations/spoe/delete_spoe_message_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeMessageNoContentCode is the HTTP code returned for type DeleteSpoeMessageNoContent -const DeleteSpoeMessageNoContentCode int = 204 - -/* -DeleteSpoeMessageNoContent Spoe message deleted - -swagger:response deleteSpoeMessageNoContent -*/ -type DeleteSpoeMessageNoContent struct { -} - -// NewDeleteSpoeMessageNoContent creates DeleteSpoeMessageNoContent with default headers values -func NewDeleteSpoeMessageNoContent() *DeleteSpoeMessageNoContent { - - return &DeleteSpoeMessageNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeMessageNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeMessageNotFoundCode is the HTTP code returned for type DeleteSpoeMessageNotFound -const DeleteSpoeMessageNotFoundCode int = 404 - -/* -DeleteSpoeMessageNotFound The specified resource was not found - -swagger:response deleteSpoeMessageNotFound -*/ -type DeleteSpoeMessageNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeMessageNotFound creates DeleteSpoeMessageNotFound with default headers values -func NewDeleteSpoeMessageNotFound() *DeleteSpoeMessageNotFound { - - return &DeleteSpoeMessageNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe message not found response -func (o *DeleteSpoeMessageNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeMessageNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe message not found response -func (o *DeleteSpoeMessageNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe message not found response -func (o *DeleteSpoeMessageNotFound) WithPayload(payload *models.Error) *DeleteSpoeMessageNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe message not found response -func (o *DeleteSpoeMessageNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeMessageNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeMessageDefault General Error - -swagger:response deleteSpoeMessageDefault -*/ -type DeleteSpoeMessageDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeMessageDefault creates DeleteSpoeMessageDefault with default headers values -func NewDeleteSpoeMessageDefault(code int) *DeleteSpoeMessageDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeMessageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) WithStatusCode(code int) *DeleteSpoeMessageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeMessageDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) WithPayload(payload *models.Error) *DeleteSpoeMessageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe message default response -func (o *DeleteSpoeMessageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeMessageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/delete_spoe_message_urlbuilder.go b/operations/spoe/delete_spoe_message_urlbuilder.go deleted file mode 100644 index 42a83772..00000000 --- a/operations/spoe/delete_spoe_message_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSpoeMessageURL generates an URL for the delete spoe message operation -type DeleteSpoeMessageURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeMessageURL) WithBasePath(bp string) *DeleteSpoeMessageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeMessageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeMessageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSpoeMessageURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSpoeMessageURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on DeleteSpoeMessageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeMessageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeMessageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeMessageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeMessageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeMessageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeMessageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/delete_spoe_scope.go b/operations/spoe/delete_spoe_scope.go deleted file mode 100644 index b6758424..00000000 --- a/operations/spoe/delete_spoe_scope.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeScopeHandlerFunc turns a function with the right signature into a delete spoe scope handler -type DeleteSpoeScopeHandlerFunc func(DeleteSpoeScopeParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeScopeHandlerFunc) Handle(params DeleteSpoeScopeParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeScopeHandler interface for that can handle valid delete spoe scope params -type DeleteSpoeScopeHandler interface { - Handle(DeleteSpoeScopeParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeScope creates a new http.Handler for the delete spoe scope operation -func NewDeleteSpoeScope(ctx *middleware.Context, handler DeleteSpoeScopeHandler) *DeleteSpoeScope { - return &DeleteSpoeScope{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeScope swagger:route DELETE /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name} Spoe deleteSpoeScope - -# Delete a SPOE scope - -Deletes a SPOE scope from the configuration file. -*/ -type DeleteSpoeScope struct { - Context *middleware.Context - Handler DeleteSpoeScopeHandler -} - -func (o *DeleteSpoeScope) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeScopeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/delete_spoe_scope_parameters.go b/operations/spoe/delete_spoe_scope_parameters.go deleted file mode 100644 index d4a3423b..00000000 --- a/operations/spoe/delete_spoe_scope_parameters.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteSpoeScopeParams creates a new DeleteSpoeScopeParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeScopeParams() DeleteSpoeScopeParams { - - return DeleteSpoeScopeParams{} -} - -// DeleteSpoeScopeParams contains all the bound params for the delete spoe scope operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeScope -type DeleteSpoeScopeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe scope name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeScopeParams() beforehand. -func (o *DeleteSpoeScopeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteSpoeScopeParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSpoeScopeParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteSpoeScopeParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteSpoeScopeParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/delete_spoe_scope_responses.go b/operations/spoe/delete_spoe_scope_responses.go deleted file mode 100644 index d58df513..00000000 --- a/operations/spoe/delete_spoe_scope_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeScopeNoContentCode is the HTTP code returned for type DeleteSpoeScopeNoContent -const DeleteSpoeScopeNoContentCode int = 204 - -/* -DeleteSpoeScopeNoContent Spoe scope deleted - -swagger:response deleteSpoeScopeNoContent -*/ -type DeleteSpoeScopeNoContent struct { -} - -// NewDeleteSpoeScopeNoContent creates DeleteSpoeScopeNoContent with default headers values -func NewDeleteSpoeScopeNoContent() *DeleteSpoeScopeNoContent { - - return &DeleteSpoeScopeNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeScopeNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeScopeNotFoundCode is the HTTP code returned for type DeleteSpoeScopeNotFound -const DeleteSpoeScopeNotFoundCode int = 404 - -/* -DeleteSpoeScopeNotFound The specified resource was not found - -swagger:response deleteSpoeScopeNotFound -*/ -type DeleteSpoeScopeNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeScopeNotFound creates DeleteSpoeScopeNotFound with default headers values -func NewDeleteSpoeScopeNotFound() *DeleteSpoeScopeNotFound { - - return &DeleteSpoeScopeNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe scope not found response -func (o *DeleteSpoeScopeNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeScopeNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe scope not found response -func (o *DeleteSpoeScopeNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe scope not found response -func (o *DeleteSpoeScopeNotFound) WithPayload(payload *models.Error) *DeleteSpoeScopeNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe scope not found response -func (o *DeleteSpoeScopeNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeScopeNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeScopeDefault General Error - -swagger:response deleteSpoeScopeDefault -*/ -type DeleteSpoeScopeDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeScopeDefault creates DeleteSpoeScopeDefault with default headers values -func NewDeleteSpoeScopeDefault(code int) *DeleteSpoeScopeDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeScopeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) WithStatusCode(code int) *DeleteSpoeScopeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeScopeDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) WithPayload(payload *models.Error) *DeleteSpoeScopeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe scope default response -func (o *DeleteSpoeScopeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeScopeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/delete_spoe_scope_urlbuilder.go b/operations/spoe/delete_spoe_scope_urlbuilder.go deleted file mode 100644 index 67ae59e9..00000000 --- a/operations/spoe/delete_spoe_scope_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteSpoeScopeURL generates an URL for the delete spoe scope operation -type DeleteSpoeScopeURL struct { - Name string - ParentName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeScopeURL) WithBasePath(bp string) *DeleteSpoeScopeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeScopeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeScopeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteSpoeScopeURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSpoeScopeURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeScopeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeScopeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeScopeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeScopeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeScopeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeScopeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_all_spoe_agent.go b/operations/spoe/get_all_spoe_agent.go deleted file mode 100644 index 595eb914..00000000 --- a/operations/spoe/get_all_spoe_agent.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeAgentHandlerFunc turns a function with the right signature into a get all spoe agent handler -type GetAllSpoeAgentHandlerFunc func(GetAllSpoeAgentParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeAgentHandlerFunc) Handle(params GetAllSpoeAgentParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeAgentHandler interface for that can handle valid get all spoe agent params -type GetAllSpoeAgentHandler interface { - Handle(GetAllSpoeAgentParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeAgent creates a new http.Handler for the get all spoe agent operation -func NewGetAllSpoeAgent(ctx *middleware.Context, handler GetAllSpoeAgentHandler) *GetAllSpoeAgent { - return &GetAllSpoeAgent{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeAgent swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents Spoe getAllSpoeAgent - -# Return an array of spoe agents in one scope - -Returns an array of all configured spoe agents in one scope. -*/ -type GetAllSpoeAgent struct { - Context *middleware.Context - Handler GetAllSpoeAgentHandler -} - -func (o *GetAllSpoeAgent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeAgentParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_all_spoe_agent_parameters.go b/operations/spoe/get_all_spoe_agent_parameters.go deleted file mode 100644 index 2d3c4e52..00000000 --- a/operations/spoe/get_all_spoe_agent_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllSpoeAgentParams creates a new GetAllSpoeAgentParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeAgentParams() GetAllSpoeAgentParams { - - return GetAllSpoeAgentParams{} -} - -// GetAllSpoeAgentParams contains all the bound params for the get all spoe agent operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeAgent -type GetAllSpoeAgentParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeAgentParams() beforehand. -func (o *GetAllSpoeAgentParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSpoeAgentParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetAllSpoeAgentParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllSpoeAgentParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_all_spoe_agent_responses.go b/operations/spoe/get_all_spoe_agent_responses.go deleted file mode 100644 index f109dd09..00000000 --- a/operations/spoe/get_all_spoe_agent_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeAgentOKCode is the HTTP code returned for type GetAllSpoeAgentOK -const GetAllSpoeAgentOKCode int = 200 - -/* -GetAllSpoeAgentOK Successful operation - -swagger:response getAllSpoeAgentOK -*/ -type GetAllSpoeAgentOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SpoeAgents `json:"body,omitempty"` -} - -// NewGetAllSpoeAgentOK creates GetAllSpoeAgentOK with default headers values -func NewGetAllSpoeAgentOK() *GetAllSpoeAgentOK { - - return &GetAllSpoeAgentOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe agent o k response -func (o *GetAllSpoeAgentOK) WithConfigurationVersion(configurationVersion string) *GetAllSpoeAgentOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe agent o k response -func (o *GetAllSpoeAgentOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe agent o k response -func (o *GetAllSpoeAgentOK) WithPayload(payload models.SpoeAgents) *GetAllSpoeAgentOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe agent o k response -func (o *GetAllSpoeAgentOK) SetPayload(payload models.SpoeAgents) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeAgentOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeAgents{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSpoeAgentDefault General Error - -swagger:response getAllSpoeAgentDefault -*/ -type GetAllSpoeAgentDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeAgentDefault creates GetAllSpoeAgentDefault with default headers values -func NewGetAllSpoeAgentDefault(code int) *GetAllSpoeAgentDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeAgentDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) WithStatusCode(code int) *GetAllSpoeAgentDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeAgentDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) WithPayload(payload *models.Error) *GetAllSpoeAgentDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe agent default response -func (o *GetAllSpoeAgentDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeAgentDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_all_spoe_agent_urlbuilder.go b/operations/spoe/get_all_spoe_agent_urlbuilder.go deleted file mode 100644 index 36307a31..00000000 --- a/operations/spoe/get_all_spoe_agent_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSpoeAgentURL generates an URL for the get all spoe agent operation -type GetAllSpoeAgentURL struct { - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeAgentURL) WithBasePath(bp string) *GetAllSpoeAgentURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeAgentURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeAgentURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSpoeAgentURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetAllSpoeAgentURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeAgentURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeAgentURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeAgentURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeAgentURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeAgentURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeAgentURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_all_spoe_files.go b/operations/spoe/get_all_spoe_files.go deleted file mode 100644 index f8e69826..00000000 --- a/operations/spoe/get_all_spoe_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeFilesHandlerFunc turns a function with the right signature into a get all spoe files handler -type GetAllSpoeFilesHandlerFunc func(GetAllSpoeFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeFilesHandlerFunc) Handle(params GetAllSpoeFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeFilesHandler interface for that can handle valid get all spoe files params -type GetAllSpoeFilesHandler interface { - Handle(GetAllSpoeFilesParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeFiles creates a new http.Handler for the get all spoe files operation -func NewGetAllSpoeFiles(ctx *middleware.Context, handler GetAllSpoeFilesHandler) *GetAllSpoeFiles { - return &GetAllSpoeFiles{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeFiles swagger:route GET /services/haproxy/spoe/spoe_files Spoe getAllSpoeFiles - -# Return all available SPOE files - -Returns all available SPOE files. -*/ -type GetAllSpoeFiles struct { - Context *middleware.Context - Handler GetAllSpoeFilesHandler -} - -func (o *GetAllSpoeFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_all_spoe_files_parameters.go b/operations/spoe/get_all_spoe_files_parameters.go deleted file mode 100644 index 56f50c8a..00000000 --- a/operations/spoe/get_all_spoe_files_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllSpoeFilesParams creates a new GetAllSpoeFilesParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeFilesParams() GetAllSpoeFilesParams { - - return GetAllSpoeFilesParams{} -} - -// GetAllSpoeFilesParams contains all the bound params for the get all spoe files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeFiles -type GetAllSpoeFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeFilesParams() beforehand. -func (o *GetAllSpoeFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/spoe/get_all_spoe_files_responses.go b/operations/spoe/get_all_spoe_files_responses.go deleted file mode 100644 index 18d90136..00000000 --- a/operations/spoe/get_all_spoe_files_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeFilesOKCode is the HTTP code returned for type GetAllSpoeFilesOK -const GetAllSpoeFilesOKCode int = 200 - -/* -GetAllSpoeFilesOK Successful operation - -swagger:response getAllSpoeFilesOK -*/ -type GetAllSpoeFilesOK struct { - - /* - In: Body - */ - Payload models.SpoeFiles `json:"body,omitempty"` -} - -// NewGetAllSpoeFilesOK creates GetAllSpoeFilesOK with default headers values -func NewGetAllSpoeFilesOK() *GetAllSpoeFilesOK { - - return &GetAllSpoeFilesOK{} -} - -// WithPayload adds the payload to the get all spoe files o k response -func (o *GetAllSpoeFilesOK) WithPayload(payload models.SpoeFiles) *GetAllSpoeFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe files o k response -func (o *GetAllSpoeFilesOK) SetPayload(payload models.SpoeFiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeFiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllSpoeFilesNotFoundCode is the HTTP code returned for type GetAllSpoeFilesNotFound -const GetAllSpoeFilesNotFoundCode int = 404 - -/* -GetAllSpoeFilesNotFound The specified resource was not found - -swagger:response getAllSpoeFilesNotFound -*/ -type GetAllSpoeFilesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeFilesNotFound creates GetAllSpoeFilesNotFound with default headers values -func NewGetAllSpoeFilesNotFound() *GetAllSpoeFilesNotFound { - - return &GetAllSpoeFilesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe files not found response -func (o *GetAllSpoeFilesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllSpoeFilesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe files not found response -func (o *GetAllSpoeFilesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe files not found response -func (o *GetAllSpoeFilesNotFound) WithPayload(payload *models.Error) *GetAllSpoeFilesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe files not found response -func (o *GetAllSpoeFilesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllSpoeFilesDefault General Error - -swagger:response getAllSpoeFilesDefault -*/ -type GetAllSpoeFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeFilesDefault creates GetAllSpoeFilesDefault with default headers values -func NewGetAllSpoeFilesDefault(code int) *GetAllSpoeFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) WithStatusCode(code int) *GetAllSpoeFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) WithPayload(payload *models.Error) *GetAllSpoeFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe files default response -func (o *GetAllSpoeFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_all_spoe_files_urlbuilder.go b/operations/spoe/get_all_spoe_files_urlbuilder.go deleted file mode 100644 index 0eb2ce03..00000000 --- a/operations/spoe/get_all_spoe_files_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllSpoeFilesURL generates an URL for the get all spoe files operation -type GetAllSpoeFilesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeFilesURL) WithBasePath(bp string) *GetAllSpoeFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_all_spoe_group.go b/operations/spoe/get_all_spoe_group.go deleted file mode 100644 index 40dcbd62..00000000 --- a/operations/spoe/get_all_spoe_group.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeGroupHandlerFunc turns a function with the right signature into a get all spoe group handler -type GetAllSpoeGroupHandlerFunc func(GetAllSpoeGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeGroupHandlerFunc) Handle(params GetAllSpoeGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeGroupHandler interface for that can handle valid get all spoe group params -type GetAllSpoeGroupHandler interface { - Handle(GetAllSpoeGroupParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeGroup creates a new http.Handler for the get all spoe group operation -func NewGetAllSpoeGroup(ctx *middleware.Context, handler GetAllSpoeGroupHandler) *GetAllSpoeGroup { - return &GetAllSpoeGroup{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeGroup swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups Spoe getAllSpoeGroup - -# Return an array of SPOE groups - -Returns an array of all configured SPOE groups in one SPOE scope. -*/ -type GetAllSpoeGroup struct { - Context *middleware.Context - Handler GetAllSpoeGroupHandler -} - -func (o *GetAllSpoeGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_all_spoe_group_parameters.go b/operations/spoe/get_all_spoe_group_parameters.go deleted file mode 100644 index 115dc82c..00000000 --- a/operations/spoe/get_all_spoe_group_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllSpoeGroupParams creates a new GetAllSpoeGroupParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeGroupParams() GetAllSpoeGroupParams { - - return GetAllSpoeGroupParams{} -} - -// GetAllSpoeGroupParams contains all the bound params for the get all spoe group operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeGroup -type GetAllSpoeGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeGroupParams() beforehand. -func (o *GetAllSpoeGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSpoeGroupParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetAllSpoeGroupParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllSpoeGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_all_spoe_group_responses.go b/operations/spoe/get_all_spoe_group_responses.go deleted file mode 100644 index dbb51061..00000000 --- a/operations/spoe/get_all_spoe_group_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeGroupOKCode is the HTTP code returned for type GetAllSpoeGroupOK -const GetAllSpoeGroupOKCode int = 200 - -/* -GetAllSpoeGroupOK Successful operation - -swagger:response getAllSpoeGroupOK -*/ -type GetAllSpoeGroupOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SpoeGroups `json:"body,omitempty"` -} - -// NewGetAllSpoeGroupOK creates GetAllSpoeGroupOK with default headers values -func NewGetAllSpoeGroupOK() *GetAllSpoeGroupOK { - - return &GetAllSpoeGroupOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe group o k response -func (o *GetAllSpoeGroupOK) WithConfigurationVersion(configurationVersion string) *GetAllSpoeGroupOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe group o k response -func (o *GetAllSpoeGroupOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe group o k response -func (o *GetAllSpoeGroupOK) WithPayload(payload models.SpoeGroups) *GetAllSpoeGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe group o k response -func (o *GetAllSpoeGroupOK) SetPayload(payload models.SpoeGroups) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeGroups{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSpoeGroupDefault General Error - -swagger:response getAllSpoeGroupDefault -*/ -type GetAllSpoeGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeGroupDefault creates GetAllSpoeGroupDefault with default headers values -func NewGetAllSpoeGroupDefault(code int) *GetAllSpoeGroupDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) WithStatusCode(code int) *GetAllSpoeGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) WithPayload(payload *models.Error) *GetAllSpoeGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe group default response -func (o *GetAllSpoeGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_all_spoe_group_urlbuilder.go b/operations/spoe/get_all_spoe_group_urlbuilder.go deleted file mode 100644 index a9a75290..00000000 --- a/operations/spoe/get_all_spoe_group_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSpoeGroupURL generates an URL for the get all spoe group operation -type GetAllSpoeGroupURL struct { - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeGroupURL) WithBasePath(bp string) *GetAllSpoeGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSpoeGroupURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetAllSpoeGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_all_spoe_message.go b/operations/spoe/get_all_spoe_message.go deleted file mode 100644 index 7e43bd68..00000000 --- a/operations/spoe/get_all_spoe_message.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeMessageHandlerFunc turns a function with the right signature into a get all spoe message handler -type GetAllSpoeMessageHandlerFunc func(GetAllSpoeMessageParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeMessageHandlerFunc) Handle(params GetAllSpoeMessageParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeMessageHandler interface for that can handle valid get all spoe message params -type GetAllSpoeMessageHandler interface { - Handle(GetAllSpoeMessageParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeMessage creates a new http.Handler for the get all spoe message operation -func NewGetAllSpoeMessage(ctx *middleware.Context, handler GetAllSpoeMessageHandler) *GetAllSpoeMessage { - return &GetAllSpoeMessage{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeMessage swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages Spoe getAllSpoeMessage - -# Return an array of spoe messages in one scope - -Returns an array of all configured spoe messages in one scope. -*/ -type GetAllSpoeMessage struct { - Context *middleware.Context - Handler GetAllSpoeMessageHandler -} - -func (o *GetAllSpoeMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeMessageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_all_spoe_message_parameters.go b/operations/spoe/get_all_spoe_message_parameters.go deleted file mode 100644 index 97d1f285..00000000 --- a/operations/spoe/get_all_spoe_message_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllSpoeMessageParams creates a new GetAllSpoeMessageParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeMessageParams() GetAllSpoeMessageParams { - - return GetAllSpoeMessageParams{} -} - -// GetAllSpoeMessageParams contains all the bound params for the get all spoe message operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeMessage -type GetAllSpoeMessageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeMessageParams() beforehand. -func (o *GetAllSpoeMessageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSpoeMessageParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetAllSpoeMessageParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllSpoeMessageParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_all_spoe_message_responses.go b/operations/spoe/get_all_spoe_message_responses.go deleted file mode 100644 index 228aec2c..00000000 --- a/operations/spoe/get_all_spoe_message_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeMessageOKCode is the HTTP code returned for type GetAllSpoeMessageOK -const GetAllSpoeMessageOKCode int = 200 - -/* -GetAllSpoeMessageOK Successful operation - -swagger:response getAllSpoeMessageOK -*/ -type GetAllSpoeMessageOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SpoeMessages `json:"body,omitempty"` -} - -// NewGetAllSpoeMessageOK creates GetAllSpoeMessageOK with default headers values -func NewGetAllSpoeMessageOK() *GetAllSpoeMessageOK { - - return &GetAllSpoeMessageOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe message o k response -func (o *GetAllSpoeMessageOK) WithConfigurationVersion(configurationVersion string) *GetAllSpoeMessageOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe message o k response -func (o *GetAllSpoeMessageOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe message o k response -func (o *GetAllSpoeMessageOK) WithPayload(payload models.SpoeMessages) *GetAllSpoeMessageOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe message o k response -func (o *GetAllSpoeMessageOK) SetPayload(payload models.SpoeMessages) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeMessageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeMessages{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSpoeMessageDefault General Error - -swagger:response getAllSpoeMessageDefault -*/ -type GetAllSpoeMessageDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeMessageDefault creates GetAllSpoeMessageDefault with default headers values -func NewGetAllSpoeMessageDefault(code int) *GetAllSpoeMessageDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeMessageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) WithStatusCode(code int) *GetAllSpoeMessageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeMessageDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) WithPayload(payload *models.Error) *GetAllSpoeMessageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe message default response -func (o *GetAllSpoeMessageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeMessageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_all_spoe_message_urlbuilder.go b/operations/spoe/get_all_spoe_message_urlbuilder.go deleted file mode 100644 index f02a68ff..00000000 --- a/operations/spoe/get_all_spoe_message_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSpoeMessageURL generates an URL for the get all spoe message operation -type GetAllSpoeMessageURL struct { - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeMessageURL) WithBasePath(bp string) *GetAllSpoeMessageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeMessageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeMessageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSpoeMessageURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetAllSpoeMessageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeMessageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeMessageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeMessageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeMessageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeMessageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeMessageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_all_spoe_scope.go b/operations/spoe/get_all_spoe_scope.go deleted file mode 100644 index 0c63ef39..00000000 --- a/operations/spoe/get_all_spoe_scope.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeScopeHandlerFunc turns a function with the right signature into a get all spoe scope handler -type GetAllSpoeScopeHandlerFunc func(GetAllSpoeScopeParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeScopeHandlerFunc) Handle(params GetAllSpoeScopeParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeScopeHandler interface for that can handle valid get all spoe scope params -type GetAllSpoeScopeHandler interface { - Handle(GetAllSpoeScopeParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeScope creates a new http.Handler for the get all spoe scope operation -func NewGetAllSpoeScope(ctx *middleware.Context, handler GetAllSpoeScopeHandler) *GetAllSpoeScope { - return &GetAllSpoeScope{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeScope swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes Spoe getAllSpoeScope - -# Return an array of spoe scopes - -Returns an array of all configured spoe scopes. -*/ -type GetAllSpoeScope struct { - Context *middleware.Context - Handler GetAllSpoeScopeHandler -} - -func (o *GetAllSpoeScope) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeScopeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_all_spoe_scope_parameters.go b/operations/spoe/get_all_spoe_scope_parameters.go deleted file mode 100644 index 7a59fb33..00000000 --- a/operations/spoe/get_all_spoe_scope_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllSpoeScopeParams creates a new GetAllSpoeScopeParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeScopeParams() GetAllSpoeScopeParams { - - return GetAllSpoeScopeParams{} -} - -// GetAllSpoeScopeParams contains all the bound params for the get all spoe scope operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeScope -type GetAllSpoeScopeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeScopeParams() beforehand. -func (o *GetAllSpoeScopeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSpoeScopeParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllSpoeScopeParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_all_spoe_scope_responses.go b/operations/spoe/get_all_spoe_scope_responses.go deleted file mode 100644 index 5db10935..00000000 --- a/operations/spoe/get_all_spoe_scope_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeScopeOKCode is the HTTP code returned for type GetAllSpoeScopeOK -const GetAllSpoeScopeOKCode int = 200 - -/* -GetAllSpoeScopeOK Successful operation - -swagger:response getAllSpoeScopeOK -*/ -type GetAllSpoeScopeOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SpoeScopes `json:"body,omitempty"` -} - -// NewGetAllSpoeScopeOK creates GetAllSpoeScopeOK with default headers values -func NewGetAllSpoeScopeOK() *GetAllSpoeScopeOK { - - return &GetAllSpoeScopeOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe scope o k response -func (o *GetAllSpoeScopeOK) WithConfigurationVersion(configurationVersion string) *GetAllSpoeScopeOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe scope o k response -func (o *GetAllSpoeScopeOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe scope o k response -func (o *GetAllSpoeScopeOK) WithPayload(payload models.SpoeScopes) *GetAllSpoeScopeOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe scope o k response -func (o *GetAllSpoeScopeOK) SetPayload(payload models.SpoeScopes) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeScopeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeScopes{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSpoeScopeDefault General Error - -swagger:response getAllSpoeScopeDefault -*/ -type GetAllSpoeScopeDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeScopeDefault creates GetAllSpoeScopeDefault with default headers values -func NewGetAllSpoeScopeDefault(code int) *GetAllSpoeScopeDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeScopeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) WithStatusCode(code int) *GetAllSpoeScopeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeScopeDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) WithPayload(payload *models.Error) *GetAllSpoeScopeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe scope default response -func (o *GetAllSpoeScopeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeScopeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_all_spoe_scope_urlbuilder.go b/operations/spoe/get_all_spoe_scope_urlbuilder.go deleted file mode 100644 index dc863bf1..00000000 --- a/operations/spoe/get_all_spoe_scope_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSpoeScopeURL generates an URL for the get all spoe scope operation -type GetAllSpoeScopeURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeScopeURL) WithBasePath(bp string) *GetAllSpoeScopeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeScopeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeScopeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSpoeScopeURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeScopeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeScopeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeScopeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeScopeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeScopeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeScopeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_one_spoe_file.go b/operations/spoe/get_one_spoe_file.go deleted file mode 100644 index 109cb75d..00000000 --- a/operations/spoe/get_one_spoe_file.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// GetOneSpoeFileHandlerFunc turns a function with the right signature into a get one spoe file handler -type GetOneSpoeFileHandlerFunc func(GetOneSpoeFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneSpoeFileHandlerFunc) Handle(params GetOneSpoeFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneSpoeFileHandler interface for that can handle valid get one spoe file params -type GetOneSpoeFileHandler interface { - Handle(GetOneSpoeFileParams, interface{}) middleware.Responder -} - -// NewGetOneSpoeFile creates a new http.Handler for the get one spoe file operation -func NewGetOneSpoeFile(ctx *middleware.Context, handler GetOneSpoeFileHandler) *GetOneSpoeFile { - return &GetOneSpoeFile{Context: ctx, Handler: handler} -} - -/* - GetOneSpoeFile swagger:route GET /services/haproxy/spoe/spoe_files/{name} Spoe getOneSpoeFile - -# Return one SPOE file - -Returns one SPOE file. -*/ -type GetOneSpoeFile struct { - Context *middleware.Context - Handler GetOneSpoeFileHandler -} - -func (o *GetOneSpoeFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneSpoeFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// GetOneSpoeFileOKBody get one spoe file o k body -// -// swagger:model GetOneSpoeFileOKBody -type GetOneSpoeFileOKBody struct { - - // data - Data string `json:"data,omitempty"` -} - -// Validate validates this get one spoe file o k body -func (o *GetOneSpoeFileOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this get one spoe file o k body based on context it is used -func (o *GetOneSpoeFileOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *GetOneSpoeFileOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *GetOneSpoeFileOKBody) UnmarshalBinary(b []byte) error { - var res GetOneSpoeFileOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operations/spoe/get_one_spoe_file_parameters.go b/operations/spoe/get_one_spoe_file_parameters.go deleted file mode 100644 index e73dffab..00000000 --- a/operations/spoe/get_one_spoe_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneSpoeFileParams creates a new GetOneSpoeFileParams object -// -// There are no default values defined in the spec. -func NewGetOneSpoeFileParams() GetOneSpoeFileParams { - - return GetOneSpoeFileParams{} -} - -// GetOneSpoeFileParams contains all the bound params for the get one spoe file operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneSpoeFile -type GetOneSpoeFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SPOE file name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneSpoeFileParams() beforehand. -func (o *GetOneSpoeFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneSpoeFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/spoe/get_one_spoe_file_responses.go b/operations/spoe/get_one_spoe_file_responses.go deleted file mode 100644 index e4cedce3..00000000 --- a/operations/spoe/get_one_spoe_file_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneSpoeFileOKCode is the HTTP code returned for type GetOneSpoeFileOK -const GetOneSpoeFileOKCode int = 200 - -/* -GetOneSpoeFileOK Successful operation - -swagger:response getOneSpoeFileOK -*/ -type GetOneSpoeFileOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *GetOneSpoeFileOKBody `json:"body,omitempty"` -} - -// NewGetOneSpoeFileOK creates GetOneSpoeFileOK with default headers values -func NewGetOneSpoeFileOK() *GetOneSpoeFileOK { - - return &GetOneSpoeFileOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one spoe file o k response -func (o *GetOneSpoeFileOK) WithConfigurationVersion(configurationVersion string) *GetOneSpoeFileOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one spoe file o k response -func (o *GetOneSpoeFileOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one spoe file o k response -func (o *GetOneSpoeFileOK) WithPayload(payload *GetOneSpoeFileOKBody) *GetOneSpoeFileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one spoe file o k response -func (o *GetOneSpoeFileOK) SetPayload(payload *GetOneSpoeFileOKBody) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneSpoeFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetOneSpoeFileNotFoundCode is the HTTP code returned for type GetOneSpoeFileNotFound -const GetOneSpoeFileNotFoundCode int = 404 - -/* -GetOneSpoeFileNotFound The specified resource was not found - -swagger:response getOneSpoeFileNotFound -*/ -type GetOneSpoeFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneSpoeFileNotFound creates GetOneSpoeFileNotFound with default headers values -func NewGetOneSpoeFileNotFound() *GetOneSpoeFileNotFound { - - return &GetOneSpoeFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one spoe file not found response -func (o *GetOneSpoeFileNotFound) WithConfigurationVersion(configurationVersion string) *GetOneSpoeFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one spoe file not found response -func (o *GetOneSpoeFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one spoe file not found response -func (o *GetOneSpoeFileNotFound) WithPayload(payload *models.Error) *GetOneSpoeFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one spoe file not found response -func (o *GetOneSpoeFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneSpoeFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneSpoeFileDefault General Error - -swagger:response getOneSpoeFileDefault -*/ -type GetOneSpoeFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneSpoeFileDefault creates GetOneSpoeFileDefault with default headers values -func NewGetOneSpoeFileDefault(code int) *GetOneSpoeFileDefault { - if code <= 0 { - code = 500 - } - - return &GetOneSpoeFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one spoe file default response -func (o *GetOneSpoeFileDefault) WithStatusCode(code int) *GetOneSpoeFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one spoe file default response -func (o *GetOneSpoeFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one spoe file default response -func (o *GetOneSpoeFileDefault) WithConfigurationVersion(configurationVersion string) *GetOneSpoeFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one spoe file default response -func (o *GetOneSpoeFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one spoe file default response -func (o *GetOneSpoeFileDefault) WithPayload(payload *models.Error) *GetOneSpoeFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one spoe file default response -func (o *GetOneSpoeFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneSpoeFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_one_spoe_file_urlbuilder.go b/operations/spoe/get_one_spoe_file_urlbuilder.go deleted file mode 100644 index e31af6d4..00000000 --- a/operations/spoe/get_one_spoe_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneSpoeFileURL generates an URL for the get one spoe file operation -type GetOneSpoeFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneSpoeFileURL) WithBasePath(bp string) *GetOneSpoeFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneSpoeFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneSpoeFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneSpoeFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneSpoeFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneSpoeFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneSpoeFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneSpoeFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneSpoeFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneSpoeFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_spoe_agent.go b/operations/spoe/get_spoe_agent.go deleted file mode 100644 index 19248c89..00000000 --- a/operations/spoe/get_spoe_agent.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeAgentHandlerFunc turns a function with the right signature into a get spoe agent handler -type GetSpoeAgentHandlerFunc func(GetSpoeAgentParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeAgentHandlerFunc) Handle(params GetSpoeAgentParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeAgentHandler interface for that can handle valid get spoe agent params -type GetSpoeAgentHandler interface { - Handle(GetSpoeAgentParams, interface{}) middleware.Responder -} - -// NewGetSpoeAgent creates a new http.Handler for the get spoe agent operation -func NewGetSpoeAgent(ctx *middleware.Context, handler GetSpoeAgentHandler) *GetSpoeAgent { - return &GetSpoeAgent{Context: ctx, Handler: handler} -} - -/* - GetSpoeAgent swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name} Spoe getSpoeAgent - -# Return a spoe agent - -Returns one spoe agent configuration in one SPOE scope. -*/ -type GetSpoeAgent struct { - Context *middleware.Context - Handler GetSpoeAgentHandler -} - -func (o *GetSpoeAgent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeAgentParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_spoe_agent_parameters.go b/operations/spoe/get_spoe_agent_parameters.go deleted file mode 100644 index 1b3115bf..00000000 --- a/operations/spoe/get_spoe_agent_parameters.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeAgentParams creates a new GetSpoeAgentParams object -// -// There are no default values defined in the spec. -func NewGetSpoeAgentParams() GetSpoeAgentParams { - - return GetSpoeAgentParams{} -} - -// GetSpoeAgentParams contains all the bound params for the get spoe agent operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeAgent -type GetSpoeAgentParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe agent name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeAgentParams() beforehand. -func (o *GetSpoeAgentParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetSpoeAgentParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeAgentParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetSpoeAgentParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSpoeAgentParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_spoe_agent_responses.go b/operations/spoe/get_spoe_agent_responses.go deleted file mode 100644 index 73f2ef72..00000000 --- a/operations/spoe/get_spoe_agent_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeAgentOKCode is the HTTP code returned for type GetSpoeAgentOK -const GetSpoeAgentOKCode int = 200 - -/* -GetSpoeAgentOK Successful operation - -swagger:response getSpoeAgentOK -*/ -type GetSpoeAgentOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.SpoeAgent `json:"body,omitempty"` -} - -// NewGetSpoeAgentOK creates GetSpoeAgentOK with default headers values -func NewGetSpoeAgentOK() *GetSpoeAgentOK { - - return &GetSpoeAgentOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe agent o k response -func (o *GetSpoeAgentOK) WithConfigurationVersion(configurationVersion string) *GetSpoeAgentOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe agent o k response -func (o *GetSpoeAgentOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe agent o k response -func (o *GetSpoeAgentOK) WithPayload(payload *models.SpoeAgent) *GetSpoeAgentOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe agent o k response -func (o *GetSpoeAgentOK) SetPayload(payload *models.SpoeAgent) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeAgentOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSpoeAgentNotFoundCode is the HTTP code returned for type GetSpoeAgentNotFound -const GetSpoeAgentNotFoundCode int = 404 - -/* -GetSpoeAgentNotFound The specified resource was not found - -swagger:response getSpoeAgentNotFound -*/ -type GetSpoeAgentNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeAgentNotFound creates GetSpoeAgentNotFound with default headers values -func NewGetSpoeAgentNotFound() *GetSpoeAgentNotFound { - - return &GetSpoeAgentNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe agent not found response -func (o *GetSpoeAgentNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeAgentNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe agent not found response -func (o *GetSpoeAgentNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe agent not found response -func (o *GetSpoeAgentNotFound) WithPayload(payload *models.Error) *GetSpoeAgentNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe agent not found response -func (o *GetSpoeAgentNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeAgentNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeAgentDefault General Error - -swagger:response getSpoeAgentDefault -*/ -type GetSpoeAgentDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeAgentDefault creates GetSpoeAgentDefault with default headers values -func NewGetSpoeAgentDefault(code int) *GetSpoeAgentDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeAgentDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe agent default response -func (o *GetSpoeAgentDefault) WithStatusCode(code int) *GetSpoeAgentDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe agent default response -func (o *GetSpoeAgentDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe agent default response -func (o *GetSpoeAgentDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeAgentDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe agent default response -func (o *GetSpoeAgentDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe agent default response -func (o *GetSpoeAgentDefault) WithPayload(payload *models.Error) *GetSpoeAgentDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe agent default response -func (o *GetSpoeAgentDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeAgentDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_spoe_agent_urlbuilder.go b/operations/spoe/get_spoe_agent_urlbuilder.go deleted file mode 100644 index 2e955eaf..00000000 --- a/operations/spoe/get_spoe_agent_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeAgentURL generates an URL for the get spoe agent operation -type GetSpoeAgentURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeAgentURL) WithBasePath(bp string) *GetSpoeAgentURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeAgentURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeAgentURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSpoeAgentURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeAgentURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetSpoeAgentURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeAgentURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeAgentURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeAgentURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeAgentURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeAgentURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeAgentURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_spoe_configuration_version.go b/operations/spoe/get_spoe_configuration_version.go deleted file mode 100644 index 3e180ff9..00000000 --- a/operations/spoe/get_spoe_configuration_version.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeConfigurationVersionHandlerFunc turns a function with the right signature into a get spoe configuration version handler -type GetSpoeConfigurationVersionHandlerFunc func(GetSpoeConfigurationVersionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeConfigurationVersionHandlerFunc) Handle(params GetSpoeConfigurationVersionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeConfigurationVersionHandler interface for that can handle valid get spoe configuration version params -type GetSpoeConfigurationVersionHandler interface { - Handle(GetSpoeConfigurationVersionParams, interface{}) middleware.Responder -} - -// NewGetSpoeConfigurationVersion creates a new http.Handler for the get spoe configuration version operation -func NewGetSpoeConfigurationVersion(ctx *middleware.Context, handler GetSpoeConfigurationVersionHandler) *GetSpoeConfigurationVersion { - return &GetSpoeConfigurationVersion{Context: ctx, Handler: handler} -} - -/* - GetSpoeConfigurationVersion swagger:route GET /services/haproxy/spoe/{parent_name}/version Spoe getSpoeConfigurationVersion - -# Return a SPOE configuration version - -Returns SPOE configuration version. -*/ -type GetSpoeConfigurationVersion struct { - Context *middleware.Context - Handler GetSpoeConfigurationVersionHandler -} - -func (o *GetSpoeConfigurationVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeConfigurationVersionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_spoe_configuration_version_parameters.go b/operations/spoe/get_spoe_configuration_version_parameters.go deleted file mode 100644 index b1fe0cb0..00000000 --- a/operations/spoe/get_spoe_configuration_version_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeConfigurationVersionParams creates a new GetSpoeConfigurationVersionParams object -// -// There are no default values defined in the spec. -func NewGetSpoeConfigurationVersionParams() GetSpoeConfigurationVersionParams { - - return GetSpoeConfigurationVersionParams{} -} - -// GetSpoeConfigurationVersionParams contains all the bound params for the get spoe configuration version operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeConfigurationVersion -type GetSpoeConfigurationVersionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeConfigurationVersionParams() beforehand. -func (o *GetSpoeConfigurationVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeConfigurationVersionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSpoeConfigurationVersionParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_spoe_configuration_version_responses.go b/operations/spoe/get_spoe_configuration_version_responses.go deleted file mode 100644 index a1233690..00000000 --- a/operations/spoe/get_spoe_configuration_version_responses.go +++ /dev/null @@ -1,220 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeConfigurationVersionOKCode is the HTTP code returned for type GetSpoeConfigurationVersionOK -const GetSpoeConfigurationVersionOKCode int = 200 - -/* -GetSpoeConfigurationVersionOK SPOE configuration version - -swagger:response getSpoeConfigurationVersionOK -*/ -type GetSpoeConfigurationVersionOK struct { - - /* - In: Body - */ - Payload int64 `json:"body,omitempty"` -} - -// NewGetSpoeConfigurationVersionOK creates GetSpoeConfigurationVersionOK with default headers values -func NewGetSpoeConfigurationVersionOK() *GetSpoeConfigurationVersionOK { - - return &GetSpoeConfigurationVersionOK{} -} - -// WithPayload adds the payload to the get spoe configuration version o k response -func (o *GetSpoeConfigurationVersionOK) WithPayload(payload int64) *GetSpoeConfigurationVersionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe configuration version o k response -func (o *GetSpoeConfigurationVersionOK) SetPayload(payload int64) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeConfigurationVersionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetSpoeConfigurationVersionNotFoundCode is the HTTP code returned for type GetSpoeConfigurationVersionNotFound -const GetSpoeConfigurationVersionNotFoundCode int = 404 - -/* -GetSpoeConfigurationVersionNotFound The specified resource was not found - -swagger:response getSpoeConfigurationVersionNotFound -*/ -type GetSpoeConfigurationVersionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeConfigurationVersionNotFound creates GetSpoeConfigurationVersionNotFound with default headers values -func NewGetSpoeConfigurationVersionNotFound() *GetSpoeConfigurationVersionNotFound { - - return &GetSpoeConfigurationVersionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe configuration version not found response -func (o *GetSpoeConfigurationVersionNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeConfigurationVersionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe configuration version not found response -func (o *GetSpoeConfigurationVersionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe configuration version not found response -func (o *GetSpoeConfigurationVersionNotFound) WithPayload(payload *models.Error) *GetSpoeConfigurationVersionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe configuration version not found response -func (o *GetSpoeConfigurationVersionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeConfigurationVersionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeConfigurationVersionDefault General Error - -swagger:response getSpoeConfigurationVersionDefault -*/ -type GetSpoeConfigurationVersionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeConfigurationVersionDefault creates GetSpoeConfigurationVersionDefault with default headers values -func NewGetSpoeConfigurationVersionDefault(code int) *GetSpoeConfigurationVersionDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeConfigurationVersionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) WithStatusCode(code int) *GetSpoeConfigurationVersionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeConfigurationVersionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) WithPayload(payload *models.Error) *GetSpoeConfigurationVersionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe configuration version default response -func (o *GetSpoeConfigurationVersionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeConfigurationVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_spoe_configuration_version_urlbuilder.go b/operations/spoe/get_spoe_configuration_version_urlbuilder.go deleted file mode 100644 index 392cf1d1..00000000 --- a/operations/spoe/get_spoe_configuration_version_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeConfigurationVersionURL generates an URL for the get spoe configuration version operation -type GetSpoeConfigurationVersionURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeConfigurationVersionURL) WithBasePath(bp string) *GetSpoeConfigurationVersionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeConfigurationVersionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeConfigurationVersionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/{parent_name}/version" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeConfigurationVersionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeConfigurationVersionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeConfigurationVersionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeConfigurationVersionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeConfigurationVersionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeConfigurationVersionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeConfigurationVersionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_spoe_group.go b/operations/spoe/get_spoe_group.go deleted file mode 100644 index 361f9dec..00000000 --- a/operations/spoe/get_spoe_group.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeGroupHandlerFunc turns a function with the right signature into a get spoe group handler -type GetSpoeGroupHandlerFunc func(GetSpoeGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeGroupHandlerFunc) Handle(params GetSpoeGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeGroupHandler interface for that can handle valid get spoe group params -type GetSpoeGroupHandler interface { - Handle(GetSpoeGroupParams, interface{}) middleware.Responder -} - -// NewGetSpoeGroup creates a new http.Handler for the get spoe group operation -func NewGetSpoeGroup(ctx *middleware.Context, handler GetSpoeGroupHandler) *GetSpoeGroup { - return &GetSpoeGroup{Context: ctx, Handler: handler} -} - -/* - GetSpoeGroup swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name} Spoe getSpoeGroup - -# Return a SPOE groups - -Returns one SPOE groups configuration in one SPOE scope. -*/ -type GetSpoeGroup struct { - Context *middleware.Context - Handler GetSpoeGroupHandler -} - -func (o *GetSpoeGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_spoe_group_parameters.go b/operations/spoe/get_spoe_group_parameters.go deleted file mode 100644 index e239498b..00000000 --- a/operations/spoe/get_spoe_group_parameters.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeGroupParams creates a new GetSpoeGroupParams object -// -// There are no default values defined in the spec. -func NewGetSpoeGroupParams() GetSpoeGroupParams { - - return GetSpoeGroupParams{} -} - -// GetSpoeGroupParams contains all the bound params for the get spoe group operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeGroup -type GetSpoeGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe group name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeGroupParams() beforehand. -func (o *GetSpoeGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetSpoeGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeGroupParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetSpoeGroupParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSpoeGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_spoe_group_responses.go b/operations/spoe/get_spoe_group_responses.go deleted file mode 100644 index 2528f0fb..00000000 --- a/operations/spoe/get_spoe_group_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeGroupOKCode is the HTTP code returned for type GetSpoeGroupOK -const GetSpoeGroupOKCode int = 200 - -/* -GetSpoeGroupOK Successful operation - -swagger:response getSpoeGroupOK -*/ -type GetSpoeGroupOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.SpoeGroup `json:"body,omitempty"` -} - -// NewGetSpoeGroupOK creates GetSpoeGroupOK with default headers values -func NewGetSpoeGroupOK() *GetSpoeGroupOK { - - return &GetSpoeGroupOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe group o k response -func (o *GetSpoeGroupOK) WithConfigurationVersion(configurationVersion string) *GetSpoeGroupOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe group o k response -func (o *GetSpoeGroupOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe group o k response -func (o *GetSpoeGroupOK) WithPayload(payload *models.SpoeGroup) *GetSpoeGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe group o k response -func (o *GetSpoeGroupOK) SetPayload(payload *models.SpoeGroup) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSpoeGroupNotFoundCode is the HTTP code returned for type GetSpoeGroupNotFound -const GetSpoeGroupNotFoundCode int = 404 - -/* -GetSpoeGroupNotFound The specified resource was not found - -swagger:response getSpoeGroupNotFound -*/ -type GetSpoeGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeGroupNotFound creates GetSpoeGroupNotFound with default headers values -func NewGetSpoeGroupNotFound() *GetSpoeGroupNotFound { - - return &GetSpoeGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe group not found response -func (o *GetSpoeGroupNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe group not found response -func (o *GetSpoeGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe group not found response -func (o *GetSpoeGroupNotFound) WithPayload(payload *models.Error) *GetSpoeGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe group not found response -func (o *GetSpoeGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeGroupDefault General Error - -swagger:response getSpoeGroupDefault -*/ -type GetSpoeGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeGroupDefault creates GetSpoeGroupDefault with default headers values -func NewGetSpoeGroupDefault(code int) *GetSpoeGroupDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe group default response -func (o *GetSpoeGroupDefault) WithStatusCode(code int) *GetSpoeGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe group default response -func (o *GetSpoeGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe group default response -func (o *GetSpoeGroupDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe group default response -func (o *GetSpoeGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe group default response -func (o *GetSpoeGroupDefault) WithPayload(payload *models.Error) *GetSpoeGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe group default response -func (o *GetSpoeGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_spoe_group_urlbuilder.go b/operations/spoe/get_spoe_group_urlbuilder.go deleted file mode 100644 index 40f01fba..00000000 --- a/operations/spoe/get_spoe_group_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeGroupURL generates an URL for the get spoe group operation -type GetSpoeGroupURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeGroupURL) WithBasePath(bp string) *GetSpoeGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSpoeGroupURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeGroupURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetSpoeGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_spoe_message.go b/operations/spoe/get_spoe_message.go deleted file mode 100644 index 98ebe832..00000000 --- a/operations/spoe/get_spoe_message.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeMessageHandlerFunc turns a function with the right signature into a get spoe message handler -type GetSpoeMessageHandlerFunc func(GetSpoeMessageParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeMessageHandlerFunc) Handle(params GetSpoeMessageParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeMessageHandler interface for that can handle valid get spoe message params -type GetSpoeMessageHandler interface { - Handle(GetSpoeMessageParams, interface{}) middleware.Responder -} - -// NewGetSpoeMessage creates a new http.Handler for the get spoe message operation -func NewGetSpoeMessage(ctx *middleware.Context, handler GetSpoeMessageHandler) *GetSpoeMessage { - return &GetSpoeMessage{Context: ctx, Handler: handler} -} - -/* - GetSpoeMessage swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name} Spoe getSpoeMessage - -# Return a spoe message - -Returns one spoe message configuration in SPOE scope. -*/ -type GetSpoeMessage struct { - Context *middleware.Context - Handler GetSpoeMessageHandler -} - -func (o *GetSpoeMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeMessageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_spoe_message_parameters.go b/operations/spoe/get_spoe_message_parameters.go deleted file mode 100644 index adc0c956..00000000 --- a/operations/spoe/get_spoe_message_parameters.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeMessageParams creates a new GetSpoeMessageParams object -// -// There are no default values defined in the spec. -func NewGetSpoeMessageParams() GetSpoeMessageParams { - - return GetSpoeMessageParams{} -} - -// GetSpoeMessageParams contains all the bound params for the get spoe message operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeMessage -type GetSpoeMessageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe message name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeMessageParams() beforehand. -func (o *GetSpoeMessageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetSpoeMessageParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeMessageParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *GetSpoeMessageParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSpoeMessageParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_spoe_message_responses.go b/operations/spoe/get_spoe_message_responses.go deleted file mode 100644 index 223008aa..00000000 --- a/operations/spoe/get_spoe_message_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeMessageOKCode is the HTTP code returned for type GetSpoeMessageOK -const GetSpoeMessageOKCode int = 200 - -/* -GetSpoeMessageOK Successful operation - -swagger:response getSpoeMessageOK -*/ -type GetSpoeMessageOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.SpoeMessage `json:"body,omitempty"` -} - -// NewGetSpoeMessageOK creates GetSpoeMessageOK with default headers values -func NewGetSpoeMessageOK() *GetSpoeMessageOK { - - return &GetSpoeMessageOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe message o k response -func (o *GetSpoeMessageOK) WithConfigurationVersion(configurationVersion string) *GetSpoeMessageOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe message o k response -func (o *GetSpoeMessageOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe message o k response -func (o *GetSpoeMessageOK) WithPayload(payload *models.SpoeMessage) *GetSpoeMessageOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe message o k response -func (o *GetSpoeMessageOK) SetPayload(payload *models.SpoeMessage) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeMessageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSpoeMessageNotFoundCode is the HTTP code returned for type GetSpoeMessageNotFound -const GetSpoeMessageNotFoundCode int = 404 - -/* -GetSpoeMessageNotFound The specified resource was not found - -swagger:response getSpoeMessageNotFound -*/ -type GetSpoeMessageNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeMessageNotFound creates GetSpoeMessageNotFound with default headers values -func NewGetSpoeMessageNotFound() *GetSpoeMessageNotFound { - - return &GetSpoeMessageNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe message not found response -func (o *GetSpoeMessageNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeMessageNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe message not found response -func (o *GetSpoeMessageNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe message not found response -func (o *GetSpoeMessageNotFound) WithPayload(payload *models.Error) *GetSpoeMessageNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe message not found response -func (o *GetSpoeMessageNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeMessageNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeMessageDefault General Error - -swagger:response getSpoeMessageDefault -*/ -type GetSpoeMessageDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeMessageDefault creates GetSpoeMessageDefault with default headers values -func NewGetSpoeMessageDefault(code int) *GetSpoeMessageDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeMessageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe message default response -func (o *GetSpoeMessageDefault) WithStatusCode(code int) *GetSpoeMessageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe message default response -func (o *GetSpoeMessageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe message default response -func (o *GetSpoeMessageDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeMessageDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe message default response -func (o *GetSpoeMessageDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe message default response -func (o *GetSpoeMessageDefault) WithPayload(payload *models.Error) *GetSpoeMessageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe message default response -func (o *GetSpoeMessageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeMessageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_spoe_message_urlbuilder.go b/operations/spoe/get_spoe_message_urlbuilder.go deleted file mode 100644 index ba57414b..00000000 --- a/operations/spoe/get_spoe_message_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeMessageURL generates an URL for the get spoe message operation -type GetSpoeMessageURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeMessageURL) WithBasePath(bp string) *GetSpoeMessageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeMessageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeMessageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSpoeMessageURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeMessageURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on GetSpoeMessageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeMessageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeMessageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeMessageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeMessageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeMessageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeMessageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/get_spoe_scope.go b/operations/spoe/get_spoe_scope.go deleted file mode 100644 index f339d42b..00000000 --- a/operations/spoe/get_spoe_scope.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeScopeHandlerFunc turns a function with the right signature into a get spoe scope handler -type GetSpoeScopeHandlerFunc func(GetSpoeScopeParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeScopeHandlerFunc) Handle(params GetSpoeScopeParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeScopeHandler interface for that can handle valid get spoe scope params -type GetSpoeScopeHandler interface { - Handle(GetSpoeScopeParams, interface{}) middleware.Responder -} - -// NewGetSpoeScope creates a new http.Handler for the get spoe scope operation -func NewGetSpoeScope(ctx *middleware.Context, handler GetSpoeScopeHandler) *GetSpoeScope { - return &GetSpoeScope{Context: ctx, Handler: handler} -} - -/* - GetSpoeScope swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name} Spoe getSpoeScope - -# Return one SPOE scope - -Returns one SPOE scope in one SPOE file. -*/ -type GetSpoeScope struct { - Context *middleware.Context - Handler GetSpoeScopeHandler -} - -func (o *GetSpoeScope) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeScopeParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/get_spoe_scope_parameters.go b/operations/spoe/get_spoe_scope_parameters.go deleted file mode 100644 index 9de86820..00000000 --- a/operations/spoe/get_spoe_scope_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeScopeParams creates a new GetSpoeScopeParams object -// -// There are no default values defined in the spec. -func NewGetSpoeScopeParams() GetSpoeScopeParams { - - return GetSpoeScopeParams{} -} - -// GetSpoeScopeParams contains all the bound params for the get spoe scope operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeScope -type GetSpoeScopeParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Spoe scope - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeScopeParams() beforehand. -func (o *GetSpoeScopeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetSpoeScopeParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeScopeParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetSpoeScopeParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/spoe/get_spoe_scope_responses.go b/operations/spoe/get_spoe_scope_responses.go deleted file mode 100644 index e0647ed2..00000000 --- a/operations/spoe/get_spoe_scope_responses.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeScopeOKCode is the HTTP code returned for type GetSpoeScopeOK -const GetSpoeScopeOKCode int = 200 - -/* -GetSpoeScopeOK Successful operation - -swagger:response getSpoeScopeOK -*/ -type GetSpoeScopeOK struct { - /*Spoe configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.SpoeScope `json:"body,omitempty"` -} - -// NewGetSpoeScopeOK creates GetSpoeScopeOK with default headers values -func NewGetSpoeScopeOK() *GetSpoeScopeOK { - - return &GetSpoeScopeOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe scope o k response -func (o *GetSpoeScopeOK) WithConfigurationVersion(configurationVersion string) *GetSpoeScopeOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe scope o k response -func (o *GetSpoeScopeOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe scope o k response -func (o *GetSpoeScopeOK) WithPayload(payload models.SpoeScope) *GetSpoeScopeOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe scope o k response -func (o *GetSpoeScopeOK) SetPayload(payload models.SpoeScope) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeScopeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetSpoeScopeNotFoundCode is the HTTP code returned for type GetSpoeScopeNotFound -const GetSpoeScopeNotFoundCode int = 404 - -/* -GetSpoeScopeNotFound The specified resource was not found - -swagger:response getSpoeScopeNotFound -*/ -type GetSpoeScopeNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeScopeNotFound creates GetSpoeScopeNotFound with default headers values -func NewGetSpoeScopeNotFound() *GetSpoeScopeNotFound { - - return &GetSpoeScopeNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe scope not found response -func (o *GetSpoeScopeNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeScopeNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe scope not found response -func (o *GetSpoeScopeNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe scope not found response -func (o *GetSpoeScopeNotFound) WithPayload(payload *models.Error) *GetSpoeScopeNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe scope not found response -func (o *GetSpoeScopeNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeScopeNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeScopeDefault General Error - -swagger:response getSpoeScopeDefault -*/ -type GetSpoeScopeDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeScopeDefault creates GetSpoeScopeDefault with default headers values -func NewGetSpoeScopeDefault(code int) *GetSpoeScopeDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeScopeDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe scope default response -func (o *GetSpoeScopeDefault) WithStatusCode(code int) *GetSpoeScopeDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe scope default response -func (o *GetSpoeScopeDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe scope default response -func (o *GetSpoeScopeDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeScopeDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe scope default response -func (o *GetSpoeScopeDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe scope default response -func (o *GetSpoeScopeDefault) WithPayload(payload *models.Error) *GetSpoeScopeDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe scope default response -func (o *GetSpoeScopeDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeScopeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/get_spoe_scope_urlbuilder.go b/operations/spoe/get_spoe_scope_urlbuilder.go deleted file mode 100644 index 45711774..00000000 --- a/operations/spoe/get_spoe_scope_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeScopeURL generates an URL for the get spoe scope operation -type GetSpoeScopeURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeScopeURL) WithBasePath(bp string) *GetSpoeScopeURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeScopeURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeScopeURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSpoeScopeURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeScopeURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeScopeURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeScopeURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeScopeURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeScopeURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeScopeURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeScopeURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/replace_spoe_agent.go b/operations/spoe/replace_spoe_agent.go deleted file mode 100644 index 99c8bf82..00000000 --- a/operations/spoe/replace_spoe_agent.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceSpoeAgentHandlerFunc turns a function with the right signature into a replace spoe agent handler -type ReplaceSpoeAgentHandlerFunc func(ReplaceSpoeAgentParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceSpoeAgentHandlerFunc) Handle(params ReplaceSpoeAgentParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceSpoeAgentHandler interface for that can handle valid replace spoe agent params -type ReplaceSpoeAgentHandler interface { - Handle(ReplaceSpoeAgentParams, interface{}) middleware.Responder -} - -// NewReplaceSpoeAgent creates a new http.Handler for the replace spoe agent operation -func NewReplaceSpoeAgent(ctx *middleware.Context, handler ReplaceSpoeAgentHandler) *ReplaceSpoeAgent { - return &ReplaceSpoeAgent{Context: ctx, Handler: handler} -} - -/* - ReplaceSpoeAgent swagger:route PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name} Spoe replaceSpoeAgent - -# Replace a SPOE agent - -Replaces a SPOE agent configuration in one SPOE scope. -*/ -type ReplaceSpoeAgent struct { - Context *middleware.Context - Handler ReplaceSpoeAgentHandler -} - -func (o *ReplaceSpoeAgent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceSpoeAgentParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/replace_spoe_agent_parameters.go b/operations/spoe/replace_spoe_agent_parameters.go deleted file mode 100644 index c75dd592..00000000 --- a/operations/spoe/replace_spoe_agent_parameters.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceSpoeAgentParams creates a new ReplaceSpoeAgentParams object -// -// There are no default values defined in the spec. -func NewReplaceSpoeAgentParams() ReplaceSpoeAgentParams { - - return ReplaceSpoeAgentParams{} -} - -// ReplaceSpoeAgentParams contains all the bound params for the replace spoe agent operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceSpoeAgent -type ReplaceSpoeAgentParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeAgent - /*Spoe agent name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceSpoeAgentParams() beforehand. -func (o *ReplaceSpoeAgentParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeAgent - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceSpoeAgentParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceSpoeAgentParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *ReplaceSpoeAgentParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceSpoeAgentParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceSpoeAgentParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/replace_spoe_agent_responses.go b/operations/spoe/replace_spoe_agent_responses.go deleted file mode 100644 index 74af8f21..00000000 --- a/operations/spoe/replace_spoe_agent_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceSpoeAgentOKCode is the HTTP code returned for type ReplaceSpoeAgentOK -const ReplaceSpoeAgentOKCode int = 200 - -/* -ReplaceSpoeAgentOK Spoe agent replaced - -swagger:response replaceSpoeAgentOK -*/ -type ReplaceSpoeAgentOK struct { - - /* - In: Body - */ - Payload *models.SpoeAgent `json:"body,omitempty"` -} - -// NewReplaceSpoeAgentOK creates ReplaceSpoeAgentOK with default headers values -func NewReplaceSpoeAgentOK() *ReplaceSpoeAgentOK { - - return &ReplaceSpoeAgentOK{} -} - -// WithPayload adds the payload to the replace spoe agent o k response -func (o *ReplaceSpoeAgentOK) WithPayload(payload *models.SpoeAgent) *ReplaceSpoeAgentOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe agent o k response -func (o *ReplaceSpoeAgentOK) SetPayload(payload *models.SpoeAgent) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeAgentOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeAgentBadRequestCode is the HTTP code returned for type ReplaceSpoeAgentBadRequest -const ReplaceSpoeAgentBadRequestCode int = 400 - -/* -ReplaceSpoeAgentBadRequest Bad request - -swagger:response replaceSpoeAgentBadRequest -*/ -type ReplaceSpoeAgentBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeAgentBadRequest creates ReplaceSpoeAgentBadRequest with default headers values -func NewReplaceSpoeAgentBadRequest() *ReplaceSpoeAgentBadRequest { - - return &ReplaceSpoeAgentBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe agent bad request response -func (o *ReplaceSpoeAgentBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeAgentBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe agent bad request response -func (o *ReplaceSpoeAgentBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe agent bad request response -func (o *ReplaceSpoeAgentBadRequest) WithPayload(payload *models.Error) *ReplaceSpoeAgentBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe agent bad request response -func (o *ReplaceSpoeAgentBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeAgentBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeAgentNotFoundCode is the HTTP code returned for type ReplaceSpoeAgentNotFound -const ReplaceSpoeAgentNotFoundCode int = 404 - -/* -ReplaceSpoeAgentNotFound The specified resource was not found - -swagger:response replaceSpoeAgentNotFound -*/ -type ReplaceSpoeAgentNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeAgentNotFound creates ReplaceSpoeAgentNotFound with default headers values -func NewReplaceSpoeAgentNotFound() *ReplaceSpoeAgentNotFound { - - return &ReplaceSpoeAgentNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe agent not found response -func (o *ReplaceSpoeAgentNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeAgentNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe agent not found response -func (o *ReplaceSpoeAgentNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe agent not found response -func (o *ReplaceSpoeAgentNotFound) WithPayload(payload *models.Error) *ReplaceSpoeAgentNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe agent not found response -func (o *ReplaceSpoeAgentNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeAgentNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceSpoeAgentDefault General Error - -swagger:response replaceSpoeAgentDefault -*/ -type ReplaceSpoeAgentDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeAgentDefault creates ReplaceSpoeAgentDefault with default headers values -func NewReplaceSpoeAgentDefault(code int) *ReplaceSpoeAgentDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceSpoeAgentDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) WithStatusCode(code int) *ReplaceSpoeAgentDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeAgentDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) WithPayload(payload *models.Error) *ReplaceSpoeAgentDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe agent default response -func (o *ReplaceSpoeAgentDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeAgentDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/replace_spoe_agent_urlbuilder.go b/operations/spoe/replace_spoe_agent_urlbuilder.go deleted file mode 100644 index 2dfa8935..00000000 --- a/operations/spoe/replace_spoe_agent_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceSpoeAgentURL generates an URL for the replace spoe agent operation -type ReplaceSpoeAgentURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeAgentURL) WithBasePath(bp string) *ReplaceSpoeAgentURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeAgentURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceSpoeAgentURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceSpoeAgentURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceSpoeAgentURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on ReplaceSpoeAgentURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceSpoeAgentURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceSpoeAgentURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceSpoeAgentURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceSpoeAgentURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceSpoeAgentURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceSpoeAgentURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/replace_spoe_group.go b/operations/spoe/replace_spoe_group.go deleted file mode 100644 index 88c3cffe..00000000 --- a/operations/spoe/replace_spoe_group.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceSpoeGroupHandlerFunc turns a function with the right signature into a replace spoe group handler -type ReplaceSpoeGroupHandlerFunc func(ReplaceSpoeGroupParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceSpoeGroupHandlerFunc) Handle(params ReplaceSpoeGroupParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceSpoeGroupHandler interface for that can handle valid replace spoe group params -type ReplaceSpoeGroupHandler interface { - Handle(ReplaceSpoeGroupParams, interface{}) middleware.Responder -} - -// NewReplaceSpoeGroup creates a new http.Handler for the replace spoe group operation -func NewReplaceSpoeGroup(ctx *middleware.Context, handler ReplaceSpoeGroupHandler) *ReplaceSpoeGroup { - return &ReplaceSpoeGroup{Context: ctx, Handler: handler} -} - -/* - ReplaceSpoeGroup swagger:route PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name} Spoe replaceSpoeGroup - -# Replace a SPOE groups - -Replaces a SPOE groups configuration in one SPOE scope. -*/ -type ReplaceSpoeGroup struct { - Context *middleware.Context - Handler ReplaceSpoeGroupHandler -} - -func (o *ReplaceSpoeGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceSpoeGroupParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/replace_spoe_group_parameters.go b/operations/spoe/replace_spoe_group_parameters.go deleted file mode 100644 index 886eb744..00000000 --- a/operations/spoe/replace_spoe_group_parameters.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceSpoeGroupParams creates a new ReplaceSpoeGroupParams object -// -// There are no default values defined in the spec. -func NewReplaceSpoeGroupParams() ReplaceSpoeGroupParams { - - return ReplaceSpoeGroupParams{} -} - -// ReplaceSpoeGroupParams contains all the bound params for the replace spoe group operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceSpoeGroup -type ReplaceSpoeGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeGroup - /*Spoe group name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceSpoeGroupParams() beforehand. -func (o *ReplaceSpoeGroupParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeGroup - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceSpoeGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceSpoeGroupParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *ReplaceSpoeGroupParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceSpoeGroupParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceSpoeGroupParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/replace_spoe_group_responses.go b/operations/spoe/replace_spoe_group_responses.go deleted file mode 100644 index 32d47ac5..00000000 --- a/operations/spoe/replace_spoe_group_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceSpoeGroupOKCode is the HTTP code returned for type ReplaceSpoeGroupOK -const ReplaceSpoeGroupOKCode int = 200 - -/* -ReplaceSpoeGroupOK Spoe groups replaced - -swagger:response replaceSpoeGroupOK -*/ -type ReplaceSpoeGroupOK struct { - - /* - In: Body - */ - Payload *models.SpoeGroup `json:"body,omitempty"` -} - -// NewReplaceSpoeGroupOK creates ReplaceSpoeGroupOK with default headers values -func NewReplaceSpoeGroupOK() *ReplaceSpoeGroupOK { - - return &ReplaceSpoeGroupOK{} -} - -// WithPayload adds the payload to the replace spoe group o k response -func (o *ReplaceSpoeGroupOK) WithPayload(payload *models.SpoeGroup) *ReplaceSpoeGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe group o k response -func (o *ReplaceSpoeGroupOK) SetPayload(payload *models.SpoeGroup) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeGroupOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeGroupBadRequestCode is the HTTP code returned for type ReplaceSpoeGroupBadRequest -const ReplaceSpoeGroupBadRequestCode int = 400 - -/* -ReplaceSpoeGroupBadRequest Bad request - -swagger:response replaceSpoeGroupBadRequest -*/ -type ReplaceSpoeGroupBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeGroupBadRequest creates ReplaceSpoeGroupBadRequest with default headers values -func NewReplaceSpoeGroupBadRequest() *ReplaceSpoeGroupBadRequest { - - return &ReplaceSpoeGroupBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe group bad request response -func (o *ReplaceSpoeGroupBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeGroupBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe group bad request response -func (o *ReplaceSpoeGroupBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe group bad request response -func (o *ReplaceSpoeGroupBadRequest) WithPayload(payload *models.Error) *ReplaceSpoeGroupBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe group bad request response -func (o *ReplaceSpoeGroupBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeGroupBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeGroupNotFoundCode is the HTTP code returned for type ReplaceSpoeGroupNotFound -const ReplaceSpoeGroupNotFoundCode int = 404 - -/* -ReplaceSpoeGroupNotFound The specified resource was not found - -swagger:response replaceSpoeGroupNotFound -*/ -type ReplaceSpoeGroupNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeGroupNotFound creates ReplaceSpoeGroupNotFound with default headers values -func NewReplaceSpoeGroupNotFound() *ReplaceSpoeGroupNotFound { - - return &ReplaceSpoeGroupNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe group not found response -func (o *ReplaceSpoeGroupNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeGroupNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe group not found response -func (o *ReplaceSpoeGroupNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe group not found response -func (o *ReplaceSpoeGroupNotFound) WithPayload(payload *models.Error) *ReplaceSpoeGroupNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe group not found response -func (o *ReplaceSpoeGroupNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeGroupNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceSpoeGroupDefault General Error - -swagger:response replaceSpoeGroupDefault -*/ -type ReplaceSpoeGroupDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeGroupDefault creates ReplaceSpoeGroupDefault with default headers values -func NewReplaceSpoeGroupDefault(code int) *ReplaceSpoeGroupDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceSpoeGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) WithStatusCode(code int) *ReplaceSpoeGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeGroupDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) WithPayload(payload *models.Error) *ReplaceSpoeGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe group default response -func (o *ReplaceSpoeGroupDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeGroupDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/replace_spoe_group_urlbuilder.go b/operations/spoe/replace_spoe_group_urlbuilder.go deleted file mode 100644 index a226f5a1..00000000 --- a/operations/spoe/replace_spoe_group_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceSpoeGroupURL generates an URL for the replace spoe group operation -type ReplaceSpoeGroupURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeGroupURL) WithBasePath(bp string) *ReplaceSpoeGroupURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceSpoeGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceSpoeGroupURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceSpoeGroupURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on ReplaceSpoeGroupURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceSpoeGroupURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceSpoeGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceSpoeGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceSpoeGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceSpoeGroupURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceSpoeGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe/replace_spoe_message.go b/operations/spoe/replace_spoe_message.go deleted file mode 100644 index 275934b0..00000000 --- a/operations/spoe/replace_spoe_message.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceSpoeMessageHandlerFunc turns a function with the right signature into a replace spoe message handler -type ReplaceSpoeMessageHandlerFunc func(ReplaceSpoeMessageParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceSpoeMessageHandlerFunc) Handle(params ReplaceSpoeMessageParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceSpoeMessageHandler interface for that can handle valid replace spoe message params -type ReplaceSpoeMessageHandler interface { - Handle(ReplaceSpoeMessageParams, interface{}) middleware.Responder -} - -// NewReplaceSpoeMessage creates a new http.Handler for the replace spoe message operation -func NewReplaceSpoeMessage(ctx *middleware.Context, handler ReplaceSpoeMessageHandler) *ReplaceSpoeMessage { - return &ReplaceSpoeMessage{Context: ctx, Handler: handler} -} - -/* - ReplaceSpoeMessage swagger:route PUT /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name} Spoe replaceSpoeMessage - -# Replace a spoe message - -Replaces a spoe message configuration in one SPOE scope. -*/ -type ReplaceSpoeMessage struct { - Context *middleware.Context - Handler ReplaceSpoeMessageHandler -} - -func (o *ReplaceSpoeMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceSpoeMessageParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe/replace_spoe_message_parameters.go b/operations/spoe/replace_spoe_message_parameters.go deleted file mode 100644 index 62ff7eff..00000000 --- a/operations/spoe/replace_spoe_message_parameters.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceSpoeMessageParams creates a new ReplaceSpoeMessageParams object -// -// There are no default values defined in the spec. -func NewReplaceSpoeMessageParams() ReplaceSpoeMessageParams { - - return ReplaceSpoeMessageParams{} -} - -// ReplaceSpoeMessageParams contains all the bound params for the replace spoe message operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceSpoeMessage -type ReplaceSpoeMessageParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.SpoeMessage - /*Spoe message name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*Spoe scope name - Required: true - In: path - */ - ScopeName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceSpoeMessageParams() beforehand. -func (o *ReplaceSpoeMessageParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SpoeMessage - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - rScopeName, rhkScopeName, _ := route.Params.GetOK("scope_name") - if err := o.bindScopeName(rScopeName, rhkScopeName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceSpoeMessageParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceSpoeMessageParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindScopeName binds and validates parameter ScopeName from path. -func (o *ReplaceSpoeMessageParams) bindScopeName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ScopeName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceSpoeMessageParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceSpoeMessageParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/spoe/replace_spoe_message_responses.go b/operations/spoe/replace_spoe_message_responses.go deleted file mode 100644 index 1fc8352e..00000000 --- a/operations/spoe/replace_spoe_message_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceSpoeMessageOKCode is the HTTP code returned for type ReplaceSpoeMessageOK -const ReplaceSpoeMessageOKCode int = 200 - -/* -ReplaceSpoeMessageOK Spoe message replaced - -swagger:response replaceSpoeMessageOK -*/ -type ReplaceSpoeMessageOK struct { - - /* - In: Body - */ - Payload *models.SpoeMessage `json:"body,omitempty"` -} - -// NewReplaceSpoeMessageOK creates ReplaceSpoeMessageOK with default headers values -func NewReplaceSpoeMessageOK() *ReplaceSpoeMessageOK { - - return &ReplaceSpoeMessageOK{} -} - -// WithPayload adds the payload to the replace spoe message o k response -func (o *ReplaceSpoeMessageOK) WithPayload(payload *models.SpoeMessage) *ReplaceSpoeMessageOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe message o k response -func (o *ReplaceSpoeMessageOK) SetPayload(payload *models.SpoeMessage) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeMessageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeMessageBadRequestCode is the HTTP code returned for type ReplaceSpoeMessageBadRequest -const ReplaceSpoeMessageBadRequestCode int = 400 - -/* -ReplaceSpoeMessageBadRequest Bad request - -swagger:response replaceSpoeMessageBadRequest -*/ -type ReplaceSpoeMessageBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeMessageBadRequest creates ReplaceSpoeMessageBadRequest with default headers values -func NewReplaceSpoeMessageBadRequest() *ReplaceSpoeMessageBadRequest { - - return &ReplaceSpoeMessageBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe message bad request response -func (o *ReplaceSpoeMessageBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeMessageBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe message bad request response -func (o *ReplaceSpoeMessageBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe message bad request response -func (o *ReplaceSpoeMessageBadRequest) WithPayload(payload *models.Error) *ReplaceSpoeMessageBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe message bad request response -func (o *ReplaceSpoeMessageBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeMessageBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceSpoeMessageNotFoundCode is the HTTP code returned for type ReplaceSpoeMessageNotFound -const ReplaceSpoeMessageNotFoundCode int = 404 - -/* -ReplaceSpoeMessageNotFound The specified resource was not found - -swagger:response replaceSpoeMessageNotFound -*/ -type ReplaceSpoeMessageNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeMessageNotFound creates ReplaceSpoeMessageNotFound with default headers values -func NewReplaceSpoeMessageNotFound() *ReplaceSpoeMessageNotFound { - - return &ReplaceSpoeMessageNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe message not found response -func (o *ReplaceSpoeMessageNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeMessageNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe message not found response -func (o *ReplaceSpoeMessageNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe message not found response -func (o *ReplaceSpoeMessageNotFound) WithPayload(payload *models.Error) *ReplaceSpoeMessageNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe message not found response -func (o *ReplaceSpoeMessageNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeMessageNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceSpoeMessageDefault General Error - -swagger:response replaceSpoeMessageDefault -*/ -type ReplaceSpoeMessageDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceSpoeMessageDefault creates ReplaceSpoeMessageDefault with default headers values -func NewReplaceSpoeMessageDefault(code int) *ReplaceSpoeMessageDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceSpoeMessageDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) WithStatusCode(code int) *ReplaceSpoeMessageDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) WithConfigurationVersion(configurationVersion string) *ReplaceSpoeMessageDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) WithPayload(payload *models.Error) *ReplaceSpoeMessageDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace spoe message default response -func (o *ReplaceSpoeMessageDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceSpoeMessageDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe/replace_spoe_message_urlbuilder.go b/operations/spoe/replace_spoe_message_urlbuilder.go deleted file mode 100644 index cb2cdcc0..00000000 --- a/operations/spoe/replace_spoe_message_urlbuilder.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceSpoeMessageURL generates an URL for the replace spoe message operation -type ReplaceSpoeMessageURL struct { - Name string - ParentName string - ScopeName string - - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeMessageURL) WithBasePath(bp string) *ReplaceSpoeMessageURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceSpoeMessageURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceSpoeMessageURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceSpoeMessageURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceSpoeMessageURL") - } - - scopeName := o.ScopeName - if scopeName != "" { - _path = strings.Replace(_path, "{scope_name}", scopeName, -1) - } else { - return nil, errors.New("scopeName is required on ReplaceSpoeMessageURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceSpoeMessageURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceSpoeMessageURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceSpoeMessageURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceSpoeMessageURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceSpoeMessageURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceSpoeMessageURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe_transactions/commit_spoe_transaction.go b/operations/spoe_transactions/commit_spoe_transaction.go deleted file mode 100644 index eb92d560..00000000 --- a/operations/spoe_transactions/commit_spoe_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CommitSpoeTransactionHandlerFunc turns a function with the right signature into a commit spoe transaction handler -type CommitSpoeTransactionHandlerFunc func(CommitSpoeTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CommitSpoeTransactionHandlerFunc) Handle(params CommitSpoeTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CommitSpoeTransactionHandler interface for that can handle valid commit spoe transaction params -type CommitSpoeTransactionHandler interface { - Handle(CommitSpoeTransactionParams, interface{}) middleware.Responder -} - -// NewCommitSpoeTransaction creates a new http.Handler for the commit spoe transaction operation -func NewCommitSpoeTransaction(ctx *middleware.Context, handler CommitSpoeTransactionHandler) *CommitSpoeTransaction { - return &CommitSpoeTransaction{Context: ctx, Handler: handler} -} - -/* - CommitSpoeTransaction swagger:route PUT /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id} SpoeTransactions commitSpoeTransaction - -# Commit transaction - -Commit transaction, execute all operations in transaction and return msg -*/ -type CommitSpoeTransaction struct { - Context *middleware.Context - Handler CommitSpoeTransactionHandler -} - -func (o *CommitSpoeTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCommitSpoeTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe_transactions/commit_spoe_transaction_parameters.go b/operations/spoe_transactions/commit_spoe_transaction_parameters.go deleted file mode 100644 index 4b800638..00000000 --- a/operations/spoe_transactions/commit_spoe_transaction_parameters.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewCommitSpoeTransactionParams creates a new CommitSpoeTransactionParams object -// with the default values initialized. -func NewCommitSpoeTransactionParams() CommitSpoeTransactionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CommitSpoeTransactionParams{ - ForceReload: &forceReloadDefault, - } -} - -// CommitSpoeTransactionParams contains all the bound params for the commit spoe transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters commitSpoeTransaction -type CommitSpoeTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Transaction id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCommitSpoeTransactionParams() beforehand. -func (o *CommitSpoeTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CommitSpoeTransactionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCommitSpoeTransactionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *CommitSpoeTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CommitSpoeTransactionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/spoe_transactions/commit_spoe_transaction_responses.go b/operations/spoe_transactions/commit_spoe_transaction_responses.go deleted file mode 100644 index 3efa6a27..00000000 --- a/operations/spoe_transactions/commit_spoe_transaction_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CommitSpoeTransactionOKCode is the HTTP code returned for type CommitSpoeTransactionOK -const CommitSpoeTransactionOKCode int = 200 - -/* -CommitSpoeTransactionOK Transaction successfully committed - -swagger:response commitSpoeTransactionOK -*/ -type CommitSpoeTransactionOK struct { - - /* - In: Body - */ - Payload *models.SpoeTransaction `json:"body,omitempty"` -} - -// NewCommitSpoeTransactionOK creates CommitSpoeTransactionOK with default headers values -func NewCommitSpoeTransactionOK() *CommitSpoeTransactionOK { - - return &CommitSpoeTransactionOK{} -} - -// WithPayload adds the payload to the commit spoe transaction o k response -func (o *CommitSpoeTransactionOK) WithPayload(payload *models.SpoeTransaction) *CommitSpoeTransactionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit spoe transaction o k response -func (o *CommitSpoeTransactionOK) SetPayload(payload *models.SpoeTransaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitSpoeTransactionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitSpoeTransactionAcceptedCode is the HTTP code returned for type CommitSpoeTransactionAccepted -const CommitSpoeTransactionAcceptedCode int = 202 - -/* -CommitSpoeTransactionAccepted Configuration change accepted and reload requested - -swagger:response commitSpoeTransactionAccepted -*/ -type CommitSpoeTransactionAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SpoeTransaction `json:"body,omitempty"` -} - -// NewCommitSpoeTransactionAccepted creates CommitSpoeTransactionAccepted with default headers values -func NewCommitSpoeTransactionAccepted() *CommitSpoeTransactionAccepted { - - return &CommitSpoeTransactionAccepted{} -} - -// WithReloadID adds the reloadId to the commit spoe transaction accepted response -func (o *CommitSpoeTransactionAccepted) WithReloadID(reloadID string) *CommitSpoeTransactionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the commit spoe transaction accepted response -func (o *CommitSpoeTransactionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the commit spoe transaction accepted response -func (o *CommitSpoeTransactionAccepted) WithPayload(payload *models.SpoeTransaction) *CommitSpoeTransactionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit spoe transaction accepted response -func (o *CommitSpoeTransactionAccepted) SetPayload(payload *models.SpoeTransaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitSpoeTransactionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitSpoeTransactionBadRequestCode is the HTTP code returned for type CommitSpoeTransactionBadRequest -const CommitSpoeTransactionBadRequestCode int = 400 - -/* -CommitSpoeTransactionBadRequest Bad request - -swagger:response commitSpoeTransactionBadRequest -*/ -type CommitSpoeTransactionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitSpoeTransactionBadRequest creates CommitSpoeTransactionBadRequest with default headers values -func NewCommitSpoeTransactionBadRequest() *CommitSpoeTransactionBadRequest { - - return &CommitSpoeTransactionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit spoe transaction bad request response -func (o *CommitSpoeTransactionBadRequest) WithConfigurationVersion(configurationVersion string) *CommitSpoeTransactionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit spoe transaction bad request response -func (o *CommitSpoeTransactionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit spoe transaction bad request response -func (o *CommitSpoeTransactionBadRequest) WithPayload(payload *models.Error) *CommitSpoeTransactionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit spoe transaction bad request response -func (o *CommitSpoeTransactionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitSpoeTransactionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitSpoeTransactionNotFoundCode is the HTTP code returned for type CommitSpoeTransactionNotFound -const CommitSpoeTransactionNotFoundCode int = 404 - -/* -CommitSpoeTransactionNotFound The specified resource was not found - -swagger:response commitSpoeTransactionNotFound -*/ -type CommitSpoeTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitSpoeTransactionNotFound creates CommitSpoeTransactionNotFound with default headers values -func NewCommitSpoeTransactionNotFound() *CommitSpoeTransactionNotFound { - - return &CommitSpoeTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit spoe transaction not found response -func (o *CommitSpoeTransactionNotFound) WithConfigurationVersion(configurationVersion string) *CommitSpoeTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit spoe transaction not found response -func (o *CommitSpoeTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit spoe transaction not found response -func (o *CommitSpoeTransactionNotFound) WithPayload(payload *models.Error) *CommitSpoeTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit spoe transaction not found response -func (o *CommitSpoeTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitSpoeTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CommitSpoeTransactionDefault General Error - -swagger:response commitSpoeTransactionDefault -*/ -type CommitSpoeTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitSpoeTransactionDefault creates CommitSpoeTransactionDefault with default headers values -func NewCommitSpoeTransactionDefault(code int) *CommitSpoeTransactionDefault { - if code <= 0 { - code = 500 - } - - return &CommitSpoeTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) WithStatusCode(code int) *CommitSpoeTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) WithConfigurationVersion(configurationVersion string) *CommitSpoeTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) WithPayload(payload *models.Error) *CommitSpoeTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit spoe transaction default response -func (o *CommitSpoeTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe_transactions/commit_spoe_transaction_urlbuilder.go b/operations/spoe_transactions/commit_spoe_transaction_urlbuilder.go deleted file mode 100644 index 93f7dda5..00000000 --- a/operations/spoe_transactions/commit_spoe_transaction_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CommitSpoeTransactionURL generates an URL for the commit spoe transaction operation -type CommitSpoeTransactionURL struct { - ID string - ParentName string - - ForceReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CommitSpoeTransactionURL) WithBasePath(bp string) *CommitSpoeTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CommitSpoeTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CommitSpoeTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on CommitSpoeTransactionURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CommitSpoeTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CommitSpoeTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CommitSpoeTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CommitSpoeTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CommitSpoeTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CommitSpoeTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CommitSpoeTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe_transactions/delete_spoe_transaction.go b/operations/spoe_transactions/delete_spoe_transaction.go deleted file mode 100644 index b27eb73e..00000000 --- a/operations/spoe_transactions/delete_spoe_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteSpoeTransactionHandlerFunc turns a function with the right signature into a delete spoe transaction handler -type DeleteSpoeTransactionHandlerFunc func(DeleteSpoeTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSpoeTransactionHandlerFunc) Handle(params DeleteSpoeTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteSpoeTransactionHandler interface for that can handle valid delete spoe transaction params -type DeleteSpoeTransactionHandler interface { - Handle(DeleteSpoeTransactionParams, interface{}) middleware.Responder -} - -// NewDeleteSpoeTransaction creates a new http.Handler for the delete spoe transaction operation -func NewDeleteSpoeTransaction(ctx *middleware.Context, handler DeleteSpoeTransactionHandler) *DeleteSpoeTransaction { - return &DeleteSpoeTransaction{Context: ctx, Handler: handler} -} - -/* - DeleteSpoeTransaction swagger:route DELETE /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id} SpoeTransactions deleteSpoeTransaction - -# Delete a transaction - -Deletes a transaction. -*/ -type DeleteSpoeTransaction struct { - Context *middleware.Context - Handler DeleteSpoeTransactionHandler -} - -func (o *DeleteSpoeTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSpoeTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe_transactions/delete_spoe_transaction_parameters.go b/operations/spoe_transactions/delete_spoe_transaction_parameters.go deleted file mode 100644 index 87e2a78f..00000000 --- a/operations/spoe_transactions/delete_spoe_transaction_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteSpoeTransactionParams creates a new DeleteSpoeTransactionParams object -// -// There are no default values defined in the spec. -func NewDeleteSpoeTransactionParams() DeleteSpoeTransactionParams { - - return DeleteSpoeTransactionParams{} -} - -// DeleteSpoeTransactionParams contains all the bound params for the delete spoe transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteSpoeTransaction -type DeleteSpoeTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Transaction id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteSpoeTransactionParams() beforehand. -func (o *DeleteSpoeTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteSpoeTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteSpoeTransactionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/spoe_transactions/delete_spoe_transaction_responses.go b/operations/spoe_transactions/delete_spoe_transaction_responses.go deleted file mode 100644 index f4968d67..00000000 --- a/operations/spoe_transactions/delete_spoe_transaction_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteSpoeTransactionNoContentCode is the HTTP code returned for type DeleteSpoeTransactionNoContent -const DeleteSpoeTransactionNoContentCode int = 204 - -/* -DeleteSpoeTransactionNoContent Transaction deleted - -swagger:response deleteSpoeTransactionNoContent -*/ -type DeleteSpoeTransactionNoContent struct { -} - -// NewDeleteSpoeTransactionNoContent creates DeleteSpoeTransactionNoContent with default headers values -func NewDeleteSpoeTransactionNoContent() *DeleteSpoeTransactionNoContent { - - return &DeleteSpoeTransactionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSpoeTransactionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteSpoeTransactionNotFoundCode is the HTTP code returned for type DeleteSpoeTransactionNotFound -const DeleteSpoeTransactionNotFoundCode int = 404 - -/* -DeleteSpoeTransactionNotFound The specified resource was not found - -swagger:response deleteSpoeTransactionNotFound -*/ -type DeleteSpoeTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeTransactionNotFound creates DeleteSpoeTransactionNotFound with default headers values -func NewDeleteSpoeTransactionNotFound() *DeleteSpoeTransactionNotFound { - - return &DeleteSpoeTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe transaction not found response -func (o *DeleteSpoeTransactionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteSpoeTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe transaction not found response -func (o *DeleteSpoeTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe transaction not found response -func (o *DeleteSpoeTransactionNotFound) WithPayload(payload *models.Error) *DeleteSpoeTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe transaction not found response -func (o *DeleteSpoeTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteSpoeTransactionDefault General Error - -swagger:response deleteSpoeTransactionDefault -*/ -type DeleteSpoeTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteSpoeTransactionDefault creates DeleteSpoeTransactionDefault with default headers values -func NewDeleteSpoeTransactionDefault(code int) *DeleteSpoeTransactionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSpoeTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) WithStatusCode(code int) *DeleteSpoeTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) WithConfigurationVersion(configurationVersion string) *DeleteSpoeTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) WithPayload(payload *models.Error) *DeleteSpoeTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete spoe transaction default response -func (o *DeleteSpoeTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe_transactions/delete_spoe_transaction_urlbuilder.go b/operations/spoe_transactions/delete_spoe_transaction_urlbuilder.go deleted file mode 100644 index ae56a5ee..00000000 --- a/operations/spoe_transactions/delete_spoe_transaction_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteSpoeTransactionURL generates an URL for the delete spoe transaction operation -type DeleteSpoeTransactionURL struct { - ID string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeTransactionURL) WithBasePath(bp string) *DeleteSpoeTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteSpoeTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSpoeTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteSpoeTransactionURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteSpoeTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteSpoeTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteSpoeTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSpoeTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSpoeTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSpoeTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteSpoeTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe_transactions/get_all_spoe_transaction.go b/operations/spoe_transactions/get_all_spoe_transaction.go deleted file mode 100644 index 599e3432..00000000 --- a/operations/spoe_transactions/get_all_spoe_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllSpoeTransactionHandlerFunc turns a function with the right signature into a get all spoe transaction handler -type GetAllSpoeTransactionHandlerFunc func(GetAllSpoeTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllSpoeTransactionHandlerFunc) Handle(params GetAllSpoeTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllSpoeTransactionHandler interface for that can handle valid get all spoe transaction params -type GetAllSpoeTransactionHandler interface { - Handle(GetAllSpoeTransactionParams, interface{}) middleware.Responder -} - -// NewGetAllSpoeTransaction creates a new http.Handler for the get all spoe transaction operation -func NewGetAllSpoeTransaction(ctx *middleware.Context, handler GetAllSpoeTransactionHandler) *GetAllSpoeTransaction { - return &GetAllSpoeTransaction{Context: ctx, Handler: handler} -} - -/* - GetAllSpoeTransaction swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions SpoeTransactions getAllSpoeTransaction - -Return list of SPOE configuration transactions. - -Returns a list of SPOE configuration transactions. Transactions can be filtered by their status. -*/ -type GetAllSpoeTransaction struct { - Context *middleware.Context - Handler GetAllSpoeTransactionHandler -} - -func (o *GetAllSpoeTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllSpoeTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe_transactions/get_all_spoe_transaction_parameters.go b/operations/spoe_transactions/get_all_spoe_transaction_parameters.go deleted file mode 100644 index a8f271ce..00000000 --- a/operations/spoe_transactions/get_all_spoe_transaction_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetAllSpoeTransactionParams creates a new GetAllSpoeTransactionParams object -// -// There are no default values defined in the spec. -func NewGetAllSpoeTransactionParams() GetAllSpoeTransactionParams { - - return GetAllSpoeTransactionParams{} -} - -// GetAllSpoeTransactionParams contains all the bound params for the get all spoe transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllSpoeTransaction -type GetAllSpoeTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Filter by transaction status - In: query - */ - Status *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllSpoeTransactionParams() beforehand. -func (o *GetAllSpoeTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qStatus, qhkStatus, _ := qs.GetOK("status") - if err := o.bindStatus(qStatus, qhkStatus, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllSpoeTransactionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindStatus binds and validates parameter Status from query. -func (o *GetAllSpoeTransactionParams) bindStatus(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Status = &raw - - if err := o.validateStatus(formats); err != nil { - return err - } - - return nil -} - -// validateStatus carries on validations for parameter Status -func (o *GetAllSpoeTransactionParams) validateStatus(formats strfmt.Registry) error { - - if err := validate.EnumCase("status", "query", *o.Status, []interface{}{"failed", "in_progress"}, true); err != nil { - return err - } - - return nil -} diff --git a/operations/spoe_transactions/get_all_spoe_transaction_responses.go b/operations/spoe_transactions/get_all_spoe_transaction_responses.go deleted file mode 100644 index 563c6b05..00000000 --- a/operations/spoe_transactions/get_all_spoe_transaction_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllSpoeTransactionOKCode is the HTTP code returned for type GetAllSpoeTransactionOK -const GetAllSpoeTransactionOKCode int = 200 - -/* -GetAllSpoeTransactionOK Success - -swagger:response getAllSpoeTransactionOK -*/ -type GetAllSpoeTransactionOK struct { - - /* - In: Body - */ - Payload models.SpoeTransactions `json:"body,omitempty"` -} - -// NewGetAllSpoeTransactionOK creates GetAllSpoeTransactionOK with default headers values -func NewGetAllSpoeTransactionOK() *GetAllSpoeTransactionOK { - - return &GetAllSpoeTransactionOK{} -} - -// WithPayload adds the payload to the get all spoe transaction o k response -func (o *GetAllSpoeTransactionOK) WithPayload(payload models.SpoeTransactions) *GetAllSpoeTransactionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe transaction o k response -func (o *GetAllSpoeTransactionOK) SetPayload(payload models.SpoeTransactions) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeTransactionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SpoeTransactions{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllSpoeTransactionDefault General Error - -swagger:response getAllSpoeTransactionDefault -*/ -type GetAllSpoeTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllSpoeTransactionDefault creates GetAllSpoeTransactionDefault with default headers values -func NewGetAllSpoeTransactionDefault(code int) *GetAllSpoeTransactionDefault { - if code <= 0 { - code = 500 - } - - return &GetAllSpoeTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) WithStatusCode(code int) *GetAllSpoeTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) WithConfigurationVersion(configurationVersion string) *GetAllSpoeTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) WithPayload(payload *models.Error) *GetAllSpoeTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all spoe transaction default response -func (o *GetAllSpoeTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe_transactions/get_all_spoe_transaction_urlbuilder.go b/operations/spoe_transactions/get_all_spoe_transaction_urlbuilder.go deleted file mode 100644 index c4c43bd6..00000000 --- a/operations/spoe_transactions/get_all_spoe_transaction_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllSpoeTransactionURL generates an URL for the get all spoe transaction operation -type GetAllSpoeTransactionURL struct { - ParentName string - - Status *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeTransactionURL) WithBasePath(bp string) *GetAllSpoeTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllSpoeTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllSpoeTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/transactions" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllSpoeTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var statusQ string - if o.Status != nil { - statusQ = *o.Status - } - if statusQ != "" { - qs.Set("status", statusQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllSpoeTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllSpoeTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllSpoeTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllSpoeTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllSpoeTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllSpoeTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe_transactions/get_spoe_transaction.go b/operations/spoe_transactions/get_spoe_transaction.go deleted file mode 100644 index d0a2000c..00000000 --- a/operations/spoe_transactions/get_spoe_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetSpoeTransactionHandlerFunc turns a function with the right signature into a get spoe transaction handler -type GetSpoeTransactionHandlerFunc func(GetSpoeTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSpoeTransactionHandlerFunc) Handle(params GetSpoeTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetSpoeTransactionHandler interface for that can handle valid get spoe transaction params -type GetSpoeTransactionHandler interface { - Handle(GetSpoeTransactionParams, interface{}) middleware.Responder -} - -// NewGetSpoeTransaction creates a new http.Handler for the get spoe transaction operation -func NewGetSpoeTransaction(ctx *middleware.Context, handler GetSpoeTransactionHandler) *GetSpoeTransaction { - return &GetSpoeTransaction{Context: ctx, Handler: handler} -} - -/* - GetSpoeTransaction swagger:route GET /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id} SpoeTransactions getSpoeTransaction - -# Return one SPOE configuration transactions - -Returns one SPOE configuration transactions. -*/ -type GetSpoeTransaction struct { - Context *middleware.Context - Handler GetSpoeTransactionHandler -} - -func (o *GetSpoeTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSpoeTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/spoe_transactions/get_spoe_transaction_parameters.go b/operations/spoe_transactions/get_spoe_transaction_parameters.go deleted file mode 100644 index 57e33f8d..00000000 --- a/operations/spoe_transactions/get_spoe_transaction_parameters.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetSpoeTransactionParams creates a new GetSpoeTransactionParams object -// -// There are no default values defined in the spec. -func NewGetSpoeTransactionParams() GetSpoeTransactionParams { - - return GetSpoeTransactionParams{} -} - -// GetSpoeTransactionParams contains all the bound params for the get spoe transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters getSpoeTransaction -type GetSpoeTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Transaction id - Required: true - In: path - */ - ID string - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetSpoeTransactionParams() beforehand. -func (o *GetSpoeTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetSpoeTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetSpoeTransactionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/spoe_transactions/get_spoe_transaction_responses.go b/operations/spoe_transactions/get_spoe_transaction_responses.go deleted file mode 100644 index c83facaf..00000000 --- a/operations/spoe_transactions/get_spoe_transaction_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetSpoeTransactionOKCode is the HTTP code returned for type GetSpoeTransactionOK -const GetSpoeTransactionOKCode int = 200 - -/* -GetSpoeTransactionOK Successful operation - -swagger:response getSpoeTransactionOK -*/ -type GetSpoeTransactionOK struct { - - /* - In: Body - */ - Payload *models.SpoeTransaction `json:"body,omitempty"` -} - -// NewGetSpoeTransactionOK creates GetSpoeTransactionOK with default headers values -func NewGetSpoeTransactionOK() *GetSpoeTransactionOK { - - return &GetSpoeTransactionOK{} -} - -// WithPayload adds the payload to the get spoe transaction o k response -func (o *GetSpoeTransactionOK) WithPayload(payload *models.SpoeTransaction) *GetSpoeTransactionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe transaction o k response -func (o *GetSpoeTransactionOK) SetPayload(payload *models.SpoeTransaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeTransactionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetSpoeTransactionNotFoundCode is the HTTP code returned for type GetSpoeTransactionNotFound -const GetSpoeTransactionNotFoundCode int = 404 - -/* -GetSpoeTransactionNotFound The specified resource was not found - -swagger:response getSpoeTransactionNotFound -*/ -type GetSpoeTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeTransactionNotFound creates GetSpoeTransactionNotFound with default headers values -func NewGetSpoeTransactionNotFound() *GetSpoeTransactionNotFound { - - return &GetSpoeTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe transaction not found response -func (o *GetSpoeTransactionNotFound) WithConfigurationVersion(configurationVersion string) *GetSpoeTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe transaction not found response -func (o *GetSpoeTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe transaction not found response -func (o *GetSpoeTransactionNotFound) WithPayload(payload *models.Error) *GetSpoeTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe transaction not found response -func (o *GetSpoeTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetSpoeTransactionDefault General Error - -swagger:response getSpoeTransactionDefault -*/ -type GetSpoeTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetSpoeTransactionDefault creates GetSpoeTransactionDefault with default headers values -func NewGetSpoeTransactionDefault(code int) *GetSpoeTransactionDefault { - if code <= 0 { - code = 500 - } - - return &GetSpoeTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) WithStatusCode(code int) *GetSpoeTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) WithConfigurationVersion(configurationVersion string) *GetSpoeTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) WithPayload(payload *models.Error) *GetSpoeTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get spoe transaction default response -func (o *GetSpoeTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe_transactions/get_spoe_transaction_urlbuilder.go b/operations/spoe_transactions/get_spoe_transaction_urlbuilder.go deleted file mode 100644 index 1c002f4b..00000000 --- a/operations/spoe_transactions/get_spoe_transaction_urlbuilder.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetSpoeTransactionURL generates an URL for the get spoe transaction operation -type GetSpoeTransactionURL struct { - ID string - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeTransactionURL) WithBasePath(bp string) *GetSpoeTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetSpoeTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSpoeTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetSpoeTransactionURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetSpoeTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetSpoeTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetSpoeTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSpoeTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSpoeTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSpoeTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetSpoeTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/spoe_transactions/start_spoe_transaction.go b/operations/spoe_transactions/start_spoe_transaction.go deleted file mode 100644 index 0b8e63da..00000000 --- a/operations/spoe_transactions/start_spoe_transaction.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// StartSpoeTransactionHandlerFunc turns a function with the right signature into a start spoe transaction handler -type StartSpoeTransactionHandlerFunc func(StartSpoeTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn StartSpoeTransactionHandlerFunc) Handle(params StartSpoeTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// StartSpoeTransactionHandler interface for that can handle valid start spoe transaction params -type StartSpoeTransactionHandler interface { - Handle(StartSpoeTransactionParams, interface{}) middleware.Responder -} - -// NewStartSpoeTransaction creates a new http.Handler for the start spoe transaction operation -func NewStartSpoeTransaction(ctx *middleware.Context, handler StartSpoeTransactionHandler) *StartSpoeTransaction { - return &StartSpoeTransaction{Context: ctx, Handler: handler} -} - -/* - StartSpoeTransaction swagger:route POST /services/haproxy/spoe/spoe_files/{parent_name}/transactions SpoeTransactions startSpoeTransaction - -# Start a new transaction - -Starts a new transaction and returns it's id -*/ -type StartSpoeTransaction struct { - Context *middleware.Context - Handler StartSpoeTransactionHandler -} - -func (o *StartSpoeTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewStartSpoeTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// StartSpoeTransactionTooManyRequestsBody start spoe transaction too many requests body -// Example: {"code":429,"message":"cannot start a new transaction, reached the maximum amount of 20 active transactions available"} -// -// swagger:model StartSpoeTransactionTooManyRequestsBody -type StartSpoeTransactionTooManyRequestsBody struct { - - // code - Code int64 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` -} - -// Validate validates this start spoe transaction too many requests body -func (o *StartSpoeTransactionTooManyRequestsBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this start spoe transaction too many requests body based on context it is used -func (o *StartSpoeTransactionTooManyRequestsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *StartSpoeTransactionTooManyRequestsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *StartSpoeTransactionTooManyRequestsBody) UnmarshalBinary(b []byte) error { - var res StartSpoeTransactionTooManyRequestsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operations/spoe_transactions/start_spoe_transaction_parameters.go b/operations/spoe_transactions/start_spoe_transaction_parameters.go deleted file mode 100644 index 17791634..00000000 --- a/operations/spoe_transactions/start_spoe_transaction_parameters.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewStartSpoeTransactionParams creates a new StartSpoeTransactionParams object -// -// There are no default values defined in the spec. -func NewStartSpoeTransactionParams() StartSpoeTransactionParams { - - return StartSpoeTransactionParams{} -} - -// StartSpoeTransactionParams contains all the bound params for the start spoe transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters startSpoeTransaction -type StartSpoeTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Configuration version on which to work on - Required: true - In: query - */ - Version int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewStartSpoeTransactionParams() beforehand. -func (o *StartSpoeTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *StartSpoeTransactionParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *StartSpoeTransactionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("version", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("version", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = value - - return nil -} diff --git a/operations/spoe_transactions/start_spoe_transaction_responses.go b/operations/spoe_transactions/start_spoe_transaction_responses.go deleted file mode 100644 index 816cc982..00000000 --- a/operations/spoe_transactions/start_spoe_transaction_responses.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// StartSpoeTransactionCreatedCode is the HTTP code returned for type StartSpoeTransactionCreated -const StartSpoeTransactionCreatedCode int = 201 - -/* -StartSpoeTransactionCreated Transaction started - -swagger:response startSpoeTransactionCreated -*/ -type StartSpoeTransactionCreated struct { - - /* - In: Body - */ - Payload *models.SpoeTransaction `json:"body,omitempty"` -} - -// NewStartSpoeTransactionCreated creates StartSpoeTransactionCreated with default headers values -func NewStartSpoeTransactionCreated() *StartSpoeTransactionCreated { - - return &StartSpoeTransactionCreated{} -} - -// WithPayload adds the payload to the start spoe transaction created response -func (o *StartSpoeTransactionCreated) WithPayload(payload *models.SpoeTransaction) *StartSpoeTransactionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start spoe transaction created response -func (o *StartSpoeTransactionCreated) SetPayload(payload *models.SpoeTransaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartSpoeTransactionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// StartSpoeTransactionTooManyRequestsCode is the HTTP code returned for type StartSpoeTransactionTooManyRequests -const StartSpoeTransactionTooManyRequestsCode int = 429 - -/* -StartSpoeTransactionTooManyRequests Too many open transactions - -swagger:response startSpoeTransactionTooManyRequests -*/ -type StartSpoeTransactionTooManyRequests struct { - - /* - In: Body - */ - Payload *StartSpoeTransactionTooManyRequestsBody `json:"body,omitempty"` -} - -// NewStartSpoeTransactionTooManyRequests creates StartSpoeTransactionTooManyRequests with default headers values -func NewStartSpoeTransactionTooManyRequests() *StartSpoeTransactionTooManyRequests { - - return &StartSpoeTransactionTooManyRequests{} -} - -// WithPayload adds the payload to the start spoe transaction too many requests response -func (o *StartSpoeTransactionTooManyRequests) WithPayload(payload *StartSpoeTransactionTooManyRequestsBody) *StartSpoeTransactionTooManyRequests { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start spoe transaction too many requests response -func (o *StartSpoeTransactionTooManyRequests) SetPayload(payload *StartSpoeTransactionTooManyRequestsBody) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartSpoeTransactionTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(429) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -StartSpoeTransactionDefault General Error - -swagger:response startSpoeTransactionDefault -*/ -type StartSpoeTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewStartSpoeTransactionDefault creates StartSpoeTransactionDefault with default headers values -func NewStartSpoeTransactionDefault(code int) *StartSpoeTransactionDefault { - if code <= 0 { - code = 500 - } - - return &StartSpoeTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) WithStatusCode(code int) *StartSpoeTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) WithConfigurationVersion(configurationVersion string) *StartSpoeTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) WithPayload(payload *models.Error) *StartSpoeTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start spoe transaction default response -func (o *StartSpoeTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/spoe_transactions/start_spoe_transaction_urlbuilder.go b/operations/spoe_transactions/start_spoe_transaction_urlbuilder.go deleted file mode 100644 index 093f9110..00000000 --- a/operations/spoe_transactions/start_spoe_transaction_urlbuilder.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package spoe_transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// StartSpoeTransactionURL generates an URL for the start spoe transaction operation -type StartSpoeTransactionURL struct { - ParentName string - - Version int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *StartSpoeTransactionURL) WithBasePath(bp string) *StartSpoeTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *StartSpoeTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *StartSpoeTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/spoe/spoe_files/{parent_name}/transactions" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on StartSpoeTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - versionQ := swag.FormatInt64(o.Version) - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *StartSpoeTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *StartSpoeTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *StartSpoeTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on StartSpoeTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on StartSpoeTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *StartSpoeTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stats/get_stats.go b/operations/stats/get_stats.go deleted file mode 100644 index 0772c39a..00000000 --- a/operations/stats/get_stats.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStatsHandlerFunc turns a function with the right signature into a get stats handler -type GetStatsHandlerFunc func(GetStatsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStatsHandlerFunc) Handle(params GetStatsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStatsHandler interface for that can handle valid get stats params -type GetStatsHandler interface { - Handle(GetStatsParams, interface{}) middleware.Responder -} - -// NewGetStats creates a new http.Handler for the get stats operation -func NewGetStats(ctx *middleware.Context, handler GetStatsHandler) *GetStats { - return &GetStats{Context: ctx, Handler: handler} -} - -/* - GetStats swagger:route GET /services/haproxy/stats/native Stats getStats - -# Gets stats - -Getting stats from the HAProxy. -*/ -type GetStats struct { - Context *middleware.Context - Handler GetStatsHandler -} - -func (o *GetStats) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStatsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stats/get_stats_parameters.go b/operations/stats/get_stats_parameters.go deleted file mode 100644 index 5185684c..00000000 --- a/operations/stats/get_stats_parameters.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetStatsParams creates a new GetStatsParams object -// -// There are no default values defined in the spec. -func NewGetStatsParams() GetStatsParams { - - return GetStatsParams{} -} - -// GetStatsParams contains all the bound params for the get stats operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStats -type GetStatsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Object name to get stats for - In: query - */ - Name *string - /*Object parent name to get stats for, in case the object is a server - In: query - */ - Parent *string - /*Object type to get stats for (one of frontend, backend, server) - In: query - */ - Type *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStatsParams() beforehand. -func (o *GetStatsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qName, qhkName, _ := qs.GetOK("name") - if err := o.bindName(qName, qhkName, route.Formats); err != nil { - res = append(res, err) - } - - qParent, qhkParent, _ := qs.GetOK("parent") - if err := o.bindParent(qParent, qhkParent, route.Formats); err != nil { - res = append(res, err) - } - - qType, qhkType, _ := qs.GetOK("type") - if err := o.bindType(qType, qhkType, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from query. -func (o *GetStatsParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Name = &raw - - return nil -} - -// bindParent binds and validates parameter Parent from query. -func (o *GetStatsParams) bindParent(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Parent = &raw - - return nil -} - -// bindType binds and validates parameter Type from query. -func (o *GetStatsParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Type = &raw - - if err := o.validateType(formats); err != nil { - return err - } - - return nil -} - -// validateType carries on validations for parameter Type -func (o *GetStatsParams) validateType(formats strfmt.Registry) error { - - if err := validate.EnumCase("type", "query", *o.Type, []interface{}{"frontend", "backend", "server"}, true); err != nil { - return err - } - - return nil -} diff --git a/operations/stats/get_stats_responses.go b/operations/stats/get_stats_responses.go deleted file mode 100644 index 906b95d1..00000000 --- a/operations/stats/get_stats_responses.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStatsOKCode is the HTTP code returned for type GetStatsOK -const GetStatsOKCode int = 200 - -/* -GetStatsOK Success - -swagger:response getStatsOK -*/ -type GetStatsOK struct { - - /* - In: Body - */ - Payload *models.NativeStats `json:"body,omitempty"` -} - -// NewGetStatsOK creates GetStatsOK with default headers values -func NewGetStatsOK() *GetStatsOK { - - return &GetStatsOK{} -} - -// WithPayload adds the payload to the get stats o k response -func (o *GetStatsOK) WithPayload(payload *models.NativeStats) *GetStatsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stats o k response -func (o *GetStatsOK) SetPayload(payload *models.NativeStats) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetStatsInternalServerErrorCode is the HTTP code returned for type GetStatsInternalServerError -const GetStatsInternalServerErrorCode int = 500 - -/* -GetStatsInternalServerError Internal Server Error - -swagger:response getStatsInternalServerError -*/ -type GetStatsInternalServerError struct { - - /* - In: Body - */ - Payload *models.NativeStats `json:"body,omitempty"` -} - -// NewGetStatsInternalServerError creates GetStatsInternalServerError with default headers values -func NewGetStatsInternalServerError() *GetStatsInternalServerError { - - return &GetStatsInternalServerError{} -} - -// WithPayload adds the payload to the get stats internal server error response -func (o *GetStatsInternalServerError) WithPayload(payload *models.NativeStats) *GetStatsInternalServerError { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stats internal server error response -func (o *GetStatsInternalServerError) SetPayload(payload *models.NativeStats) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(500) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetStatsDefault General Error - -swagger:response getStatsDefault -*/ -type GetStatsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStatsDefault creates GetStatsDefault with default headers values -func NewGetStatsDefault(code int) *GetStatsDefault { - if code <= 0 { - code = 500 - } - - return &GetStatsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stats default response -func (o *GetStatsDefault) WithStatusCode(code int) *GetStatsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stats default response -func (o *GetStatsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stats default response -func (o *GetStatsDefault) WithConfigurationVersion(configurationVersion string) *GetStatsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stats default response -func (o *GetStatsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stats default response -func (o *GetStatsDefault) WithPayload(payload *models.Error) *GetStatsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stats default response -func (o *GetStatsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStatsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stats/get_stats_urlbuilder.go b/operations/stats/get_stats_urlbuilder.go deleted file mode 100644 index fc30b406..00000000 --- a/operations/stats/get_stats_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetStatsURL generates an URL for the get stats operation -type GetStatsURL struct { - Name *string - Parent *string - Type *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStatsURL) WithBasePath(bp string) *GetStatsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStatsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStatsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/stats/native" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var nameQ string - if o.Name != nil { - nameQ = *o.Name - } - if nameQ != "" { - qs.Set("name", nameQ) - } - - var parentQ string - if o.Parent != nil { - parentQ = *o.Parent - } - if parentQ != "" { - qs.Set("parent", parentQ) - } - - var typeVarQ string - if o.Type != nil { - typeVarQ = *o.Type - } - if typeVarQ != "" { - qs.Set("type", typeVarQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStatsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStatsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStatsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStatsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStatsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStatsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/create_stick_rule.go b/operations/stick_rule/create_stick_rule.go deleted file mode 100644 index 53db16f9..00000000 --- a/operations/stick_rule/create_stick_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStickRuleHandlerFunc turns a function with the right signature into a create stick rule handler -type CreateStickRuleHandlerFunc func(CreateStickRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStickRuleHandlerFunc) Handle(params CreateStickRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStickRuleHandler interface for that can handle valid create stick rule params -type CreateStickRuleHandler interface { - Handle(CreateStickRuleParams, interface{}) middleware.Responder -} - -// NewCreateStickRule creates a new http.Handler for the create stick rule operation -func NewCreateStickRule(ctx *middleware.Context, handler CreateStickRuleHandler) *CreateStickRule { - return &CreateStickRule{Context: ctx, Handler: handler} -} - -/* - CreateStickRule swagger:route POST /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index} StickRule createStickRule - -# Add a new Stick Rule - -Adds a new Stick Rule of the specified type in the specified backend. -*/ -type CreateStickRule struct { - Context *middleware.Context - Handler CreateStickRuleHandler -} - -func (o *CreateStickRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStickRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/create_stick_rule_parameters.go b/operations/stick_rule/create_stick_rule_parameters.go deleted file mode 100644 index e24c1b04..00000000 --- a/operations/stick_rule/create_stick_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateStickRuleParams creates a new CreateStickRuleParams object -// with the default values initialized. -func NewCreateStickRuleParams() CreateStickRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateStickRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateStickRuleParams contains all the bound params for the create stick rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters createStickRule -type CreateStickRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.StickRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Stick Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStickRuleParams() beforehand. -func (o *CreateStickRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.StickRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateStickRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateStickRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateStickRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateStickRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateStickRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateStickRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/stick_rule/create_stick_rule_responses.go b/operations/stick_rule/create_stick_rule_responses.go deleted file mode 100644 index 62251213..00000000 --- a/operations/stick_rule/create_stick_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStickRuleCreatedCode is the HTTP code returned for type CreateStickRuleCreated -const CreateStickRuleCreatedCode int = 201 - -/* -CreateStickRuleCreated Stick Rule created - -swagger:response createStickRuleCreated -*/ -type CreateStickRuleCreated struct { - - /* - In: Body - */ - Payload *models.StickRule `json:"body,omitempty"` -} - -// NewCreateStickRuleCreated creates CreateStickRuleCreated with default headers values -func NewCreateStickRuleCreated() *CreateStickRuleCreated { - - return &CreateStickRuleCreated{} -} - -// WithPayload adds the payload to the create stick rule created response -func (o *CreateStickRuleCreated) WithPayload(payload *models.StickRule) *CreateStickRuleCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create stick rule created response -func (o *CreateStickRuleCreated) SetPayload(payload *models.StickRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStickRuleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStickRuleAcceptedCode is the HTTP code returned for type CreateStickRuleAccepted -const CreateStickRuleAcceptedCode int = 202 - -/* -CreateStickRuleAccepted Configuration change accepted and reload requested - -swagger:response createStickRuleAccepted -*/ -type CreateStickRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.StickRule `json:"body,omitempty"` -} - -// NewCreateStickRuleAccepted creates CreateStickRuleAccepted with default headers values -func NewCreateStickRuleAccepted() *CreateStickRuleAccepted { - - return &CreateStickRuleAccepted{} -} - -// WithReloadID adds the reloadId to the create stick rule accepted response -func (o *CreateStickRuleAccepted) WithReloadID(reloadID string) *CreateStickRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create stick rule accepted response -func (o *CreateStickRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create stick rule accepted response -func (o *CreateStickRuleAccepted) WithPayload(payload *models.StickRule) *CreateStickRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create stick rule accepted response -func (o *CreateStickRuleAccepted) SetPayload(payload *models.StickRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStickRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStickRuleBadRequestCode is the HTTP code returned for type CreateStickRuleBadRequest -const CreateStickRuleBadRequestCode int = 400 - -/* -CreateStickRuleBadRequest Bad request - -swagger:response createStickRuleBadRequest -*/ -type CreateStickRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStickRuleBadRequest creates CreateStickRuleBadRequest with default headers values -func NewCreateStickRuleBadRequest() *CreateStickRuleBadRequest { - - return &CreateStickRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create stick rule bad request response -func (o *CreateStickRuleBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStickRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create stick rule bad request response -func (o *CreateStickRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create stick rule bad request response -func (o *CreateStickRuleBadRequest) WithPayload(payload *models.Error) *CreateStickRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create stick rule bad request response -func (o *CreateStickRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStickRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStickRuleConflictCode is the HTTP code returned for type CreateStickRuleConflict -const CreateStickRuleConflictCode int = 409 - -/* -CreateStickRuleConflict The specified resource already exists - -swagger:response createStickRuleConflict -*/ -type CreateStickRuleConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStickRuleConflict creates CreateStickRuleConflict with default headers values -func NewCreateStickRuleConflict() *CreateStickRuleConflict { - - return &CreateStickRuleConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create stick rule conflict response -func (o *CreateStickRuleConflict) WithConfigurationVersion(configurationVersion string) *CreateStickRuleConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create stick rule conflict response -func (o *CreateStickRuleConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create stick rule conflict response -func (o *CreateStickRuleConflict) WithPayload(payload *models.Error) *CreateStickRuleConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create stick rule conflict response -func (o *CreateStickRuleConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStickRuleConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStickRuleDefault General Error - -swagger:response createStickRuleDefault -*/ -type CreateStickRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStickRuleDefault creates CreateStickRuleDefault with default headers values -func NewCreateStickRuleDefault(code int) *CreateStickRuleDefault { - if code <= 0 { - code = 500 - } - - return &CreateStickRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create stick rule default response -func (o *CreateStickRuleDefault) WithStatusCode(code int) *CreateStickRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create stick rule default response -func (o *CreateStickRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create stick rule default response -func (o *CreateStickRuleDefault) WithConfigurationVersion(configurationVersion string) *CreateStickRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create stick rule default response -func (o *CreateStickRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create stick rule default response -func (o *CreateStickRuleDefault) WithPayload(payload *models.Error) *CreateStickRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create stick rule default response -func (o *CreateStickRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStickRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/create_stick_rule_urlbuilder.go b/operations/stick_rule/create_stick_rule_urlbuilder.go deleted file mode 100644 index afe672ee..00000000 --- a/operations/stick_rule/create_stick_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateStickRuleURL generates an URL for the create stick rule operation -type CreateStickRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStickRuleURL) WithBasePath(bp string) *CreateStickRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStickRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStickRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateStickRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateStickRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStickRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStickRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStickRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStickRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStickRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStickRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/delete_stick_rule.go b/operations/stick_rule/delete_stick_rule.go deleted file mode 100644 index 8cbfb2bf..00000000 --- a/operations/stick_rule/delete_stick_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStickRuleHandlerFunc turns a function with the right signature into a delete stick rule handler -type DeleteStickRuleHandlerFunc func(DeleteStickRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStickRuleHandlerFunc) Handle(params DeleteStickRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStickRuleHandler interface for that can handle valid delete stick rule params -type DeleteStickRuleHandler interface { - Handle(DeleteStickRuleParams, interface{}) middleware.Responder -} - -// NewDeleteStickRule creates a new http.Handler for the delete stick rule operation -func NewDeleteStickRule(ctx *middleware.Context, handler DeleteStickRuleHandler) *DeleteStickRule { - return &DeleteStickRule{Context: ctx, Handler: handler} -} - -/* - DeleteStickRule swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index} StickRule deleteStickRule - -# Delete a Stick Rule - -Deletes a Stick Rule configuration by it's index from the specified backend. -*/ -type DeleteStickRule struct { - Context *middleware.Context - Handler DeleteStickRuleHandler -} - -func (o *DeleteStickRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStickRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/delete_stick_rule_parameters.go b/operations/stick_rule/delete_stick_rule_parameters.go deleted file mode 100644 index bff42efe..00000000 --- a/operations/stick_rule/delete_stick_rule_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteStickRuleParams creates a new DeleteStickRuleParams object -// with the default values initialized. -func NewDeleteStickRuleParams() DeleteStickRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteStickRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteStickRuleParams contains all the bound params for the delete stick rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteStickRule -type DeleteStickRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Stick Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStickRuleParams() beforehand. -func (o *DeleteStickRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteStickRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStickRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteStickRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteStickRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteStickRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteStickRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/stick_rule/delete_stick_rule_responses.go b/operations/stick_rule/delete_stick_rule_responses.go deleted file mode 100644 index 3d63ae0b..00000000 --- a/operations/stick_rule/delete_stick_rule_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStickRuleAcceptedCode is the HTTP code returned for type DeleteStickRuleAccepted -const DeleteStickRuleAcceptedCode int = 202 - -/* -DeleteStickRuleAccepted Configuration change accepted and reload requested - -swagger:response deleteStickRuleAccepted -*/ -type DeleteStickRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteStickRuleAccepted creates DeleteStickRuleAccepted with default headers values -func NewDeleteStickRuleAccepted() *DeleteStickRuleAccepted { - - return &DeleteStickRuleAccepted{} -} - -// WithReloadID adds the reloadId to the delete stick rule accepted response -func (o *DeleteStickRuleAccepted) WithReloadID(reloadID string) *DeleteStickRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete stick rule accepted response -func (o *DeleteStickRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteStickRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteStickRuleNoContentCode is the HTTP code returned for type DeleteStickRuleNoContent -const DeleteStickRuleNoContentCode int = 204 - -/* -DeleteStickRuleNoContent Stick Rule deleted - -swagger:response deleteStickRuleNoContent -*/ -type DeleteStickRuleNoContent struct { -} - -// NewDeleteStickRuleNoContent creates DeleteStickRuleNoContent with default headers values -func NewDeleteStickRuleNoContent() *DeleteStickRuleNoContent { - - return &DeleteStickRuleNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStickRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStickRuleNotFoundCode is the HTTP code returned for type DeleteStickRuleNotFound -const DeleteStickRuleNotFoundCode int = 404 - -/* -DeleteStickRuleNotFound The specified resource was not found - -swagger:response deleteStickRuleNotFound -*/ -type DeleteStickRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStickRuleNotFound creates DeleteStickRuleNotFound with default headers values -func NewDeleteStickRuleNotFound() *DeleteStickRuleNotFound { - - return &DeleteStickRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete stick rule not found response -func (o *DeleteStickRuleNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStickRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete stick rule not found response -func (o *DeleteStickRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete stick rule not found response -func (o *DeleteStickRuleNotFound) WithPayload(payload *models.Error) *DeleteStickRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete stick rule not found response -func (o *DeleteStickRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStickRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStickRuleDefault General Error - -swagger:response deleteStickRuleDefault -*/ -type DeleteStickRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStickRuleDefault creates DeleteStickRuleDefault with default headers values -func NewDeleteStickRuleDefault(code int) *DeleteStickRuleDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStickRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete stick rule default response -func (o *DeleteStickRuleDefault) WithStatusCode(code int) *DeleteStickRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete stick rule default response -func (o *DeleteStickRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete stick rule default response -func (o *DeleteStickRuleDefault) WithConfigurationVersion(configurationVersion string) *DeleteStickRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete stick rule default response -func (o *DeleteStickRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete stick rule default response -func (o *DeleteStickRuleDefault) WithPayload(payload *models.Error) *DeleteStickRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete stick rule default response -func (o *DeleteStickRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStickRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/delete_stick_rule_urlbuilder.go b/operations/stick_rule/delete_stick_rule_urlbuilder.go deleted file mode 100644 index 75582b5c..00000000 --- a/operations/stick_rule/delete_stick_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteStickRuleURL generates an URL for the delete stick rule operation -type DeleteStickRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStickRuleURL) WithBasePath(bp string) *DeleteStickRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStickRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStickRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteStickRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteStickRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStickRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStickRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStickRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStickRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStickRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStickRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/get_stick_rule.go b/operations/stick_rule/get_stick_rule.go deleted file mode 100644 index b11ebc47..00000000 --- a/operations/stick_rule/get_stick_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStickRuleHandlerFunc turns a function with the right signature into a get stick rule handler -type GetStickRuleHandlerFunc func(GetStickRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStickRuleHandlerFunc) Handle(params GetStickRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStickRuleHandler interface for that can handle valid get stick rule params -type GetStickRuleHandler interface { - Handle(GetStickRuleParams, interface{}) middleware.Responder -} - -// NewGetStickRule creates a new http.Handler for the get stick rule operation -func NewGetStickRule(ctx *middleware.Context, handler GetStickRuleHandler) *GetStickRule { - return &GetStickRule{Context: ctx, Handler: handler} -} - -/* - GetStickRule swagger:route GET /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index} StickRule getStickRule - -# Return one Stick Rule - -Returns one Stick Rule configuration by it's index in the specified backend. -*/ -type GetStickRule struct { - Context *middleware.Context - Handler GetStickRuleHandler -} - -func (o *GetStickRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStickRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/get_stick_rule_parameters.go b/operations/stick_rule/get_stick_rule_parameters.go deleted file mode 100644 index 952dfd31..00000000 --- a/operations/stick_rule/get_stick_rule_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetStickRuleParams creates a new GetStickRuleParams object -// -// There are no default values defined in the spec. -func NewGetStickRuleParams() GetStickRuleParams { - - return GetStickRuleParams{} -} - -// GetStickRuleParams contains all the bound params for the get stick rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStickRule -type GetStickRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Stick Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStickRuleParams() beforehand. -func (o *GetStickRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetStickRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetStickRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetStickRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/stick_rule/get_stick_rule_responses.go b/operations/stick_rule/get_stick_rule_responses.go deleted file mode 100644 index e2815da5..00000000 --- a/operations/stick_rule/get_stick_rule_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStickRuleOKCode is the HTTP code returned for type GetStickRuleOK -const GetStickRuleOKCode int = 200 - -/* -GetStickRuleOK Successful operation - -swagger:response getStickRuleOK -*/ -type GetStickRuleOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.StickRule `json:"body,omitempty"` -} - -// NewGetStickRuleOK creates GetStickRuleOK with default headers values -func NewGetStickRuleOK() *GetStickRuleOK { - - return &GetStickRuleOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get stick rule o k response -func (o *GetStickRuleOK) WithConfigurationVersion(configurationVersion string) *GetStickRuleOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick rule o k response -func (o *GetStickRuleOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick rule o k response -func (o *GetStickRuleOK) WithPayload(payload *models.StickRule) *GetStickRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick rule o k response -func (o *GetStickRuleOK) SetPayload(payload *models.StickRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetStickRuleNotFoundCode is the HTTP code returned for type GetStickRuleNotFound -const GetStickRuleNotFoundCode int = 404 - -/* -GetStickRuleNotFound The specified resource was not found - -swagger:response getStickRuleNotFound -*/ -type GetStickRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickRuleNotFound creates GetStickRuleNotFound with default headers values -func NewGetStickRuleNotFound() *GetStickRuleNotFound { - - return &GetStickRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get stick rule not found response -func (o *GetStickRuleNotFound) WithConfigurationVersion(configurationVersion string) *GetStickRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick rule not found response -func (o *GetStickRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick rule not found response -func (o *GetStickRuleNotFound) WithPayload(payload *models.Error) *GetStickRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick rule not found response -func (o *GetStickRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetStickRuleDefault General Error - -swagger:response getStickRuleDefault -*/ -type GetStickRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickRuleDefault creates GetStickRuleDefault with default headers values -func NewGetStickRuleDefault(code int) *GetStickRuleDefault { - if code <= 0 { - code = 500 - } - - return &GetStickRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stick rule default response -func (o *GetStickRuleDefault) WithStatusCode(code int) *GetStickRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stick rule default response -func (o *GetStickRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stick rule default response -func (o *GetStickRuleDefault) WithConfigurationVersion(configurationVersion string) *GetStickRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick rule default response -func (o *GetStickRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick rule default response -func (o *GetStickRuleDefault) WithPayload(payload *models.Error) *GetStickRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick rule default response -func (o *GetStickRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/get_stick_rule_urlbuilder.go b/operations/stick_rule/get_stick_rule_urlbuilder.go deleted file mode 100644 index 9e35ed36..00000000 --- a/operations/stick_rule/get_stick_rule_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetStickRuleURL generates an URL for the get stick rule operation -type GetStickRuleURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickRuleURL) WithBasePath(bp string) *GetStickRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStickRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetStickRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetStickRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStickRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStickRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStickRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStickRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStickRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStickRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/get_stick_rules.go b/operations/stick_rule/get_stick_rules.go deleted file mode 100644 index 0010a595..00000000 --- a/operations/stick_rule/get_stick_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStickRulesHandlerFunc turns a function with the right signature into a get stick rules handler -type GetStickRulesHandlerFunc func(GetStickRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStickRulesHandlerFunc) Handle(params GetStickRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStickRulesHandler interface for that can handle valid get stick rules params -type GetStickRulesHandler interface { - Handle(GetStickRulesParams, interface{}) middleware.Responder -} - -// NewGetStickRules creates a new http.Handler for the get stick rules operation -func NewGetStickRules(ctx *middleware.Context, handler GetStickRulesHandler) *GetStickRules { - return &GetStickRules{Context: ctx, Handler: handler} -} - -/* - GetStickRules swagger:route GET /services/haproxy/configuration/backends/{parent_name}/stick_rules StickRule getStickRules - -# Return an array of all Stick Rules - -Returns all Stick Rules that are configured in specified backend. -*/ -type GetStickRules struct { - Context *middleware.Context - Handler GetStickRulesHandler -} - -func (o *GetStickRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStickRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/get_stick_rules_parameters.go b/operations/stick_rule/get_stick_rules_parameters.go deleted file mode 100644 index 0e77aeb3..00000000 --- a/operations/stick_rule/get_stick_rules_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetStickRulesParams creates a new GetStickRulesParams object -// -// There are no default values defined in the spec. -func NewGetStickRulesParams() GetStickRulesParams { - - return GetStickRulesParams{} -} - -// GetStickRulesParams contains all the bound params for the get stick rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStickRules -type GetStickRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStickRulesParams() beforehand. -func (o *GetStickRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetStickRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetStickRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/stick_rule/get_stick_rules_responses.go b/operations/stick_rule/get_stick_rules_responses.go deleted file mode 100644 index 4458caa4..00000000 --- a/operations/stick_rule/get_stick_rules_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStickRulesOKCode is the HTTP code returned for type GetStickRulesOK -const GetStickRulesOKCode int = 200 - -/* -GetStickRulesOK Successful operation - -swagger:response getStickRulesOK -*/ -type GetStickRulesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.StickRules `json:"body,omitempty"` -} - -// NewGetStickRulesOK creates GetStickRulesOK with default headers values -func NewGetStickRulesOK() *GetStickRulesOK { - - return &GetStickRulesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get stick rules o k response -func (o *GetStickRulesOK) WithConfigurationVersion(configurationVersion string) *GetStickRulesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick rules o k response -func (o *GetStickRulesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick rules o k response -func (o *GetStickRulesOK) WithPayload(payload models.StickRules) *GetStickRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick rules o k response -func (o *GetStickRulesOK) SetPayload(payload models.StickRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.StickRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetStickRulesDefault General Error - -swagger:response getStickRulesDefault -*/ -type GetStickRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickRulesDefault creates GetStickRulesDefault with default headers values -func NewGetStickRulesDefault(code int) *GetStickRulesDefault { - if code <= 0 { - code = 500 - } - - return &GetStickRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stick rules default response -func (o *GetStickRulesDefault) WithStatusCode(code int) *GetStickRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stick rules default response -func (o *GetStickRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stick rules default response -func (o *GetStickRulesDefault) WithConfigurationVersion(configurationVersion string) *GetStickRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick rules default response -func (o *GetStickRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick rules default response -func (o *GetStickRulesDefault) WithPayload(payload *models.Error) *GetStickRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick rules default response -func (o *GetStickRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/get_stick_rules_urlbuilder.go b/operations/stick_rule/get_stick_rules_urlbuilder.go deleted file mode 100644 index bae1f9ed..00000000 --- a/operations/stick_rule/get_stick_rules_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetStickRulesURL generates an URL for the get stick rules operation -type GetStickRulesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickRulesURL) WithBasePath(bp string) *GetStickRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStickRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetStickRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStickRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStickRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStickRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStickRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStickRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStickRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/replace_stick_rule.go b/operations/stick_rule/replace_stick_rule.go deleted file mode 100644 index 2f2df077..00000000 --- a/operations/stick_rule/replace_stick_rule.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStickRuleHandlerFunc turns a function with the right signature into a replace stick rule handler -type ReplaceStickRuleHandlerFunc func(ReplaceStickRuleParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStickRuleHandlerFunc) Handle(params ReplaceStickRuleParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStickRuleHandler interface for that can handle valid replace stick rule params -type ReplaceStickRuleHandler interface { - Handle(ReplaceStickRuleParams, interface{}) middleware.Responder -} - -// NewReplaceStickRule creates a new http.Handler for the replace stick rule operation -func NewReplaceStickRule(ctx *middleware.Context, handler ReplaceStickRuleHandler) *ReplaceStickRule { - return &ReplaceStickRule{Context: ctx, Handler: handler} -} - -/* - ReplaceStickRule swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index} StickRule replaceStickRule - -# Replace a Stick Rule - -Replaces a Stick Rule configuration by it's index in the specified backend. -*/ -type ReplaceStickRule struct { - Context *middleware.Context - Handler ReplaceStickRuleHandler -} - -func (o *ReplaceStickRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStickRuleParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/replace_stick_rule_parameters.go b/operations/stick_rule/replace_stick_rule_parameters.go deleted file mode 100644 index 4bab91a9..00000000 --- a/operations/stick_rule/replace_stick_rule_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceStickRuleParams creates a new ReplaceStickRuleParams object -// with the default values initialized. -func NewReplaceStickRuleParams() ReplaceStickRuleParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceStickRuleParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceStickRuleParams contains all the bound params for the replace stick rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStickRule -type ReplaceStickRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.StickRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Stick Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStickRuleParams() beforehand. -func (o *ReplaceStickRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.StickRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStickRuleParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStickRuleParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceStickRuleParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceStickRuleParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceStickRuleParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceStickRuleParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/stick_rule/replace_stick_rule_responses.go b/operations/stick_rule/replace_stick_rule_responses.go deleted file mode 100644 index ff3a2140..00000000 --- a/operations/stick_rule/replace_stick_rule_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStickRuleOKCode is the HTTP code returned for type ReplaceStickRuleOK -const ReplaceStickRuleOKCode int = 200 - -/* -ReplaceStickRuleOK Stick Rule replaced - -swagger:response replaceStickRuleOK -*/ -type ReplaceStickRuleOK struct { - - /* - In: Body - */ - Payload *models.StickRule `json:"body,omitempty"` -} - -// NewReplaceStickRuleOK creates ReplaceStickRuleOK with default headers values -func NewReplaceStickRuleOK() *ReplaceStickRuleOK { - - return &ReplaceStickRuleOK{} -} - -// WithPayload adds the payload to the replace stick rule o k response -func (o *ReplaceStickRuleOK) WithPayload(payload *models.StickRule) *ReplaceStickRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rule o k response -func (o *ReplaceStickRuleOK) SetPayload(payload *models.StickRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStickRuleAcceptedCode is the HTTP code returned for type ReplaceStickRuleAccepted -const ReplaceStickRuleAcceptedCode int = 202 - -/* -ReplaceStickRuleAccepted Configuration change accepted and reload requested - -swagger:response replaceStickRuleAccepted -*/ -type ReplaceStickRuleAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.StickRule `json:"body,omitempty"` -} - -// NewReplaceStickRuleAccepted creates ReplaceStickRuleAccepted with default headers values -func NewReplaceStickRuleAccepted() *ReplaceStickRuleAccepted { - - return &ReplaceStickRuleAccepted{} -} - -// WithReloadID adds the reloadId to the replace stick rule accepted response -func (o *ReplaceStickRuleAccepted) WithReloadID(reloadID string) *ReplaceStickRuleAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace stick rule accepted response -func (o *ReplaceStickRuleAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace stick rule accepted response -func (o *ReplaceStickRuleAccepted) WithPayload(payload *models.StickRule) *ReplaceStickRuleAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rule accepted response -func (o *ReplaceStickRuleAccepted) SetPayload(payload *models.StickRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRuleAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStickRuleBadRequestCode is the HTTP code returned for type ReplaceStickRuleBadRequest -const ReplaceStickRuleBadRequestCode int = 400 - -/* -ReplaceStickRuleBadRequest Bad request - -swagger:response replaceStickRuleBadRequest -*/ -type ReplaceStickRuleBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStickRuleBadRequest creates ReplaceStickRuleBadRequest with default headers values -func NewReplaceStickRuleBadRequest() *ReplaceStickRuleBadRequest { - - return &ReplaceStickRuleBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace stick rule bad request response -func (o *ReplaceStickRuleBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStickRuleBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace stick rule bad request response -func (o *ReplaceStickRuleBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace stick rule bad request response -func (o *ReplaceStickRuleBadRequest) WithPayload(payload *models.Error) *ReplaceStickRuleBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rule bad request response -func (o *ReplaceStickRuleBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRuleBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStickRuleNotFoundCode is the HTTP code returned for type ReplaceStickRuleNotFound -const ReplaceStickRuleNotFoundCode int = 404 - -/* -ReplaceStickRuleNotFound The specified resource was not found - -swagger:response replaceStickRuleNotFound -*/ -type ReplaceStickRuleNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStickRuleNotFound creates ReplaceStickRuleNotFound with default headers values -func NewReplaceStickRuleNotFound() *ReplaceStickRuleNotFound { - - return &ReplaceStickRuleNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace stick rule not found response -func (o *ReplaceStickRuleNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceStickRuleNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace stick rule not found response -func (o *ReplaceStickRuleNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace stick rule not found response -func (o *ReplaceStickRuleNotFound) WithPayload(payload *models.Error) *ReplaceStickRuleNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rule not found response -func (o *ReplaceStickRuleNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRuleNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStickRuleDefault General Error - -swagger:response replaceStickRuleDefault -*/ -type ReplaceStickRuleDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStickRuleDefault creates ReplaceStickRuleDefault with default headers values -func NewReplaceStickRuleDefault(code int) *ReplaceStickRuleDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStickRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace stick rule default response -func (o *ReplaceStickRuleDefault) WithStatusCode(code int) *ReplaceStickRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace stick rule default response -func (o *ReplaceStickRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace stick rule default response -func (o *ReplaceStickRuleDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStickRuleDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace stick rule default response -func (o *ReplaceStickRuleDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace stick rule default response -func (o *ReplaceStickRuleDefault) WithPayload(payload *models.Error) *ReplaceStickRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rule default response -func (o *ReplaceStickRuleDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRuleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/replace_stick_rule_urlbuilder.go b/operations/stick_rule/replace_stick_rule_urlbuilder.go deleted file mode 100644 index fc7ecd37..00000000 --- a/operations/stick_rule/replace_stick_rule_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStickRuleURL generates an URL for the replace stick rule operation -type ReplaceStickRuleURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStickRuleURL) WithBasePath(bp string) *ReplaceStickRuleURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStickRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStickRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceStickRuleURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceStickRuleURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStickRuleURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStickRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStickRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStickRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStickRuleURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStickRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_rule/replace_stick_rules.go b/operations/stick_rule/replace_stick_rules.go deleted file mode 100644 index 9f94ca19..00000000 --- a/operations/stick_rule/replace_stick_rules.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStickRulesHandlerFunc turns a function with the right signature into a replace stick rules handler -type ReplaceStickRulesHandlerFunc func(ReplaceStickRulesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStickRulesHandlerFunc) Handle(params ReplaceStickRulesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStickRulesHandler interface for that can handle valid replace stick rules params -type ReplaceStickRulesHandler interface { - Handle(ReplaceStickRulesParams, interface{}) middleware.Responder -} - -// NewReplaceStickRules creates a new http.Handler for the replace stick rules operation -func NewReplaceStickRules(ctx *middleware.Context, handler ReplaceStickRulesHandler) *ReplaceStickRules { - return &ReplaceStickRules{Context: ctx, Handler: handler} -} - -/* - ReplaceStickRules swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/stick_rules StickRule replaceStickRules - -# Replace a Stick Rule list - -Replaces a whole list of Stick Rules with the list given in parameter -*/ -type ReplaceStickRules struct { - Context *middleware.Context - Handler ReplaceStickRulesHandler -} - -func (o *ReplaceStickRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStickRulesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_rule/replace_stick_rules_parameters.go b/operations/stick_rule/replace_stick_rules_parameters.go deleted file mode 100644 index 58ba13f6..00000000 --- a/operations/stick_rule/replace_stick_rules_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceStickRulesParams creates a new ReplaceStickRulesParams object -// with the default values initialized. -func NewReplaceStickRulesParams() ReplaceStickRulesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceStickRulesParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceStickRulesParams contains all the bound params for the replace stick rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStickRules -type ReplaceStickRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.StickRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStickRulesParams() beforehand. -func (o *ReplaceStickRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.StickRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStickRulesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStickRulesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceStickRulesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceStickRulesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceStickRulesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/stick_rule/replace_stick_rules_responses.go b/operations/stick_rule/replace_stick_rules_responses.go deleted file mode 100644 index a79fee69..00000000 --- a/operations/stick_rule/replace_stick_rules_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStickRulesOKCode is the HTTP code returned for type ReplaceStickRulesOK -const ReplaceStickRulesOKCode int = 200 - -/* -ReplaceStickRulesOK All Stick Rule lines replaced - -swagger:response replaceStickRulesOK -*/ -type ReplaceStickRulesOK struct { - - /* - In: Body - */ - Payload models.StickRules `json:"body,omitempty"` -} - -// NewReplaceStickRulesOK creates ReplaceStickRulesOK with default headers values -func NewReplaceStickRulesOK() *ReplaceStickRulesOK { - - return &ReplaceStickRulesOK{} -} - -// WithPayload adds the payload to the replace stick rules o k response -func (o *ReplaceStickRulesOK) WithPayload(payload models.StickRules) *ReplaceStickRulesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rules o k response -func (o *ReplaceStickRulesOK) SetPayload(payload models.StickRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRulesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.StickRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceStickRulesAcceptedCode is the HTTP code returned for type ReplaceStickRulesAccepted -const ReplaceStickRulesAcceptedCode int = 202 - -/* -ReplaceStickRulesAccepted Configuration change accepted and reload requested - -swagger:response replaceStickRulesAccepted -*/ -type ReplaceStickRulesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.StickRules `json:"body,omitempty"` -} - -// NewReplaceStickRulesAccepted creates ReplaceStickRulesAccepted with default headers values -func NewReplaceStickRulesAccepted() *ReplaceStickRulesAccepted { - - return &ReplaceStickRulesAccepted{} -} - -// WithReloadID adds the reloadId to the replace stick rules accepted response -func (o *ReplaceStickRulesAccepted) WithReloadID(reloadID string) *ReplaceStickRulesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace stick rules accepted response -func (o *ReplaceStickRulesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace stick rules accepted response -func (o *ReplaceStickRulesAccepted) WithPayload(payload models.StickRules) *ReplaceStickRulesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rules accepted response -func (o *ReplaceStickRulesAccepted) SetPayload(payload models.StickRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRulesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.StickRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceStickRulesBadRequestCode is the HTTP code returned for type ReplaceStickRulesBadRequest -const ReplaceStickRulesBadRequestCode int = 400 - -/* -ReplaceStickRulesBadRequest Bad request - -swagger:response replaceStickRulesBadRequest -*/ -type ReplaceStickRulesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStickRulesBadRequest creates ReplaceStickRulesBadRequest with default headers values -func NewReplaceStickRulesBadRequest() *ReplaceStickRulesBadRequest { - - return &ReplaceStickRulesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace stick rules bad request response -func (o *ReplaceStickRulesBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStickRulesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace stick rules bad request response -func (o *ReplaceStickRulesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace stick rules bad request response -func (o *ReplaceStickRulesBadRequest) WithPayload(payload *models.Error) *ReplaceStickRulesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rules bad request response -func (o *ReplaceStickRulesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRulesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStickRulesDefault General Error - -swagger:response replaceStickRulesDefault -*/ -type ReplaceStickRulesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStickRulesDefault creates ReplaceStickRulesDefault with default headers values -func NewReplaceStickRulesDefault(code int) *ReplaceStickRulesDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStickRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace stick rules default response -func (o *ReplaceStickRulesDefault) WithStatusCode(code int) *ReplaceStickRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace stick rules default response -func (o *ReplaceStickRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace stick rules default response -func (o *ReplaceStickRulesDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStickRulesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace stick rules default response -func (o *ReplaceStickRulesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace stick rules default response -func (o *ReplaceStickRulesDefault) WithPayload(payload *models.Error) *ReplaceStickRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace stick rules default response -func (o *ReplaceStickRulesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStickRulesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_rule/replace_stick_rules_urlbuilder.go b/operations/stick_rule/replace_stick_rules_urlbuilder.go deleted file mode 100644 index c03b9b82..00000000 --- a/operations/stick_rule/replace_stick_rules_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStickRulesURL generates an URL for the replace stick rules operation -type ReplaceStickRulesURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStickRulesURL) WithBasePath(bp string) *ReplaceStickRulesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStickRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStickRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/stick_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceStickRulesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStickRulesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStickRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStickRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStickRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStickRulesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStickRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_table/get_stick_table.go b/operations/stick_table/get_stick_table.go deleted file mode 100644 index 9efdd169..00000000 --- a/operations/stick_table/get_stick_table.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStickTableHandlerFunc turns a function with the right signature into a get stick table handler -type GetStickTableHandlerFunc func(GetStickTableParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStickTableHandlerFunc) Handle(params GetStickTableParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStickTableHandler interface for that can handle valid get stick table params -type GetStickTableHandler interface { - Handle(GetStickTableParams, interface{}) middleware.Responder -} - -// NewGetStickTable creates a new http.Handler for the get stick table operation -func NewGetStickTable(ctx *middleware.Context, handler GetStickTableHandler) *GetStickTable { - return &GetStickTable{Context: ctx, Handler: handler} -} - -/* - GetStickTable swagger:route GET /services/haproxy/runtime/stick_tables/{name} StickTable getStickTable - -# Return Stick Table - -Returns one stick table from runtime. -*/ -type GetStickTable struct { - Context *middleware.Context - Handler GetStickTableHandler -} - -func (o *GetStickTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStickTableParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_table/get_stick_table_entries.go b/operations/stick_table/get_stick_table_entries.go deleted file mode 100644 index 5d96d830..00000000 --- a/operations/stick_table/get_stick_table_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStickTableEntriesHandlerFunc turns a function with the right signature into a get stick table entries handler -type GetStickTableEntriesHandlerFunc func(GetStickTableEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStickTableEntriesHandlerFunc) Handle(params GetStickTableEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStickTableEntriesHandler interface for that can handle valid get stick table entries params -type GetStickTableEntriesHandler interface { - Handle(GetStickTableEntriesParams, interface{}) middleware.Responder -} - -// NewGetStickTableEntries creates a new http.Handler for the get stick table entries operation -func NewGetStickTableEntries(ctx *middleware.Context, handler GetStickTableEntriesHandler) *GetStickTableEntries { - return &GetStickTableEntries{Context: ctx, Handler: handler} -} - -/* - GetStickTableEntries swagger:route GET /services/haproxy/runtime/stick_tables/{parent_name}/entries StickTable getStickTableEntries - -# Return Stick Table Entries - -Returns an array of all entries in a given stick tables. -*/ -type GetStickTableEntries struct { - Context *middleware.Context - Handler GetStickTableEntriesHandler -} - -func (o *GetStickTableEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStickTableEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_table/get_stick_table_entries_parameters.go b/operations/stick_table/get_stick_table_entries_parameters.go deleted file mode 100644 index f214233f..00000000 --- a/operations/stick_table/get_stick_table_entries_parameters.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetStickTableEntriesParams creates a new GetStickTableEntriesParams object -// -// There are no default values defined in the spec. -func NewGetStickTableEntriesParams() GetStickTableEntriesParams { - - return GetStickTableEntriesParams{} -} - -// GetStickTableEntriesParams contains all the bound params for the get stick table entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStickTableEntries -type GetStickTableEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Max number of entries to be returned for pagination - In: query - */ - Count *int64 - /*A list of filters in format data. separated by comma - In: query - */ - Filter *string - /*Key which we want the entries for - In: query - */ - Key *string - /*Offset which indicates how many items we skip in pagination - In: query - */ - Offset *int64 - /*Parent name - Required: true - In: path - */ - ParentName string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStickTableEntriesParams() beforehand. -func (o *GetStickTableEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCount, qhkCount, _ := qs.GetOK("count") - if err := o.bindCount(qCount, qhkCount, route.Formats); err != nil { - res = append(res, err) - } - - qFilter, qhkFilter, _ := qs.GetOK("filter") - if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { - res = append(res, err) - } - - qKey, qhkKey, _ := qs.GetOK("key") - if err := o.bindKey(qKey, qhkKey, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCount binds and validates parameter Count from query. -func (o *GetStickTableEntriesParams) bindCount(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("count", "query", "int64", raw) - } - o.Count = &value - - return nil -} - -// bindFilter binds and validates parameter Filter from query. -func (o *GetStickTableEntriesParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Filter = &raw - - return nil -} - -// bindKey binds and validates parameter Key from query. -func (o *GetStickTableEntriesParams) bindKey(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Key = &raw - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *GetStickTableEntriesParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int64", raw) - } - o.Offset = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetStickTableEntriesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/stick_table/get_stick_table_entries_responses.go b/operations/stick_table/get_stick_table_entries_responses.go deleted file mode 100644 index a2f9aa6f..00000000 --- a/operations/stick_table/get_stick_table_entries_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStickTableEntriesOKCode is the HTTP code returned for type GetStickTableEntriesOK -const GetStickTableEntriesOKCode int = 200 - -/* -GetStickTableEntriesOK Successful operation - -swagger:response getStickTableEntriesOK -*/ -type GetStickTableEntriesOK struct { - - /* - In: Body - */ - Payload models.StickTableEntries `json:"body,omitempty"` -} - -// NewGetStickTableEntriesOK creates GetStickTableEntriesOK with default headers values -func NewGetStickTableEntriesOK() *GetStickTableEntriesOK { - - return &GetStickTableEntriesOK{} -} - -// WithPayload adds the payload to the get stick table entries o k response -func (o *GetStickTableEntriesOK) WithPayload(payload models.StickTableEntries) *GetStickTableEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick table entries o k response -func (o *GetStickTableEntriesOK) SetPayload(payload models.StickTableEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTableEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.StickTableEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetStickTableEntriesDefault General Error - -swagger:response getStickTableEntriesDefault -*/ -type GetStickTableEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickTableEntriesDefault creates GetStickTableEntriesDefault with default headers values -func NewGetStickTableEntriesDefault(code int) *GetStickTableEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetStickTableEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stick table entries default response -func (o *GetStickTableEntriesDefault) WithStatusCode(code int) *GetStickTableEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stick table entries default response -func (o *GetStickTableEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stick table entries default response -func (o *GetStickTableEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetStickTableEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick table entries default response -func (o *GetStickTableEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick table entries default response -func (o *GetStickTableEntriesDefault) WithPayload(payload *models.Error) *GetStickTableEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick table entries default response -func (o *GetStickTableEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTableEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_table/get_stick_table_entries_urlbuilder.go b/operations/stick_table/get_stick_table_entries_urlbuilder.go deleted file mode 100644 index 1c9f5b5b..00000000 --- a/operations/stick_table/get_stick_table_entries_urlbuilder.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetStickTableEntriesURL generates an URL for the get stick table entries operation -type GetStickTableEntriesURL struct { - ParentName string - - Count *int64 - Filter *string - Key *string - Offset *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTableEntriesURL) WithBasePath(bp string) *GetStickTableEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTableEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStickTableEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/stick_tables/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetStickTableEntriesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var countQ string - if o.Count != nil { - countQ = swag.FormatInt64(*o.Count) - } - if countQ != "" { - qs.Set("count", countQ) - } - - var filterQ string - if o.Filter != nil { - filterQ = *o.Filter - } - if filterQ != "" { - qs.Set("filter", filterQ) - } - - var keyQ string - if o.Key != nil { - keyQ = *o.Key - } - if keyQ != "" { - qs.Set("key", keyQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt64(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStickTableEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStickTableEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStickTableEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStickTableEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStickTableEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStickTableEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_table/get_stick_table_parameters.go b/operations/stick_table/get_stick_table_parameters.go deleted file mode 100644 index dc7b61e4..00000000 --- a/operations/stick_table/get_stick_table_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetStickTableParams creates a new GetStickTableParams object -// -// There are no default values defined in the spec. -func NewGetStickTableParams() GetStickTableParams { - - return GetStickTableParams{} -} - -// GetStickTableParams contains all the bound params for the get stick table operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStickTable -type GetStickTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Stick table name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStickTableParams() beforehand. -func (o *GetStickTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetStickTableParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/stick_table/get_stick_table_responses.go b/operations/stick_table/get_stick_table_responses.go deleted file mode 100644 index 789c7db1..00000000 --- a/operations/stick_table/get_stick_table_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStickTableOKCode is the HTTP code returned for type GetStickTableOK -const GetStickTableOKCode int = 200 - -/* -GetStickTableOK Successful operation - -swagger:response getStickTableOK -*/ -type GetStickTableOK struct { - - /* - In: Body - */ - Payload *models.StickTable `json:"body,omitempty"` -} - -// NewGetStickTableOK creates GetStickTableOK with default headers values -func NewGetStickTableOK() *GetStickTableOK { - - return &GetStickTableOK{} -} - -// WithPayload adds the payload to the get stick table o k response -func (o *GetStickTableOK) WithPayload(payload *models.StickTable) *GetStickTableOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick table o k response -func (o *GetStickTableOK) SetPayload(payload *models.StickTable) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTableOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetStickTableNotFoundCode is the HTTP code returned for type GetStickTableNotFound -const GetStickTableNotFoundCode int = 404 - -/* -GetStickTableNotFound The specified resource was not found - -swagger:response getStickTableNotFound -*/ -type GetStickTableNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickTableNotFound creates GetStickTableNotFound with default headers values -func NewGetStickTableNotFound() *GetStickTableNotFound { - - return &GetStickTableNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get stick table not found response -func (o *GetStickTableNotFound) WithConfigurationVersion(configurationVersion string) *GetStickTableNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick table not found response -func (o *GetStickTableNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick table not found response -func (o *GetStickTableNotFound) WithPayload(payload *models.Error) *GetStickTableNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick table not found response -func (o *GetStickTableNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetStickTableDefault General Error - -swagger:response getStickTableDefault -*/ -type GetStickTableDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickTableDefault creates GetStickTableDefault with default headers values -func NewGetStickTableDefault(code int) *GetStickTableDefault { - if code <= 0 { - code = 500 - } - - return &GetStickTableDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stick table default response -func (o *GetStickTableDefault) WithStatusCode(code int) *GetStickTableDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stick table default response -func (o *GetStickTableDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stick table default response -func (o *GetStickTableDefault) WithConfigurationVersion(configurationVersion string) *GetStickTableDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick table default response -func (o *GetStickTableDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick table default response -func (o *GetStickTableDefault) WithPayload(payload *models.Error) *GetStickTableDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick table default response -func (o *GetStickTableDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTableDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_table/get_stick_table_urlbuilder.go b/operations/stick_table/get_stick_table_urlbuilder.go deleted file mode 100644 index 7118ea1b..00000000 --- a/operations/stick_table/get_stick_table_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetStickTableURL generates an URL for the get stick table operation -type GetStickTableURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTableURL) WithBasePath(bp string) *GetStickTableURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTableURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStickTableURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/stick_tables/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetStickTableURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStickTableURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStickTableURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStickTableURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStickTableURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStickTableURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStickTableURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_table/get_stick_tables.go b/operations/stick_table/get_stick_tables.go deleted file mode 100644 index 6b6507aa..00000000 --- a/operations/stick_table/get_stick_tables.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStickTablesHandlerFunc turns a function with the right signature into a get stick tables handler -type GetStickTablesHandlerFunc func(GetStickTablesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStickTablesHandlerFunc) Handle(params GetStickTablesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStickTablesHandler interface for that can handle valid get stick tables params -type GetStickTablesHandler interface { - Handle(GetStickTablesParams, interface{}) middleware.Responder -} - -// NewGetStickTables creates a new http.Handler for the get stick tables operation -func NewGetStickTables(ctx *middleware.Context, handler GetStickTablesHandler) *GetStickTables { - return &GetStickTables{Context: ctx, Handler: handler} -} - -/* - GetStickTables swagger:route GET /services/haproxy/runtime/stick_tables StickTable getStickTables - -# Return Stick Tables - -Returns an array of all stick tables. -*/ -type GetStickTables struct { - Context *middleware.Context - Handler GetStickTablesHandler -} - -func (o *GetStickTables) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStickTablesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/stick_table/get_stick_tables_parameters.go b/operations/stick_table/get_stick_tables_parameters.go deleted file mode 100644 index 8f48c92a..00000000 --- a/operations/stick_table/get_stick_tables_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetStickTablesParams creates a new GetStickTablesParams object -// -// There are no default values defined in the spec. -func NewGetStickTablesParams() GetStickTablesParams { - - return GetStickTablesParams{} -} - -// GetStickTablesParams contains all the bound params for the get stick tables operation -// typically these are obtained from a http.Request -// -// swagger:parameters getStickTables -type GetStickTablesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStickTablesParams() beforehand. -func (o *GetStickTablesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/stick_table/get_stick_tables_responses.go b/operations/stick_table/get_stick_tables_responses.go deleted file mode 100644 index 19b87552..00000000 --- a/operations/stick_table/get_stick_tables_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStickTablesOKCode is the HTTP code returned for type GetStickTablesOK -const GetStickTablesOKCode int = 200 - -/* -GetStickTablesOK Successful operation - -swagger:response getStickTablesOK -*/ -type GetStickTablesOK struct { - - /* - In: Body - */ - Payload models.StickTables `json:"body,omitempty"` -} - -// NewGetStickTablesOK creates GetStickTablesOK with default headers values -func NewGetStickTablesOK() *GetStickTablesOK { - - return &GetStickTablesOK{} -} - -// WithPayload adds the payload to the get stick tables o k response -func (o *GetStickTablesOK) WithPayload(payload models.StickTables) *GetStickTablesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick tables o k response -func (o *GetStickTablesOK) SetPayload(payload models.StickTables) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTablesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.StickTables{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetStickTablesDefault General Error - -swagger:response getStickTablesDefault -*/ -type GetStickTablesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStickTablesDefault creates GetStickTablesDefault with default headers values -func NewGetStickTablesDefault(code int) *GetStickTablesDefault { - if code <= 0 { - code = 500 - } - - return &GetStickTablesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get stick tables default response -func (o *GetStickTablesDefault) WithStatusCode(code int) *GetStickTablesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get stick tables default response -func (o *GetStickTablesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get stick tables default response -func (o *GetStickTablesDefault) WithConfigurationVersion(configurationVersion string) *GetStickTablesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get stick tables default response -func (o *GetStickTablesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get stick tables default response -func (o *GetStickTablesDefault) WithPayload(payload *models.Error) *GetStickTablesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get stick tables default response -func (o *GetStickTablesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStickTablesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_table/get_stick_tables_urlbuilder.go b/operations/stick_table/get_stick_tables_urlbuilder.go deleted file mode 100644 index 0e8b0d7e..00000000 --- a/operations/stick_table/get_stick_tables_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetStickTablesURL generates an URL for the get stick tables operation -type GetStickTablesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTablesURL) WithBasePath(bp string) *GetStickTablesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStickTablesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStickTablesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/stick_tables" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStickTablesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStickTablesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStickTablesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStickTablesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStickTablesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStickTablesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/stick_table/set_stick_table_entries.go b/operations/stick_table/set_stick_table_entries.go deleted file mode 100644 index 71d0a195..00000000 --- a/operations/stick_table/set_stick_table_entries.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// SetStickTableEntriesHandlerFunc turns a function with the right signature into a set stick table entries handler -type SetStickTableEntriesHandlerFunc func(SetStickTableEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetStickTableEntriesHandlerFunc) Handle(params SetStickTableEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// SetStickTableEntriesHandler interface for that can handle valid set stick table entries params -type SetStickTableEntriesHandler interface { - Handle(SetStickTableEntriesParams, interface{}) middleware.Responder -} - -// NewSetStickTableEntries creates a new http.Handler for the set stick table entries operation -func NewSetStickTableEntries(ctx *middleware.Context, handler SetStickTableEntriesHandler) *SetStickTableEntries { - return &SetStickTableEntries{Context: ctx, Handler: handler} -} - -/* - SetStickTableEntries swagger:route POST /services/haproxy/runtime/stick_tables/{parent_name}/entries StickTable setStickTableEntries - -# Set Entry to Stick Table - -Create or update a stick-table entry in the table. -*/ -type SetStickTableEntries struct { - Context *middleware.Context - Handler SetStickTableEntriesHandler -} - -func (o *SetStickTableEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetStickTableEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// SetStickTableEntriesBody set stick table entries body -// -// swagger:model SetStickTableEntriesBody -type SetStickTableEntriesBody struct { - - // data type - // Required: true - DataType *models.StickTableEntry `json:"data_type"` - - // key - // Required: true - Key *string `json:"key"` -} - -// Validate validates this set stick table entries body -func (o *SetStickTableEntriesBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDataType(formats); err != nil { - res = append(res, err) - } - - if err := o.validateKey(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *SetStickTableEntriesBody) validateDataType(formats strfmt.Registry) error { - - if err := validate.Required("stick_table_entry"+"."+"data_type", "body", o.DataType); err != nil { - return err - } - - if o.DataType != nil { - if err := o.DataType.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("stick_table_entry" + "." + "data_type") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("stick_table_entry" + "." + "data_type") - } - return err - } - } - - return nil -} - -func (o *SetStickTableEntriesBody) validateKey(formats strfmt.Registry) error { - - if err := validate.Required("stick_table_entry"+"."+"key", "body", o.Key); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this set stick table entries body based on the context it is used -func (o *SetStickTableEntriesBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDataType(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *SetStickTableEntriesBody) contextValidateDataType(ctx context.Context, formats strfmt.Registry) error { - - if o.DataType != nil { - - if err := o.DataType.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("stick_table_entry" + "." + "data_type") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("stick_table_entry" + "." + "data_type") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *SetStickTableEntriesBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *SetStickTableEntriesBody) UnmarshalBinary(b []byte) error { - var res SetStickTableEntriesBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operations/stick_table/set_stick_table_entries_parameters.go b/operations/stick_table/set_stick_table_entries_parameters.go deleted file mode 100644 index f6067e32..00000000 --- a/operations/stick_table/set_stick_table_entries_parameters.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewSetStickTableEntriesParams creates a new SetStickTableEntriesParams object -// -// There are no default values defined in the spec. -func NewSetStickTableEntriesParams() SetStickTableEntriesParams { - - return SetStickTableEntriesParams{} -} - -// SetStickTableEntriesParams contains all the bound params for the set stick table entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters setStickTableEntries -type SetStickTableEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*Stick table entry - In: body - */ - StickTableEntry SetStickTableEntriesBody -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSetStickTableEntriesParams() beforehand. -func (o *SetStickTableEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body SetStickTableEntriesBody - if err := route.Consumer.Consume(r.Body, &body); err != nil { - res = append(res, errors.NewParseError("stickTableEntry", "body", "", err)) - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.StickTableEntry = body - } - } - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *SetStickTableEntriesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} diff --git a/operations/stick_table/set_stick_table_entries_responses.go b/operations/stick_table/set_stick_table_entries_responses.go deleted file mode 100644 index 8a16c9b7..00000000 --- a/operations/stick_table/set_stick_table_entries_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// SetStickTableEntriesNoContentCode is the HTTP code returned for type SetStickTableEntriesNoContent -const SetStickTableEntriesNoContentCode int = 204 - -/* -SetStickTableEntriesNoContent Successful operation - -swagger:response setStickTableEntriesNoContent -*/ -type SetStickTableEntriesNoContent struct { -} - -// NewSetStickTableEntriesNoContent creates SetStickTableEntriesNoContent with default headers values -func NewSetStickTableEntriesNoContent() *SetStickTableEntriesNoContent { - - return &SetStickTableEntriesNoContent{} -} - -// WriteResponse to the client -func (o *SetStickTableEntriesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -SetStickTableEntriesDefault General Error - -swagger:response setStickTableEntriesDefault -*/ -type SetStickTableEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewSetStickTableEntriesDefault creates SetStickTableEntriesDefault with default headers values -func NewSetStickTableEntriesDefault(code int) *SetStickTableEntriesDefault { - if code <= 0 { - code = 500 - } - - return &SetStickTableEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set stick table entries default response -func (o *SetStickTableEntriesDefault) WithStatusCode(code int) *SetStickTableEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set stick table entries default response -func (o *SetStickTableEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the set stick table entries default response -func (o *SetStickTableEntriesDefault) WithConfigurationVersion(configurationVersion string) *SetStickTableEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the set stick table entries default response -func (o *SetStickTableEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the set stick table entries default response -func (o *SetStickTableEntriesDefault) WithPayload(payload *models.Error) *SetStickTableEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set stick table entries default response -func (o *SetStickTableEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetStickTableEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/stick_table/set_stick_table_entries_urlbuilder.go b/operations/stick_table/set_stick_table_entries_urlbuilder.go deleted file mode 100644 index e5add852..00000000 --- a/operations/stick_table/set_stick_table_entries_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stick_table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// SetStickTableEntriesURL generates an URL for the set stick table entries operation -type SetStickTableEntriesURL struct { - ParentName string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetStickTableEntriesURL) WithBasePath(bp string) *SetStickTableEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SetStickTableEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetStickTableEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/runtime/stick_tables/{parent_name}/entries" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on SetStickTableEntriesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetStickTableEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SetStickTableEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetStickTableEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetStickTableEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetStickTableEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SetStickTableEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/create_storage_general_file.go b/operations/storage/create_storage_general_file.go deleted file mode 100644 index 16c07bb9..00000000 --- a/operations/storage/create_storage_general_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageGeneralFileHandlerFunc turns a function with the right signature into a create storage general file handler -type CreateStorageGeneralFileHandlerFunc func(CreateStorageGeneralFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStorageGeneralFileHandlerFunc) Handle(params CreateStorageGeneralFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStorageGeneralFileHandler interface for that can handle valid create storage general file params -type CreateStorageGeneralFileHandler interface { - Handle(CreateStorageGeneralFileParams, interface{}) middleware.Responder -} - -// NewCreateStorageGeneralFile creates a new http.Handler for the create storage general file operation -func NewCreateStorageGeneralFile(ctx *middleware.Context, handler CreateStorageGeneralFileHandler) *CreateStorageGeneralFile { - return &CreateStorageGeneralFile{Context: ctx, Handler: handler} -} - -/* - CreateStorageGeneralFile swagger:route POST /services/haproxy/storage/general Storage createStorageGeneralFile - -# Creates a managed storage general use file with contents - -Creates a managed storage general use file with contents. -*/ -type CreateStorageGeneralFile struct { - Context *middleware.Context - Handler CreateStorageGeneralFileHandler -} - -func (o *CreateStorageGeneralFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStorageGeneralFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/create_storage_general_file_parameters.go b/operations/storage/create_storage_general_file_parameters.go deleted file mode 100644 index 6149e352..00000000 --- a/operations/storage/create_storage_general_file_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageGeneralFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateStorageGeneralFileMaxParseMemory int64 = 32 << 20 - -// NewCreateStorageGeneralFileParams creates a new CreateStorageGeneralFileParams object -// -// There are no default values defined in the spec. -func NewCreateStorageGeneralFileParams() CreateStorageGeneralFileParams { - - return CreateStorageGeneralFileParams{} -} - -// CreateStorageGeneralFileParams contains all the bound params for the create storage general file operation -// typically these are obtained from a http.Request -// -// swagger:parameters createStorageGeneralFile -type CreateStorageGeneralFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*General use file content - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStorageGeneralFileParams() beforehand. -func (o *CreateStorageGeneralFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateStorageGeneralFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateStorageGeneralFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/storage/create_storage_general_file_responses.go b/operations/storage/create_storage_general_file_responses.go deleted file mode 100644 index df2bef87..00000000 --- a/operations/storage/create_storage_general_file_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStorageGeneralFileCreatedCode is the HTTP code returned for type CreateStorageGeneralFileCreated -const CreateStorageGeneralFileCreatedCode int = 201 - -/* -CreateStorageGeneralFileCreated General use file created with its contents - -swagger:response createStorageGeneralFileCreated -*/ -type CreateStorageGeneralFileCreated struct { - - /* - In: Body - */ - Payload *models.GeneralFile `json:"body,omitempty"` -} - -// NewCreateStorageGeneralFileCreated creates CreateStorageGeneralFileCreated with default headers values -func NewCreateStorageGeneralFileCreated() *CreateStorageGeneralFileCreated { - - return &CreateStorageGeneralFileCreated{} -} - -// WithPayload adds the payload to the create storage general file created response -func (o *CreateStorageGeneralFileCreated) WithPayload(payload *models.GeneralFile) *CreateStorageGeneralFileCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage general file created response -func (o *CreateStorageGeneralFileCreated) SetPayload(payload *models.GeneralFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageGeneralFileCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageGeneralFileBadRequestCode is the HTTP code returned for type CreateStorageGeneralFileBadRequest -const CreateStorageGeneralFileBadRequestCode int = 400 - -/* -CreateStorageGeneralFileBadRequest Bad request - -swagger:response createStorageGeneralFileBadRequest -*/ -type CreateStorageGeneralFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageGeneralFileBadRequest creates CreateStorageGeneralFileBadRequest with default headers values -func NewCreateStorageGeneralFileBadRequest() *CreateStorageGeneralFileBadRequest { - - return &CreateStorageGeneralFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage general file bad request response -func (o *CreateStorageGeneralFileBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStorageGeneralFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage general file bad request response -func (o *CreateStorageGeneralFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage general file bad request response -func (o *CreateStorageGeneralFileBadRequest) WithPayload(payload *models.Error) *CreateStorageGeneralFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage general file bad request response -func (o *CreateStorageGeneralFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageGeneralFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageGeneralFileConflictCode is the HTTP code returned for type CreateStorageGeneralFileConflict -const CreateStorageGeneralFileConflictCode int = 409 - -/* -CreateStorageGeneralFileConflict The specified resource already exists - -swagger:response createStorageGeneralFileConflict -*/ -type CreateStorageGeneralFileConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageGeneralFileConflict creates CreateStorageGeneralFileConflict with default headers values -func NewCreateStorageGeneralFileConflict() *CreateStorageGeneralFileConflict { - - return &CreateStorageGeneralFileConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage general file conflict response -func (o *CreateStorageGeneralFileConflict) WithConfigurationVersion(configurationVersion string) *CreateStorageGeneralFileConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage general file conflict response -func (o *CreateStorageGeneralFileConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage general file conflict response -func (o *CreateStorageGeneralFileConflict) WithPayload(payload *models.Error) *CreateStorageGeneralFileConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage general file conflict response -func (o *CreateStorageGeneralFileConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageGeneralFileConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStorageGeneralFileDefault General Error - -swagger:response createStorageGeneralFileDefault -*/ -type CreateStorageGeneralFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageGeneralFileDefault creates CreateStorageGeneralFileDefault with default headers values -func NewCreateStorageGeneralFileDefault(code int) *CreateStorageGeneralFileDefault { - if code <= 0 { - code = 500 - } - - return &CreateStorageGeneralFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) WithStatusCode(code int) *CreateStorageGeneralFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) WithConfigurationVersion(configurationVersion string) *CreateStorageGeneralFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) WithPayload(payload *models.Error) *CreateStorageGeneralFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage general file default response -func (o *CreateStorageGeneralFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageGeneralFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/create_storage_general_file_urlbuilder.go b/operations/storage/create_storage_general_file_urlbuilder.go deleted file mode 100644 index 5f4bbf0c..00000000 --- a/operations/storage/create_storage_general_file_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateStorageGeneralFileURL generates an URL for the create storage general file operation -type CreateStorageGeneralFileURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageGeneralFileURL) WithBasePath(bp string) *CreateStorageGeneralFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageGeneralFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStorageGeneralFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/general" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStorageGeneralFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStorageGeneralFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStorageGeneralFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStorageGeneralFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStorageGeneralFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStorageGeneralFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/create_storage_map_file.go b/operations/storage/create_storage_map_file.go deleted file mode 100644 index 07efb0de..00000000 --- a/operations/storage/create_storage_map_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageMapFileHandlerFunc turns a function with the right signature into a create storage map file handler -type CreateStorageMapFileHandlerFunc func(CreateStorageMapFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStorageMapFileHandlerFunc) Handle(params CreateStorageMapFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStorageMapFileHandler interface for that can handle valid create storage map file params -type CreateStorageMapFileHandler interface { - Handle(CreateStorageMapFileParams, interface{}) middleware.Responder -} - -// NewCreateStorageMapFile creates a new http.Handler for the create storage map file operation -func NewCreateStorageMapFile(ctx *middleware.Context, handler CreateStorageMapFileHandler) *CreateStorageMapFile { - return &CreateStorageMapFile{Context: ctx, Handler: handler} -} - -/* - CreateStorageMapFile swagger:route POST /services/haproxy/storage/maps Storage createStorageMapFile - -# Creates a managed storage map file with its entries - -Creates a managed storage map file with its entries. -*/ -type CreateStorageMapFile struct { - Context *middleware.Context - Handler CreateStorageMapFileHandler -} - -func (o *CreateStorageMapFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStorageMapFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/create_storage_map_file_parameters.go b/operations/storage/create_storage_map_file_parameters.go deleted file mode 100644 index a58a38b4..00000000 --- a/operations/storage/create_storage_map_file_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageMapFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateStorageMapFileMaxParseMemory int64 = 32 << 20 - -// NewCreateStorageMapFileParams creates a new CreateStorageMapFileParams object -// -// There are no default values defined in the spec. -func NewCreateStorageMapFileParams() CreateStorageMapFileParams { - - return CreateStorageMapFileParams{} -} - -// CreateStorageMapFileParams contains all the bound params for the create storage map file operation -// typically these are obtained from a http.Request -// -// swagger:parameters createStorageMapFile -type CreateStorageMapFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*The map file contents - In: formData - */ - FileUpload io.ReadCloser -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStorageMapFileParams() beforehand. -func (o *CreateStorageMapFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(CreateStorageMapFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateStorageMapFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/operations/storage/create_storage_map_file_responses.go b/operations/storage/create_storage_map_file_responses.go deleted file mode 100644 index 03971ad5..00000000 --- a/operations/storage/create_storage_map_file_responses.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStorageMapFileCreatedCode is the HTTP code returned for type CreateStorageMapFileCreated -const CreateStorageMapFileCreatedCode int = 201 - -/* -CreateStorageMapFileCreated Map file created with its entries - -swagger:response createStorageMapFileCreated -*/ -type CreateStorageMapFileCreated struct { - - /* - In: Body - */ - Payload *models.Map `json:"body,omitempty"` -} - -// NewCreateStorageMapFileCreated creates CreateStorageMapFileCreated with default headers values -func NewCreateStorageMapFileCreated() *CreateStorageMapFileCreated { - - return &CreateStorageMapFileCreated{} -} - -// WithPayload adds the payload to the create storage map file created response -func (o *CreateStorageMapFileCreated) WithPayload(payload *models.Map) *CreateStorageMapFileCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage map file created response -func (o *CreateStorageMapFileCreated) SetPayload(payload *models.Map) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageMapFileCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageMapFileBadRequestCode is the HTTP code returned for type CreateStorageMapFileBadRequest -const CreateStorageMapFileBadRequestCode int = 400 - -/* -CreateStorageMapFileBadRequest Bad request - -swagger:response createStorageMapFileBadRequest -*/ -type CreateStorageMapFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageMapFileBadRequest creates CreateStorageMapFileBadRequest with default headers values -func NewCreateStorageMapFileBadRequest() *CreateStorageMapFileBadRequest { - - return &CreateStorageMapFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage map file bad request response -func (o *CreateStorageMapFileBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStorageMapFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage map file bad request response -func (o *CreateStorageMapFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage map file bad request response -func (o *CreateStorageMapFileBadRequest) WithPayload(payload *models.Error) *CreateStorageMapFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage map file bad request response -func (o *CreateStorageMapFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageMapFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageMapFileConflictCode is the HTTP code returned for type CreateStorageMapFileConflict -const CreateStorageMapFileConflictCode int = 409 - -/* -CreateStorageMapFileConflict The specified resource already exists - -swagger:response createStorageMapFileConflict -*/ -type CreateStorageMapFileConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageMapFileConflict creates CreateStorageMapFileConflict with default headers values -func NewCreateStorageMapFileConflict() *CreateStorageMapFileConflict { - - return &CreateStorageMapFileConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage map file conflict response -func (o *CreateStorageMapFileConflict) WithConfigurationVersion(configurationVersion string) *CreateStorageMapFileConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage map file conflict response -func (o *CreateStorageMapFileConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage map file conflict response -func (o *CreateStorageMapFileConflict) WithPayload(payload *models.Error) *CreateStorageMapFileConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage map file conflict response -func (o *CreateStorageMapFileConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageMapFileConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStorageMapFileDefault General Error - -swagger:response createStorageMapFileDefault -*/ -type CreateStorageMapFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageMapFileDefault creates CreateStorageMapFileDefault with default headers values -func NewCreateStorageMapFileDefault(code int) *CreateStorageMapFileDefault { - if code <= 0 { - code = 500 - } - - return &CreateStorageMapFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create storage map file default response -func (o *CreateStorageMapFileDefault) WithStatusCode(code int) *CreateStorageMapFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create storage map file default response -func (o *CreateStorageMapFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create storage map file default response -func (o *CreateStorageMapFileDefault) WithConfigurationVersion(configurationVersion string) *CreateStorageMapFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage map file default response -func (o *CreateStorageMapFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage map file default response -func (o *CreateStorageMapFileDefault) WithPayload(payload *models.Error) *CreateStorageMapFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage map file default response -func (o *CreateStorageMapFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageMapFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/create_storage_map_file_urlbuilder.go b/operations/storage/create_storage_map_file_urlbuilder.go deleted file mode 100644 index 0792a5fc..00000000 --- a/operations/storage/create_storage_map_file_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// CreateStorageMapFileURL generates an URL for the create storage map file operation -type CreateStorageMapFileURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageMapFileURL) WithBasePath(bp string) *CreateStorageMapFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageMapFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStorageMapFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/maps" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStorageMapFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStorageMapFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStorageMapFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStorageMapFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStorageMapFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStorageMapFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/create_storage_s_s_l_certificate.go b/operations/storage/create_storage_s_s_l_certificate.go deleted file mode 100644 index d414feff..00000000 --- a/operations/storage/create_storage_s_s_l_certificate.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageSSLCertificateHandlerFunc turns a function with the right signature into a create storage s s l certificate handler -type CreateStorageSSLCertificateHandlerFunc func(CreateStorageSSLCertificateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStorageSSLCertificateHandlerFunc) Handle(params CreateStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStorageSSLCertificateHandler interface for that can handle valid create storage s s l certificate params -type CreateStorageSSLCertificateHandler interface { - Handle(CreateStorageSSLCertificateParams, interface{}) middleware.Responder -} - -// NewCreateStorageSSLCertificate creates a new http.Handler for the create storage s s l certificate operation -func NewCreateStorageSSLCertificate(ctx *middleware.Context, handler CreateStorageSSLCertificateHandler) *CreateStorageSSLCertificate { - return &CreateStorageSSLCertificate{Context: ctx, Handler: handler} -} - -/* - CreateStorageSSLCertificate swagger:route POST /services/haproxy/storage/ssl_certificates Storage createStorageSSLCertificate - -# Create SSL certificate - -Creates SSL certificate. -*/ -type CreateStorageSSLCertificate struct { - Context *middleware.Context - Handler CreateStorageSSLCertificateHandler -} - -func (o *CreateStorageSSLCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStorageSSLCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/create_storage_s_s_l_certificate_parameters.go b/operations/storage/create_storage_s_s_l_certificate_parameters.go deleted file mode 100644 index b552602d..00000000 --- a/operations/storage/create_storage_s_s_l_certificate_parameters.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CreateStorageSSLCertificateMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateStorageSSLCertificateMaxParseMemory int64 = 32 << 20 - -// NewCreateStorageSSLCertificateParams creates a new CreateStorageSSLCertificateParams object -// with the default values initialized. -func NewCreateStorageSSLCertificateParams() CreateStorageSSLCertificateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - skipReloadDefault = bool(false) - ) - - return CreateStorageSSLCertificateParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// CreateStorageSSLCertificateParams contains all the bound params for the create storage s s l certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters createStorageSSLCertificate -type CreateStorageSSLCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*The SSL certificate to upload - In: formData - */ - FileUpload io.ReadCloser - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStorageSSLCertificateParams() beforehand. -func (o *CreateStorageSSLCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if err := r.ParseMultipartForm(CreateStorageSSLCertificateMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateStorageSSLCertificateParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateStorageSSLCertificateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *CreateStorageSSLCertificateParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/create_storage_s_s_l_certificate_responses.go b/operations/storage/create_storage_s_s_l_certificate_responses.go deleted file mode 100644 index b4417c05..00000000 --- a/operations/storage/create_storage_s_s_l_certificate_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStorageSSLCertificateCreatedCode is the HTTP code returned for type CreateStorageSSLCertificateCreated -const CreateStorageSSLCertificateCreatedCode int = 201 - -/* -CreateStorageSSLCertificateCreated SSL certificate created - -swagger:response createStorageSSLCertificateCreated -*/ -type CreateStorageSSLCertificateCreated struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewCreateStorageSSLCertificateCreated creates CreateStorageSSLCertificateCreated with default headers values -func NewCreateStorageSSLCertificateCreated() *CreateStorageSSLCertificateCreated { - - return &CreateStorageSSLCertificateCreated{} -} - -// WithPayload adds the payload to the create storage s s l certificate created response -func (o *CreateStorageSSLCertificateCreated) WithPayload(payload *models.SslCertificate) *CreateStorageSSLCertificateCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l certificate created response -func (o *CreateStorageSSLCertificateCreated) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCertificateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCertificateAcceptedCode is the HTTP code returned for type CreateStorageSSLCertificateAccepted -const CreateStorageSSLCertificateAcceptedCode int = 202 - -/* -CreateStorageSSLCertificateAccepted SSL certificate created requested - -swagger:response createStorageSSLCertificateAccepted -*/ -type CreateStorageSSLCertificateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewCreateStorageSSLCertificateAccepted creates CreateStorageSSLCertificateAccepted with default headers values -func NewCreateStorageSSLCertificateAccepted() *CreateStorageSSLCertificateAccepted { - - return &CreateStorageSSLCertificateAccepted{} -} - -// WithReloadID adds the reloadId to the create storage s s l certificate accepted response -func (o *CreateStorageSSLCertificateAccepted) WithReloadID(reloadID string) *CreateStorageSSLCertificateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create storage s s l certificate accepted response -func (o *CreateStorageSSLCertificateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create storage s s l certificate accepted response -func (o *CreateStorageSSLCertificateAccepted) WithPayload(payload *models.SslCertificate) *CreateStorageSSLCertificateAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l certificate accepted response -func (o *CreateStorageSSLCertificateAccepted) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCertificateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCertificateBadRequestCode is the HTTP code returned for type CreateStorageSSLCertificateBadRequest -const CreateStorageSSLCertificateBadRequestCode int = 400 - -/* -CreateStorageSSLCertificateBadRequest Bad request - -swagger:response createStorageSSLCertificateBadRequest -*/ -type CreateStorageSSLCertificateBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCertificateBadRequest creates CreateStorageSSLCertificateBadRequest with default headers values -func NewCreateStorageSSLCertificateBadRequest() *CreateStorageSSLCertificateBadRequest { - - return &CreateStorageSSLCertificateBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l certificate bad request response -func (o *CreateStorageSSLCertificateBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCertificateBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l certificate bad request response -func (o *CreateStorageSSLCertificateBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l certificate bad request response -func (o *CreateStorageSSLCertificateBadRequest) WithPayload(payload *models.Error) *CreateStorageSSLCertificateBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l certificate bad request response -func (o *CreateStorageSSLCertificateBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCertificateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCertificateConflictCode is the HTTP code returned for type CreateStorageSSLCertificateConflict -const CreateStorageSSLCertificateConflictCode int = 409 - -/* -CreateStorageSSLCertificateConflict The specified resource already exists - -swagger:response createStorageSSLCertificateConflict -*/ -type CreateStorageSSLCertificateConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCertificateConflict creates CreateStorageSSLCertificateConflict with default headers values -func NewCreateStorageSSLCertificateConflict() *CreateStorageSSLCertificateConflict { - - return &CreateStorageSSLCertificateConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l certificate conflict response -func (o *CreateStorageSSLCertificateConflict) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCertificateConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l certificate conflict response -func (o *CreateStorageSSLCertificateConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l certificate conflict response -func (o *CreateStorageSSLCertificateConflict) WithPayload(payload *models.Error) *CreateStorageSSLCertificateConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l certificate conflict response -func (o *CreateStorageSSLCertificateConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCertificateConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStorageSSLCertificateDefault General Error - -swagger:response createStorageSSLCertificateDefault -*/ -type CreateStorageSSLCertificateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCertificateDefault creates CreateStorageSSLCertificateDefault with default headers values -func NewCreateStorageSSLCertificateDefault(code int) *CreateStorageSSLCertificateDefault { - if code <= 0 { - code = 500 - } - - return &CreateStorageSSLCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) WithStatusCode(code int) *CreateStorageSSLCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCertificateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) WithPayload(payload *models.Error) *CreateStorageSSLCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l certificate default response -func (o *CreateStorageSSLCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/create_storage_s_s_l_certificate_urlbuilder.go b/operations/storage/create_storage_s_s_l_certificate_urlbuilder.go deleted file mode 100644 index 63a14ad2..00000000 --- a/operations/storage/create_storage_s_s_l_certificate_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateStorageSSLCertificateURL generates an URL for the create storage s s l certificate operation -type CreateStorageSSLCertificateURL struct { - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCertificateURL) WithBasePath(bp string) *CreateStorageSSLCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStorageSSLCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_certificates" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStorageSSLCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStorageSSLCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStorageSSLCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStorageSSLCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStorageSSLCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStorageSSLCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_entry.go b/operations/storage/create_storage_s_s_l_crt_list_entry.go deleted file mode 100644 index 13790d08..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageSSLCrtListEntryHandlerFunc turns a function with the right signature into a create storage s s l crt list entry handler -type CreateStorageSSLCrtListEntryHandlerFunc func(CreateStorageSSLCrtListEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStorageSSLCrtListEntryHandlerFunc) Handle(params CreateStorageSSLCrtListEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStorageSSLCrtListEntryHandler interface for that can handle valid create storage s s l crt list entry params -type CreateStorageSSLCrtListEntryHandler interface { - Handle(CreateStorageSSLCrtListEntryParams, interface{}) middleware.Responder -} - -// NewCreateStorageSSLCrtListEntry creates a new http.Handler for the create storage s s l crt list entry operation -func NewCreateStorageSSLCrtListEntry(ctx *middleware.Context, handler CreateStorageSSLCrtListEntryHandler) *CreateStorageSSLCrtListEntry { - return &CreateStorageSSLCrtListEntry{Context: ctx, Handler: handler} -} - -/* - CreateStorageSSLCrtListEntry swagger:route POST /services/haproxy/storage/ssl_crt_lists/{name}/entries Storage createStorageSSLCrtListEntry - -# Creates a new entry in a CrtList - -Creates a new entry in a certificate list. -*/ -type CreateStorageSSLCrtListEntry struct { - Context *middleware.Context - Handler CreateStorageSSLCrtListEntryHandler -} - -func (o *CreateStorageSSLCrtListEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStorageSSLCrtListEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_entry_parameters.go b/operations/storage/create_storage_s_s_l_crt_list_entry_parameters.go deleted file mode 100644 index c02e10de..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_entry_parameters.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateStorageSSLCrtListEntryParams creates a new CreateStorageSSLCrtListEntryParams object -// with the default values initialized. -func NewCreateStorageSSLCrtListEntryParams() CreateStorageSSLCrtListEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateStorageSSLCrtListEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateStorageSSLCrtListEntryParams contains all the bound params for the create storage s s l crt list entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateStorageSSLCrtListEntry -type CreateStorageSSLCrtListEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL crt-list entry - Required: true - In: body - */ - Data *models.SslCrtListEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*SSL crt-list file - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStorageSSLCrtListEntryParams() beforehand. -func (o *CreateStorageSSLCrtListEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.SslCrtListEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateStorageSSLCrtListEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateStorageSSLCrtListEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *CreateStorageSSLCrtListEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_entry_responses.go b/operations/storage/create_storage_s_s_l_crt_list_entry_responses.go deleted file mode 100644 index 80b613e9..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_entry_responses.go +++ /dev/null @@ -1,336 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStorageSSLCrtListEntryCreatedCode is the HTTP code returned for type CreateStorageSSLCrtListEntryCreated -const CreateStorageSSLCrtListEntryCreatedCode int = 201 - -/* -CreateStorageSSLCrtListEntryCreated New entry added - -swagger:response createStorageSSLCrtListEntryCreated -*/ -type CreateStorageSSLCrtListEntryCreated struct { - - /* - In: Body - */ - Payload *models.SslCrtListEntry `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListEntryCreated creates CreateStorageSSLCrtListEntryCreated with default headers values -func NewCreateStorageSSLCrtListEntryCreated() *CreateStorageSSLCrtListEntryCreated { - - return &CreateStorageSSLCrtListEntryCreated{} -} - -// WithPayload adds the payload to the create storage s s l crt list entry created response -func (o *CreateStorageSSLCrtListEntryCreated) WithPayload(payload *models.SslCrtListEntry) *CreateStorageSSLCrtListEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list entry created response -func (o *CreateStorageSSLCrtListEntryCreated) SetPayload(payload *models.SslCrtListEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCrtListEntryAcceptedCode is the HTTP code returned for type CreateStorageSSLCrtListEntryAccepted -const CreateStorageSSLCrtListEntryAcceptedCode int = 202 - -/* -CreateStorageSSLCrtListEntryAccepted Configuration change accepted and reload requested - -swagger:response createStorageSSLCrtListEntryAccepted -*/ -type CreateStorageSSLCrtListEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewCreateStorageSSLCrtListEntryAccepted creates CreateStorageSSLCrtListEntryAccepted with default headers values -func NewCreateStorageSSLCrtListEntryAccepted() *CreateStorageSSLCrtListEntryAccepted { - - return &CreateStorageSSLCrtListEntryAccepted{} -} - -// WithReloadID adds the reloadId to the create storage s s l crt list entry accepted response -func (o *CreateStorageSSLCrtListEntryAccepted) WithReloadID(reloadID string) *CreateStorageSSLCrtListEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create storage s s l crt list entry accepted response -func (o *CreateStorageSSLCrtListEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// CreateStorageSSLCrtListEntryBadRequestCode is the HTTP code returned for type CreateStorageSSLCrtListEntryBadRequest -const CreateStorageSSLCrtListEntryBadRequestCode int = 400 - -/* -CreateStorageSSLCrtListEntryBadRequest Bad request - -swagger:response createStorageSSLCrtListEntryBadRequest -*/ -type CreateStorageSSLCrtListEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListEntryBadRequest creates CreateStorageSSLCrtListEntryBadRequest with default headers values -func NewCreateStorageSSLCrtListEntryBadRequest() *CreateStorageSSLCrtListEntryBadRequest { - - return &CreateStorageSSLCrtListEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list entry bad request response -func (o *CreateStorageSSLCrtListEntryBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list entry bad request response -func (o *CreateStorageSSLCrtListEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list entry bad request response -func (o *CreateStorageSSLCrtListEntryBadRequest) WithPayload(payload *models.Error) *CreateStorageSSLCrtListEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list entry bad request response -func (o *CreateStorageSSLCrtListEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCrtListEntryConflictCode is the HTTP code returned for type CreateStorageSSLCrtListEntryConflict -const CreateStorageSSLCrtListEntryConflictCode int = 409 - -/* -CreateStorageSSLCrtListEntryConflict The specified resource already exists - -swagger:response createStorageSSLCrtListEntryConflict -*/ -type CreateStorageSSLCrtListEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListEntryConflict creates CreateStorageSSLCrtListEntryConflict with default headers values -func NewCreateStorageSSLCrtListEntryConflict() *CreateStorageSSLCrtListEntryConflict { - - return &CreateStorageSSLCrtListEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list entry conflict response -func (o *CreateStorageSSLCrtListEntryConflict) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list entry conflict response -func (o *CreateStorageSSLCrtListEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list entry conflict response -func (o *CreateStorageSSLCrtListEntryConflict) WithPayload(payload *models.Error) *CreateStorageSSLCrtListEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list entry conflict response -func (o *CreateStorageSSLCrtListEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStorageSSLCrtListEntryDefault General Error - -swagger:response createStorageSSLCrtListEntryDefault -*/ -type CreateStorageSSLCrtListEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListEntryDefault creates CreateStorageSSLCrtListEntryDefault with default headers values -func NewCreateStorageSSLCrtListEntryDefault(code int) *CreateStorageSSLCrtListEntryDefault { - if code <= 0 { - code = 500 - } - - return &CreateStorageSSLCrtListEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) WithStatusCode(code int) *CreateStorageSSLCrtListEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) WithPayload(payload *models.Error) *CreateStorageSSLCrtListEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list entry default response -func (o *CreateStorageSSLCrtListEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_entry_urlbuilder.go b/operations/storage/create_storage_s_s_l_crt_list_entry_urlbuilder.go deleted file mode 100644 index ffb27b7a..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_entry_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateStorageSSLCrtListEntryURL generates an URL for the create storage s s l crt list entry operation -type CreateStorageSSLCrtListEntryURL struct { - Name string - - ForceReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCrtListEntryURL) WithBasePath(bp string) *CreateStorageSSLCrtListEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCrtListEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStorageSSLCrtListEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}/entries" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on CreateStorageSSLCrtListEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStorageSSLCrtListEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStorageSSLCrtListEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStorageSSLCrtListEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStorageSSLCrtListEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStorageSSLCrtListEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStorageSSLCrtListEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_file.go b/operations/storage/create_storage_s_s_l_crt_list_file.go deleted file mode 100644 index ccf0808b..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateStorageSSLCrtListFileHandlerFunc turns a function with the right signature into a create storage s s l crt list file handler -type CreateStorageSSLCrtListFileHandlerFunc func(CreateStorageSSLCrtListFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateStorageSSLCrtListFileHandlerFunc) Handle(params CreateStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateStorageSSLCrtListFileHandler interface for that can handle valid create storage s s l crt list file params -type CreateStorageSSLCrtListFileHandler interface { - Handle(CreateStorageSSLCrtListFileParams, interface{}) middleware.Responder -} - -// NewCreateStorageSSLCrtListFile creates a new http.Handler for the create storage s s l crt list file operation -func NewCreateStorageSSLCrtListFile(ctx *middleware.Context, handler CreateStorageSSLCrtListFileHandler) *CreateStorageSSLCrtListFile { - return &CreateStorageSSLCrtListFile{Context: ctx, Handler: handler} -} - -/* - CreateStorageSSLCrtListFile swagger:route POST /services/haproxy/storage/ssl_crt_lists Storage createStorageSSLCrtListFile - -# Create a certificate list - -Creates a certificate list. -*/ -type CreateStorageSSLCrtListFile struct { - Context *middleware.Context - Handler CreateStorageSSLCrtListFileHandler -} - -func (o *CreateStorageSSLCrtListFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateStorageSSLCrtListFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_file_parameters.go b/operations/storage/create_storage_s_s_l_crt_list_file_parameters.go deleted file mode 100644 index 782f4468..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_file_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// CreateStorageSSLCrtListFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var CreateStorageSSLCrtListFileMaxParseMemory int64 = 32 << 20 - -// NewCreateStorageSSLCrtListFileParams creates a new CreateStorageSSLCrtListFileParams object -// with the default values initialized. -func NewCreateStorageSSLCrtListFileParams() CreateStorageSSLCrtListFileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateStorageSSLCrtListFileParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateStorageSSLCrtListFileParams contains all the bound params for the create storage s s l crt list file operation -// typically these are obtained from a http.Request -// -// swagger:parameters createStorageSSLCrtListFile -type CreateStorageSSLCrtListFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*The certificate list to upload - In: formData - */ - FileUpload io.ReadCloser - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateStorageSSLCrtListFileParams() beforehand. -func (o *CreateStorageSSLCrtListFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if err := r.ParseMultipartForm(CreateStorageSSLCrtListFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *CreateStorageSSLCrtListFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateStorageSSLCrtListFileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateStorageSSLCrtListFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_file_responses.go b/operations/storage/create_storage_s_s_l_crt_list_file_responses.go deleted file mode 100644 index e0e5ce4e..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_file_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateStorageSSLCrtListFileCreatedCode is the HTTP code returned for type CreateStorageSSLCrtListFileCreated -const CreateStorageSSLCrtListFileCreatedCode int = 201 - -/* -CreateStorageSSLCrtListFileCreated Certificate list created - -swagger:response createStorageSSLCrtListFileCreated -*/ -type CreateStorageSSLCrtListFileCreated struct { - - /* - In: Body - */ - Payload *models.SslCrtListFile `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListFileCreated creates CreateStorageSSLCrtListFileCreated with default headers values -func NewCreateStorageSSLCrtListFileCreated() *CreateStorageSSLCrtListFileCreated { - - return &CreateStorageSSLCrtListFileCreated{} -} - -// WithPayload adds the payload to the create storage s s l crt list file created response -func (o *CreateStorageSSLCrtListFileCreated) WithPayload(payload *models.SslCrtListFile) *CreateStorageSSLCrtListFileCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list file created response -func (o *CreateStorageSSLCrtListFileCreated) SetPayload(payload *models.SslCrtListFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListFileCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCrtListFileAcceptedCode is the HTTP code returned for type CreateStorageSSLCrtListFileAccepted -const CreateStorageSSLCrtListFileAcceptedCode int = 202 - -/* -CreateStorageSSLCrtListFileAccepted Certificate list created requested - -swagger:response createStorageSSLCrtListFileAccepted -*/ -type CreateStorageSSLCrtListFileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SslCrtListFile `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListFileAccepted creates CreateStorageSSLCrtListFileAccepted with default headers values -func NewCreateStorageSSLCrtListFileAccepted() *CreateStorageSSLCrtListFileAccepted { - - return &CreateStorageSSLCrtListFileAccepted{} -} - -// WithReloadID adds the reloadId to the create storage s s l crt list file accepted response -func (o *CreateStorageSSLCrtListFileAccepted) WithReloadID(reloadID string) *CreateStorageSSLCrtListFileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create storage s s l crt list file accepted response -func (o *CreateStorageSSLCrtListFileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create storage s s l crt list file accepted response -func (o *CreateStorageSSLCrtListFileAccepted) WithPayload(payload *models.SslCrtListFile) *CreateStorageSSLCrtListFileAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list file accepted response -func (o *CreateStorageSSLCrtListFileAccepted) SetPayload(payload *models.SslCrtListFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListFileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCrtListFileBadRequestCode is the HTTP code returned for type CreateStorageSSLCrtListFileBadRequest -const CreateStorageSSLCrtListFileBadRequestCode int = 400 - -/* -CreateStorageSSLCrtListFileBadRequest Bad request - -swagger:response createStorageSSLCrtListFileBadRequest -*/ -type CreateStorageSSLCrtListFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListFileBadRequest creates CreateStorageSSLCrtListFileBadRequest with default headers values -func NewCreateStorageSSLCrtListFileBadRequest() *CreateStorageSSLCrtListFileBadRequest { - - return &CreateStorageSSLCrtListFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list file bad request response -func (o *CreateStorageSSLCrtListFileBadRequest) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list file bad request response -func (o *CreateStorageSSLCrtListFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list file bad request response -func (o *CreateStorageSSLCrtListFileBadRequest) WithPayload(payload *models.Error) *CreateStorageSSLCrtListFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list file bad request response -func (o *CreateStorageSSLCrtListFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateStorageSSLCrtListFileConflictCode is the HTTP code returned for type CreateStorageSSLCrtListFileConflict -const CreateStorageSSLCrtListFileConflictCode int = 409 - -/* -CreateStorageSSLCrtListFileConflict The specified resource already exists - -swagger:response createStorageSSLCrtListFileConflict -*/ -type CreateStorageSSLCrtListFileConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListFileConflict creates CreateStorageSSLCrtListFileConflict with default headers values -func NewCreateStorageSSLCrtListFileConflict() *CreateStorageSSLCrtListFileConflict { - - return &CreateStorageSSLCrtListFileConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list file conflict response -func (o *CreateStorageSSLCrtListFileConflict) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListFileConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list file conflict response -func (o *CreateStorageSSLCrtListFileConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list file conflict response -func (o *CreateStorageSSLCrtListFileConflict) WithPayload(payload *models.Error) *CreateStorageSSLCrtListFileConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list file conflict response -func (o *CreateStorageSSLCrtListFileConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListFileConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateStorageSSLCrtListFileDefault General Error - -swagger:response createStorageSSLCrtListFileDefault -*/ -type CreateStorageSSLCrtListFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateStorageSSLCrtListFileDefault creates CreateStorageSSLCrtListFileDefault with default headers values -func NewCreateStorageSSLCrtListFileDefault(code int) *CreateStorageSSLCrtListFileDefault { - if code <= 0 { - code = 500 - } - - return &CreateStorageSSLCrtListFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) WithStatusCode(code int) *CreateStorageSSLCrtListFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) WithConfigurationVersion(configurationVersion string) *CreateStorageSSLCrtListFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) WithPayload(payload *models.Error) *CreateStorageSSLCrtListFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create storage s s l crt list file default response -func (o *CreateStorageSSLCrtListFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateStorageSSLCrtListFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/create_storage_s_s_l_crt_list_file_urlbuilder.go b/operations/storage/create_storage_s_s_l_crt_list_file_urlbuilder.go deleted file mode 100644 index 818b5d92..00000000 --- a/operations/storage/create_storage_s_s_l_crt_list_file_urlbuilder.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateStorageSSLCrtListFileURL generates an URL for the create storage s s l crt list file operation -type CreateStorageSSLCrtListFileURL struct { - ForceReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCrtListFileURL) WithBasePath(bp string) *CreateStorageSSLCrtListFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateStorageSSLCrtListFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateStorageSSLCrtListFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateStorageSSLCrtListFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateStorageSSLCrtListFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateStorageSSLCrtListFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateStorageSSLCrtListFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateStorageSSLCrtListFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateStorageSSLCrtListFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/delete_storage_general_file.go b/operations/storage/delete_storage_general_file.go deleted file mode 100644 index 0f5abcec..00000000 --- a/operations/storage/delete_storage_general_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStorageGeneralFileHandlerFunc turns a function with the right signature into a delete storage general file handler -type DeleteStorageGeneralFileHandlerFunc func(DeleteStorageGeneralFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStorageGeneralFileHandlerFunc) Handle(params DeleteStorageGeneralFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStorageGeneralFileHandler interface for that can handle valid delete storage general file params -type DeleteStorageGeneralFileHandler interface { - Handle(DeleteStorageGeneralFileParams, interface{}) middleware.Responder -} - -// NewDeleteStorageGeneralFile creates a new http.Handler for the delete storage general file operation -func NewDeleteStorageGeneralFile(ctx *middleware.Context, handler DeleteStorageGeneralFileHandler) *DeleteStorageGeneralFile { - return &DeleteStorageGeneralFile{Context: ctx, Handler: handler} -} - -/* - DeleteStorageGeneralFile swagger:route DELETE /services/haproxy/storage/general/{name} Storage deleteStorageGeneralFile - -# Deletes a managed general use file from disk - -Deletes a managed general use file from disk. -*/ -type DeleteStorageGeneralFile struct { - Context *middleware.Context - Handler DeleteStorageGeneralFileHandler -} - -func (o *DeleteStorageGeneralFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStorageGeneralFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/delete_storage_general_file_parameters.go b/operations/storage/delete_storage_general_file_parameters.go deleted file mode 100644 index 1dd2ca6e..00000000 --- a/operations/storage/delete_storage_general_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteStorageGeneralFileParams creates a new DeleteStorageGeneralFileParams object -// -// There are no default values defined in the spec. -func NewDeleteStorageGeneralFileParams() DeleteStorageGeneralFileParams { - - return DeleteStorageGeneralFileParams{} -} - -// DeleteStorageGeneralFileParams contains all the bound params for the delete storage general file operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteStorageGeneralFile -type DeleteStorageGeneralFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*General use file storage_name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStorageGeneralFileParams() beforehand. -func (o *DeleteStorageGeneralFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteStorageGeneralFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/delete_storage_general_file_responses.go b/operations/storage/delete_storage_general_file_responses.go deleted file mode 100644 index 38ca3318..00000000 --- a/operations/storage/delete_storage_general_file_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStorageGeneralFileNoContentCode is the HTTP code returned for type DeleteStorageGeneralFileNoContent -const DeleteStorageGeneralFileNoContentCode int = 204 - -/* -DeleteStorageGeneralFileNoContent General use file deleted - -swagger:response deleteStorageGeneralFileNoContent -*/ -type DeleteStorageGeneralFileNoContent struct { -} - -// NewDeleteStorageGeneralFileNoContent creates DeleteStorageGeneralFileNoContent with default headers values -func NewDeleteStorageGeneralFileNoContent() *DeleteStorageGeneralFileNoContent { - - return &DeleteStorageGeneralFileNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStorageGeneralFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStorageGeneralFileNotFoundCode is the HTTP code returned for type DeleteStorageGeneralFileNotFound -const DeleteStorageGeneralFileNotFoundCode int = 404 - -/* -DeleteStorageGeneralFileNotFound The specified resource was not found - -swagger:response deleteStorageGeneralFileNotFound -*/ -type DeleteStorageGeneralFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageGeneralFileNotFound creates DeleteStorageGeneralFileNotFound with default headers values -func NewDeleteStorageGeneralFileNotFound() *DeleteStorageGeneralFileNotFound { - - return &DeleteStorageGeneralFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage general file not found response -func (o *DeleteStorageGeneralFileNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStorageGeneralFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage general file not found response -func (o *DeleteStorageGeneralFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage general file not found response -func (o *DeleteStorageGeneralFileNotFound) WithPayload(payload *models.Error) *DeleteStorageGeneralFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage general file not found response -func (o *DeleteStorageGeneralFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageGeneralFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStorageGeneralFileDefault General Error - -swagger:response deleteStorageGeneralFileDefault -*/ -type DeleteStorageGeneralFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageGeneralFileDefault creates DeleteStorageGeneralFileDefault with default headers values -func NewDeleteStorageGeneralFileDefault(code int) *DeleteStorageGeneralFileDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStorageGeneralFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) WithStatusCode(code int) *DeleteStorageGeneralFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) WithConfigurationVersion(configurationVersion string) *DeleteStorageGeneralFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) WithPayload(payload *models.Error) *DeleteStorageGeneralFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage general file default response -func (o *DeleteStorageGeneralFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageGeneralFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/delete_storage_general_file_urlbuilder.go b/operations/storage/delete_storage_general_file_urlbuilder.go deleted file mode 100644 index ef6e4d24..00000000 --- a/operations/storage/delete_storage_general_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteStorageGeneralFileURL generates an URL for the delete storage general file operation -type DeleteStorageGeneralFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageGeneralFileURL) WithBasePath(bp string) *DeleteStorageGeneralFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageGeneralFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStorageGeneralFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/general/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteStorageGeneralFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStorageGeneralFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStorageGeneralFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStorageGeneralFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStorageGeneralFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStorageGeneralFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStorageGeneralFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/delete_storage_map.go b/operations/storage/delete_storage_map.go deleted file mode 100644 index 47f3bcb3..00000000 --- a/operations/storage/delete_storage_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStorageMapHandlerFunc turns a function with the right signature into a delete storage map handler -type DeleteStorageMapHandlerFunc func(DeleteStorageMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStorageMapHandlerFunc) Handle(params DeleteStorageMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStorageMapHandler interface for that can handle valid delete storage map params -type DeleteStorageMapHandler interface { - Handle(DeleteStorageMapParams, interface{}) middleware.Responder -} - -// NewDeleteStorageMap creates a new http.Handler for the delete storage map operation -func NewDeleteStorageMap(ctx *middleware.Context, handler DeleteStorageMapHandler) *DeleteStorageMap { - return &DeleteStorageMap{Context: ctx, Handler: handler} -} - -/* - DeleteStorageMap swagger:route DELETE /services/haproxy/storage/maps/{name} Storage deleteStorageMap - -# Deletes a managed map file from disk - -Deletes a managed map file from disk. -*/ -type DeleteStorageMap struct { - Context *middleware.Context - Handler DeleteStorageMapHandler -} - -func (o *DeleteStorageMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStorageMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/delete_storage_map_parameters.go b/operations/storage/delete_storage_map_parameters.go deleted file mode 100644 index 40c2b65d..00000000 --- a/operations/storage/delete_storage_map_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteStorageMapParams creates a new DeleteStorageMapParams object -// -// There are no default values defined in the spec. -func NewDeleteStorageMapParams() DeleteStorageMapParams { - - return DeleteStorageMapParams{} -} - -// DeleteStorageMapParams contains all the bound params for the delete storage map operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteStorageMap -type DeleteStorageMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Map file storage_name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStorageMapParams() beforehand. -func (o *DeleteStorageMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteStorageMapParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/delete_storage_map_responses.go b/operations/storage/delete_storage_map_responses.go deleted file mode 100644 index 786c6f54..00000000 --- a/operations/storage/delete_storage_map_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStorageMapNoContentCode is the HTTP code returned for type DeleteStorageMapNoContent -const DeleteStorageMapNoContentCode int = 204 - -/* -DeleteStorageMapNoContent Map file deleted - -swagger:response deleteStorageMapNoContent -*/ -type DeleteStorageMapNoContent struct { -} - -// NewDeleteStorageMapNoContent creates DeleteStorageMapNoContent with default headers values -func NewDeleteStorageMapNoContent() *DeleteStorageMapNoContent { - - return &DeleteStorageMapNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStorageMapNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStorageMapNotFoundCode is the HTTP code returned for type DeleteStorageMapNotFound -const DeleteStorageMapNotFoundCode int = 404 - -/* -DeleteStorageMapNotFound The specified resource was not found - -swagger:response deleteStorageMapNotFound -*/ -type DeleteStorageMapNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageMapNotFound creates DeleteStorageMapNotFound with default headers values -func NewDeleteStorageMapNotFound() *DeleteStorageMapNotFound { - - return &DeleteStorageMapNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage map not found response -func (o *DeleteStorageMapNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStorageMapNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage map not found response -func (o *DeleteStorageMapNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage map not found response -func (o *DeleteStorageMapNotFound) WithPayload(payload *models.Error) *DeleteStorageMapNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage map not found response -func (o *DeleteStorageMapNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageMapNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStorageMapDefault General Error - -swagger:response deleteStorageMapDefault -*/ -type DeleteStorageMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageMapDefault creates DeleteStorageMapDefault with default headers values -func NewDeleteStorageMapDefault(code int) *DeleteStorageMapDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStorageMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete storage map default response -func (o *DeleteStorageMapDefault) WithStatusCode(code int) *DeleteStorageMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete storage map default response -func (o *DeleteStorageMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage map default response -func (o *DeleteStorageMapDefault) WithConfigurationVersion(configurationVersion string) *DeleteStorageMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage map default response -func (o *DeleteStorageMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage map default response -func (o *DeleteStorageMapDefault) WithPayload(payload *models.Error) *DeleteStorageMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage map default response -func (o *DeleteStorageMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/delete_storage_map_urlbuilder.go b/operations/storage/delete_storage_map_urlbuilder.go deleted file mode 100644 index 7d8f9dd4..00000000 --- a/operations/storage/delete_storage_map_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteStorageMapURL generates an URL for the delete storage map operation -type DeleteStorageMapURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageMapURL) WithBasePath(bp string) *DeleteStorageMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStorageMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteStorageMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStorageMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStorageMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStorageMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStorageMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStorageMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStorageMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/delete_storage_s_s_l_certificate.go b/operations/storage/delete_storage_s_s_l_certificate.go deleted file mode 100644 index 42f923fe..00000000 --- a/operations/storage/delete_storage_s_s_l_certificate.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStorageSSLCertificateHandlerFunc turns a function with the right signature into a delete storage s s l certificate handler -type DeleteStorageSSLCertificateHandlerFunc func(DeleteStorageSSLCertificateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStorageSSLCertificateHandlerFunc) Handle(params DeleteStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStorageSSLCertificateHandler interface for that can handle valid delete storage s s l certificate params -type DeleteStorageSSLCertificateHandler interface { - Handle(DeleteStorageSSLCertificateParams, interface{}) middleware.Responder -} - -// NewDeleteStorageSSLCertificate creates a new http.Handler for the delete storage s s l certificate operation -func NewDeleteStorageSSLCertificate(ctx *middleware.Context, handler DeleteStorageSSLCertificateHandler) *DeleteStorageSSLCertificate { - return &DeleteStorageSSLCertificate{Context: ctx, Handler: handler} -} - -/* - DeleteStorageSSLCertificate swagger:route DELETE /services/haproxy/storage/ssl_certificates/{name} Storage deleteStorageSSLCertificate - -# Delete SSL certificate from disk - -Deletes SSL certificate from disk. -*/ -type DeleteStorageSSLCertificate struct { - Context *middleware.Context - Handler DeleteStorageSSLCertificateHandler -} - -func (o *DeleteStorageSSLCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStorageSSLCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/delete_storage_s_s_l_certificate_parameters.go b/operations/storage/delete_storage_s_s_l_certificate_parameters.go deleted file mode 100644 index bd524de1..00000000 --- a/operations/storage/delete_storage_s_s_l_certificate_parameters.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteStorageSSLCertificateParams creates a new DeleteStorageSSLCertificateParams object -// with the default values initialized. -func NewDeleteStorageSSLCertificateParams() DeleteStorageSSLCertificateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return DeleteStorageSSLCertificateParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// DeleteStorageSSLCertificateParams contains all the bound params for the delete storage s s l certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteStorageSSLCertificate -type DeleteStorageSSLCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*SSL certificate name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStorageSSLCertificateParams() beforehand. -func (o *DeleteStorageSSLCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteStorageSSLCertificateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteStorageSSLCertificateParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *DeleteStorageSSLCertificateParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/delete_storage_s_s_l_certificate_responses.go b/operations/storage/delete_storage_s_s_l_certificate_responses.go deleted file mode 100644 index c50c912d..00000000 --- a/operations/storage/delete_storage_s_s_l_certificate_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStorageSSLCertificateAcceptedCode is the HTTP code returned for type DeleteStorageSSLCertificateAccepted -const DeleteStorageSSLCertificateAcceptedCode int = 202 - -/* -DeleteStorageSSLCertificateAccepted SSL certificate deleted and reload requested - -swagger:response deleteStorageSSLCertificateAccepted -*/ -type DeleteStorageSSLCertificateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteStorageSSLCertificateAccepted creates DeleteStorageSSLCertificateAccepted with default headers values -func NewDeleteStorageSSLCertificateAccepted() *DeleteStorageSSLCertificateAccepted { - - return &DeleteStorageSSLCertificateAccepted{} -} - -// WithReloadID adds the reloadId to the delete storage s s l certificate accepted response -func (o *DeleteStorageSSLCertificateAccepted) WithReloadID(reloadID string) *DeleteStorageSSLCertificateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete storage s s l certificate accepted response -func (o *DeleteStorageSSLCertificateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCertificateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteStorageSSLCertificateNoContentCode is the HTTP code returned for type DeleteStorageSSLCertificateNoContent -const DeleteStorageSSLCertificateNoContentCode int = 204 - -/* -DeleteStorageSSLCertificateNoContent SSL certificate deleted - -swagger:response deleteStorageSSLCertificateNoContent -*/ -type DeleteStorageSSLCertificateNoContent struct { -} - -// NewDeleteStorageSSLCertificateNoContent creates DeleteStorageSSLCertificateNoContent with default headers values -func NewDeleteStorageSSLCertificateNoContent() *DeleteStorageSSLCertificateNoContent { - - return &DeleteStorageSSLCertificateNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCertificateNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStorageSSLCertificateNotFoundCode is the HTTP code returned for type DeleteStorageSSLCertificateNotFound -const DeleteStorageSSLCertificateNotFoundCode int = 404 - -/* -DeleteStorageSSLCertificateNotFound The specified resource was not found - -swagger:response deleteStorageSSLCertificateNotFound -*/ -type DeleteStorageSSLCertificateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCertificateNotFound creates DeleteStorageSSLCertificateNotFound with default headers values -func NewDeleteStorageSSLCertificateNotFound() *DeleteStorageSSLCertificateNotFound { - - return &DeleteStorageSSLCertificateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l certificate not found response -func (o *DeleteStorageSSLCertificateNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCertificateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l certificate not found response -func (o *DeleteStorageSSLCertificateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l certificate not found response -func (o *DeleteStorageSSLCertificateNotFound) WithPayload(payload *models.Error) *DeleteStorageSSLCertificateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l certificate not found response -func (o *DeleteStorageSSLCertificateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCertificateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStorageSSLCertificateDefault General Error - -swagger:response deleteStorageSSLCertificateDefault -*/ -type DeleteStorageSSLCertificateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCertificateDefault creates DeleteStorageSSLCertificateDefault with default headers values -func NewDeleteStorageSSLCertificateDefault(code int) *DeleteStorageSSLCertificateDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStorageSSLCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) WithStatusCode(code int) *DeleteStorageSSLCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCertificateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) WithPayload(payload *models.Error) *DeleteStorageSSLCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l certificate default response -func (o *DeleteStorageSSLCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/delete_storage_s_s_l_certificate_urlbuilder.go b/operations/storage/delete_storage_s_s_l_certificate_urlbuilder.go deleted file mode 100644 index 9a83b9ef..00000000 --- a/operations/storage/delete_storage_s_s_l_certificate_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteStorageSSLCertificateURL generates an URL for the delete storage s s l certificate operation -type DeleteStorageSSLCertificateURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCertificateURL) WithBasePath(bp string) *DeleteStorageSSLCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStorageSSLCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_certificates/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteStorageSSLCertificateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStorageSSLCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStorageSSLCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStorageSSLCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStorageSSLCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStorageSSLCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStorageSSLCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_entry.go b/operations/storage/delete_storage_s_s_l_crt_list_entry.go deleted file mode 100644 index 31dd4275..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStorageSSLCrtListEntryHandlerFunc turns a function with the right signature into a delete storage s s l crt list entry handler -type DeleteStorageSSLCrtListEntryHandlerFunc func(DeleteStorageSSLCrtListEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStorageSSLCrtListEntryHandlerFunc) Handle(params DeleteStorageSSLCrtListEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStorageSSLCrtListEntryHandler interface for that can handle valid delete storage s s l crt list entry params -type DeleteStorageSSLCrtListEntryHandler interface { - Handle(DeleteStorageSSLCrtListEntryParams, interface{}) middleware.Responder -} - -// NewDeleteStorageSSLCrtListEntry creates a new http.Handler for the delete storage s s l crt list entry operation -func NewDeleteStorageSSLCrtListEntry(ctx *middleware.Context, handler DeleteStorageSSLCrtListEntryHandler) *DeleteStorageSSLCrtListEntry { - return &DeleteStorageSSLCrtListEntry{Context: ctx, Handler: handler} -} - -/* - DeleteStorageSSLCrtListEntry swagger:route DELETE /services/haproxy/storage/ssl_crt_lists/{name}/entries Storage deleteStorageSSLCrtListEntry - -# Deletes an entry from CrtList file - -Deletes an entry from a certificate list. -*/ -type DeleteStorageSSLCrtListEntry struct { - Context *middleware.Context - Handler DeleteStorageSSLCrtListEntryHandler -} - -func (o *DeleteStorageSSLCrtListEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStorageSSLCrtListEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_entry_parameters.go b/operations/storage/delete_storage_s_s_l_crt_list_entry_parameters.go deleted file mode 100644 index 936c5042..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_entry_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteStorageSSLCrtListEntryParams creates a new DeleteStorageSSLCrtListEntryParams object -// with the default values initialized. -func NewDeleteStorageSSLCrtListEntryParams() DeleteStorageSSLCrtListEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteStorageSSLCrtListEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteStorageSSLCrtListEntryParams contains all the bound params for the delete storage s s l crt list entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteStorageSSLCrtListEntry -type DeleteStorageSSLCrtListEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL certificate filename - Required: true - In: query - */ - Certificate string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*The line number in the crt-list - Required: true - Minimum: 0 - In: query - */ - LineNumber int64 - /*SSL crt list name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStorageSSLCrtListEntryParams() beforehand. -func (o *DeleteStorageSSLCrtListEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCertificate, qhkCertificate, _ := qs.GetOK("certificate") - if err := o.bindCertificate(qCertificate, qhkCertificate, route.Formats); err != nil { - res = append(res, err) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qLineNumber, qhkLineNumber, _ := qs.GetOK("line_number") - if err := o.bindLineNumber(qLineNumber, qhkLineNumber, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCertificate binds and validates parameter Certificate from query. -func (o *DeleteStorageSSLCrtListEntryParams) bindCertificate(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("certificate", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("certificate", "query", raw); err != nil { - return err - } - o.Certificate = raw - - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteStorageSSLCrtListEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStorageSSLCrtListEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindLineNumber binds and validates parameter LineNumber from query. -func (o *DeleteStorageSSLCrtListEntryParams) bindLineNumber(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("line_number", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("line_number", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("line_number", "query", "int64", raw) - } - o.LineNumber = value - - if err := o.validateLineNumber(formats); err != nil { - return err - } - - return nil -} - -// validateLineNumber carries on validations for parameter LineNumber -func (o *DeleteStorageSSLCrtListEntryParams) validateLineNumber(formats strfmt.Registry) error { - - if err := validate.MinimumInt("line_number", "query", o.LineNumber, 0, false); err != nil { - return err - } - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteStorageSSLCrtListEntryParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_entry_responses.go b/operations/storage/delete_storage_s_s_l_crt_list_entry_responses.go deleted file mode 100644 index 4c9ecdac..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_entry_responses.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStorageSSLCrtListEntryAcceptedCode is the HTTP code returned for type DeleteStorageSSLCrtListEntryAccepted -const DeleteStorageSSLCrtListEntryAcceptedCode int = 202 - -/* -DeleteStorageSSLCrtListEntryAccepted Configuration change accepted and reload requested - -swagger:response deleteStorageSSLCrtListEntryAccepted -*/ -type DeleteStorageSSLCrtListEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteStorageSSLCrtListEntryAccepted creates DeleteStorageSSLCrtListEntryAccepted with default headers values -func NewDeleteStorageSSLCrtListEntryAccepted() *DeleteStorageSSLCrtListEntryAccepted { - - return &DeleteStorageSSLCrtListEntryAccepted{} -} - -// WithReloadID adds the reloadId to the delete storage s s l crt list entry accepted response -func (o *DeleteStorageSSLCrtListEntryAccepted) WithReloadID(reloadID string) *DeleteStorageSSLCrtListEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete storage s s l crt list entry accepted response -func (o *DeleteStorageSSLCrtListEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteStorageSSLCrtListEntryNoContentCode is the HTTP code returned for type DeleteStorageSSLCrtListEntryNoContent -const DeleteStorageSSLCrtListEntryNoContentCode int = 204 - -/* -DeleteStorageSSLCrtListEntryNoContent Successful operation - -swagger:response deleteStorageSSLCrtListEntryNoContent -*/ -type DeleteStorageSSLCrtListEntryNoContent struct { -} - -// NewDeleteStorageSSLCrtListEntryNoContent creates DeleteStorageSSLCrtListEntryNoContent with default headers values -func NewDeleteStorageSSLCrtListEntryNoContent() *DeleteStorageSSLCrtListEntryNoContent { - - return &DeleteStorageSSLCrtListEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStorageSSLCrtListEntryBadRequestCode is the HTTP code returned for type DeleteStorageSSLCrtListEntryBadRequest -const DeleteStorageSSLCrtListEntryBadRequestCode int = 400 - -/* -DeleteStorageSSLCrtListEntryBadRequest Bad request - -swagger:response deleteStorageSSLCrtListEntryBadRequest -*/ -type DeleteStorageSSLCrtListEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCrtListEntryBadRequest creates DeleteStorageSSLCrtListEntryBadRequest with default headers values -func NewDeleteStorageSSLCrtListEntryBadRequest() *DeleteStorageSSLCrtListEntryBadRequest { - - return &DeleteStorageSSLCrtListEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l crt list entry bad request response -func (o *DeleteStorageSSLCrtListEntryBadRequest) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCrtListEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l crt list entry bad request response -func (o *DeleteStorageSSLCrtListEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l crt list entry bad request response -func (o *DeleteStorageSSLCrtListEntryBadRequest) WithPayload(payload *models.Error) *DeleteStorageSSLCrtListEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l crt list entry bad request response -func (o *DeleteStorageSSLCrtListEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// DeleteStorageSSLCrtListEntryNotFoundCode is the HTTP code returned for type DeleteStorageSSLCrtListEntryNotFound -const DeleteStorageSSLCrtListEntryNotFoundCode int = 404 - -/* -DeleteStorageSSLCrtListEntryNotFound The specified resource was not found - -swagger:response deleteStorageSSLCrtListEntryNotFound -*/ -type DeleteStorageSSLCrtListEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCrtListEntryNotFound creates DeleteStorageSSLCrtListEntryNotFound with default headers values -func NewDeleteStorageSSLCrtListEntryNotFound() *DeleteStorageSSLCrtListEntryNotFound { - - return &DeleteStorageSSLCrtListEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l crt list entry not found response -func (o *DeleteStorageSSLCrtListEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCrtListEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l crt list entry not found response -func (o *DeleteStorageSSLCrtListEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l crt list entry not found response -func (o *DeleteStorageSSLCrtListEntryNotFound) WithPayload(payload *models.Error) *DeleteStorageSSLCrtListEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l crt list entry not found response -func (o *DeleteStorageSSLCrtListEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStorageSSLCrtListEntryDefault General Error - -swagger:response deleteStorageSSLCrtListEntryDefault -*/ -type DeleteStorageSSLCrtListEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCrtListEntryDefault creates DeleteStorageSSLCrtListEntryDefault with default headers values -func NewDeleteStorageSSLCrtListEntryDefault(code int) *DeleteStorageSSLCrtListEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStorageSSLCrtListEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) WithStatusCode(code int) *DeleteStorageSSLCrtListEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCrtListEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) WithPayload(payload *models.Error) *DeleteStorageSSLCrtListEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l crt list entry default response -func (o *DeleteStorageSSLCrtListEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_entry_urlbuilder.go b/operations/storage/delete_storage_s_s_l_crt_list_entry_urlbuilder.go deleted file mode 100644 index 3e5bc136..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_entry_urlbuilder.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteStorageSSLCrtListEntryURL generates an URL for the delete storage s s l crt list entry operation -type DeleteStorageSSLCrtListEntryURL struct { - Name string - - Certificate string - ForceReload *bool - LineNumber int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCrtListEntryURL) WithBasePath(bp string) *DeleteStorageSSLCrtListEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCrtListEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStorageSSLCrtListEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}/entries" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteStorageSSLCrtListEntryURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - certificateQ := o.Certificate - if certificateQ != "" { - qs.Set("certificate", certificateQ) - } - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - lineNumberQ := swag.FormatInt64(o.LineNumber) - if lineNumberQ != "" { - qs.Set("line_number", lineNumberQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStorageSSLCrtListEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStorageSSLCrtListEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStorageSSLCrtListEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStorageSSLCrtListEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStorageSSLCrtListEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStorageSSLCrtListEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_file.go b/operations/storage/delete_storage_s_s_l_crt_list_file.go deleted file mode 100644 index 35223114..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteStorageSSLCrtListFileHandlerFunc turns a function with the right signature into a delete storage s s l crt list file handler -type DeleteStorageSSLCrtListFileHandlerFunc func(DeleteStorageSSLCrtListFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteStorageSSLCrtListFileHandlerFunc) Handle(params DeleteStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteStorageSSLCrtListFileHandler interface for that can handle valid delete storage s s l crt list file params -type DeleteStorageSSLCrtListFileHandler interface { - Handle(DeleteStorageSSLCrtListFileParams, interface{}) middleware.Responder -} - -// NewDeleteStorageSSLCrtListFile creates a new http.Handler for the delete storage s s l crt list file operation -func NewDeleteStorageSSLCrtListFile(ctx *middleware.Context, handler DeleteStorageSSLCrtListFileHandler) *DeleteStorageSSLCrtListFile { - return &DeleteStorageSSLCrtListFile{Context: ctx, Handler: handler} -} - -/* - DeleteStorageSSLCrtListFile swagger:route DELETE /services/haproxy/storage/ssl_crt_lists/{name} Storage deleteStorageSSLCrtListFile - -# Delete a certificate list from disk - -Deletes a certificate list from disk. -*/ -type DeleteStorageSSLCrtListFile struct { - Context *middleware.Context - Handler DeleteStorageSSLCrtListFileHandler -} - -func (o *DeleteStorageSSLCrtListFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteStorageSSLCrtListFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_file_parameters.go b/operations/storage/delete_storage_s_s_l_crt_list_file_parameters.go deleted file mode 100644 index aad62fca..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_file_parameters.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteStorageSSLCrtListFileParams creates a new DeleteStorageSSLCrtListFileParams object -// with the default values initialized. -func NewDeleteStorageSSLCrtListFileParams() DeleteStorageSSLCrtListFileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return DeleteStorageSSLCrtListFileParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// DeleteStorageSSLCrtListFileParams contains all the bound params for the delete storage s s l crt list file operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteStorageSSLCrtListFile -type DeleteStorageSSLCrtListFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Certificate list name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteStorageSSLCrtListFileParams() beforehand. -func (o *DeleteStorageSSLCrtListFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteStorageSSLCrtListFileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStorageSSLCrtListFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteStorageSSLCrtListFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *DeleteStorageSSLCrtListFileParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteStorageSSLCrtListFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_file_responses.go b/operations/storage/delete_storage_s_s_l_crt_list_file_responses.go deleted file mode 100644 index 592c99e9..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_file_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteStorageSSLCrtListFileAcceptedCode is the HTTP code returned for type DeleteStorageSSLCrtListFileAccepted -const DeleteStorageSSLCrtListFileAcceptedCode int = 202 - -/* -DeleteStorageSSLCrtListFileAccepted Certificate list deleted and reload requested - -swagger:response deleteStorageSSLCrtListFileAccepted -*/ -type DeleteStorageSSLCrtListFileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteStorageSSLCrtListFileAccepted creates DeleteStorageSSLCrtListFileAccepted with default headers values -func NewDeleteStorageSSLCrtListFileAccepted() *DeleteStorageSSLCrtListFileAccepted { - - return &DeleteStorageSSLCrtListFileAccepted{} -} - -// WithReloadID adds the reloadId to the delete storage s s l crt list file accepted response -func (o *DeleteStorageSSLCrtListFileAccepted) WithReloadID(reloadID string) *DeleteStorageSSLCrtListFileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete storage s s l crt list file accepted response -func (o *DeleteStorageSSLCrtListFileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListFileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteStorageSSLCrtListFileNoContentCode is the HTTP code returned for type DeleteStorageSSLCrtListFileNoContent -const DeleteStorageSSLCrtListFileNoContentCode int = 204 - -/* -DeleteStorageSSLCrtListFileNoContent Certificate list deleted - -swagger:response deleteStorageSSLCrtListFileNoContent -*/ -type DeleteStorageSSLCrtListFileNoContent struct { -} - -// NewDeleteStorageSSLCrtListFileNoContent creates DeleteStorageSSLCrtListFileNoContent with default headers values -func NewDeleteStorageSSLCrtListFileNoContent() *DeleteStorageSSLCrtListFileNoContent { - - return &DeleteStorageSSLCrtListFileNoContent{} -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteStorageSSLCrtListFileNotFoundCode is the HTTP code returned for type DeleteStorageSSLCrtListFileNotFound -const DeleteStorageSSLCrtListFileNotFoundCode int = 404 - -/* -DeleteStorageSSLCrtListFileNotFound The specified resource was not found - -swagger:response deleteStorageSSLCrtListFileNotFound -*/ -type DeleteStorageSSLCrtListFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCrtListFileNotFound creates DeleteStorageSSLCrtListFileNotFound with default headers values -func NewDeleteStorageSSLCrtListFileNotFound() *DeleteStorageSSLCrtListFileNotFound { - - return &DeleteStorageSSLCrtListFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l crt list file not found response -func (o *DeleteStorageSSLCrtListFileNotFound) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCrtListFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l crt list file not found response -func (o *DeleteStorageSSLCrtListFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l crt list file not found response -func (o *DeleteStorageSSLCrtListFileNotFound) WithPayload(payload *models.Error) *DeleteStorageSSLCrtListFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l crt list file not found response -func (o *DeleteStorageSSLCrtListFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteStorageSSLCrtListFileDefault General Error - -swagger:response deleteStorageSSLCrtListFileDefault -*/ -type DeleteStorageSSLCrtListFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteStorageSSLCrtListFileDefault creates DeleteStorageSSLCrtListFileDefault with default headers values -func NewDeleteStorageSSLCrtListFileDefault(code int) *DeleteStorageSSLCrtListFileDefault { - if code <= 0 { - code = 500 - } - - return &DeleteStorageSSLCrtListFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) WithStatusCode(code int) *DeleteStorageSSLCrtListFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) WithConfigurationVersion(configurationVersion string) *DeleteStorageSSLCrtListFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) WithPayload(payload *models.Error) *DeleteStorageSSLCrtListFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete storage s s l crt list file default response -func (o *DeleteStorageSSLCrtListFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteStorageSSLCrtListFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/delete_storage_s_s_l_crt_list_file_urlbuilder.go b/operations/storage/delete_storage_s_s_l_crt_list_file_urlbuilder.go deleted file mode 100644 index 15c446f5..00000000 --- a/operations/storage/delete_storage_s_s_l_crt_list_file_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteStorageSSLCrtListFileURL generates an URL for the delete storage s s l crt list file operation -type DeleteStorageSSLCrtListFileURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCrtListFileURL) WithBasePath(bp string) *DeleteStorageSSLCrtListFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteStorageSSLCrtListFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteStorageSSLCrtListFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteStorageSSLCrtListFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteStorageSSLCrtListFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteStorageSSLCrtListFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteStorageSSLCrtListFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteStorageSSLCrtListFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteStorageSSLCrtListFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteStorageSSLCrtListFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_all_storage_general_files.go b/operations/storage/get_all_storage_general_files.go deleted file mode 100644 index 448534ef..00000000 --- a/operations/storage/get_all_storage_general_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllStorageGeneralFilesHandlerFunc turns a function with the right signature into a get all storage general files handler -type GetAllStorageGeneralFilesHandlerFunc func(GetAllStorageGeneralFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllStorageGeneralFilesHandlerFunc) Handle(params GetAllStorageGeneralFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllStorageGeneralFilesHandler interface for that can handle valid get all storage general files params -type GetAllStorageGeneralFilesHandler interface { - Handle(GetAllStorageGeneralFilesParams, interface{}) middleware.Responder -} - -// NewGetAllStorageGeneralFiles creates a new http.Handler for the get all storage general files operation -func NewGetAllStorageGeneralFiles(ctx *middleware.Context, handler GetAllStorageGeneralFilesHandler) *GetAllStorageGeneralFiles { - return &GetAllStorageGeneralFiles{Context: ctx, Handler: handler} -} - -/* - GetAllStorageGeneralFiles swagger:route GET /services/haproxy/storage/general Storage getAllStorageGeneralFiles - -# Return a list of all managed general use files - -Returns a list of all managed general use files -*/ -type GetAllStorageGeneralFiles struct { - Context *middleware.Context - Handler GetAllStorageGeneralFilesHandler -} - -func (o *GetAllStorageGeneralFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllStorageGeneralFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_all_storage_general_files_parameters.go b/operations/storage/get_all_storage_general_files_parameters.go deleted file mode 100644 index 22678508..00000000 --- a/operations/storage/get_all_storage_general_files_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllStorageGeneralFilesParams creates a new GetAllStorageGeneralFilesParams object -// -// There are no default values defined in the spec. -func NewGetAllStorageGeneralFilesParams() GetAllStorageGeneralFilesParams { - - return GetAllStorageGeneralFilesParams{} -} - -// GetAllStorageGeneralFilesParams contains all the bound params for the get all storage general files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllStorageGeneralFiles -type GetAllStorageGeneralFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllStorageGeneralFilesParams() beforehand. -func (o *GetAllStorageGeneralFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/storage/get_all_storage_general_files_responses.go b/operations/storage/get_all_storage_general_files_responses.go deleted file mode 100644 index 1bd7b8c2..00000000 --- a/operations/storage/get_all_storage_general_files_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllStorageGeneralFilesOKCode is the HTTP code returned for type GetAllStorageGeneralFilesOK -const GetAllStorageGeneralFilesOKCode int = 200 - -/* -GetAllStorageGeneralFilesOK Successful operation - -swagger:response getAllStorageGeneralFilesOK -*/ -type GetAllStorageGeneralFilesOK struct { - - /* - In: Body - */ - Payload models.GeneralFiles `json:"body,omitempty"` -} - -// NewGetAllStorageGeneralFilesOK creates GetAllStorageGeneralFilesOK with default headers values -func NewGetAllStorageGeneralFilesOK() *GetAllStorageGeneralFilesOK { - - return &GetAllStorageGeneralFilesOK{} -} - -// WithPayload adds the payload to the get all storage general files o k response -func (o *GetAllStorageGeneralFilesOK) WithPayload(payload models.GeneralFiles) *GetAllStorageGeneralFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage general files o k response -func (o *GetAllStorageGeneralFilesOK) SetPayload(payload models.GeneralFiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageGeneralFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.GeneralFiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllStorageGeneralFilesNotFoundCode is the HTTP code returned for type GetAllStorageGeneralFilesNotFound -const GetAllStorageGeneralFilesNotFoundCode int = 404 - -/* -GetAllStorageGeneralFilesNotFound The specified resource was not found - -swagger:response getAllStorageGeneralFilesNotFound -*/ -type GetAllStorageGeneralFilesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageGeneralFilesNotFound creates GetAllStorageGeneralFilesNotFound with default headers values -func NewGetAllStorageGeneralFilesNotFound() *GetAllStorageGeneralFilesNotFound { - - return &GetAllStorageGeneralFilesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage general files not found response -func (o *GetAllStorageGeneralFilesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllStorageGeneralFilesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage general files not found response -func (o *GetAllStorageGeneralFilesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage general files not found response -func (o *GetAllStorageGeneralFilesNotFound) WithPayload(payload *models.Error) *GetAllStorageGeneralFilesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage general files not found response -func (o *GetAllStorageGeneralFilesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageGeneralFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllStorageGeneralFilesDefault General Error - -swagger:response getAllStorageGeneralFilesDefault -*/ -type GetAllStorageGeneralFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageGeneralFilesDefault creates GetAllStorageGeneralFilesDefault with default headers values -func NewGetAllStorageGeneralFilesDefault(code int) *GetAllStorageGeneralFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllStorageGeneralFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) WithStatusCode(code int) *GetAllStorageGeneralFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllStorageGeneralFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) WithPayload(payload *models.Error) *GetAllStorageGeneralFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage general files default response -func (o *GetAllStorageGeneralFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageGeneralFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_all_storage_general_files_urlbuilder.go b/operations/storage/get_all_storage_general_files_urlbuilder.go deleted file mode 100644 index be00a5a9..00000000 --- a/operations/storage/get_all_storage_general_files_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllStorageGeneralFilesURL generates an URL for the get all storage general files operation -type GetAllStorageGeneralFilesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageGeneralFilesURL) WithBasePath(bp string) *GetAllStorageGeneralFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageGeneralFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllStorageGeneralFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/general" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllStorageGeneralFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllStorageGeneralFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllStorageGeneralFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllStorageGeneralFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllStorageGeneralFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllStorageGeneralFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_all_storage_map_files.go b/operations/storage/get_all_storage_map_files.go deleted file mode 100644 index f3f3cd93..00000000 --- a/operations/storage/get_all_storage_map_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllStorageMapFilesHandlerFunc turns a function with the right signature into a get all storage map files handler -type GetAllStorageMapFilesHandlerFunc func(GetAllStorageMapFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllStorageMapFilesHandlerFunc) Handle(params GetAllStorageMapFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllStorageMapFilesHandler interface for that can handle valid get all storage map files params -type GetAllStorageMapFilesHandler interface { - Handle(GetAllStorageMapFilesParams, interface{}) middleware.Responder -} - -// NewGetAllStorageMapFiles creates a new http.Handler for the get all storage map files operation -func NewGetAllStorageMapFiles(ctx *middleware.Context, handler GetAllStorageMapFilesHandler) *GetAllStorageMapFiles { - return &GetAllStorageMapFiles{Context: ctx, Handler: handler} -} - -/* - GetAllStorageMapFiles swagger:route GET /services/haproxy/storage/maps Storage getAllStorageMapFiles - -# Return a list of all managed map files - -Returns a list of all managed map files -*/ -type GetAllStorageMapFiles struct { - Context *middleware.Context - Handler GetAllStorageMapFilesHandler -} - -func (o *GetAllStorageMapFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllStorageMapFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_all_storage_map_files_parameters.go b/operations/storage/get_all_storage_map_files_parameters.go deleted file mode 100644 index ff9c5707..00000000 --- a/operations/storage/get_all_storage_map_files_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllStorageMapFilesParams creates a new GetAllStorageMapFilesParams object -// -// There are no default values defined in the spec. -func NewGetAllStorageMapFilesParams() GetAllStorageMapFilesParams { - - return GetAllStorageMapFilesParams{} -} - -// GetAllStorageMapFilesParams contains all the bound params for the get all storage map files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllStorageMapFiles -type GetAllStorageMapFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllStorageMapFilesParams() beforehand. -func (o *GetAllStorageMapFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/storage/get_all_storage_map_files_responses.go b/operations/storage/get_all_storage_map_files_responses.go deleted file mode 100644 index 9d647a2c..00000000 --- a/operations/storage/get_all_storage_map_files_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllStorageMapFilesOKCode is the HTTP code returned for type GetAllStorageMapFilesOK -const GetAllStorageMapFilesOKCode int = 200 - -/* -GetAllStorageMapFilesOK Successful operation - -swagger:response getAllStorageMapFilesOK -*/ -type GetAllStorageMapFilesOK struct { - - /* - In: Body - */ - Payload models.Maps `json:"body,omitempty"` -} - -// NewGetAllStorageMapFilesOK creates GetAllStorageMapFilesOK with default headers values -func NewGetAllStorageMapFilesOK() *GetAllStorageMapFilesOK { - - return &GetAllStorageMapFilesOK{} -} - -// WithPayload adds the payload to the get all storage map files o k response -func (o *GetAllStorageMapFilesOK) WithPayload(payload models.Maps) *GetAllStorageMapFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage map files o k response -func (o *GetAllStorageMapFilesOK) SetPayload(payload models.Maps) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageMapFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Maps{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllStorageMapFilesNotFoundCode is the HTTP code returned for type GetAllStorageMapFilesNotFound -const GetAllStorageMapFilesNotFoundCode int = 404 - -/* -GetAllStorageMapFilesNotFound The specified resource was not found - -swagger:response getAllStorageMapFilesNotFound -*/ -type GetAllStorageMapFilesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageMapFilesNotFound creates GetAllStorageMapFilesNotFound with default headers values -func NewGetAllStorageMapFilesNotFound() *GetAllStorageMapFilesNotFound { - - return &GetAllStorageMapFilesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage map files not found response -func (o *GetAllStorageMapFilesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllStorageMapFilesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage map files not found response -func (o *GetAllStorageMapFilesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage map files not found response -func (o *GetAllStorageMapFilesNotFound) WithPayload(payload *models.Error) *GetAllStorageMapFilesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage map files not found response -func (o *GetAllStorageMapFilesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageMapFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllStorageMapFilesDefault General Error - -swagger:response getAllStorageMapFilesDefault -*/ -type GetAllStorageMapFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageMapFilesDefault creates GetAllStorageMapFilesDefault with default headers values -func NewGetAllStorageMapFilesDefault(code int) *GetAllStorageMapFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllStorageMapFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) WithStatusCode(code int) *GetAllStorageMapFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllStorageMapFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) WithPayload(payload *models.Error) *GetAllStorageMapFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage map files default response -func (o *GetAllStorageMapFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageMapFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_all_storage_map_files_urlbuilder.go b/operations/storage/get_all_storage_map_files_urlbuilder.go deleted file mode 100644 index 76cf0b2b..00000000 --- a/operations/storage/get_all_storage_map_files_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllStorageMapFilesURL generates an URL for the get all storage map files operation -type GetAllStorageMapFilesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageMapFilesURL) WithBasePath(bp string) *GetAllStorageMapFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageMapFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllStorageMapFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/maps" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllStorageMapFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllStorageMapFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllStorageMapFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllStorageMapFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllStorageMapFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllStorageMapFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_all_storage_s_s_l_certificates.go b/operations/storage/get_all_storage_s_s_l_certificates.go deleted file mode 100644 index ddd95628..00000000 --- a/operations/storage/get_all_storage_s_s_l_certificates.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllStorageSSLCertificatesHandlerFunc turns a function with the right signature into a get all storage s s l certificates handler -type GetAllStorageSSLCertificatesHandlerFunc func(GetAllStorageSSLCertificatesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllStorageSSLCertificatesHandlerFunc) Handle(params GetAllStorageSSLCertificatesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllStorageSSLCertificatesHandler interface for that can handle valid get all storage s s l certificates params -type GetAllStorageSSLCertificatesHandler interface { - Handle(GetAllStorageSSLCertificatesParams, interface{}) middleware.Responder -} - -// NewGetAllStorageSSLCertificates creates a new http.Handler for the get all storage s s l certificates operation -func NewGetAllStorageSSLCertificates(ctx *middleware.Context, handler GetAllStorageSSLCertificatesHandler) *GetAllStorageSSLCertificates { - return &GetAllStorageSSLCertificates{Context: ctx, Handler: handler} -} - -/* - GetAllStorageSSLCertificates swagger:route GET /services/haproxy/storage/ssl_certificates Storage getAllStorageSSLCertificates - -# Return all available SSL certificates on disk - -Returns all available SSL certificates on disk. -*/ -type GetAllStorageSSLCertificates struct { - Context *middleware.Context - Handler GetAllStorageSSLCertificatesHandler -} - -func (o *GetAllStorageSSLCertificates) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllStorageSSLCertificatesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_all_storage_s_s_l_certificates_parameters.go b/operations/storage/get_all_storage_s_s_l_certificates_parameters.go deleted file mode 100644 index 7855f026..00000000 --- a/operations/storage/get_all_storage_s_s_l_certificates_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllStorageSSLCertificatesParams creates a new GetAllStorageSSLCertificatesParams object -// -// There are no default values defined in the spec. -func NewGetAllStorageSSLCertificatesParams() GetAllStorageSSLCertificatesParams { - - return GetAllStorageSSLCertificatesParams{} -} - -// GetAllStorageSSLCertificatesParams contains all the bound params for the get all storage s s l certificates operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllStorageSSLCertificates -type GetAllStorageSSLCertificatesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllStorageSSLCertificatesParams() beforehand. -func (o *GetAllStorageSSLCertificatesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/storage/get_all_storage_s_s_l_certificates_responses.go b/operations/storage/get_all_storage_s_s_l_certificates_responses.go deleted file mode 100644 index a430027d..00000000 --- a/operations/storage/get_all_storage_s_s_l_certificates_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllStorageSSLCertificatesOKCode is the HTTP code returned for type GetAllStorageSSLCertificatesOK -const GetAllStorageSSLCertificatesOKCode int = 200 - -/* -GetAllStorageSSLCertificatesOK Successful operation - -swagger:response getAllStorageSSLCertificatesOK -*/ -type GetAllStorageSSLCertificatesOK struct { - - /* - In: Body - */ - Payload models.SslCertificates `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCertificatesOK creates GetAllStorageSSLCertificatesOK with default headers values -func NewGetAllStorageSSLCertificatesOK() *GetAllStorageSSLCertificatesOK { - - return &GetAllStorageSSLCertificatesOK{} -} - -// WithPayload adds the payload to the get all storage s s l certificates o k response -func (o *GetAllStorageSSLCertificatesOK) WithPayload(payload models.SslCertificates) *GetAllStorageSSLCertificatesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l certificates o k response -func (o *GetAllStorageSSLCertificatesOK) SetPayload(payload models.SslCertificates) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCertificatesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCertificates{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllStorageSSLCertificatesNotFoundCode is the HTTP code returned for type GetAllStorageSSLCertificatesNotFound -const GetAllStorageSSLCertificatesNotFoundCode int = 404 - -/* -GetAllStorageSSLCertificatesNotFound The specified resource was not found - -swagger:response getAllStorageSSLCertificatesNotFound -*/ -type GetAllStorageSSLCertificatesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCertificatesNotFound creates GetAllStorageSSLCertificatesNotFound with default headers values -func NewGetAllStorageSSLCertificatesNotFound() *GetAllStorageSSLCertificatesNotFound { - - return &GetAllStorageSSLCertificatesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage s s l certificates not found response -func (o *GetAllStorageSSLCertificatesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllStorageSSLCertificatesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage s s l certificates not found response -func (o *GetAllStorageSSLCertificatesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage s s l certificates not found response -func (o *GetAllStorageSSLCertificatesNotFound) WithPayload(payload *models.Error) *GetAllStorageSSLCertificatesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l certificates not found response -func (o *GetAllStorageSSLCertificatesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCertificatesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllStorageSSLCertificatesDefault General Error - -swagger:response getAllStorageSSLCertificatesDefault -*/ -type GetAllStorageSSLCertificatesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCertificatesDefault creates GetAllStorageSSLCertificatesDefault with default headers values -func NewGetAllStorageSSLCertificatesDefault(code int) *GetAllStorageSSLCertificatesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllStorageSSLCertificatesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) WithStatusCode(code int) *GetAllStorageSSLCertificatesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) WithConfigurationVersion(configurationVersion string) *GetAllStorageSSLCertificatesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) WithPayload(payload *models.Error) *GetAllStorageSSLCertificatesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l certificates default response -func (o *GetAllStorageSSLCertificatesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCertificatesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_all_storage_s_s_l_certificates_urlbuilder.go b/operations/storage/get_all_storage_s_s_l_certificates_urlbuilder.go deleted file mode 100644 index 9fefc422..00000000 --- a/operations/storage/get_all_storage_s_s_l_certificates_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllStorageSSLCertificatesURL generates an URL for the get all storage s s l certificates operation -type GetAllStorageSSLCertificatesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageSSLCertificatesURL) WithBasePath(bp string) *GetAllStorageSSLCertificatesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageSSLCertificatesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllStorageSSLCertificatesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_certificates" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllStorageSSLCertificatesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllStorageSSLCertificatesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllStorageSSLCertificatesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllStorageSSLCertificatesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllStorageSSLCertificatesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllStorageSSLCertificatesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_all_storage_s_s_l_crt_list_files.go b/operations/storage/get_all_storage_s_s_l_crt_list_files.go deleted file mode 100644 index 665b4aea..00000000 --- a/operations/storage/get_all_storage_s_s_l_crt_list_files.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllStorageSSLCrtListFilesHandlerFunc turns a function with the right signature into a get all storage s s l crt list files handler -type GetAllStorageSSLCrtListFilesHandlerFunc func(GetAllStorageSSLCrtListFilesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllStorageSSLCrtListFilesHandlerFunc) Handle(params GetAllStorageSSLCrtListFilesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllStorageSSLCrtListFilesHandler interface for that can handle valid get all storage s s l crt list files params -type GetAllStorageSSLCrtListFilesHandler interface { - Handle(GetAllStorageSSLCrtListFilesParams, interface{}) middleware.Responder -} - -// NewGetAllStorageSSLCrtListFiles creates a new http.Handler for the get all storage s s l crt list files operation -func NewGetAllStorageSSLCrtListFiles(ctx *middleware.Context, handler GetAllStorageSSLCrtListFilesHandler) *GetAllStorageSSLCrtListFiles { - return &GetAllStorageSSLCrtListFiles{Context: ctx, Handler: handler} -} - -/* - GetAllStorageSSLCrtListFiles swagger:route GET /services/haproxy/storage/ssl_crt_lists Storage getAllStorageSSLCrtListFiles - -# Return all available certificate lists on disk - -Returns all available certificate lists on disk. -*/ -type GetAllStorageSSLCrtListFiles struct { - Context *middleware.Context - Handler GetAllStorageSSLCrtListFilesHandler -} - -func (o *GetAllStorageSSLCrtListFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllStorageSSLCrtListFilesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_all_storage_s_s_l_crt_list_files_parameters.go b/operations/storage/get_all_storage_s_s_l_crt_list_files_parameters.go deleted file mode 100644 index 523303ac..00000000 --- a/operations/storage/get_all_storage_s_s_l_crt_list_files_parameters.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetAllStorageSSLCrtListFilesParams creates a new GetAllStorageSSLCrtListFilesParams object -// -// There are no default values defined in the spec. -func NewGetAllStorageSSLCrtListFilesParams() GetAllStorageSSLCrtListFilesParams { - - return GetAllStorageSSLCrtListFilesParams{} -} - -// GetAllStorageSSLCrtListFilesParams contains all the bound params for the get all storage s s l crt list files operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllStorageSSLCrtListFiles -type GetAllStorageSSLCrtListFilesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllStorageSSLCrtListFilesParams() beforehand. -func (o *GetAllStorageSSLCrtListFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/operations/storage/get_all_storage_s_s_l_crt_list_files_responses.go b/operations/storage/get_all_storage_s_s_l_crt_list_files_responses.go deleted file mode 100644 index fcc9cc04..00000000 --- a/operations/storage/get_all_storage_s_s_l_crt_list_files_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllStorageSSLCrtListFilesOKCode is the HTTP code returned for type GetAllStorageSSLCrtListFilesOK -const GetAllStorageSSLCrtListFilesOKCode int = 200 - -/* -GetAllStorageSSLCrtListFilesOK Successful operation - -swagger:response getAllStorageSSLCrtListFilesOK -*/ -type GetAllStorageSSLCrtListFilesOK struct { - - /* - In: Body - */ - Payload models.SslCrtListFiles `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCrtListFilesOK creates GetAllStorageSSLCrtListFilesOK with default headers values -func NewGetAllStorageSSLCrtListFilesOK() *GetAllStorageSSLCrtListFilesOK { - - return &GetAllStorageSSLCrtListFilesOK{} -} - -// WithPayload adds the payload to the get all storage s s l crt list files o k response -func (o *GetAllStorageSSLCrtListFilesOK) WithPayload(payload models.SslCrtListFiles) *GetAllStorageSSLCrtListFilesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l crt list files o k response -func (o *GetAllStorageSSLCrtListFilesOK) SetPayload(payload models.SslCrtListFiles) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCrtListFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrtListFiles{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetAllStorageSSLCrtListFilesNotFoundCode is the HTTP code returned for type GetAllStorageSSLCrtListFilesNotFound -const GetAllStorageSSLCrtListFilesNotFoundCode int = 404 - -/* -GetAllStorageSSLCrtListFilesNotFound The specified resource was not found - -swagger:response getAllStorageSSLCrtListFilesNotFound -*/ -type GetAllStorageSSLCrtListFilesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCrtListFilesNotFound creates GetAllStorageSSLCrtListFilesNotFound with default headers values -func NewGetAllStorageSSLCrtListFilesNotFound() *GetAllStorageSSLCrtListFilesNotFound { - - return &GetAllStorageSSLCrtListFilesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage s s l crt list files not found response -func (o *GetAllStorageSSLCrtListFilesNotFound) WithConfigurationVersion(configurationVersion string) *GetAllStorageSSLCrtListFilesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage s s l crt list files not found response -func (o *GetAllStorageSSLCrtListFilesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage s s l crt list files not found response -func (o *GetAllStorageSSLCrtListFilesNotFound) WithPayload(payload *models.Error) *GetAllStorageSSLCrtListFilesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l crt list files not found response -func (o *GetAllStorageSSLCrtListFilesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCrtListFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetAllStorageSSLCrtListFilesDefault General Error - -swagger:response getAllStorageSSLCrtListFilesDefault -*/ -type GetAllStorageSSLCrtListFilesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllStorageSSLCrtListFilesDefault creates GetAllStorageSSLCrtListFilesDefault with default headers values -func NewGetAllStorageSSLCrtListFilesDefault(code int) *GetAllStorageSSLCrtListFilesDefault { - if code <= 0 { - code = 500 - } - - return &GetAllStorageSSLCrtListFilesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) WithStatusCode(code int) *GetAllStorageSSLCrtListFilesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) WithConfigurationVersion(configurationVersion string) *GetAllStorageSSLCrtListFilesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) WithPayload(payload *models.Error) *GetAllStorageSSLCrtListFilesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all storage s s l crt list files default response -func (o *GetAllStorageSSLCrtListFilesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllStorageSSLCrtListFilesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_all_storage_s_s_l_crt_list_files_urlbuilder.go b/operations/storage/get_all_storage_s_s_l_crt_list_files_urlbuilder.go deleted file mode 100644 index 3205d184..00000000 --- a/operations/storage/get_all_storage_s_s_l_crt_list_files_urlbuilder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetAllStorageSSLCrtListFilesURL generates an URL for the get all storage s s l crt list files operation -type GetAllStorageSSLCrtListFilesURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageSSLCrtListFilesURL) WithBasePath(bp string) *GetAllStorageSSLCrtListFilesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllStorageSSLCrtListFilesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllStorageSSLCrtListFilesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllStorageSSLCrtListFilesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllStorageSSLCrtListFilesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllStorageSSLCrtListFilesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllStorageSSLCrtListFilesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllStorageSSLCrtListFilesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllStorageSSLCrtListFilesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_one_storage_general_file.go b/operations/storage/get_one_storage_general_file.go deleted file mode 100644 index e22c4aa7..00000000 --- a/operations/storage/get_one_storage_general_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOneStorageGeneralFileHandlerFunc turns a function with the right signature into a get one storage general file handler -type GetOneStorageGeneralFileHandlerFunc func(GetOneStorageGeneralFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneStorageGeneralFileHandlerFunc) Handle(params GetOneStorageGeneralFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneStorageGeneralFileHandler interface for that can handle valid get one storage general file params -type GetOneStorageGeneralFileHandler interface { - Handle(GetOneStorageGeneralFileParams, interface{}) middleware.Responder -} - -// NewGetOneStorageGeneralFile creates a new http.Handler for the get one storage general file operation -func NewGetOneStorageGeneralFile(ctx *middleware.Context, handler GetOneStorageGeneralFileHandler) *GetOneStorageGeneralFile { - return &GetOneStorageGeneralFile{Context: ctx, Handler: handler} -} - -/* - GetOneStorageGeneralFile swagger:route GET /services/haproxy/storage/general/{name} Storage getOneStorageGeneralFile - -# Return the contents of one managed general use file from disk - -Returns the contents of one managed general use file from disk -*/ -type GetOneStorageGeneralFile struct { - Context *middleware.Context - Handler GetOneStorageGeneralFileHandler -} - -func (o *GetOneStorageGeneralFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneStorageGeneralFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_one_storage_general_file_parameters.go b/operations/storage/get_one_storage_general_file_parameters.go deleted file mode 100644 index d12cb8d6..00000000 --- a/operations/storage/get_one_storage_general_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneStorageGeneralFileParams creates a new GetOneStorageGeneralFileParams object -// -// There are no default values defined in the spec. -func NewGetOneStorageGeneralFileParams() GetOneStorageGeneralFileParams { - - return GetOneStorageGeneralFileParams{} -} - -// GetOneStorageGeneralFileParams contains all the bound params for the get one storage general file operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneStorageGeneralFile -type GetOneStorageGeneralFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*General use file storage_name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneStorageGeneralFileParams() beforehand. -func (o *GetOneStorageGeneralFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneStorageGeneralFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/get_one_storage_general_file_responses.go b/operations/storage/get_one_storage_general_file_responses.go deleted file mode 100644 index 6800e3aa..00000000 --- a/operations/storage/get_one_storage_general_file_responses.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneStorageGeneralFileOKCode is the HTTP code returned for type GetOneStorageGeneralFileOK -const GetOneStorageGeneralFileOKCode int = 200 - -/* -GetOneStorageGeneralFileOK Successful operation - -swagger:response getOneStorageGeneralFileOK -*/ -type GetOneStorageGeneralFileOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewGetOneStorageGeneralFileOK creates GetOneStorageGeneralFileOK with default headers values -func NewGetOneStorageGeneralFileOK() *GetOneStorageGeneralFileOK { - - return &GetOneStorageGeneralFileOK{} -} - -// WithPayload adds the payload to the get one storage general file o k response -func (o *GetOneStorageGeneralFileOK) WithPayload(payload io.ReadCloser) *GetOneStorageGeneralFileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage general file o k response -func (o *GetOneStorageGeneralFileOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageGeneralFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetOneStorageGeneralFileNotFoundCode is the HTTP code returned for type GetOneStorageGeneralFileNotFound -const GetOneStorageGeneralFileNotFoundCode int = 404 - -/* -GetOneStorageGeneralFileNotFound The specified resource was not found - -swagger:response getOneStorageGeneralFileNotFound -*/ -type GetOneStorageGeneralFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageGeneralFileNotFound creates GetOneStorageGeneralFileNotFound with default headers values -func NewGetOneStorageGeneralFileNotFound() *GetOneStorageGeneralFileNotFound { - - return &GetOneStorageGeneralFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage general file not found response -func (o *GetOneStorageGeneralFileNotFound) WithConfigurationVersion(configurationVersion string) *GetOneStorageGeneralFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage general file not found response -func (o *GetOneStorageGeneralFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage general file not found response -func (o *GetOneStorageGeneralFileNotFound) WithPayload(payload *models.Error) *GetOneStorageGeneralFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage general file not found response -func (o *GetOneStorageGeneralFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageGeneralFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneStorageGeneralFileDefault General Error - -swagger:response getOneStorageGeneralFileDefault -*/ -type GetOneStorageGeneralFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageGeneralFileDefault creates GetOneStorageGeneralFileDefault with default headers values -func NewGetOneStorageGeneralFileDefault(code int) *GetOneStorageGeneralFileDefault { - if code <= 0 { - code = 500 - } - - return &GetOneStorageGeneralFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) WithStatusCode(code int) *GetOneStorageGeneralFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) WithConfigurationVersion(configurationVersion string) *GetOneStorageGeneralFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) WithPayload(payload *models.Error) *GetOneStorageGeneralFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage general file default response -func (o *GetOneStorageGeneralFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageGeneralFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_one_storage_general_file_urlbuilder.go b/operations/storage/get_one_storage_general_file_urlbuilder.go deleted file mode 100644 index 08983005..00000000 --- a/operations/storage/get_one_storage_general_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneStorageGeneralFileURL generates an URL for the get one storage general file operation -type GetOneStorageGeneralFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageGeneralFileURL) WithBasePath(bp string) *GetOneStorageGeneralFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageGeneralFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneStorageGeneralFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/general/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneStorageGeneralFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneStorageGeneralFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneStorageGeneralFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneStorageGeneralFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneStorageGeneralFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneStorageGeneralFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneStorageGeneralFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_one_storage_map.go b/operations/storage/get_one_storage_map.go deleted file mode 100644 index 592cacd2..00000000 --- a/operations/storage/get_one_storage_map.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOneStorageMapHandlerFunc turns a function with the right signature into a get one storage map handler -type GetOneStorageMapHandlerFunc func(GetOneStorageMapParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneStorageMapHandlerFunc) Handle(params GetOneStorageMapParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneStorageMapHandler interface for that can handle valid get one storage map params -type GetOneStorageMapHandler interface { - Handle(GetOneStorageMapParams, interface{}) middleware.Responder -} - -// NewGetOneStorageMap creates a new http.Handler for the get one storage map operation -func NewGetOneStorageMap(ctx *middleware.Context, handler GetOneStorageMapHandler) *GetOneStorageMap { - return &GetOneStorageMap{Context: ctx, Handler: handler} -} - -/* - GetOneStorageMap swagger:route GET /services/haproxy/storage/maps/{name} Storage getOneStorageMap - -# Return the contents of one managed map file from disk - -Returns the contents of one managed map file from disk -*/ -type GetOneStorageMap struct { - Context *middleware.Context - Handler GetOneStorageMapHandler -} - -func (o *GetOneStorageMap) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneStorageMapParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_one_storage_map_parameters.go b/operations/storage/get_one_storage_map_parameters.go deleted file mode 100644 index 551543f4..00000000 --- a/operations/storage/get_one_storage_map_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneStorageMapParams creates a new GetOneStorageMapParams object -// -// There are no default values defined in the spec. -func NewGetOneStorageMapParams() GetOneStorageMapParams { - - return GetOneStorageMapParams{} -} - -// GetOneStorageMapParams contains all the bound params for the get one storage map operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneStorageMap -type GetOneStorageMapParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Map file storage_name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneStorageMapParams() beforehand. -func (o *GetOneStorageMapParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneStorageMapParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/get_one_storage_map_responses.go b/operations/storage/get_one_storage_map_responses.go deleted file mode 100644 index 3d2f90ff..00000000 --- a/operations/storage/get_one_storage_map_responses.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneStorageMapOKCode is the HTTP code returned for type GetOneStorageMapOK -const GetOneStorageMapOKCode int = 200 - -/* -GetOneStorageMapOK Successful operation - -swagger:response getOneStorageMapOK -*/ -type GetOneStorageMapOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewGetOneStorageMapOK creates GetOneStorageMapOK with default headers values -func NewGetOneStorageMapOK() *GetOneStorageMapOK { - - return &GetOneStorageMapOK{} -} - -// WithPayload adds the payload to the get one storage map o k response -func (o *GetOneStorageMapOK) WithPayload(payload io.ReadCloser) *GetOneStorageMapOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage map o k response -func (o *GetOneStorageMapOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageMapOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetOneStorageMapNotFoundCode is the HTTP code returned for type GetOneStorageMapNotFound -const GetOneStorageMapNotFoundCode int = 404 - -/* -GetOneStorageMapNotFound The specified resource was not found - -swagger:response getOneStorageMapNotFound -*/ -type GetOneStorageMapNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageMapNotFound creates GetOneStorageMapNotFound with default headers values -func NewGetOneStorageMapNotFound() *GetOneStorageMapNotFound { - - return &GetOneStorageMapNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage map not found response -func (o *GetOneStorageMapNotFound) WithConfigurationVersion(configurationVersion string) *GetOneStorageMapNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage map not found response -func (o *GetOneStorageMapNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage map not found response -func (o *GetOneStorageMapNotFound) WithPayload(payload *models.Error) *GetOneStorageMapNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage map not found response -func (o *GetOneStorageMapNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageMapNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneStorageMapDefault General Error - -swagger:response getOneStorageMapDefault -*/ -type GetOneStorageMapDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageMapDefault creates GetOneStorageMapDefault with default headers values -func NewGetOneStorageMapDefault(code int) *GetOneStorageMapDefault { - if code <= 0 { - code = 500 - } - - return &GetOneStorageMapDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one storage map default response -func (o *GetOneStorageMapDefault) WithStatusCode(code int) *GetOneStorageMapDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one storage map default response -func (o *GetOneStorageMapDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage map default response -func (o *GetOneStorageMapDefault) WithConfigurationVersion(configurationVersion string) *GetOneStorageMapDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage map default response -func (o *GetOneStorageMapDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage map default response -func (o *GetOneStorageMapDefault) WithPayload(payload *models.Error) *GetOneStorageMapDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage map default response -func (o *GetOneStorageMapDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageMapDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_one_storage_map_urlbuilder.go b/operations/storage/get_one_storage_map_urlbuilder.go deleted file mode 100644 index 95692e05..00000000 --- a/operations/storage/get_one_storage_map_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneStorageMapURL generates an URL for the get one storage map operation -type GetOneStorageMapURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageMapURL) WithBasePath(bp string) *GetOneStorageMapURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageMapURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneStorageMapURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneStorageMapURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneStorageMapURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneStorageMapURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneStorageMapURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneStorageMapURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneStorageMapURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneStorageMapURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_one_storage_s_s_l_certificate.go b/operations/storage/get_one_storage_s_s_l_certificate.go deleted file mode 100644 index 1ea58439..00000000 --- a/operations/storage/get_one_storage_s_s_l_certificate.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOneStorageSSLCertificateHandlerFunc turns a function with the right signature into a get one storage s s l certificate handler -type GetOneStorageSSLCertificateHandlerFunc func(GetOneStorageSSLCertificateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneStorageSSLCertificateHandlerFunc) Handle(params GetOneStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneStorageSSLCertificateHandler interface for that can handle valid get one storage s s l certificate params -type GetOneStorageSSLCertificateHandler interface { - Handle(GetOneStorageSSLCertificateParams, interface{}) middleware.Responder -} - -// NewGetOneStorageSSLCertificate creates a new http.Handler for the get one storage s s l certificate operation -func NewGetOneStorageSSLCertificate(ctx *middleware.Context, handler GetOneStorageSSLCertificateHandler) *GetOneStorageSSLCertificate { - return &GetOneStorageSSLCertificate{Context: ctx, Handler: handler} -} - -/* - GetOneStorageSSLCertificate swagger:route GET /services/haproxy/storage/ssl_certificates/{name} Storage getOneStorageSSLCertificate - -# Return one SSL certificate from disk - -Returns one SSL certificate from disk. -*/ -type GetOneStorageSSLCertificate struct { - Context *middleware.Context - Handler GetOneStorageSSLCertificateHandler -} - -func (o *GetOneStorageSSLCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneStorageSSLCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_one_storage_s_s_l_certificate_parameters.go b/operations/storage/get_one_storage_s_s_l_certificate_parameters.go deleted file mode 100644 index f83f0e51..00000000 --- a/operations/storage/get_one_storage_s_s_l_certificate_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneStorageSSLCertificateParams creates a new GetOneStorageSSLCertificateParams object -// -// There are no default values defined in the spec. -func NewGetOneStorageSSLCertificateParams() GetOneStorageSSLCertificateParams { - - return GetOneStorageSSLCertificateParams{} -} - -// GetOneStorageSSLCertificateParams contains all the bound params for the get one storage s s l certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneStorageSSLCertificate -type GetOneStorageSSLCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL certificate name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneStorageSSLCertificateParams() beforehand. -func (o *GetOneStorageSSLCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneStorageSSLCertificateParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/get_one_storage_s_s_l_certificate_responses.go b/operations/storage/get_one_storage_s_s_l_certificate_responses.go deleted file mode 100644 index 5bacf8ed..00000000 --- a/operations/storage/get_one_storage_s_s_l_certificate_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneStorageSSLCertificateOKCode is the HTTP code returned for type GetOneStorageSSLCertificateOK -const GetOneStorageSSLCertificateOKCode int = 200 - -/* -GetOneStorageSSLCertificateOK Successful operation - -swagger:response getOneStorageSSLCertificateOK -*/ -type GetOneStorageSSLCertificateOK struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCertificateOK creates GetOneStorageSSLCertificateOK with default headers values -func NewGetOneStorageSSLCertificateOK() *GetOneStorageSSLCertificateOK { - - return &GetOneStorageSSLCertificateOK{} -} - -// WithPayload adds the payload to the get one storage s s l certificate o k response -func (o *GetOneStorageSSLCertificateOK) WithPayload(payload *models.SslCertificate) *GetOneStorageSSLCertificateOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l certificate o k response -func (o *GetOneStorageSSLCertificateOK) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetOneStorageSSLCertificateNotFoundCode is the HTTP code returned for type GetOneStorageSSLCertificateNotFound -const GetOneStorageSSLCertificateNotFoundCode int = 404 - -/* -GetOneStorageSSLCertificateNotFound The specified resource was not found - -swagger:response getOneStorageSSLCertificateNotFound -*/ -type GetOneStorageSSLCertificateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCertificateNotFound creates GetOneStorageSSLCertificateNotFound with default headers values -func NewGetOneStorageSSLCertificateNotFound() *GetOneStorageSSLCertificateNotFound { - - return &GetOneStorageSSLCertificateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage s s l certificate not found response -func (o *GetOneStorageSSLCertificateNotFound) WithConfigurationVersion(configurationVersion string) *GetOneStorageSSLCertificateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage s s l certificate not found response -func (o *GetOneStorageSSLCertificateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage s s l certificate not found response -func (o *GetOneStorageSSLCertificateNotFound) WithPayload(payload *models.Error) *GetOneStorageSSLCertificateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l certificate not found response -func (o *GetOneStorageSSLCertificateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCertificateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneStorageSSLCertificateDefault General Error - -swagger:response getOneStorageSSLCertificateDefault -*/ -type GetOneStorageSSLCertificateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCertificateDefault creates GetOneStorageSSLCertificateDefault with default headers values -func NewGetOneStorageSSLCertificateDefault(code int) *GetOneStorageSSLCertificateDefault { - if code <= 0 { - code = 500 - } - - return &GetOneStorageSSLCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) WithStatusCode(code int) *GetOneStorageSSLCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) WithConfigurationVersion(configurationVersion string) *GetOneStorageSSLCertificateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) WithPayload(payload *models.Error) *GetOneStorageSSLCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l certificate default response -func (o *GetOneStorageSSLCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_one_storage_s_s_l_certificate_urlbuilder.go b/operations/storage/get_one_storage_s_s_l_certificate_urlbuilder.go deleted file mode 100644 index 7433e883..00000000 --- a/operations/storage/get_one_storage_s_s_l_certificate_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneStorageSSLCertificateURL generates an URL for the get one storage s s l certificate operation -type GetOneStorageSSLCertificateURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageSSLCertificateURL) WithBasePath(bp string) *GetOneStorageSSLCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageSSLCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneStorageSSLCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_certificates/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneStorageSSLCertificateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneStorageSSLCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneStorageSSLCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneStorageSSLCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneStorageSSLCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneStorageSSLCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneStorageSSLCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_one_storage_s_s_l_crt_list_file.go b/operations/storage/get_one_storage_s_s_l_crt_list_file.go deleted file mode 100644 index 03e272e0..00000000 --- a/operations/storage/get_one_storage_s_s_l_crt_list_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetOneStorageSSLCrtListFileHandlerFunc turns a function with the right signature into a get one storage s s l crt list file handler -type GetOneStorageSSLCrtListFileHandlerFunc func(GetOneStorageSSLCrtListFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetOneStorageSSLCrtListFileHandlerFunc) Handle(params GetOneStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetOneStorageSSLCrtListFileHandler interface for that can handle valid get one storage s s l crt list file params -type GetOneStorageSSLCrtListFileHandler interface { - Handle(GetOneStorageSSLCrtListFileParams, interface{}) middleware.Responder -} - -// NewGetOneStorageSSLCrtListFile creates a new http.Handler for the get one storage s s l crt list file operation -func NewGetOneStorageSSLCrtListFile(ctx *middleware.Context, handler GetOneStorageSSLCrtListFileHandler) *GetOneStorageSSLCrtListFile { - return &GetOneStorageSSLCrtListFile{Context: ctx, Handler: handler} -} - -/* - GetOneStorageSSLCrtListFile swagger:route GET /services/haproxy/storage/ssl_crt_lists/{name} Storage getOneStorageSSLCrtListFile - -# Return one certificate list from disk - -Returns one certificate list from disk. -*/ -type GetOneStorageSSLCrtListFile struct { - Context *middleware.Context - Handler GetOneStorageSSLCrtListFileHandler -} - -func (o *GetOneStorageSSLCrtListFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetOneStorageSSLCrtListFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_one_storage_s_s_l_crt_list_file_parameters.go b/operations/storage/get_one_storage_s_s_l_crt_list_file_parameters.go deleted file mode 100644 index 1ecaf089..00000000 --- a/operations/storage/get_one_storage_s_s_l_crt_list_file_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetOneStorageSSLCrtListFileParams creates a new GetOneStorageSSLCrtListFileParams object -// -// There are no default values defined in the spec. -func NewGetOneStorageSSLCrtListFileParams() GetOneStorageSSLCrtListFileParams { - - return GetOneStorageSSLCrtListFileParams{} -} - -// GetOneStorageSSLCrtListFileParams contains all the bound params for the get one storage s s l crt list file operation -// typically these are obtained from a http.Request -// -// swagger:parameters getOneStorageSSLCrtListFile -type GetOneStorageSSLCrtListFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Certificate list name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetOneStorageSSLCrtListFileParams() beforehand. -func (o *GetOneStorageSSLCrtListFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetOneStorageSSLCrtListFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/get_one_storage_s_s_l_crt_list_file_responses.go b/operations/storage/get_one_storage_s_s_l_crt_list_file_responses.go deleted file mode 100644 index 6847a95a..00000000 --- a/operations/storage/get_one_storage_s_s_l_crt_list_file_responses.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetOneStorageSSLCrtListFileOKCode is the HTTP code returned for type GetOneStorageSSLCrtListFileOK -const GetOneStorageSSLCrtListFileOKCode int = 200 - -/* -GetOneStorageSSLCrtListFileOK Successful operation - -swagger:response getOneStorageSSLCrtListFileOK -*/ -type GetOneStorageSSLCrtListFileOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCrtListFileOK creates GetOneStorageSSLCrtListFileOK with default headers values -func NewGetOneStorageSSLCrtListFileOK() *GetOneStorageSSLCrtListFileOK { - - return &GetOneStorageSSLCrtListFileOK{} -} - -// WithPayload adds the payload to the get one storage s s l crt list file o k response -func (o *GetOneStorageSSLCrtListFileOK) WithPayload(payload io.ReadCloser) *GetOneStorageSSLCrtListFileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l crt list file o k response -func (o *GetOneStorageSSLCrtListFileOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCrtListFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetOneStorageSSLCrtListFileNotFoundCode is the HTTP code returned for type GetOneStorageSSLCrtListFileNotFound -const GetOneStorageSSLCrtListFileNotFoundCode int = 404 - -/* -GetOneStorageSSLCrtListFileNotFound The specified resource was not found - -swagger:response getOneStorageSSLCrtListFileNotFound -*/ -type GetOneStorageSSLCrtListFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCrtListFileNotFound creates GetOneStorageSSLCrtListFileNotFound with default headers values -func NewGetOneStorageSSLCrtListFileNotFound() *GetOneStorageSSLCrtListFileNotFound { - - return &GetOneStorageSSLCrtListFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage s s l crt list file not found response -func (o *GetOneStorageSSLCrtListFileNotFound) WithConfigurationVersion(configurationVersion string) *GetOneStorageSSLCrtListFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage s s l crt list file not found response -func (o *GetOneStorageSSLCrtListFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage s s l crt list file not found response -func (o *GetOneStorageSSLCrtListFileNotFound) WithPayload(payload *models.Error) *GetOneStorageSSLCrtListFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l crt list file not found response -func (o *GetOneStorageSSLCrtListFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCrtListFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetOneStorageSSLCrtListFileDefault General Error - -swagger:response getOneStorageSSLCrtListFileDefault -*/ -type GetOneStorageSSLCrtListFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetOneStorageSSLCrtListFileDefault creates GetOneStorageSSLCrtListFileDefault with default headers values -func NewGetOneStorageSSLCrtListFileDefault(code int) *GetOneStorageSSLCrtListFileDefault { - if code <= 0 { - code = 500 - } - - return &GetOneStorageSSLCrtListFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) WithStatusCode(code int) *GetOneStorageSSLCrtListFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) WithConfigurationVersion(configurationVersion string) *GetOneStorageSSLCrtListFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) WithPayload(payload *models.Error) *GetOneStorageSSLCrtListFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get one storage s s l crt list file default response -func (o *GetOneStorageSSLCrtListFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOneStorageSSLCrtListFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_one_storage_s_s_l_crt_list_file_urlbuilder.go b/operations/storage/get_one_storage_s_s_l_crt_list_file_urlbuilder.go deleted file mode 100644 index 1b664e40..00000000 --- a/operations/storage/get_one_storage_s_s_l_crt_list_file_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetOneStorageSSLCrtListFileURL generates an URL for the get one storage s s l crt list file operation -type GetOneStorageSSLCrtListFileURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageSSLCrtListFileURL) WithBasePath(bp string) *GetOneStorageSSLCrtListFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetOneStorageSSLCrtListFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetOneStorageSSLCrtListFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetOneStorageSSLCrtListFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetOneStorageSSLCrtListFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetOneStorageSSLCrtListFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetOneStorageSSLCrtListFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetOneStorageSSLCrtListFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetOneStorageSSLCrtListFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetOneStorageSSLCrtListFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/get_storage_s_s_l_crt_list_entries.go b/operations/storage/get_storage_s_s_l_crt_list_entries.go deleted file mode 100644 index e795550a..00000000 --- a/operations/storage/get_storage_s_s_l_crt_list_entries.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetStorageSSLCrtListEntriesHandlerFunc turns a function with the right signature into a get storage s s l crt list entries handler -type GetStorageSSLCrtListEntriesHandlerFunc func(GetStorageSSLCrtListEntriesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetStorageSSLCrtListEntriesHandlerFunc) Handle(params GetStorageSSLCrtListEntriesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetStorageSSLCrtListEntriesHandler interface for that can handle valid get storage s s l crt list entries params -type GetStorageSSLCrtListEntriesHandler interface { - Handle(GetStorageSSLCrtListEntriesParams, interface{}) middleware.Responder -} - -// NewGetStorageSSLCrtListEntries creates a new http.Handler for the get storage s s l crt list entries operation -func NewGetStorageSSLCrtListEntries(ctx *middleware.Context, handler GetStorageSSLCrtListEntriesHandler) *GetStorageSSLCrtListEntries { - return &GetStorageSSLCrtListEntries{Context: ctx, Handler: handler} -} - -/* - GetStorageSSLCrtListEntries swagger:route GET /services/haproxy/storage/ssl_crt_lists/{name}/entries Storage getStorageSSLCrtListEntries - -# Returns all the entries in a CrtList - -Returns all the entries in a certificate list. -*/ -type GetStorageSSLCrtListEntries struct { - Context *middleware.Context - Handler GetStorageSSLCrtListEntriesHandler -} - -func (o *GetStorageSSLCrtListEntries) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetStorageSSLCrtListEntriesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/get_storage_s_s_l_crt_list_entries_parameters.go b/operations/storage/get_storage_s_s_l_crt_list_entries_parameters.go deleted file mode 100644 index 20be6659..00000000 --- a/operations/storage/get_storage_s_s_l_crt_list_entries_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetStorageSSLCrtListEntriesParams creates a new GetStorageSSLCrtListEntriesParams object -// -// There are no default values defined in the spec. -func NewGetStorageSSLCrtListEntriesParams() GetStorageSSLCrtListEntriesParams { - - return GetStorageSSLCrtListEntriesParams{} -} - -// GetStorageSSLCrtListEntriesParams contains all the bound params for the get storage s s l crt list entries operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetStorageSSLCrtListEntries -type GetStorageSSLCrtListEntriesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*SSL crt-list file - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetStorageSSLCrtListEntriesParams() beforehand. -func (o *GetStorageSSLCrtListEntriesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetStorageSSLCrtListEntriesParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/operations/storage/get_storage_s_s_l_crt_list_entries_responses.go b/operations/storage/get_storage_s_s_l_crt_list_entries_responses.go deleted file mode 100644 index 6e06bf68..00000000 --- a/operations/storage/get_storage_s_s_l_crt_list_entries_responses.go +++ /dev/null @@ -1,225 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetStorageSSLCrtListEntriesOKCode is the HTTP code returned for type GetStorageSSLCrtListEntriesOK -const GetStorageSSLCrtListEntriesOKCode int = 200 - -/* -GetStorageSSLCrtListEntriesOK Successful operation - -swagger:response getStorageSSLCrtListEntriesOK -*/ -type GetStorageSSLCrtListEntriesOK struct { - - /* - In: Body - */ - Payload models.SslCrtListEntries `json:"body,omitempty"` -} - -// NewGetStorageSSLCrtListEntriesOK creates GetStorageSSLCrtListEntriesOK with default headers values -func NewGetStorageSSLCrtListEntriesOK() *GetStorageSSLCrtListEntriesOK { - - return &GetStorageSSLCrtListEntriesOK{} -} - -// WithPayload adds the payload to the get storage s s l crt list entries o k response -func (o *GetStorageSSLCrtListEntriesOK) WithPayload(payload models.SslCrtListEntries) *GetStorageSSLCrtListEntriesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get storage s s l crt list entries o k response -func (o *GetStorageSSLCrtListEntriesOK) SetPayload(payload models.SslCrtListEntries) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStorageSSLCrtListEntriesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SslCrtListEntries{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// GetStorageSSLCrtListEntriesNotFoundCode is the HTTP code returned for type GetStorageSSLCrtListEntriesNotFound -const GetStorageSSLCrtListEntriesNotFoundCode int = 404 - -/* -GetStorageSSLCrtListEntriesNotFound The specified resource was not found - -swagger:response getStorageSSLCrtListEntriesNotFound -*/ -type GetStorageSSLCrtListEntriesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStorageSSLCrtListEntriesNotFound creates GetStorageSSLCrtListEntriesNotFound with default headers values -func NewGetStorageSSLCrtListEntriesNotFound() *GetStorageSSLCrtListEntriesNotFound { - - return &GetStorageSSLCrtListEntriesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get storage s s l crt list entries not found response -func (o *GetStorageSSLCrtListEntriesNotFound) WithConfigurationVersion(configurationVersion string) *GetStorageSSLCrtListEntriesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get storage s s l crt list entries not found response -func (o *GetStorageSSLCrtListEntriesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get storage s s l crt list entries not found response -func (o *GetStorageSSLCrtListEntriesNotFound) WithPayload(payload *models.Error) *GetStorageSSLCrtListEntriesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get storage s s l crt list entries not found response -func (o *GetStorageSSLCrtListEntriesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStorageSSLCrtListEntriesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetStorageSSLCrtListEntriesDefault General Error - -swagger:response getStorageSSLCrtListEntriesDefault -*/ -type GetStorageSSLCrtListEntriesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetStorageSSLCrtListEntriesDefault creates GetStorageSSLCrtListEntriesDefault with default headers values -func NewGetStorageSSLCrtListEntriesDefault(code int) *GetStorageSSLCrtListEntriesDefault { - if code <= 0 { - code = 500 - } - - return &GetStorageSSLCrtListEntriesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) WithStatusCode(code int) *GetStorageSSLCrtListEntriesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) WithConfigurationVersion(configurationVersion string) *GetStorageSSLCrtListEntriesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) WithPayload(payload *models.Error) *GetStorageSSLCrtListEntriesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get storage s s l crt list entries default response -func (o *GetStorageSSLCrtListEntriesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetStorageSSLCrtListEntriesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/get_storage_s_s_l_crt_list_entries_urlbuilder.go b/operations/storage/get_storage_s_s_l_crt_list_entries_urlbuilder.go deleted file mode 100644 index ed4452ea..00000000 --- a/operations/storage/get_storage_s_s_l_crt_list_entries_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetStorageSSLCrtListEntriesURL generates an URL for the get storage s s l crt list entries operation -type GetStorageSSLCrtListEntriesURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStorageSSLCrtListEntriesURL) WithBasePath(bp string) *GetStorageSSLCrtListEntriesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetStorageSSLCrtListEntriesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetStorageSSLCrtListEntriesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}/entries" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetStorageSSLCrtListEntriesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetStorageSSLCrtListEntriesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetStorageSSLCrtListEntriesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetStorageSSLCrtListEntriesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetStorageSSLCrtListEntriesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetStorageSSLCrtListEntriesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetStorageSSLCrtListEntriesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/replace_storage_general_file.go b/operations/storage/replace_storage_general_file.go deleted file mode 100644 index 55743f99..00000000 --- a/operations/storage/replace_storage_general_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStorageGeneralFileHandlerFunc turns a function with the right signature into a replace storage general file handler -type ReplaceStorageGeneralFileHandlerFunc func(ReplaceStorageGeneralFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStorageGeneralFileHandlerFunc) Handle(params ReplaceStorageGeneralFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStorageGeneralFileHandler interface for that can handle valid replace storage general file params -type ReplaceStorageGeneralFileHandler interface { - Handle(ReplaceStorageGeneralFileParams, interface{}) middleware.Responder -} - -// NewReplaceStorageGeneralFile creates a new http.Handler for the replace storage general file operation -func NewReplaceStorageGeneralFile(ctx *middleware.Context, handler ReplaceStorageGeneralFileHandler) *ReplaceStorageGeneralFile { - return &ReplaceStorageGeneralFile{Context: ctx, Handler: handler} -} - -/* - ReplaceStorageGeneralFile swagger:route PUT /services/haproxy/storage/general/{name} Storage replaceStorageGeneralFile - -# Replace contents of a managed general use file on disk - -Replaces the contents of a managed general use file on disk -*/ -type ReplaceStorageGeneralFile struct { - Context *middleware.Context - Handler ReplaceStorageGeneralFileHandler -} - -func (o *ReplaceStorageGeneralFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStorageGeneralFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/replace_storage_general_file_parameters.go b/operations/storage/replace_storage_general_file_parameters.go deleted file mode 100644 index 7d0db4c7..00000000 --- a/operations/storage/replace_storage_general_file_parameters.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ReplaceStorageGeneralFileMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var ReplaceStorageGeneralFileMaxParseMemory int64 = 32 << 20 - -// NewReplaceStorageGeneralFileParams creates a new ReplaceStorageGeneralFileParams object -// with the default values initialized. -func NewReplaceStorageGeneralFileParams() ReplaceStorageGeneralFileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return ReplaceStorageGeneralFileParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// ReplaceStorageGeneralFileParams contains all the bound params for the replace storage general file operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStorageGeneralFile -type ReplaceStorageGeneralFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*General use file content - In: formData - */ - FileUpload io.ReadCloser - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*General use file storage_name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStorageGeneralFileParams() beforehand. -func (o *ReplaceStorageGeneralFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if err := r.ParseMultipartForm(ReplaceStorageGeneralFileMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - fileUpload, fileUploadHeader, err := r.FormFile("file_upload") - if err != nil && err != http.ErrMissingFile { - res = append(res, errors.New(400, "reading file %q failed: %v", "fileUpload", err)) - } else if err == http.ErrMissingFile { - // no-op for missing but optional file parameter - } else if err := o.bindFileUpload(fileUpload, fileUploadHeader); err != nil { - res = append(res, err) - } else { - o.FileUpload = &runtime.File{Data: fileUpload, Header: fileUploadHeader} - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFileUpload binds file parameter FileUpload. -// -// The only supported validations on files are MinLength and MaxLength -func (o *ReplaceStorageGeneralFileParams) bindFileUpload(file multipart.File, header *multipart.FileHeader) error { - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStorageGeneralFileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageGeneralFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceStorageGeneralFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *ReplaceStorageGeneralFileParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageGeneralFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/replace_storage_general_file_responses.go b/operations/storage/replace_storage_general_file_responses.go deleted file mode 100644 index 464bdfa3..00000000 --- a/operations/storage/replace_storage_general_file_responses.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStorageGeneralFileAcceptedCode is the HTTP code returned for type ReplaceStorageGeneralFileAccepted -const ReplaceStorageGeneralFileAcceptedCode int = 202 - -/* -ReplaceStorageGeneralFileAccepted Configuration change accepted and reload requested - -swagger:response replaceStorageGeneralFileAccepted -*/ -type ReplaceStorageGeneralFileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewReplaceStorageGeneralFileAccepted creates ReplaceStorageGeneralFileAccepted with default headers values -func NewReplaceStorageGeneralFileAccepted() *ReplaceStorageGeneralFileAccepted { - - return &ReplaceStorageGeneralFileAccepted{} -} - -// WithReloadID adds the reloadId to the replace storage general file accepted response -func (o *ReplaceStorageGeneralFileAccepted) WithReloadID(reloadID string) *ReplaceStorageGeneralFileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace storage general file accepted response -func (o *ReplaceStorageGeneralFileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *ReplaceStorageGeneralFileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// ReplaceStorageGeneralFileNoContentCode is the HTTP code returned for type ReplaceStorageGeneralFileNoContent -const ReplaceStorageGeneralFileNoContentCode int = 204 - -/* -ReplaceStorageGeneralFileNoContent General use file replaced - -swagger:response replaceStorageGeneralFileNoContent -*/ -type ReplaceStorageGeneralFileNoContent struct { -} - -// NewReplaceStorageGeneralFileNoContent creates ReplaceStorageGeneralFileNoContent with default headers values -func NewReplaceStorageGeneralFileNoContent() *ReplaceStorageGeneralFileNoContent { - - return &ReplaceStorageGeneralFileNoContent{} -} - -// WriteResponse to the client -func (o *ReplaceStorageGeneralFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// ReplaceStorageGeneralFileBadRequestCode is the HTTP code returned for type ReplaceStorageGeneralFileBadRequest -const ReplaceStorageGeneralFileBadRequestCode int = 400 - -/* -ReplaceStorageGeneralFileBadRequest Bad request - -swagger:response replaceStorageGeneralFileBadRequest -*/ -type ReplaceStorageGeneralFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageGeneralFileBadRequest creates ReplaceStorageGeneralFileBadRequest with default headers values -func NewReplaceStorageGeneralFileBadRequest() *ReplaceStorageGeneralFileBadRequest { - - return &ReplaceStorageGeneralFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage general file bad request response -func (o *ReplaceStorageGeneralFileBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStorageGeneralFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage general file bad request response -func (o *ReplaceStorageGeneralFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage general file bad request response -func (o *ReplaceStorageGeneralFileBadRequest) WithPayload(payload *models.Error) *ReplaceStorageGeneralFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage general file bad request response -func (o *ReplaceStorageGeneralFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageGeneralFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageGeneralFileNotFoundCode is the HTTP code returned for type ReplaceStorageGeneralFileNotFound -const ReplaceStorageGeneralFileNotFoundCode int = 404 - -/* -ReplaceStorageGeneralFileNotFound The specified resource was not found - -swagger:response replaceStorageGeneralFileNotFound -*/ -type ReplaceStorageGeneralFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageGeneralFileNotFound creates ReplaceStorageGeneralFileNotFound with default headers values -func NewReplaceStorageGeneralFileNotFound() *ReplaceStorageGeneralFileNotFound { - - return &ReplaceStorageGeneralFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage general file not found response -func (o *ReplaceStorageGeneralFileNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceStorageGeneralFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage general file not found response -func (o *ReplaceStorageGeneralFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage general file not found response -func (o *ReplaceStorageGeneralFileNotFound) WithPayload(payload *models.Error) *ReplaceStorageGeneralFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage general file not found response -func (o *ReplaceStorageGeneralFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageGeneralFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStorageGeneralFileDefault General Error - -swagger:response replaceStorageGeneralFileDefault -*/ -type ReplaceStorageGeneralFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageGeneralFileDefault creates ReplaceStorageGeneralFileDefault with default headers values -func NewReplaceStorageGeneralFileDefault(code int) *ReplaceStorageGeneralFileDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStorageGeneralFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) WithStatusCode(code int) *ReplaceStorageGeneralFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStorageGeneralFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) WithPayload(payload *models.Error) *ReplaceStorageGeneralFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage general file default response -func (o *ReplaceStorageGeneralFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageGeneralFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/replace_storage_general_file_urlbuilder.go b/operations/storage/replace_storage_general_file_urlbuilder.go deleted file mode 100644 index 878d6435..00000000 --- a/operations/storage/replace_storage_general_file_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStorageGeneralFileURL generates an URL for the replace storage general file operation -type ReplaceStorageGeneralFileURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageGeneralFileURL) WithBasePath(bp string) *ReplaceStorageGeneralFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageGeneralFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStorageGeneralFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/general/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceStorageGeneralFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStorageGeneralFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStorageGeneralFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStorageGeneralFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStorageGeneralFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStorageGeneralFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStorageGeneralFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/replace_storage_map_file.go b/operations/storage/replace_storage_map_file.go deleted file mode 100644 index 51e8daa8..00000000 --- a/operations/storage/replace_storage_map_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStorageMapFileHandlerFunc turns a function with the right signature into a replace storage map file handler -type ReplaceStorageMapFileHandlerFunc func(ReplaceStorageMapFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStorageMapFileHandlerFunc) Handle(params ReplaceStorageMapFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStorageMapFileHandler interface for that can handle valid replace storage map file params -type ReplaceStorageMapFileHandler interface { - Handle(ReplaceStorageMapFileParams, interface{}) middleware.Responder -} - -// NewReplaceStorageMapFile creates a new http.Handler for the replace storage map file operation -func NewReplaceStorageMapFile(ctx *middleware.Context, handler ReplaceStorageMapFileHandler) *ReplaceStorageMapFile { - return &ReplaceStorageMapFile{Context: ctx, Handler: handler} -} - -/* - ReplaceStorageMapFile swagger:route PUT /services/haproxy/storage/maps/{name} Storage replaceStorageMapFile - -# Replace contents of a managed map file on disk - -Replaces the contents of a managed map file on disk -*/ -type ReplaceStorageMapFile struct { - Context *middleware.Context - Handler ReplaceStorageMapFileHandler -} - -func (o *ReplaceStorageMapFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStorageMapFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/replace_storage_map_file_parameters.go b/operations/storage/replace_storage_map_file_parameters.go deleted file mode 100644 index 761ac80c..00000000 --- a/operations/storage/replace_storage_map_file_parameters.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewReplaceStorageMapFileParams creates a new ReplaceStorageMapFileParams object -// with the default values initialized. -func NewReplaceStorageMapFileParams() ReplaceStorageMapFileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return ReplaceStorageMapFileParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// ReplaceStorageMapFileParams contains all the bound params for the replace storage map file operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStorageMapFile -type ReplaceStorageMapFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Map file storage_name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStorageMapFileParams() beforehand. -func (o *ReplaceStorageMapFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body string - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // no validation required on inline body - o.Data = body - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStorageMapFileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageMapFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceStorageMapFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *ReplaceStorageMapFileParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageMapFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/replace_storage_map_file_responses.go b/operations/storage/replace_storage_map_file_responses.go deleted file mode 100644 index 30884fb1..00000000 --- a/operations/storage/replace_storage_map_file_responses.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStorageMapFileAcceptedCode is the HTTP code returned for type ReplaceStorageMapFileAccepted -const ReplaceStorageMapFileAcceptedCode int = 202 - -/* -ReplaceStorageMapFileAccepted Configuration change accepted and reload requested - -swagger:response replaceStorageMapFileAccepted -*/ -type ReplaceStorageMapFileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewReplaceStorageMapFileAccepted creates ReplaceStorageMapFileAccepted with default headers values -func NewReplaceStorageMapFileAccepted() *ReplaceStorageMapFileAccepted { - - return &ReplaceStorageMapFileAccepted{} -} - -// WithReloadID adds the reloadId to the replace storage map file accepted response -func (o *ReplaceStorageMapFileAccepted) WithReloadID(reloadID string) *ReplaceStorageMapFileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace storage map file accepted response -func (o *ReplaceStorageMapFileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *ReplaceStorageMapFileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// ReplaceStorageMapFileNoContentCode is the HTTP code returned for type ReplaceStorageMapFileNoContent -const ReplaceStorageMapFileNoContentCode int = 204 - -/* -ReplaceStorageMapFileNoContent Map file replaced - -swagger:response replaceStorageMapFileNoContent -*/ -type ReplaceStorageMapFileNoContent struct { -} - -// NewReplaceStorageMapFileNoContent creates ReplaceStorageMapFileNoContent with default headers values -func NewReplaceStorageMapFileNoContent() *ReplaceStorageMapFileNoContent { - - return &ReplaceStorageMapFileNoContent{} -} - -// WriteResponse to the client -func (o *ReplaceStorageMapFileNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// ReplaceStorageMapFileBadRequestCode is the HTTP code returned for type ReplaceStorageMapFileBadRequest -const ReplaceStorageMapFileBadRequestCode int = 400 - -/* -ReplaceStorageMapFileBadRequest Bad request - -swagger:response replaceStorageMapFileBadRequest -*/ -type ReplaceStorageMapFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageMapFileBadRequest creates ReplaceStorageMapFileBadRequest with default headers values -func NewReplaceStorageMapFileBadRequest() *ReplaceStorageMapFileBadRequest { - - return &ReplaceStorageMapFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage map file bad request response -func (o *ReplaceStorageMapFileBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStorageMapFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage map file bad request response -func (o *ReplaceStorageMapFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage map file bad request response -func (o *ReplaceStorageMapFileBadRequest) WithPayload(payload *models.Error) *ReplaceStorageMapFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage map file bad request response -func (o *ReplaceStorageMapFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageMapFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageMapFileNotFoundCode is the HTTP code returned for type ReplaceStorageMapFileNotFound -const ReplaceStorageMapFileNotFoundCode int = 404 - -/* -ReplaceStorageMapFileNotFound The specified resource was not found - -swagger:response replaceStorageMapFileNotFound -*/ -type ReplaceStorageMapFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageMapFileNotFound creates ReplaceStorageMapFileNotFound with default headers values -func NewReplaceStorageMapFileNotFound() *ReplaceStorageMapFileNotFound { - - return &ReplaceStorageMapFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage map file not found response -func (o *ReplaceStorageMapFileNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceStorageMapFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage map file not found response -func (o *ReplaceStorageMapFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage map file not found response -func (o *ReplaceStorageMapFileNotFound) WithPayload(payload *models.Error) *ReplaceStorageMapFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage map file not found response -func (o *ReplaceStorageMapFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageMapFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStorageMapFileDefault General Error - -swagger:response replaceStorageMapFileDefault -*/ -type ReplaceStorageMapFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageMapFileDefault creates ReplaceStorageMapFileDefault with default headers values -func NewReplaceStorageMapFileDefault(code int) *ReplaceStorageMapFileDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStorageMapFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) WithStatusCode(code int) *ReplaceStorageMapFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStorageMapFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) WithPayload(payload *models.Error) *ReplaceStorageMapFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage map file default response -func (o *ReplaceStorageMapFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageMapFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/replace_storage_map_file_urlbuilder.go b/operations/storage/replace_storage_map_file_urlbuilder.go deleted file mode 100644 index 6ed2f527..00000000 --- a/operations/storage/replace_storage_map_file_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStorageMapFileURL generates an URL for the replace storage map file operation -type ReplaceStorageMapFileURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageMapFileURL) WithBasePath(bp string) *ReplaceStorageMapFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageMapFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStorageMapFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/maps/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceStorageMapFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStorageMapFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStorageMapFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStorageMapFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStorageMapFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStorageMapFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStorageMapFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/replace_storage_s_s_l_certificate.go b/operations/storage/replace_storage_s_s_l_certificate.go deleted file mode 100644 index 858c718c..00000000 --- a/operations/storage/replace_storage_s_s_l_certificate.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStorageSSLCertificateHandlerFunc turns a function with the right signature into a replace storage s s l certificate handler -type ReplaceStorageSSLCertificateHandlerFunc func(ReplaceStorageSSLCertificateParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStorageSSLCertificateHandlerFunc) Handle(params ReplaceStorageSSLCertificateParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStorageSSLCertificateHandler interface for that can handle valid replace storage s s l certificate params -type ReplaceStorageSSLCertificateHandler interface { - Handle(ReplaceStorageSSLCertificateParams, interface{}) middleware.Responder -} - -// NewReplaceStorageSSLCertificate creates a new http.Handler for the replace storage s s l certificate operation -func NewReplaceStorageSSLCertificate(ctx *middleware.Context, handler ReplaceStorageSSLCertificateHandler) *ReplaceStorageSSLCertificate { - return &ReplaceStorageSSLCertificate{Context: ctx, Handler: handler} -} - -/* - ReplaceStorageSSLCertificate swagger:route PUT /services/haproxy/storage/ssl_certificates/{name} Storage replaceStorageSSLCertificate - -# Replace SSL certificates on disk - -Replaces SSL certificate on disk. -*/ -type ReplaceStorageSSLCertificate struct { - Context *middleware.Context - Handler ReplaceStorageSSLCertificateHandler -} - -func (o *ReplaceStorageSSLCertificate) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStorageSSLCertificateParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/replace_storage_s_s_l_certificate_parameters.go b/operations/storage/replace_storage_s_s_l_certificate_parameters.go deleted file mode 100644 index 75daa74c..00000000 --- a/operations/storage/replace_storage_s_s_l_certificate_parameters.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewReplaceStorageSSLCertificateParams creates a new ReplaceStorageSSLCertificateParams object -// with the default values initialized. -func NewReplaceStorageSSLCertificateParams() ReplaceStorageSSLCertificateParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return ReplaceStorageSSLCertificateParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// ReplaceStorageSSLCertificateParams contains all the bound params for the replace storage s s l certificate operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStorageSSLCertificate -type ReplaceStorageSSLCertificateParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*SSL certificate name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStorageSSLCertificateParams() beforehand. -func (o *ReplaceStorageSSLCertificateParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body string - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // no validation required on inline body - o.Data = body - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStorageSSLCertificateParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceStorageSSLCertificateParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *ReplaceStorageSSLCertificateParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageSSLCertificateParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/replace_storage_s_s_l_certificate_responses.go b/operations/storage/replace_storage_s_s_l_certificate_responses.go deleted file mode 100644 index a5472616..00000000 --- a/operations/storage/replace_storage_s_s_l_certificate_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStorageSSLCertificateOKCode is the HTTP code returned for type ReplaceStorageSSLCertificateOK -const ReplaceStorageSSLCertificateOKCode int = 200 - -/* -ReplaceStorageSSLCertificateOK SSL certificate replaced - -swagger:response replaceStorageSSLCertificateOK -*/ -type ReplaceStorageSSLCertificateOK struct { - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCertificateOK creates ReplaceStorageSSLCertificateOK with default headers values -func NewReplaceStorageSSLCertificateOK() *ReplaceStorageSSLCertificateOK { - - return &ReplaceStorageSSLCertificateOK{} -} - -// WithPayload adds the payload to the replace storage s s l certificate o k response -func (o *ReplaceStorageSSLCertificateOK) WithPayload(payload *models.SslCertificate) *ReplaceStorageSSLCertificateOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l certificate o k response -func (o *ReplaceStorageSSLCertificateOK) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCertificateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCertificateAcceptedCode is the HTTP code returned for type ReplaceStorageSSLCertificateAccepted -const ReplaceStorageSSLCertificateAcceptedCode int = 202 - -/* -ReplaceStorageSSLCertificateAccepted SSL certificate replaced and reload requested - -swagger:response replaceStorageSSLCertificateAccepted -*/ -type ReplaceStorageSSLCertificateAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SslCertificate `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCertificateAccepted creates ReplaceStorageSSLCertificateAccepted with default headers values -func NewReplaceStorageSSLCertificateAccepted() *ReplaceStorageSSLCertificateAccepted { - - return &ReplaceStorageSSLCertificateAccepted{} -} - -// WithReloadID adds the reloadId to the replace storage s s l certificate accepted response -func (o *ReplaceStorageSSLCertificateAccepted) WithReloadID(reloadID string) *ReplaceStorageSSLCertificateAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace storage s s l certificate accepted response -func (o *ReplaceStorageSSLCertificateAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace storage s s l certificate accepted response -func (o *ReplaceStorageSSLCertificateAccepted) WithPayload(payload *models.SslCertificate) *ReplaceStorageSSLCertificateAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l certificate accepted response -func (o *ReplaceStorageSSLCertificateAccepted) SetPayload(payload *models.SslCertificate) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCertificateAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCertificateBadRequestCode is the HTTP code returned for type ReplaceStorageSSLCertificateBadRequest -const ReplaceStorageSSLCertificateBadRequestCode int = 400 - -/* -ReplaceStorageSSLCertificateBadRequest Bad request - -swagger:response replaceStorageSSLCertificateBadRequest -*/ -type ReplaceStorageSSLCertificateBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCertificateBadRequest creates ReplaceStorageSSLCertificateBadRequest with default headers values -func NewReplaceStorageSSLCertificateBadRequest() *ReplaceStorageSSLCertificateBadRequest { - - return &ReplaceStorageSSLCertificateBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l certificate bad request response -func (o *ReplaceStorageSSLCertificateBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCertificateBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l certificate bad request response -func (o *ReplaceStorageSSLCertificateBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l certificate bad request response -func (o *ReplaceStorageSSLCertificateBadRequest) WithPayload(payload *models.Error) *ReplaceStorageSSLCertificateBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l certificate bad request response -func (o *ReplaceStorageSSLCertificateBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCertificateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCertificateNotFoundCode is the HTTP code returned for type ReplaceStorageSSLCertificateNotFound -const ReplaceStorageSSLCertificateNotFoundCode int = 404 - -/* -ReplaceStorageSSLCertificateNotFound The specified resource was not found - -swagger:response replaceStorageSSLCertificateNotFound -*/ -type ReplaceStorageSSLCertificateNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCertificateNotFound creates ReplaceStorageSSLCertificateNotFound with default headers values -func NewReplaceStorageSSLCertificateNotFound() *ReplaceStorageSSLCertificateNotFound { - - return &ReplaceStorageSSLCertificateNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l certificate not found response -func (o *ReplaceStorageSSLCertificateNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCertificateNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l certificate not found response -func (o *ReplaceStorageSSLCertificateNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l certificate not found response -func (o *ReplaceStorageSSLCertificateNotFound) WithPayload(payload *models.Error) *ReplaceStorageSSLCertificateNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l certificate not found response -func (o *ReplaceStorageSSLCertificateNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCertificateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStorageSSLCertificateDefault General Error - -swagger:response replaceStorageSSLCertificateDefault -*/ -type ReplaceStorageSSLCertificateDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCertificateDefault creates ReplaceStorageSSLCertificateDefault with default headers values -func NewReplaceStorageSSLCertificateDefault(code int) *ReplaceStorageSSLCertificateDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStorageSSLCertificateDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) WithStatusCode(code int) *ReplaceStorageSSLCertificateDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCertificateDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) WithPayload(payload *models.Error) *ReplaceStorageSSLCertificateDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l certificate default response -func (o *ReplaceStorageSSLCertificateDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCertificateDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/replace_storage_s_s_l_certificate_urlbuilder.go b/operations/storage/replace_storage_s_s_l_certificate_urlbuilder.go deleted file mode 100644 index 9a3edd7d..00000000 --- a/operations/storage/replace_storage_s_s_l_certificate_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStorageSSLCertificateURL generates an URL for the replace storage s s l certificate operation -type ReplaceStorageSSLCertificateURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageSSLCertificateURL) WithBasePath(bp string) *ReplaceStorageSSLCertificateURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageSSLCertificateURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStorageSSLCertificateURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_certificates/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceStorageSSLCertificateURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStorageSSLCertificateURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStorageSSLCertificateURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStorageSSLCertificateURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStorageSSLCertificateURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStorageSSLCertificateURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStorageSSLCertificateURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/storage/replace_storage_s_s_l_crt_list_file.go b/operations/storage/replace_storage_s_s_l_crt_list_file.go deleted file mode 100644 index 6d379f7e..00000000 --- a/operations/storage/replace_storage_s_s_l_crt_list_file.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceStorageSSLCrtListFileHandlerFunc turns a function with the right signature into a replace storage s s l crt list file handler -type ReplaceStorageSSLCrtListFileHandlerFunc func(ReplaceStorageSSLCrtListFileParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceStorageSSLCrtListFileHandlerFunc) Handle(params ReplaceStorageSSLCrtListFileParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceStorageSSLCrtListFileHandler interface for that can handle valid replace storage s s l crt list file params -type ReplaceStorageSSLCrtListFileHandler interface { - Handle(ReplaceStorageSSLCrtListFileParams, interface{}) middleware.Responder -} - -// NewReplaceStorageSSLCrtListFile creates a new http.Handler for the replace storage s s l crt list file operation -func NewReplaceStorageSSLCrtListFile(ctx *middleware.Context, handler ReplaceStorageSSLCrtListFileHandler) *ReplaceStorageSSLCrtListFile { - return &ReplaceStorageSSLCrtListFile{Context: ctx, Handler: handler} -} - -/* - ReplaceStorageSSLCrtListFile swagger:route PUT /services/haproxy/storage/ssl_crt_lists/{name} Storage replaceStorageSSLCrtListFile - -# Replace a certificate lists on disk - -Replaces a certificate list on disk. -*/ -type ReplaceStorageSSLCrtListFile struct { - Context *middleware.Context - Handler ReplaceStorageSSLCrtListFileHandler -} - -func (o *ReplaceStorageSSLCrtListFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceStorageSSLCrtListFileParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/storage/replace_storage_s_s_l_crt_list_file_parameters.go b/operations/storage/replace_storage_s_s_l_crt_list_file_parameters.go deleted file mode 100644 index d7c4f4f0..00000000 --- a/operations/storage/replace_storage_s_s_l_crt_list_file_parameters.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewReplaceStorageSSLCrtListFileParams creates a new ReplaceStorageSSLCrtListFileParams object -// with the default values initialized. -func NewReplaceStorageSSLCrtListFileParams() ReplaceStorageSSLCrtListFileParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - - skipReloadDefault = bool(false) - ) - - return ReplaceStorageSSLCrtListFileParams{ - ForceReload: &forceReloadDefault, - - SkipReload: &skipReloadDefault, - } -} - -// ReplaceStorageSSLCrtListFileParams contains all the bound params for the replace storage s s l crt list file operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceStorageSSLCrtListFile -type ReplaceStorageSSLCrtListFileParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data string - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Certificate list name - Required: true - In: path - */ - Name string - /*If set, no reload will be initiated after update - In: query - Default: false - */ - SkipReload *bool -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceStorageSSLCrtListFileParams() beforehand. -func (o *ReplaceStorageSSLCrtListFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body string - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // no validation required on inline body - o.Data = body - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qSkipReload, qhkSkipReload, _ := qs.GetOK("skip_reload") - if err := o.bindSkipReload(qSkipReload, qhkSkipReload, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceStorageSSLCrtListFileParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageSSLCrtListFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceStorageSSLCrtListFileParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindSkipReload binds and validates parameter SkipReload from query. -func (o *ReplaceStorageSSLCrtListFileParams) bindSkipReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceStorageSSLCrtListFileParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("skip_reload", "query", "bool", raw) - } - o.SkipReload = &value - - return nil -} diff --git a/operations/storage/replace_storage_s_s_l_crt_list_file_responses.go b/operations/storage/replace_storage_s_s_l_crt_list_file_responses.go deleted file mode 100644 index 25ad7941..00000000 --- a/operations/storage/replace_storage_s_s_l_crt_list_file_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceStorageSSLCrtListFileOKCode is the HTTP code returned for type ReplaceStorageSSLCrtListFileOK -const ReplaceStorageSSLCrtListFileOKCode int = 200 - -/* -ReplaceStorageSSLCrtListFileOK Certificate list replaced - -swagger:response replaceStorageSSLCrtListFileOK -*/ -type ReplaceStorageSSLCrtListFileOK struct { - - /* - In: Body - */ - Payload *models.SslCrtListFile `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCrtListFileOK creates ReplaceStorageSSLCrtListFileOK with default headers values -func NewReplaceStorageSSLCrtListFileOK() *ReplaceStorageSSLCrtListFileOK { - - return &ReplaceStorageSSLCrtListFileOK{} -} - -// WithPayload adds the payload to the replace storage s s l crt list file o k response -func (o *ReplaceStorageSSLCrtListFileOK) WithPayload(payload *models.SslCrtListFile) *ReplaceStorageSSLCrtListFileOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l crt list file o k response -func (o *ReplaceStorageSSLCrtListFileOK) SetPayload(payload *models.SslCrtListFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCrtListFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCrtListFileAcceptedCode is the HTTP code returned for type ReplaceStorageSSLCrtListFileAccepted -const ReplaceStorageSSLCrtListFileAcceptedCode int = 202 - -/* -ReplaceStorageSSLCrtListFileAccepted Certificate list replaced and reload requested - -swagger:response replaceStorageSSLCrtListFileAccepted -*/ -type ReplaceStorageSSLCrtListFileAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.SslCrtListFile `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCrtListFileAccepted creates ReplaceStorageSSLCrtListFileAccepted with default headers values -func NewReplaceStorageSSLCrtListFileAccepted() *ReplaceStorageSSLCrtListFileAccepted { - - return &ReplaceStorageSSLCrtListFileAccepted{} -} - -// WithReloadID adds the reloadId to the replace storage s s l crt list file accepted response -func (o *ReplaceStorageSSLCrtListFileAccepted) WithReloadID(reloadID string) *ReplaceStorageSSLCrtListFileAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace storage s s l crt list file accepted response -func (o *ReplaceStorageSSLCrtListFileAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace storage s s l crt list file accepted response -func (o *ReplaceStorageSSLCrtListFileAccepted) WithPayload(payload *models.SslCrtListFile) *ReplaceStorageSSLCrtListFileAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l crt list file accepted response -func (o *ReplaceStorageSSLCrtListFileAccepted) SetPayload(payload *models.SslCrtListFile) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCrtListFileAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCrtListFileBadRequestCode is the HTTP code returned for type ReplaceStorageSSLCrtListFileBadRequest -const ReplaceStorageSSLCrtListFileBadRequestCode int = 400 - -/* -ReplaceStorageSSLCrtListFileBadRequest Bad request - -swagger:response replaceStorageSSLCrtListFileBadRequest -*/ -type ReplaceStorageSSLCrtListFileBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCrtListFileBadRequest creates ReplaceStorageSSLCrtListFileBadRequest with default headers values -func NewReplaceStorageSSLCrtListFileBadRequest() *ReplaceStorageSSLCrtListFileBadRequest { - - return &ReplaceStorageSSLCrtListFileBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l crt list file bad request response -func (o *ReplaceStorageSSLCrtListFileBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCrtListFileBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l crt list file bad request response -func (o *ReplaceStorageSSLCrtListFileBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l crt list file bad request response -func (o *ReplaceStorageSSLCrtListFileBadRequest) WithPayload(payload *models.Error) *ReplaceStorageSSLCrtListFileBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l crt list file bad request response -func (o *ReplaceStorageSSLCrtListFileBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCrtListFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceStorageSSLCrtListFileNotFoundCode is the HTTP code returned for type ReplaceStorageSSLCrtListFileNotFound -const ReplaceStorageSSLCrtListFileNotFoundCode int = 404 - -/* -ReplaceStorageSSLCrtListFileNotFound The specified resource was not found - -swagger:response replaceStorageSSLCrtListFileNotFound -*/ -type ReplaceStorageSSLCrtListFileNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCrtListFileNotFound creates ReplaceStorageSSLCrtListFileNotFound with default headers values -func NewReplaceStorageSSLCrtListFileNotFound() *ReplaceStorageSSLCrtListFileNotFound { - - return &ReplaceStorageSSLCrtListFileNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l crt list file not found response -func (o *ReplaceStorageSSLCrtListFileNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCrtListFileNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l crt list file not found response -func (o *ReplaceStorageSSLCrtListFileNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l crt list file not found response -func (o *ReplaceStorageSSLCrtListFileNotFound) WithPayload(payload *models.Error) *ReplaceStorageSSLCrtListFileNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l crt list file not found response -func (o *ReplaceStorageSSLCrtListFileNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCrtListFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceStorageSSLCrtListFileDefault General Error - -swagger:response replaceStorageSSLCrtListFileDefault -*/ -type ReplaceStorageSSLCrtListFileDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceStorageSSLCrtListFileDefault creates ReplaceStorageSSLCrtListFileDefault with default headers values -func NewReplaceStorageSSLCrtListFileDefault(code int) *ReplaceStorageSSLCrtListFileDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceStorageSSLCrtListFileDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) WithStatusCode(code int) *ReplaceStorageSSLCrtListFileDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) WithConfigurationVersion(configurationVersion string) *ReplaceStorageSSLCrtListFileDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) WithPayload(payload *models.Error) *ReplaceStorageSSLCrtListFileDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace storage s s l crt list file default response -func (o *ReplaceStorageSSLCrtListFileDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceStorageSSLCrtListFileDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/storage/replace_storage_s_s_l_crt_list_file_urlbuilder.go b/operations/storage/replace_storage_s_s_l_crt_list_file_urlbuilder.go deleted file mode 100644 index f0480ff0..00000000 --- a/operations/storage/replace_storage_s_s_l_crt_list_file_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package storage - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceStorageSSLCrtListFileURL generates an URL for the replace storage s s l crt list file operation -type ReplaceStorageSSLCrtListFileURL struct { - Name string - - ForceReload *bool - SkipReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageSSLCrtListFileURL) WithBasePath(bp string) *ReplaceStorageSSLCrtListFileURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceStorageSSLCrtListFileURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceStorageSSLCrtListFileURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/storage/ssl_crt_lists/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceStorageSSLCrtListFileURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var skipReloadQ string - if o.SkipReload != nil { - skipReloadQ = swag.FormatBool(*o.SkipReload) - } - if skipReloadQ != "" { - qs.Set("skip_reload", skipReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceStorageSSLCrtListFileURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceStorageSSLCrtListFileURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceStorageSSLCrtListFileURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceStorageSSLCrtListFileURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceStorageSSLCrtListFileURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceStorageSSLCrtListFileURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/table/create_table.go b/operations/table/create_table.go deleted file mode 100644 index 8a98a93c..00000000 --- a/operations/table/create_table.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTableHandlerFunc turns a function with the right signature into a create table handler -type CreateTableHandlerFunc func(CreateTableParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTableHandlerFunc) Handle(params CreateTableParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTableHandler interface for that can handle valid create table params -type CreateTableHandler interface { - Handle(CreateTableParams, interface{}) middleware.Responder -} - -// NewCreateTable creates a new http.Handler for the create table operation -func NewCreateTable(ctx *middleware.Context, handler CreateTableHandler) *CreateTable { - return &CreateTable{Context: ctx, Handler: handler} -} - -/* - CreateTable swagger:route POST /services/haproxy/configuration/peers/{parent_name}/tables Table createTable - -# Add a new table - -Adds a new table in the specified peer section in the configuration file. -*/ -type CreateTable struct { - Context *middleware.Context - Handler CreateTableHandler -} - -func (o *CreateTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTableParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/table/create_table_parameters.go b/operations/table/create_table_parameters.go deleted file mode 100644 index 722a4edc..00000000 --- a/operations/table/create_table_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTableParams creates a new CreateTableParams object -// with the default values initialized. -func NewCreateTableParams() CreateTableParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTableParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTableParams contains all the bound params for the create table operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTable -type CreateTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Table - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTableParams() beforehand. -func (o *CreateTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Table - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTableParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTableParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTableParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTableParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTableParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/table/create_table_responses.go b/operations/table/create_table_responses.go deleted file mode 100644 index c0662b00..00000000 --- a/operations/table/create_table_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTableCreatedCode is the HTTP code returned for type CreateTableCreated -const CreateTableCreatedCode int = 201 - -/* -CreateTableCreated Table created - -swagger:response createTableCreated -*/ -type CreateTableCreated struct { - - /* - In: Body - */ - Payload *models.Table `json:"body,omitempty"` -} - -// NewCreateTableCreated creates CreateTableCreated with default headers values -func NewCreateTableCreated() *CreateTableCreated { - - return &CreateTableCreated{} -} - -// WithPayload adds the payload to the create table created response -func (o *CreateTableCreated) WithPayload(payload *models.Table) *CreateTableCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create table created response -func (o *CreateTableCreated) SetPayload(payload *models.Table) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTableCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTableAcceptedCode is the HTTP code returned for type CreateTableAccepted -const CreateTableAcceptedCode int = 202 - -/* -CreateTableAccepted Configuration change accepted and reload requested - -swagger:response createTableAccepted -*/ -type CreateTableAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Table `json:"body,omitempty"` -} - -// NewCreateTableAccepted creates CreateTableAccepted with default headers values -func NewCreateTableAccepted() *CreateTableAccepted { - - return &CreateTableAccepted{} -} - -// WithReloadID adds the reloadId to the create table accepted response -func (o *CreateTableAccepted) WithReloadID(reloadID string) *CreateTableAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create table accepted response -func (o *CreateTableAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create table accepted response -func (o *CreateTableAccepted) WithPayload(payload *models.Table) *CreateTableAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create table accepted response -func (o *CreateTableAccepted) SetPayload(payload *models.Table) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTableAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTableBadRequestCode is the HTTP code returned for type CreateTableBadRequest -const CreateTableBadRequestCode int = 400 - -/* -CreateTableBadRequest Bad request - -swagger:response createTableBadRequest -*/ -type CreateTableBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTableBadRequest creates CreateTableBadRequest with default headers values -func NewCreateTableBadRequest() *CreateTableBadRequest { - - return &CreateTableBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create table bad request response -func (o *CreateTableBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTableBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create table bad request response -func (o *CreateTableBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create table bad request response -func (o *CreateTableBadRequest) WithPayload(payload *models.Error) *CreateTableBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create table bad request response -func (o *CreateTableBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTableBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTableConflictCode is the HTTP code returned for type CreateTableConflict -const CreateTableConflictCode int = 409 - -/* -CreateTableConflict The specified resource already exists - -swagger:response createTableConflict -*/ -type CreateTableConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTableConflict creates CreateTableConflict with default headers values -func NewCreateTableConflict() *CreateTableConflict { - - return &CreateTableConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create table conflict response -func (o *CreateTableConflict) WithConfigurationVersion(configurationVersion string) *CreateTableConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create table conflict response -func (o *CreateTableConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create table conflict response -func (o *CreateTableConflict) WithPayload(payload *models.Error) *CreateTableConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create table conflict response -func (o *CreateTableConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTableConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTableDefault General Error - -swagger:response createTableDefault -*/ -type CreateTableDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTableDefault creates CreateTableDefault with default headers values -func NewCreateTableDefault(code int) *CreateTableDefault { - if code <= 0 { - code = 500 - } - - return &CreateTableDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create table default response -func (o *CreateTableDefault) WithStatusCode(code int) *CreateTableDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create table default response -func (o *CreateTableDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create table default response -func (o *CreateTableDefault) WithConfigurationVersion(configurationVersion string) *CreateTableDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create table default response -func (o *CreateTableDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create table default response -func (o *CreateTableDefault) WithPayload(payload *models.Error) *CreateTableDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create table default response -func (o *CreateTableDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTableDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/table/create_table_urlbuilder.go b/operations/table/create_table_urlbuilder.go deleted file mode 100644 index d0baf20c..00000000 --- a/operations/table/create_table_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTableURL generates an URL for the create table operation -type CreateTableURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTableURL) WithBasePath(bp string) *CreateTableURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTableURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTableURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/tables" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTableURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTableURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTableURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTableURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTableURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTableURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTableURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/table/delete_table.go b/operations/table/delete_table.go deleted file mode 100644 index a5d99c8e..00000000 --- a/operations/table/delete_table.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTableHandlerFunc turns a function with the right signature into a delete table handler -type DeleteTableHandlerFunc func(DeleteTableParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTableHandlerFunc) Handle(params DeleteTableParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTableHandler interface for that can handle valid delete table params -type DeleteTableHandler interface { - Handle(DeleteTableParams, interface{}) middleware.Responder -} - -// NewDeleteTable creates a new http.Handler for the delete table operation -func NewDeleteTable(ctx *middleware.Context, handler DeleteTableHandler) *DeleteTable { - return &DeleteTable{Context: ctx, Handler: handler} -} - -/* - DeleteTable swagger:route DELETE /services/haproxy/configuration/peers/{parent_name}/tables/{name} Table deleteTable - -# Delete a table - -Deletes a table configuration by it's name in the specified peer section. -*/ -type DeleteTable struct { - Context *middleware.Context - Handler DeleteTableHandler -} - -func (o *DeleteTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTableParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/table/delete_table_parameters.go b/operations/table/delete_table_parameters.go deleted file mode 100644 index 6e3a5fc6..00000000 --- a/operations/table/delete_table_parameters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTableParams creates a new DeleteTableParams object -// with the default values initialized. -func NewDeleteTableParams() DeleteTableParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTableParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTableParams contains all the bound params for the delete table operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTable -type DeleteTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Table name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTableParams() beforehand. -func (o *DeleteTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTableParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTableParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteTableParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTableParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTableParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTableParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/table/delete_table_responses.go b/operations/table/delete_table_responses.go deleted file mode 100644 index 4c897b95..00000000 --- a/operations/table/delete_table_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTableAcceptedCode is the HTTP code returned for type DeleteTableAccepted -const DeleteTableAcceptedCode int = 202 - -/* -DeleteTableAccepted Configuration change accepted and reload requested - -swagger:response deleteTableAccepted -*/ -type DeleteTableAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTableAccepted creates DeleteTableAccepted with default headers values -func NewDeleteTableAccepted() *DeleteTableAccepted { - - return &DeleteTableAccepted{} -} - -// WithReloadID adds the reloadId to the delete table accepted response -func (o *DeleteTableAccepted) WithReloadID(reloadID string) *DeleteTableAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete table accepted response -func (o *DeleteTableAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTableAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTableNoContentCode is the HTTP code returned for type DeleteTableNoContent -const DeleteTableNoContentCode int = 204 - -/* -DeleteTableNoContent Table deleted - -swagger:response deleteTableNoContent -*/ -type DeleteTableNoContent struct { -} - -// NewDeleteTableNoContent creates DeleteTableNoContent with default headers values -func NewDeleteTableNoContent() *DeleteTableNoContent { - - return &DeleteTableNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTableNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTableNotFoundCode is the HTTP code returned for type DeleteTableNotFound -const DeleteTableNotFoundCode int = 404 - -/* -DeleteTableNotFound The specified resource was not found - -swagger:response deleteTableNotFound -*/ -type DeleteTableNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTableNotFound creates DeleteTableNotFound with default headers values -func NewDeleteTableNotFound() *DeleteTableNotFound { - - return &DeleteTableNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete table not found response -func (o *DeleteTableNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTableNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete table not found response -func (o *DeleteTableNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete table not found response -func (o *DeleteTableNotFound) WithPayload(payload *models.Error) *DeleteTableNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete table not found response -func (o *DeleteTableNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTableDefault General Error - -swagger:response deleteTableDefault -*/ -type DeleteTableDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTableDefault creates DeleteTableDefault with default headers values -func NewDeleteTableDefault(code int) *DeleteTableDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTableDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete table default response -func (o *DeleteTableDefault) WithStatusCode(code int) *DeleteTableDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete table default response -func (o *DeleteTableDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete table default response -func (o *DeleteTableDefault) WithConfigurationVersion(configurationVersion string) *DeleteTableDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete table default response -func (o *DeleteTableDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete table default response -func (o *DeleteTableDefault) WithPayload(payload *models.Error) *DeleteTableDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete table default response -func (o *DeleteTableDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTableDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/table/delete_table_urlbuilder.go b/operations/table/delete_table_urlbuilder.go deleted file mode 100644 index 232bae37..00000000 --- a/operations/table/delete_table_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTableURL generates an URL for the delete table operation -type DeleteTableURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTableURL) WithBasePath(bp string) *DeleteTableURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTableURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTableURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/tables/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteTableURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTableURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTableURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTableURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTableURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTableURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTableURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTableURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/table/get_table.go b/operations/table/get_table.go deleted file mode 100644 index f6225cec..00000000 --- a/operations/table/get_table.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTableHandlerFunc turns a function with the right signature into a get table handler -type GetTableHandlerFunc func(GetTableParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTableHandlerFunc) Handle(params GetTableParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTableHandler interface for that can handle valid get table params -type GetTableHandler interface { - Handle(GetTableParams, interface{}) middleware.Responder -} - -// NewGetTable creates a new http.Handler for the get table operation -func NewGetTable(ctx *middleware.Context, handler GetTableHandler) *GetTable { - return &GetTable{Context: ctx, Handler: handler} -} - -/* - GetTable swagger:route GET /services/haproxy/configuration/peers/{parent_name}/tables/{name} Table getTable - -# Return one table - -Returns one table configuration by it's name in the specified peer section. -*/ -type GetTable struct { - Context *middleware.Context - Handler GetTableHandler -} - -func (o *GetTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTableParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/table/get_table_parameters.go b/operations/table/get_table_parameters.go deleted file mode 100644 index 3e4d1ae9..00000000 --- a/operations/table/get_table_parameters.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTableParams creates a new GetTableParams object -// -// There are no default values defined in the spec. -func NewGetTableParams() GetTableParams { - - return GetTableParams{} -} - -// GetTableParams contains all the bound params for the get table operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTable -type GetTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Table name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTableParams() beforehand. -func (o *GetTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetTableParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTableParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTableParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/table/get_table_responses.go b/operations/table/get_table_responses.go deleted file mode 100644 index 8e9879c6..00000000 --- a/operations/table/get_table_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTableOKCode is the HTTP code returned for type GetTableOK -const GetTableOKCode int = 200 - -/* -GetTableOK Successful operation - -swagger:response getTableOK -*/ -type GetTableOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Table `json:"body,omitempty"` -} - -// NewGetTableOK creates GetTableOK with default headers values -func NewGetTableOK() *GetTableOK { - - return &GetTableOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get table o k response -func (o *GetTableOK) WithConfigurationVersion(configurationVersion string) *GetTableOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get table o k response -func (o *GetTableOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get table o k response -func (o *GetTableOK) WithPayload(payload *models.Table) *GetTableOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get table o k response -func (o *GetTableOK) SetPayload(payload *models.Table) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTableOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTableNotFoundCode is the HTTP code returned for type GetTableNotFound -const GetTableNotFoundCode int = 404 - -/* -GetTableNotFound The specified resource already exists - -swagger:response getTableNotFound -*/ -type GetTableNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTableNotFound creates GetTableNotFound with default headers values -func NewGetTableNotFound() *GetTableNotFound { - - return &GetTableNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get table not found response -func (o *GetTableNotFound) WithConfigurationVersion(configurationVersion string) *GetTableNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get table not found response -func (o *GetTableNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get table not found response -func (o *GetTableNotFound) WithPayload(payload *models.Error) *GetTableNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get table not found response -func (o *GetTableNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTableDefault General Error - -swagger:response getTableDefault -*/ -type GetTableDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTableDefault creates GetTableDefault with default headers values -func NewGetTableDefault(code int) *GetTableDefault { - if code <= 0 { - code = 500 - } - - return &GetTableDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get table default response -func (o *GetTableDefault) WithStatusCode(code int) *GetTableDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get table default response -func (o *GetTableDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get table default response -func (o *GetTableDefault) WithConfigurationVersion(configurationVersion string) *GetTableDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get table default response -func (o *GetTableDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get table default response -func (o *GetTableDefault) WithPayload(payload *models.Error) *GetTableDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get table default response -func (o *GetTableDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTableDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/table/get_table_urlbuilder.go b/operations/table/get_table_urlbuilder.go deleted file mode 100644 index 9bdf840b..00000000 --- a/operations/table/get_table_urlbuilder.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTableURL generates an URL for the get table operation -type GetTableURL struct { - Name string - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTableURL) WithBasePath(bp string) *GetTableURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTableURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTableURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/tables/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetTableURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTableURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTableURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTableURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTableURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTableURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTableURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTableURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/table/get_tables.go b/operations/table/get_tables.go deleted file mode 100644 index 34266841..00000000 --- a/operations/table/get_tables.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTablesHandlerFunc turns a function with the right signature into a get tables handler -type GetTablesHandlerFunc func(GetTablesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTablesHandlerFunc) Handle(params GetTablesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTablesHandler interface for that can handle valid get tables params -type GetTablesHandler interface { - Handle(GetTablesParams, interface{}) middleware.Responder -} - -// NewGetTables creates a new http.Handler for the get tables operation -func NewGetTables(ctx *middleware.Context, handler GetTablesHandler) *GetTables { - return &GetTables{Context: ctx, Handler: handler} -} - -/* - GetTables swagger:route GET /services/haproxy/configuration/peers/{parent_name}/tables Table getTables - -# Return an array of tables - -Returns an array of all tables that are configured in specified peer section. -*/ -type GetTables struct { - Context *middleware.Context - Handler GetTablesHandler -} - -func (o *GetTables) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTablesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/table/get_tables_parameters.go b/operations/table/get_tables_parameters.go deleted file mode 100644 index cdf2856d..00000000 --- a/operations/table/get_tables_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTablesParams creates a new GetTablesParams object -// -// There are no default values defined in the spec. -func NewGetTablesParams() GetTablesParams { - - return GetTablesParams{} -} - -// GetTablesParams contains all the bound params for the get tables operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTables -type GetTablesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTablesParams() beforehand. -func (o *GetTablesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTablesParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTablesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/table/get_tables_responses.go b/operations/table/get_tables_responses.go deleted file mode 100644 index cbccfb8f..00000000 --- a/operations/table/get_tables_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTablesOKCode is the HTTP code returned for type GetTablesOK -const GetTablesOKCode int = 200 - -/* -GetTablesOK Successful operation - -swagger:response getTablesOK -*/ -type GetTablesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Tables `json:"body,omitempty"` -} - -// NewGetTablesOK creates GetTablesOK with default headers values -func NewGetTablesOK() *GetTablesOK { - - return &GetTablesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get tables o k response -func (o *GetTablesOK) WithConfigurationVersion(configurationVersion string) *GetTablesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get tables o k response -func (o *GetTablesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get tables o k response -func (o *GetTablesOK) WithPayload(payload models.Tables) *GetTablesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tables o k response -func (o *GetTablesOK) SetPayload(payload models.Tables) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTablesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Tables{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetTablesDefault General Error - -swagger:response getTablesDefault -*/ -type GetTablesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTablesDefault creates GetTablesDefault with default headers values -func NewGetTablesDefault(code int) *GetTablesDefault { - if code <= 0 { - code = 500 - } - - return &GetTablesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tables default response -func (o *GetTablesDefault) WithStatusCode(code int) *GetTablesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tables default response -func (o *GetTablesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get tables default response -func (o *GetTablesDefault) WithConfigurationVersion(configurationVersion string) *GetTablesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get tables default response -func (o *GetTablesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get tables default response -func (o *GetTablesDefault) WithPayload(payload *models.Error) *GetTablesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tables default response -func (o *GetTablesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTablesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/table/get_tables_urlbuilder.go b/operations/table/get_tables_urlbuilder.go deleted file mode 100644 index 002844ce..00000000 --- a/operations/table/get_tables_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTablesURL generates an URL for the get tables operation -type GetTablesURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTablesURL) WithBasePath(bp string) *GetTablesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTablesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTablesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/tables" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTablesURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTablesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTablesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTablesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTablesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTablesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTablesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/table/replace_table.go b/operations/table/replace_table.go deleted file mode 100644 index b801d344..00000000 --- a/operations/table/replace_table.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTableHandlerFunc turns a function with the right signature into a replace table handler -type ReplaceTableHandlerFunc func(ReplaceTableParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTableHandlerFunc) Handle(params ReplaceTableParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTableHandler interface for that can handle valid replace table params -type ReplaceTableHandler interface { - Handle(ReplaceTableParams, interface{}) middleware.Responder -} - -// NewReplaceTable creates a new http.Handler for the replace table operation -func NewReplaceTable(ctx *middleware.Context, handler ReplaceTableHandler) *ReplaceTable { - return &ReplaceTable{Context: ctx, Handler: handler} -} - -/* - ReplaceTable swagger:route PUT /services/haproxy/configuration/peers/{parent_name}/tables/{name} Table replaceTable - -# Replace a table - -Replaces a table configuration by it's name in the specified peer section. -*/ -type ReplaceTable struct { - Context *middleware.Context - Handler ReplaceTableHandler -} - -func (o *ReplaceTable) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTableParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/table/replace_table_parameters.go b/operations/table/replace_table_parameters.go deleted file mode 100644 index 257018ce..00000000 --- a/operations/table/replace_table_parameters.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTableParams creates a new ReplaceTableParams object -// with the default values initialized. -func NewReplaceTableParams() ReplaceTableParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTableParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTableParams contains all the bound params for the replace table operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTable -type ReplaceTableParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Table - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Table name - Required: true - In: path - */ - Name string - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTableParams() beforehand. -func (o *ReplaceTableParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Table - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTableParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTableParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *ReplaceTableParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTableParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTableParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTableParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/table/replace_table_responses.go b/operations/table/replace_table_responses.go deleted file mode 100644 index 8c395dc5..00000000 --- a/operations/table/replace_table_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTableOKCode is the HTTP code returned for type ReplaceTableOK -const ReplaceTableOKCode int = 200 - -/* -ReplaceTableOK Table replaced - -swagger:response replaceTableOK -*/ -type ReplaceTableOK struct { - - /* - In: Body - */ - Payload *models.Table `json:"body,omitempty"` -} - -// NewReplaceTableOK creates ReplaceTableOK with default headers values -func NewReplaceTableOK() *ReplaceTableOK { - - return &ReplaceTableOK{} -} - -// WithPayload adds the payload to the replace table o k response -func (o *ReplaceTableOK) WithPayload(payload *models.Table) *ReplaceTableOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace table o k response -func (o *ReplaceTableOK) SetPayload(payload *models.Table) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTableOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTableAcceptedCode is the HTTP code returned for type ReplaceTableAccepted -const ReplaceTableAcceptedCode int = 202 - -/* -ReplaceTableAccepted Configuration change accepted and reload requested - -swagger:response replaceTableAccepted -*/ -type ReplaceTableAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Table `json:"body,omitempty"` -} - -// NewReplaceTableAccepted creates ReplaceTableAccepted with default headers values -func NewReplaceTableAccepted() *ReplaceTableAccepted { - - return &ReplaceTableAccepted{} -} - -// WithReloadID adds the reloadId to the replace table accepted response -func (o *ReplaceTableAccepted) WithReloadID(reloadID string) *ReplaceTableAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace table accepted response -func (o *ReplaceTableAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace table accepted response -func (o *ReplaceTableAccepted) WithPayload(payload *models.Table) *ReplaceTableAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace table accepted response -func (o *ReplaceTableAccepted) SetPayload(payload *models.Table) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTableAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTableBadRequestCode is the HTTP code returned for type ReplaceTableBadRequest -const ReplaceTableBadRequestCode int = 400 - -/* -ReplaceTableBadRequest Bad request - -swagger:response replaceTableBadRequest -*/ -type ReplaceTableBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTableBadRequest creates ReplaceTableBadRequest with default headers values -func NewReplaceTableBadRequest() *ReplaceTableBadRequest { - - return &ReplaceTableBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace table bad request response -func (o *ReplaceTableBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTableBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace table bad request response -func (o *ReplaceTableBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace table bad request response -func (o *ReplaceTableBadRequest) WithPayload(payload *models.Error) *ReplaceTableBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace table bad request response -func (o *ReplaceTableBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTableBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTableNotFoundCode is the HTTP code returned for type ReplaceTableNotFound -const ReplaceTableNotFoundCode int = 404 - -/* -ReplaceTableNotFound The specified resource was not found - -swagger:response replaceTableNotFound -*/ -type ReplaceTableNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTableNotFound creates ReplaceTableNotFound with default headers values -func NewReplaceTableNotFound() *ReplaceTableNotFound { - - return &ReplaceTableNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace table not found response -func (o *ReplaceTableNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTableNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace table not found response -func (o *ReplaceTableNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace table not found response -func (o *ReplaceTableNotFound) WithPayload(payload *models.Error) *ReplaceTableNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace table not found response -func (o *ReplaceTableNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTableNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTableDefault General Error - -swagger:response replaceTableDefault -*/ -type ReplaceTableDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTableDefault creates ReplaceTableDefault with default headers values -func NewReplaceTableDefault(code int) *ReplaceTableDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTableDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace table default response -func (o *ReplaceTableDefault) WithStatusCode(code int) *ReplaceTableDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace table default response -func (o *ReplaceTableDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace table default response -func (o *ReplaceTableDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTableDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace table default response -func (o *ReplaceTableDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace table default response -func (o *ReplaceTableDefault) WithPayload(payload *models.Error) *ReplaceTableDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace table default response -func (o *ReplaceTableDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTableDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/table/replace_table_urlbuilder.go b/operations/table/replace_table_urlbuilder.go deleted file mode 100644 index d9465c72..00000000 --- a/operations/table/replace_table_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package table - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTableURL generates an URL for the replace table operation -type ReplaceTableURL struct { - Name string - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTableURL) WithBasePath(bp string) *ReplaceTableURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTableURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTableURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/peers/{parent_name}/tables/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ReplaceTableURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTableURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTableURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTableURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTableURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTableURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTableURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTableURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/create_tcp_check_backend.go b/operations/tcp_check/create_tcp_check_backend.go deleted file mode 100644 index c977c25c..00000000 --- a/operations/tcp_check/create_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPCheckBackendHandlerFunc turns a function with the right signature into a create TCP check backend handler -type CreateTCPCheckBackendHandlerFunc func(CreateTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPCheckBackendHandlerFunc) Handle(params CreateTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPCheckBackendHandler interface for that can handle valid create TCP check backend params -type CreateTCPCheckBackendHandler interface { - Handle(CreateTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewCreateTCPCheckBackend creates a new http.Handler for the create TCP check backend operation -func NewCreateTCPCheckBackend(ctx *middleware.Context, handler CreateTCPCheckBackendHandler) *CreateTCPCheckBackend { - return &CreateTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - CreateTCPCheckBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index} TCPCheck createTcpCheckBackend - -# Add a new TCP check - -Adds a new TCP check of the specified type in the specified parent. -*/ -type CreateTCPCheckBackend struct { - Context *middleware.Context - Handler CreateTCPCheckBackendHandler -} - -func (o *CreateTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/create_tcp_check_backend_parameters.go b/operations/tcp_check/create_tcp_check_backend_parameters.go deleted file mode 100644 index eccb3a07..00000000 --- a/operations/tcp_check/create_tcp_check_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPCheckBackendParams creates a new CreateTCPCheckBackendParams object -// with the default values initialized. -func NewCreateTCPCheckBackendParams() CreateTCPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPCheckBackendParams contains all the bound params for the create TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPCheckBackend -type CreateTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPCheckBackendParams() beforehand. -func (o *CreateTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/create_tcp_check_backend_responses.go b/operations/tcp_check/create_tcp_check_backend_responses.go deleted file mode 100644 index a69f46b6..00000000 --- a/operations/tcp_check/create_tcp_check_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPCheckBackendCreatedCode is the HTTP code returned for type CreateTCPCheckBackendCreated -const CreateTCPCheckBackendCreatedCode int = 201 - -/* -CreateTCPCheckBackendCreated TCP check created - -swagger:response createTcpCheckBackendCreated -*/ -type CreateTCPCheckBackendCreated struct { - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewCreateTCPCheckBackendCreated creates CreateTCPCheckBackendCreated with default headers values -func NewCreateTCPCheckBackendCreated() *CreateTCPCheckBackendCreated { - - return &CreateTCPCheckBackendCreated{} -} - -// WithPayload adds the payload to the create Tcp check backend created response -func (o *CreateTCPCheckBackendCreated) WithPayload(payload *models.TCPCheck) *CreateTCPCheckBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check backend created response -func (o *CreateTCPCheckBackendCreated) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckBackendAcceptedCode is the HTTP code returned for type CreateTCPCheckBackendAccepted -const CreateTCPCheckBackendAcceptedCode int = 202 - -/* -CreateTCPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response createTcpCheckBackendAccepted -*/ -type CreateTCPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewCreateTCPCheckBackendAccepted creates CreateTCPCheckBackendAccepted with default headers values -func NewCreateTCPCheckBackendAccepted() *CreateTCPCheckBackendAccepted { - - return &CreateTCPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp check backend accepted response -func (o *CreateTCPCheckBackendAccepted) WithReloadID(reloadID string) *CreateTCPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp check backend accepted response -func (o *CreateTCPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp check backend accepted response -func (o *CreateTCPCheckBackendAccepted) WithPayload(payload *models.TCPCheck) *CreateTCPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check backend accepted response -func (o *CreateTCPCheckBackendAccepted) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckBackendBadRequestCode is the HTTP code returned for type CreateTCPCheckBackendBadRequest -const CreateTCPCheckBackendBadRequestCode int = 400 - -/* -CreateTCPCheckBackendBadRequest Bad request - -swagger:response createTcpCheckBackendBadRequest -*/ -type CreateTCPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckBackendBadRequest creates CreateTCPCheckBackendBadRequest with default headers values -func NewCreateTCPCheckBackendBadRequest() *CreateTCPCheckBackendBadRequest { - - return &CreateTCPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp check backend bad request response -func (o *CreateTCPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp check backend bad request response -func (o *CreateTCPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp check backend bad request response -func (o *CreateTCPCheckBackendBadRequest) WithPayload(payload *models.Error) *CreateTCPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check backend bad request response -func (o *CreateTCPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckBackendConflictCode is the HTTP code returned for type CreateTCPCheckBackendConflict -const CreateTCPCheckBackendConflictCode int = 409 - -/* -CreateTCPCheckBackendConflict The specified resource already exists - -swagger:response createTcpCheckBackendConflict -*/ -type CreateTCPCheckBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckBackendConflict creates CreateTCPCheckBackendConflict with default headers values -func NewCreateTCPCheckBackendConflict() *CreateTCPCheckBackendConflict { - - return &CreateTCPCheckBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp check backend conflict response -func (o *CreateTCPCheckBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp check backend conflict response -func (o *CreateTCPCheckBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp check backend conflict response -func (o *CreateTCPCheckBackendConflict) WithPayload(payload *models.Error) *CreateTCPCheckBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check backend conflict response -func (o *CreateTCPCheckBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPCheckBackendDefault General Error - -swagger:response createTcpCheckBackendDefault -*/ -type CreateTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckBackendDefault creates CreateTCPCheckBackendDefault with default headers values -func NewCreateTCPCheckBackendDefault(code int) *CreateTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) WithStatusCode(code int) *CreateTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) WithPayload(payload *models.Error) *CreateTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP check backend default response -func (o *CreateTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/create_tcp_check_backend_urlbuilder.go b/operations/tcp_check/create_tcp_check_backend_urlbuilder.go deleted file mode 100644 index c6ab6dfd..00000000 --- a/operations/tcp_check/create_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPCheckBackendURL generates an URL for the create TCP check backend operation -type CreateTCPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPCheckBackendURL) WithBasePath(bp string) *CreateTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/create_tcp_check_defaults.go b/operations/tcp_check/create_tcp_check_defaults.go deleted file mode 100644 index 9c0351e3..00000000 --- a/operations/tcp_check/create_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPCheckDefaultsHandlerFunc turns a function with the right signature into a create TCP check defaults handler -type CreateTCPCheckDefaultsHandlerFunc func(CreateTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPCheckDefaultsHandlerFunc) Handle(params CreateTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPCheckDefaultsHandler interface for that can handle valid create TCP check defaults params -type CreateTCPCheckDefaultsHandler interface { - Handle(CreateTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateTCPCheckDefaults creates a new http.Handler for the create TCP check defaults operation -func NewCreateTCPCheckDefaults(ctx *middleware.Context, handler CreateTCPCheckDefaultsHandler) *CreateTCPCheckDefaults { - return &CreateTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - CreateTCPCheckDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index} TCPCheck createTcpCheckDefaults - -# Add a new TCP check - -Adds a new TCP check of the specified type in the specified parent. -*/ -type CreateTCPCheckDefaults struct { - Context *middleware.Context - Handler CreateTCPCheckDefaultsHandler -} - -func (o *CreateTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/create_tcp_check_defaults_parameters.go b/operations/tcp_check/create_tcp_check_defaults_parameters.go deleted file mode 100644 index 44fb6302..00000000 --- a/operations/tcp_check/create_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPCheckDefaultsParams creates a new CreateTCPCheckDefaultsParams object -// with the default values initialized. -func NewCreateTCPCheckDefaultsParams() CreateTCPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPCheckDefaultsParams contains all the bound params for the create TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPCheckDefaults -type CreateTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPCheckDefaultsParams() beforehand. -func (o *CreateTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/create_tcp_check_defaults_responses.go b/operations/tcp_check/create_tcp_check_defaults_responses.go deleted file mode 100644 index a666aba2..00000000 --- a/operations/tcp_check/create_tcp_check_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPCheckDefaultsCreatedCode is the HTTP code returned for type CreateTCPCheckDefaultsCreated -const CreateTCPCheckDefaultsCreatedCode int = 201 - -/* -CreateTCPCheckDefaultsCreated TCP check created - -swagger:response createTcpCheckDefaultsCreated -*/ -type CreateTCPCheckDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewCreateTCPCheckDefaultsCreated creates CreateTCPCheckDefaultsCreated with default headers values -func NewCreateTCPCheckDefaultsCreated() *CreateTCPCheckDefaultsCreated { - - return &CreateTCPCheckDefaultsCreated{} -} - -// WithPayload adds the payload to the create Tcp check defaults created response -func (o *CreateTCPCheckDefaultsCreated) WithPayload(payload *models.TCPCheck) *CreateTCPCheckDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check defaults created response -func (o *CreateTCPCheckDefaultsCreated) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckDefaultsAcceptedCode is the HTTP code returned for type CreateTCPCheckDefaultsAccepted -const CreateTCPCheckDefaultsAcceptedCode int = 202 - -/* -CreateTCPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createTcpCheckDefaultsAccepted -*/ -type CreateTCPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewCreateTCPCheckDefaultsAccepted creates CreateTCPCheckDefaultsAccepted with default headers values -func NewCreateTCPCheckDefaultsAccepted() *CreateTCPCheckDefaultsAccepted { - - return &CreateTCPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp check defaults accepted response -func (o *CreateTCPCheckDefaultsAccepted) WithReloadID(reloadID string) *CreateTCPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp check defaults accepted response -func (o *CreateTCPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp check defaults accepted response -func (o *CreateTCPCheckDefaultsAccepted) WithPayload(payload *models.TCPCheck) *CreateTCPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check defaults accepted response -func (o *CreateTCPCheckDefaultsAccepted) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckDefaultsBadRequestCode is the HTTP code returned for type CreateTCPCheckDefaultsBadRequest -const CreateTCPCheckDefaultsBadRequestCode int = 400 - -/* -CreateTCPCheckDefaultsBadRequest Bad request - -swagger:response createTcpCheckDefaultsBadRequest -*/ -type CreateTCPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckDefaultsBadRequest creates CreateTCPCheckDefaultsBadRequest with default headers values -func NewCreateTCPCheckDefaultsBadRequest() *CreateTCPCheckDefaultsBadRequest { - - return &CreateTCPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp check defaults bad request response -func (o *CreateTCPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp check defaults bad request response -func (o *CreateTCPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp check defaults bad request response -func (o *CreateTCPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *CreateTCPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check defaults bad request response -func (o *CreateTCPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPCheckDefaultsConflictCode is the HTTP code returned for type CreateTCPCheckDefaultsConflict -const CreateTCPCheckDefaultsConflictCode int = 409 - -/* -CreateTCPCheckDefaultsConflict The specified resource already exists - -swagger:response createTcpCheckDefaultsConflict -*/ -type CreateTCPCheckDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckDefaultsConflict creates CreateTCPCheckDefaultsConflict with default headers values -func NewCreateTCPCheckDefaultsConflict() *CreateTCPCheckDefaultsConflict { - - return &CreateTCPCheckDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp check defaults conflict response -func (o *CreateTCPCheckDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp check defaults conflict response -func (o *CreateTCPCheckDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp check defaults conflict response -func (o *CreateTCPCheckDefaultsConflict) WithPayload(payload *models.Error) *CreateTCPCheckDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp check defaults conflict response -func (o *CreateTCPCheckDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPCheckDefaultsDefault General Error - -swagger:response createTcpCheckDefaultsDefault -*/ -type CreateTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPCheckDefaultsDefault creates CreateTCPCheckDefaultsDefault with default headers values -func NewCreateTCPCheckDefaultsDefault(code int) *CreateTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) WithStatusCode(code int) *CreateTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *CreateTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP check defaults default response -func (o *CreateTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/create_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/create_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index de6e6266..00000000 --- a/operations/tcp_check/create_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPCheckDefaultsURL generates an URL for the create TCP check defaults operation -type CreateTCPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPCheckDefaultsURL) WithBasePath(bp string) *CreateTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/delete_tcp_check_backend.go b/operations/tcp_check/delete_tcp_check_backend.go deleted file mode 100644 index ebdd057e..00000000 --- a/operations/tcp_check/delete_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPCheckBackendHandlerFunc turns a function with the right signature into a delete TCP check backend handler -type DeleteTCPCheckBackendHandlerFunc func(DeleteTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPCheckBackendHandlerFunc) Handle(params DeleteTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPCheckBackendHandler interface for that can handle valid delete TCP check backend params -type DeleteTCPCheckBackendHandler interface { - Handle(DeleteTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewDeleteTCPCheckBackend creates a new http.Handler for the delete TCP check backend operation -func NewDeleteTCPCheckBackend(ctx *middleware.Context, handler DeleteTCPCheckBackendHandler) *DeleteTCPCheckBackend { - return &DeleteTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - DeleteTCPCheckBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index} TCPCheck deleteTcpCheckBackend - -# Delete a TCP check - -Deletes a TCP check configuration by it's index from the specified parent. -*/ -type DeleteTCPCheckBackend struct { - Context *middleware.Context - Handler DeleteTCPCheckBackendHandler -} - -func (o *DeleteTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/delete_tcp_check_backend_parameters.go b/operations/tcp_check/delete_tcp_check_backend_parameters.go deleted file mode 100644 index e3a771cf..00000000 --- a/operations/tcp_check/delete_tcp_check_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPCheckBackendParams creates a new DeleteTCPCheckBackendParams object -// with the default values initialized. -func NewDeleteTCPCheckBackendParams() DeleteTCPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPCheckBackendParams contains all the bound params for the delete TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPCheckBackend -type DeleteTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPCheckBackendParams() beforehand. -func (o *DeleteTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/delete_tcp_check_backend_responses.go b/operations/tcp_check/delete_tcp_check_backend_responses.go deleted file mode 100644 index 2586c358..00000000 --- a/operations/tcp_check/delete_tcp_check_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPCheckBackendAcceptedCode is the HTTP code returned for type DeleteTCPCheckBackendAccepted -const DeleteTCPCheckBackendAcceptedCode int = 202 - -/* -DeleteTCPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpCheckBackendAccepted -*/ -type DeleteTCPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPCheckBackendAccepted creates DeleteTCPCheckBackendAccepted with default headers values -func NewDeleteTCPCheckBackendAccepted() *DeleteTCPCheckBackendAccepted { - - return &DeleteTCPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp check backend accepted response -func (o *DeleteTCPCheckBackendAccepted) WithReloadID(reloadID string) *DeleteTCPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp check backend accepted response -func (o *DeleteTCPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPCheckBackendNoContentCode is the HTTP code returned for type DeleteTCPCheckBackendNoContent -const DeleteTCPCheckBackendNoContentCode int = 204 - -/* -DeleteTCPCheckBackendNoContent TCP check deleted - -swagger:response deleteTcpCheckBackendNoContent -*/ -type DeleteTCPCheckBackendNoContent struct { -} - -// NewDeleteTCPCheckBackendNoContent creates DeleteTCPCheckBackendNoContent with default headers values -func NewDeleteTCPCheckBackendNoContent() *DeleteTCPCheckBackendNoContent { - - return &DeleteTCPCheckBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPCheckBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPCheckBackendNotFoundCode is the HTTP code returned for type DeleteTCPCheckBackendNotFound -const DeleteTCPCheckBackendNotFoundCode int = 404 - -/* -DeleteTCPCheckBackendNotFound The specified resource was not found - -swagger:response deleteTcpCheckBackendNotFound -*/ -type DeleteTCPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPCheckBackendNotFound creates DeleteTCPCheckBackendNotFound with default headers values -func NewDeleteTCPCheckBackendNotFound() *DeleteTCPCheckBackendNotFound { - - return &DeleteTCPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp check backend not found response -func (o *DeleteTCPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp check backend not found response -func (o *DeleteTCPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp check backend not found response -func (o *DeleteTCPCheckBackendNotFound) WithPayload(payload *models.Error) *DeleteTCPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp check backend not found response -func (o *DeleteTCPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPCheckBackendDefault General Error - -swagger:response deleteTcpCheckBackendDefault -*/ -type DeleteTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPCheckBackendDefault creates DeleteTCPCheckBackendDefault with default headers values -func NewDeleteTCPCheckBackendDefault(code int) *DeleteTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) WithStatusCode(code int) *DeleteTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) WithPayload(payload *models.Error) *DeleteTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP check backend default response -func (o *DeleteTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/delete_tcp_check_backend_urlbuilder.go b/operations/tcp_check/delete_tcp_check_backend_urlbuilder.go deleted file mode 100644 index 80ee8b38..00000000 --- a/operations/tcp_check/delete_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPCheckBackendURL generates an URL for the delete TCP check backend operation -type DeleteTCPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPCheckBackendURL) WithBasePath(bp string) *DeleteTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/delete_tcp_check_defaults.go b/operations/tcp_check/delete_tcp_check_defaults.go deleted file mode 100644 index 8f10dee7..00000000 --- a/operations/tcp_check/delete_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPCheckDefaultsHandlerFunc turns a function with the right signature into a delete TCP check defaults handler -type DeleteTCPCheckDefaultsHandlerFunc func(DeleteTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPCheckDefaultsHandlerFunc) Handle(params DeleteTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPCheckDefaultsHandler interface for that can handle valid delete TCP check defaults params -type DeleteTCPCheckDefaultsHandler interface { - Handle(DeleteTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteTCPCheckDefaults creates a new http.Handler for the delete TCP check defaults operation -func NewDeleteTCPCheckDefaults(ctx *middleware.Context, handler DeleteTCPCheckDefaultsHandler) *DeleteTCPCheckDefaults { - return &DeleteTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteTCPCheckDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index} TCPCheck deleteTcpCheckDefaults - -# Delete a TCP check - -Deletes a TCP check configuration by it's index from the specified parent. -*/ -type DeleteTCPCheckDefaults struct { - Context *middleware.Context - Handler DeleteTCPCheckDefaultsHandler -} - -func (o *DeleteTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/delete_tcp_check_defaults_parameters.go b/operations/tcp_check/delete_tcp_check_defaults_parameters.go deleted file mode 100644 index 16582b44..00000000 --- a/operations/tcp_check/delete_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPCheckDefaultsParams creates a new DeleteTCPCheckDefaultsParams object -// with the default values initialized. -func NewDeleteTCPCheckDefaultsParams() DeleteTCPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPCheckDefaultsParams contains all the bound params for the delete TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPCheckDefaults -type DeleteTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPCheckDefaultsParams() beforehand. -func (o *DeleteTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/delete_tcp_check_defaults_responses.go b/operations/tcp_check/delete_tcp_check_defaults_responses.go deleted file mode 100644 index 083463c0..00000000 --- a/operations/tcp_check/delete_tcp_check_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPCheckDefaultsAcceptedCode is the HTTP code returned for type DeleteTCPCheckDefaultsAccepted -const DeleteTCPCheckDefaultsAcceptedCode int = 202 - -/* -DeleteTCPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpCheckDefaultsAccepted -*/ -type DeleteTCPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPCheckDefaultsAccepted creates DeleteTCPCheckDefaultsAccepted with default headers values -func NewDeleteTCPCheckDefaultsAccepted() *DeleteTCPCheckDefaultsAccepted { - - return &DeleteTCPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp check defaults accepted response -func (o *DeleteTCPCheckDefaultsAccepted) WithReloadID(reloadID string) *DeleteTCPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp check defaults accepted response -func (o *DeleteTCPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPCheckDefaultsNoContentCode is the HTTP code returned for type DeleteTCPCheckDefaultsNoContent -const DeleteTCPCheckDefaultsNoContentCode int = 204 - -/* -DeleteTCPCheckDefaultsNoContent TCP check deleted - -swagger:response deleteTcpCheckDefaultsNoContent -*/ -type DeleteTCPCheckDefaultsNoContent struct { -} - -// NewDeleteTCPCheckDefaultsNoContent creates DeleteTCPCheckDefaultsNoContent with default headers values -func NewDeleteTCPCheckDefaultsNoContent() *DeleteTCPCheckDefaultsNoContent { - - return &DeleteTCPCheckDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPCheckDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPCheckDefaultsNotFoundCode is the HTTP code returned for type DeleteTCPCheckDefaultsNotFound -const DeleteTCPCheckDefaultsNotFoundCode int = 404 - -/* -DeleteTCPCheckDefaultsNotFound The specified resource was not found - -swagger:response deleteTcpCheckDefaultsNotFound -*/ -type DeleteTCPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPCheckDefaultsNotFound creates DeleteTCPCheckDefaultsNotFound with default headers values -func NewDeleteTCPCheckDefaultsNotFound() *DeleteTCPCheckDefaultsNotFound { - - return &DeleteTCPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp check defaults not found response -func (o *DeleteTCPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp check defaults not found response -func (o *DeleteTCPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp check defaults not found response -func (o *DeleteTCPCheckDefaultsNotFound) WithPayload(payload *models.Error) *DeleteTCPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp check defaults not found response -func (o *DeleteTCPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPCheckDefaultsDefault General Error - -swagger:response deleteTcpCheckDefaultsDefault -*/ -type DeleteTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPCheckDefaultsDefault creates DeleteTCPCheckDefaultsDefault with default headers values -func NewDeleteTCPCheckDefaultsDefault(code int) *DeleteTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) WithStatusCode(code int) *DeleteTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *DeleteTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP check defaults default response -func (o *DeleteTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/delete_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/delete_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index 833c21e8..00000000 --- a/operations/tcp_check/delete_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPCheckDefaultsURL generates an URL for the delete TCP check defaults operation -type DeleteTCPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPCheckDefaultsURL) WithBasePath(bp string) *DeleteTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/get_all_tcp_check_backend.go b/operations/tcp_check/get_all_tcp_check_backend.go deleted file mode 100644 index aa4ce745..00000000 --- a/operations/tcp_check/get_all_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPCheckBackendHandlerFunc turns a function with the right signature into a get all TCP check backend handler -type GetAllTCPCheckBackendHandlerFunc func(GetAllTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPCheckBackendHandlerFunc) Handle(params GetAllTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPCheckBackendHandler interface for that can handle valid get all TCP check backend params -type GetAllTCPCheckBackendHandler interface { - Handle(GetAllTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewGetAllTCPCheckBackend creates a new http.Handler for the get all TCP check backend operation -func NewGetAllTCPCheckBackend(ctx *middleware.Context, handler GetAllTCPCheckBackendHandler) *GetAllTCPCheckBackend { - return &GetAllTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - GetAllTCPCheckBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks TCPCheck getAllTcpCheckBackend - -# Return an array of TCP checks - -Returns all TCP checks that are configured in specified parent. -*/ -type GetAllTCPCheckBackend struct { - Context *middleware.Context - Handler GetAllTCPCheckBackendHandler -} - -func (o *GetAllTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/get_all_tcp_check_backend_parameters.go b/operations/tcp_check/get_all_tcp_check_backend_parameters.go deleted file mode 100644 index 2871e6f8..00000000 --- a/operations/tcp_check/get_all_tcp_check_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPCheckBackendParams creates a new GetAllTCPCheckBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPCheckBackendParams() GetAllTCPCheckBackendParams { - - return GetAllTCPCheckBackendParams{} -} - -// GetAllTCPCheckBackendParams contains all the bound params for the get all TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPCheckBackend -type GetAllTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPCheckBackendParams() beforehand. -func (o *GetAllTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_check/get_all_tcp_check_backend_responses.go b/operations/tcp_check/get_all_tcp_check_backend_responses.go deleted file mode 100644 index 3a3d7624..00000000 --- a/operations/tcp_check/get_all_tcp_check_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPCheckBackendOKCode is the HTTP code returned for type GetAllTCPCheckBackendOK -const GetAllTCPCheckBackendOKCode int = 200 - -/* -GetAllTCPCheckBackendOK Successful operation - -swagger:response getAllTcpCheckBackendOK -*/ -type GetAllTCPCheckBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewGetAllTCPCheckBackendOK creates GetAllTCPCheckBackendOK with default headers values -func NewGetAllTCPCheckBackendOK() *GetAllTCPCheckBackendOK { - - return &GetAllTCPCheckBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp check backend o k response -func (o *GetAllTCPCheckBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPCheckBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp check backend o k response -func (o *GetAllTCPCheckBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp check backend o k response -func (o *GetAllTCPCheckBackendOK) WithPayload(payload models.TCPChecks) *GetAllTCPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp check backend o k response -func (o *GetAllTCPCheckBackendOK) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPCheckBackendDefault General Error - -swagger:response getAllTcpCheckBackendDefault -*/ -type GetAllTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPCheckBackendDefault creates GetAllTCPCheckBackendDefault with default headers values -func NewGetAllTCPCheckBackendDefault(code int) *GetAllTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) WithStatusCode(code int) *GetAllTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) WithPayload(payload *models.Error) *GetAllTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP check backend default response -func (o *GetAllTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/get_all_tcp_check_backend_urlbuilder.go b/operations/tcp_check/get_all_tcp_check_backend_urlbuilder.go deleted file mode 100644 index 4885180a..00000000 --- a/operations/tcp_check/get_all_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPCheckBackendURL generates an URL for the get all TCP check backend operation -type GetAllTCPCheckBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPCheckBackendURL) WithBasePath(bp string) *GetAllTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/get_all_tcp_check_defaults.go b/operations/tcp_check/get_all_tcp_check_defaults.go deleted file mode 100644 index fb234eec..00000000 --- a/operations/tcp_check/get_all_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPCheckDefaultsHandlerFunc turns a function with the right signature into a get all TCP check defaults handler -type GetAllTCPCheckDefaultsHandlerFunc func(GetAllTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPCheckDefaultsHandlerFunc) Handle(params GetAllTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPCheckDefaultsHandler interface for that can handle valid get all TCP check defaults params -type GetAllTCPCheckDefaultsHandler interface { - Handle(GetAllTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllTCPCheckDefaults creates a new http.Handler for the get all TCP check defaults operation -func NewGetAllTCPCheckDefaults(ctx *middleware.Context, handler GetAllTCPCheckDefaultsHandler) *GetAllTCPCheckDefaults { - return &GetAllTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllTCPCheckDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks TCPCheck getAllTcpCheckDefaults - -# Return an array of TCP checks - -Returns all TCP checks that are configured in specified parent. -*/ -type GetAllTCPCheckDefaults struct { - Context *middleware.Context - Handler GetAllTCPCheckDefaultsHandler -} - -func (o *GetAllTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/get_all_tcp_check_defaults_parameters.go b/operations/tcp_check/get_all_tcp_check_defaults_parameters.go deleted file mode 100644 index 3001d2e3..00000000 --- a/operations/tcp_check/get_all_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPCheckDefaultsParams creates a new GetAllTCPCheckDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPCheckDefaultsParams() GetAllTCPCheckDefaultsParams { - - return GetAllTCPCheckDefaultsParams{} -} - -// GetAllTCPCheckDefaultsParams contains all the bound params for the get all TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPCheckDefaults -type GetAllTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPCheckDefaultsParams() beforehand. -func (o *GetAllTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_check/get_all_tcp_check_defaults_responses.go b/operations/tcp_check/get_all_tcp_check_defaults_responses.go deleted file mode 100644 index f8f03c9d..00000000 --- a/operations/tcp_check/get_all_tcp_check_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPCheckDefaultsOKCode is the HTTP code returned for type GetAllTCPCheckDefaultsOK -const GetAllTCPCheckDefaultsOKCode int = 200 - -/* -GetAllTCPCheckDefaultsOK Successful operation - -swagger:response getAllTcpCheckDefaultsOK -*/ -type GetAllTCPCheckDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewGetAllTCPCheckDefaultsOK creates GetAllTCPCheckDefaultsOK with default headers values -func NewGetAllTCPCheckDefaultsOK() *GetAllTCPCheckDefaultsOK { - - return &GetAllTCPCheckDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp check defaults o k response -func (o *GetAllTCPCheckDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPCheckDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp check defaults o k response -func (o *GetAllTCPCheckDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp check defaults o k response -func (o *GetAllTCPCheckDefaultsOK) WithPayload(payload models.TCPChecks) *GetAllTCPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp check defaults o k response -func (o *GetAllTCPCheckDefaultsOK) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPCheckDefaultsDefault General Error - -swagger:response getAllTcpCheckDefaultsDefault -*/ -type GetAllTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPCheckDefaultsDefault creates GetAllTCPCheckDefaultsDefault with default headers values -func NewGetAllTCPCheckDefaultsDefault(code int) *GetAllTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) WithStatusCode(code int) *GetAllTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *GetAllTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP check defaults default response -func (o *GetAllTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/get_all_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/get_all_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index 587fdcd0..00000000 --- a/operations/tcp_check/get_all_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPCheckDefaultsURL generates an URL for the get all TCP check defaults operation -type GetAllTCPCheckDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPCheckDefaultsURL) WithBasePath(bp string) *GetAllTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/get_tcp_check_backend.go b/operations/tcp_check/get_tcp_check_backend.go deleted file mode 100644 index a6f040b9..00000000 --- a/operations/tcp_check/get_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPCheckBackendHandlerFunc turns a function with the right signature into a get TCP check backend handler -type GetTCPCheckBackendHandlerFunc func(GetTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPCheckBackendHandlerFunc) Handle(params GetTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPCheckBackendHandler interface for that can handle valid get TCP check backend params -type GetTCPCheckBackendHandler interface { - Handle(GetTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewGetTCPCheckBackend creates a new http.Handler for the get TCP check backend operation -func NewGetTCPCheckBackend(ctx *middleware.Context, handler GetTCPCheckBackendHandler) *GetTCPCheckBackend { - return &GetTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - GetTCPCheckBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index} TCPCheck getTcpCheckBackend - -# Return one TCP check - -Returns one TCP check configuration by it's index in the specified parent. -*/ -type GetTCPCheckBackend struct { - Context *middleware.Context - Handler GetTCPCheckBackendHandler -} - -func (o *GetTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/get_tcp_check_backend_parameters.go b/operations/tcp_check/get_tcp_check_backend_parameters.go deleted file mode 100644 index 499447cc..00000000 --- a/operations/tcp_check/get_tcp_check_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPCheckBackendParams creates a new GetTCPCheckBackendParams object -// -// There are no default values defined in the spec. -func NewGetTCPCheckBackendParams() GetTCPCheckBackendParams { - - return GetTCPCheckBackendParams{} -} - -// GetTCPCheckBackendParams contains all the bound params for the get TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPCheckBackend -type GetTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPCheckBackendParams() beforehand. -func (o *GetTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_check/get_tcp_check_backend_responses.go b/operations/tcp_check/get_tcp_check_backend_responses.go deleted file mode 100644 index 19e87168..00000000 --- a/operations/tcp_check/get_tcp_check_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPCheckBackendOKCode is the HTTP code returned for type GetTCPCheckBackendOK -const GetTCPCheckBackendOKCode int = 200 - -/* -GetTCPCheckBackendOK Successful operation - -swagger:response getTcpCheckBackendOK -*/ -type GetTCPCheckBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewGetTCPCheckBackendOK creates GetTCPCheckBackendOK with default headers values -func NewGetTCPCheckBackendOK() *GetTCPCheckBackendOK { - - return &GetTCPCheckBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp check backend o k response -func (o *GetTCPCheckBackendOK) WithConfigurationVersion(configurationVersion string) *GetTCPCheckBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp check backend o k response -func (o *GetTCPCheckBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp check backend o k response -func (o *GetTCPCheckBackendOK) WithPayload(payload *models.TCPCheck) *GetTCPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp check backend o k response -func (o *GetTCPCheckBackendOK) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPCheckBackendNotFoundCode is the HTTP code returned for type GetTCPCheckBackendNotFound -const GetTCPCheckBackendNotFoundCode int = 404 - -/* -GetTCPCheckBackendNotFound The specified resource was not found - -swagger:response getTcpCheckBackendNotFound -*/ -type GetTCPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPCheckBackendNotFound creates GetTCPCheckBackendNotFound with default headers values -func NewGetTCPCheckBackendNotFound() *GetTCPCheckBackendNotFound { - - return &GetTCPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp check backend not found response -func (o *GetTCPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp check backend not found response -func (o *GetTCPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp check backend not found response -func (o *GetTCPCheckBackendNotFound) WithPayload(payload *models.Error) *GetTCPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp check backend not found response -func (o *GetTCPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPCheckBackendDefault General Error - -swagger:response getTcpCheckBackendDefault -*/ -type GetTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPCheckBackendDefault creates GetTCPCheckBackendDefault with default headers values -func NewGetTCPCheckBackendDefault(code int) *GetTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) WithStatusCode(code int) *GetTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *GetTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) WithPayload(payload *models.Error) *GetTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP check backend default response -func (o *GetTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/get_tcp_check_backend_urlbuilder.go b/operations/tcp_check/get_tcp_check_backend_urlbuilder.go deleted file mode 100644 index 579e6e30..00000000 --- a/operations/tcp_check/get_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPCheckBackendURL generates an URL for the get TCP check backend operation -type GetTCPCheckBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPCheckBackendURL) WithBasePath(bp string) *GetTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/get_tcp_check_defaults.go b/operations/tcp_check/get_tcp_check_defaults.go deleted file mode 100644 index 4383d688..00000000 --- a/operations/tcp_check/get_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPCheckDefaultsHandlerFunc turns a function with the right signature into a get TCP check defaults handler -type GetTCPCheckDefaultsHandlerFunc func(GetTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPCheckDefaultsHandlerFunc) Handle(params GetTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPCheckDefaultsHandler interface for that can handle valid get TCP check defaults params -type GetTCPCheckDefaultsHandler interface { - Handle(GetTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewGetTCPCheckDefaults creates a new http.Handler for the get TCP check defaults operation -func NewGetTCPCheckDefaults(ctx *middleware.Context, handler GetTCPCheckDefaultsHandler) *GetTCPCheckDefaults { - return &GetTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - GetTCPCheckDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index} TCPCheck getTcpCheckDefaults - -# Return one TCP check - -Returns one TCP check configuration by it's index in the specified parent. -*/ -type GetTCPCheckDefaults struct { - Context *middleware.Context - Handler GetTCPCheckDefaultsHandler -} - -func (o *GetTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/get_tcp_check_defaults_parameters.go b/operations/tcp_check/get_tcp_check_defaults_parameters.go deleted file mode 100644 index 8ea37fff..00000000 --- a/operations/tcp_check/get_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPCheckDefaultsParams creates a new GetTCPCheckDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetTCPCheckDefaultsParams() GetTCPCheckDefaultsParams { - - return GetTCPCheckDefaultsParams{} -} - -// GetTCPCheckDefaultsParams contains all the bound params for the get TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPCheckDefaults -type GetTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPCheckDefaultsParams() beforehand. -func (o *GetTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_check/get_tcp_check_defaults_responses.go b/operations/tcp_check/get_tcp_check_defaults_responses.go deleted file mode 100644 index 81cbd560..00000000 --- a/operations/tcp_check/get_tcp_check_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPCheckDefaultsOKCode is the HTTP code returned for type GetTCPCheckDefaultsOK -const GetTCPCheckDefaultsOKCode int = 200 - -/* -GetTCPCheckDefaultsOK Successful operation - -swagger:response getTcpCheckDefaultsOK -*/ -type GetTCPCheckDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewGetTCPCheckDefaultsOK creates GetTCPCheckDefaultsOK with default headers values -func NewGetTCPCheckDefaultsOK() *GetTCPCheckDefaultsOK { - - return &GetTCPCheckDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp check defaults o k response -func (o *GetTCPCheckDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetTCPCheckDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp check defaults o k response -func (o *GetTCPCheckDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp check defaults o k response -func (o *GetTCPCheckDefaultsOK) WithPayload(payload *models.TCPCheck) *GetTCPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp check defaults o k response -func (o *GetTCPCheckDefaultsOK) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPCheckDefaultsNotFoundCode is the HTTP code returned for type GetTCPCheckDefaultsNotFound -const GetTCPCheckDefaultsNotFoundCode int = 404 - -/* -GetTCPCheckDefaultsNotFound The specified resource was not found - -swagger:response getTcpCheckDefaultsNotFound -*/ -type GetTCPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPCheckDefaultsNotFound creates GetTCPCheckDefaultsNotFound with default headers values -func NewGetTCPCheckDefaultsNotFound() *GetTCPCheckDefaultsNotFound { - - return &GetTCPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp check defaults not found response -func (o *GetTCPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp check defaults not found response -func (o *GetTCPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp check defaults not found response -func (o *GetTCPCheckDefaultsNotFound) WithPayload(payload *models.Error) *GetTCPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp check defaults not found response -func (o *GetTCPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPCheckDefaultsDefault General Error - -swagger:response getTcpCheckDefaultsDefault -*/ -type GetTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPCheckDefaultsDefault creates GetTCPCheckDefaultsDefault with default headers values -func NewGetTCPCheckDefaultsDefault(code int) *GetTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) WithStatusCode(code int) *GetTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *GetTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP check defaults default response -func (o *GetTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/get_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/get_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index 2ca0cf04..00000000 --- a/operations/tcp_check/get_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPCheckDefaultsURL generates an URL for the get TCP check defaults operation -type GetTCPCheckDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPCheckDefaultsURL) WithBasePath(bp string) *GetTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/replace_all_tcp_check_backend.go b/operations/tcp_check/replace_all_tcp_check_backend.go deleted file mode 100644 index 3e57fcb3..00000000 --- a/operations/tcp_check/replace_all_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPCheckBackendHandlerFunc turns a function with the right signature into a replace all TCP check backend handler -type ReplaceAllTCPCheckBackendHandlerFunc func(ReplaceAllTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPCheckBackendHandlerFunc) Handle(params ReplaceAllTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPCheckBackendHandler interface for that can handle valid replace all TCP check backend params -type ReplaceAllTCPCheckBackendHandler interface { - Handle(ReplaceAllTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPCheckBackend creates a new http.Handler for the replace all TCP check backend operation -func NewReplaceAllTCPCheckBackend(ctx *middleware.Context, handler ReplaceAllTCPCheckBackendHandler) *ReplaceAllTCPCheckBackend { - return &ReplaceAllTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPCheckBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks TCPCheck replaceAllTcpCheckBackend - -# Replace an TCP Check list - -Replaces a whole list of TCP Checks with the list given in parameter -*/ -type ReplaceAllTCPCheckBackend struct { - Context *middleware.Context - Handler ReplaceAllTCPCheckBackendHandler -} - -func (o *ReplaceAllTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/replace_all_tcp_check_backend_parameters.go b/operations/tcp_check/replace_all_tcp_check_backend_parameters.go deleted file mode 100644 index 16c59bed..00000000 --- a/operations/tcp_check/replace_all_tcp_check_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPCheckBackendParams creates a new ReplaceAllTCPCheckBackendParams object -// with the default values initialized. -func NewReplaceAllTCPCheckBackendParams() ReplaceAllTCPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPCheckBackendParams contains all the bound params for the replace all TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPCheckBackend -type ReplaceAllTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPChecks - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPCheckBackendParams() beforehand. -func (o *ReplaceAllTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPChecks - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/replace_all_tcp_check_backend_responses.go b/operations/tcp_check/replace_all_tcp_check_backend_responses.go deleted file mode 100644 index c6f7950b..00000000 --- a/operations/tcp_check/replace_all_tcp_check_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPCheckBackendOKCode is the HTTP code returned for type ReplaceAllTCPCheckBackendOK -const ReplaceAllTCPCheckBackendOKCode int = 200 - -/* -ReplaceAllTCPCheckBackendOK All TCP Check lines replaced - -swagger:response replaceAllTcpCheckBackendOK -*/ -type ReplaceAllTCPCheckBackendOK struct { - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckBackendOK creates ReplaceAllTCPCheckBackendOK with default headers values -func NewReplaceAllTCPCheckBackendOK() *ReplaceAllTCPCheckBackendOK { - - return &ReplaceAllTCPCheckBackendOK{} -} - -// WithPayload adds the payload to the replace all Tcp check backend o k response -func (o *ReplaceAllTCPCheckBackendOK) WithPayload(payload models.TCPChecks) *ReplaceAllTCPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check backend o k response -func (o *ReplaceAllTCPCheckBackendOK) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPCheckBackendAcceptedCode is the HTTP code returned for type ReplaceAllTCPCheckBackendAccepted -const ReplaceAllTCPCheckBackendAcceptedCode int = 202 - -/* -ReplaceAllTCPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpCheckBackendAccepted -*/ -type ReplaceAllTCPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckBackendAccepted creates ReplaceAllTCPCheckBackendAccepted with default headers values -func NewReplaceAllTCPCheckBackendAccepted() *ReplaceAllTCPCheckBackendAccepted { - - return &ReplaceAllTCPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp check backend accepted response -func (o *ReplaceAllTCPCheckBackendAccepted) WithReloadID(reloadID string) *ReplaceAllTCPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp check backend accepted response -func (o *ReplaceAllTCPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp check backend accepted response -func (o *ReplaceAllTCPCheckBackendAccepted) WithPayload(payload models.TCPChecks) *ReplaceAllTCPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check backend accepted response -func (o *ReplaceAllTCPCheckBackendAccepted) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPCheckBackendBadRequestCode is the HTTP code returned for type ReplaceAllTCPCheckBackendBadRequest -const ReplaceAllTCPCheckBackendBadRequestCode int = 400 - -/* -ReplaceAllTCPCheckBackendBadRequest Bad request - -swagger:response replaceAllTcpCheckBackendBadRequest -*/ -type ReplaceAllTCPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckBackendBadRequest creates ReplaceAllTCPCheckBackendBadRequest with default headers values -func NewReplaceAllTCPCheckBackendBadRequest() *ReplaceAllTCPCheckBackendBadRequest { - - return &ReplaceAllTCPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp check backend bad request response -func (o *ReplaceAllTCPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp check backend bad request response -func (o *ReplaceAllTCPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp check backend bad request response -func (o *ReplaceAllTCPCheckBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check backend bad request response -func (o *ReplaceAllTCPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPCheckBackendDefault General Error - -swagger:response replaceAllTcpCheckBackendDefault -*/ -type ReplaceAllTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckBackendDefault creates ReplaceAllTCPCheckBackendDefault with default headers values -func NewReplaceAllTCPCheckBackendDefault(code int) *ReplaceAllTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) WithStatusCode(code int) *ReplaceAllTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) WithPayload(payload *models.Error) *ReplaceAllTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP check backend default response -func (o *ReplaceAllTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/replace_all_tcp_check_backend_urlbuilder.go b/operations/tcp_check/replace_all_tcp_check_backend_urlbuilder.go deleted file mode 100644 index 2bf293fe..00000000 --- a/operations/tcp_check/replace_all_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPCheckBackendURL generates an URL for the replace all TCP check backend operation -type ReplaceAllTCPCheckBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPCheckBackendURL) WithBasePath(bp string) *ReplaceAllTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/replace_all_tcp_check_defaults.go b/operations/tcp_check/replace_all_tcp_check_defaults.go deleted file mode 100644 index bff0b866..00000000 --- a/operations/tcp_check/replace_all_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPCheckDefaultsHandlerFunc turns a function with the right signature into a replace all TCP check defaults handler -type ReplaceAllTCPCheckDefaultsHandlerFunc func(ReplaceAllTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPCheckDefaultsHandlerFunc) Handle(params ReplaceAllTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPCheckDefaultsHandler interface for that can handle valid replace all TCP check defaults params -type ReplaceAllTCPCheckDefaultsHandler interface { - Handle(ReplaceAllTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPCheckDefaults creates a new http.Handler for the replace all TCP check defaults operation -func NewReplaceAllTCPCheckDefaults(ctx *middleware.Context, handler ReplaceAllTCPCheckDefaultsHandler) *ReplaceAllTCPCheckDefaults { - return &ReplaceAllTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPCheckDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks TCPCheck replaceAllTcpCheckDefaults - -# Replace an TCP Check list - -Replaces a whole list of TCP Checks with the list given in parameter -*/ -type ReplaceAllTCPCheckDefaults struct { - Context *middleware.Context - Handler ReplaceAllTCPCheckDefaultsHandler -} - -func (o *ReplaceAllTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/replace_all_tcp_check_defaults_parameters.go b/operations/tcp_check/replace_all_tcp_check_defaults_parameters.go deleted file mode 100644 index 6bad0a9c..00000000 --- a/operations/tcp_check/replace_all_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPCheckDefaultsParams creates a new ReplaceAllTCPCheckDefaultsParams object -// with the default values initialized. -func NewReplaceAllTCPCheckDefaultsParams() ReplaceAllTCPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPCheckDefaultsParams contains all the bound params for the replace all TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPCheckDefaults -type ReplaceAllTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPChecks - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPCheckDefaultsParams() beforehand. -func (o *ReplaceAllTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPChecks - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/replace_all_tcp_check_defaults_responses.go b/operations/tcp_check/replace_all_tcp_check_defaults_responses.go deleted file mode 100644 index 008c61db..00000000 --- a/operations/tcp_check/replace_all_tcp_check_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPCheckDefaultsOKCode is the HTTP code returned for type ReplaceAllTCPCheckDefaultsOK -const ReplaceAllTCPCheckDefaultsOKCode int = 200 - -/* -ReplaceAllTCPCheckDefaultsOK All TCP Check lines replaced - -swagger:response replaceAllTcpCheckDefaultsOK -*/ -type ReplaceAllTCPCheckDefaultsOK struct { - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckDefaultsOK creates ReplaceAllTCPCheckDefaultsOK with default headers values -func NewReplaceAllTCPCheckDefaultsOK() *ReplaceAllTCPCheckDefaultsOK { - - return &ReplaceAllTCPCheckDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Tcp check defaults o k response -func (o *ReplaceAllTCPCheckDefaultsOK) WithPayload(payload models.TCPChecks) *ReplaceAllTCPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check defaults o k response -func (o *ReplaceAllTCPCheckDefaultsOK) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPCheckDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllTCPCheckDefaultsAccepted -const ReplaceAllTCPCheckDefaultsAcceptedCode int = 202 - -/* -ReplaceAllTCPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpCheckDefaultsAccepted -*/ -type ReplaceAllTCPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPChecks `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckDefaultsAccepted creates ReplaceAllTCPCheckDefaultsAccepted with default headers values -func NewReplaceAllTCPCheckDefaultsAccepted() *ReplaceAllTCPCheckDefaultsAccepted { - - return &ReplaceAllTCPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp check defaults accepted response -func (o *ReplaceAllTCPCheckDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllTCPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp check defaults accepted response -func (o *ReplaceAllTCPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp check defaults accepted response -func (o *ReplaceAllTCPCheckDefaultsAccepted) WithPayload(payload models.TCPChecks) *ReplaceAllTCPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check defaults accepted response -func (o *ReplaceAllTCPCheckDefaultsAccepted) SetPayload(payload models.TCPChecks) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPChecks{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPCheckDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllTCPCheckDefaultsBadRequest -const ReplaceAllTCPCheckDefaultsBadRequestCode int = 400 - -/* -ReplaceAllTCPCheckDefaultsBadRequest Bad request - -swagger:response replaceAllTcpCheckDefaultsBadRequest -*/ -type ReplaceAllTCPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckDefaultsBadRequest creates ReplaceAllTCPCheckDefaultsBadRequest with default headers values -func NewReplaceAllTCPCheckDefaultsBadRequest() *ReplaceAllTCPCheckDefaultsBadRequest { - - return &ReplaceAllTCPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp check defaults bad request response -func (o *ReplaceAllTCPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp check defaults bad request response -func (o *ReplaceAllTCPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp check defaults bad request response -func (o *ReplaceAllTCPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp check defaults bad request response -func (o *ReplaceAllTCPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPCheckDefaultsDefault General Error - -swagger:response replaceAllTcpCheckDefaultsDefault -*/ -type ReplaceAllTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPCheckDefaultsDefault creates ReplaceAllTCPCheckDefaultsDefault with default headers values -func NewReplaceAllTCPCheckDefaultsDefault(code int) *ReplaceAllTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) WithStatusCode(code int) *ReplaceAllTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP check defaults default response -func (o *ReplaceAllTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/replace_all_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/replace_all_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index cf078214..00000000 --- a/operations/tcp_check/replace_all_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPCheckDefaultsURL generates an URL for the replace all TCP check defaults operation -type ReplaceAllTCPCheckDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPCheckDefaultsURL) WithBasePath(bp string) *ReplaceAllTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/replace_tcp_check_backend.go b/operations/tcp_check/replace_tcp_check_backend.go deleted file mode 100644 index 7fc779fd..00000000 --- a/operations/tcp_check/replace_tcp_check_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPCheckBackendHandlerFunc turns a function with the right signature into a replace TCP check backend handler -type ReplaceTCPCheckBackendHandlerFunc func(ReplaceTCPCheckBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPCheckBackendHandlerFunc) Handle(params ReplaceTCPCheckBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPCheckBackendHandler interface for that can handle valid replace TCP check backend params -type ReplaceTCPCheckBackendHandler interface { - Handle(ReplaceTCPCheckBackendParams, interface{}) middleware.Responder -} - -// NewReplaceTCPCheckBackend creates a new http.Handler for the replace TCP check backend operation -func NewReplaceTCPCheckBackend(ctx *middleware.Context, handler ReplaceTCPCheckBackendHandler) *ReplaceTCPCheckBackend { - return &ReplaceTCPCheckBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPCheckBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index} TCPCheck replaceTcpCheckBackend - -# Replace a TCP check - -Replaces a TCP Check configuration by it's index in the specified parent. -*/ -type ReplaceTCPCheckBackend struct { - Context *middleware.Context - Handler ReplaceTCPCheckBackendHandler -} - -func (o *ReplaceTCPCheckBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPCheckBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/replace_tcp_check_backend_parameters.go b/operations/tcp_check/replace_tcp_check_backend_parameters.go deleted file mode 100644 index 2519c621..00000000 --- a/operations/tcp_check/replace_tcp_check_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPCheckBackendParams creates a new ReplaceTCPCheckBackendParams object -// with the default values initialized. -func NewReplaceTCPCheckBackendParams() ReplaceTCPCheckBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPCheckBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPCheckBackendParams contains all the bound params for the replace TCP check backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPCheckBackend -type ReplaceTCPCheckBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPCheckBackendParams() beforehand. -func (o *ReplaceTCPCheckBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPCheckBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPCheckBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPCheckBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPCheckBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPCheckBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPCheckBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/replace_tcp_check_backend_responses.go b/operations/tcp_check/replace_tcp_check_backend_responses.go deleted file mode 100644 index b8ff8e80..00000000 --- a/operations/tcp_check/replace_tcp_check_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPCheckBackendOKCode is the HTTP code returned for type ReplaceTCPCheckBackendOK -const ReplaceTCPCheckBackendOKCode int = 200 - -/* -ReplaceTCPCheckBackendOK TCP check replaced - -swagger:response replaceTcpCheckBackendOK -*/ -type ReplaceTCPCheckBackendOK struct { - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewReplaceTCPCheckBackendOK creates ReplaceTCPCheckBackendOK with default headers values -func NewReplaceTCPCheckBackendOK() *ReplaceTCPCheckBackendOK { - - return &ReplaceTCPCheckBackendOK{} -} - -// WithPayload adds the payload to the replace Tcp check backend o k response -func (o *ReplaceTCPCheckBackendOK) WithPayload(payload *models.TCPCheck) *ReplaceTCPCheckBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check backend o k response -func (o *ReplaceTCPCheckBackendOK) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckBackendAcceptedCode is the HTTP code returned for type ReplaceTCPCheckBackendAccepted -const ReplaceTCPCheckBackendAcceptedCode int = 202 - -/* -ReplaceTCPCheckBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpCheckBackendAccepted -*/ -type ReplaceTCPCheckBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewReplaceTCPCheckBackendAccepted creates ReplaceTCPCheckBackendAccepted with default headers values -func NewReplaceTCPCheckBackendAccepted() *ReplaceTCPCheckBackendAccepted { - - return &ReplaceTCPCheckBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp check backend accepted response -func (o *ReplaceTCPCheckBackendAccepted) WithReloadID(reloadID string) *ReplaceTCPCheckBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp check backend accepted response -func (o *ReplaceTCPCheckBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp check backend accepted response -func (o *ReplaceTCPCheckBackendAccepted) WithPayload(payload *models.TCPCheck) *ReplaceTCPCheckBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check backend accepted response -func (o *ReplaceTCPCheckBackendAccepted) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckBackendBadRequestCode is the HTTP code returned for type ReplaceTCPCheckBackendBadRequest -const ReplaceTCPCheckBackendBadRequestCode int = 400 - -/* -ReplaceTCPCheckBackendBadRequest Bad request - -swagger:response replaceTcpCheckBackendBadRequest -*/ -type ReplaceTCPCheckBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckBackendBadRequest creates ReplaceTCPCheckBackendBadRequest with default headers values -func NewReplaceTCPCheckBackendBadRequest() *ReplaceTCPCheckBackendBadRequest { - - return &ReplaceTCPCheckBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp check backend bad request response -func (o *ReplaceTCPCheckBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp check backend bad request response -func (o *ReplaceTCPCheckBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp check backend bad request response -func (o *ReplaceTCPCheckBackendBadRequest) WithPayload(payload *models.Error) *ReplaceTCPCheckBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check backend bad request response -func (o *ReplaceTCPCheckBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckBackendNotFoundCode is the HTTP code returned for type ReplaceTCPCheckBackendNotFound -const ReplaceTCPCheckBackendNotFoundCode int = 404 - -/* -ReplaceTCPCheckBackendNotFound The specified resource was not found - -swagger:response replaceTcpCheckBackendNotFound -*/ -type ReplaceTCPCheckBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckBackendNotFound creates ReplaceTCPCheckBackendNotFound with default headers values -func NewReplaceTCPCheckBackendNotFound() *ReplaceTCPCheckBackendNotFound { - - return &ReplaceTCPCheckBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp check backend not found response -func (o *ReplaceTCPCheckBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp check backend not found response -func (o *ReplaceTCPCheckBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp check backend not found response -func (o *ReplaceTCPCheckBackendNotFound) WithPayload(payload *models.Error) *ReplaceTCPCheckBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check backend not found response -func (o *ReplaceTCPCheckBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPCheckBackendDefault General Error - -swagger:response replaceTcpCheckBackendDefault -*/ -type ReplaceTCPCheckBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckBackendDefault creates ReplaceTCPCheckBackendDefault with default headers values -func NewReplaceTCPCheckBackendDefault(code int) *ReplaceTCPCheckBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPCheckBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) WithStatusCode(code int) *ReplaceTCPCheckBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) WithPayload(payload *models.Error) *ReplaceTCPCheckBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP check backend default response -func (o *ReplaceTCPCheckBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/replace_tcp_check_backend_urlbuilder.go b/operations/tcp_check/replace_tcp_check_backend_urlbuilder.go deleted file mode 100644 index a2e09e77..00000000 --- a/operations/tcp_check/replace_tcp_check_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPCheckBackendURL generates an URL for the replace TCP check backend operation -type ReplaceTCPCheckBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPCheckBackendURL) WithBasePath(bp string) *ReplaceTCPCheckBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPCheckBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPCheckBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPCheckBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPCheckBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPCheckBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPCheckBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPCheckBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPCheckBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPCheckBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPCheckBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_check/replace_tcp_check_defaults.go b/operations/tcp_check/replace_tcp_check_defaults.go deleted file mode 100644 index bf0bef23..00000000 --- a/operations/tcp_check/replace_tcp_check_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPCheckDefaultsHandlerFunc turns a function with the right signature into a replace TCP check defaults handler -type ReplaceTCPCheckDefaultsHandlerFunc func(ReplaceTCPCheckDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPCheckDefaultsHandlerFunc) Handle(params ReplaceTCPCheckDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPCheckDefaultsHandler interface for that can handle valid replace TCP check defaults params -type ReplaceTCPCheckDefaultsHandler interface { - Handle(ReplaceTCPCheckDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceTCPCheckDefaults creates a new http.Handler for the replace TCP check defaults operation -func NewReplaceTCPCheckDefaults(ctx *middleware.Context, handler ReplaceTCPCheckDefaultsHandler) *ReplaceTCPCheckDefaults { - return &ReplaceTCPCheckDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPCheckDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index} TCPCheck replaceTcpCheckDefaults - -# Replace a TCP check - -Replaces a TCP Check configuration by it's index in the specified parent. -*/ -type ReplaceTCPCheckDefaults struct { - Context *middleware.Context - Handler ReplaceTCPCheckDefaultsHandler -} - -func (o *ReplaceTCPCheckDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPCheckDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_check/replace_tcp_check_defaults_parameters.go b/operations/tcp_check/replace_tcp_check_defaults_parameters.go deleted file mode 100644 index 9e1bd36b..00000000 --- a/operations/tcp_check/replace_tcp_check_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPCheckDefaultsParams creates a new ReplaceTCPCheckDefaultsParams object -// with the default values initialized. -func NewReplaceTCPCheckDefaultsParams() ReplaceTCPCheckDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPCheckDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPCheckDefaultsParams contains all the bound params for the replace TCP check defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPCheckDefaults -type ReplaceTCPCheckDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPCheck - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Check Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPCheckDefaultsParams() beforehand. -func (o *ReplaceTCPCheckDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPCheck - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPCheckDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPCheckDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPCheckDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPCheckDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPCheckDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPCheckDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_check/replace_tcp_check_defaults_responses.go b/operations/tcp_check/replace_tcp_check_defaults_responses.go deleted file mode 100644 index 94c78881..00000000 --- a/operations/tcp_check/replace_tcp_check_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPCheckDefaultsOKCode is the HTTP code returned for type ReplaceTCPCheckDefaultsOK -const ReplaceTCPCheckDefaultsOKCode int = 200 - -/* -ReplaceTCPCheckDefaultsOK TCP check replaced - -swagger:response replaceTcpCheckDefaultsOK -*/ -type ReplaceTCPCheckDefaultsOK struct { - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewReplaceTCPCheckDefaultsOK creates ReplaceTCPCheckDefaultsOK with default headers values -func NewReplaceTCPCheckDefaultsOK() *ReplaceTCPCheckDefaultsOK { - - return &ReplaceTCPCheckDefaultsOK{} -} - -// WithPayload adds the payload to the replace Tcp check defaults o k response -func (o *ReplaceTCPCheckDefaultsOK) WithPayload(payload *models.TCPCheck) *ReplaceTCPCheckDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check defaults o k response -func (o *ReplaceTCPCheckDefaultsOK) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckDefaultsAcceptedCode is the HTTP code returned for type ReplaceTCPCheckDefaultsAccepted -const ReplaceTCPCheckDefaultsAcceptedCode int = 202 - -/* -ReplaceTCPCheckDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpCheckDefaultsAccepted -*/ -type ReplaceTCPCheckDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPCheck `json:"body,omitempty"` -} - -// NewReplaceTCPCheckDefaultsAccepted creates ReplaceTCPCheckDefaultsAccepted with default headers values -func NewReplaceTCPCheckDefaultsAccepted() *ReplaceTCPCheckDefaultsAccepted { - - return &ReplaceTCPCheckDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp check defaults accepted response -func (o *ReplaceTCPCheckDefaultsAccepted) WithReloadID(reloadID string) *ReplaceTCPCheckDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp check defaults accepted response -func (o *ReplaceTCPCheckDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp check defaults accepted response -func (o *ReplaceTCPCheckDefaultsAccepted) WithPayload(payload *models.TCPCheck) *ReplaceTCPCheckDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check defaults accepted response -func (o *ReplaceTCPCheckDefaultsAccepted) SetPayload(payload *models.TCPCheck) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckDefaultsBadRequestCode is the HTTP code returned for type ReplaceTCPCheckDefaultsBadRequest -const ReplaceTCPCheckDefaultsBadRequestCode int = 400 - -/* -ReplaceTCPCheckDefaultsBadRequest Bad request - -swagger:response replaceTcpCheckDefaultsBadRequest -*/ -type ReplaceTCPCheckDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckDefaultsBadRequest creates ReplaceTCPCheckDefaultsBadRequest with default headers values -func NewReplaceTCPCheckDefaultsBadRequest() *ReplaceTCPCheckDefaultsBadRequest { - - return &ReplaceTCPCheckDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp check defaults bad request response -func (o *ReplaceTCPCheckDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp check defaults bad request response -func (o *ReplaceTCPCheckDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp check defaults bad request response -func (o *ReplaceTCPCheckDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceTCPCheckDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check defaults bad request response -func (o *ReplaceTCPCheckDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPCheckDefaultsNotFoundCode is the HTTP code returned for type ReplaceTCPCheckDefaultsNotFound -const ReplaceTCPCheckDefaultsNotFoundCode int = 404 - -/* -ReplaceTCPCheckDefaultsNotFound The specified resource was not found - -swagger:response replaceTcpCheckDefaultsNotFound -*/ -type ReplaceTCPCheckDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckDefaultsNotFound creates ReplaceTCPCheckDefaultsNotFound with default headers values -func NewReplaceTCPCheckDefaultsNotFound() *ReplaceTCPCheckDefaultsNotFound { - - return &ReplaceTCPCheckDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp check defaults not found response -func (o *ReplaceTCPCheckDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp check defaults not found response -func (o *ReplaceTCPCheckDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp check defaults not found response -func (o *ReplaceTCPCheckDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceTCPCheckDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp check defaults not found response -func (o *ReplaceTCPCheckDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPCheckDefaultsDefault General Error - -swagger:response replaceTcpCheckDefaultsDefault -*/ -type ReplaceTCPCheckDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPCheckDefaultsDefault creates ReplaceTCPCheckDefaultsDefault with default headers values -func NewReplaceTCPCheckDefaultsDefault(code int) *ReplaceTCPCheckDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPCheckDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) WithStatusCode(code int) *ReplaceTCPCheckDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPCheckDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) WithPayload(payload *models.Error) *ReplaceTCPCheckDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP check defaults default response -func (o *ReplaceTCPCheckDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPCheckDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_check/replace_tcp_check_defaults_urlbuilder.go b/operations/tcp_check/replace_tcp_check_defaults_urlbuilder.go deleted file mode 100644 index 846bdd9c..00000000 --- a/operations/tcp_check/replace_tcp_check_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_check - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPCheckDefaultsURL generates an URL for the replace TCP check defaults operation -type ReplaceTCPCheckDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPCheckDefaultsURL) WithBasePath(bp string) *ReplaceTCPCheckDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPCheckDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPCheckDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPCheckDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPCheckDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPCheckDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPCheckDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPCheckDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPCheckDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPCheckDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPCheckDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_backend.go b/operations/tcp_request_rule/create_tcp_request_rule_backend.go deleted file mode 100644 index cadc24e4..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a create TCP request rule backend handler -type CreateTCPRequestRuleBackendHandlerFunc func(CreateTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPRequestRuleBackendHandlerFunc) Handle(params CreateTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPRequestRuleBackendHandler interface for that can handle valid create TCP request rule backend params -type CreateTCPRequestRuleBackendHandler interface { - Handle(CreateTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateTCPRequestRuleBackend creates a new http.Handler for the create TCP request rule backend operation -func NewCreateTCPRequestRuleBackend(ctx *middleware.Context, handler CreateTCPRequestRuleBackendHandler) *CreateTCPRequestRuleBackend { - return &CreateTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateTCPRequestRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index} TCPRequestRule createTcpRequestRuleBackend - -# Add a new TCP Request Rule - -Adds a new TCP Request Rule of the specified type in the specified parent. -*/ -type CreateTCPRequestRuleBackend struct { - Context *middleware.Context - Handler CreateTCPRequestRuleBackendHandler -} - -func (o *CreateTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/create_tcp_request_rule_backend_parameters.go deleted file mode 100644 index d26e46fe..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPRequestRuleBackendParams creates a new CreateTCPRequestRuleBackendParams object -// with the default values initialized. -func NewCreateTCPRequestRuleBackendParams() CreateTCPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPRequestRuleBackendParams contains all the bound params for the create TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPRequestRuleBackend -type CreateTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPRequestRuleBackendParams() beforehand. -func (o *CreateTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/create_tcp_request_rule_backend_responses.go deleted file mode 100644 index 4931504a..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPRequestRuleBackendCreatedCode is the HTTP code returned for type CreateTCPRequestRuleBackendCreated -const CreateTCPRequestRuleBackendCreatedCode int = 201 - -/* -CreateTCPRequestRuleBackendCreated TCP Request Rule created - -swagger:response createTcpRequestRuleBackendCreated -*/ -type CreateTCPRequestRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleBackendCreated creates CreateTCPRequestRuleBackendCreated with default headers values -func NewCreateTCPRequestRuleBackendCreated() *CreateTCPRequestRuleBackendCreated { - - return &CreateTCPRequestRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Tcp request rule backend created response -func (o *CreateTCPRequestRuleBackendCreated) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule backend created response -func (o *CreateTCPRequestRuleBackendCreated) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleBackendAcceptedCode is the HTTP code returned for type CreateTCPRequestRuleBackendAccepted -const CreateTCPRequestRuleBackendAcceptedCode int = 202 - -/* -CreateTCPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createTcpRequestRuleBackendAccepted -*/ -type CreateTCPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleBackendAccepted creates CreateTCPRequestRuleBackendAccepted with default headers values -func NewCreateTCPRequestRuleBackendAccepted() *CreateTCPRequestRuleBackendAccepted { - - return &CreateTCPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp request rule backend accepted response -func (o *CreateTCPRequestRuleBackendAccepted) WithReloadID(reloadID string) *CreateTCPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp request rule backend accepted response -func (o *CreateTCPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp request rule backend accepted response -func (o *CreateTCPRequestRuleBackendAccepted) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule backend accepted response -func (o *CreateTCPRequestRuleBackendAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleBackendBadRequestCode is the HTTP code returned for type CreateTCPRequestRuleBackendBadRequest -const CreateTCPRequestRuleBackendBadRequestCode int = 400 - -/* -CreateTCPRequestRuleBackendBadRequest Bad request - -swagger:response createTcpRequestRuleBackendBadRequest -*/ -type CreateTCPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleBackendBadRequest creates CreateTCPRequestRuleBackendBadRequest with default headers values -func NewCreateTCPRequestRuleBackendBadRequest() *CreateTCPRequestRuleBackendBadRequest { - - return &CreateTCPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule backend bad request response -func (o *CreateTCPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule backend bad request response -func (o *CreateTCPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule backend bad request response -func (o *CreateTCPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateTCPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule backend bad request response -func (o *CreateTCPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleBackendConflictCode is the HTTP code returned for type CreateTCPRequestRuleBackendConflict -const CreateTCPRequestRuleBackendConflictCode int = 409 - -/* -CreateTCPRequestRuleBackendConflict The specified resource already exists - -swagger:response createTcpRequestRuleBackendConflict -*/ -type CreateTCPRequestRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleBackendConflict creates CreateTCPRequestRuleBackendConflict with default headers values -func NewCreateTCPRequestRuleBackendConflict() *CreateTCPRequestRuleBackendConflict { - - return &CreateTCPRequestRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule backend conflict response -func (o *CreateTCPRequestRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule backend conflict response -func (o *CreateTCPRequestRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule backend conflict response -func (o *CreateTCPRequestRuleBackendConflict) WithPayload(payload *models.Error) *CreateTCPRequestRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule backend conflict response -func (o *CreateTCPRequestRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPRequestRuleBackendDefault General Error - -swagger:response createTcpRequestRuleBackendDefault -*/ -type CreateTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleBackendDefault creates CreateTCPRequestRuleBackendDefault with default headers values -func NewCreateTCPRequestRuleBackendDefault(code int) *CreateTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) WithStatusCode(code int) *CreateTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *CreateTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP request rule backend default response -func (o *CreateTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/create_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index 46c154c2..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPRequestRuleBackendURL generates an URL for the create TCP request rule backend operation -type CreateTCPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleBackendURL) WithBasePath(bp string) *CreateTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_defaults.go b/operations/tcp_request_rule/create_tcp_request_rule_defaults.go deleted file mode 100644 index 7f3eee00..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a create TCP request rule defaults handler -type CreateTCPRequestRuleDefaultsHandlerFunc func(CreateTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPRequestRuleDefaultsHandlerFunc) Handle(params CreateTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPRequestRuleDefaultsHandler interface for that can handle valid create TCP request rule defaults params -type CreateTCPRequestRuleDefaultsHandler interface { - Handle(CreateTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateTCPRequestRuleDefaults creates a new http.Handler for the create TCP request rule defaults operation -func NewCreateTCPRequestRuleDefaults(ctx *middleware.Context, handler CreateTCPRequestRuleDefaultsHandler) *CreateTCPRequestRuleDefaults { - return &CreateTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateTCPRequestRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index} TCPRequestRule createTcpRequestRuleDefaults - -# Add a new TCP Request Rule - -Adds a new TCP Request Rule of the specified type in the specified parent. -*/ -type CreateTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler CreateTCPRequestRuleDefaultsHandler -} - -func (o *CreateTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/create_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index 67b0f6d1..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPRequestRuleDefaultsParams creates a new CreateTCPRequestRuleDefaultsParams object -// with the default values initialized. -func NewCreateTCPRequestRuleDefaultsParams() CreateTCPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPRequestRuleDefaultsParams contains all the bound params for the create TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPRequestRuleDefaults -type CreateTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPRequestRuleDefaultsParams() beforehand. -func (o *CreateTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/create_tcp_request_rule_defaults_responses.go deleted file mode 100644 index acf568d6..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPRequestRuleDefaultsCreatedCode is the HTTP code returned for type CreateTCPRequestRuleDefaultsCreated -const CreateTCPRequestRuleDefaultsCreatedCode int = 201 - -/* -CreateTCPRequestRuleDefaultsCreated TCP Request Rule created - -swagger:response createTcpRequestRuleDefaultsCreated -*/ -type CreateTCPRequestRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleDefaultsCreated creates CreateTCPRequestRuleDefaultsCreated with default headers values -func NewCreateTCPRequestRuleDefaultsCreated() *CreateTCPRequestRuleDefaultsCreated { - - return &CreateTCPRequestRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Tcp request rule defaults created response -func (o *CreateTCPRequestRuleDefaultsCreated) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule defaults created response -func (o *CreateTCPRequestRuleDefaultsCreated) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type CreateTCPRequestRuleDefaultsAccepted -const CreateTCPRequestRuleDefaultsAcceptedCode int = 202 - -/* -CreateTCPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createTcpRequestRuleDefaultsAccepted -*/ -type CreateTCPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleDefaultsAccepted creates CreateTCPRequestRuleDefaultsAccepted with default headers values -func NewCreateTCPRequestRuleDefaultsAccepted() *CreateTCPRequestRuleDefaultsAccepted { - - return &CreateTCPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp request rule defaults accepted response -func (o *CreateTCPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateTCPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp request rule defaults accepted response -func (o *CreateTCPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp request rule defaults accepted response -func (o *CreateTCPRequestRuleDefaultsAccepted) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule defaults accepted response -func (o *CreateTCPRequestRuleDefaultsAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type CreateTCPRequestRuleDefaultsBadRequest -const CreateTCPRequestRuleDefaultsBadRequestCode int = 400 - -/* -CreateTCPRequestRuleDefaultsBadRequest Bad request - -swagger:response createTcpRequestRuleDefaultsBadRequest -*/ -type CreateTCPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleDefaultsBadRequest creates CreateTCPRequestRuleDefaultsBadRequest with default headers values -func NewCreateTCPRequestRuleDefaultsBadRequest() *CreateTCPRequestRuleDefaultsBadRequest { - - return &CreateTCPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule defaults bad request response -func (o *CreateTCPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule defaults bad request response -func (o *CreateTCPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule defaults bad request response -func (o *CreateTCPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateTCPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule defaults bad request response -func (o *CreateTCPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleDefaultsConflictCode is the HTTP code returned for type CreateTCPRequestRuleDefaultsConflict -const CreateTCPRequestRuleDefaultsConflictCode int = 409 - -/* -CreateTCPRequestRuleDefaultsConflict The specified resource already exists - -swagger:response createTcpRequestRuleDefaultsConflict -*/ -type CreateTCPRequestRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleDefaultsConflict creates CreateTCPRequestRuleDefaultsConflict with default headers values -func NewCreateTCPRequestRuleDefaultsConflict() *CreateTCPRequestRuleDefaultsConflict { - - return &CreateTCPRequestRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule defaults conflict response -func (o *CreateTCPRequestRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule defaults conflict response -func (o *CreateTCPRequestRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule defaults conflict response -func (o *CreateTCPRequestRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateTCPRequestRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule defaults conflict response -func (o *CreateTCPRequestRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPRequestRuleDefaultsDefault General Error - -swagger:response createTcpRequestRuleDefaultsDefault -*/ -type CreateTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleDefaultsDefault creates CreateTCPRequestRuleDefaultsDefault with default headers values -func NewCreateTCPRequestRuleDefaultsDefault(code int) *CreateTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *CreateTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP request rule defaults default response -func (o *CreateTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/create_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 57f17d15..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPRequestRuleDefaultsURL generates an URL for the create TCP request rule defaults operation -type CreateTCPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleDefaultsURL) WithBasePath(bp string) *CreateTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_frontend.go b/operations/tcp_request_rule/create_tcp_request_rule_frontend.go deleted file mode 100644 index e2a45b59..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a create TCP request rule frontend handler -type CreateTCPRequestRuleFrontendHandlerFunc func(CreateTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPRequestRuleFrontendHandlerFunc) Handle(params CreateTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPRequestRuleFrontendHandler interface for that can handle valid create TCP request rule frontend params -type CreateTCPRequestRuleFrontendHandler interface { - Handle(CreateTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewCreateTCPRequestRuleFrontend creates a new http.Handler for the create TCP request rule frontend operation -func NewCreateTCPRequestRuleFrontend(ctx *middleware.Context, handler CreateTCPRequestRuleFrontendHandler) *CreateTCPRequestRuleFrontend { - return &CreateTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - CreateTCPRequestRuleFrontend swagger:route POST /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index} TCPRequestRule createTcpRequestRuleFrontend - -# Add a new TCP Request Rule - -Adds a new TCP Request Rule of the specified type in the specified parent. -*/ -type CreateTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler CreateTCPRequestRuleFrontendHandler -} - -func (o *CreateTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/create_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index 1bb09dc4..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPRequestRuleFrontendParams creates a new CreateTCPRequestRuleFrontendParams object -// with the default values initialized. -func NewCreateTCPRequestRuleFrontendParams() CreateTCPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPRequestRuleFrontendParams contains all the bound params for the create TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPRequestRuleFrontend -type CreateTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPRequestRuleFrontendParams() beforehand. -func (o *CreateTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/create_tcp_request_rule_frontend_responses.go deleted file mode 100644 index fb362a83..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPRequestRuleFrontendCreatedCode is the HTTP code returned for type CreateTCPRequestRuleFrontendCreated -const CreateTCPRequestRuleFrontendCreatedCode int = 201 - -/* -CreateTCPRequestRuleFrontendCreated TCP Request Rule created - -swagger:response createTcpRequestRuleFrontendCreated -*/ -type CreateTCPRequestRuleFrontendCreated struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleFrontendCreated creates CreateTCPRequestRuleFrontendCreated with default headers values -func NewCreateTCPRequestRuleFrontendCreated() *CreateTCPRequestRuleFrontendCreated { - - return &CreateTCPRequestRuleFrontendCreated{} -} - -// WithPayload adds the payload to the create Tcp request rule frontend created response -func (o *CreateTCPRequestRuleFrontendCreated) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleFrontendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule frontend created response -func (o *CreateTCPRequestRuleFrontendCreated) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleFrontendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleFrontendAcceptedCode is the HTTP code returned for type CreateTCPRequestRuleFrontendAccepted -const CreateTCPRequestRuleFrontendAcceptedCode int = 202 - -/* -CreateTCPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response createTcpRequestRuleFrontendAccepted -*/ -type CreateTCPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleFrontendAccepted creates CreateTCPRequestRuleFrontendAccepted with default headers values -func NewCreateTCPRequestRuleFrontendAccepted() *CreateTCPRequestRuleFrontendAccepted { - - return &CreateTCPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp request rule frontend accepted response -func (o *CreateTCPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *CreateTCPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp request rule frontend accepted response -func (o *CreateTCPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp request rule frontend accepted response -func (o *CreateTCPRequestRuleFrontendAccepted) WithPayload(payload *models.TCPRequestRule) *CreateTCPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule frontend accepted response -func (o *CreateTCPRequestRuleFrontendAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleFrontendBadRequestCode is the HTTP code returned for type CreateTCPRequestRuleFrontendBadRequest -const CreateTCPRequestRuleFrontendBadRequestCode int = 400 - -/* -CreateTCPRequestRuleFrontendBadRequest Bad request - -swagger:response createTcpRequestRuleFrontendBadRequest -*/ -type CreateTCPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleFrontendBadRequest creates CreateTCPRequestRuleFrontendBadRequest with default headers values -func NewCreateTCPRequestRuleFrontendBadRequest() *CreateTCPRequestRuleFrontendBadRequest { - - return &CreateTCPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule frontend bad request response -func (o *CreateTCPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule frontend bad request response -func (o *CreateTCPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule frontend bad request response -func (o *CreateTCPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *CreateTCPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule frontend bad request response -func (o *CreateTCPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPRequestRuleFrontendConflictCode is the HTTP code returned for type CreateTCPRequestRuleFrontendConflict -const CreateTCPRequestRuleFrontendConflictCode int = 409 - -/* -CreateTCPRequestRuleFrontendConflict The specified resource already exists - -swagger:response createTcpRequestRuleFrontendConflict -*/ -type CreateTCPRequestRuleFrontendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleFrontendConflict creates CreateTCPRequestRuleFrontendConflict with default headers values -func NewCreateTCPRequestRuleFrontendConflict() *CreateTCPRequestRuleFrontendConflict { - - return &CreateTCPRequestRuleFrontendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp request rule frontend conflict response -func (o *CreateTCPRequestRuleFrontendConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleFrontendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp request rule frontend conflict response -func (o *CreateTCPRequestRuleFrontendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp request rule frontend conflict response -func (o *CreateTCPRequestRuleFrontendConflict) WithPayload(payload *models.Error) *CreateTCPRequestRuleFrontendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp request rule frontend conflict response -func (o *CreateTCPRequestRuleFrontendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleFrontendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPRequestRuleFrontendDefault General Error - -swagger:response createTcpRequestRuleFrontendDefault -*/ -type CreateTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPRequestRuleFrontendDefault creates CreateTCPRequestRuleFrontendDefault with default headers values -func NewCreateTCPRequestRuleFrontendDefault(code int) *CreateTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) WithStatusCode(code int) *CreateTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *CreateTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP request rule frontend default response -func (o *CreateTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/create_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/create_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 8f8ab37b..00000000 --- a/operations/tcp_request_rule/create_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPRequestRuleFrontendURL generates an URL for the create TCP request rule frontend operation -type CreateTCPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleFrontendURL) WithBasePath(bp string) *CreateTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_backend.go b/operations/tcp_request_rule/delete_tcp_request_rule_backend.go deleted file mode 100644 index d5594d77..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a delete TCP request rule backend handler -type DeleteTCPRequestRuleBackendHandlerFunc func(DeleteTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPRequestRuleBackendHandlerFunc) Handle(params DeleteTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPRequestRuleBackendHandler interface for that can handle valid delete TCP request rule backend params -type DeleteTCPRequestRuleBackendHandler interface { - Handle(DeleteTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteTCPRequestRuleBackend creates a new http.Handler for the delete TCP request rule backend operation -func NewDeleteTCPRequestRuleBackend(ctx *middleware.Context, handler DeleteTCPRequestRuleBackendHandler) *DeleteTCPRequestRuleBackend { - return &DeleteTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteTCPRequestRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index} TCPRequestRule deleteTcpRequestRuleBackend - -# Delete a TCP Request Rule - -Deletes a TCP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteTCPRequestRuleBackend struct { - Context *middleware.Context - Handler DeleteTCPRequestRuleBackendHandler -} - -func (o *DeleteTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/delete_tcp_request_rule_backend_parameters.go deleted file mode 100644 index a91a9ade..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPRequestRuleBackendParams creates a new DeleteTCPRequestRuleBackendParams object -// with the default values initialized. -func NewDeleteTCPRequestRuleBackendParams() DeleteTCPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPRequestRuleBackendParams contains all the bound params for the delete TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPRequestRuleBackend -type DeleteTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPRequestRuleBackendParams() beforehand. -func (o *DeleteTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/delete_tcp_request_rule_backend_responses.go deleted file mode 100644 index 4608b23c..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPRequestRuleBackendAcceptedCode is the HTTP code returned for type DeleteTCPRequestRuleBackendAccepted -const DeleteTCPRequestRuleBackendAcceptedCode int = 202 - -/* -DeleteTCPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpRequestRuleBackendAccepted -*/ -type DeleteTCPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPRequestRuleBackendAccepted creates DeleteTCPRequestRuleBackendAccepted with default headers values -func NewDeleteTCPRequestRuleBackendAccepted() *DeleteTCPRequestRuleBackendAccepted { - - return &DeleteTCPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp request rule backend accepted response -func (o *DeleteTCPRequestRuleBackendAccepted) WithReloadID(reloadID string) *DeleteTCPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp request rule backend accepted response -func (o *DeleteTCPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPRequestRuleBackendNoContentCode is the HTTP code returned for type DeleteTCPRequestRuleBackendNoContent -const DeleteTCPRequestRuleBackendNoContentCode int = 204 - -/* -DeleteTCPRequestRuleBackendNoContent TCP Request Rule deleted - -swagger:response deleteTcpRequestRuleBackendNoContent -*/ -type DeleteTCPRequestRuleBackendNoContent struct { -} - -// NewDeleteTCPRequestRuleBackendNoContent creates DeleteTCPRequestRuleBackendNoContent with default headers values -func NewDeleteTCPRequestRuleBackendNoContent() *DeleteTCPRequestRuleBackendNoContent { - - return &DeleteTCPRequestRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPRequestRuleBackendNotFoundCode is the HTTP code returned for type DeleteTCPRequestRuleBackendNotFound -const DeleteTCPRequestRuleBackendNotFoundCode int = 404 - -/* -DeleteTCPRequestRuleBackendNotFound The specified resource was not found - -swagger:response deleteTcpRequestRuleBackendNotFound -*/ -type DeleteTCPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleBackendNotFound creates DeleteTCPRequestRuleBackendNotFound with default headers values -func NewDeleteTCPRequestRuleBackendNotFound() *DeleteTCPRequestRuleBackendNotFound { - - return &DeleteTCPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp request rule backend not found response -func (o *DeleteTCPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp request rule backend not found response -func (o *DeleteTCPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp request rule backend not found response -func (o *DeleteTCPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteTCPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp request rule backend not found response -func (o *DeleteTCPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPRequestRuleBackendDefault General Error - -swagger:response deleteTcpRequestRuleBackendDefault -*/ -type DeleteTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleBackendDefault creates DeleteTCPRequestRuleBackendDefault with default headers values -func NewDeleteTCPRequestRuleBackendDefault(code int) *DeleteTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) WithStatusCode(code int) *DeleteTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *DeleteTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP request rule backend default response -func (o *DeleteTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/delete_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index 4ec6022e..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPRequestRuleBackendURL generates an URL for the delete TCP request rule backend operation -type DeleteTCPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleBackendURL) WithBasePath(bp string) *DeleteTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_defaults.go b/operations/tcp_request_rule/delete_tcp_request_rule_defaults.go deleted file mode 100644 index 7419e5ce..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a delete TCP request rule defaults handler -type DeleteTCPRequestRuleDefaultsHandlerFunc func(DeleteTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPRequestRuleDefaultsHandlerFunc) Handle(params DeleteTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPRequestRuleDefaultsHandler interface for that can handle valid delete TCP request rule defaults params -type DeleteTCPRequestRuleDefaultsHandler interface { - Handle(DeleteTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteTCPRequestRuleDefaults creates a new http.Handler for the delete TCP request rule defaults operation -func NewDeleteTCPRequestRuleDefaults(ctx *middleware.Context, handler DeleteTCPRequestRuleDefaultsHandler) *DeleteTCPRequestRuleDefaults { - return &DeleteTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteTCPRequestRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index} TCPRequestRule deleteTcpRequestRuleDefaults - -# Delete a TCP Request Rule - -Deletes a TCP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler DeleteTCPRequestRuleDefaultsHandler -} - -func (o *DeleteTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/delete_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index 6aafb50f..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPRequestRuleDefaultsParams creates a new DeleteTCPRequestRuleDefaultsParams object -// with the default values initialized. -func NewDeleteTCPRequestRuleDefaultsParams() DeleteTCPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPRequestRuleDefaultsParams contains all the bound params for the delete TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPRequestRuleDefaults -type DeleteTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPRequestRuleDefaultsParams() beforehand. -func (o *DeleteTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/delete_tcp_request_rule_defaults_responses.go deleted file mode 100644 index 5b04ff17..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteTCPRequestRuleDefaultsAccepted -const DeleteTCPRequestRuleDefaultsAcceptedCode int = 202 - -/* -DeleteTCPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpRequestRuleDefaultsAccepted -*/ -type DeleteTCPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPRequestRuleDefaultsAccepted creates DeleteTCPRequestRuleDefaultsAccepted with default headers values -func NewDeleteTCPRequestRuleDefaultsAccepted() *DeleteTCPRequestRuleDefaultsAccepted { - - return &DeleteTCPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp request rule defaults accepted response -func (o *DeleteTCPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteTCPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp request rule defaults accepted response -func (o *DeleteTCPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPRequestRuleDefaultsNoContentCode is the HTTP code returned for type DeleteTCPRequestRuleDefaultsNoContent -const DeleteTCPRequestRuleDefaultsNoContentCode int = 204 - -/* -DeleteTCPRequestRuleDefaultsNoContent TCP Request Rule deleted - -swagger:response deleteTcpRequestRuleDefaultsNoContent -*/ -type DeleteTCPRequestRuleDefaultsNoContent struct { -} - -// NewDeleteTCPRequestRuleDefaultsNoContent creates DeleteTCPRequestRuleDefaultsNoContent with default headers values -func NewDeleteTCPRequestRuleDefaultsNoContent() *DeleteTCPRequestRuleDefaultsNoContent { - - return &DeleteTCPRequestRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteTCPRequestRuleDefaultsNotFound -const DeleteTCPRequestRuleDefaultsNotFoundCode int = 404 - -/* -DeleteTCPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteTcpRequestRuleDefaultsNotFound -*/ -type DeleteTCPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleDefaultsNotFound creates DeleteTCPRequestRuleDefaultsNotFound with default headers values -func NewDeleteTCPRequestRuleDefaultsNotFound() *DeleteTCPRequestRuleDefaultsNotFound { - - return &DeleteTCPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp request rule defaults not found response -func (o *DeleteTCPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp request rule defaults not found response -func (o *DeleteTCPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp request rule defaults not found response -func (o *DeleteTCPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteTCPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp request rule defaults not found response -func (o *DeleteTCPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPRequestRuleDefaultsDefault General Error - -swagger:response deleteTcpRequestRuleDefaultsDefault -*/ -type DeleteTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleDefaultsDefault creates DeleteTCPRequestRuleDefaultsDefault with default headers values -func NewDeleteTCPRequestRuleDefaultsDefault(code int) *DeleteTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *DeleteTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP request rule defaults default response -func (o *DeleteTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/delete_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index a728fda9..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPRequestRuleDefaultsURL generates an URL for the delete TCP request rule defaults operation -type DeleteTCPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleDefaultsURL) WithBasePath(bp string) *DeleteTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_frontend.go b/operations/tcp_request_rule/delete_tcp_request_rule_frontend.go deleted file mode 100644 index 4690df67..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a delete TCP request rule frontend handler -type DeleteTCPRequestRuleFrontendHandlerFunc func(DeleteTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPRequestRuleFrontendHandlerFunc) Handle(params DeleteTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPRequestRuleFrontendHandler interface for that can handle valid delete TCP request rule frontend params -type DeleteTCPRequestRuleFrontendHandler interface { - Handle(DeleteTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewDeleteTCPRequestRuleFrontend creates a new http.Handler for the delete TCP request rule frontend operation -func NewDeleteTCPRequestRuleFrontend(ctx *middleware.Context, handler DeleteTCPRequestRuleFrontendHandler) *DeleteTCPRequestRuleFrontend { - return &DeleteTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - DeleteTCPRequestRuleFrontend swagger:route DELETE /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index} TCPRequestRule deleteTcpRequestRuleFrontend - -# Delete a TCP Request Rule - -Deletes a TCP Request Rule configuration by it's index from the specified parent. -*/ -type DeleteTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler DeleteTCPRequestRuleFrontendHandler -} - -func (o *DeleteTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/delete_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index f08d511b..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPRequestRuleFrontendParams creates a new DeleteTCPRequestRuleFrontendParams object -// with the default values initialized. -func NewDeleteTCPRequestRuleFrontendParams() DeleteTCPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPRequestRuleFrontendParams contains all the bound params for the delete TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPRequestRuleFrontend -type DeleteTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPRequestRuleFrontendParams() beforehand. -func (o *DeleteTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/delete_tcp_request_rule_frontend_responses.go deleted file mode 100644 index e2cb9ea6..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPRequestRuleFrontendAcceptedCode is the HTTP code returned for type DeleteTCPRequestRuleFrontendAccepted -const DeleteTCPRequestRuleFrontendAcceptedCode int = 202 - -/* -DeleteTCPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpRequestRuleFrontendAccepted -*/ -type DeleteTCPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPRequestRuleFrontendAccepted creates DeleteTCPRequestRuleFrontendAccepted with default headers values -func NewDeleteTCPRequestRuleFrontendAccepted() *DeleteTCPRequestRuleFrontendAccepted { - - return &DeleteTCPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp request rule frontend accepted response -func (o *DeleteTCPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *DeleteTCPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp request rule frontend accepted response -func (o *DeleteTCPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPRequestRuleFrontendNoContentCode is the HTTP code returned for type DeleteTCPRequestRuleFrontendNoContent -const DeleteTCPRequestRuleFrontendNoContentCode int = 204 - -/* -DeleteTCPRequestRuleFrontendNoContent TCP Request Rule deleted - -swagger:response deleteTcpRequestRuleFrontendNoContent -*/ -type DeleteTCPRequestRuleFrontendNoContent struct { -} - -// NewDeleteTCPRequestRuleFrontendNoContent creates DeleteTCPRequestRuleFrontendNoContent with default headers values -func NewDeleteTCPRequestRuleFrontendNoContent() *DeleteTCPRequestRuleFrontendNoContent { - - return &DeleteTCPRequestRuleFrontendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleFrontendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPRequestRuleFrontendNotFoundCode is the HTTP code returned for type DeleteTCPRequestRuleFrontendNotFound -const DeleteTCPRequestRuleFrontendNotFoundCode int = 404 - -/* -DeleteTCPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response deleteTcpRequestRuleFrontendNotFound -*/ -type DeleteTCPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleFrontendNotFound creates DeleteTCPRequestRuleFrontendNotFound with default headers values -func NewDeleteTCPRequestRuleFrontendNotFound() *DeleteTCPRequestRuleFrontendNotFound { - - return &DeleteTCPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp request rule frontend not found response -func (o *DeleteTCPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp request rule frontend not found response -func (o *DeleteTCPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp request rule frontend not found response -func (o *DeleteTCPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *DeleteTCPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp request rule frontend not found response -func (o *DeleteTCPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPRequestRuleFrontendDefault General Error - -swagger:response deleteTcpRequestRuleFrontendDefault -*/ -type DeleteTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPRequestRuleFrontendDefault creates DeleteTCPRequestRuleFrontendDefault with default headers values -func NewDeleteTCPRequestRuleFrontendDefault(code int) *DeleteTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) WithStatusCode(code int) *DeleteTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *DeleteTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP request rule frontend default response -func (o *DeleteTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/delete_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index a55d46d8..00000000 --- a/operations/tcp_request_rule/delete_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPRequestRuleFrontendURL generates an URL for the delete TCP request rule frontend operation -type DeleteTCPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleFrontendURL) WithBasePath(bp string) *DeleteTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_backend.go b/operations/tcp_request_rule/get_all_tcp_request_rule_backend.go deleted file mode 100644 index 266d7567..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a get all TCP request rule backend handler -type GetAllTCPRequestRuleBackendHandlerFunc func(GetAllTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPRequestRuleBackendHandlerFunc) Handle(params GetAllTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPRequestRuleBackendHandler interface for that can handle valid get all TCP request rule backend params -type GetAllTCPRequestRuleBackendHandler interface { - Handle(GetAllTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllTCPRequestRuleBackend creates a new http.Handler for the get all TCP request rule backend operation -func NewGetAllTCPRequestRuleBackend(ctx *middleware.Context, handler GetAllTCPRequestRuleBackendHandler) *GetAllTCPRequestRuleBackend { - return &GetAllTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllTCPRequestRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules TCPRequestRule getAllTcpRequestRuleBackend - -# Return an array of all TCP Request Rules - -Returns all TCP Request Rules that are configured in specified parent and parent type. -*/ -type GetAllTCPRequestRuleBackend struct { - Context *middleware.Context - Handler GetAllTCPRequestRuleBackendHandler -} - -func (o *GetAllTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/get_all_tcp_request_rule_backend_parameters.go deleted file mode 100644 index 4b5640fb..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPRequestRuleBackendParams creates a new GetAllTCPRequestRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPRequestRuleBackendParams() GetAllTCPRequestRuleBackendParams { - - return GetAllTCPRequestRuleBackendParams{} -} - -// GetAllTCPRequestRuleBackendParams contains all the bound params for the get all TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPRequestRuleBackend -type GetAllTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPRequestRuleBackendParams() beforehand. -func (o *GetAllTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/get_all_tcp_request_rule_backend_responses.go deleted file mode 100644 index 4b904e53..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPRequestRuleBackendOKCode is the HTTP code returned for type GetAllTCPRequestRuleBackendOK -const GetAllTCPRequestRuleBackendOKCode int = 200 - -/* -GetAllTCPRequestRuleBackendOK Successful operation - -swagger:response getAllTcpRequestRuleBackendOK -*/ -type GetAllTCPRequestRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleBackendOK creates GetAllTCPRequestRuleBackendOK with default headers values -func NewGetAllTCPRequestRuleBackendOK() *GetAllTCPRequestRuleBackendOK { - - return &GetAllTCPRequestRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp request rule backend o k response -func (o *GetAllTCPRequestRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp request rule backend o k response -func (o *GetAllTCPRequestRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp request rule backend o k response -func (o *GetAllTCPRequestRuleBackendOK) WithPayload(payload models.TCPRequestRules) *GetAllTCPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp request rule backend o k response -func (o *GetAllTCPRequestRuleBackendOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPRequestRuleBackendDefault General Error - -swagger:response getAllTcpRequestRuleBackendDefault -*/ -type GetAllTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleBackendDefault creates GetAllTCPRequestRuleBackendDefault with default headers values -func NewGetAllTCPRequestRuleBackendDefault(code int) *GetAllTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) WithStatusCode(code int) *GetAllTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *GetAllTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP request rule backend default response -func (o *GetAllTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/get_all_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index 8f65a488..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPRequestRuleBackendURL generates an URL for the get all TCP request rule backend operation -type GetAllTCPRequestRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleBackendURL) WithBasePath(bp string) *GetAllTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults.go b/operations/tcp_request_rule/get_all_tcp_request_rule_defaults.go deleted file mode 100644 index e6a48ee7..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a get all TCP request rule defaults handler -type GetAllTCPRequestRuleDefaultsHandlerFunc func(GetAllTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPRequestRuleDefaultsHandlerFunc) Handle(params GetAllTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPRequestRuleDefaultsHandler interface for that can handle valid get all TCP request rule defaults params -type GetAllTCPRequestRuleDefaultsHandler interface { - Handle(GetAllTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllTCPRequestRuleDefaults creates a new http.Handler for the get all TCP request rule defaults operation -func NewGetAllTCPRequestRuleDefaults(ctx *middleware.Context, handler GetAllTCPRequestRuleDefaultsHandler) *GetAllTCPRequestRuleDefaults { - return &GetAllTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllTCPRequestRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules TCPRequestRule getAllTcpRequestRuleDefaults - -# Return an array of all TCP Request Rules - -Returns all TCP Request Rules that are configured in specified parent and parent type. -*/ -type GetAllTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler GetAllTCPRequestRuleDefaultsHandler -} - -func (o *GetAllTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index 0c5b28dc..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPRequestRuleDefaultsParams creates a new GetAllTCPRequestRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPRequestRuleDefaultsParams() GetAllTCPRequestRuleDefaultsParams { - - return GetAllTCPRequestRuleDefaultsParams{} -} - -// GetAllTCPRequestRuleDefaultsParams contains all the bound params for the get all TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPRequestRuleDefaults -type GetAllTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPRequestRuleDefaultsParams() beforehand. -func (o *GetAllTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_responses.go deleted file mode 100644 index 31e52326..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPRequestRuleDefaultsOKCode is the HTTP code returned for type GetAllTCPRequestRuleDefaultsOK -const GetAllTCPRequestRuleDefaultsOKCode int = 200 - -/* -GetAllTCPRequestRuleDefaultsOK Successful operation - -swagger:response getAllTcpRequestRuleDefaultsOK -*/ -type GetAllTCPRequestRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleDefaultsOK creates GetAllTCPRequestRuleDefaultsOK with default headers values -func NewGetAllTCPRequestRuleDefaultsOK() *GetAllTCPRequestRuleDefaultsOK { - - return &GetAllTCPRequestRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp request rule defaults o k response -func (o *GetAllTCPRequestRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp request rule defaults o k response -func (o *GetAllTCPRequestRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp request rule defaults o k response -func (o *GetAllTCPRequestRuleDefaultsOK) WithPayload(payload models.TCPRequestRules) *GetAllTCPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp request rule defaults o k response -func (o *GetAllTCPRequestRuleDefaultsOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPRequestRuleDefaultsDefault General Error - -swagger:response getAllTcpRequestRuleDefaultsDefault -*/ -type GetAllTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleDefaultsDefault creates GetAllTCPRequestRuleDefaultsDefault with default headers values -func NewGetAllTCPRequestRuleDefaultsDefault(code int) *GetAllTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *GetAllTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP request rule defaults default response -func (o *GetAllTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index bfe6cee8..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPRequestRuleDefaultsURL generates an URL for the get all TCP request rule defaults operation -type GetAllTCPRequestRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleDefaultsURL) WithBasePath(bp string) *GetAllTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend.go b/operations/tcp_request_rule/get_all_tcp_request_rule_frontend.go deleted file mode 100644 index 2bc6b7b7..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a get all TCP request rule frontend handler -type GetAllTCPRequestRuleFrontendHandlerFunc func(GetAllTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPRequestRuleFrontendHandlerFunc) Handle(params GetAllTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPRequestRuleFrontendHandler interface for that can handle valid get all TCP request rule frontend params -type GetAllTCPRequestRuleFrontendHandler interface { - Handle(GetAllTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetAllTCPRequestRuleFrontend creates a new http.Handler for the get all TCP request rule frontend operation -func NewGetAllTCPRequestRuleFrontend(ctx *middleware.Context, handler GetAllTCPRequestRuleFrontendHandler) *GetAllTCPRequestRuleFrontend { - return &GetAllTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetAllTCPRequestRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules TCPRequestRule getAllTcpRequestRuleFrontend - -# Return an array of all TCP Request Rules - -Returns all TCP Request Rules that are configured in specified parent and parent type. -*/ -type GetAllTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler GetAllTCPRequestRuleFrontendHandler -} - -func (o *GetAllTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index 41f2eda9..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPRequestRuleFrontendParams creates a new GetAllTCPRequestRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPRequestRuleFrontendParams() GetAllTCPRequestRuleFrontendParams { - - return GetAllTCPRequestRuleFrontendParams{} -} - -// GetAllTCPRequestRuleFrontendParams contains all the bound params for the get all TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPRequestRuleFrontend -type GetAllTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPRequestRuleFrontendParams() beforehand. -func (o *GetAllTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_responses.go deleted file mode 100644 index 9e22a57f..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPRequestRuleFrontendOKCode is the HTTP code returned for type GetAllTCPRequestRuleFrontendOK -const GetAllTCPRequestRuleFrontendOKCode int = 200 - -/* -GetAllTCPRequestRuleFrontendOK Successful operation - -swagger:response getAllTcpRequestRuleFrontendOK -*/ -type GetAllTCPRequestRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleFrontendOK creates GetAllTCPRequestRuleFrontendOK with default headers values -func NewGetAllTCPRequestRuleFrontendOK() *GetAllTCPRequestRuleFrontendOK { - - return &GetAllTCPRequestRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp request rule frontend o k response -func (o *GetAllTCPRequestRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp request rule frontend o k response -func (o *GetAllTCPRequestRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp request rule frontend o k response -func (o *GetAllTCPRequestRuleFrontendOK) WithPayload(payload models.TCPRequestRules) *GetAllTCPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp request rule frontend o k response -func (o *GetAllTCPRequestRuleFrontendOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPRequestRuleFrontendDefault General Error - -swagger:response getAllTcpRequestRuleFrontendDefault -*/ -type GetAllTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPRequestRuleFrontendDefault creates GetAllTCPRequestRuleFrontendDefault with default headers values -func NewGetAllTCPRequestRuleFrontendDefault(code int) *GetAllTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) WithStatusCode(code int) *GetAllTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *GetAllTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP request rule frontend default response -func (o *GetAllTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 3eb7fb81..00000000 --- a/operations/tcp_request_rule/get_all_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPRequestRuleFrontendURL generates an URL for the get all TCP request rule frontend operation -type GetAllTCPRequestRuleFrontendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleFrontendURL) WithBasePath(bp string) *GetAllTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_backend.go b/operations/tcp_request_rule/get_tcp_request_rule_backend.go deleted file mode 100644 index ccb9a6a0..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a get TCP request rule backend handler -type GetTCPRequestRuleBackendHandlerFunc func(GetTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPRequestRuleBackendHandlerFunc) Handle(params GetTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPRequestRuleBackendHandler interface for that can handle valid get TCP request rule backend params -type GetTCPRequestRuleBackendHandler interface { - Handle(GetTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetTCPRequestRuleBackend creates a new http.Handler for the get TCP request rule backend operation -func NewGetTCPRequestRuleBackend(ctx *middleware.Context, handler GetTCPRequestRuleBackendHandler) *GetTCPRequestRuleBackend { - return &GetTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetTCPRequestRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index} TCPRequestRule getTcpRequestRuleBackend - -# Return one TCP Request Rule - -Returns one TCP Request Rule configuration by it's index in the specified parent. -*/ -type GetTCPRequestRuleBackend struct { - Context *middleware.Context - Handler GetTCPRequestRuleBackendHandler -} - -func (o *GetTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/get_tcp_request_rule_backend_parameters.go deleted file mode 100644 index 7eef7832..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPRequestRuleBackendParams creates a new GetTCPRequestRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetTCPRequestRuleBackendParams() GetTCPRequestRuleBackendParams { - - return GetTCPRequestRuleBackendParams{} -} - -// GetTCPRequestRuleBackendParams contains all the bound params for the get TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPRequestRuleBackend -type GetTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPRequestRuleBackendParams() beforehand. -func (o *GetTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/get_tcp_request_rule_backend_responses.go deleted file mode 100644 index f2f5640e..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPRequestRuleBackendOKCode is the HTTP code returned for type GetTCPRequestRuleBackendOK -const GetTCPRequestRuleBackendOKCode int = 200 - -/* -GetTCPRequestRuleBackendOK Successful operation - -swagger:response getTcpRequestRuleBackendOK -*/ -type GetTCPRequestRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleBackendOK creates GetTCPRequestRuleBackendOK with default headers values -func NewGetTCPRequestRuleBackendOK() *GetTCPRequestRuleBackendOK { - - return &GetTCPRequestRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule backend o k response -func (o *GetTCPRequestRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule backend o k response -func (o *GetTCPRequestRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule backend o k response -func (o *GetTCPRequestRuleBackendOK) WithPayload(payload *models.TCPRequestRule) *GetTCPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule backend o k response -func (o *GetTCPRequestRuleBackendOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPRequestRuleBackendNotFoundCode is the HTTP code returned for type GetTCPRequestRuleBackendNotFound -const GetTCPRequestRuleBackendNotFoundCode int = 404 - -/* -GetTCPRequestRuleBackendNotFound The specified resource was not found - -swagger:response getTcpRequestRuleBackendNotFound -*/ -type GetTCPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleBackendNotFound creates GetTCPRequestRuleBackendNotFound with default headers values -func NewGetTCPRequestRuleBackendNotFound() *GetTCPRequestRuleBackendNotFound { - - return &GetTCPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule backend not found response -func (o *GetTCPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule backend not found response -func (o *GetTCPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule backend not found response -func (o *GetTCPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *GetTCPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule backend not found response -func (o *GetTCPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPRequestRuleBackendDefault General Error - -swagger:response getTcpRequestRuleBackendDefault -*/ -type GetTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleBackendDefault creates GetTCPRequestRuleBackendDefault with default headers values -func NewGetTCPRequestRuleBackendDefault(code int) *GetTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) WithStatusCode(code int) *GetTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *GetTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP request rule backend default response -func (o *GetTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/get_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index b6c7026b..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPRequestRuleBackendURL generates an URL for the get TCP request rule backend operation -type GetTCPRequestRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleBackendURL) WithBasePath(bp string) *GetTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_defaults.go b/operations/tcp_request_rule/get_tcp_request_rule_defaults.go deleted file mode 100644 index 0d557a7f..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a get TCP request rule defaults handler -type GetTCPRequestRuleDefaultsHandlerFunc func(GetTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPRequestRuleDefaultsHandlerFunc) Handle(params GetTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPRequestRuleDefaultsHandler interface for that can handle valid get TCP request rule defaults params -type GetTCPRequestRuleDefaultsHandler interface { - Handle(GetTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetTCPRequestRuleDefaults creates a new http.Handler for the get TCP request rule defaults operation -func NewGetTCPRequestRuleDefaults(ctx *middleware.Context, handler GetTCPRequestRuleDefaultsHandler) *GetTCPRequestRuleDefaults { - return &GetTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetTCPRequestRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index} TCPRequestRule getTcpRequestRuleDefaults - -# Return one TCP Request Rule - -Returns one TCP Request Rule configuration by it's index in the specified parent. -*/ -type GetTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler GetTCPRequestRuleDefaultsHandler -} - -func (o *GetTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/get_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index 181d7b1f..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPRequestRuleDefaultsParams creates a new GetTCPRequestRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetTCPRequestRuleDefaultsParams() GetTCPRequestRuleDefaultsParams { - - return GetTCPRequestRuleDefaultsParams{} -} - -// GetTCPRequestRuleDefaultsParams contains all the bound params for the get TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPRequestRuleDefaults -type GetTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPRequestRuleDefaultsParams() beforehand. -func (o *GetTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/get_tcp_request_rule_defaults_responses.go deleted file mode 100644 index ad0957f5..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPRequestRuleDefaultsOKCode is the HTTP code returned for type GetTCPRequestRuleDefaultsOK -const GetTCPRequestRuleDefaultsOKCode int = 200 - -/* -GetTCPRequestRuleDefaultsOK Successful operation - -swagger:response getTcpRequestRuleDefaultsOK -*/ -type GetTCPRequestRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleDefaultsOK creates GetTCPRequestRuleDefaultsOK with default headers values -func NewGetTCPRequestRuleDefaultsOK() *GetTCPRequestRuleDefaultsOK { - - return &GetTCPRequestRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule defaults o k response -func (o *GetTCPRequestRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule defaults o k response -func (o *GetTCPRequestRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule defaults o k response -func (o *GetTCPRequestRuleDefaultsOK) WithPayload(payload *models.TCPRequestRule) *GetTCPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule defaults o k response -func (o *GetTCPRequestRuleDefaultsOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type GetTCPRequestRuleDefaultsNotFound -const GetTCPRequestRuleDefaultsNotFoundCode int = 404 - -/* -GetTCPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response getTcpRequestRuleDefaultsNotFound -*/ -type GetTCPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleDefaultsNotFound creates GetTCPRequestRuleDefaultsNotFound with default headers values -func NewGetTCPRequestRuleDefaultsNotFound() *GetTCPRequestRuleDefaultsNotFound { - - return &GetTCPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule defaults not found response -func (o *GetTCPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule defaults not found response -func (o *GetTCPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule defaults not found response -func (o *GetTCPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetTCPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule defaults not found response -func (o *GetTCPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPRequestRuleDefaultsDefault General Error - -swagger:response getTcpRequestRuleDefaultsDefault -*/ -type GetTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleDefaultsDefault creates GetTCPRequestRuleDefaultsDefault with default headers values -func NewGetTCPRequestRuleDefaultsDefault(code int) *GetTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *GetTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *GetTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP request rule defaults default response -func (o *GetTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/get_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 5e4bfc6e..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPRequestRuleDefaultsURL generates an URL for the get TCP request rule defaults operation -type GetTCPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleDefaultsURL) WithBasePath(bp string) *GetTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_frontend.go b/operations/tcp_request_rule/get_tcp_request_rule_frontend.go deleted file mode 100644 index 931e805d..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a get TCP request rule frontend handler -type GetTCPRequestRuleFrontendHandlerFunc func(GetTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPRequestRuleFrontendHandlerFunc) Handle(params GetTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPRequestRuleFrontendHandler interface for that can handle valid get TCP request rule frontend params -type GetTCPRequestRuleFrontendHandler interface { - Handle(GetTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewGetTCPRequestRuleFrontend creates a new http.Handler for the get TCP request rule frontend operation -func NewGetTCPRequestRuleFrontend(ctx *middleware.Context, handler GetTCPRequestRuleFrontendHandler) *GetTCPRequestRuleFrontend { - return &GetTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - GetTCPRequestRuleFrontend swagger:route GET /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index} TCPRequestRule getTcpRequestRuleFrontend - -# Return one TCP Request Rule - -Returns one TCP Request Rule configuration by it's index in the specified parent. -*/ -type GetTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler GetTCPRequestRuleFrontendHandler -} - -func (o *GetTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/get_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index 96e8b0f6..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPRequestRuleFrontendParams creates a new GetTCPRequestRuleFrontendParams object -// -// There are no default values defined in the spec. -func NewGetTCPRequestRuleFrontendParams() GetTCPRequestRuleFrontendParams { - - return GetTCPRequestRuleFrontendParams{} -} - -// GetTCPRequestRuleFrontendParams contains all the bound params for the get TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPRequestRuleFrontend -type GetTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPRequestRuleFrontendParams() beforehand. -func (o *GetTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/get_tcp_request_rule_frontend_responses.go deleted file mode 100644 index 74207aee..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPRequestRuleFrontendOKCode is the HTTP code returned for type GetTCPRequestRuleFrontendOK -const GetTCPRequestRuleFrontendOKCode int = 200 - -/* -GetTCPRequestRuleFrontendOK Successful operation - -swagger:response getTcpRequestRuleFrontendOK -*/ -type GetTCPRequestRuleFrontendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleFrontendOK creates GetTCPRequestRuleFrontendOK with default headers values -func NewGetTCPRequestRuleFrontendOK() *GetTCPRequestRuleFrontendOK { - - return &GetTCPRequestRuleFrontendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule frontend o k response -func (o *GetTCPRequestRuleFrontendOK) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleFrontendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule frontend o k response -func (o *GetTCPRequestRuleFrontendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule frontend o k response -func (o *GetTCPRequestRuleFrontendOK) WithPayload(payload *models.TCPRequestRule) *GetTCPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule frontend o k response -func (o *GetTCPRequestRuleFrontendOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPRequestRuleFrontendNotFoundCode is the HTTP code returned for type GetTCPRequestRuleFrontendNotFound -const GetTCPRequestRuleFrontendNotFoundCode int = 404 - -/* -GetTCPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response getTcpRequestRuleFrontendNotFound -*/ -type GetTCPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleFrontendNotFound creates GetTCPRequestRuleFrontendNotFound with default headers values -func NewGetTCPRequestRuleFrontendNotFound() *GetTCPRequestRuleFrontendNotFound { - - return &GetTCPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp request rule frontend not found response -func (o *GetTCPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp request rule frontend not found response -func (o *GetTCPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp request rule frontend not found response -func (o *GetTCPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *GetTCPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp request rule frontend not found response -func (o *GetTCPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPRequestRuleFrontendDefault General Error - -swagger:response getTcpRequestRuleFrontendDefault -*/ -type GetTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPRequestRuleFrontendDefault creates GetTCPRequestRuleFrontendDefault with default headers values -func NewGetTCPRequestRuleFrontendDefault(code int) *GetTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) WithStatusCode(code int) *GetTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *GetTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *GetTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP request rule frontend default response -func (o *GetTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/get_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/get_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 2118c125..00000000 --- a/operations/tcp_request_rule/get_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPRequestRuleFrontendURL generates an URL for the get TCP request rule frontend operation -type GetTCPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleFrontendURL) WithBasePath(bp string) *GetTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_backend.go deleted file mode 100644 index 343ec95d..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a replace all TCP request rule backend handler -type ReplaceAllTCPRequestRuleBackendHandlerFunc func(ReplaceAllTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPRequestRuleBackendHandlerFunc) Handle(params ReplaceAllTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPRequestRuleBackendHandler interface for that can handle valid replace all TCP request rule backend params -type ReplaceAllTCPRequestRuleBackendHandler interface { - Handle(ReplaceAllTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPRequestRuleBackend creates a new http.Handler for the replace all TCP request rule backend operation -func NewReplaceAllTCPRequestRuleBackend(ctx *middleware.Context, handler ReplaceAllTCPRequestRuleBackendHandler) *ReplaceAllTCPRequestRuleBackend { - return &ReplaceAllTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPRequestRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules TCPRequestRule replaceAllTcpRequestRuleBackend - -# Replace an TCP Request Rule list - -Replaces a whole list of TCP Request Rules with the list given in parameter -*/ -type ReplaceAllTCPRequestRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllTCPRequestRuleBackendHandler -} - -func (o *ReplaceAllTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_parameters.go deleted file mode 100644 index 92bedea6..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPRequestRuleBackendParams creates a new ReplaceAllTCPRequestRuleBackendParams object -// with the default values initialized. -func NewReplaceAllTCPRequestRuleBackendParams() ReplaceAllTCPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPRequestRuleBackendParams contains all the bound params for the replace all TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPRequestRuleBackend -type ReplaceAllTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPRequestRuleBackendParams() beforehand. -func (o *ReplaceAllTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_responses.go deleted file mode 100644 index 0a8d5b96..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPRequestRuleBackendOKCode is the HTTP code returned for type ReplaceAllTCPRequestRuleBackendOK -const ReplaceAllTCPRequestRuleBackendOKCode int = 200 - -/* -ReplaceAllTCPRequestRuleBackendOK All TCP Request Rule lines replaced - -swagger:response replaceAllTcpRequestRuleBackendOK -*/ -type ReplaceAllTCPRequestRuleBackendOK struct { - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleBackendOK creates ReplaceAllTCPRequestRuleBackendOK with default headers values -func NewReplaceAllTCPRequestRuleBackendOK() *ReplaceAllTCPRequestRuleBackendOK { - - return &ReplaceAllTCPRequestRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Tcp request rule backend o k response -func (o *ReplaceAllTCPRequestRuleBackendOK) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule backend o k response -func (o *ReplaceAllTCPRequestRuleBackendOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllTCPRequestRuleBackendAccepted -const ReplaceAllTCPRequestRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllTCPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpRequestRuleBackendAccepted -*/ -type ReplaceAllTCPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleBackendAccepted creates ReplaceAllTCPRequestRuleBackendAccepted with default headers values -func NewReplaceAllTCPRequestRuleBackendAccepted() *ReplaceAllTCPRequestRuleBackendAccepted { - - return &ReplaceAllTCPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp request rule backend accepted response -func (o *ReplaceAllTCPRequestRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllTCPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp request rule backend accepted response -func (o *ReplaceAllTCPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp request rule backend accepted response -func (o *ReplaceAllTCPRequestRuleBackendAccepted) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule backend accepted response -func (o *ReplaceAllTCPRequestRuleBackendAccepted) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllTCPRequestRuleBackendBadRequest -const ReplaceAllTCPRequestRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllTCPRequestRuleBackendBadRequest Bad request - -swagger:response replaceAllTcpRequestRuleBackendBadRequest -*/ -type ReplaceAllTCPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleBackendBadRequest creates ReplaceAllTCPRequestRuleBackendBadRequest with default headers values -func NewReplaceAllTCPRequestRuleBackendBadRequest() *ReplaceAllTCPRequestRuleBackendBadRequest { - - return &ReplaceAllTCPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp request rule backend bad request response -func (o *ReplaceAllTCPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp request rule backend bad request response -func (o *ReplaceAllTCPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp request rule backend bad request response -func (o *ReplaceAllTCPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule backend bad request response -func (o *ReplaceAllTCPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPRequestRuleBackendDefault General Error - -swagger:response replaceAllTcpRequestRuleBackendDefault -*/ -type ReplaceAllTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleBackendDefault creates ReplaceAllTCPRequestRuleBackendDefault with default headers values -func NewReplaceAllTCPRequestRuleBackendDefault(code int) *ReplaceAllTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) WithStatusCode(code int) *ReplaceAllTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP request rule backend default response -func (o *ReplaceAllTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index 91d9636f..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPRequestRuleBackendURL generates an URL for the replace all TCP request rule backend operation -type ReplaceAllTCPRequestRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleBackendURL) WithBasePath(bp string) *ReplaceAllTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults.go deleted file mode 100644 index dbc65bc6..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a replace all TCP request rule defaults handler -type ReplaceAllTCPRequestRuleDefaultsHandlerFunc func(ReplaceAllTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPRequestRuleDefaultsHandlerFunc) Handle(params ReplaceAllTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPRequestRuleDefaultsHandler interface for that can handle valid replace all TCP request rule defaults params -type ReplaceAllTCPRequestRuleDefaultsHandler interface { - Handle(ReplaceAllTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPRequestRuleDefaults creates a new http.Handler for the replace all TCP request rule defaults operation -func NewReplaceAllTCPRequestRuleDefaults(ctx *middleware.Context, handler ReplaceAllTCPRequestRuleDefaultsHandler) *ReplaceAllTCPRequestRuleDefaults { - return &ReplaceAllTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPRequestRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules TCPRequestRule replaceAllTcpRequestRuleDefaults - -# Replace an TCP Request Rule list - -Replaces a whole list of TCP Request Rules with the list given in parameter -*/ -type ReplaceAllTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllTCPRequestRuleDefaultsHandler -} - -func (o *ReplaceAllTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index 4795742a..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPRequestRuleDefaultsParams creates a new ReplaceAllTCPRequestRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllTCPRequestRuleDefaultsParams() ReplaceAllTCPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPRequestRuleDefaultsParams contains all the bound params for the replace all TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPRequestRuleDefaults -type ReplaceAllTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPRequestRuleDefaultsParams() beforehand. -func (o *ReplaceAllTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_responses.go deleted file mode 100644 index 063a6d0c..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPRequestRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllTCPRequestRuleDefaultsOK -const ReplaceAllTCPRequestRuleDefaultsOKCode int = 200 - -/* -ReplaceAllTCPRequestRuleDefaultsOK All TCP Request Rule lines replaced - -swagger:response replaceAllTcpRequestRuleDefaultsOK -*/ -type ReplaceAllTCPRequestRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleDefaultsOK creates ReplaceAllTCPRequestRuleDefaultsOK with default headers values -func NewReplaceAllTCPRequestRuleDefaultsOK() *ReplaceAllTCPRequestRuleDefaultsOK { - - return &ReplaceAllTCPRequestRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Tcp request rule defaults o k response -func (o *ReplaceAllTCPRequestRuleDefaultsOK) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule defaults o k response -func (o *ReplaceAllTCPRequestRuleDefaultsOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllTCPRequestRuleDefaultsAccepted -const ReplaceAllTCPRequestRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllTCPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpRequestRuleDefaultsAccepted -*/ -type ReplaceAllTCPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleDefaultsAccepted creates ReplaceAllTCPRequestRuleDefaultsAccepted with default headers values -func NewReplaceAllTCPRequestRuleDefaultsAccepted() *ReplaceAllTCPRequestRuleDefaultsAccepted { - - return &ReplaceAllTCPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp request rule defaults accepted response -func (o *ReplaceAllTCPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllTCPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp request rule defaults accepted response -func (o *ReplaceAllTCPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp request rule defaults accepted response -func (o *ReplaceAllTCPRequestRuleDefaultsAccepted) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule defaults accepted response -func (o *ReplaceAllTCPRequestRuleDefaultsAccepted) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllTCPRequestRuleDefaultsBadRequest -const ReplaceAllTCPRequestRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllTCPRequestRuleDefaultsBadRequest Bad request - -swagger:response replaceAllTcpRequestRuleDefaultsBadRequest -*/ -type ReplaceAllTCPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleDefaultsBadRequest creates ReplaceAllTCPRequestRuleDefaultsBadRequest with default headers values -func NewReplaceAllTCPRequestRuleDefaultsBadRequest() *ReplaceAllTCPRequestRuleDefaultsBadRequest { - - return &ReplaceAllTCPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp request rule defaults bad request response -func (o *ReplaceAllTCPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp request rule defaults bad request response -func (o *ReplaceAllTCPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp request rule defaults bad request response -func (o *ReplaceAllTCPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule defaults bad request response -func (o *ReplaceAllTCPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPRequestRuleDefaultsDefault General Error - -swagger:response replaceAllTcpRequestRuleDefaultsDefault -*/ -type ReplaceAllTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleDefaultsDefault creates ReplaceAllTCPRequestRuleDefaultsDefault with default headers values -func NewReplaceAllTCPRequestRuleDefaultsDefault(code int) *ReplaceAllTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP request rule defaults default response -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index f256d669..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPRequestRuleDefaultsURL generates an URL for the replace all TCP request rule defaults operation -type ReplaceAllTCPRequestRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend.go deleted file mode 100644 index d66efba9..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a replace all TCP request rule frontend handler -type ReplaceAllTCPRequestRuleFrontendHandlerFunc func(ReplaceAllTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPRequestRuleFrontendHandlerFunc) Handle(params ReplaceAllTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPRequestRuleFrontendHandler interface for that can handle valid replace all TCP request rule frontend params -type ReplaceAllTCPRequestRuleFrontendHandler interface { - Handle(ReplaceAllTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPRequestRuleFrontend creates a new http.Handler for the replace all TCP request rule frontend operation -func NewReplaceAllTCPRequestRuleFrontend(ctx *middleware.Context, handler ReplaceAllTCPRequestRuleFrontendHandler) *ReplaceAllTCPRequestRuleFrontend { - return &ReplaceAllTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPRequestRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules TCPRequestRule replaceAllTcpRequestRuleFrontend - -# Replace an TCP Request Rule list - -Replaces a whole list of TCP Request Rules with the list given in parameter -*/ -type ReplaceAllTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler ReplaceAllTCPRequestRuleFrontendHandler -} - -func (o *ReplaceAllTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index 3d386463..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPRequestRuleFrontendParams creates a new ReplaceAllTCPRequestRuleFrontendParams object -// with the default values initialized. -func NewReplaceAllTCPRequestRuleFrontendParams() ReplaceAllTCPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPRequestRuleFrontendParams contains all the bound params for the replace all TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPRequestRuleFrontend -type ReplaceAllTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPRequestRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPRequestRuleFrontendParams() beforehand. -func (o *ReplaceAllTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_responses.go deleted file mode 100644 index d384691a..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPRequestRuleFrontendOKCode is the HTTP code returned for type ReplaceAllTCPRequestRuleFrontendOK -const ReplaceAllTCPRequestRuleFrontendOKCode int = 200 - -/* -ReplaceAllTCPRequestRuleFrontendOK All TCP Request Rule lines replaced - -swagger:response replaceAllTcpRequestRuleFrontendOK -*/ -type ReplaceAllTCPRequestRuleFrontendOK struct { - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleFrontendOK creates ReplaceAllTCPRequestRuleFrontendOK with default headers values -func NewReplaceAllTCPRequestRuleFrontendOK() *ReplaceAllTCPRequestRuleFrontendOK { - - return &ReplaceAllTCPRequestRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace all Tcp request rule frontend o k response -func (o *ReplaceAllTCPRequestRuleFrontendOK) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule frontend o k response -func (o *ReplaceAllTCPRequestRuleFrontendOK) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceAllTCPRequestRuleFrontendAccepted -const ReplaceAllTCPRequestRuleFrontendAcceptedCode int = 202 - -/* -ReplaceAllTCPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpRequestRuleFrontendAccepted -*/ -type ReplaceAllTCPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPRequestRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleFrontendAccepted creates ReplaceAllTCPRequestRuleFrontendAccepted with default headers values -func NewReplaceAllTCPRequestRuleFrontendAccepted() *ReplaceAllTCPRequestRuleFrontendAccepted { - - return &ReplaceAllTCPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp request rule frontend accepted response -func (o *ReplaceAllTCPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceAllTCPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp request rule frontend accepted response -func (o *ReplaceAllTCPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp request rule frontend accepted response -func (o *ReplaceAllTCPRequestRuleFrontendAccepted) WithPayload(payload models.TCPRequestRules) *ReplaceAllTCPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule frontend accepted response -func (o *ReplaceAllTCPRequestRuleFrontendAccepted) SetPayload(payload models.TCPRequestRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPRequestRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPRequestRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceAllTCPRequestRuleFrontendBadRequest -const ReplaceAllTCPRequestRuleFrontendBadRequestCode int = 400 - -/* -ReplaceAllTCPRequestRuleFrontendBadRequest Bad request - -swagger:response replaceAllTcpRequestRuleFrontendBadRequest -*/ -type ReplaceAllTCPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleFrontendBadRequest creates ReplaceAllTCPRequestRuleFrontendBadRequest with default headers values -func NewReplaceAllTCPRequestRuleFrontendBadRequest() *ReplaceAllTCPRequestRuleFrontendBadRequest { - - return &ReplaceAllTCPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp request rule frontend bad request response -func (o *ReplaceAllTCPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp request rule frontend bad request response -func (o *ReplaceAllTCPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp request rule frontend bad request response -func (o *ReplaceAllTCPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp request rule frontend bad request response -func (o *ReplaceAllTCPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPRequestRuleFrontendDefault General Error - -swagger:response replaceAllTcpRequestRuleFrontendDefault -*/ -type ReplaceAllTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPRequestRuleFrontendDefault creates ReplaceAllTCPRequestRuleFrontendDefault with default headers values -func NewReplaceAllTCPRequestRuleFrontendDefault(code int) *ReplaceAllTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) WithStatusCode(code int) *ReplaceAllTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceAllTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP request rule frontend default response -func (o *ReplaceAllTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 91d9b792..00000000 --- a/operations/tcp_request_rule/replace_all_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPRequestRuleFrontendURL generates an URL for the replace all TCP request rule frontend operation -type ReplaceAllTCPRequestRuleFrontendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleFrontendURL) WithBasePath(bp string) *ReplaceAllTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_backend.go b/operations/tcp_request_rule/replace_tcp_request_rule_backend.go deleted file mode 100644 index 6713ca04..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPRequestRuleBackendHandlerFunc turns a function with the right signature into a replace TCP request rule backend handler -type ReplaceTCPRequestRuleBackendHandlerFunc func(ReplaceTCPRequestRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPRequestRuleBackendHandlerFunc) Handle(params ReplaceTCPRequestRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPRequestRuleBackendHandler interface for that can handle valid replace TCP request rule backend params -type ReplaceTCPRequestRuleBackendHandler interface { - Handle(ReplaceTCPRequestRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceTCPRequestRuleBackend creates a new http.Handler for the replace TCP request rule backend operation -func NewReplaceTCPRequestRuleBackend(ctx *middleware.Context, handler ReplaceTCPRequestRuleBackendHandler) *ReplaceTCPRequestRuleBackend { - return &ReplaceTCPRequestRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPRequestRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index} TCPRequestRule replaceTcpRequestRuleBackend - -# Replace a TCP Request Rule - -Replaces a TCP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceTCPRequestRuleBackend struct { - Context *middleware.Context - Handler ReplaceTCPRequestRuleBackendHandler -} - -func (o *ReplaceTCPRequestRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPRequestRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_backend_parameters.go b/operations/tcp_request_rule/replace_tcp_request_rule_backend_parameters.go deleted file mode 100644 index 4c11e122..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPRequestRuleBackendParams creates a new ReplaceTCPRequestRuleBackendParams object -// with the default values initialized. -func NewReplaceTCPRequestRuleBackendParams() ReplaceTCPRequestRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPRequestRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPRequestRuleBackendParams contains all the bound params for the replace TCP request rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPRequestRuleBackend -type ReplaceTCPRequestRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPRequestRuleBackendParams() beforehand. -func (o *ReplaceTCPRequestRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPRequestRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPRequestRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPRequestRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPRequestRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPRequestRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPRequestRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_backend_responses.go b/operations/tcp_request_rule/replace_tcp_request_rule_backend_responses.go deleted file mode 100644 index daaf0546..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPRequestRuleBackendOKCode is the HTTP code returned for type ReplaceTCPRequestRuleBackendOK -const ReplaceTCPRequestRuleBackendOKCode int = 200 - -/* -ReplaceTCPRequestRuleBackendOK TCP Request Rule replaced - -swagger:response replaceTcpRequestRuleBackendOK -*/ -type ReplaceTCPRequestRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleBackendOK creates ReplaceTCPRequestRuleBackendOK with default headers values -func NewReplaceTCPRequestRuleBackendOK() *ReplaceTCPRequestRuleBackendOK { - - return &ReplaceTCPRequestRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Tcp request rule backend o k response -func (o *ReplaceTCPRequestRuleBackendOK) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule backend o k response -func (o *ReplaceTCPRequestRuleBackendOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleBackendAcceptedCode is the HTTP code returned for type ReplaceTCPRequestRuleBackendAccepted -const ReplaceTCPRequestRuleBackendAcceptedCode int = 202 - -/* -ReplaceTCPRequestRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpRequestRuleBackendAccepted -*/ -type ReplaceTCPRequestRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleBackendAccepted creates ReplaceTCPRequestRuleBackendAccepted with default headers values -func NewReplaceTCPRequestRuleBackendAccepted() *ReplaceTCPRequestRuleBackendAccepted { - - return &ReplaceTCPRequestRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp request rule backend accepted response -func (o *ReplaceTCPRequestRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceTCPRequestRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp request rule backend accepted response -func (o *ReplaceTCPRequestRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp request rule backend accepted response -func (o *ReplaceTCPRequestRuleBackendAccepted) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule backend accepted response -func (o *ReplaceTCPRequestRuleBackendAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleBackendBadRequestCode is the HTTP code returned for type ReplaceTCPRequestRuleBackendBadRequest -const ReplaceTCPRequestRuleBackendBadRequestCode int = 400 - -/* -ReplaceTCPRequestRuleBackendBadRequest Bad request - -swagger:response replaceTcpRequestRuleBackendBadRequest -*/ -type ReplaceTCPRequestRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleBackendBadRequest creates ReplaceTCPRequestRuleBackendBadRequest with default headers values -func NewReplaceTCPRequestRuleBackendBadRequest() *ReplaceTCPRequestRuleBackendBadRequest { - - return &ReplaceTCPRequestRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule backend bad request response -func (o *ReplaceTCPRequestRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule backend bad request response -func (o *ReplaceTCPRequestRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule backend bad request response -func (o *ReplaceTCPRequestRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule backend bad request response -func (o *ReplaceTCPRequestRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleBackendNotFoundCode is the HTTP code returned for type ReplaceTCPRequestRuleBackendNotFound -const ReplaceTCPRequestRuleBackendNotFoundCode int = 404 - -/* -ReplaceTCPRequestRuleBackendNotFound The specified resource was not found - -swagger:response replaceTcpRequestRuleBackendNotFound -*/ -type ReplaceTCPRequestRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleBackendNotFound creates ReplaceTCPRequestRuleBackendNotFound with default headers values -func NewReplaceTCPRequestRuleBackendNotFound() *ReplaceTCPRequestRuleBackendNotFound { - - return &ReplaceTCPRequestRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule backend not found response -func (o *ReplaceTCPRequestRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule backend not found response -func (o *ReplaceTCPRequestRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule backend not found response -func (o *ReplaceTCPRequestRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule backend not found response -func (o *ReplaceTCPRequestRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPRequestRuleBackendDefault General Error - -swagger:response replaceTcpRequestRuleBackendDefault -*/ -type ReplaceTCPRequestRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleBackendDefault creates ReplaceTCPRequestRuleBackendDefault with default headers values -func NewReplaceTCPRequestRuleBackendDefault(code int) *ReplaceTCPRequestRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPRequestRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) WithStatusCode(code int) *ReplaceTCPRequestRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP request rule backend default response -func (o *ReplaceTCPRequestRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_backend_urlbuilder.go b/operations/tcp_request_rule/replace_tcp_request_rule_backend_urlbuilder.go deleted file mode 100644 index ae6a32f6..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPRequestRuleBackendURL generates an URL for the replace TCP request rule backend operation -type ReplaceTCPRequestRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleBackendURL) WithBasePath(bp string) *ReplaceTCPRequestRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPRequestRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPRequestRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPRequestRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPRequestRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPRequestRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPRequestRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPRequestRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPRequestRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPRequestRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_defaults.go b/operations/tcp_request_rule/replace_tcp_request_rule_defaults.go deleted file mode 100644 index d55832c2..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPRequestRuleDefaultsHandlerFunc turns a function with the right signature into a replace TCP request rule defaults handler -type ReplaceTCPRequestRuleDefaultsHandlerFunc func(ReplaceTCPRequestRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPRequestRuleDefaultsHandlerFunc) Handle(params ReplaceTCPRequestRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPRequestRuleDefaultsHandler interface for that can handle valid replace TCP request rule defaults params -type ReplaceTCPRequestRuleDefaultsHandler interface { - Handle(ReplaceTCPRequestRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceTCPRequestRuleDefaults creates a new http.Handler for the replace TCP request rule defaults operation -func NewReplaceTCPRequestRuleDefaults(ctx *middleware.Context, handler ReplaceTCPRequestRuleDefaultsHandler) *ReplaceTCPRequestRuleDefaults { - return &ReplaceTCPRequestRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPRequestRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index} TCPRequestRule replaceTcpRequestRuleDefaults - -# Replace a TCP Request Rule - -Replaces a TCP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceTCPRequestRuleDefaults struct { - Context *middleware.Context - Handler ReplaceTCPRequestRuleDefaultsHandler -} - -func (o *ReplaceTCPRequestRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPRequestRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_parameters.go b/operations/tcp_request_rule/replace_tcp_request_rule_defaults_parameters.go deleted file mode 100644 index c94104d5..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPRequestRuleDefaultsParams creates a new ReplaceTCPRequestRuleDefaultsParams object -// with the default values initialized. -func NewReplaceTCPRequestRuleDefaultsParams() ReplaceTCPRequestRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPRequestRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPRequestRuleDefaultsParams contains all the bound params for the replace TCP request rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPRequestRuleDefaults -type ReplaceTCPRequestRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPRequestRuleDefaultsParams() beforehand. -func (o *ReplaceTCPRequestRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPRequestRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPRequestRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPRequestRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPRequestRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPRequestRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPRequestRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_responses.go b/operations/tcp_request_rule/replace_tcp_request_rule_defaults_responses.go deleted file mode 100644 index 7cc0268c..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPRequestRuleDefaultsOKCode is the HTTP code returned for type ReplaceTCPRequestRuleDefaultsOK -const ReplaceTCPRequestRuleDefaultsOKCode int = 200 - -/* -ReplaceTCPRequestRuleDefaultsOK TCP Request Rule replaced - -swagger:response replaceTcpRequestRuleDefaultsOK -*/ -type ReplaceTCPRequestRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleDefaultsOK creates ReplaceTCPRequestRuleDefaultsOK with default headers values -func NewReplaceTCPRequestRuleDefaultsOK() *ReplaceTCPRequestRuleDefaultsOK { - - return &ReplaceTCPRequestRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Tcp request rule defaults o k response -func (o *ReplaceTCPRequestRuleDefaultsOK) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule defaults o k response -func (o *ReplaceTCPRequestRuleDefaultsOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceTCPRequestRuleDefaultsAccepted -const ReplaceTCPRequestRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceTCPRequestRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpRequestRuleDefaultsAccepted -*/ -type ReplaceTCPRequestRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleDefaultsAccepted creates ReplaceTCPRequestRuleDefaultsAccepted with default headers values -func NewReplaceTCPRequestRuleDefaultsAccepted() *ReplaceTCPRequestRuleDefaultsAccepted { - - return &ReplaceTCPRequestRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp request rule defaults accepted response -func (o *ReplaceTCPRequestRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceTCPRequestRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp request rule defaults accepted response -func (o *ReplaceTCPRequestRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp request rule defaults accepted response -func (o *ReplaceTCPRequestRuleDefaultsAccepted) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule defaults accepted response -func (o *ReplaceTCPRequestRuleDefaultsAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceTCPRequestRuleDefaultsBadRequest -const ReplaceTCPRequestRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceTCPRequestRuleDefaultsBadRequest Bad request - -swagger:response replaceTcpRequestRuleDefaultsBadRequest -*/ -type ReplaceTCPRequestRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleDefaultsBadRequest creates ReplaceTCPRequestRuleDefaultsBadRequest with default headers values -func NewReplaceTCPRequestRuleDefaultsBadRequest() *ReplaceTCPRequestRuleDefaultsBadRequest { - - return &ReplaceTCPRequestRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule defaults bad request response -func (o *ReplaceTCPRequestRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule defaults bad request response -func (o *ReplaceTCPRequestRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule defaults bad request response -func (o *ReplaceTCPRequestRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule defaults bad request response -func (o *ReplaceTCPRequestRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceTCPRequestRuleDefaultsNotFound -const ReplaceTCPRequestRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceTCPRequestRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceTcpRequestRuleDefaultsNotFound -*/ -type ReplaceTCPRequestRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleDefaultsNotFound creates ReplaceTCPRequestRuleDefaultsNotFound with default headers values -func NewReplaceTCPRequestRuleDefaultsNotFound() *ReplaceTCPRequestRuleDefaultsNotFound { - - return &ReplaceTCPRequestRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule defaults not found response -func (o *ReplaceTCPRequestRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule defaults not found response -func (o *ReplaceTCPRequestRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule defaults not found response -func (o *ReplaceTCPRequestRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule defaults not found response -func (o *ReplaceTCPRequestRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPRequestRuleDefaultsDefault General Error - -swagger:response replaceTcpRequestRuleDefaultsDefault -*/ -type ReplaceTCPRequestRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleDefaultsDefault creates ReplaceTCPRequestRuleDefaultsDefault with default headers values -func NewReplaceTCPRequestRuleDefaultsDefault(code int) *ReplaceTCPRequestRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPRequestRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) WithStatusCode(code int) *ReplaceTCPRequestRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP request rule defaults default response -func (o *ReplaceTCPRequestRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_urlbuilder.go b/operations/tcp_request_rule/replace_tcp_request_rule_defaults_urlbuilder.go deleted file mode 100644 index 0350db02..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPRequestRuleDefaultsURL generates an URL for the replace TCP request rule defaults operation -type ReplaceTCPRequestRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleDefaultsURL) WithBasePath(bp string) *ReplaceTCPRequestRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPRequestRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPRequestRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPRequestRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPRequestRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPRequestRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPRequestRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPRequestRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPRequestRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPRequestRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_frontend.go b/operations/tcp_request_rule/replace_tcp_request_rule_frontend.go deleted file mode 100644 index c423b9e4..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_frontend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPRequestRuleFrontendHandlerFunc turns a function with the right signature into a replace TCP request rule frontend handler -type ReplaceTCPRequestRuleFrontendHandlerFunc func(ReplaceTCPRequestRuleFrontendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPRequestRuleFrontendHandlerFunc) Handle(params ReplaceTCPRequestRuleFrontendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPRequestRuleFrontendHandler interface for that can handle valid replace TCP request rule frontend params -type ReplaceTCPRequestRuleFrontendHandler interface { - Handle(ReplaceTCPRequestRuleFrontendParams, interface{}) middleware.Responder -} - -// NewReplaceTCPRequestRuleFrontend creates a new http.Handler for the replace TCP request rule frontend operation -func NewReplaceTCPRequestRuleFrontend(ctx *middleware.Context, handler ReplaceTCPRequestRuleFrontendHandler) *ReplaceTCPRequestRuleFrontend { - return &ReplaceTCPRequestRuleFrontend{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPRequestRuleFrontend swagger:route PUT /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index} TCPRequestRule replaceTcpRequestRuleFrontend - -# Replace a TCP Request Rule - -Replaces a TCP Request Rule configuration by it's index in the specified parent. -*/ -type ReplaceTCPRequestRuleFrontend struct { - Context *middleware.Context - Handler ReplaceTCPRequestRuleFrontendHandler -} - -func (o *ReplaceTCPRequestRuleFrontend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPRequestRuleFrontendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_parameters.go b/operations/tcp_request_rule/replace_tcp_request_rule_frontend_parameters.go deleted file mode 100644 index cb1bd52e..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPRequestRuleFrontendParams creates a new ReplaceTCPRequestRuleFrontendParams object -// with the default values initialized. -func NewReplaceTCPRequestRuleFrontendParams() ReplaceTCPRequestRuleFrontendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPRequestRuleFrontendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPRequestRuleFrontendParams contains all the bound params for the replace TCP request rule frontend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPRequestRuleFrontend -type ReplaceTCPRequestRuleFrontendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPRequestRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Request Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPRequestRuleFrontendParams() beforehand. -func (o *ReplaceTCPRequestRuleFrontendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPRequestRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPRequestRuleFrontendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPRequestRuleFrontendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPRequestRuleFrontendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPRequestRuleFrontendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPRequestRuleFrontendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPRequestRuleFrontendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_responses.go b/operations/tcp_request_rule/replace_tcp_request_rule_frontend_responses.go deleted file mode 100644 index 58004dbd..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPRequestRuleFrontendOKCode is the HTTP code returned for type ReplaceTCPRequestRuleFrontendOK -const ReplaceTCPRequestRuleFrontendOKCode int = 200 - -/* -ReplaceTCPRequestRuleFrontendOK TCP Request Rule replaced - -swagger:response replaceTcpRequestRuleFrontendOK -*/ -type ReplaceTCPRequestRuleFrontendOK struct { - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleFrontendOK creates ReplaceTCPRequestRuleFrontendOK with default headers values -func NewReplaceTCPRequestRuleFrontendOK() *ReplaceTCPRequestRuleFrontendOK { - - return &ReplaceTCPRequestRuleFrontendOK{} -} - -// WithPayload adds the payload to the replace Tcp request rule frontend o k response -func (o *ReplaceTCPRequestRuleFrontendOK) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleFrontendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule frontend o k response -func (o *ReplaceTCPRequestRuleFrontendOK) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleFrontendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleFrontendAcceptedCode is the HTTP code returned for type ReplaceTCPRequestRuleFrontendAccepted -const ReplaceTCPRequestRuleFrontendAcceptedCode int = 202 - -/* -ReplaceTCPRequestRuleFrontendAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpRequestRuleFrontendAccepted -*/ -type ReplaceTCPRequestRuleFrontendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPRequestRule `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleFrontendAccepted creates ReplaceTCPRequestRuleFrontendAccepted with default headers values -func NewReplaceTCPRequestRuleFrontendAccepted() *ReplaceTCPRequestRuleFrontendAccepted { - - return &ReplaceTCPRequestRuleFrontendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp request rule frontend accepted response -func (o *ReplaceTCPRequestRuleFrontendAccepted) WithReloadID(reloadID string) *ReplaceTCPRequestRuleFrontendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp request rule frontend accepted response -func (o *ReplaceTCPRequestRuleFrontendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp request rule frontend accepted response -func (o *ReplaceTCPRequestRuleFrontendAccepted) WithPayload(payload *models.TCPRequestRule) *ReplaceTCPRequestRuleFrontendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule frontend accepted response -func (o *ReplaceTCPRequestRuleFrontendAccepted) SetPayload(payload *models.TCPRequestRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleFrontendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleFrontendBadRequestCode is the HTTP code returned for type ReplaceTCPRequestRuleFrontendBadRequest -const ReplaceTCPRequestRuleFrontendBadRequestCode int = 400 - -/* -ReplaceTCPRequestRuleFrontendBadRequest Bad request - -swagger:response replaceTcpRequestRuleFrontendBadRequest -*/ -type ReplaceTCPRequestRuleFrontendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleFrontendBadRequest creates ReplaceTCPRequestRuleFrontendBadRequest with default headers values -func NewReplaceTCPRequestRuleFrontendBadRequest() *ReplaceTCPRequestRuleFrontendBadRequest { - - return &ReplaceTCPRequestRuleFrontendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule frontend bad request response -func (o *ReplaceTCPRequestRuleFrontendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleFrontendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule frontend bad request response -func (o *ReplaceTCPRequestRuleFrontendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule frontend bad request response -func (o *ReplaceTCPRequestRuleFrontendBadRequest) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleFrontendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule frontend bad request response -func (o *ReplaceTCPRequestRuleFrontendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleFrontendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPRequestRuleFrontendNotFoundCode is the HTTP code returned for type ReplaceTCPRequestRuleFrontendNotFound -const ReplaceTCPRequestRuleFrontendNotFoundCode int = 404 - -/* -ReplaceTCPRequestRuleFrontendNotFound The specified resource was not found - -swagger:response replaceTcpRequestRuleFrontendNotFound -*/ -type ReplaceTCPRequestRuleFrontendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleFrontendNotFound creates ReplaceTCPRequestRuleFrontendNotFound with default headers values -func NewReplaceTCPRequestRuleFrontendNotFound() *ReplaceTCPRequestRuleFrontendNotFound { - - return &ReplaceTCPRequestRuleFrontendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp request rule frontend not found response -func (o *ReplaceTCPRequestRuleFrontendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleFrontendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp request rule frontend not found response -func (o *ReplaceTCPRequestRuleFrontendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp request rule frontend not found response -func (o *ReplaceTCPRequestRuleFrontendNotFound) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleFrontendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp request rule frontend not found response -func (o *ReplaceTCPRequestRuleFrontendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleFrontendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPRequestRuleFrontendDefault General Error - -swagger:response replaceTcpRequestRuleFrontendDefault -*/ -type ReplaceTCPRequestRuleFrontendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPRequestRuleFrontendDefault creates ReplaceTCPRequestRuleFrontendDefault with default headers values -func NewReplaceTCPRequestRuleFrontendDefault(code int) *ReplaceTCPRequestRuleFrontendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPRequestRuleFrontendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) WithStatusCode(code int) *ReplaceTCPRequestRuleFrontendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPRequestRuleFrontendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) WithPayload(payload *models.Error) *ReplaceTCPRequestRuleFrontendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP request rule frontend default response -func (o *ReplaceTCPRequestRuleFrontendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPRequestRuleFrontendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_urlbuilder.go b/operations/tcp_request_rule/replace_tcp_request_rule_frontend_urlbuilder.go deleted file mode 100644 index 15d917f3..00000000 --- a/operations/tcp_request_rule/replace_tcp_request_rule_frontend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_request_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPRequestRuleFrontendURL generates an URL for the replace TCP request rule frontend operation -type ReplaceTCPRequestRuleFrontendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleFrontendURL) WithBasePath(bp string) *ReplaceTCPRequestRuleFrontendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPRequestRuleFrontendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPRequestRuleFrontendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPRequestRuleFrontendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPRequestRuleFrontendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPRequestRuleFrontendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPRequestRuleFrontendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPRequestRuleFrontendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPRequestRuleFrontendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPRequestRuleFrontendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPRequestRuleFrontendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_backend.go b/operations/tcp_response_rule/create_tcp_response_rule_backend.go deleted file mode 100644 index 4aeaff1a..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a create TCP response rule backend handler -type CreateTCPResponseRuleBackendHandlerFunc func(CreateTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPResponseRuleBackendHandlerFunc) Handle(params CreateTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPResponseRuleBackendHandler interface for that can handle valid create TCP response rule backend params -type CreateTCPResponseRuleBackendHandler interface { - Handle(CreateTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewCreateTCPResponseRuleBackend creates a new http.Handler for the create TCP response rule backend operation -func NewCreateTCPResponseRuleBackend(ctx *middleware.Context, handler CreateTCPResponseRuleBackendHandler) *CreateTCPResponseRuleBackend { - return &CreateTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - CreateTCPResponseRuleBackend swagger:route POST /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index} TCPResponseRule createTcpResponseRuleBackend - -# Add a new TCP Response Rule - -Adds a new TCP Response Rule of the specified type in the specified backend. -*/ -type CreateTCPResponseRuleBackend struct { - Context *middleware.Context - Handler CreateTCPResponseRuleBackendHandler -} - -func (o *CreateTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/create_tcp_response_rule_backend_parameters.go deleted file mode 100644 index 1e80ee9c..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPResponseRuleBackendParams creates a new CreateTCPResponseRuleBackendParams object -// with the default values initialized. -func NewCreateTCPResponseRuleBackendParams() CreateTCPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPResponseRuleBackendParams contains all the bound params for the create TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPResponseRuleBackend -type CreateTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPResponseRuleBackendParams() beforehand. -func (o *CreateTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/create_tcp_response_rule_backend_responses.go deleted file mode 100644 index 08e0762f..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPResponseRuleBackendCreatedCode is the HTTP code returned for type CreateTCPResponseRuleBackendCreated -const CreateTCPResponseRuleBackendCreatedCode int = 201 - -/* -CreateTCPResponseRuleBackendCreated TCP Response Rule created - -swagger:response createTcpResponseRuleBackendCreated -*/ -type CreateTCPResponseRuleBackendCreated struct { - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleBackendCreated creates CreateTCPResponseRuleBackendCreated with default headers values -func NewCreateTCPResponseRuleBackendCreated() *CreateTCPResponseRuleBackendCreated { - - return &CreateTCPResponseRuleBackendCreated{} -} - -// WithPayload adds the payload to the create Tcp response rule backend created response -func (o *CreateTCPResponseRuleBackendCreated) WithPayload(payload *models.TCPResponseRule) *CreateTCPResponseRuleBackendCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule backend created response -func (o *CreateTCPResponseRuleBackendCreated) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleBackendCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleBackendAcceptedCode is the HTTP code returned for type CreateTCPResponseRuleBackendAccepted -const CreateTCPResponseRuleBackendAcceptedCode int = 202 - -/* -CreateTCPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response createTcpResponseRuleBackendAccepted -*/ -type CreateTCPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleBackendAccepted creates CreateTCPResponseRuleBackendAccepted with default headers values -func NewCreateTCPResponseRuleBackendAccepted() *CreateTCPResponseRuleBackendAccepted { - - return &CreateTCPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp response rule backend accepted response -func (o *CreateTCPResponseRuleBackendAccepted) WithReloadID(reloadID string) *CreateTCPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp response rule backend accepted response -func (o *CreateTCPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp response rule backend accepted response -func (o *CreateTCPResponseRuleBackendAccepted) WithPayload(payload *models.TCPResponseRule) *CreateTCPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule backend accepted response -func (o *CreateTCPResponseRuleBackendAccepted) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleBackendBadRequestCode is the HTTP code returned for type CreateTCPResponseRuleBackendBadRequest -const CreateTCPResponseRuleBackendBadRequestCode int = 400 - -/* -CreateTCPResponseRuleBackendBadRequest Bad request - -swagger:response createTcpResponseRuleBackendBadRequest -*/ -type CreateTCPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleBackendBadRequest creates CreateTCPResponseRuleBackendBadRequest with default headers values -func NewCreateTCPResponseRuleBackendBadRequest() *CreateTCPResponseRuleBackendBadRequest { - - return &CreateTCPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp response rule backend bad request response -func (o *CreateTCPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp response rule backend bad request response -func (o *CreateTCPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp response rule backend bad request response -func (o *CreateTCPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *CreateTCPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule backend bad request response -func (o *CreateTCPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleBackendConflictCode is the HTTP code returned for type CreateTCPResponseRuleBackendConflict -const CreateTCPResponseRuleBackendConflictCode int = 409 - -/* -CreateTCPResponseRuleBackendConflict The specified resource already exists - -swagger:response createTcpResponseRuleBackendConflict -*/ -type CreateTCPResponseRuleBackendConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleBackendConflict creates CreateTCPResponseRuleBackendConflict with default headers values -func NewCreateTCPResponseRuleBackendConflict() *CreateTCPResponseRuleBackendConflict { - - return &CreateTCPResponseRuleBackendConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp response rule backend conflict response -func (o *CreateTCPResponseRuleBackendConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleBackendConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp response rule backend conflict response -func (o *CreateTCPResponseRuleBackendConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp response rule backend conflict response -func (o *CreateTCPResponseRuleBackendConflict) WithPayload(payload *models.Error) *CreateTCPResponseRuleBackendConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule backend conflict response -func (o *CreateTCPResponseRuleBackendConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleBackendConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPResponseRuleBackendDefault General Error - -swagger:response createTcpResponseRuleBackendDefault -*/ -type CreateTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleBackendDefault creates CreateTCPResponseRuleBackendDefault with default headers values -func NewCreateTCPResponseRuleBackendDefault(code int) *CreateTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) WithStatusCode(code int) *CreateTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *CreateTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP response rule backend default response -func (o *CreateTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/create_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index e40cd937..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPResponseRuleBackendURL generates an URL for the create TCP response rule backend operation -type CreateTCPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPResponseRuleBackendURL) WithBasePath(bp string) *CreateTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_defaults.go b/operations/tcp_response_rule/create_tcp_response_rule_defaults.go deleted file mode 100644 index e25f1c9f..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a create TCP response rule defaults handler -type CreateTCPResponseRuleDefaultsHandlerFunc func(CreateTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTCPResponseRuleDefaultsHandlerFunc) Handle(params CreateTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTCPResponseRuleDefaultsHandler interface for that can handle valid create TCP response rule defaults params -type CreateTCPResponseRuleDefaultsHandler interface { - Handle(CreateTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewCreateTCPResponseRuleDefaults creates a new http.Handler for the create TCP response rule defaults operation -func NewCreateTCPResponseRuleDefaults(ctx *middleware.Context, handler CreateTCPResponseRuleDefaultsHandler) *CreateTCPResponseRuleDefaults { - return &CreateTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - CreateTCPResponseRuleDefaults swagger:route POST /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index} TCPResponseRule createTcpResponseRuleDefaults - -# Add a new TCP Response Rule - -Adds a new TCP Response Rule of the specified type in the specified backend. -*/ -type CreateTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler CreateTCPResponseRuleDefaultsHandler -} - -func (o *CreateTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/create_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index 24eea127..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTCPResponseRuleDefaultsParams creates a new CreateTCPResponseRuleDefaultsParams object -// with the default values initialized. -func NewCreateTCPResponseRuleDefaultsParams() CreateTCPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTCPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTCPResponseRuleDefaultsParams contains all the bound params for the create TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTCPResponseRuleDefaults -type CreateTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTCPResponseRuleDefaultsParams() beforehand. -func (o *CreateTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTCPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTCPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *CreateTCPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *CreateTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTCPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/create_tcp_response_rule_defaults_responses.go deleted file mode 100644 index 5f7087f1..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTCPResponseRuleDefaultsCreatedCode is the HTTP code returned for type CreateTCPResponseRuleDefaultsCreated -const CreateTCPResponseRuleDefaultsCreatedCode int = 201 - -/* -CreateTCPResponseRuleDefaultsCreated TCP Response Rule created - -swagger:response createTcpResponseRuleDefaultsCreated -*/ -type CreateTCPResponseRuleDefaultsCreated struct { - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleDefaultsCreated creates CreateTCPResponseRuleDefaultsCreated with default headers values -func NewCreateTCPResponseRuleDefaultsCreated() *CreateTCPResponseRuleDefaultsCreated { - - return &CreateTCPResponseRuleDefaultsCreated{} -} - -// WithPayload adds the payload to the create Tcp response rule defaults created response -func (o *CreateTCPResponseRuleDefaultsCreated) WithPayload(payload *models.TCPResponseRule) *CreateTCPResponseRuleDefaultsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule defaults created response -func (o *CreateTCPResponseRuleDefaultsCreated) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleDefaultsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type CreateTCPResponseRuleDefaultsAccepted -const CreateTCPResponseRuleDefaultsAcceptedCode int = 202 - -/* -CreateTCPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response createTcpResponseRuleDefaultsAccepted -*/ -type CreateTCPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleDefaultsAccepted creates CreateTCPResponseRuleDefaultsAccepted with default headers values -func NewCreateTCPResponseRuleDefaultsAccepted() *CreateTCPResponseRuleDefaultsAccepted { - - return &CreateTCPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the create Tcp response rule defaults accepted response -func (o *CreateTCPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *CreateTCPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create Tcp response rule defaults accepted response -func (o *CreateTCPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create Tcp response rule defaults accepted response -func (o *CreateTCPResponseRuleDefaultsAccepted) WithPayload(payload *models.TCPResponseRule) *CreateTCPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule defaults accepted response -func (o *CreateTCPResponseRuleDefaultsAccepted) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type CreateTCPResponseRuleDefaultsBadRequest -const CreateTCPResponseRuleDefaultsBadRequestCode int = 400 - -/* -CreateTCPResponseRuleDefaultsBadRequest Bad request - -swagger:response createTcpResponseRuleDefaultsBadRequest -*/ -type CreateTCPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleDefaultsBadRequest creates CreateTCPResponseRuleDefaultsBadRequest with default headers values -func NewCreateTCPResponseRuleDefaultsBadRequest() *CreateTCPResponseRuleDefaultsBadRequest { - - return &CreateTCPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp response rule defaults bad request response -func (o *CreateTCPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp response rule defaults bad request response -func (o *CreateTCPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp response rule defaults bad request response -func (o *CreateTCPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *CreateTCPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule defaults bad request response -func (o *CreateTCPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTCPResponseRuleDefaultsConflictCode is the HTTP code returned for type CreateTCPResponseRuleDefaultsConflict -const CreateTCPResponseRuleDefaultsConflictCode int = 409 - -/* -CreateTCPResponseRuleDefaultsConflict The specified resource already exists - -swagger:response createTcpResponseRuleDefaultsConflict -*/ -type CreateTCPResponseRuleDefaultsConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleDefaultsConflict creates CreateTCPResponseRuleDefaultsConflict with default headers values -func NewCreateTCPResponseRuleDefaultsConflict() *CreateTCPResponseRuleDefaultsConflict { - - return &CreateTCPResponseRuleDefaultsConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create Tcp response rule defaults conflict response -func (o *CreateTCPResponseRuleDefaultsConflict) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleDefaultsConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create Tcp response rule defaults conflict response -func (o *CreateTCPResponseRuleDefaultsConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create Tcp response rule defaults conflict response -func (o *CreateTCPResponseRuleDefaultsConflict) WithPayload(payload *models.Error) *CreateTCPResponseRuleDefaultsConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create Tcp response rule defaults conflict response -func (o *CreateTCPResponseRuleDefaultsConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleDefaultsConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTCPResponseRuleDefaultsDefault General Error - -swagger:response createTcpResponseRuleDefaultsDefault -*/ -type CreateTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTCPResponseRuleDefaultsDefault creates CreateTCPResponseRuleDefaultsDefault with default headers values -func NewCreateTCPResponseRuleDefaultsDefault(code int) *CreateTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &CreateTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *CreateTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *CreateTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *CreateTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create TCP response rule defaults default response -func (o *CreateTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/create_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/create_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index f0981354..00000000 --- a/operations/tcp_response_rule/create_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CreateTCPResponseRuleDefaultsURL generates an URL for the create TCP response rule defaults operation -type CreateTCPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPResponseRuleDefaultsURL) WithBasePath(bp string) *CreateTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on CreateTCPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on CreateTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_backend.go b/operations/tcp_response_rule/delete_tcp_response_rule_backend.go deleted file mode 100644 index 59e83ca8..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a delete TCP response rule backend handler -type DeleteTCPResponseRuleBackendHandlerFunc func(DeleteTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPResponseRuleBackendHandlerFunc) Handle(params DeleteTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPResponseRuleBackendHandler interface for that can handle valid delete TCP response rule backend params -type DeleteTCPResponseRuleBackendHandler interface { - Handle(DeleteTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewDeleteTCPResponseRuleBackend creates a new http.Handler for the delete TCP response rule backend operation -func NewDeleteTCPResponseRuleBackend(ctx *middleware.Context, handler DeleteTCPResponseRuleBackendHandler) *DeleteTCPResponseRuleBackend { - return &DeleteTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - DeleteTCPResponseRuleBackend swagger:route DELETE /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index} TCPResponseRule deleteTcpResponseRuleBackend - -# Delete a TCP Response Rule - -Deletes a TCP Response Rule configuration by it's index from the specified backend. -*/ -type DeleteTCPResponseRuleBackend struct { - Context *middleware.Context - Handler DeleteTCPResponseRuleBackendHandler -} - -func (o *DeleteTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/delete_tcp_response_rule_backend_parameters.go deleted file mode 100644 index 1d5e4f9b..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPResponseRuleBackendParams creates a new DeleteTCPResponseRuleBackendParams object -// with the default values initialized. -func NewDeleteTCPResponseRuleBackendParams() DeleteTCPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPResponseRuleBackendParams contains all the bound params for the delete TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPResponseRuleBackend -type DeleteTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPResponseRuleBackendParams() beforehand. -func (o *DeleteTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/delete_tcp_response_rule_backend_responses.go deleted file mode 100644 index fbbc2358..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPResponseRuleBackendAcceptedCode is the HTTP code returned for type DeleteTCPResponseRuleBackendAccepted -const DeleteTCPResponseRuleBackendAcceptedCode int = 202 - -/* -DeleteTCPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpResponseRuleBackendAccepted -*/ -type DeleteTCPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPResponseRuleBackendAccepted creates DeleteTCPResponseRuleBackendAccepted with default headers values -func NewDeleteTCPResponseRuleBackendAccepted() *DeleteTCPResponseRuleBackendAccepted { - - return &DeleteTCPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp response rule backend accepted response -func (o *DeleteTCPResponseRuleBackendAccepted) WithReloadID(reloadID string) *DeleteTCPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp response rule backend accepted response -func (o *DeleteTCPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPResponseRuleBackendNoContentCode is the HTTP code returned for type DeleteTCPResponseRuleBackendNoContent -const DeleteTCPResponseRuleBackendNoContentCode int = 204 - -/* -DeleteTCPResponseRuleBackendNoContent TCP Response Rule deleted - -swagger:response deleteTcpResponseRuleBackendNoContent -*/ -type DeleteTCPResponseRuleBackendNoContent struct { -} - -// NewDeleteTCPResponseRuleBackendNoContent creates DeleteTCPResponseRuleBackendNoContent with default headers values -func NewDeleteTCPResponseRuleBackendNoContent() *DeleteTCPResponseRuleBackendNoContent { - - return &DeleteTCPResponseRuleBackendNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleBackendNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPResponseRuleBackendNotFoundCode is the HTTP code returned for type DeleteTCPResponseRuleBackendNotFound -const DeleteTCPResponseRuleBackendNotFoundCode int = 404 - -/* -DeleteTCPResponseRuleBackendNotFound The specified resource was not found - -swagger:response deleteTcpResponseRuleBackendNotFound -*/ -type DeleteTCPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPResponseRuleBackendNotFound creates DeleteTCPResponseRuleBackendNotFound with default headers values -func NewDeleteTCPResponseRuleBackendNotFound() *DeleteTCPResponseRuleBackendNotFound { - - return &DeleteTCPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp response rule backend not found response -func (o *DeleteTCPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp response rule backend not found response -func (o *DeleteTCPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp response rule backend not found response -func (o *DeleteTCPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *DeleteTCPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp response rule backend not found response -func (o *DeleteTCPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPResponseRuleBackendDefault General Error - -swagger:response deleteTcpResponseRuleBackendDefault -*/ -type DeleteTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPResponseRuleBackendDefault creates DeleteTCPResponseRuleBackendDefault with default headers values -func NewDeleteTCPResponseRuleBackendDefault(code int) *DeleteTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) WithStatusCode(code int) *DeleteTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *DeleteTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP response rule backend default response -func (o *DeleteTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/delete_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index 09c695ba..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPResponseRuleBackendURL generates an URL for the delete TCP response rule backend operation -type DeleteTCPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPResponseRuleBackendURL) WithBasePath(bp string) *DeleteTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_defaults.go b/operations/tcp_response_rule/delete_tcp_response_rule_defaults.go deleted file mode 100644 index 77936502..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a delete TCP response rule defaults handler -type DeleteTCPResponseRuleDefaultsHandlerFunc func(DeleteTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTCPResponseRuleDefaultsHandlerFunc) Handle(params DeleteTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTCPResponseRuleDefaultsHandler interface for that can handle valid delete TCP response rule defaults params -type DeleteTCPResponseRuleDefaultsHandler interface { - Handle(DeleteTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewDeleteTCPResponseRuleDefaults creates a new http.Handler for the delete TCP response rule defaults operation -func NewDeleteTCPResponseRuleDefaults(ctx *middleware.Context, handler DeleteTCPResponseRuleDefaultsHandler) *DeleteTCPResponseRuleDefaults { - return &DeleteTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - DeleteTCPResponseRuleDefaults swagger:route DELETE /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index} TCPResponseRule deleteTcpResponseRuleDefaults - -# Delete a TCP Response Rule - -Deletes a TCP Response Rule configuration by it's index from the specified backend. -*/ -type DeleteTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler DeleteTCPResponseRuleDefaultsHandler -} - -func (o *DeleteTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/delete_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index 4216d8c2..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,219 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTCPResponseRuleDefaultsParams creates a new DeleteTCPResponseRuleDefaultsParams object -// with the default values initialized. -func NewDeleteTCPResponseRuleDefaultsParams() DeleteTCPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTCPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTCPResponseRuleDefaultsParams contains all the bound params for the delete TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTCPResponseRuleDefaults -type DeleteTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTCPResponseRuleDefaultsParams() beforehand. -func (o *DeleteTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTCPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTCPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *DeleteTCPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *DeleteTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTCPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/delete_tcp_response_rule_defaults_responses.go deleted file mode 100644 index 5d3a2506..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTCPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type DeleteTCPResponseRuleDefaultsAccepted -const DeleteTCPResponseRuleDefaultsAcceptedCode int = 202 - -/* -DeleteTCPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response deleteTcpResponseRuleDefaultsAccepted -*/ -type DeleteTCPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTCPResponseRuleDefaultsAccepted creates DeleteTCPResponseRuleDefaultsAccepted with default headers values -func NewDeleteTCPResponseRuleDefaultsAccepted() *DeleteTCPResponseRuleDefaultsAccepted { - - return &DeleteTCPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the delete Tcp response rule defaults accepted response -func (o *DeleteTCPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *DeleteTCPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete Tcp response rule defaults accepted response -func (o *DeleteTCPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTCPResponseRuleDefaultsNoContentCode is the HTTP code returned for type DeleteTCPResponseRuleDefaultsNoContent -const DeleteTCPResponseRuleDefaultsNoContentCode int = 204 - -/* -DeleteTCPResponseRuleDefaultsNoContent TCP Response Rule deleted - -swagger:response deleteTcpResponseRuleDefaultsNoContent -*/ -type DeleteTCPResponseRuleDefaultsNoContent struct { -} - -// NewDeleteTCPResponseRuleDefaultsNoContent creates DeleteTCPResponseRuleDefaultsNoContent with default headers values -func NewDeleteTCPResponseRuleDefaultsNoContent() *DeleteTCPResponseRuleDefaultsNoContent { - - return &DeleteTCPResponseRuleDefaultsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleDefaultsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTCPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type DeleteTCPResponseRuleDefaultsNotFound -const DeleteTCPResponseRuleDefaultsNotFoundCode int = 404 - -/* -DeleteTCPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response deleteTcpResponseRuleDefaultsNotFound -*/ -type DeleteTCPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPResponseRuleDefaultsNotFound creates DeleteTCPResponseRuleDefaultsNotFound with default headers values -func NewDeleteTCPResponseRuleDefaultsNotFound() *DeleteTCPResponseRuleDefaultsNotFound { - - return &DeleteTCPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete Tcp response rule defaults not found response -func (o *DeleteTCPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTCPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete Tcp response rule defaults not found response -func (o *DeleteTCPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete Tcp response rule defaults not found response -func (o *DeleteTCPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *DeleteTCPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete Tcp response rule defaults not found response -func (o *DeleteTCPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTCPResponseRuleDefaultsDefault General Error - -swagger:response deleteTcpResponseRuleDefaultsDefault -*/ -type DeleteTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTCPResponseRuleDefaultsDefault creates DeleteTCPResponseRuleDefaultsDefault with default headers values -func NewDeleteTCPResponseRuleDefaultsDefault(code int) *DeleteTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *DeleteTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *DeleteTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *DeleteTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete TCP response rule defaults default response -func (o *DeleteTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/delete_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 5b664c0a..00000000 --- a/operations/tcp_response_rule/delete_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteTCPResponseRuleDefaultsURL generates an URL for the delete TCP response rule defaults operation -type DeleteTCPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPResponseRuleDefaultsURL) WithBasePath(bp string) *DeleteTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on DeleteTCPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on DeleteTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_backend.go b/operations/tcp_response_rule/get_all_tcp_response_rule_backend.go deleted file mode 100644 index 0816541b..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a get all TCP response rule backend handler -type GetAllTCPResponseRuleBackendHandlerFunc func(GetAllTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPResponseRuleBackendHandlerFunc) Handle(params GetAllTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPResponseRuleBackendHandler interface for that can handle valid get all TCP response rule backend params -type GetAllTCPResponseRuleBackendHandler interface { - Handle(GetAllTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetAllTCPResponseRuleBackend creates a new http.Handler for the get all TCP response rule backend operation -func NewGetAllTCPResponseRuleBackend(ctx *middleware.Context, handler GetAllTCPResponseRuleBackendHandler) *GetAllTCPResponseRuleBackend { - return &GetAllTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetAllTCPResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules TCPResponseRule getAllTcpResponseRuleBackend - -# Return an array of all TCP Response Rules - -Returns all TCP Response Rules that are configured in specified backend. -*/ -type GetAllTCPResponseRuleBackend struct { - Context *middleware.Context - Handler GetAllTCPResponseRuleBackendHandler -} - -func (o *GetAllTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/get_all_tcp_response_rule_backend_parameters.go deleted file mode 100644 index ea8ca33b..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPResponseRuleBackendParams creates a new GetAllTCPResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPResponseRuleBackendParams() GetAllTCPResponseRuleBackendParams { - - return GetAllTCPResponseRuleBackendParams{} -} - -// GetAllTCPResponseRuleBackendParams contains all the bound params for the get all TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPResponseRuleBackend -type GetAllTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPResponseRuleBackendParams() beforehand. -func (o *GetAllTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/get_all_tcp_response_rule_backend_responses.go deleted file mode 100644 index abafdf6f..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPResponseRuleBackendOKCode is the HTTP code returned for type GetAllTCPResponseRuleBackendOK -const GetAllTCPResponseRuleBackendOKCode int = 200 - -/* -GetAllTCPResponseRuleBackendOK Successful operation - -swagger:response getAllTcpResponseRuleBackendOK -*/ -type GetAllTCPResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewGetAllTCPResponseRuleBackendOK creates GetAllTCPResponseRuleBackendOK with default headers values -func NewGetAllTCPResponseRuleBackendOK() *GetAllTCPResponseRuleBackendOK { - - return &GetAllTCPResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp response rule backend o k response -func (o *GetAllTCPResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp response rule backend o k response -func (o *GetAllTCPResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp response rule backend o k response -func (o *GetAllTCPResponseRuleBackendOK) WithPayload(payload models.TCPResponseRules) *GetAllTCPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp response rule backend o k response -func (o *GetAllTCPResponseRuleBackendOK) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPResponseRuleBackendDefault General Error - -swagger:response getAllTcpResponseRuleBackendDefault -*/ -type GetAllTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPResponseRuleBackendDefault creates GetAllTCPResponseRuleBackendDefault with default headers values -func NewGetAllTCPResponseRuleBackendDefault(code int) *GetAllTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) WithStatusCode(code int) *GetAllTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetAllTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP response rule backend default response -func (o *GetAllTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/get_all_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index 36fbf779..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPResponseRuleBackendURL generates an URL for the get all TCP response rule backend operation -type GetAllTCPResponseRuleBackendURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPResponseRuleBackendURL) WithBasePath(bp string) *GetAllTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults.go b/operations/tcp_response_rule/get_all_tcp_response_rule_defaults.go deleted file mode 100644 index 933a8b4e..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetAllTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get all TCP response rule defaults handler -type GetAllTCPResponseRuleDefaultsHandlerFunc func(GetAllTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetAllTCPResponseRuleDefaultsHandlerFunc) Handle(params GetAllTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetAllTCPResponseRuleDefaultsHandler interface for that can handle valid get all TCP response rule defaults params -type GetAllTCPResponseRuleDefaultsHandler interface { - Handle(GetAllTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetAllTCPResponseRuleDefaults creates a new http.Handler for the get all TCP response rule defaults operation -func NewGetAllTCPResponseRuleDefaults(ctx *middleware.Context, handler GetAllTCPResponseRuleDefaultsHandler) *GetAllTCPResponseRuleDefaults { - return &GetAllTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetAllTCPResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules TCPResponseRule getAllTcpResponseRuleDefaults - -# Return an array of all TCP Response Rules - -Returns all TCP Response Rules that are configured in specified backend. -*/ -type GetAllTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler GetAllTCPResponseRuleDefaultsHandler -} - -func (o *GetAllTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetAllTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index dc8b543b..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetAllTCPResponseRuleDefaultsParams creates a new GetAllTCPResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetAllTCPResponseRuleDefaultsParams() GetAllTCPResponseRuleDefaultsParams { - - return GetAllTCPResponseRuleDefaultsParams{} -} - -// GetAllTCPResponseRuleDefaultsParams contains all the bound params for the get all TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getAllTCPResponseRuleDefaults -type GetAllTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetAllTCPResponseRuleDefaultsParams() beforehand. -func (o *GetAllTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetAllTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetAllTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_responses.go deleted file mode 100644 index d6e92501..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetAllTCPResponseRuleDefaultsOKCode is the HTTP code returned for type GetAllTCPResponseRuleDefaultsOK -const GetAllTCPResponseRuleDefaultsOKCode int = 200 - -/* -GetAllTCPResponseRuleDefaultsOK Successful operation - -swagger:response getAllTcpResponseRuleDefaultsOK -*/ -type GetAllTCPResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewGetAllTCPResponseRuleDefaultsOK creates GetAllTCPResponseRuleDefaultsOK with default headers values -func NewGetAllTCPResponseRuleDefaultsOK() *GetAllTCPResponseRuleDefaultsOK { - - return &GetAllTCPResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get all Tcp response rule defaults o k response -func (o *GetAllTCPResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetAllTCPResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all Tcp response rule defaults o k response -func (o *GetAllTCPResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all Tcp response rule defaults o k response -func (o *GetAllTCPResponseRuleDefaultsOK) WithPayload(payload models.TCPResponseRules) *GetAllTCPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all Tcp response rule defaults o k response -func (o *GetAllTCPResponseRuleDefaultsOK) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetAllTCPResponseRuleDefaultsDefault General Error - -swagger:response getAllTcpResponseRuleDefaultsDefault -*/ -type GetAllTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetAllTCPResponseRuleDefaultsDefault creates GetAllTCPResponseRuleDefaultsDefault with default headers values -func NewGetAllTCPResponseRuleDefaultsDefault(code int) *GetAllTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetAllTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *GetAllTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetAllTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetAllTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get all TCP response rule defaults default response -func (o *GetAllTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetAllTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 471a60ec..00000000 --- a/operations/tcp_response_rule/get_all_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetAllTCPResponseRuleDefaultsURL generates an URL for the get all TCP response rule defaults operation -type GetAllTCPResponseRuleDefaultsURL struct { - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPResponseRuleDefaultsURL) WithBasePath(bp string) *GetAllTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetAllTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetAllTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetAllTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetAllTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetAllTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetAllTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetAllTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetAllTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetAllTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_backend.go b/operations/tcp_response_rule/get_tcp_response_rule_backend.go deleted file mode 100644 index 3d2f86c0..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a get TCP response rule backend handler -type GetTCPResponseRuleBackendHandlerFunc func(GetTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPResponseRuleBackendHandlerFunc) Handle(params GetTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPResponseRuleBackendHandler interface for that can handle valid get TCP response rule backend params -type GetTCPResponseRuleBackendHandler interface { - Handle(GetTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewGetTCPResponseRuleBackend creates a new http.Handler for the get TCP response rule backend operation -func NewGetTCPResponseRuleBackend(ctx *middleware.Context, handler GetTCPResponseRuleBackendHandler) *GetTCPResponseRuleBackend { - return &GetTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - GetTCPResponseRuleBackend swagger:route GET /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index} TCPResponseRule getTcpResponseRuleBackend - -# Return one TCP Response Rule - -Returns one TCP Response Rule configuration by it's index in the specified backend. -*/ -type GetTCPResponseRuleBackend struct { - Context *middleware.Context - Handler GetTCPResponseRuleBackendHandler -} - -func (o *GetTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/get_tcp_response_rule_backend_parameters.go deleted file mode 100644 index 55cc0465..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPResponseRuleBackendParams creates a new GetTCPResponseRuleBackendParams object -// -// There are no default values defined in the spec. -func NewGetTCPResponseRuleBackendParams() GetTCPResponseRuleBackendParams { - - return GetTCPResponseRuleBackendParams{} -} - -// GetTCPResponseRuleBackendParams contains all the bound params for the get TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPResponseRuleBackend -type GetTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPResponseRuleBackendParams() beforehand. -func (o *GetTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/get_tcp_response_rule_backend_responses.go deleted file mode 100644 index b93c0d24..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPResponseRuleBackendOKCode is the HTTP code returned for type GetTCPResponseRuleBackendOK -const GetTCPResponseRuleBackendOKCode int = 200 - -/* -GetTCPResponseRuleBackendOK Successful operation - -swagger:response getTcpResponseRuleBackendOK -*/ -type GetTCPResponseRuleBackendOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleBackendOK creates GetTCPResponseRuleBackendOK with default headers values -func NewGetTCPResponseRuleBackendOK() *GetTCPResponseRuleBackendOK { - - return &GetTCPResponseRuleBackendOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp response rule backend o k response -func (o *GetTCPResponseRuleBackendOK) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleBackendOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp response rule backend o k response -func (o *GetTCPResponseRuleBackendOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp response rule backend o k response -func (o *GetTCPResponseRuleBackendOK) WithPayload(payload *models.TCPResponseRule) *GetTCPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp response rule backend o k response -func (o *GetTCPResponseRuleBackendOK) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPResponseRuleBackendNotFoundCode is the HTTP code returned for type GetTCPResponseRuleBackendNotFound -const GetTCPResponseRuleBackendNotFoundCode int = 404 - -/* -GetTCPResponseRuleBackendNotFound The specified resource was not found - -swagger:response getTcpResponseRuleBackendNotFound -*/ -type GetTCPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleBackendNotFound creates GetTCPResponseRuleBackendNotFound with default headers values -func NewGetTCPResponseRuleBackendNotFound() *GetTCPResponseRuleBackendNotFound { - - return &GetTCPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp response rule backend not found response -func (o *GetTCPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp response rule backend not found response -func (o *GetTCPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp response rule backend not found response -func (o *GetTCPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *GetTCPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp response rule backend not found response -func (o *GetTCPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPResponseRuleBackendDefault General Error - -swagger:response getTcpResponseRuleBackendDefault -*/ -type GetTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleBackendDefault creates GetTCPResponseRuleBackendDefault with default headers values -func NewGetTCPResponseRuleBackendDefault(code int) *GetTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) WithStatusCode(code int) *GetTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *GetTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP response rule backend default response -func (o *GetTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/get_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index 9df06942..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPResponseRuleBackendURL generates an URL for the get TCP response rule backend operation -type GetTCPResponseRuleBackendURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPResponseRuleBackendURL) WithBasePath(bp string) *GetTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_defaults.go b/operations/tcp_response_rule/get_tcp_response_rule_defaults.go deleted file mode 100644 index e3ecd11a..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a get TCP response rule defaults handler -type GetTCPResponseRuleDefaultsHandlerFunc func(GetTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTCPResponseRuleDefaultsHandlerFunc) Handle(params GetTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTCPResponseRuleDefaultsHandler interface for that can handle valid get TCP response rule defaults params -type GetTCPResponseRuleDefaultsHandler interface { - Handle(GetTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewGetTCPResponseRuleDefaults creates a new http.Handler for the get TCP response rule defaults operation -func NewGetTCPResponseRuleDefaults(ctx *middleware.Context, handler GetTCPResponseRuleDefaultsHandler) *GetTCPResponseRuleDefaults { - return &GetTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - GetTCPResponseRuleDefaults swagger:route GET /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index} TCPResponseRule getTcpResponseRuleDefaults - -# Return one TCP Response Rule - -Returns one TCP Response Rule configuration by it's index in the specified backend. -*/ -type GetTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler GetTCPResponseRuleDefaultsHandler -} - -func (o *GetTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/get_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index be37635f..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTCPResponseRuleDefaultsParams creates a new GetTCPResponseRuleDefaultsParams object -// -// There are no default values defined in the spec. -func NewGetTCPResponseRuleDefaultsParams() GetTCPResponseRuleDefaultsParams { - - return GetTCPResponseRuleDefaultsParams{} -} - -// GetTCPResponseRuleDefaultsParams contains all the bound params for the get TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTCPResponseRuleDefaults -type GetTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTCPResponseRuleDefaultsParams() beforehand. -func (o *GetTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *GetTCPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *GetTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/get_tcp_response_rule_defaults_responses.go deleted file mode 100644 index f6f7bfe5..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTCPResponseRuleDefaultsOKCode is the HTTP code returned for type GetTCPResponseRuleDefaultsOK -const GetTCPResponseRuleDefaultsOKCode int = 200 - -/* -GetTCPResponseRuleDefaultsOK Successful operation - -swagger:response getTcpResponseRuleDefaultsOK -*/ -type GetTCPResponseRuleDefaultsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleDefaultsOK creates GetTCPResponseRuleDefaultsOK with default headers values -func NewGetTCPResponseRuleDefaultsOK() *GetTCPResponseRuleDefaultsOK { - - return &GetTCPResponseRuleDefaultsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp response rule defaults o k response -func (o *GetTCPResponseRuleDefaultsOK) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleDefaultsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp response rule defaults o k response -func (o *GetTCPResponseRuleDefaultsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp response rule defaults o k response -func (o *GetTCPResponseRuleDefaultsOK) WithPayload(payload *models.TCPResponseRule) *GetTCPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp response rule defaults o k response -func (o *GetTCPResponseRuleDefaultsOK) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTCPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type GetTCPResponseRuleDefaultsNotFound -const GetTCPResponseRuleDefaultsNotFoundCode int = 404 - -/* -GetTCPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response getTcpResponseRuleDefaultsNotFound -*/ -type GetTCPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleDefaultsNotFound creates GetTCPResponseRuleDefaultsNotFound with default headers values -func NewGetTCPResponseRuleDefaultsNotFound() *GetTCPResponseRuleDefaultsNotFound { - - return &GetTCPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get Tcp response rule defaults not found response -func (o *GetTCPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get Tcp response rule defaults not found response -func (o *GetTCPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get Tcp response rule defaults not found response -func (o *GetTCPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *GetTCPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get Tcp response rule defaults not found response -func (o *GetTCPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTCPResponseRuleDefaultsDefault General Error - -swagger:response getTcpResponseRuleDefaultsDefault -*/ -type GetTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTCPResponseRuleDefaultsDefault creates GetTCPResponseRuleDefaultsDefault with default headers values -func NewGetTCPResponseRuleDefaultsDefault(code int) *GetTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &GetTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *GetTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *GetTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *GetTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get TCP response rule defaults default response -func (o *GetTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/get_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/get_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 90041f71..00000000 --- a/operations/tcp_response_rule/get_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetTCPResponseRuleDefaultsURL generates an URL for the get TCP response rule defaults operation -type GetTCPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPResponseRuleDefaultsURL) WithBasePath(bp string) *GetTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on GetTCPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on GetTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_backend.go deleted file mode 100644 index 72d958c8..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a replace all TCP response rule backend handler -type ReplaceAllTCPResponseRuleBackendHandlerFunc func(ReplaceAllTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPResponseRuleBackendHandlerFunc) Handle(params ReplaceAllTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPResponseRuleBackendHandler interface for that can handle valid replace all TCP response rule backend params -type ReplaceAllTCPResponseRuleBackendHandler interface { - Handle(ReplaceAllTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPResponseRuleBackend creates a new http.Handler for the replace all TCP response rule backend operation -func NewReplaceAllTCPResponseRuleBackend(ctx *middleware.Context, handler ReplaceAllTCPResponseRuleBackendHandler) *ReplaceAllTCPResponseRuleBackend { - return &ReplaceAllTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules TCPResponseRule replaceAllTcpResponseRuleBackend - -# Replace a TCP Response Rule list - -Replaces a whole list of TCP Response Rules with the list given in parameter -*/ -type ReplaceAllTCPResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceAllTCPResponseRuleBackendHandler -} - -func (o *ReplaceAllTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_parameters.go deleted file mode 100644 index eccae8c8..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPResponseRuleBackendParams creates a new ReplaceAllTCPResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceAllTCPResponseRuleBackendParams() ReplaceAllTCPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPResponseRuleBackendParams contains all the bound params for the replace all TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPResponseRuleBackend -type ReplaceAllTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPResponseRuleBackendParams() beforehand. -func (o *ReplaceAllTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_responses.go deleted file mode 100644 index 9ebcba00..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPResponseRuleBackendOKCode is the HTTP code returned for type ReplaceAllTCPResponseRuleBackendOK -const ReplaceAllTCPResponseRuleBackendOKCode int = 200 - -/* -ReplaceAllTCPResponseRuleBackendOK All TCP Response Rule lines replaced - -swagger:response replaceAllTcpResponseRuleBackendOK -*/ -type ReplaceAllTCPResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleBackendOK creates ReplaceAllTCPResponseRuleBackendOK with default headers values -func NewReplaceAllTCPResponseRuleBackendOK() *ReplaceAllTCPResponseRuleBackendOK { - - return &ReplaceAllTCPResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace all Tcp response rule backend o k response -func (o *ReplaceAllTCPResponseRuleBackendOK) WithPayload(payload models.TCPResponseRules) *ReplaceAllTCPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule backend o k response -func (o *ReplaceAllTCPResponseRuleBackendOK) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceAllTCPResponseRuleBackendAccepted -const ReplaceAllTCPResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceAllTCPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpResponseRuleBackendAccepted -*/ -type ReplaceAllTCPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleBackendAccepted creates ReplaceAllTCPResponseRuleBackendAccepted with default headers values -func NewReplaceAllTCPResponseRuleBackendAccepted() *ReplaceAllTCPResponseRuleBackendAccepted { - - return &ReplaceAllTCPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp response rule backend accepted response -func (o *ReplaceAllTCPResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceAllTCPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp response rule backend accepted response -func (o *ReplaceAllTCPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp response rule backend accepted response -func (o *ReplaceAllTCPResponseRuleBackendAccepted) WithPayload(payload models.TCPResponseRules) *ReplaceAllTCPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule backend accepted response -func (o *ReplaceAllTCPResponseRuleBackendAccepted) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceAllTCPResponseRuleBackendBadRequest -const ReplaceAllTCPResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceAllTCPResponseRuleBackendBadRequest Bad request - -swagger:response replaceAllTcpResponseRuleBackendBadRequest -*/ -type ReplaceAllTCPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleBackendBadRequest creates ReplaceAllTCPResponseRuleBackendBadRequest with default headers values -func NewReplaceAllTCPResponseRuleBackendBadRequest() *ReplaceAllTCPResponseRuleBackendBadRequest { - - return &ReplaceAllTCPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp response rule backend bad request response -func (o *ReplaceAllTCPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp response rule backend bad request response -func (o *ReplaceAllTCPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp response rule backend bad request response -func (o *ReplaceAllTCPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule backend bad request response -func (o *ReplaceAllTCPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPResponseRuleBackendDefault General Error - -swagger:response replaceAllTcpResponseRuleBackendDefault -*/ -type ReplaceAllTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleBackendDefault creates ReplaceAllTCPResponseRuleBackendDefault with default headers values -func NewReplaceAllTCPResponseRuleBackendDefault(code int) *ReplaceAllTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceAllTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceAllTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP response rule backend default response -func (o *ReplaceAllTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index 17300ead..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPResponseRuleBackendURL generates an URL for the replace all TCP response rule backend operation -type ReplaceAllTCPResponseRuleBackendURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPResponseRuleBackendURL) WithBasePath(bp string) *ReplaceAllTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults.go deleted file mode 100644 index fb87a3ac..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceAllTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace all TCP response rule defaults handler -type ReplaceAllTCPResponseRuleDefaultsHandlerFunc func(ReplaceAllTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceAllTCPResponseRuleDefaultsHandlerFunc) Handle(params ReplaceAllTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceAllTCPResponseRuleDefaultsHandler interface for that can handle valid replace all TCP response rule defaults params -type ReplaceAllTCPResponseRuleDefaultsHandler interface { - Handle(ReplaceAllTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceAllTCPResponseRuleDefaults creates a new http.Handler for the replace all TCP response rule defaults operation -func NewReplaceAllTCPResponseRuleDefaults(ctx *middleware.Context, handler ReplaceAllTCPResponseRuleDefaultsHandler) *ReplaceAllTCPResponseRuleDefaults { - return &ReplaceAllTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceAllTCPResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules TCPResponseRule replaceAllTcpResponseRuleDefaults - -# Replace a TCP Response Rule list - -Replaces a whole list of TCP Response Rules with the list given in parameter -*/ -type ReplaceAllTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceAllTCPResponseRuleDefaultsHandler -} - -func (o *ReplaceAllTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceAllTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index e515668f..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceAllTCPResponseRuleDefaultsParams creates a new ReplaceAllTCPResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceAllTCPResponseRuleDefaultsParams() ReplaceAllTCPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceAllTCPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceAllTCPResponseRuleDefaultsParams contains all the bound params for the replace all TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceAllTCPResponseRuleDefaults -type ReplaceAllTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data models.TCPResponseRules - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceAllTCPResponseRuleDefaultsParams() beforehand. -func (o *ReplaceAllTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRules - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceAllTCPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceAllTCPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceAllTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceAllTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceAllTCPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_responses.go deleted file mode 100644 index 15bc7495..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceAllTCPResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceAllTCPResponseRuleDefaultsOK -const ReplaceAllTCPResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceAllTCPResponseRuleDefaultsOK All TCP Response Rule lines replaced - -swagger:response replaceAllTcpResponseRuleDefaultsOK -*/ -type ReplaceAllTCPResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleDefaultsOK creates ReplaceAllTCPResponseRuleDefaultsOK with default headers values -func NewReplaceAllTCPResponseRuleDefaultsOK() *ReplaceAllTCPResponseRuleDefaultsOK { - - return &ReplaceAllTCPResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace all Tcp response rule defaults o k response -func (o *ReplaceAllTCPResponseRuleDefaultsOK) WithPayload(payload models.TCPResponseRules) *ReplaceAllTCPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule defaults o k response -func (o *ReplaceAllTCPResponseRuleDefaultsOK) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceAllTCPResponseRuleDefaultsAccepted -const ReplaceAllTCPResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceAllTCPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceAllTcpResponseRuleDefaultsAccepted -*/ -type ReplaceAllTCPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload models.TCPResponseRules `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleDefaultsAccepted creates ReplaceAllTCPResponseRuleDefaultsAccepted with default headers values -func NewReplaceAllTCPResponseRuleDefaultsAccepted() *ReplaceAllTCPResponseRuleDefaultsAccepted { - - return &ReplaceAllTCPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace all Tcp response rule defaults accepted response -func (o *ReplaceAllTCPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceAllTCPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace all Tcp response rule defaults accepted response -func (o *ReplaceAllTCPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace all Tcp response rule defaults accepted response -func (o *ReplaceAllTCPResponseRuleDefaultsAccepted) WithPayload(payload models.TCPResponseRules) *ReplaceAllTCPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule defaults accepted response -func (o *ReplaceAllTCPResponseRuleDefaultsAccepted) SetPayload(payload models.TCPResponseRules) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.TCPResponseRules{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// ReplaceAllTCPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceAllTCPResponseRuleDefaultsBadRequest -const ReplaceAllTCPResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceAllTCPResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceAllTcpResponseRuleDefaultsBadRequest -*/ -type ReplaceAllTCPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleDefaultsBadRequest creates ReplaceAllTCPResponseRuleDefaultsBadRequest with default headers values -func NewReplaceAllTCPResponseRuleDefaultsBadRequest() *ReplaceAllTCPResponseRuleDefaultsBadRequest { - - return &ReplaceAllTCPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace all Tcp response rule defaults bad request response -func (o *ReplaceAllTCPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all Tcp response rule defaults bad request response -func (o *ReplaceAllTCPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all Tcp response rule defaults bad request response -func (o *ReplaceAllTCPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceAllTCPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all Tcp response rule defaults bad request response -func (o *ReplaceAllTCPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceAllTCPResponseRuleDefaultsDefault General Error - -swagger:response replaceAllTcpResponseRuleDefaultsDefault -*/ -type ReplaceAllTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceAllTCPResponseRuleDefaultsDefault creates ReplaceAllTCPResponseRuleDefaultsDefault with default headers values -func NewReplaceAllTCPResponseRuleDefaultsDefault(code int) *ReplaceAllTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceAllTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceAllTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceAllTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceAllTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace all TCP response rule defaults default response -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceAllTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 43355561..00000000 --- a/operations/tcp_response_rule/replace_all_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceAllTCPResponseRuleDefaultsURL generates an URL for the replace all TCP response rule defaults operation -type ReplaceAllTCPResponseRuleDefaultsURL struct { - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceAllTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceAllTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceAllTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules" - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceAllTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceAllTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceAllTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceAllTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceAllTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceAllTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceAllTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_backend.go b/operations/tcp_response_rule/replace_tcp_response_rule_backend.go deleted file mode 100644 index 0a6bf91a..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_backend.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPResponseRuleBackendHandlerFunc turns a function with the right signature into a replace TCP response rule backend handler -type ReplaceTCPResponseRuleBackendHandlerFunc func(ReplaceTCPResponseRuleBackendParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPResponseRuleBackendHandlerFunc) Handle(params ReplaceTCPResponseRuleBackendParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPResponseRuleBackendHandler interface for that can handle valid replace TCP response rule backend params -type ReplaceTCPResponseRuleBackendHandler interface { - Handle(ReplaceTCPResponseRuleBackendParams, interface{}) middleware.Responder -} - -// NewReplaceTCPResponseRuleBackend creates a new http.Handler for the replace TCP response rule backend operation -func NewReplaceTCPResponseRuleBackend(ctx *middleware.Context, handler ReplaceTCPResponseRuleBackendHandler) *ReplaceTCPResponseRuleBackend { - return &ReplaceTCPResponseRuleBackend{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPResponseRuleBackend swagger:route PUT /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index} TCPResponseRule replaceTcpResponseRuleBackend - -# Replace a TCP Response Rule - -Replaces a TCP Response Rule configuration by it's Index in the specified backend. -*/ -type ReplaceTCPResponseRuleBackend struct { - Context *middleware.Context - Handler ReplaceTCPResponseRuleBackendHandler -} - -func (o *ReplaceTCPResponseRuleBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPResponseRuleBackendParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_backend_parameters.go b/operations/tcp_response_rule/replace_tcp_response_rule_backend_parameters.go deleted file mode 100644 index b9141c45..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_backend_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPResponseRuleBackendParams creates a new ReplaceTCPResponseRuleBackendParams object -// with the default values initialized. -func NewReplaceTCPResponseRuleBackendParams() ReplaceTCPResponseRuleBackendParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPResponseRuleBackendParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPResponseRuleBackendParams contains all the bound params for the replace TCP response rule backend operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPResponseRuleBackend -type ReplaceTCPResponseRuleBackendParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPResponseRuleBackendParams() beforehand. -func (o *ReplaceTCPResponseRuleBackendParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPResponseRuleBackendParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPResponseRuleBackendParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPResponseRuleBackendParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPResponseRuleBackendParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPResponseRuleBackendParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPResponseRuleBackendParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_backend_responses.go b/operations/tcp_response_rule/replace_tcp_response_rule_backend_responses.go deleted file mode 100644 index 9db168d1..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_backend_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPResponseRuleBackendOKCode is the HTTP code returned for type ReplaceTCPResponseRuleBackendOK -const ReplaceTCPResponseRuleBackendOKCode int = 200 - -/* -ReplaceTCPResponseRuleBackendOK TCP Response Rule replaced - -swagger:response replaceTcpResponseRuleBackendOK -*/ -type ReplaceTCPResponseRuleBackendOK struct { - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleBackendOK creates ReplaceTCPResponseRuleBackendOK with default headers values -func NewReplaceTCPResponseRuleBackendOK() *ReplaceTCPResponseRuleBackendOK { - - return &ReplaceTCPResponseRuleBackendOK{} -} - -// WithPayload adds the payload to the replace Tcp response rule backend o k response -func (o *ReplaceTCPResponseRuleBackendOK) WithPayload(payload *models.TCPResponseRule) *ReplaceTCPResponseRuleBackendOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule backend o k response -func (o *ReplaceTCPResponseRuleBackendOK) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleBackendOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleBackendAcceptedCode is the HTTP code returned for type ReplaceTCPResponseRuleBackendAccepted -const ReplaceTCPResponseRuleBackendAcceptedCode int = 202 - -/* -ReplaceTCPResponseRuleBackendAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpResponseRuleBackendAccepted -*/ -type ReplaceTCPResponseRuleBackendAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleBackendAccepted creates ReplaceTCPResponseRuleBackendAccepted with default headers values -func NewReplaceTCPResponseRuleBackendAccepted() *ReplaceTCPResponseRuleBackendAccepted { - - return &ReplaceTCPResponseRuleBackendAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp response rule backend accepted response -func (o *ReplaceTCPResponseRuleBackendAccepted) WithReloadID(reloadID string) *ReplaceTCPResponseRuleBackendAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp response rule backend accepted response -func (o *ReplaceTCPResponseRuleBackendAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp response rule backend accepted response -func (o *ReplaceTCPResponseRuleBackendAccepted) WithPayload(payload *models.TCPResponseRule) *ReplaceTCPResponseRuleBackendAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule backend accepted response -func (o *ReplaceTCPResponseRuleBackendAccepted) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleBackendAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleBackendBadRequestCode is the HTTP code returned for type ReplaceTCPResponseRuleBackendBadRequest -const ReplaceTCPResponseRuleBackendBadRequestCode int = 400 - -/* -ReplaceTCPResponseRuleBackendBadRequest Bad request - -swagger:response replaceTcpResponseRuleBackendBadRequest -*/ -type ReplaceTCPResponseRuleBackendBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleBackendBadRequest creates ReplaceTCPResponseRuleBackendBadRequest with default headers values -func NewReplaceTCPResponseRuleBackendBadRequest() *ReplaceTCPResponseRuleBackendBadRequest { - - return &ReplaceTCPResponseRuleBackendBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp response rule backend bad request response -func (o *ReplaceTCPResponseRuleBackendBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleBackendBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp response rule backend bad request response -func (o *ReplaceTCPResponseRuleBackendBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp response rule backend bad request response -func (o *ReplaceTCPResponseRuleBackendBadRequest) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleBackendBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule backend bad request response -func (o *ReplaceTCPResponseRuleBackendBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleBackendBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleBackendNotFoundCode is the HTTP code returned for type ReplaceTCPResponseRuleBackendNotFound -const ReplaceTCPResponseRuleBackendNotFoundCode int = 404 - -/* -ReplaceTCPResponseRuleBackendNotFound The specified resource was not found - -swagger:response replaceTcpResponseRuleBackendNotFound -*/ -type ReplaceTCPResponseRuleBackendNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleBackendNotFound creates ReplaceTCPResponseRuleBackendNotFound with default headers values -func NewReplaceTCPResponseRuleBackendNotFound() *ReplaceTCPResponseRuleBackendNotFound { - - return &ReplaceTCPResponseRuleBackendNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp response rule backend not found response -func (o *ReplaceTCPResponseRuleBackendNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleBackendNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp response rule backend not found response -func (o *ReplaceTCPResponseRuleBackendNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp response rule backend not found response -func (o *ReplaceTCPResponseRuleBackendNotFound) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleBackendNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule backend not found response -func (o *ReplaceTCPResponseRuleBackendNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleBackendNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPResponseRuleBackendDefault General Error - -swagger:response replaceTcpResponseRuleBackendDefault -*/ -type ReplaceTCPResponseRuleBackendDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleBackendDefault creates ReplaceTCPResponseRuleBackendDefault with default headers values -func NewReplaceTCPResponseRuleBackendDefault(code int) *ReplaceTCPResponseRuleBackendDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPResponseRuleBackendDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) WithStatusCode(code int) *ReplaceTCPResponseRuleBackendDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleBackendDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleBackendDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP response rule backend default response -func (o *ReplaceTCPResponseRuleBackendDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleBackendDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_backend_urlbuilder.go b/operations/tcp_response_rule/replace_tcp_response_rule_backend_urlbuilder.go deleted file mode 100644 index d460eec1..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_backend_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPResponseRuleBackendURL generates an URL for the replace TCP response rule backend operation -type ReplaceTCPResponseRuleBackendURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPResponseRuleBackendURL) WithBasePath(bp string) *ReplaceTCPResponseRuleBackendURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPResponseRuleBackendURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPResponseRuleBackendURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPResponseRuleBackendURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPResponseRuleBackendURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPResponseRuleBackendURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPResponseRuleBackendURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPResponseRuleBackendURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPResponseRuleBackendURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPResponseRuleBackendURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPResponseRuleBackendURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_defaults.go b/operations/tcp_response_rule/replace_tcp_response_rule_defaults.go deleted file mode 100644 index cbc59e76..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_defaults.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTCPResponseRuleDefaultsHandlerFunc turns a function with the right signature into a replace TCP response rule defaults handler -type ReplaceTCPResponseRuleDefaultsHandlerFunc func(ReplaceTCPResponseRuleDefaultsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTCPResponseRuleDefaultsHandlerFunc) Handle(params ReplaceTCPResponseRuleDefaultsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTCPResponseRuleDefaultsHandler interface for that can handle valid replace TCP response rule defaults params -type ReplaceTCPResponseRuleDefaultsHandler interface { - Handle(ReplaceTCPResponseRuleDefaultsParams, interface{}) middleware.Responder -} - -// NewReplaceTCPResponseRuleDefaults creates a new http.Handler for the replace TCP response rule defaults operation -func NewReplaceTCPResponseRuleDefaults(ctx *middleware.Context, handler ReplaceTCPResponseRuleDefaultsHandler) *ReplaceTCPResponseRuleDefaults { - return &ReplaceTCPResponseRuleDefaults{Context: ctx, Handler: handler} -} - -/* - ReplaceTCPResponseRuleDefaults swagger:route PUT /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index} TCPResponseRule replaceTcpResponseRuleDefaults - -# Replace a TCP Response Rule - -Replaces a TCP Response Rule configuration by it's Index in the specified backend. -*/ -type ReplaceTCPResponseRuleDefaults struct { - Context *middleware.Context - Handler ReplaceTCPResponseRuleDefaultsHandler -} - -func (o *ReplaceTCPResponseRuleDefaults) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTCPResponseRuleDefaultsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_parameters.go b/operations/tcp_response_rule/replace_tcp_response_rule_defaults_parameters.go deleted file mode 100644 index 8233dfce..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_parameters.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTCPResponseRuleDefaultsParams creates a new ReplaceTCPResponseRuleDefaultsParams object -// with the default values initialized. -func NewReplaceTCPResponseRuleDefaultsParams() ReplaceTCPResponseRuleDefaultsParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceTCPResponseRuleDefaultsParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceTCPResponseRuleDefaultsParams contains all the bound params for the replace TCP response rule defaults operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTCPResponseRuleDefaults -type ReplaceTCPResponseRuleDefaultsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TCPResponseRule - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*TCP Response Rule Index - Required: true - In: path - */ - Index int64 - /*Parent name - Required: true - In: path - */ - ParentName string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTCPResponseRuleDefaultsParams() beforehand. -func (o *ReplaceTCPResponseRuleDefaultsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TCPResponseRule - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rIndex, rhkIndex, _ := route.Params.GetOK("index") - if err := o.bindIndex(rIndex, rhkIndex, route.Formats); err != nil { - res = append(res, err) - } - - rParentName, rhkParentName, _ := route.Params.GetOK("parent_name") - if err := o.bindParentName(rParentName, rhkParentName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTCPResponseRuleDefaultsParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTCPResponseRuleDefaultsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindIndex binds and validates parameter Index from path. -func (o *ReplaceTCPResponseRuleDefaultsParams) bindIndex(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("index", "path", "int64", raw) - } - o.Index = value - - return nil -} - -// bindParentName binds and validates parameter ParentName from path. -func (o *ReplaceTCPResponseRuleDefaultsParams) bindParentName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ParentName = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTCPResponseRuleDefaultsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTCPResponseRuleDefaultsParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_responses.go b/operations/tcp_response_rule/replace_tcp_response_rule_defaults_responses.go deleted file mode 100644 index 24d37892..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTCPResponseRuleDefaultsOKCode is the HTTP code returned for type ReplaceTCPResponseRuleDefaultsOK -const ReplaceTCPResponseRuleDefaultsOKCode int = 200 - -/* -ReplaceTCPResponseRuleDefaultsOK TCP Response Rule replaced - -swagger:response replaceTcpResponseRuleDefaultsOK -*/ -type ReplaceTCPResponseRuleDefaultsOK struct { - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleDefaultsOK creates ReplaceTCPResponseRuleDefaultsOK with default headers values -func NewReplaceTCPResponseRuleDefaultsOK() *ReplaceTCPResponseRuleDefaultsOK { - - return &ReplaceTCPResponseRuleDefaultsOK{} -} - -// WithPayload adds the payload to the replace Tcp response rule defaults o k response -func (o *ReplaceTCPResponseRuleDefaultsOK) WithPayload(payload *models.TCPResponseRule) *ReplaceTCPResponseRuleDefaultsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule defaults o k response -func (o *ReplaceTCPResponseRuleDefaultsOK) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleDefaultsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleDefaultsAcceptedCode is the HTTP code returned for type ReplaceTCPResponseRuleDefaultsAccepted -const ReplaceTCPResponseRuleDefaultsAcceptedCode int = 202 - -/* -ReplaceTCPResponseRuleDefaultsAccepted Configuration change accepted and reload requested - -swagger:response replaceTcpResponseRuleDefaultsAccepted -*/ -type ReplaceTCPResponseRuleDefaultsAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TCPResponseRule `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleDefaultsAccepted creates ReplaceTCPResponseRuleDefaultsAccepted with default headers values -func NewReplaceTCPResponseRuleDefaultsAccepted() *ReplaceTCPResponseRuleDefaultsAccepted { - - return &ReplaceTCPResponseRuleDefaultsAccepted{} -} - -// WithReloadID adds the reloadId to the replace Tcp response rule defaults accepted response -func (o *ReplaceTCPResponseRuleDefaultsAccepted) WithReloadID(reloadID string) *ReplaceTCPResponseRuleDefaultsAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace Tcp response rule defaults accepted response -func (o *ReplaceTCPResponseRuleDefaultsAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace Tcp response rule defaults accepted response -func (o *ReplaceTCPResponseRuleDefaultsAccepted) WithPayload(payload *models.TCPResponseRule) *ReplaceTCPResponseRuleDefaultsAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule defaults accepted response -func (o *ReplaceTCPResponseRuleDefaultsAccepted) SetPayload(payload *models.TCPResponseRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleDefaultsAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleDefaultsBadRequestCode is the HTTP code returned for type ReplaceTCPResponseRuleDefaultsBadRequest -const ReplaceTCPResponseRuleDefaultsBadRequestCode int = 400 - -/* -ReplaceTCPResponseRuleDefaultsBadRequest Bad request - -swagger:response replaceTcpResponseRuleDefaultsBadRequest -*/ -type ReplaceTCPResponseRuleDefaultsBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleDefaultsBadRequest creates ReplaceTCPResponseRuleDefaultsBadRequest with default headers values -func NewReplaceTCPResponseRuleDefaultsBadRequest() *ReplaceTCPResponseRuleDefaultsBadRequest { - - return &ReplaceTCPResponseRuleDefaultsBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp response rule defaults bad request response -func (o *ReplaceTCPResponseRuleDefaultsBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleDefaultsBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp response rule defaults bad request response -func (o *ReplaceTCPResponseRuleDefaultsBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp response rule defaults bad request response -func (o *ReplaceTCPResponseRuleDefaultsBadRequest) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleDefaultsBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule defaults bad request response -func (o *ReplaceTCPResponseRuleDefaultsBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleDefaultsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTCPResponseRuleDefaultsNotFoundCode is the HTTP code returned for type ReplaceTCPResponseRuleDefaultsNotFound -const ReplaceTCPResponseRuleDefaultsNotFoundCode int = 404 - -/* -ReplaceTCPResponseRuleDefaultsNotFound The specified resource was not found - -swagger:response replaceTcpResponseRuleDefaultsNotFound -*/ -type ReplaceTCPResponseRuleDefaultsNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleDefaultsNotFound creates ReplaceTCPResponseRuleDefaultsNotFound with default headers values -func NewReplaceTCPResponseRuleDefaultsNotFound() *ReplaceTCPResponseRuleDefaultsNotFound { - - return &ReplaceTCPResponseRuleDefaultsNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace Tcp response rule defaults not found response -func (o *ReplaceTCPResponseRuleDefaultsNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleDefaultsNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace Tcp response rule defaults not found response -func (o *ReplaceTCPResponseRuleDefaultsNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace Tcp response rule defaults not found response -func (o *ReplaceTCPResponseRuleDefaultsNotFound) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleDefaultsNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace Tcp response rule defaults not found response -func (o *ReplaceTCPResponseRuleDefaultsNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleDefaultsNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTCPResponseRuleDefaultsDefault General Error - -swagger:response replaceTcpResponseRuleDefaultsDefault -*/ -type ReplaceTCPResponseRuleDefaultsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTCPResponseRuleDefaultsDefault creates ReplaceTCPResponseRuleDefaultsDefault with default headers values -func NewReplaceTCPResponseRuleDefaultsDefault(code int) *ReplaceTCPResponseRuleDefaultsDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTCPResponseRuleDefaultsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) WithStatusCode(code int) *ReplaceTCPResponseRuleDefaultsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTCPResponseRuleDefaultsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) WithPayload(payload *models.Error) *ReplaceTCPResponseRuleDefaultsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace TCP response rule defaults default response -func (o *ReplaceTCPResponseRuleDefaultsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTCPResponseRuleDefaultsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_urlbuilder.go b/operations/tcp_response_rule/replace_tcp_response_rule_defaults_urlbuilder.go deleted file mode 100644 index 7e3890aa..00000000 --- a/operations/tcp_response_rule/replace_tcp_response_rule_defaults_urlbuilder.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tcp_response_rule - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceTCPResponseRuleDefaultsURL generates an URL for the replace TCP response rule defaults operation -type ReplaceTCPResponseRuleDefaultsURL struct { - Index int64 - ParentName string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPResponseRuleDefaultsURL) WithBasePath(bp string) *ReplaceTCPResponseRuleDefaultsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTCPResponseRuleDefaultsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTCPResponseRuleDefaultsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}" - - index := swag.FormatInt64(o.Index) - if index != "" { - _path = strings.Replace(_path, "{index}", index, -1) - } else { - return nil, errors.New("index is required on ReplaceTCPResponseRuleDefaultsURL") - } - - parentName := o.ParentName - if parentName != "" { - _path = strings.Replace(_path, "{parent_name}", parentName, -1) - } else { - return nil, errors.New("parentName is required on ReplaceTCPResponseRuleDefaultsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTCPResponseRuleDefaultsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTCPResponseRuleDefaultsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTCPResponseRuleDefaultsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTCPResponseRuleDefaultsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTCPResponseRuleDefaultsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTCPResponseRuleDefaultsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/create_trace_entry.go b/operations/traces/create_trace_entry.go deleted file mode 100644 index 9eb6c54b..00000000 --- a/operations/traces/create_trace_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTraceEntryHandlerFunc turns a function with the right signature into a create trace entry handler -type CreateTraceEntryHandlerFunc func(CreateTraceEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTraceEntryHandlerFunc) Handle(params CreateTraceEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTraceEntryHandler interface for that can handle valid create trace entry params -type CreateTraceEntryHandler interface { - Handle(CreateTraceEntryParams, interface{}) middleware.Responder -} - -// NewCreateTraceEntry creates a new http.Handler for the create trace entry operation -func NewCreateTraceEntry(ctx *middleware.Context, handler CreateTraceEntryHandler) *CreateTraceEntry { - return &CreateTraceEntry{Context: ctx, Handler: handler} -} - -/* - CreateTraceEntry swagger:route POST /services/haproxy/configuration/traces/entries Traces createTraceEntry - -# Add a new trace entry - -Adds a new trace entry into the traces section. The traces section will be created if needed. -*/ -type CreateTraceEntry struct { - Context *middleware.Context - Handler CreateTraceEntryHandler -} - -func (o *CreateTraceEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTraceEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/create_trace_entry_parameters.go b/operations/traces/create_trace_entry_parameters.go deleted file mode 100644 index 98384016..00000000 --- a/operations/traces/create_trace_entry_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTraceEntryParams creates a new CreateTraceEntryParams object -// with the default values initialized. -func NewCreateTraceEntryParams() CreateTraceEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTraceEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTraceEntryParams contains all the bound params for the create trace entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTraceEntry -type CreateTraceEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TraceEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTraceEntryParams() beforehand. -func (o *CreateTraceEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TraceEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTraceEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTraceEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTraceEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTraceEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/traces/create_trace_entry_responses.go b/operations/traces/create_trace_entry_responses.go deleted file mode 100644 index 55f387f7..00000000 --- a/operations/traces/create_trace_entry_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTraceEntryCreatedCode is the HTTP code returned for type CreateTraceEntryCreated -const CreateTraceEntryCreatedCode int = 201 - -/* -CreateTraceEntryCreated Trace entry added - -swagger:response createTraceEntryCreated -*/ -type CreateTraceEntryCreated struct { - - /* - In: Body - */ - Payload *models.TraceEntry `json:"body,omitempty"` -} - -// NewCreateTraceEntryCreated creates CreateTraceEntryCreated with default headers values -func NewCreateTraceEntryCreated() *CreateTraceEntryCreated { - - return &CreateTraceEntryCreated{} -} - -// WithPayload adds the payload to the create trace entry created response -func (o *CreateTraceEntryCreated) WithPayload(payload *models.TraceEntry) *CreateTraceEntryCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create trace entry created response -func (o *CreateTraceEntryCreated) SetPayload(payload *models.TraceEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTraceEntryCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTraceEntryAcceptedCode is the HTTP code returned for type CreateTraceEntryAccepted -const CreateTraceEntryAcceptedCode int = 202 - -/* -CreateTraceEntryAccepted Configuration change accepted and reload requested - -swagger:response createTraceEntryAccepted -*/ -type CreateTraceEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.TraceEntry `json:"body,omitempty"` -} - -// NewCreateTraceEntryAccepted creates CreateTraceEntryAccepted with default headers values -func NewCreateTraceEntryAccepted() *CreateTraceEntryAccepted { - - return &CreateTraceEntryAccepted{} -} - -// WithReloadID adds the reloadId to the create trace entry accepted response -func (o *CreateTraceEntryAccepted) WithReloadID(reloadID string) *CreateTraceEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create trace entry accepted response -func (o *CreateTraceEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create trace entry accepted response -func (o *CreateTraceEntryAccepted) WithPayload(payload *models.TraceEntry) *CreateTraceEntryAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create trace entry accepted response -func (o *CreateTraceEntryAccepted) SetPayload(payload *models.TraceEntry) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTraceEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTraceEntryBadRequestCode is the HTTP code returned for type CreateTraceEntryBadRequest -const CreateTraceEntryBadRequestCode int = 400 - -/* -CreateTraceEntryBadRequest Bad request - -swagger:response createTraceEntryBadRequest -*/ -type CreateTraceEntryBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTraceEntryBadRequest creates CreateTraceEntryBadRequest with default headers values -func NewCreateTraceEntryBadRequest() *CreateTraceEntryBadRequest { - - return &CreateTraceEntryBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create trace entry bad request response -func (o *CreateTraceEntryBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTraceEntryBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create trace entry bad request response -func (o *CreateTraceEntryBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create trace entry bad request response -func (o *CreateTraceEntryBadRequest) WithPayload(payload *models.Error) *CreateTraceEntryBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create trace entry bad request response -func (o *CreateTraceEntryBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTraceEntryBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTraceEntryConflictCode is the HTTP code returned for type CreateTraceEntryConflict -const CreateTraceEntryConflictCode int = 409 - -/* -CreateTraceEntryConflict The specified resource already exists - -swagger:response createTraceEntryConflict -*/ -type CreateTraceEntryConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTraceEntryConflict creates CreateTraceEntryConflict with default headers values -func NewCreateTraceEntryConflict() *CreateTraceEntryConflict { - - return &CreateTraceEntryConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create trace entry conflict response -func (o *CreateTraceEntryConflict) WithConfigurationVersion(configurationVersion string) *CreateTraceEntryConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create trace entry conflict response -func (o *CreateTraceEntryConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create trace entry conflict response -func (o *CreateTraceEntryConflict) WithPayload(payload *models.Error) *CreateTraceEntryConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create trace entry conflict response -func (o *CreateTraceEntryConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTraceEntryConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTraceEntryDefault General Error - -swagger:response createTraceEntryDefault -*/ -type CreateTraceEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTraceEntryDefault creates CreateTraceEntryDefault with default headers values -func NewCreateTraceEntryDefault(code int) *CreateTraceEntryDefault { - if code <= 0 { - code = 500 - } - - return &CreateTraceEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create trace entry default response -func (o *CreateTraceEntryDefault) WithStatusCode(code int) *CreateTraceEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create trace entry default response -func (o *CreateTraceEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create trace entry default response -func (o *CreateTraceEntryDefault) WithConfigurationVersion(configurationVersion string) *CreateTraceEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create trace entry default response -func (o *CreateTraceEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create trace entry default response -func (o *CreateTraceEntryDefault) WithPayload(payload *models.Error) *CreateTraceEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create trace entry default response -func (o *CreateTraceEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTraceEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/create_trace_entry_urlbuilder.go b/operations/traces/create_trace_entry_urlbuilder.go deleted file mode 100644 index 9b537588..00000000 --- a/operations/traces/create_trace_entry_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateTraceEntryURL generates an URL for the create trace entry operation -type CreateTraceEntryURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTraceEntryURL) WithBasePath(bp string) *CreateTraceEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTraceEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTraceEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces/entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTraceEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTraceEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTraceEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTraceEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTraceEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTraceEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/create_traces.go b/operations/traces/create_traces.go deleted file mode 100644 index b6962b54..00000000 --- a/operations/traces/create_traces.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateTracesHandlerFunc turns a function with the right signature into a create traces handler -type CreateTracesHandlerFunc func(CreateTracesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateTracesHandlerFunc) Handle(params CreateTracesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateTracesHandler interface for that can handle valid create traces params -type CreateTracesHandler interface { - Handle(CreateTracesParams, interface{}) middleware.Responder -} - -// NewCreateTraces creates a new http.Handler for the create traces operation -func NewCreateTraces(ctx *middleware.Context, handler CreateTracesHandler) *CreateTraces { - return &CreateTraces{Context: ctx, Handler: handler} -} - -/* - CreateTraces swagger:route POST /services/haproxy/configuration/traces Traces createTraces - -# Create the traces section - -Create the traces section. -*/ -type CreateTraces struct { - Context *middleware.Context - Handler CreateTracesHandler -} - -func (o *CreateTraces) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateTracesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/create_traces_parameters.go b/operations/traces/create_traces_parameters.go deleted file mode 100644 index fdfb81f6..00000000 --- a/operations/traces/create_traces_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateTracesParams creates a new CreateTracesParams object -// with the default values initialized. -func NewCreateTracesParams() CreateTracesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateTracesParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateTracesParams contains all the bound params for the create traces operation -// typically these are obtained from a http.Request -// -// swagger:parameters createTraces -type CreateTracesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Traces - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateTracesParams() beforehand. -func (o *CreateTracesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Traces - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateTracesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateTracesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateTracesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateTracesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/traces/create_traces_responses.go b/operations/traces/create_traces_responses.go deleted file mode 100644 index d5a6ee4c..00000000 --- a/operations/traces/create_traces_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateTracesCreatedCode is the HTTP code returned for type CreateTracesCreated -const CreateTracesCreatedCode int = 201 - -/* -CreateTracesCreated Traces section created - -swagger:response createTracesCreated -*/ -type CreateTracesCreated struct { - - /* - In: Body - */ - Payload *models.Traces `json:"body,omitempty"` -} - -// NewCreateTracesCreated creates CreateTracesCreated with default headers values -func NewCreateTracesCreated() *CreateTracesCreated { - - return &CreateTracesCreated{} -} - -// WithPayload adds the payload to the create traces created response -func (o *CreateTracesCreated) WithPayload(payload *models.Traces) *CreateTracesCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create traces created response -func (o *CreateTracesCreated) SetPayload(payload *models.Traces) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTracesCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTracesAcceptedCode is the HTTP code returned for type CreateTracesAccepted -const CreateTracesAcceptedCode int = 202 - -/* -CreateTracesAccepted Configuration change accepted and reload requested - -swagger:response createTracesAccepted -*/ -type CreateTracesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Traces `json:"body,omitempty"` -} - -// NewCreateTracesAccepted creates CreateTracesAccepted with default headers values -func NewCreateTracesAccepted() *CreateTracesAccepted { - - return &CreateTracesAccepted{} -} - -// WithReloadID adds the reloadId to the create traces accepted response -func (o *CreateTracesAccepted) WithReloadID(reloadID string) *CreateTracesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create traces accepted response -func (o *CreateTracesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create traces accepted response -func (o *CreateTracesAccepted) WithPayload(payload *models.Traces) *CreateTracesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create traces accepted response -func (o *CreateTracesAccepted) SetPayload(payload *models.Traces) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTracesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTracesBadRequestCode is the HTTP code returned for type CreateTracesBadRequest -const CreateTracesBadRequestCode int = 400 - -/* -CreateTracesBadRequest Bad request - -swagger:response createTracesBadRequest -*/ -type CreateTracesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTracesBadRequest creates CreateTracesBadRequest with default headers values -func NewCreateTracesBadRequest() *CreateTracesBadRequest { - - return &CreateTracesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create traces bad request response -func (o *CreateTracesBadRequest) WithConfigurationVersion(configurationVersion string) *CreateTracesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create traces bad request response -func (o *CreateTracesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create traces bad request response -func (o *CreateTracesBadRequest) WithPayload(payload *models.Error) *CreateTracesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create traces bad request response -func (o *CreateTracesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTracesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateTracesConflictCode is the HTTP code returned for type CreateTracesConflict -const CreateTracesConflictCode int = 409 - -/* -CreateTracesConflict The specified resource already exists - -swagger:response createTracesConflict -*/ -type CreateTracesConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTracesConflict creates CreateTracesConflict with default headers values -func NewCreateTracesConflict() *CreateTracesConflict { - - return &CreateTracesConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create traces conflict response -func (o *CreateTracesConflict) WithConfigurationVersion(configurationVersion string) *CreateTracesConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create traces conflict response -func (o *CreateTracesConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create traces conflict response -func (o *CreateTracesConflict) WithPayload(payload *models.Error) *CreateTracesConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create traces conflict response -func (o *CreateTracesConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTracesConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateTracesDefault General Error - -swagger:response createTracesDefault -*/ -type CreateTracesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateTracesDefault creates CreateTracesDefault with default headers values -func NewCreateTracesDefault(code int) *CreateTracesDefault { - if code <= 0 { - code = 500 - } - - return &CreateTracesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create traces default response -func (o *CreateTracesDefault) WithStatusCode(code int) *CreateTracesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create traces default response -func (o *CreateTracesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create traces default response -func (o *CreateTracesDefault) WithConfigurationVersion(configurationVersion string) *CreateTracesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create traces default response -func (o *CreateTracesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create traces default response -func (o *CreateTracesDefault) WithPayload(payload *models.Error) *CreateTracesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create traces default response -func (o *CreateTracesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateTracesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/create_traces_urlbuilder.go b/operations/traces/create_traces_urlbuilder.go deleted file mode 100644 index 1e9dc31d..00000000 --- a/operations/traces/create_traces_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateTracesURL generates an URL for the create traces operation -type CreateTracesURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTracesURL) WithBasePath(bp string) *CreateTracesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateTracesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateTracesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateTracesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateTracesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateTracesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateTracesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateTracesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateTracesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/delete_trace_entry.go b/operations/traces/delete_trace_entry.go deleted file mode 100644 index bf5d7ecd..00000000 --- a/operations/traces/delete_trace_entry.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTraceEntryHandlerFunc turns a function with the right signature into a delete trace entry handler -type DeleteTraceEntryHandlerFunc func(DeleteTraceEntryParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTraceEntryHandlerFunc) Handle(params DeleteTraceEntryParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTraceEntryHandler interface for that can handle valid delete trace entry params -type DeleteTraceEntryHandler interface { - Handle(DeleteTraceEntryParams, interface{}) middleware.Responder -} - -// NewDeleteTraceEntry creates a new http.Handler for the delete trace entry operation -func NewDeleteTraceEntry(ctx *middleware.Context, handler DeleteTraceEntryHandler) *DeleteTraceEntry { - return &DeleteTraceEntry{Context: ctx, Handler: handler} -} - -/* - DeleteTraceEntry swagger:route DELETE /services/haproxy/configuration/traces/entries Traces deleteTraceEntry - -# Delete a trace entry - -Deletes a trace entry from the traces section. -*/ -type DeleteTraceEntry struct { - Context *middleware.Context - Handler DeleteTraceEntryHandler -} - -func (o *DeleteTraceEntry) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTraceEntryParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/delete_trace_entry_parameters.go b/operations/traces/delete_trace_entry_parameters.go deleted file mode 100644 index 25467994..00000000 --- a/operations/traces/delete_trace_entry_parameters.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewDeleteTraceEntryParams creates a new DeleteTraceEntryParams object -// with the default values initialized. -func NewDeleteTraceEntryParams() DeleteTraceEntryParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTraceEntryParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTraceEntryParams contains all the bound params for the delete trace entry operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTraceEntry -type DeleteTraceEntryParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.TraceEntry - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTraceEntryParams() beforehand. -func (o *DeleteTraceEntryParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.TraceEntry - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTraceEntryParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTraceEntryParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTraceEntryParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTraceEntryParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/traces/delete_trace_entry_responses.go b/operations/traces/delete_trace_entry_responses.go deleted file mode 100644 index 2773ccea..00000000 --- a/operations/traces/delete_trace_entry_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTraceEntryAcceptedCode is the HTTP code returned for type DeleteTraceEntryAccepted -const DeleteTraceEntryAcceptedCode int = 202 - -/* -DeleteTraceEntryAccepted Configuration change accepted and reload requested - -swagger:response deleteTraceEntryAccepted -*/ -type DeleteTraceEntryAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTraceEntryAccepted creates DeleteTraceEntryAccepted with default headers values -func NewDeleteTraceEntryAccepted() *DeleteTraceEntryAccepted { - - return &DeleteTraceEntryAccepted{} -} - -// WithReloadID adds the reloadId to the delete trace entry accepted response -func (o *DeleteTraceEntryAccepted) WithReloadID(reloadID string) *DeleteTraceEntryAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete trace entry accepted response -func (o *DeleteTraceEntryAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTraceEntryAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTraceEntryNoContentCode is the HTTP code returned for type DeleteTraceEntryNoContent -const DeleteTraceEntryNoContentCode int = 204 - -/* -DeleteTraceEntryNoContent Trace entry deleted - -swagger:response deleteTraceEntryNoContent -*/ -type DeleteTraceEntryNoContent struct { -} - -// NewDeleteTraceEntryNoContent creates DeleteTraceEntryNoContent with default headers values -func NewDeleteTraceEntryNoContent() *DeleteTraceEntryNoContent { - - return &DeleteTraceEntryNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTraceEntryNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTraceEntryNotFoundCode is the HTTP code returned for type DeleteTraceEntryNotFound -const DeleteTraceEntryNotFoundCode int = 404 - -/* -DeleteTraceEntryNotFound The specified resource was not found - -swagger:response deleteTraceEntryNotFound -*/ -type DeleteTraceEntryNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTraceEntryNotFound creates DeleteTraceEntryNotFound with default headers values -func NewDeleteTraceEntryNotFound() *DeleteTraceEntryNotFound { - - return &DeleteTraceEntryNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete trace entry not found response -func (o *DeleteTraceEntryNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTraceEntryNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete trace entry not found response -func (o *DeleteTraceEntryNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete trace entry not found response -func (o *DeleteTraceEntryNotFound) WithPayload(payload *models.Error) *DeleteTraceEntryNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete trace entry not found response -func (o *DeleteTraceEntryNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTraceEntryNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTraceEntryDefault General Error - -swagger:response deleteTraceEntryDefault -*/ -type DeleteTraceEntryDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTraceEntryDefault creates DeleteTraceEntryDefault with default headers values -func NewDeleteTraceEntryDefault(code int) *DeleteTraceEntryDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTraceEntryDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete trace entry default response -func (o *DeleteTraceEntryDefault) WithStatusCode(code int) *DeleteTraceEntryDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete trace entry default response -func (o *DeleteTraceEntryDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete trace entry default response -func (o *DeleteTraceEntryDefault) WithConfigurationVersion(configurationVersion string) *DeleteTraceEntryDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete trace entry default response -func (o *DeleteTraceEntryDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete trace entry default response -func (o *DeleteTraceEntryDefault) WithPayload(payload *models.Error) *DeleteTraceEntryDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete trace entry default response -func (o *DeleteTraceEntryDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTraceEntryDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/delete_trace_entry_urlbuilder.go b/operations/traces/delete_trace_entry_urlbuilder.go deleted file mode 100644 index e2665b0e..00000000 --- a/operations/traces/delete_trace_entry_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// DeleteTraceEntryURL generates an URL for the delete trace entry operation -type DeleteTraceEntryURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTraceEntryURL) WithBasePath(bp string) *DeleteTraceEntryURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTraceEntryURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTraceEntryURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces/entries" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTraceEntryURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTraceEntryURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTraceEntryURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTraceEntryURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTraceEntryURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTraceEntryURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/delete_traces.go b/operations/traces/delete_traces.go deleted file mode 100644 index 1c62e919..00000000 --- a/operations/traces/delete_traces.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTracesHandlerFunc turns a function with the right signature into a delete traces handler -type DeleteTracesHandlerFunc func(DeleteTracesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTracesHandlerFunc) Handle(params DeleteTracesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTracesHandler interface for that can handle valid delete traces params -type DeleteTracesHandler interface { - Handle(DeleteTracesParams, interface{}) middleware.Responder -} - -// NewDeleteTraces creates a new http.Handler for the delete traces operation -func NewDeleteTraces(ctx *middleware.Context, handler DeleteTracesHandler) *DeleteTraces { - return &DeleteTraces{Context: ctx, Handler: handler} -} - -/* - DeleteTraces swagger:route DELETE /services/haproxy/configuration/traces Traces deleteTraces - -# Delete the traces section - -Delete the whole traces section. -*/ -type DeleteTraces struct { - Context *middleware.Context - Handler DeleteTracesHandler -} - -func (o *DeleteTraces) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTracesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/delete_traces_parameters.go b/operations/traces/delete_traces_parameters.go deleted file mode 100644 index 4531a1aa..00000000 --- a/operations/traces/delete_traces_parameters.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteTracesParams creates a new DeleteTracesParams object -// with the default values initialized. -func NewDeleteTracesParams() DeleteTracesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteTracesParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteTracesParams contains all the bound params for the delete traces operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTraces -type DeleteTracesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTracesParams() beforehand. -func (o *DeleteTracesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteTracesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteTracesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteTracesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteTracesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/traces/delete_traces_responses.go b/operations/traces/delete_traces_responses.go deleted file mode 100644 index 253c4f4a..00000000 --- a/operations/traces/delete_traces_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTracesAcceptedCode is the HTTP code returned for type DeleteTracesAccepted -const DeleteTracesAcceptedCode int = 202 - -/* -DeleteTracesAccepted Configuration change accepted and reload requested - -swagger:response deleteTracesAccepted -*/ -type DeleteTracesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteTracesAccepted creates DeleteTracesAccepted with default headers values -func NewDeleteTracesAccepted() *DeleteTracesAccepted { - - return &DeleteTracesAccepted{} -} - -// WithReloadID adds the reloadId to the delete traces accepted response -func (o *DeleteTracesAccepted) WithReloadID(reloadID string) *DeleteTracesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete traces accepted response -func (o *DeleteTracesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteTracesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteTracesNoContentCode is the HTTP code returned for type DeleteTracesNoContent -const DeleteTracesNoContentCode int = 204 - -/* -DeleteTracesNoContent Traces section deleted - -swagger:response deleteTracesNoContent -*/ -type DeleteTracesNoContent struct { -} - -// NewDeleteTracesNoContent creates DeleteTracesNoContent with default headers values -func NewDeleteTracesNoContent() *DeleteTracesNoContent { - - return &DeleteTracesNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTracesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTracesNotFoundCode is the HTTP code returned for type DeleteTracesNotFound -const DeleteTracesNotFoundCode int = 404 - -/* -DeleteTracesNotFound The specified resource was not found - -swagger:response deleteTracesNotFound -*/ -type DeleteTracesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTracesNotFound creates DeleteTracesNotFound with default headers values -func NewDeleteTracesNotFound() *DeleteTracesNotFound { - - return &DeleteTracesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete traces not found response -func (o *DeleteTracesNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTracesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete traces not found response -func (o *DeleteTracesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete traces not found response -func (o *DeleteTracesNotFound) WithPayload(payload *models.Error) *DeleteTracesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete traces not found response -func (o *DeleteTracesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTracesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTracesDefault General Error - -swagger:response deleteTracesDefault -*/ -type DeleteTracesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTracesDefault creates DeleteTracesDefault with default headers values -func NewDeleteTracesDefault(code int) *DeleteTracesDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTracesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete traces default response -func (o *DeleteTracesDefault) WithStatusCode(code int) *DeleteTracesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete traces default response -func (o *DeleteTracesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete traces default response -func (o *DeleteTracesDefault) WithConfigurationVersion(configurationVersion string) *DeleteTracesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete traces default response -func (o *DeleteTracesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete traces default response -func (o *DeleteTracesDefault) WithPayload(payload *models.Error) *DeleteTracesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete traces default response -func (o *DeleteTracesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTracesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/delete_traces_urlbuilder.go b/operations/traces/delete_traces_urlbuilder.go deleted file mode 100644 index 66e2e866..00000000 --- a/operations/traces/delete_traces_urlbuilder.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// DeleteTracesURL generates an URL for the delete traces operation -type DeleteTracesURL struct { - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTracesURL) WithBasePath(bp string) *DeleteTracesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTracesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTracesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTracesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTracesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTracesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTracesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTracesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTracesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/get_traces.go b/operations/traces/get_traces.go deleted file mode 100644 index 5acaec19..00000000 --- a/operations/traces/get_traces.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTracesHandlerFunc turns a function with the right signature into a get traces handler -type GetTracesHandlerFunc func(GetTracesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTracesHandlerFunc) Handle(params GetTracesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTracesHandler interface for that can handle valid get traces params -type GetTracesHandler interface { - Handle(GetTracesParams, interface{}) middleware.Responder -} - -// NewGetTraces creates a new http.Handler for the get traces operation -func NewGetTraces(ctx *middleware.Context, handler GetTracesHandler) *GetTraces { - return &GetTraces{Context: ctx, Handler: handler} -} - -/* - GetTraces swagger:route GET /services/haproxy/configuration/traces Traces getTraces - -# Return the traces section contents - -Return the traces section contents. -*/ -type GetTraces struct { - Context *middleware.Context - Handler GetTracesHandler -} - -func (o *GetTraces) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTracesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/get_traces_parameters.go b/operations/traces/get_traces_parameters.go deleted file mode 100644 index dbdba2c0..00000000 --- a/operations/traces/get_traces_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetTracesParams creates a new GetTracesParams object -// with the default values initialized. -func NewGetTracesParams() GetTracesParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetTracesParams{ - FullSection: &fullSectionDefault, - } -} - -// GetTracesParams contains all the bound params for the get traces operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTraces -type GetTracesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTracesParams() beforehand. -func (o *GetTracesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetTracesParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetTracesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetTracesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/traces/get_traces_responses.go b/operations/traces/get_traces_responses.go deleted file mode 100644 index b98fed5f..00000000 --- a/operations/traces/get_traces_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTracesOKCode is the HTTP code returned for type GetTracesOK -const GetTracesOKCode int = 200 - -/* -GetTracesOK Successful operation - -swagger:response getTracesOK -*/ -type GetTracesOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Traces `json:"body,omitempty"` -} - -// NewGetTracesOK creates GetTracesOK with default headers values -func NewGetTracesOK() *GetTracesOK { - - return &GetTracesOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get traces o k response -func (o *GetTracesOK) WithConfigurationVersion(configurationVersion string) *GetTracesOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get traces o k response -func (o *GetTracesOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get traces o k response -func (o *GetTracesOK) WithPayload(payload *models.Traces) *GetTracesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get traces o k response -func (o *GetTracesOK) SetPayload(payload *models.Traces) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTracesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTracesNotFoundCode is the HTTP code returned for type GetTracesNotFound -const GetTracesNotFoundCode int = 404 - -/* -GetTracesNotFound The specified resource was not found - -swagger:response getTracesNotFound -*/ -type GetTracesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTracesNotFound creates GetTracesNotFound with default headers values -func NewGetTracesNotFound() *GetTracesNotFound { - - return &GetTracesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get traces not found response -func (o *GetTracesNotFound) WithConfigurationVersion(configurationVersion string) *GetTracesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get traces not found response -func (o *GetTracesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get traces not found response -func (o *GetTracesNotFound) WithPayload(payload *models.Error) *GetTracesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get traces not found response -func (o *GetTracesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTracesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTracesDefault General Error - -swagger:response getTracesDefault -*/ -type GetTracesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTracesDefault creates GetTracesDefault with default headers values -func NewGetTracesDefault(code int) *GetTracesDefault { - if code <= 0 { - code = 500 - } - - return &GetTracesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get traces default response -func (o *GetTracesDefault) WithStatusCode(code int) *GetTracesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get traces default response -func (o *GetTracesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get traces default response -func (o *GetTracesDefault) WithConfigurationVersion(configurationVersion string) *GetTracesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get traces default response -func (o *GetTracesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get traces default response -func (o *GetTracesDefault) WithPayload(payload *models.Error) *GetTracesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get traces default response -func (o *GetTracesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTracesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/get_traces_urlbuilder.go b/operations/traces/get_traces_urlbuilder.go deleted file mode 100644 index 638dc31e..00000000 --- a/operations/traces/get_traces_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetTracesURL generates an URL for the get traces operation -type GetTracesURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTracesURL) WithBasePath(bp string) *GetTracesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTracesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTracesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTracesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTracesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTracesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTracesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTracesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTracesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/traces/replace_traces.go b/operations/traces/replace_traces.go deleted file mode 100644 index d353da20..00000000 --- a/operations/traces/replace_traces.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceTracesHandlerFunc turns a function with the right signature into a replace traces handler -type ReplaceTracesHandlerFunc func(ReplaceTracesParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceTracesHandlerFunc) Handle(params ReplaceTracesParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceTracesHandler interface for that can handle valid replace traces params -type ReplaceTracesHandler interface { - Handle(ReplaceTracesParams, interface{}) middleware.Responder -} - -// NewReplaceTraces creates a new http.Handler for the replace traces operation -func NewReplaceTraces(ctx *middleware.Context, handler ReplaceTracesHandler) *ReplaceTraces { - return &ReplaceTraces{Context: ctx, Handler: handler} -} - -/* - ReplaceTraces swagger:route PUT /services/haproxy/configuration/traces Traces replaceTraces - -# Replace traces - -Replace the traces section contents -*/ -type ReplaceTraces struct { - Context *middleware.Context - Handler ReplaceTracesHandler -} - -func (o *ReplaceTraces) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceTracesParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/traces/replace_traces_parameters.go b/operations/traces/replace_traces_parameters.go deleted file mode 100644 index d03db2e8..00000000 --- a/operations/traces/replace_traces_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceTracesParams creates a new ReplaceTracesParams object -// with the default values initialized. -func NewReplaceTracesParams() ReplaceTracesParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return ReplaceTracesParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// ReplaceTracesParams contains all the bound params for the replace traces operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceTraces -type ReplaceTracesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Traces - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceTracesParams() beforehand. -func (o *ReplaceTracesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Traces - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceTracesParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTracesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *ReplaceTracesParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceTracesParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceTracesParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceTracesParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/traces/replace_traces_responses.go b/operations/traces/replace_traces_responses.go deleted file mode 100644 index b21ec909..00000000 --- a/operations/traces/replace_traces_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceTracesOKCode is the HTTP code returned for type ReplaceTracesOK -const ReplaceTracesOKCode int = 200 - -/* -ReplaceTracesOK Traces replaced - -swagger:response replaceTracesOK -*/ -type ReplaceTracesOK struct { - - /* - In: Body - */ - Payload *models.Traces `json:"body,omitempty"` -} - -// NewReplaceTracesOK creates ReplaceTracesOK with default headers values -func NewReplaceTracesOK() *ReplaceTracesOK { - - return &ReplaceTracesOK{} -} - -// WithPayload adds the payload to the replace traces o k response -func (o *ReplaceTracesOK) WithPayload(payload *models.Traces) *ReplaceTracesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace traces o k response -func (o *ReplaceTracesOK) SetPayload(payload *models.Traces) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTracesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTracesAcceptedCode is the HTTP code returned for type ReplaceTracesAccepted -const ReplaceTracesAcceptedCode int = 202 - -/* -ReplaceTracesAccepted Configuration change accepted and reload requested - -swagger:response replaceTracesAccepted -*/ -type ReplaceTracesAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Traces `json:"body,omitempty"` -} - -// NewReplaceTracesAccepted creates ReplaceTracesAccepted with default headers values -func NewReplaceTracesAccepted() *ReplaceTracesAccepted { - - return &ReplaceTracesAccepted{} -} - -// WithReloadID adds the reloadId to the replace traces accepted response -func (o *ReplaceTracesAccepted) WithReloadID(reloadID string) *ReplaceTracesAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace traces accepted response -func (o *ReplaceTracesAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace traces accepted response -func (o *ReplaceTracesAccepted) WithPayload(payload *models.Traces) *ReplaceTracesAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace traces accepted response -func (o *ReplaceTracesAccepted) SetPayload(payload *models.Traces) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTracesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTracesBadRequestCode is the HTTP code returned for type ReplaceTracesBadRequest -const ReplaceTracesBadRequestCode int = 400 - -/* -ReplaceTracesBadRequest Bad request - -swagger:response replaceTracesBadRequest -*/ -type ReplaceTracesBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTracesBadRequest creates ReplaceTracesBadRequest with default headers values -func NewReplaceTracesBadRequest() *ReplaceTracesBadRequest { - - return &ReplaceTracesBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace traces bad request response -func (o *ReplaceTracesBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceTracesBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace traces bad request response -func (o *ReplaceTracesBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace traces bad request response -func (o *ReplaceTracesBadRequest) WithPayload(payload *models.Error) *ReplaceTracesBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace traces bad request response -func (o *ReplaceTracesBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTracesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceTracesNotFoundCode is the HTTP code returned for type ReplaceTracesNotFound -const ReplaceTracesNotFoundCode int = 404 - -/* -ReplaceTracesNotFound The specified resource was not found - -swagger:response replaceTracesNotFound -*/ -type ReplaceTracesNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTracesNotFound creates ReplaceTracesNotFound with default headers values -func NewReplaceTracesNotFound() *ReplaceTracesNotFound { - - return &ReplaceTracesNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace traces not found response -func (o *ReplaceTracesNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceTracesNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace traces not found response -func (o *ReplaceTracesNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace traces not found response -func (o *ReplaceTracesNotFound) WithPayload(payload *models.Error) *ReplaceTracesNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace traces not found response -func (o *ReplaceTracesNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTracesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceTracesDefault General Error - -swagger:response replaceTracesDefault -*/ -type ReplaceTracesDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceTracesDefault creates ReplaceTracesDefault with default headers values -func NewReplaceTracesDefault(code int) *ReplaceTracesDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceTracesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace traces default response -func (o *ReplaceTracesDefault) WithStatusCode(code int) *ReplaceTracesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace traces default response -func (o *ReplaceTracesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace traces default response -func (o *ReplaceTracesDefault) WithConfigurationVersion(configurationVersion string) *ReplaceTracesDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace traces default response -func (o *ReplaceTracesDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace traces default response -func (o *ReplaceTracesDefault) WithPayload(payload *models.Error) *ReplaceTracesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace traces default response -func (o *ReplaceTracesDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceTracesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/traces/replace_traces_urlbuilder.go b/operations/traces/replace_traces_urlbuilder.go deleted file mode 100644 index 44209481..00000000 --- a/operations/traces/replace_traces_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package traces - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// ReplaceTracesURL generates an URL for the replace traces operation -type ReplaceTracesURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTracesURL) WithBasePath(bp string) *ReplaceTracesURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceTracesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceTracesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/traces" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceTracesURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceTracesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceTracesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceTracesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceTracesURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceTracesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/transactions/commit_transaction.go b/operations/transactions/commit_transaction.go deleted file mode 100644 index aea62de6..00000000 --- a/operations/transactions/commit_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CommitTransactionHandlerFunc turns a function with the right signature into a commit transaction handler -type CommitTransactionHandlerFunc func(CommitTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CommitTransactionHandlerFunc) Handle(params CommitTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CommitTransactionHandler interface for that can handle valid commit transaction params -type CommitTransactionHandler interface { - Handle(CommitTransactionParams, interface{}) middleware.Responder -} - -// NewCommitTransaction creates a new http.Handler for the commit transaction operation -func NewCommitTransaction(ctx *middleware.Context, handler CommitTransactionHandler) *CommitTransaction { - return &CommitTransaction{Context: ctx, Handler: handler} -} - -/* - CommitTransaction swagger:route PUT /services/haproxy/transactions/{id} Transactions commitTransaction - -# Commit transaction - -Commit transaction, execute all operations in transaction and return msg -*/ -type CommitTransaction struct { - Context *middleware.Context - Handler CommitTransactionHandler -} - -func (o *CommitTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCommitTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/transactions/commit_transaction_parameters.go b/operations/transactions/commit_transaction_parameters.go deleted file mode 100644 index 4bfe1e70..00000000 --- a/operations/transactions/commit_transaction_parameters.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewCommitTransactionParams creates a new CommitTransactionParams object -// with the default values initialized. -func NewCommitTransactionParams() CommitTransactionParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CommitTransactionParams{ - ForceReload: &forceReloadDefault, - } -} - -// CommitTransactionParams contains all the bound params for the commit transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters commitTransaction -type CommitTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Transaction id - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCommitTransactionParams() beforehand. -func (o *CommitTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CommitTransactionParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCommitTransactionParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *CommitTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/transactions/commit_transaction_responses.go b/operations/transactions/commit_transaction_responses.go deleted file mode 100644 index 30a02783..00000000 --- a/operations/transactions/commit_transaction_responses.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CommitTransactionOKCode is the HTTP code returned for type CommitTransactionOK -const CommitTransactionOKCode int = 200 - -/* -CommitTransactionOK Transaction successfully committed - -swagger:response commitTransactionOK -*/ -type CommitTransactionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Transaction `json:"body,omitempty"` -} - -// NewCommitTransactionOK creates CommitTransactionOK with default headers values -func NewCommitTransactionOK() *CommitTransactionOK { - - return &CommitTransactionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction o k response -func (o *CommitTransactionOK) WithConfigurationVersion(configurationVersion string) *CommitTransactionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction o k response -func (o *CommitTransactionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit transaction o k response -func (o *CommitTransactionOK) WithPayload(payload *models.Transaction) *CommitTransactionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction o k response -func (o *CommitTransactionOK) SetPayload(payload *models.Transaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitTransactionAcceptedCode is the HTTP code returned for type CommitTransactionAccepted -const CommitTransactionAcceptedCode int = 202 - -/* -CommitTransactionAccepted Configuration change accepted and reload requested - -swagger:response commitTransactionAccepted -*/ -type CommitTransactionAccepted struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Transaction `json:"body,omitempty"` -} - -// NewCommitTransactionAccepted creates CommitTransactionAccepted with default headers values -func NewCommitTransactionAccepted() *CommitTransactionAccepted { - - return &CommitTransactionAccepted{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction accepted response -func (o *CommitTransactionAccepted) WithConfigurationVersion(configurationVersion string) *CommitTransactionAccepted { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction accepted response -func (o *CommitTransactionAccepted) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithReloadID adds the reloadId to the commit transaction accepted response -func (o *CommitTransactionAccepted) WithReloadID(reloadID string) *CommitTransactionAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the commit transaction accepted response -func (o *CommitTransactionAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the commit transaction accepted response -func (o *CommitTransactionAccepted) WithPayload(payload *models.Transaction) *CommitTransactionAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction accepted response -func (o *CommitTransactionAccepted) SetPayload(payload *models.Transaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitTransactionBadRequestCode is the HTTP code returned for type CommitTransactionBadRequest -const CommitTransactionBadRequestCode int = 400 - -/* -CommitTransactionBadRequest Bad request - -swagger:response commitTransactionBadRequest -*/ -type CommitTransactionBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitTransactionBadRequest creates CommitTransactionBadRequest with default headers values -func NewCommitTransactionBadRequest() *CommitTransactionBadRequest { - - return &CommitTransactionBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction bad request response -func (o *CommitTransactionBadRequest) WithConfigurationVersion(configurationVersion string) *CommitTransactionBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction bad request response -func (o *CommitTransactionBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit transaction bad request response -func (o *CommitTransactionBadRequest) WithPayload(payload *models.Error) *CommitTransactionBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction bad request response -func (o *CommitTransactionBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitTransactionNotFoundCode is the HTTP code returned for type CommitTransactionNotFound -const CommitTransactionNotFoundCode int = 404 - -/* -CommitTransactionNotFound The specified resource was not found - -swagger:response commitTransactionNotFound -*/ -type CommitTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitTransactionNotFound creates CommitTransactionNotFound with default headers values -func NewCommitTransactionNotFound() *CommitTransactionNotFound { - - return &CommitTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction not found response -func (o *CommitTransactionNotFound) WithConfigurationVersion(configurationVersion string) *CommitTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction not found response -func (o *CommitTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit transaction not found response -func (o *CommitTransactionNotFound) WithPayload(payload *models.Error) *CommitTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction not found response -func (o *CommitTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CommitTransactionNotAcceptableCode is the HTTP code returned for type CommitTransactionNotAcceptable -const CommitTransactionNotAcceptableCode int = 406 - -/* -CommitTransactionNotAcceptable The specified resource cannot be handled - -swagger:response commitTransactionNotAcceptable -*/ -type CommitTransactionNotAcceptable struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitTransactionNotAcceptable creates CommitTransactionNotAcceptable with default headers values -func NewCommitTransactionNotAcceptable() *CommitTransactionNotAcceptable { - - return &CommitTransactionNotAcceptable{} -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction not acceptable response -func (o *CommitTransactionNotAcceptable) WithConfigurationVersion(configurationVersion string) *CommitTransactionNotAcceptable { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction not acceptable response -func (o *CommitTransactionNotAcceptable) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit transaction not acceptable response -func (o *CommitTransactionNotAcceptable) WithPayload(payload *models.Error) *CommitTransactionNotAcceptable { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction not acceptable response -func (o *CommitTransactionNotAcceptable) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionNotAcceptable) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(406) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CommitTransactionDefault General Error - -swagger:response commitTransactionDefault -*/ -type CommitTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCommitTransactionDefault creates CommitTransactionDefault with default headers values -func NewCommitTransactionDefault(code int) *CommitTransactionDefault { - if code <= 0 { - code = 500 - } - - return &CommitTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the commit transaction default response -func (o *CommitTransactionDefault) WithStatusCode(code int) *CommitTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the commit transaction default response -func (o *CommitTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the commit transaction default response -func (o *CommitTransactionDefault) WithConfigurationVersion(configurationVersion string) *CommitTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the commit transaction default response -func (o *CommitTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the commit transaction default response -func (o *CommitTransactionDefault) WithPayload(payload *models.Error) *CommitTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the commit transaction default response -func (o *CommitTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CommitTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/transactions/commit_transaction_urlbuilder.go b/operations/transactions/commit_transaction_urlbuilder.go deleted file mode 100644 index a7fa52f0..00000000 --- a/operations/transactions/commit_transaction_urlbuilder.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// CommitTransactionURL generates an URL for the commit transaction operation -type CommitTransactionURL struct { - ID string - - ForceReload *bool - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CommitTransactionURL) WithBasePath(bp string) *CommitTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CommitTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CommitTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on CommitTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CommitTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CommitTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CommitTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CommitTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CommitTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CommitTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/transactions/delete_transaction.go b/operations/transactions/delete_transaction.go deleted file mode 100644 index 0eca2f9f..00000000 --- a/operations/transactions/delete_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteTransactionHandlerFunc turns a function with the right signature into a delete transaction handler -type DeleteTransactionHandlerFunc func(DeleteTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteTransactionHandlerFunc) Handle(params DeleteTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteTransactionHandler interface for that can handle valid delete transaction params -type DeleteTransactionHandler interface { - Handle(DeleteTransactionParams, interface{}) middleware.Responder -} - -// NewDeleteTransaction creates a new http.Handler for the delete transaction operation -func NewDeleteTransaction(ctx *middleware.Context, handler DeleteTransactionHandler) *DeleteTransaction { - return &DeleteTransaction{Context: ctx, Handler: handler} -} - -/* - DeleteTransaction swagger:route DELETE /services/haproxy/transactions/{id} Transactions deleteTransaction - -# Delete a transaction - -Deletes a transaction. -*/ -type DeleteTransaction struct { - Context *middleware.Context - Handler DeleteTransactionHandler -} - -func (o *DeleteTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/transactions/delete_transaction_parameters.go b/operations/transactions/delete_transaction_parameters.go deleted file mode 100644 index a88477c5..00000000 --- a/operations/transactions/delete_transaction_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewDeleteTransactionParams creates a new DeleteTransactionParams object -// -// There are no default values defined in the spec. -func NewDeleteTransactionParams() DeleteTransactionParams { - - return DeleteTransactionParams{} -} - -// DeleteTransactionParams contains all the bound params for the delete transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteTransaction -type DeleteTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Transaction id - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteTransactionParams() beforehand. -func (o *DeleteTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *DeleteTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/transactions/delete_transaction_responses.go b/operations/transactions/delete_transaction_responses.go deleted file mode 100644 index 21841b71..00000000 --- a/operations/transactions/delete_transaction_responses.go +++ /dev/null @@ -1,202 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteTransactionNoContentCode is the HTTP code returned for type DeleteTransactionNoContent -const DeleteTransactionNoContentCode int = 204 - -/* -DeleteTransactionNoContent Transaction deleted - -swagger:response deleteTransactionNoContent -*/ -type DeleteTransactionNoContent struct { -} - -// NewDeleteTransactionNoContent creates DeleteTransactionNoContent with default headers values -func NewDeleteTransactionNoContent() *DeleteTransactionNoContent { - - return &DeleteTransactionNoContent{} -} - -// WriteResponse to the client -func (o *DeleteTransactionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteTransactionNotFoundCode is the HTTP code returned for type DeleteTransactionNotFound -const DeleteTransactionNotFoundCode int = 404 - -/* -DeleteTransactionNotFound The specified resource was not found - -swagger:response deleteTransactionNotFound -*/ -type DeleteTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTransactionNotFound creates DeleteTransactionNotFound with default headers values -func NewDeleteTransactionNotFound() *DeleteTransactionNotFound { - - return &DeleteTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete transaction not found response -func (o *DeleteTransactionNotFound) WithConfigurationVersion(configurationVersion string) *DeleteTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete transaction not found response -func (o *DeleteTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete transaction not found response -func (o *DeleteTransactionNotFound) WithPayload(payload *models.Error) *DeleteTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete transaction not found response -func (o *DeleteTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteTransactionDefault General Error - -swagger:response deleteTransactionDefault -*/ -type DeleteTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteTransactionDefault creates DeleteTransactionDefault with default headers values -func NewDeleteTransactionDefault(code int) *DeleteTransactionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete transaction default response -func (o *DeleteTransactionDefault) WithStatusCode(code int) *DeleteTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete transaction default response -func (o *DeleteTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete transaction default response -func (o *DeleteTransactionDefault) WithConfigurationVersion(configurationVersion string) *DeleteTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete transaction default response -func (o *DeleteTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete transaction default response -func (o *DeleteTransactionDefault) WithPayload(payload *models.Error) *DeleteTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete transaction default response -func (o *DeleteTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/transactions/delete_transaction_urlbuilder.go b/operations/transactions/delete_transaction_urlbuilder.go deleted file mode 100644 index 54e156ec..00000000 --- a/operations/transactions/delete_transaction_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// DeleteTransactionURL generates an URL for the delete transaction operation -type DeleteTransactionURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTransactionURL) WithBasePath(bp string) *DeleteTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on DeleteTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/transactions/get_transaction.go b/operations/transactions/get_transaction.go deleted file mode 100644 index 4a8158d2..00000000 --- a/operations/transactions/get_transaction.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTransactionHandlerFunc turns a function with the right signature into a get transaction handler -type GetTransactionHandlerFunc func(GetTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTransactionHandlerFunc) Handle(params GetTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTransactionHandler interface for that can handle valid get transaction params -type GetTransactionHandler interface { - Handle(GetTransactionParams, interface{}) middleware.Responder -} - -// NewGetTransaction creates a new http.Handler for the get transaction operation -func NewGetTransaction(ctx *middleware.Context, handler GetTransactionHandler) *GetTransaction { - return &GetTransaction{Context: ctx, Handler: handler} -} - -/* - GetTransaction swagger:route GET /services/haproxy/transactions/{id} Transactions getTransaction - -# Return one HAProxy configuration transactions - -Returns one HAProxy configuration transactions. -*/ -type GetTransaction struct { - Context *middleware.Context - Handler GetTransactionHandler -} - -func (o *GetTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/transactions/get_transaction_parameters.go b/operations/transactions/get_transaction_parameters.go deleted file mode 100644 index 6f54d693..00000000 --- a/operations/transactions/get_transaction_parameters.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" -) - -// NewGetTransactionParams creates a new GetTransactionParams object -// -// There are no default values defined in the spec. -func NewGetTransactionParams() GetTransactionParams { - - return GetTransactionParams{} -} - -// GetTransactionParams contains all the bound params for the get transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTransaction -type GetTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Transaction id - Required: true - In: path - */ - ID string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTransactionParams() beforehand. -func (o *GetTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rID, rhkID, _ := route.Params.GetOK("id") - if err := o.bindID(rID, rhkID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindID binds and validates parameter ID from path. -func (o *GetTransactionParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.ID = raw - - return nil -} diff --git a/operations/transactions/get_transaction_responses.go b/operations/transactions/get_transaction_responses.go deleted file mode 100644 index bdadf191..00000000 --- a/operations/transactions/get_transaction_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTransactionOKCode is the HTTP code returned for type GetTransactionOK -const GetTransactionOKCode int = 200 - -/* -GetTransactionOK Successful operation - -swagger:response getTransactionOK -*/ -type GetTransactionOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Transaction `json:"body,omitempty"` -} - -// NewGetTransactionOK creates GetTransactionOK with default headers values -func NewGetTransactionOK() *GetTransactionOK { - - return &GetTransactionOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get transaction o k response -func (o *GetTransactionOK) WithConfigurationVersion(configurationVersion string) *GetTransactionOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get transaction o k response -func (o *GetTransactionOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get transaction o k response -func (o *GetTransactionOK) WithPayload(payload *models.Transaction) *GetTransactionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get transaction o k response -func (o *GetTransactionOK) SetPayload(payload *models.Transaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTransactionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetTransactionNotFoundCode is the HTTP code returned for type GetTransactionNotFound -const GetTransactionNotFoundCode int = 404 - -/* -GetTransactionNotFound The specified resource was not found - -swagger:response getTransactionNotFound -*/ -type GetTransactionNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTransactionNotFound creates GetTransactionNotFound with default headers values -func NewGetTransactionNotFound() *GetTransactionNotFound { - - return &GetTransactionNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get transaction not found response -func (o *GetTransactionNotFound) WithConfigurationVersion(configurationVersion string) *GetTransactionNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get transaction not found response -func (o *GetTransactionNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get transaction not found response -func (o *GetTransactionNotFound) WithPayload(payload *models.Error) *GetTransactionNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get transaction not found response -func (o *GetTransactionNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTransactionNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetTransactionDefault General Error - -swagger:response getTransactionDefault -*/ -type GetTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTransactionDefault creates GetTransactionDefault with default headers values -func NewGetTransactionDefault(code int) *GetTransactionDefault { - if code <= 0 { - code = 500 - } - - return &GetTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get transaction default response -func (o *GetTransactionDefault) WithStatusCode(code int) *GetTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get transaction default response -func (o *GetTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get transaction default response -func (o *GetTransactionDefault) WithConfigurationVersion(configurationVersion string) *GetTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get transaction default response -func (o *GetTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get transaction default response -func (o *GetTransactionDefault) WithPayload(payload *models.Error) *GetTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get transaction default response -func (o *GetTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/transactions/get_transaction_urlbuilder.go b/operations/transactions/get_transaction_urlbuilder.go deleted file mode 100644 index f58256a2..00000000 --- a/operations/transactions/get_transaction_urlbuilder.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetTransactionURL generates an URL for the get transaction operation -type GetTransactionURL struct { - ID string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTransactionURL) WithBasePath(bp string) *GetTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/transactions/{id}" - - id := o.ID - if id != "" { - _path = strings.Replace(_path, "{id}", id, -1) - } else { - return nil, errors.New("id is required on GetTransactionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/transactions/get_transactions.go b/operations/transactions/get_transactions.go deleted file mode 100644 index 2a15d89d..00000000 --- a/operations/transactions/get_transactions.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetTransactionsHandlerFunc turns a function with the right signature into a get transactions handler -type GetTransactionsHandlerFunc func(GetTransactionsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTransactionsHandlerFunc) Handle(params GetTransactionsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetTransactionsHandler interface for that can handle valid get transactions params -type GetTransactionsHandler interface { - Handle(GetTransactionsParams, interface{}) middleware.Responder -} - -// NewGetTransactions creates a new http.Handler for the get transactions operation -func NewGetTransactions(ctx *middleware.Context, handler GetTransactionsHandler) *GetTransactions { - return &GetTransactions{Context: ctx, Handler: handler} -} - -/* - GetTransactions swagger:route GET /services/haproxy/transactions Transactions getTransactions - -Return list of HAProxy configuration transactions. - -Returns a list of HAProxy configuration transactions. Transactions can be filtered by their status. -*/ -type GetTransactions struct { - Context *middleware.Context - Handler GetTransactionsHandler -} - -func (o *GetTransactions) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTransactionsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/transactions/get_transactions_parameters.go b/operations/transactions/get_transactions_parameters.go deleted file mode 100644 index 7843dd56..00000000 --- a/operations/transactions/get_transactions_parameters.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetTransactionsParams creates a new GetTransactionsParams object -// -// There are no default values defined in the spec. -func NewGetTransactionsParams() GetTransactionsParams { - - return GetTransactionsParams{} -} - -// GetTransactionsParams contains all the bound params for the get transactions operation -// typically these are obtained from a http.Request -// -// swagger:parameters getTransactions -type GetTransactionsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Filter by transaction status - In: query - */ - Status *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetTransactionsParams() beforehand. -func (o *GetTransactionsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qStatus, qhkStatus, _ := qs.GetOK("status") - if err := o.bindStatus(qStatus, qhkStatus, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindStatus binds and validates parameter Status from query. -func (o *GetTransactionsParams) bindStatus(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.Status = &raw - - if err := o.validateStatus(formats); err != nil { - return err - } - - return nil -} - -// validateStatus carries on validations for parameter Status -func (o *GetTransactionsParams) validateStatus(formats strfmt.Registry) error { - - if err := validate.EnumCase("status", "query", *o.Status, []interface{}{"failed", "in_progress"}, true); err != nil { - return err - } - - return nil -} diff --git a/operations/transactions/get_transactions_responses.go b/operations/transactions/get_transactions_responses.go deleted file mode 100644 index 57f083e4..00000000 --- a/operations/transactions/get_transactions_responses.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetTransactionsOKCode is the HTTP code returned for type GetTransactionsOK -const GetTransactionsOKCode int = 200 - -/* -GetTransactionsOK Success - -swagger:response getTransactionsOK -*/ -type GetTransactionsOK struct { - - /* - In: Body - */ - Payload models.Transactions `json:"body,omitempty"` -} - -// NewGetTransactionsOK creates GetTransactionsOK with default headers values -func NewGetTransactionsOK() *GetTransactionsOK { - - return &GetTransactionsOK{} -} - -// WithPayload adds the payload to the get transactions o k response -func (o *GetTransactionsOK) WithPayload(payload models.Transactions) *GetTransactionsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get transactions o k response -func (o *GetTransactionsOK) SetPayload(payload models.Transactions) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTransactionsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Transactions{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetTransactionsDefault General Error - -swagger:response getTransactionsDefault -*/ -type GetTransactionsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetTransactionsDefault creates GetTransactionsDefault with default headers values -func NewGetTransactionsDefault(code int) *GetTransactionsDefault { - if code <= 0 { - code = 500 - } - - return &GetTransactionsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get transactions default response -func (o *GetTransactionsDefault) WithStatusCode(code int) *GetTransactionsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get transactions default response -func (o *GetTransactionsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get transactions default response -func (o *GetTransactionsDefault) WithConfigurationVersion(configurationVersion string) *GetTransactionsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get transactions default response -func (o *GetTransactionsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get transactions default response -func (o *GetTransactionsDefault) WithPayload(payload *models.Error) *GetTransactionsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get transactions default response -func (o *GetTransactionsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTransactionsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/transactions/get_transactions_urlbuilder.go b/operations/transactions/get_transactions_urlbuilder.go deleted file mode 100644 index fea02a57..00000000 --- a/operations/transactions/get_transactions_urlbuilder.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetTransactionsURL generates an URL for the get transactions operation -type GetTransactionsURL struct { - Status *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTransactionsURL) WithBasePath(bp string) *GetTransactionsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetTransactionsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTransactionsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/transactions" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var statusQ string - if o.Status != nil { - statusQ = *o.Status - } - if statusQ != "" { - qs.Set("status", statusQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetTransactionsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetTransactionsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTransactionsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTransactionsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTransactionsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetTransactionsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/transactions/start_transaction.go b/operations/transactions/start_transaction.go deleted file mode 100644 index e9192fa5..00000000 --- a/operations/transactions/start_transaction.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "context" - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// StartTransactionHandlerFunc turns a function with the right signature into a start transaction handler -type StartTransactionHandlerFunc func(StartTransactionParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn StartTransactionHandlerFunc) Handle(params StartTransactionParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// StartTransactionHandler interface for that can handle valid start transaction params -type StartTransactionHandler interface { - Handle(StartTransactionParams, interface{}) middleware.Responder -} - -// NewStartTransaction creates a new http.Handler for the start transaction operation -func NewStartTransaction(ctx *middleware.Context, handler StartTransactionHandler) *StartTransaction { - return &StartTransaction{Context: ctx, Handler: handler} -} - -/* - StartTransaction swagger:route POST /services/haproxy/transactions Transactions startTransaction - -# Start a new transaction - -Starts a new transaction and returns it's id -*/ -type StartTransaction struct { - Context *middleware.Context - Handler StartTransactionHandler -} - -func (o *StartTransaction) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewStartTransactionParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} - -// StartTransactionTooManyRequestsBody start transaction too many requests body -// Example: {"code":429,"message":"cannot start a new transaction, reached the maximum amount of 20 active transactions available"} -// -// swagger:model StartTransactionTooManyRequestsBody -type StartTransactionTooManyRequestsBody struct { - - // code - Code int64 `json:"code,omitempty"` - - // message - Message string `json:"message,omitempty"` -} - -// Validate validates this start transaction too many requests body -func (o *StartTransactionTooManyRequestsBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this start transaction too many requests body based on context it is used -func (o *StartTransactionTooManyRequestsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *StartTransactionTooManyRequestsBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *StartTransactionTooManyRequestsBody) UnmarshalBinary(b []byte) error { - var res StartTransactionTooManyRequestsBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/operations/transactions/start_transaction_parameters.go b/operations/transactions/start_transaction_parameters.go deleted file mode 100644 index d3999c24..00000000 --- a/operations/transactions/start_transaction_parameters.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewStartTransactionParams creates a new StartTransactionParams object -// -// There are no default values defined in the spec. -func NewStartTransactionParams() StartTransactionParams { - - return StartTransactionParams{} -} - -// StartTransactionParams contains all the bound params for the start transaction operation -// typically these are obtained from a http.Request -// -// swagger:parameters startTransaction -type StartTransactionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Configuration version on which to work on - Required: true - In: query - */ - Version int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewStartTransactionParams() beforehand. -func (o *StartTransactionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *StartTransactionParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("version", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("version", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = value - - return nil -} diff --git a/operations/transactions/start_transaction_responses.go b/operations/transactions/start_transaction_responses.go deleted file mode 100644 index 03385c7e..00000000 --- a/operations/transactions/start_transaction_responses.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// StartTransactionCreatedCode is the HTTP code returned for type StartTransactionCreated -const StartTransactionCreatedCode int = 201 - -/* -StartTransactionCreated Transaction started - -swagger:response startTransactionCreated -*/ -type StartTransactionCreated struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Transaction `json:"body,omitempty"` -} - -// NewStartTransactionCreated creates StartTransactionCreated with default headers values -func NewStartTransactionCreated() *StartTransactionCreated { - - return &StartTransactionCreated{} -} - -// WithConfigurationVersion adds the configurationVersion to the start transaction created response -func (o *StartTransactionCreated) WithConfigurationVersion(configurationVersion string) *StartTransactionCreated { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the start transaction created response -func (o *StartTransactionCreated) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the start transaction created response -func (o *StartTransactionCreated) WithPayload(payload *models.Transaction) *StartTransactionCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start transaction created response -func (o *StartTransactionCreated) SetPayload(payload *models.Transaction) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartTransactionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// StartTransactionTooManyRequestsCode is the HTTP code returned for type StartTransactionTooManyRequests -const StartTransactionTooManyRequestsCode int = 429 - -/* -StartTransactionTooManyRequests Too many open transactions - -swagger:response startTransactionTooManyRequests -*/ -type StartTransactionTooManyRequests struct { - - /* - In: Body - */ - Payload *StartTransactionTooManyRequestsBody `json:"body,omitempty"` -} - -// NewStartTransactionTooManyRequests creates StartTransactionTooManyRequests with default headers values -func NewStartTransactionTooManyRequests() *StartTransactionTooManyRequests { - - return &StartTransactionTooManyRequests{} -} - -// WithPayload adds the payload to the start transaction too many requests response -func (o *StartTransactionTooManyRequests) WithPayload(payload *StartTransactionTooManyRequestsBody) *StartTransactionTooManyRequests { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start transaction too many requests response -func (o *StartTransactionTooManyRequests) SetPayload(payload *StartTransactionTooManyRequestsBody) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartTransactionTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(429) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -StartTransactionDefault General Error - -swagger:response startTransactionDefault -*/ -type StartTransactionDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewStartTransactionDefault creates StartTransactionDefault with default headers values -func NewStartTransactionDefault(code int) *StartTransactionDefault { - if code <= 0 { - code = 500 - } - - return &StartTransactionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the start transaction default response -func (o *StartTransactionDefault) WithStatusCode(code int) *StartTransactionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the start transaction default response -func (o *StartTransactionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the start transaction default response -func (o *StartTransactionDefault) WithConfigurationVersion(configurationVersion string) *StartTransactionDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the start transaction default response -func (o *StartTransactionDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the start transaction default response -func (o *StartTransactionDefault) WithPayload(payload *models.Error) *StartTransactionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the start transaction default response -func (o *StartTransactionDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *StartTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/transactions/start_transaction_urlbuilder.go b/operations/transactions/start_transaction_urlbuilder.go deleted file mode 100644 index db15c199..00000000 --- a/operations/transactions/start_transaction_urlbuilder.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package transactions - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// StartTransactionURL generates an URL for the start transaction operation -type StartTransactionURL struct { - Version int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *StartTransactionURL) WithBasePath(bp string) *StartTransactionURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *StartTransactionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *StartTransactionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/transactions" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - versionQ := swag.FormatInt64(o.Version) - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *StartTransactionURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *StartTransactionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *StartTransactionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on StartTransactionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on StartTransactionURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *StartTransactionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/user/create_user.go b/operations/user/create_user.go deleted file mode 100644 index 09f71d2b..00000000 --- a/operations/user/create_user.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateUserHandlerFunc turns a function with the right signature into a create user handler -type CreateUserHandlerFunc func(CreateUserParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateUserHandlerFunc) Handle(params CreateUserParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateUserHandler interface for that can handle valid create user params -type CreateUserHandler interface { - Handle(CreateUserParams, interface{}) middleware.Responder -} - -// NewCreateUser creates a new http.Handler for the create user operation -func NewCreateUser(ctx *middleware.Context, handler CreateUserHandler) *CreateUser { - return &CreateUser{Context: ctx, Handler: handler} -} - -/* - CreateUser swagger:route POST /services/haproxy/configuration/users User createUser - -Add a new userlist user -*/ -type CreateUser struct { - Context *middleware.Context - Handler CreateUserHandler -} - -func (o *CreateUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/user/create_user_parameters.go b/operations/user/create_user_parameters.go deleted file mode 100644 index 60ca7454..00000000 --- a/operations/user/create_user_parameters.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateUserParams creates a new CreateUserParams object -// with the default values initialized. -func NewCreateUserParams() CreateUserParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return CreateUserParams{ - ForceReload: &forceReloadDefault, - } -} - -// CreateUserParams contains all the bound params for the create user operation -// typically these are obtained from a http.Request -// -// swagger:parameters createUser -type CreateUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.User - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateUserParams() beforehand. -func (o *CreateUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.User - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateUserParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateUserParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateUserParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *CreateUserParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateUserParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/user/create_user_responses.go b/operations/user/create_user_responses.go deleted file mode 100644 index 24099a04..00000000 --- a/operations/user/create_user_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateUserCreatedCode is the HTTP code returned for type CreateUserCreated -const CreateUserCreatedCode int = 201 - -/* -CreateUserCreated User created - -swagger:response createUserCreated -*/ -type CreateUserCreated struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewCreateUserCreated creates CreateUserCreated with default headers values -func NewCreateUserCreated() *CreateUserCreated { - - return &CreateUserCreated{} -} - -// WithPayload adds the payload to the create user created response -func (o *CreateUserCreated) WithPayload(payload *models.User) *CreateUserCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create user created response -func (o *CreateUserCreated) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserAcceptedCode is the HTTP code returned for type CreateUserAccepted -const CreateUserAcceptedCode int = 202 - -/* -CreateUserAccepted Configuration change accepted and reload requested - -swagger:response createUserAccepted -*/ -type CreateUserAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewCreateUserAccepted creates CreateUserAccepted with default headers values -func NewCreateUserAccepted() *CreateUserAccepted { - - return &CreateUserAccepted{} -} - -// WithReloadID adds the reloadId to the create user accepted response -func (o *CreateUserAccepted) WithReloadID(reloadID string) *CreateUserAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create user accepted response -func (o *CreateUserAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create user accepted response -func (o *CreateUserAccepted) WithPayload(payload *models.User) *CreateUserAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create user accepted response -func (o *CreateUserAccepted) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserBadRequestCode is the HTTP code returned for type CreateUserBadRequest -const CreateUserBadRequestCode int = 400 - -/* -CreateUserBadRequest Bad request - -swagger:response createUserBadRequest -*/ -type CreateUserBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserBadRequest creates CreateUserBadRequest with default headers values -func NewCreateUserBadRequest() *CreateUserBadRequest { - - return &CreateUserBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create user bad request response -func (o *CreateUserBadRequest) WithConfigurationVersion(configurationVersion string) *CreateUserBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create user bad request response -func (o *CreateUserBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create user bad request response -func (o *CreateUserBadRequest) WithPayload(payload *models.Error) *CreateUserBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create user bad request response -func (o *CreateUserBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserConflictCode is the HTTP code returned for type CreateUserConflict -const CreateUserConflictCode int = 409 - -/* -CreateUserConflict The specified resource already exists - -swagger:response createUserConflict -*/ -type CreateUserConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserConflict creates CreateUserConflict with default headers values -func NewCreateUserConflict() *CreateUserConflict { - - return &CreateUserConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create user conflict response -func (o *CreateUserConflict) WithConfigurationVersion(configurationVersion string) *CreateUserConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create user conflict response -func (o *CreateUserConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create user conflict response -func (o *CreateUserConflict) WithPayload(payload *models.Error) *CreateUserConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create user conflict response -func (o *CreateUserConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateUserDefault General Error - -swagger:response createUserDefault -*/ -type CreateUserDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserDefault creates CreateUserDefault with default headers values -func NewCreateUserDefault(code int) *CreateUserDefault { - if code <= 0 { - code = 500 - } - - return &CreateUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create user default response -func (o *CreateUserDefault) WithStatusCode(code int) *CreateUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create user default response -func (o *CreateUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create user default response -func (o *CreateUserDefault) WithConfigurationVersion(configurationVersion string) *CreateUserDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create user default response -func (o *CreateUserDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create user default response -func (o *CreateUserDefault) WithPayload(payload *models.Error) *CreateUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create user default response -func (o *CreateUserDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/user/create_user_urlbuilder.go b/operations/user/create_user_urlbuilder.go deleted file mode 100644 index a1f26257..00000000 --- a/operations/user/create_user_urlbuilder.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateUserURL generates an URL for the create user operation -type CreateUserURL struct { - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateUserURL) WithBasePath(bp string) *CreateUserURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/users" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateUserURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateUserURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/user/delete_user.go b/operations/user/delete_user.go deleted file mode 100644 index 76d26210..00000000 --- a/operations/user/delete_user.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteUserHandlerFunc turns a function with the right signature into a delete user handler -type DeleteUserHandlerFunc func(DeleteUserParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteUserHandlerFunc) Handle(params DeleteUserParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteUserHandler interface for that can handle valid delete user params -type DeleteUserHandler interface { - Handle(DeleteUserParams, interface{}) middleware.Responder -} - -// NewDeleteUser creates a new http.Handler for the delete user operation -func NewDeleteUser(ctx *middleware.Context, handler DeleteUserHandler) *DeleteUser { - return &DeleteUser{Context: ctx, Handler: handler} -} - -/* - DeleteUser swagger:route DELETE /services/haproxy/configuration/users/{username} User deleteUser - -Delete a user -*/ -type DeleteUser struct { - Context *middleware.Context - Handler DeleteUserHandler -} - -func (o *DeleteUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/user/delete_user_parameters.go b/operations/user/delete_user_parameters.go deleted file mode 100644 index e26f693d..00000000 --- a/operations/user/delete_user_parameters.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewDeleteUserParams creates a new DeleteUserParams object -// with the default values initialized. -func NewDeleteUserParams() DeleteUserParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteUserParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteUserParams contains all the bound params for the delete user operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteUser -type DeleteUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*User username - Required: true - In: path - */ - Username string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteUserParams() beforehand. -func (o *DeleteUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - rUsername, rhkUsername, _ := route.Params.GetOK("username") - if err := o.bindUsername(rUsername, rhkUsername, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteUserParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteUserParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteUserParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *DeleteUserParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindUsername binds and validates parameter Username from path. -func (o *DeleteUserParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Username = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteUserParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/user/delete_user_responses.go b/operations/user/delete_user_responses.go deleted file mode 100644 index d4268586..00000000 --- a/operations/user/delete_user_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteUserAcceptedCode is the HTTP code returned for type DeleteUserAccepted -const DeleteUserAcceptedCode int = 202 - -/* -DeleteUserAccepted Configuration change accepted and reload requested - -swagger:response deleteUserAccepted -*/ -type DeleteUserAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteUserAccepted creates DeleteUserAccepted with default headers values -func NewDeleteUserAccepted() *DeleteUserAccepted { - - return &DeleteUserAccepted{} -} - -// WithReloadID adds the reloadId to the delete user accepted response -func (o *DeleteUserAccepted) WithReloadID(reloadID string) *DeleteUserAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete user accepted response -func (o *DeleteUserAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteUserAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteUserNoContentCode is the HTTP code returned for type DeleteUserNoContent -const DeleteUserNoContentCode int = 204 - -/* -DeleteUserNoContent User deleted - -swagger:response deleteUserNoContent -*/ -type DeleteUserNoContent struct { -} - -// NewDeleteUserNoContent creates DeleteUserNoContent with default headers values -func NewDeleteUserNoContent() *DeleteUserNoContent { - - return &DeleteUserNoContent{} -} - -// WriteResponse to the client -func (o *DeleteUserNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteUserNotFoundCode is the HTTP code returned for type DeleteUserNotFound -const DeleteUserNotFoundCode int = 404 - -/* -DeleteUserNotFound The specified resource was not found - -swagger:response deleteUserNotFound -*/ -type DeleteUserNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteUserNotFound creates DeleteUserNotFound with default headers values -func NewDeleteUserNotFound() *DeleteUserNotFound { - - return &DeleteUserNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete user not found response -func (o *DeleteUserNotFound) WithConfigurationVersion(configurationVersion string) *DeleteUserNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete user not found response -func (o *DeleteUserNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete user not found response -func (o *DeleteUserNotFound) WithPayload(payload *models.Error) *DeleteUserNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete user not found response -func (o *DeleteUserNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteUserNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteUserDefault General Error - -swagger:response deleteUserDefault -*/ -type DeleteUserDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteUserDefault creates DeleteUserDefault with default headers values -func NewDeleteUserDefault(code int) *DeleteUserDefault { - if code <= 0 { - code = 500 - } - - return &DeleteUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete user default response -func (o *DeleteUserDefault) WithStatusCode(code int) *DeleteUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete user default response -func (o *DeleteUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete user default response -func (o *DeleteUserDefault) WithConfigurationVersion(configurationVersion string) *DeleteUserDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete user default response -func (o *DeleteUserDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete user default response -func (o *DeleteUserDefault) WithPayload(payload *models.Error) *DeleteUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete user default response -func (o *DeleteUserDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteUserDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/user/delete_user_urlbuilder.go b/operations/user/delete_user_urlbuilder.go deleted file mode 100644 index 7445935c..00000000 --- a/operations/user/delete_user_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteUserURL generates an URL for the delete user operation -type DeleteUserURL struct { - Username string - - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteUserURL) WithBasePath(bp string) *DeleteUserURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/users/{username}" - - username := o.Username - if username != "" { - _path = strings.Replace(_path, "{username}", username, -1) - } else { - return nil, errors.New("username is required on DeleteUserURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteUserURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteUserURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/user/get_user.go b/operations/user/get_user.go deleted file mode 100644 index fa0ea8f2..00000000 --- a/operations/user/get_user.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetUserHandlerFunc turns a function with the right signature into a get user handler -type GetUserHandlerFunc func(GetUserParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUserHandlerFunc) Handle(params GetUserParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetUserHandler interface for that can handle valid get user params -type GetUserHandler interface { - Handle(GetUserParams, interface{}) middleware.Responder -} - -// NewGetUser creates a new http.Handler for the get user operation -func NewGetUser(ctx *middleware.Context, handler GetUserHandler) *GetUser { - return &GetUser{Context: ctx, Handler: handler} -} - -/* - GetUser swagger:route GET /services/haproxy/configuration/users/{username} User getUser - -Return one userlist user -*/ -type GetUser struct { - Context *middleware.Context - Handler GetUserHandler -} - -func (o *GetUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/user/get_user_parameters.go b/operations/user/get_user_parameters.go deleted file mode 100644 index 126c02bf..00000000 --- a/operations/user/get_user_parameters.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetUserParams creates a new GetUserParams object -// -// There are no default values defined in the spec. -func NewGetUserParams() GetUserParams { - - return GetUserParams{} -} - -// GetUserParams contains all the bound params for the get user operation -// typically these are obtained from a http.Request -// -// swagger:parameters getUser -type GetUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*User username - Required: true - In: path - */ - Username string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetUserParams() beforehand. -func (o *GetUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - rUsername, rhkUsername, _ := route.Params.GetOK("username") - if err := o.bindUsername(rUsername, rhkUsername, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetUserParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *GetUserParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindUsername binds and validates parameter Username from path. -func (o *GetUserParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Username = raw - - return nil -} diff --git a/operations/user/get_user_responses.go b/operations/user/get_user_responses.go deleted file mode 100644 index 84f90439..00000000 --- a/operations/user/get_user_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetUserOKCode is the HTTP code returned for type GetUserOK -const GetUserOKCode int = 200 - -/* -GetUserOK Successful operation - -swagger:response getUserOK -*/ -type GetUserOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewGetUserOK creates GetUserOK with default headers values -func NewGetUserOK() *GetUserOK { - - return &GetUserOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get user o k response -func (o *GetUserOK) WithConfigurationVersion(configurationVersion string) *GetUserOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get user o k response -func (o *GetUserOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get user o k response -func (o *GetUserOK) WithPayload(payload *models.User) *GetUserOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user o k response -func (o *GetUserOK) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetUserNotFoundCode is the HTTP code returned for type GetUserNotFound -const GetUserNotFoundCode int = 404 - -/* -GetUserNotFound The specified resource already exists - -swagger:response getUserNotFound -*/ -type GetUserNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUserNotFound creates GetUserNotFound with default headers values -func NewGetUserNotFound() *GetUserNotFound { - - return &GetUserNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get user not found response -func (o *GetUserNotFound) WithConfigurationVersion(configurationVersion string) *GetUserNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get user not found response -func (o *GetUserNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get user not found response -func (o *GetUserNotFound) WithPayload(payload *models.Error) *GetUserNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user not found response -func (o *GetUserNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetUserDefault General Error - -swagger:response getUserDefault -*/ -type GetUserDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUserDefault creates GetUserDefault with default headers values -func NewGetUserDefault(code int) *GetUserDefault { - if code <= 0 { - code = 500 - } - - return &GetUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get user default response -func (o *GetUserDefault) WithStatusCode(code int) *GetUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get user default response -func (o *GetUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get user default response -func (o *GetUserDefault) WithConfigurationVersion(configurationVersion string) *GetUserDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get user default response -func (o *GetUserDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get user default response -func (o *GetUserDefault) WithPayload(payload *models.Error) *GetUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user default response -func (o *GetUserDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/user/get_user_urlbuilder.go b/operations/user/get_user_urlbuilder.go deleted file mode 100644 index e7692dbc..00000000 --- a/operations/user/get_user_urlbuilder.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" -) - -// GetUserURL generates an URL for the get user operation -type GetUserURL struct { - Username string - - TransactionID *string - Userlist string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserURL) WithBasePath(bp string) *GetUserURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/users/{username}" - - username := o.Username - if username != "" { - _path = strings.Replace(_path, "{username}", username, -1) - } else { - return nil, errors.New("username is required on GetUserURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetUserURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUserURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/user/get_users.go b/operations/user/get_users.go deleted file mode 100644 index 00deb265..00000000 --- a/operations/user/get_users.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetUsersHandlerFunc turns a function with the right signature into a get users handler -type GetUsersHandlerFunc func(GetUsersParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUsersHandlerFunc) Handle(params GetUsersParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetUsersHandler interface for that can handle valid get users params -type GetUsersHandler interface { - Handle(GetUsersParams, interface{}) middleware.Responder -} - -// NewGetUsers creates a new http.Handler for the get users operation -func NewGetUsers(ctx *middleware.Context, handler GetUsersHandler) *GetUsers { - return &GetUsers{Context: ctx, Handler: handler} -} - -/* - GetUsers swagger:route GET /services/haproxy/configuration/users User getUsers - -Return an array of userlist users -*/ -type GetUsers struct { - Context *middleware.Context - Handler GetUsersHandler -} - -func (o *GetUsers) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUsersParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/user/get_users_parameters.go b/operations/user/get_users_parameters.go deleted file mode 100644 index d7e2b7c8..00000000 --- a/operations/user/get_users_parameters.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewGetUsersParams creates a new GetUsersParams object -// -// There are no default values defined in the spec. -func NewGetUsersParams() GetUsersParams { - - return GetUsersParams{} -} - -// GetUsersParams contains all the bound params for the get users operation -// typically these are obtained from a http.Request -// -// swagger:parameters getUsers -type GetUsersParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetUsersParams() beforehand. -func (o *GetUsersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetUsersParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *GetUsersParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} diff --git a/operations/user/get_users_responses.go b/operations/user/get_users_responses.go deleted file mode 100644 index bbbf5aa6..00000000 --- a/operations/user/get_users_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetUsersOKCode is the HTTP code returned for type GetUsersOK -const GetUsersOKCode int = 200 - -/* -GetUsersOK Successful operation - -swagger:response getUsersOK -*/ -type GetUsersOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Users `json:"body,omitempty"` -} - -// NewGetUsersOK creates GetUsersOK with default headers values -func NewGetUsersOK() *GetUsersOK { - - return &GetUsersOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get users o k response -func (o *GetUsersOK) WithConfigurationVersion(configurationVersion string) *GetUsersOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get users o k response -func (o *GetUsersOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get users o k response -func (o *GetUsersOK) WithPayload(payload models.Users) *GetUsersOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get users o k response -func (o *GetUsersOK) SetPayload(payload models.Users) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUsersOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Users{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetUsersDefault General Error - -swagger:response getUsersDefault -*/ -type GetUsersDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUsersDefault creates GetUsersDefault with default headers values -func NewGetUsersDefault(code int) *GetUsersDefault { - if code <= 0 { - code = 500 - } - - return &GetUsersDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get users default response -func (o *GetUsersDefault) WithStatusCode(code int) *GetUsersDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get users default response -func (o *GetUsersDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get users default response -func (o *GetUsersDefault) WithConfigurationVersion(configurationVersion string) *GetUsersDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get users default response -func (o *GetUsersDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get users default response -func (o *GetUsersDefault) WithPayload(payload *models.Error) *GetUsersDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get users default response -func (o *GetUsersDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUsersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/user/get_users_urlbuilder.go b/operations/user/get_users_urlbuilder.go deleted file mode 100644 index 110439a6..00000000 --- a/operations/user/get_users_urlbuilder.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetUsersURL generates an URL for the get users operation -type GetUsersURL struct { - TransactionID *string - Userlist string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUsersURL) WithBasePath(bp string) *GetUsersURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUsersURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUsersURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/users" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetUsersURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetUsersURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUsersURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUsersURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUsersURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetUsersURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/user/replace_user.go b/operations/user/replace_user.go deleted file mode 100644 index 8eb70bf5..00000000 --- a/operations/user/replace_user.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ReplaceUserHandlerFunc turns a function with the right signature into a replace user handler -type ReplaceUserHandlerFunc func(ReplaceUserParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn ReplaceUserHandlerFunc) Handle(params ReplaceUserParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// ReplaceUserHandler interface for that can handle valid replace user params -type ReplaceUserHandler interface { - Handle(ReplaceUserParams, interface{}) middleware.Responder -} - -// NewReplaceUser creates a new http.Handler for the replace user operation -func NewReplaceUser(ctx *middleware.Context, handler ReplaceUserHandler) *ReplaceUser { - return &ReplaceUser{Context: ctx, Handler: handler} -} - -/* - ReplaceUser swagger:route PUT /services/haproxy/configuration/users/{username} User replaceUser - -Replace a user -*/ -type ReplaceUser struct { - Context *middleware.Context - Handler ReplaceUserHandler -} - -func (o *ReplaceUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewReplaceUserParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/user/replace_user_parameters.go b/operations/user/replace_user_parameters.go deleted file mode 100644 index a41ac731..00000000 --- a/operations/user/replace_user_parameters.go +++ /dev/null @@ -1,253 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewReplaceUserParams creates a new ReplaceUserParams object -// with the default values initialized. -func NewReplaceUserParams() ReplaceUserParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return ReplaceUserParams{ - ForceReload: &forceReloadDefault, - } -} - -// ReplaceUserParams contains all the bound params for the replace user operation -// typically these are obtained from a http.Request -// -// swagger:parameters replaceUser -type ReplaceUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.User - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Parent userlist name - Required: true - In: query - */ - Userlist string - /*User username - Required: true - In: path - */ - Username string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewReplaceUserParams() beforehand. -func (o *ReplaceUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.User - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qUserlist, qhkUserlist, _ := qs.GetOK("userlist") - if err := o.bindUserlist(qUserlist, qhkUserlist, route.Formats); err != nil { - res = append(res, err) - } - - rUsername, rhkUsername, _ := route.Params.GetOK("username") - if err := o.bindUsername(rUsername, rhkUsername, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *ReplaceUserParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewReplaceUserParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *ReplaceUserParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindUserlist binds and validates parameter Userlist from query. -func (o *ReplaceUserParams) bindUserlist(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("userlist", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("userlist", "query", raw); err != nil { - return err - } - o.Userlist = raw - - return nil -} - -// bindUsername binds and validates parameter Username from path. -func (o *ReplaceUserParams) bindUsername(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Username = raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *ReplaceUserParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/user/replace_user_responses.go b/operations/user/replace_user_responses.go deleted file mode 100644 index e3a55d6a..00000000 --- a/operations/user/replace_user_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// ReplaceUserOKCode is the HTTP code returned for type ReplaceUserOK -const ReplaceUserOKCode int = 200 - -/* -ReplaceUserOK User replaced - -swagger:response replaceUserOK -*/ -type ReplaceUserOK struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewReplaceUserOK creates ReplaceUserOK with default headers values -func NewReplaceUserOK() *ReplaceUserOK { - - return &ReplaceUserOK{} -} - -// WithPayload adds the payload to the replace user o k response -func (o *ReplaceUserOK) WithPayload(payload *models.User) *ReplaceUserOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace user o k response -func (o *ReplaceUserOK) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceUserAcceptedCode is the HTTP code returned for type ReplaceUserAccepted -const ReplaceUserAcceptedCode int = 202 - -/* -ReplaceUserAccepted Configuration change accepted and reload requested - -swagger:response replaceUserAccepted -*/ -type ReplaceUserAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewReplaceUserAccepted creates ReplaceUserAccepted with default headers values -func NewReplaceUserAccepted() *ReplaceUserAccepted { - - return &ReplaceUserAccepted{} -} - -// WithReloadID adds the reloadId to the replace user accepted response -func (o *ReplaceUserAccepted) WithReloadID(reloadID string) *ReplaceUserAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the replace user accepted response -func (o *ReplaceUserAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the replace user accepted response -func (o *ReplaceUserAccepted) WithPayload(payload *models.User) *ReplaceUserAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace user accepted response -func (o *ReplaceUserAccepted) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceUserAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceUserBadRequestCode is the HTTP code returned for type ReplaceUserBadRequest -const ReplaceUserBadRequestCode int = 400 - -/* -ReplaceUserBadRequest Bad request - -swagger:response replaceUserBadRequest -*/ -type ReplaceUserBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceUserBadRequest creates ReplaceUserBadRequest with default headers values -func NewReplaceUserBadRequest() *ReplaceUserBadRequest { - - return &ReplaceUserBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace user bad request response -func (o *ReplaceUserBadRequest) WithConfigurationVersion(configurationVersion string) *ReplaceUserBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace user bad request response -func (o *ReplaceUserBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace user bad request response -func (o *ReplaceUserBadRequest) WithPayload(payload *models.Error) *ReplaceUserBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace user bad request response -func (o *ReplaceUserBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ReplaceUserNotFoundCode is the HTTP code returned for type ReplaceUserNotFound -const ReplaceUserNotFoundCode int = 404 - -/* -ReplaceUserNotFound The specified resource was not found - -swagger:response replaceUserNotFound -*/ -type ReplaceUserNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceUserNotFound creates ReplaceUserNotFound with default headers values -func NewReplaceUserNotFound() *ReplaceUserNotFound { - - return &ReplaceUserNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the replace user not found response -func (o *ReplaceUserNotFound) WithConfigurationVersion(configurationVersion string) *ReplaceUserNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace user not found response -func (o *ReplaceUserNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace user not found response -func (o *ReplaceUserNotFound) WithPayload(payload *models.Error) *ReplaceUserNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace user not found response -func (o *ReplaceUserNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceUserNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -ReplaceUserDefault General Error - -swagger:response replaceUserDefault -*/ -type ReplaceUserDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewReplaceUserDefault creates ReplaceUserDefault with default headers values -func NewReplaceUserDefault(code int) *ReplaceUserDefault { - if code <= 0 { - code = 500 - } - - return &ReplaceUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the replace user default response -func (o *ReplaceUserDefault) WithStatusCode(code int) *ReplaceUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the replace user default response -func (o *ReplaceUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the replace user default response -func (o *ReplaceUserDefault) WithConfigurationVersion(configurationVersion string) *ReplaceUserDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the replace user default response -func (o *ReplaceUserDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the replace user default response -func (o *ReplaceUserDefault) WithPayload(payload *models.Error) *ReplaceUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the replace user default response -func (o *ReplaceUserDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ReplaceUserDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/user/replace_user_urlbuilder.go b/operations/user/replace_user_urlbuilder.go deleted file mode 100644 index 546b820a..00000000 --- a/operations/user/replace_user_urlbuilder.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package user - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// ReplaceUserURL generates an URL for the replace user operation -type ReplaceUserURL struct { - Username string - - ForceReload *bool - TransactionID *string - Userlist string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceUserURL) WithBasePath(bp string) *ReplaceUserURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ReplaceUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ReplaceUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/users/{username}" - - username := o.Username - if username != "" { - _path = strings.Replace(_path, "{username}", username, -1) - } else { - return nil, errors.New("username is required on ReplaceUserURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - userlistQ := o.Userlist - if userlistQ != "" { - qs.Set("userlist", userlistQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ReplaceUserURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ReplaceUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ReplaceUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ReplaceUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ReplaceUserURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ReplaceUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/userlist/create_userlist.go b/operations/userlist/create_userlist.go deleted file mode 100644 index 15126425..00000000 --- a/operations/userlist/create_userlist.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// CreateUserlistHandlerFunc turns a function with the right signature into a create userlist handler -type CreateUserlistHandlerFunc func(CreateUserlistParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateUserlistHandlerFunc) Handle(params CreateUserlistParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// CreateUserlistHandler interface for that can handle valid create userlist params -type CreateUserlistHandler interface { - Handle(CreateUserlistParams, interface{}) middleware.Responder -} - -// NewCreateUserlist creates a new http.Handler for the create userlist operation -func NewCreateUserlist(ctx *middleware.Context, handler CreateUserlistHandler) *CreateUserlist { - return &CreateUserlist{Context: ctx, Handler: handler} -} - -/* - CreateUserlist swagger:route POST /services/haproxy/configuration/userlists Userlist createUserlist - -# Add a new userlist - -Adds a new userlist to the configuration file. -*/ -type CreateUserlist struct { - Context *middleware.Context - Handler CreateUserlistHandler -} - -func (o *CreateUserlist) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateUserlistParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/userlist/create_userlist_parameters.go b/operations/userlist/create_userlist_parameters.go deleted file mode 100644 index 76842237..00000000 --- a/operations/userlist/create_userlist_parameters.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/haproxytech/client-native/v6/models" -) - -// NewCreateUserlistParams creates a new CreateUserlistParams object -// with the default values initialized. -func NewCreateUserlistParams() CreateUserlistParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - fullSectionDefault = bool(false) - ) - - return CreateUserlistParams{ - ForceReload: &forceReloadDefault, - - FullSection: &fullSectionDefault, - } -} - -// CreateUserlistParams contains all the bound params for the create userlist operation -// typically these are obtained from a http.Request -// -// swagger:parameters createUserlist -type CreateUserlistParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Data *models.Userlist - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewCreateUserlistParams() beforehand. -func (o *CreateUserlistParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.Userlist - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("data", "body", "")) - } else { - res = append(res, errors.NewParseError("data", "body", "", err)) - } - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Data = &body - } - } - } else { - res = append(res, errors.Required("data", "body", "")) - } - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *CreateUserlistParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateUserlistParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *CreateUserlistParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewCreateUserlistParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *CreateUserlistParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *CreateUserlistParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/userlist/create_userlist_responses.go b/operations/userlist/create_userlist_responses.go deleted file mode 100644 index a977a916..00000000 --- a/operations/userlist/create_userlist_responses.go +++ /dev/null @@ -1,356 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// CreateUserlistCreatedCode is the HTTP code returned for type CreateUserlistCreated -const CreateUserlistCreatedCode int = 201 - -/* -CreateUserlistCreated Userlist created - -swagger:response createUserlistCreated -*/ -type CreateUserlistCreated struct { - - /* - In: Body - */ - Payload *models.Userlist `json:"body,omitempty"` -} - -// NewCreateUserlistCreated creates CreateUserlistCreated with default headers values -func NewCreateUserlistCreated() *CreateUserlistCreated { - - return &CreateUserlistCreated{} -} - -// WithPayload adds the payload to the create userlist created response -func (o *CreateUserlistCreated) WithPayload(payload *models.Userlist) *CreateUserlistCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create userlist created response -func (o *CreateUserlistCreated) SetPayload(payload *models.Userlist) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserlistCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserlistAcceptedCode is the HTTP code returned for type CreateUserlistAccepted -const CreateUserlistAcceptedCode int = 202 - -/* -CreateUserlistAccepted Configuration change accepted and reload requested - -swagger:response createUserlistAccepted -*/ -type CreateUserlistAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` - - /* - In: Body - */ - Payload *models.Userlist `json:"body,omitempty"` -} - -// NewCreateUserlistAccepted creates CreateUserlistAccepted with default headers values -func NewCreateUserlistAccepted() *CreateUserlistAccepted { - - return &CreateUserlistAccepted{} -} - -// WithReloadID adds the reloadId to the create userlist accepted response -func (o *CreateUserlistAccepted) WithReloadID(reloadID string) *CreateUserlistAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the create userlist accepted response -func (o *CreateUserlistAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WithPayload adds the payload to the create userlist accepted response -func (o *CreateUserlistAccepted) WithPayload(payload *models.Userlist) *CreateUserlistAccepted { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create userlist accepted response -func (o *CreateUserlistAccepted) SetPayload(payload *models.Userlist) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserlistAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.WriteHeader(202) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserlistBadRequestCode is the HTTP code returned for type CreateUserlistBadRequest -const CreateUserlistBadRequestCode int = 400 - -/* -CreateUserlistBadRequest Bad request - -swagger:response createUserlistBadRequest -*/ -type CreateUserlistBadRequest struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserlistBadRequest creates CreateUserlistBadRequest with default headers values -func NewCreateUserlistBadRequest() *CreateUserlistBadRequest { - - return &CreateUserlistBadRequest{} -} - -// WithConfigurationVersion adds the configurationVersion to the create userlist bad request response -func (o *CreateUserlistBadRequest) WithConfigurationVersion(configurationVersion string) *CreateUserlistBadRequest { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create userlist bad request response -func (o *CreateUserlistBadRequest) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create userlist bad request response -func (o *CreateUserlistBadRequest) WithPayload(payload *models.Error) *CreateUserlistBadRequest { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create userlist bad request response -func (o *CreateUserlistBadRequest) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserlistBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(400) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// CreateUserlistConflictCode is the HTTP code returned for type CreateUserlistConflict -const CreateUserlistConflictCode int = 409 - -/* -CreateUserlistConflict The specified resource already exists - -swagger:response createUserlistConflict -*/ -type CreateUserlistConflict struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserlistConflict creates CreateUserlistConflict with default headers values -func NewCreateUserlistConflict() *CreateUserlistConflict { - - return &CreateUserlistConflict{} -} - -// WithConfigurationVersion adds the configurationVersion to the create userlist conflict response -func (o *CreateUserlistConflict) WithConfigurationVersion(configurationVersion string) *CreateUserlistConflict { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create userlist conflict response -func (o *CreateUserlistConflict) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create userlist conflict response -func (o *CreateUserlistConflict) WithPayload(payload *models.Error) *CreateUserlistConflict { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create userlist conflict response -func (o *CreateUserlistConflict) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserlistConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(409) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateUserlistDefault General Error - -swagger:response createUserlistDefault -*/ -type CreateUserlistDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewCreateUserlistDefault creates CreateUserlistDefault with default headers values -func NewCreateUserlistDefault(code int) *CreateUserlistDefault { - if code <= 0 { - code = 500 - } - - return &CreateUserlistDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create userlist default response -func (o *CreateUserlistDefault) WithStatusCode(code int) *CreateUserlistDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create userlist default response -func (o *CreateUserlistDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the create userlist default response -func (o *CreateUserlistDefault) WithConfigurationVersion(configurationVersion string) *CreateUserlistDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the create userlist default response -func (o *CreateUserlistDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the create userlist default response -func (o *CreateUserlistDefault) WithPayload(payload *models.Error) *CreateUserlistDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create userlist default response -func (o *CreateUserlistDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateUserlistDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/userlist/create_userlist_urlbuilder.go b/operations/userlist/create_userlist_urlbuilder.go deleted file mode 100644 index f3817054..00000000 --- a/operations/userlist/create_userlist_urlbuilder.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// CreateUserlistURL generates an URL for the create userlist operation -type CreateUserlistURL struct { - ForceReload *bool - FullSection *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateUserlistURL) WithBasePath(bp string) *CreateUserlistURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *CreateUserlistURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateUserlistURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/userlists" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *CreateUserlistURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *CreateUserlistURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateUserlistURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateUserlistURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateUserlistURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *CreateUserlistURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/userlist/delete_userlist.go b/operations/userlist/delete_userlist.go deleted file mode 100644 index 7c938328..00000000 --- a/operations/userlist/delete_userlist.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// DeleteUserlistHandlerFunc turns a function with the right signature into a delete userlist handler -type DeleteUserlistHandlerFunc func(DeleteUserlistParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteUserlistHandlerFunc) Handle(params DeleteUserlistParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// DeleteUserlistHandler interface for that can handle valid delete userlist params -type DeleteUserlistHandler interface { - Handle(DeleteUserlistParams, interface{}) middleware.Responder -} - -// NewDeleteUserlist creates a new http.Handler for the delete userlist operation -func NewDeleteUserlist(ctx *middleware.Context, handler DeleteUserlistHandler) *DeleteUserlist { - return &DeleteUserlist{Context: ctx, Handler: handler} -} - -/* - DeleteUserlist swagger:route DELETE /services/haproxy/configuration/userlists/{name} Userlist deleteUserlist - -# Delete a userlist - -Deletes a userlist configuration by it's name. -*/ -type DeleteUserlist struct { - Context *middleware.Context - Handler DeleteUserlistHandler -} - -func (o *DeleteUserlist) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteUserlistParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/userlist/delete_userlist_parameters.go b/operations/userlist/delete_userlist_parameters.go deleted file mode 100644 index 544b3040..00000000 --- a/operations/userlist/delete_userlist_parameters.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDeleteUserlistParams creates a new DeleteUserlistParams object -// with the default values initialized. -func NewDeleteUserlistParams() DeleteUserlistParams { - - var ( - // initialize parameters with default values - - forceReloadDefault = bool(false) - ) - - return DeleteUserlistParams{ - ForceReload: &forceReloadDefault, - } -} - -// DeleteUserlistParams contains all the bound params for the delete userlist operation -// typically these are obtained from a http.Request -// -// swagger:parameters deleteUserlist -type DeleteUserlistParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. - In: query - Default: false - */ - ForceReload *bool - /*Userlist name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string - /*Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. - In: query - */ - Version *int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewDeleteUserlistParams() beforehand. -func (o *DeleteUserlistParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qForceReload, qhkForceReload, _ := qs.GetOK("force_reload") - if err := o.bindForceReload(qForceReload, qhkForceReload, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - - qVersion, qhkVersion, _ := qs.GetOK("version") - if err := o.bindVersion(qVersion, qhkVersion, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindForceReload binds and validates parameter ForceReload from query. -func (o *DeleteUserlistParams) bindForceReload(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewDeleteUserlistParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("force_reload", "query", "bool", raw) - } - o.ForceReload = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *DeleteUserlistParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *DeleteUserlistParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} - -// bindVersion binds and validates parameter Version from query. -func (o *DeleteUserlistParams) bindVersion(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("version", "query", "int64", raw) - } - o.Version = &value - - return nil -} diff --git a/operations/userlist/delete_userlist_responses.go b/operations/userlist/delete_userlist_responses.go deleted file mode 100644 index 1bc0a5f3..00000000 --- a/operations/userlist/delete_userlist_responses.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// DeleteUserlistAcceptedCode is the HTTP code returned for type DeleteUserlistAccepted -const DeleteUserlistAcceptedCode int = 202 - -/* -DeleteUserlistAccepted Configuration change accepted and reload requested - -swagger:response deleteUserlistAccepted -*/ -type DeleteUserlistAccepted struct { - /*ID of the requested reload - - */ - ReloadID string `json:"Reload-ID"` -} - -// NewDeleteUserlistAccepted creates DeleteUserlistAccepted with default headers values -func NewDeleteUserlistAccepted() *DeleteUserlistAccepted { - - return &DeleteUserlistAccepted{} -} - -// WithReloadID adds the reloadId to the delete userlist accepted response -func (o *DeleteUserlistAccepted) WithReloadID(reloadID string) *DeleteUserlistAccepted { - o.ReloadID = reloadID - return o -} - -// SetReloadID sets the reloadId to the delete userlist accepted response -func (o *DeleteUserlistAccepted) SetReloadID(reloadID string) { - o.ReloadID = reloadID -} - -// WriteResponse to the client -func (o *DeleteUserlistAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Reload-ID - - reloadID := o.ReloadID - if reloadID != "" { - rw.Header().Set("Reload-ID", reloadID) - } - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(202) -} - -// DeleteUserlistNoContentCode is the HTTP code returned for type DeleteUserlistNoContent -const DeleteUserlistNoContentCode int = 204 - -/* -DeleteUserlistNoContent Userlist deleted - -swagger:response deleteUserlistNoContent -*/ -type DeleteUserlistNoContent struct { -} - -// NewDeleteUserlistNoContent creates DeleteUserlistNoContent with default headers values -func NewDeleteUserlistNoContent() *DeleteUserlistNoContent { - - return &DeleteUserlistNoContent{} -} - -// WriteResponse to the client -func (o *DeleteUserlistNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -// DeleteUserlistNotFoundCode is the HTTP code returned for type DeleteUserlistNotFound -const DeleteUserlistNotFoundCode int = 404 - -/* -DeleteUserlistNotFound The specified resource was not found - -swagger:response deleteUserlistNotFound -*/ -type DeleteUserlistNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteUserlistNotFound creates DeleteUserlistNotFound with default headers values -func NewDeleteUserlistNotFound() *DeleteUserlistNotFound { - - return &DeleteUserlistNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the delete userlist not found response -func (o *DeleteUserlistNotFound) WithConfigurationVersion(configurationVersion string) *DeleteUserlistNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete userlist not found response -func (o *DeleteUserlistNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete userlist not found response -func (o *DeleteUserlistNotFound) WithPayload(payload *models.Error) *DeleteUserlistNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete userlist not found response -func (o *DeleteUserlistNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteUserlistNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -DeleteUserlistDefault General Error - -swagger:response deleteUserlistDefault -*/ -type DeleteUserlistDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewDeleteUserlistDefault creates DeleteUserlistDefault with default headers values -func NewDeleteUserlistDefault(code int) *DeleteUserlistDefault { - if code <= 0 { - code = 500 - } - - return &DeleteUserlistDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete userlist default response -func (o *DeleteUserlistDefault) WithStatusCode(code int) *DeleteUserlistDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete userlist default response -func (o *DeleteUserlistDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the delete userlist default response -func (o *DeleteUserlistDefault) WithConfigurationVersion(configurationVersion string) *DeleteUserlistDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the delete userlist default response -func (o *DeleteUserlistDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the delete userlist default response -func (o *DeleteUserlistDefault) WithPayload(payload *models.Error) *DeleteUserlistDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete userlist default response -func (o *DeleteUserlistDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteUserlistDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/userlist/delete_userlist_urlbuilder.go b/operations/userlist/delete_userlist_urlbuilder.go deleted file mode 100644 index 712974da..00000000 --- a/operations/userlist/delete_userlist_urlbuilder.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// DeleteUserlistURL generates an URL for the delete userlist operation -type DeleteUserlistURL struct { - Name string - - ForceReload *bool - TransactionID *string - Version *int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteUserlistURL) WithBasePath(bp string) *DeleteUserlistURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *DeleteUserlistURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteUserlistURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/userlists/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteUserlistURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var forceReloadQ string - if o.ForceReload != nil { - forceReloadQ = swag.FormatBool(*o.ForceReload) - } - if forceReloadQ != "" { - qs.Set("force_reload", forceReloadQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - var versionQ string - if o.Version != nil { - versionQ = swag.FormatInt64(*o.Version) - } - if versionQ != "" { - qs.Set("version", versionQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteUserlistURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *DeleteUserlistURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteUserlistURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteUserlistURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteUserlistURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *DeleteUserlistURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/userlist/get_userlist.go b/operations/userlist/get_userlist.go deleted file mode 100644 index f8c67599..00000000 --- a/operations/userlist/get_userlist.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetUserlistHandlerFunc turns a function with the right signature into a get userlist handler -type GetUserlistHandlerFunc func(GetUserlistParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUserlistHandlerFunc) Handle(params GetUserlistParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetUserlistHandler interface for that can handle valid get userlist params -type GetUserlistHandler interface { - Handle(GetUserlistParams, interface{}) middleware.Responder -} - -// NewGetUserlist creates a new http.Handler for the get userlist operation -func NewGetUserlist(ctx *middleware.Context, handler GetUserlistHandler) *GetUserlist { - return &GetUserlist{Context: ctx, Handler: handler} -} - -/* - GetUserlist swagger:route GET /services/haproxy/configuration/userlists/{name} Userlist getUserlist - -# Return one userlist - -Returns one userlist configuration by it's name. -*/ -type GetUserlist struct { - Context *middleware.Context - Handler GetUserlistHandler -} - -func (o *GetUserlist) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUserlistParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/userlist/get_userlist_parameters.go b/operations/userlist/get_userlist_parameters.go deleted file mode 100644 index aabf0c2b..00000000 --- a/operations/userlist/get_userlist_parameters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetUserlistParams creates a new GetUserlistParams object -// with the default values initialized. -func NewGetUserlistParams() GetUserlistParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetUserlistParams{ - FullSection: &fullSectionDefault, - } -} - -// GetUserlistParams contains all the bound params for the get userlist operation -// typically these are obtained from a http.Request -// -// swagger:parameters getUserlist -type GetUserlistParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*Userlist name - Required: true - In: path - */ - Name string - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetUserlistParams() beforehand. -func (o *GetUserlistParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetUserlistParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetUserlistParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *GetUserlistParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetUserlistParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/userlist/get_userlist_responses.go b/operations/userlist/get_userlist_responses.go deleted file mode 100644 index a6479d6a..00000000 --- a/operations/userlist/get_userlist_responses.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetUserlistOKCode is the HTTP code returned for type GetUserlistOK -const GetUserlistOKCode int = 200 - -/* -GetUserlistOK Successful operation - -swagger:response getUserlistOK -*/ -type GetUserlistOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Userlist `json:"body,omitempty"` -} - -// NewGetUserlistOK creates GetUserlistOK with default headers values -func NewGetUserlistOK() *GetUserlistOK { - - return &GetUserlistOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get userlist o k response -func (o *GetUserlistOK) WithConfigurationVersion(configurationVersion string) *GetUserlistOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get userlist o k response -func (o *GetUserlistOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get userlist o k response -func (o *GetUserlistOK) WithPayload(payload *models.Userlist) *GetUserlistOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get userlist o k response -func (o *GetUserlistOK) SetPayload(payload *models.Userlist) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserlistOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// GetUserlistNotFoundCode is the HTTP code returned for type GetUserlistNotFound -const GetUserlistNotFoundCode int = 404 - -/* -GetUserlistNotFound The specified resource already exists - -swagger:response getUserlistNotFound -*/ -type GetUserlistNotFound struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUserlistNotFound creates GetUserlistNotFound with default headers values -func NewGetUserlistNotFound() *GetUserlistNotFound { - - return &GetUserlistNotFound{} -} - -// WithConfigurationVersion adds the configurationVersion to the get userlist not found response -func (o *GetUserlistNotFound) WithConfigurationVersion(configurationVersion string) *GetUserlistNotFound { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get userlist not found response -func (o *GetUserlistNotFound) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get userlist not found response -func (o *GetUserlistNotFound) WithPayload(payload *models.Error) *GetUserlistNotFound { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get userlist not found response -func (o *GetUserlistNotFound) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserlistNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(404) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -GetUserlistDefault General Error - -swagger:response getUserlistDefault -*/ -type GetUserlistDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUserlistDefault creates GetUserlistDefault with default headers values -func NewGetUserlistDefault(code int) *GetUserlistDefault { - if code <= 0 { - code = 500 - } - - return &GetUserlistDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get userlist default response -func (o *GetUserlistDefault) WithStatusCode(code int) *GetUserlistDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get userlist default response -func (o *GetUserlistDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get userlist default response -func (o *GetUserlistDefault) WithConfigurationVersion(configurationVersion string) *GetUserlistDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get userlist default response -func (o *GetUserlistDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get userlist default response -func (o *GetUserlistDefault) WithPayload(payload *models.Error) *GetUserlistDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get userlist default response -func (o *GetUserlistDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserlistDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/userlist/get_userlist_urlbuilder.go b/operations/userlist/get_userlist_urlbuilder.go deleted file mode 100644 index 3a425750..00000000 --- a/operations/userlist/get_userlist_urlbuilder.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - "strings" - - "github.com/go-openapi/swag" -) - -// GetUserlistURL generates an URL for the get userlist operation -type GetUserlistURL struct { - Name string - - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserlistURL) WithBasePath(bp string) *GetUserlistURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserlistURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUserlistURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/userlists/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetUserlistURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetUserlistURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetUserlistURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUserlistURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUserlistURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUserlistURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetUserlistURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/operations/userlist/get_userlists.go b/operations/userlist/get_userlists.go deleted file mode 100644 index dd92c871..00000000 --- a/operations/userlist/get_userlists.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetUserlistsHandlerFunc turns a function with the right signature into a get userlists handler -type GetUserlistsHandlerFunc func(GetUserlistsParams, interface{}) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUserlistsHandlerFunc) Handle(params GetUserlistsParams, principal interface{}) middleware.Responder { - return fn(params, principal) -} - -// GetUserlistsHandler interface for that can handle valid get userlists params -type GetUserlistsHandler interface { - Handle(GetUserlistsParams, interface{}) middleware.Responder -} - -// NewGetUserlists creates a new http.Handler for the get userlists operation -func NewGetUserlists(ctx *middleware.Context, handler GetUserlistsHandler) *GetUserlists { - return &GetUserlists{Context: ctx, Handler: handler} -} - -/* - GetUserlists swagger:route GET /services/haproxy/configuration/userlists Userlist getUserlists - -# Return an array of userlists - -Returns an array of all configured userlists. -*/ -type GetUserlists struct { - Context *middleware.Context - Handler GetUserlistsHandler -} - -func (o *GetUserlists) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUserlistsParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal interface{} - if uprinc != nil { - principal = uprinc.(interface{}) // this is really a interface{}, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/operations/userlist/get_userlists_parameters.go b/operations/userlist/get_userlists_parameters.go deleted file mode 100644 index 24a0fff0..00000000 --- a/operations/userlist/get_userlists_parameters.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewGetUserlistsParams creates a new GetUserlistsParams object -// with the default values initialized. -func NewGetUserlistsParams() GetUserlistsParams { - - var ( - // initialize parameters with default values - - fullSectionDefault = bool(false) - ) - - return GetUserlistsParams{ - FullSection: &fullSectionDefault, - } -} - -// GetUserlistsParams contains all the bound params for the get userlists operation -// typically these are obtained from a http.Request -// -// swagger:parameters getUserlists -type GetUserlistsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Indicates if the action affects the specified child resources as well - In: query - Default: false - */ - FullSection *bool - /*ID of the transaction where we want to add the operation. Cannot be used when version is specified. - In: query - */ - TransactionID *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetUserlistsParams() beforehand. -func (o *GetUserlistsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFullSection, qhkFullSection, _ := qs.GetOK("full_section") - if err := o.bindFullSection(qFullSection, qhkFullSection, route.Formats); err != nil { - res = append(res, err) - } - - qTransactionID, qhkTransactionID, _ := qs.GetOK("transaction_id") - if err := o.bindTransactionID(qTransactionID, qhkTransactionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFullSection binds and validates parameter FullSection from query. -func (o *GetUserlistsParams) bindFullSection(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - // Default values have been previously initialized by NewGetUserlistsParams() - return nil - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("full_section", "query", "bool", raw) - } - o.FullSection = &value - - return nil -} - -// bindTransactionID binds and validates parameter TransactionID from query. -func (o *GetUserlistsParams) bindTransactionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: false - // AllowEmptyValue: false - - if raw == "" { // empty values pass all other validations - return nil - } - o.TransactionID = &raw - - return nil -} diff --git a/operations/userlist/get_userlists_responses.go b/operations/userlist/get_userlists_responses.go deleted file mode 100644 index 46b25464..00000000 --- a/operations/userlist/get_userlists_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/haproxytech/client-native/v6/models" -) - -// GetUserlistsOKCode is the HTTP code returned for type GetUserlistsOK -const GetUserlistsOKCode int = 200 - -/* -GetUserlistsOK Successful operation - -swagger:response getUserlistsOK -*/ -type GetUserlistsOK struct { - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload models.Userlists `json:"body,omitempty"` -} - -// NewGetUserlistsOK creates GetUserlistsOK with default headers values -func NewGetUserlistsOK() *GetUserlistsOK { - - return &GetUserlistsOK{} -} - -// WithConfigurationVersion adds the configurationVersion to the get userlists o k response -func (o *GetUserlistsOK) WithConfigurationVersion(configurationVersion string) *GetUserlistsOK { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get userlists o k response -func (o *GetUserlistsOK) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get userlists o k response -func (o *GetUserlistsOK) WithPayload(payload models.Userlists) *GetUserlistsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get userlists o k response -func (o *GetUserlistsOK) SetPayload(payload models.Userlists) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserlistsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.Userlists{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetUserlistsDefault General Error - -swagger:response getUserlistsDefault -*/ -type GetUserlistsDefault struct { - _statusCode int - /*Configuration file version - - */ - ConfigurationVersion string `json:"Configuration-Version"` - - /* - In: Body - */ - Payload *models.Error `json:"body,omitempty"` -} - -// NewGetUserlistsDefault creates GetUserlistsDefault with default headers values -func NewGetUserlistsDefault(code int) *GetUserlistsDefault { - if code <= 0 { - code = 500 - } - - return &GetUserlistsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get userlists default response -func (o *GetUserlistsDefault) WithStatusCode(code int) *GetUserlistsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get userlists default response -func (o *GetUserlistsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithConfigurationVersion adds the configurationVersion to the get userlists default response -func (o *GetUserlistsDefault) WithConfigurationVersion(configurationVersion string) *GetUserlistsDefault { - o.ConfigurationVersion = configurationVersion - return o -} - -// SetConfigurationVersion sets the configurationVersion to the get userlists default response -func (o *GetUserlistsDefault) SetConfigurationVersion(configurationVersion string) { - o.ConfigurationVersion = configurationVersion -} - -// WithPayload adds the payload to the get userlists default response -func (o *GetUserlistsDefault) WithPayload(payload *models.Error) *GetUserlistsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get userlists default response -func (o *GetUserlistsDefault) SetPayload(payload *models.Error) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserlistsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - // response header Configuration-Version - - configurationVersion := o.ConfigurationVersion - if configurationVersion != "" { - rw.Header().Set("Configuration-Version", configurationVersion) - } - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/operations/userlist/get_userlists_urlbuilder.go b/operations/userlist/get_userlists_urlbuilder.go deleted file mode 100644 index efe8cd2a..00000000 --- a/operations/userlist/get_userlists_urlbuilder.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// Copyright 2019 HAProxy Technologies -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package userlist - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/swag" -) - -// GetUserlistsURL generates an URL for the get userlists operation -type GetUserlistsURL struct { - FullSection *bool - TransactionID *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserlistsURL) WithBasePath(bp string) *GetUserlistsURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetUserlistsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUserlistsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/services/haproxy/configuration/userlists" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/v3" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fullSectionQ string - if o.FullSection != nil { - fullSectionQ = swag.FormatBool(*o.FullSection) - } - if fullSectionQ != "" { - qs.Set("full_section", fullSectionQ) - } - - var transactionIDQ string - if o.TransactionID != nil { - transactionIDQ = *o.TransactionID - } - if transactionIDQ != "" { - qs.Set("transaction_id", transactionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetUserlistsURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetUserlistsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUserlistsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUserlistsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUserlistsURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetUserlistsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/haproxy/reload_agent.go b/reload_agent/reload_agent.go similarity index 93% rename from haproxy/reload_agent.go rename to reload_agent/reload_agent.go index 7408339f..a88f1fc2 100644 --- a/haproxy/reload_agent.go +++ b/reload_agent/reload_agent.go @@ -13,7 +13,7 @@ // limitations under the License. // -package haproxy +package reload_agent import ( "bytes" @@ -30,10 +30,8 @@ import ( "time" "github.com/google/renameio" - client_native "github.com/haproxytech/client-native/v6" "github.com/haproxytech/client-native/v6/misc" "github.com/haproxytech/client-native/v6/models" - "github.com/haproxytech/client-native/v6/runtime" "github.com/haproxytech/dataplaneapi/log" ) @@ -52,6 +50,10 @@ type IReloadAgent interface { GetReload(id string) *models.Reload } +type Runtime interface { + Reload() (string, error) +} + type reloadCache struct { failedReloads map[string]*models.Reload lastSuccess *models.Reload @@ -64,37 +66,37 @@ type reloadCache struct { } type ReloadAgentParams struct { - Client client_native.HAProxyClient - Ctx context.Context - ReloadCmd string - RestartCmd string - StatusCmd string - ConfigFile string - BackupDir string - Delay int - Retention int - UseMasterSocket bool + Runtime Runtime + Ctx context.Context + ReloadCmd string + RestartCmd string + StatusCmd string + ConfigFile string + BackupDir string + Delay int + Retention int + UseRuntime bool } // ReloadAgent handles all reloads, scheduled or forced type ReloadAgent struct { - runtime runtime.Runtime - done <-chan struct{} - reloadCmd string - restartCmd string - statusCmd string - configFile string - lkgConfigFile string - cache reloadCache - delay int - useMasterSocket bool + runtime Runtime + done <-chan struct{} + reloadCmd string + restartCmd string + statusCmd string + configFile string + lkgConfigFile string + cache reloadCache + delay int + useRuntime bool } func NewReloadAgent(params ReloadAgentParams) (*ReloadAgent, error) { ra := &ReloadAgent{} ra.reloadCmd = params.ReloadCmd - ra.useMasterSocket = params.UseMasterSocket + ra.useRuntime = params.UseRuntime ra.restartCmd = params.RestartCmd ra.statusCmd = params.StatusCmd ra.configFile = params.ConfigFile @@ -103,14 +105,7 @@ func NewReloadAgent(params ReloadAgentParams) (*ReloadAgent, error) { params.Ctx = context.Background() } ra.done = params.Ctx.Done() - - if ra.useMasterSocket { - rt, err := params.Client.Runtime() - if err != nil { - return nil, err - } - ra.runtime = rt - } + ra.runtime = params.Runtime params.Delay *= 1000 // delay is defined in seconds - internally in miliseconds d := os.Getenv("CI_DATAPLANE_RELOAD_DELAY_OVERRIDE") @@ -200,7 +195,7 @@ func (ra *ReloadAgent) reloadHAProxy(id string) (string, error) { var err error t := time.Now() - if ra.useMasterSocket { + if ra.useRuntime { output, err = ra.runtime.Reload() } else { output, err = execCmd(ra.reloadCmd) diff --git a/haproxy/reload_agent_test.go b/reload_agent/reload_agent_test.go similarity index 99% rename from haproxy/reload_agent_test.go rename to reload_agent/reload_agent_test.go index d3ac7658..a37236b5 100644 --- a/haproxy/reload_agent_test.go +++ b/reload_agent/reload_agent_test.go @@ -13,7 +13,7 @@ // limitations under the License. // -package haproxy +package reload_agent import ( "context" diff --git a/runtime/commands/stack.go b/runtime/commands/stack.go index 844a87fc..bf56fee9 100644 --- a/runtime/commands/stack.go +++ b/runtime/commands/stack.go @@ -100,16 +100,15 @@ func MakeStackDump() (string, error) { if len(bucket.CreatedBy.Calls) != 0 { extra += fmt.Sprintf(" [Created by %s.%s @ %s:%d]", bucket.CreatedBy.Calls[0].Func.DirName, bucket.CreatedBy.Calls[0].Func.Name, bucket.CreatedBy.Calls[0].SrcName, bucket.CreatedBy.Calls[0].Line) } - result.WriteString(fmt.Sprintf("%d: %s%s\n", len(bucket.IDs), bucket.State, extra)) + fmt.Fprintf(&result, "%d: %s%s\n", len(bucket.IDs), bucket.State, extra) // Print the stack lines. for _, line := range bucket.Stack.Calls { arg := line.Args - result.WriteString(fmt.Sprintf( - " %-*s %-*s %s(%s)\n", + fmt.Fprintf(&result, " %-*s %-*s %s(%s)\n", pkgLen, line.Func.DirName, srcLen, fmt.Sprintf("%s:%d", line.SrcName, line.Line), - line.Func.Name, &arg)) + line.Func.Name, &arg) } if bucket.Stack.Elided { result.WriteString(" (...)\n") diff --git a/server.go b/server.go index 011b035c..230b50be 100644 --- a/server.go +++ b/server.go @@ -1,5 +1,3 @@ -// Code generated by go-swagger; DO NOT EDIT. - // Copyright 2019 HAProxy Technologies // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// package dataplaneapi @@ -22,12 +19,12 @@ import ( "crypto/tls" "crypto/x509" "errors" - "fmt" "log" "net" "net/http" "os" "os/signal" + "slices" "strconv" "sync" "sync/atomic" @@ -35,11 +32,9 @@ import ( "time" "github.com/go-openapi/runtime/flagext" - "github.com/go-openapi/swag" + "github.com/go-openapi/swag/netutils" flags "github.com/jessevdk/go-flags" "golang.org/x/net/netutil" - - "github.com/haproxytech/dataplaneapi/operations" ) const ( @@ -48,37 +43,25 @@ const ( schemeUnix = "unix" ) -var defaultSchemes []string - -func init() { - defaultSchemes = []string{ - schemeHTTP, - schemeHTTPS, - } +var defaultSchemes = []string{ + schemeHTTP, + schemeHTTPS, } // NewServer creates a new api data plane server but does not configure it -func NewServer(api *operations.DataPlaneAPI) *Server { +func NewServer() *Server { s := new(Server) - s.shutdown = make(chan struct{}) - s.api = api s.interrupt = make(chan os.Signal, 1) return s } // ConfigureAPI configures the API and handlers. func (s *Server) ConfigureAPI() { - if s.api != nil { - s.handler = configureAPI(s.api) - } -} - -// ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse -func (s *Server) ConfigureFlags() { - if s.api != nil { - configureFlags(s.api) - } + skipBasicAuth := len(s.TLSCACertificate) > 0 && s.TLSPort > 0 + handler, shutdown := configureAPI(skipBasicAuth, int64(s.MaxBodySize)) + s.handler = handler + s.serverShutdown = shutdown } // Server for the data plane API @@ -87,6 +70,7 @@ type Server struct { CleanupTimeout time.Duration `long:"cleanup-timeout" description:"grace period for which to wait before killing idle connections" default:"10s"` GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"` MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"` + MaxBodySize flagext.ByteSize `long:"max-body-size" description:"controls the maximum number of bytes the server will read from a request body before aborting the request. 0 means unlimited." default:"1GiB"` SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/data-plane.sock"` domainSocketL net.Listener @@ -110,19 +94,22 @@ type Server struct { TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"` httpsServerL net.Listener - api *operations.DataPlaneAPI - handler http.Handler - hasListeners bool - shutdown chan struct{} - shuttingDown int32 - interrupted bool - interrupt chan os.Signal + // Logger is used by Logf and Fatalf. If nil, the standard log package is used. + Logger func(string, ...any) + + handler http.Handler + serverShutdown func() + hasListeners bool + shutdown chan struct{} + shuttingDown int32 + interrupted bool + interrupt chan os.Signal } // Logf logs message either via defined user logger or via system one if no user logger is defined. -func (s *Server) Logf(f string, args ...interface{}) { - if s.api != nil && s.api.Logger != nil { - s.api.Logger(f, args...) +func (s *Server) Logf(f string, args ...any) { + if s.Logger != nil { + s.Logger(f, args...) } else { log.Printf(f, args...) } @@ -130,39 +117,22 @@ func (s *Server) Logf(f string, args ...interface{}) { // Fatalf logs message either via defined user logger or via system one if no user logger is defined. // Exits with non-zero status after printing -func (s *Server) Fatalf(f string, args ...interface{}) { - if s.api != nil && s.api.Logger != nil { - s.api.Logger(f, args...) +func (s *Server) Fatalf(f string, args ...any) { + if s.Logger != nil { + s.Logger(f, args...) os.Exit(1) } else { log.Fatalf(f, args...) } } -// SetAPI configures the server with the specified API. Needs to be called before Serve -func (s *Server) SetAPI(api *operations.DataPlaneAPI) { - if api == nil { - s.api = nil - s.handler = nil - return - } - - s.api = api - s.handler = configureAPI(api) -} - func (s *Server) hasScheme(scheme string) bool { schemes := s.EnabledListeners if len(schemes) == 0 { schemes = defaultSchemes } - for _, v := range schemes { - if v == scheme { - return true - } - } - return false + return slices.Contains(schemes, scheme) } // Serve the api @@ -175,11 +145,7 @@ func (s *Server) Serve() (err error) { // set default handler, if none is set if s.handler == nil { - if s.api == nil { - return errors.New("can't create the default handler, as no api is set") - } - - s.SetHandler(s.api.Serve(nil)) + return errors.New("can't serve: handler not configured, call ConfigureAPI first") } wg := new(sync.WaitGroup) @@ -296,7 +262,7 @@ func (s *Server) Serve() (err error) { caCertPool := x509.NewCertPool() ok := caCertPool.AppendCertsFromPEM(caCert) if !ok { - return fmt.Errorf("cannot parse CA certificate") + return errors.New("cannot parse CA certificate") } httpsServer.TLSConfig.ClientCAs = caCertPool httpsServer.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert @@ -385,7 +351,7 @@ func (s *Server) Listen() error { return err } - h, p, err := swag.SplitHostPort(listener.Addr().String()) + h, p, err := netutils.SplitHostPort(listener.Addr().String()) if err != nil { return err } @@ -400,7 +366,7 @@ func (s *Server) Listen() error { return err } - sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String()) + sh, sp, err := netutils.SplitHostPort(tlsListener.Addr().String()) if err != nil { return err } @@ -422,7 +388,7 @@ func (s *Server) Shutdown() error { } func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) { - // wg.Done must occur last, after s.api.ServerShutdown() + // wg.Done must occur last, after s.serverShutdown() // (to preserve old behaviour) defer wg.Done() @@ -433,9 +399,6 @@ func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) ctx, cancel := context.WithTimeout(context.TODO(), s.GracefulTimeout) defer cancel() - // first execute the pre-shutdown hook - s.api.PreServerShutdown() - shutdownChan := make(chan bool) for i := range servers { server := servers[i] @@ -453,13 +416,13 @@ func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) }() } - // Wait until all listeners have successfully shut down before calling ServerShutdown + // Wait until all listeners have successfully shut down before calling serverShutdown success := true for range servers { success = success && <-shutdownChan } - if success { - s.api.ServerShutdown() + if success && s.serverShutdown != nil { + s.serverShutdown() } } diff --git a/specification/build/dataplane_spec.yaml b/specification/build/dataplane_spec.yaml new file mode 100644 index 00000000..cd458987 --- /dev/null +++ b/specification/build/dataplane_spec.yaml @@ -0,0 +1,37652 @@ +info: + title: HAProxy Data Plane API + version: "3.0" +openapi: 3.0.1 +security: + - basic_auth: [] +servers: + - url: /v3 +components: + responses: + AlreadyExists: + content: + application/json: + schema: + $ref: '#/components/schemas/error' + description: The specified resource already exists + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + BadRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/error' + description: Bad request + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + DefaultError: + content: + application/json: + schema: + $ref: '#/components/schemas/error' + description: General Error + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + NotAcceptable: + content: + application/json: + schema: + $ref: '#/components/schemas/error' + description: The specified resource cannot be handled + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + NotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/error' + description: The specified resource was not found + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + schemas: + acl: + additionalProperties: false + description: | + The use of Access Control Lists (ACL) provides a flexible solution to perform + content switching and generally to take decisions based on content extracted + from the request, the response or any environmental status. + properties: + acl_name: + pattern: ^[^\s]+$ + type: string + criterion: + pattern: ^[^\s]+$ + type: string + metadata: + additionalProperties: + type: object + value: + type: string + required: + - acl_name + - criterion + title: ACL Lines + type: object + x-go-type: models.ACL + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_file: + description: ACL File + properties: + description: + type: string + id: + type: string + storage_name: + type: string + title: ACL File + type: object + x-go-type: models.ACLFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_file_entry: + description: One ACL File Entry + properties: + id: + readOnly: true + type: string + value: + type: string + title: One ACL File Entry + type: object + x-go-type: models.ACLFileEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_files: + description: Array of runtime acl files + items: + $ref: '#/components/schemas/acl_file' + title: ACL Files Array + type: array + x-go-type: models.ACLFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_files_entries: + description: Array of entries of one runtime acl file + items: + $ref: '#/components/schemas/acl_file_entry' + title: ACL Files Entries + type: array + x-go-type: models.ACLFilesEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acls: + description: HAProxy ACL lines array (corresponds to acl directives) + items: + $ref: '#/components/schemas/acl' + title: ACL Lines Array + type: array + x-go-type: models.Acls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acme_certificate_status: + description: Status of a single ACME certificate from runtime. + properties: + acme_section: + description: ACME section which generated the certificate. + type: string + certificate: + description: Certificate name + type: string + expiries_in: + description: Duration until certificate expiry. + type: string + expiry_date: + description: Certificate expiration date. + format: date-time + type: string + renewal_in: + description: Duration until the next planned renewal. + type: string + scheduled_renewal: + description: Planned date for certificate renewal. + format: date-time + type: string + state: + description: State of the ACME task, either "Running" or "Scheduled". + type: string + title: ACME certificate status + type: object + acme_provider: + additionalProperties: false + description: Define an ACME provider to generate certificates automatically + properties: + account_key: + description: Path where the the ACME account key is stored + type: string + acme_provider: + description: DNS provider for the dns-01 challenge + type: string + acme_vars: + additionalProperties: + type: string + description: List of variables passed to the dns-01 provider (typically API keys) + bits: + description: Number of bits used when generating an RSA certificate. Ignored when keytype is ECDSA (curves is used instead). + nullable: true + type: integer + x-omitempty: true + challenge: + description: ACME challenge type. Only http-01 and dns-01 are supported. + enum: + - http-01 + - dns-01 + type: string + contact: + description: Contact email for the ACME account + type: string + curves: + description: Curves used with the ECDSA key type + type: string + directory: + description: | + URL to the ACME provider's directory. For example: + https://acme-staging-v02.api.letsencrypt.org/directory + pattern: ^https://[^\s]+$ + type: string + keytype: + description: Type of key to generate + enum: + - RSA + - ECDSA + type: string + map: + description: The map which will be used to store the ACME token (key) and thumbprint + type: string + metadata: + additionalProperties: + type: object + name: + description: ACME provider's name + type: string + reuse_key: + description: Try to reuse the private key instead of generating a new one. + enum: + - enabled + - disabled + type: string + required: + - name + - directory + title: ACME Provider + type: object + x-go-type: models.AcmeProvider + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acme_providers: + description: List of ACME sections. + items: + $ref: '#/components/schemas/acme_provider' + type: array + x-go-type: models.AcmeProviders + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acme_status: + description: Status of all the ACME certificates from runtime. + items: + $ref: '#/components/schemas/acme_certificate_status' + title: ACME status + type: array + x-go-type: models.AcmeStatus + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + awsFilters: + properties: + key: + description: Key to use as filter, using the format specified at https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options + type: string + value: + description: Value of the filter to use + type: string + required: + - key + - value + type: object + awsRegion: + description: AWS region configuration + example: + access_key_id: '****************L7GT' + allowlist: + - key: tag-key + value: Instance:Having:This:Tag + denylist: + - key: tag:Environment + value: development + enabled: true + id: "0" + ipv4_address: private + name: frontend-service + region: us-east-1 + retry_timeout: 1 + secret_access_key: '****************soLl' + properties: + access_key_id: + description: AWS Access Key ID. + type: string + allowlist: + description: Specify the AWS filters used to filter the EC2 instances to add + items: + $ref: '#/components/schemas/awsFilters' + type: array + x-omitempty: true + denylist: + description: Specify the AWS filters used to filter the EC2 instances to ignore + items: + $ref: '#/components/schemas/awsFilters' + type: array + x-omitempty: true + description: + type: string + enabled: + type: boolean + id: + description: Auto generated ID. + nullable: true + pattern: ^[^\s]+$ + readOnly: true + type: string + ipv4_address: + description: Select which IPv4 address the Service Discovery has to use for the backend server entry + enum: + - private + - public + type: string + name: + type: string + region: + type: string + retry_timeout: + description: Duration in seconds in-between data pulling requests to the AWS region + minimum: 1 + type: integer + secret_access_key: + description: AWS Secret Access Key. + type: string + server_slots_base: + default: 10 + type: integer + server_slots_growth_increment: + type: integer + server_slots_growth_type: + default: exponential + enum: + - linear + - exponential + type: string + required: + - name + - region + - enabled + - retry_timeout + - ipv4_address + title: AWS region + type: object + x-go-type: models.AwsRegion + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + awsRegions: + description: AWS regions array + items: + $ref: '#/components/schemas/awsRegion' + title: AWS + type: array + x-go-type: models.AwsRegions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backend: + allOf: + - $ref: '#/components/schemas/backend_base' + - properties: + acl_list: + $ref: '#/components/schemas/acls' + filter_list: + $ref: '#/components/schemas/filters' + http_after_response_rule_list: + $ref: '#/components/schemas/http_after_response_rules' + http_check_list: + $ref: '#/components/schemas/http_checks' + http_error_rule_list: + $ref: '#/components/schemas/http_error_rules' + http_request_rule_list: + $ref: '#/components/schemas/http_request_rules' + http_response_rule_list: + $ref: '#/components/schemas/http_response_rules' + log_target_list: + $ref: '#/components/schemas/log_targets' + server_switching_rule_list: + $ref: '#/components/schemas/server_switching_rules' + server_templates: + additionalProperties: + $ref: '#/components/schemas/server_template' + servers: + additionalProperties: + $ref: '#/components/schemas/server' + stick_rule_list: + $ref: '#/components/schemas/stick_rules' + tcp_check_rule_list: + $ref: '#/components/schemas/tcp_checks' + tcp_request_rule_list: + $ref: '#/components/schemas/tcp_request_rules' + tcp_response_rule_list: + $ref: '#/components/schemas/tcp_response_rules' + type: object + description: Backend with all its children resources + type: object + x-go-name: Backend + x-go-type: models.Backend + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backend_base: + additionalProperties: false + description: HAProxy backend configuration + example: + adv_check: httpchk + balance: + algorithm: roundrobin + forwardfor: + enabled: enabled + httpchk_params: + method: GET + uri: /check + version: HTTP/1.1 + mode: http + name: test_backend + properties: + abortonclose: + enum: + - enabled + - disabled + type: string + accept_invalid_http_response: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Invalid HTTP Response + accept_unsafe_violations_in_http_response: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Unsafe Violations in HTTP Response + adv_check: + enum: + - httpchk + - ldap-check + - mysql-check + - pgsql-check + - redis-check + - smtpchk + - ssl-hello-chk + - tcp-check + type: string + x-display-name: Advanced Check + allbackups: + enum: + - enabled + - disabled + type: string + x-display-name: All Backups + balance: + $ref: '#/components/schemas/balance' + check_timeout: + nullable: true + type: integer + x-default-unit: ms + x-duration: true + checkcache: + enum: + - enabled + - disabled + type: string + x-display-name: Checkcache + compression: + $ref: '#/components/schemas/compression' + connect_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + cookie: + $ref: '#/components/schemas/cookie' + default_server: + $ref: '#/components/schemas/default_server' + description: + type: string + x-display-name: Description + disabled: + type: boolean + dynamic_cookie_key: + pattern: ^[^\s]+$ + type: string + x-dependency: + cookie.dynamic: + value: true + email_alert: + $ref: '#/components/schemas/email_alert' + enabled: + type: boolean + error_files: + items: + $ref: '#/components/schemas/errorfile' + type: array + x-go-name: ErrorFiles + x-omitempty: true + errorfiles_from_http_errors: + items: + $ref: '#/components/schemas/errorfiles' + type: array + x-go-name: ErrorFilesFromHTTPErrors + x-omitempty: true + errorloc302: + $ref: '#/components/schemas/errorloc' + errorloc303: + $ref: '#/components/schemas/errorloc' + external_check: + enum: + - enabled + - disabled + type: string + x-display-name: External Check + external_check_command: + pattern: ^[^\s]+$ + type: string + x-display-name: External Check Command + external_check_path: + pattern: ^[^\s]+$ + type: string + x-display-name: External Check Path + force_persist: + description: This field is deprecated in favor of force_persist_list, and will be removed in a future release + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + required: + - cond + - cond_test + type: object + x-deprecated: true + x-go-name: BackendForcePersist + force_persist_list: + items: + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + required: + - cond + - cond_test + type: object + x-go-name: ForcePersist + type: array + x-go-name: ForcePersistList + x-omitempty: true + forwardfor: + $ref: '#/components/schemas/forwardfor' + from: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + fullconn: + nullable: true + type: integer + guid: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + h1_case_adjust_bogus_server: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + x-display-name: H1 Adjust Bogus Server + hash_balance_factor: + nullable: true + type: integer + hash_preserve_affinity: + enum: + - always + - maxconn + - maxqueue + type: string + hash_type: + $ref: '#/components/schemas/hash_type' + http-buffer-request: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + x-display-name: HTTP bufferrequest + http-drop-request-trailers: + enum: + - enabled + - disabled + type: string + x-display-name: Drop HTTP Request Trailers + http-no-delay: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + x-display-name: HTTP low interactive delays + http-use-htx: + enum: + - enabled + - disabled + pattern: ^[^\s]+$ + type: string + x-dependency: + mode: + value: http + http_connection_mode: + enum: + - httpclose + - http-server-close + - http-keep-alive + type: string + x-dependency: + mode: + value: http + http_keep_alive_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + mode: + value: http + x-duration: true + http_pretend_keepalive: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + http_proxy: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + x-display-name: HTTP proxy mode + http_request_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + mode: + value: http + x-duration: true + http_restrict_req_hdr_names: + enum: + - preserve + - delete + - reject + type: string + x-display-name: Restrict HTTP Request Header Names + http_reuse: + enum: + - aggressive + - always + - never + - safe + type: string + x-dependency: + mode: + value: http + http_send_name_header: + description: The header string to use to send the server name + nullable: true + type: string + httpchk_params: + $ref: '#/components/schemas/httpchk_params' + id: + nullable: true + type: integer + ignore_persist: + description: This field is deprecated in favor of ignore_persist_list, and will be removed in a future release + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + required: + - cond + - cond_test + type: object + x-deprecated: true + x-go-name: BackendIgnorePersist + ignore_persist_list: + items: + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + required: + - cond + - cond_test + type: object + x-go-name: IgnorePersist + type: array + x-go-name: IgnorePersistList + x-omitempty: true + independent_streams: + enum: + - enabled + - disabled + type: string + x-display-name: Independent Streams + load_server_state_from_file: + enum: + - global + - local + - none + type: string + log_health_checks: + enum: + - enabled + - disabled + type: string + x-display-name: Log Health Checks + log_tag: + pattern: ^[^\s]+$ + type: string + max_keep_alive_queue: + nullable: true + type: integer + x-display-name: Maximum keep alive queue + metadata: + additionalProperties: + type: object + mode: + enum: + - http + - tcp + - log + type: string + mysql_check_params: + $ref: '#/components/schemas/mysql_check_params' + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + nolinger: + enum: + - enabled + - disabled + type: string + x-display-name: Nolinger + originalto: + $ref: '#/components/schemas/originalto' + persist: + enum: + - enabled + - disabled + type: string + x-display-name: Persist + persist_rule: + $ref: '#/components/schemas/persist_rule' + pgsql_check_params: + $ref: '#/components/schemas/pgsql_check_params' + prefer_last_server: + enum: + - enabled + - disabled + type: string + x-display-name: Prefer Last Server + queue_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + redispatch: + $ref: '#/components/schemas/redispatch' + retries: + nullable: true + type: integer + retry_on: + type: string + x-display-name: Retry on + server_fin_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + server_state_file_name: + type: string + x-display-name: Server state file + server_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + smtpchk_params: + $ref: '#/components/schemas/smtpchk_params' + source: + $ref: '#/components/schemas/source' + splice_auto: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Auto + splice_request: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Request + splice_response: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Response + spop_check: + enum: + - enabled + - disabled + type: string + x-display-name: Spop Check + srvtcpka: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: tcp + x-display-name: Server TCP Keep Alive + srvtcpka_cnt: + nullable: true + type: integer + x-display-name: Srvtcpka Cnt + srvtcpka_idle: + nullable: true + type: integer + x-default-unit: s + x-display-name: Srvtcpka Idle + x-duration: true + srvtcpka_intvl: + nullable: true + type: integer + x-default-unit: s + x-display-name: Srvtcpka Intvl + x-duration: true + stats_options: + $ref: '#/components/schemas/stats_options' + stick_table: + $ref: '#/components/schemas/config_stick_table' + tarpit_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + tcp_smart_connect: + enum: + - enabled + - disabled + type: string + x-display-name: Tcp Smart Connect + tcpka: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: tcp + x-display-name: TCP Keep Alive + transparent: + enum: + - enabled + - disabled + type: string + x-display-name: Transparent + tunnel_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + use_fcgi_app: + type: string + x-display-name: FastCGI application + required: + - name + title: Backend Base + type: object + backend_switching_rule: + additionalProperties: false + description: HAProxy backend switching rule configuration (corresponds to use_backend directive) + example: + cond: if + cond_test: '{ req.ssl_sni -i www.example.com }' + index: 0 + name: test_backend + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + metadata: + additionalProperties: + type: object + name: + pattern: ^[^\s]+$ + type: string + x-display-name: Backend Name + x-dynamic-enum: + operation: getBackends + property: name + required: + - name + title: Backend Switching Rule + type: object + x-go-type: models.BackendSwitchingRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backend_switching_rules: + description: HAProxy backend switching rules array (corresponds to use_backend directives) + items: + $ref: '#/components/schemas/backend_switching_rule' + title: Backend Switching Rules Array + type: array + x-go-type: models.BackendSwitchingRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backends: + description: HAProxy backends array + items: + $ref: '#/components/schemas/backend' + title: Backends + type: array + x-go-type: models.Backends + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + balance: + properties: + algorithm: + enum: + - first + - hash + - hdr + - leastconn + - random + - rdp-cookie + - roundrobin + - source + - static-rr + - uri + - url_param + type: string + hash_expression: + type: string + x-dependency: + algorithm: + value: hash + x-display-name: Hash Expression + hdr_name: + type: string + x-dependency: + algorithm: + required: true + value: hdr + x-display-name: Header Name + hdr_use_domain_only: + type: boolean + x-dependency: + algorithm: + value: hdr + x-display-name: Header Use Domain Only + random_draws: + type: integer + x-dependency: + algorithm: + value: random + x-display-name: Random Draws + rdp_cookie_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + algorithm: + value: rdp-cookie + x-display-name: Rdp Cookie Name + uri_depth: + type: integer + x-dependency: + algorithm: + value: uri + x-display-name: Uri Depth + uri_len: + type: integer + x-dependency: + algorithm: + value: uri + x-display-name: Uri Len + uri_path_only: + type: boolean + x-dependency: + algorithm: + value: uri + x-display-name: Uri Path Only + uri_whole: + type: boolean + x-dependency: + algorithm: + value: uri + x-display-name: Uri Whole + url_param: + pattern: ^[^\s]+$ + type: string + x-dependency: + algorithm: + required: true + value: url_param + x-display-name: Url Param + url_param_check_post: + type: integer + x-dependency: + algorithm: + value: url_param + x-display-name: Url Param Check Post + url_param_max_wait: + type: integer + x-dependency: + algorithm: + value: url_param + x-display-name: Url Param Max Weight + required: + - algorithm + type: object + bind: + allOf: + - $ref: '#/components/schemas/bind_params' + - additionalProperties: false + properties: + address: + example: 127.0.0.1 + pattern: ^[^\s]+$ + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[^\s]+$ + type: string + port: + example: 80 + maximum: 65535 + minimum: 1 + nullable: true + type: integer + port-range-end: + example: 81 + maximum: 65535 + minimum: 1 + nullable: true + type: integer + required: + - name + type: object + description: HAProxy frontend bind configuration + title: Bind + x-go-type: models.Bind + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + bind_params: + additionalProperties: false + properties: + accept_netscaler_cip: + type: integer + accept_proxy: + type: boolean + allow_0rtt: + type: boolean + alpn: + pattern: ^[^\s]+$ + type: string + x-display-name: ALPN Protocols + backlog: + type: string + ca_ignore_err: + type: string + x-dependency: + ssl: + value: true + ca_sign_file: + type: string + x-dependency: + ssl: + value: true + ca_sign_pass: + type: string + x-dependency: + ssl: + value: true + x-display-name: Passphrase + ca_verify_file: + type: string + x-dependency: + ca_file: + value: true + cc: + type: string + x-display-name: TCP Congestion Control Algorithm + ciphers: + type: string + x-dependency: + ssl: + value: true + ciphersuites: + type: string + x-dependency: + ssl: + value: true + client_sigalgs: + type: string + x-dependency: + ssl: + value: true + crl_file: + type: string + x-dependency: + ssl: + value: true + crt_ignore_err: + type: string + x-dependency: + ssl: + value: true + crt_list: + type: string + x-dependency: + ssl: + value: true + curves: + type: string + x-dependency: + ssl: + value: true + default_crt_list: + items: + pattern: ^[^\s]+$ + type: string + type: array + x-omitempty: true + defer_accept: + type: boolean + ecdhe: + type: string + x-dependency: + ssl: + value: true + expose_fd_listeners: + type: boolean + force_sslv3: + description: This field is deprecated in favor of sslv3, and will be removed in a future release + type: boolean + x-deprecated: true + force_strict_sni: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + force_tlsv10: + description: This field is deprecated in favor of tlsv10, and will be removed in a future release + type: boolean + x-deprecated: true + force_tlsv11: + description: This field is deprecated in favor of tlsv11, and will be removed in a future release + type: boolean + x-deprecated: true + force_tlsv12: + description: This field is deprecated in favor of tlsv12, and will be removed in a future release + type: boolean + x-deprecated: true + force_tlsv13: + description: This field is deprecated in favor of tlsv13, and will be removed in a future release + type: boolean + x-deprecated: true + generate_certificates: + type: boolean + x-dependency: + ssl: + value: true + gid: + type: integer + x-display-name: Group ID + group: + type: string + x-display-name: Group name + guid_prefix: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + id: + type: string + x-display-name: Socket ID + idle_ping: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + interface: + type: string + ktls: + enum: + - "on" + - "off" + type: string + x-display-name: |- + Enables or disables ktls for those sockets. If enabled, kTLS will be used if the kernel supports it and the cipher is compatible. + This is only available on Linux kernel 4.17 and above. + EXPERIMENTAL OPTION. + label: + type: string + level: + enum: + - user + - operator + - admin + example: user + type: string + maxconn: + example: 1234 + type: integer + mode: + type: string + mss: + type: string + namespace: + example: app + type: string + nbconn: + type: integer + x-display-name: Number of connection + nice: + example: 1 + type: integer + no_alpn: + type: boolean + x-dependency: + ssl: + value: true + no_ca_names: + type: boolean + x-dependency: + ssl: + value: true + no_sslv3: + description: This field is deprecated in favor of sslv3, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_strict_sni: + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_tls_tickets: + description: This field is deprecated in favor of tls_tickets, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_tlsv10: + description: This field is deprecated in favor of tlsv10, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_tlsv11: + description: This field is deprecated in favor of tlsv11, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_tlsv12: + description: This field is deprecated in favor of tlsv12, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + no_tlsv13: + description: This field is deprecated in favor of tlsv13, and will be removed in a future release + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + npn: + type: string + prefer_client_ciphers: + type: boolean + proto: + type: string + x-display-name: Protocol name + quic-cc-algo: + enum: + - cubic + - newreno + - bbr + - nocc + type: string + quic-force-retry: + type: boolean + quic-socket: + enum: + - connection + - listener + type: string + quic_cc_algo_burst_size: + maximum: 1024 + minimum: 0 + nullable: true + type: integer + x-dependency: + quic-cc-algo: null + quic_cc_algo_max_window: + maximum: 4.194304e+06 + minimum: 10 + nullable: true + type: integer + x-default-unit: k + x-dependency: + quic-cc-algo: null + x-size: true + severity_output: + enum: + - none + - number + - string + example: none + type: string + x-display-name: Format + sigalgs: + type: string + x-dependency: + ssl: + value: true + ssl: + type: boolean + ssl_cafile: + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: true + x-display-name: SSL CA File + ssl_certificate: + description: All of the certificates delimited by ':' as mentioned as a crt on the bind line. + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: true + ssl_max_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_min_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + sslv3: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + strict_sni: + type: boolean + x-dependency: + ssl: + value: true + x-deprecated: true + tcp_md5sig: + pattern: ^[^\s]+$ + type: string + tcp_user_timeout: + nullable: true + type: integer + tfo: + type: boolean + thread: + type: string + tls_ticket_keys: + type: string + tls_tickets: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + tlsv10: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + tlsv11: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + tlsv12: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + tlsv13: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: true + transparent: + type: boolean + uid: + type: string + user: + type: string + v4v6: + type: boolean + v6only: + type: boolean + verify: + enum: + - none + - optional + - required + example: none + type: string + x-dependency: + ssl: + value: enabled + type: object + binds: + description: HAProxy frontend binds array (corresponds to bind directives) + items: + $ref: '#/components/schemas/bind' + title: Binds + type: array + x-go-type: models.Binds + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + cache: + description: HAPRoxy Cache section + properties: + max_age: + type: integer + x-default-unit: s + x-duration: false + max_object_size: + type: integer + x-size: false + max_secondary_entries: + type: integer + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + process_vary: + nullable: true + type: boolean + total_max_size: + maximum: 4095 + minimum: 1 + type: integer + required: + - name + title: Cache + type: object + x-go-type: models.Cache + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + caches: + description: HAProxy caches array + items: + $ref: '#/components/schemas/cache' + title: Cache Sections + type: array + x-go-type: models.Caches + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + capture: + properties: + length: + type: integer + metadata: + additionalProperties: + type: object + type: + enum: + - request + - response + type: string + required: + - type + - length + title: Declare Capture + type: object + x-go-type: models.Capture + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + captures: + items: + $ref: '#/components/schemas/capture' + title: Declare capture array + type: array + x-go-type: models.Captures + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + cluster_settings: + description: Settings related to a cluster. + properties: + bootstrap_key: + type: string + cluster: + properties: + address: + pattern: ^[^\s]+$ + readOnly: true + type: string + api_base_path: + readOnly: true + type: string + cluster_id: + type: string + description: + readOnly: true + type: string + log_targets: + items: + properties: + address: + type: string + log_format: + type: string + port: + maximum: 65535 + minimum: 1 + type: integer + protocol: + enum: + - tcp + - udp + type: string + required: + - address + - port + - protocol + type: object + x-go-name: ClusterLogTarget + type: array + x-go-name: ClusterLogTargets + x-omitempty: true + name: + readOnly: true + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + readOnly: true + type: integer + title: Cluster controller information + type: object + mode: + enum: + - single + - cluster + type: string + status: + enum: + - active + - unreachable + - waiting_approval + readOnly: true + type: string + title: Cluster Settings + type: object + x-go-type: models.ClusterSettings + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + compression: + properties: + algo-req: + enum: + - identity + - gzip + - deflate + - raw-deflate + type: string + x-omitempty: true + algorithms: + items: + enum: + - identity + - gzip + - deflate + - raw-deflate + type: string + type: array + x-omitempty: true + algos-res: + items: + enum: + - identity + - gzip + - deflate + - raw-deflate + type: string + type: array + x-omitempty: true + direction: + enum: + - request + - response + - both + type: string + x-omitempty: true + minsize_req: + type: integer + x-display-name: Minimum Size for Requests + x-size: true + minsize_res: + type: integer + x-display-name: Minimum Size for Responses + x-size: true + offload: + type: boolean + types: + items: + type: string + type: array + x-omitempty: true + types-req: + items: + type: string + type: array + x-omitempty: true + types-res: + items: + type: string + type: array + x-omitempty: true + type: object + config_stick_table: + properties: + expire: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + keylen: + nullable: true + type: integer + x-display-name: Key Length + metadata: + additionalProperties: + type: object + nopurge: + type: boolean + x-display-name: No Purge + peers: + pattern: ^[^\s]+$ + type: string + recv_only: + type: boolean + x-display-name: Receive Only + size: + minimum: 0 + nullable: true + type: integer + x-size: true + srvkey: + enum: + - addr + - name + nullable: true + type: string + store: + pattern: ^[^\s]+$ + type: string + type: + enum: + - ip + - ipv6 + - integer + - string + - binary + type: string + write_to: + nullable: true + pattern: ^[^\s]+$ + type: string + type: object + consul: + additionalProperties: false + description: Consul server configuration + example: + address: 127.0.0.1 + enabled: true + id: "0" + port: 90 + retry_timeout: 10 + properties: + address: + pattern: ^[^\s]+$ + type: string + defaults: + description: Name of the defaults section to be used in backends created by this service + type: string + description: + type: string + enabled: + type: boolean + health_check_policy: + default: none + description: |- + Defines the health check conditions required for each node to be considered valid for the service. + none: all nodes are considered valid + any: a node is considered valid if any one health check is 'passing' + all: a node is considered valid if all health checks are 'passing' + min: a node is considered valid if the number of 'passing' checks is greater or equal to the 'health_check_policy_min' value. + If the node has less health checks configured then 'health_check_policy_min' it is considered invalid. + enum: + - none + - any + - all + - min + type: string + health_check_policy_min: + type: integer + x-dependency: + health_check_policy: + value: min + id: + description: Auto generated ID. + nullable: true + pattern: ^[^\s]+$ + type: string + mode: + default: http + enum: + - http + - https + type: string + name: + type: string + namespace: + type: string + port: + maximum: 65535 + minimum: 1 + type: integer + retry_timeout: + description: Duration in seconds in-between data pulling requests to the consul server + minimum: 1 + type: integer + server_slots_base: + default: 10 + type: integer + server_slots_growth_increment: + type: integer + server_slots_growth_type: + default: exponential + enum: + - linear + - exponential + type: string + service_allowlist: + items: + pattern: ^[^\s]+$ + type: string + type: array + x-omitempty: true + service_denylist: + items: + pattern: ^[^\s]+$ + type: string + type: array + x-omitempty: true + service_name_regexp: + description: Regular expression used to filter services by name. + type: string + token: + pattern: ^[^\s]+$ + type: string + required: + - address + - port + - enabled + - retry_timeout + title: Consul server + type: object + x-go-type: models.Consul + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + consuls: + description: Consuls array + items: + $ref: '#/components/schemas/consul' + title: Consuls + type: array + x-go-type: models.Consuls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + cookie: + properties: + attr: + items: + properties: + value: + pattern: ^[^\s]+$ + type: string + type: object + x-go-name: Attr + type: array + x-go-name: Attrs + x-omitempty: true + domain: + items: + properties: + value: + pattern: ^[^\s]+$ + type: string + type: object + x-go-name: Domain + type: array + x-go-name: Domains + x-omitempty: true + dynamic: + type: boolean + httponly: + type: boolean + indirect: + type: boolean + maxidle: + type: integer + maxlife: + type: integer + name: + pattern: ^[^\s]+$ + type: string + nocache: + type: boolean + postonly: + type: boolean + preserve: + type: boolean + secure: + type: boolean + type: + enum: + - rewrite + - insert + - prefix + type: string + required: + - name + type: object + crt_load: + description: Loads a certificate from a store with options + properties: + acme: + description: ACME section name to use + type: string + alias: + description: Certificate alias + type: string + certificate: + description: Certificate filename + type: string + domains: + description: List of domains used to generate the certificate with ACME + items: + type: string + type: array + x-go-name: Domains + x-omitempty: true + issuer: + description: OCSP issuer filename + type: string + key: + description: Private key filename + type: string + metadata: + additionalProperties: + type: object + ocsp: + description: OCSP response filename + type: string + ocsp_update: + description: Automatic OCSP response update + enum: + - enabled + - disabled + type: string + sctl: + description: Signed Certificate Timestamp List filename + type: string + required: + - certificate + title: Certificate load action + type: object + x-go-type: models.CrtLoad + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + crt_loads: + description: List of certificates to load from a Certificate Store + items: + $ref: '#/components/schemas/crt_load' + type: array + x-go-type: models.CrtLoads + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + x-omitempty: true + crt_store: + allOf: + - $ref: '#/components/schemas/crt_store_base' + - properties: + crt_loads: + additionalProperties: + $ref: '#/components/schemas/crt_load' + type: object + description: Storage mechanism to load and store certificates used in the configuration + title: Certificate Store + x-go-name: CrtStore + x-go-type: models.CrtStore + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + crt_store_base: + additionalProperties: false + description: Storage mechanism to load and store certificates used in the configuration + properties: + crt_base: + description: Default directory to fetch SSL certificates from + type: string + key_base: + description: Default directory to fetch SSL private keys from + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_]+$ + type: string + required: + - name + title: Certificate Store + type: object + crt_stores: + description: List of Certificate Stores + items: + $ref: '#/components/schemas/crt_store' + type: array + x-go-type: models.CrtStores + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + debug_options: + properties: + anonkey: + maximum: 4.294967295e+09 + minimum: 0 + nullable: true + type: integer + quiet: + type: boolean + stress_level: + maximum: 9 + minimum: 0 + nullable: true + type: integer + zero_warning: + type: boolean + type: object + default_bind: + allOf: + - $ref: '#/components/schemas/bind_params' + - properties: + metadata: + additionalProperties: + type: object + name: + pattern: ^[^\s]+$ + type: string + type: object + description: HAProxy default bind configuration + title: Default Bind + default_server: + allOf: + - $ref: '#/components/schemas/server_params' + title: Default Server + defaults: + allOf: + - $ref: '#/components/schemas/defaults_base' + - properties: + acl_list: + $ref: '#/components/schemas/acls' + http_after_response_rule_list: + $ref: '#/components/schemas/http_after_response_rules' + http_check_list: + $ref: '#/components/schemas/http_checks' + http_error_rule_list: + $ref: '#/components/schemas/http_error_rules' + http_request_rule_list: + $ref: '#/components/schemas/http_request_rules' + http_response_rule_list: + $ref: '#/components/schemas/http_response_rules' + log_target_list: + $ref: '#/components/schemas/log_targets' + quic_initial_rule_list: + $ref: '#/components/schemas/quic_initial_rules' + tcp_check_rule_list: + $ref: '#/components/schemas/tcp_checks' + tcp_request_rule_list: + $ref: '#/components/schemas/tcp_request_rules' + tcp_response_rule_list: + $ref: '#/components/schemas/tcp_response_rules' + type: object + description: Defaults with all its children resources + type: object + x-go-name: Defaults + x-go-type: models.Defaults + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + defaults_base: + additionalProperties: false + description: HAProxy defaults configuration + properties: + abortonclose: + enum: + - enabled + - disabled + type: string + accept_invalid_http_request: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Invalid HTTP Request + accept_invalid_http_response: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Invalid HTTP Response + accept_unsafe_violations_in_http_request: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Unsafe Violations in HTTP Request + accept_unsafe_violations_in_http_response: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Unsafe Violations in HTTP Response + adv_check: + enum: + - httpchk + - ldap-check + - mysql-check + - pgsql-check + - redis-check + - smtpchk + - ssl-hello-chk + - tcp-check + type: string + x-display-name: Advanced Check + allbackups: + enum: + - enabled + - disabled + type: string + x-display-name: All Backups + backlog: + nullable: true + type: integer + x-display-name: Backlog + balance: + $ref: '#/components/schemas/balance' + check_timeout: + nullable: true + type: integer + x-default-unit: ms + x-duration: true + checkcache: + enum: + - enabled + - disabled + type: string + x-display-name: Checkcache + clflog: + type: boolean + x-display-name: CLF Log + client_fin_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + client_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + clitcpka: + enum: + - enabled + - disabled + type: string + x-display-name: Client TCP Keep Alive + clitcpka_cnt: + nullable: true + type: integer + x-display-name: Clitcpka Cnt + clitcpka_idle: + nullable: true + type: integer + x-default-unit: s + x-display-name: Clitcpka Idle + x-duration: true + clitcpka_intvl: + nullable: true + type: integer + x-default-unit: s + x-display-name: Clitcpka Intvl + x-duration: true + compression: + $ref: '#/components/schemas/compression' + connect_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + contstats: + enum: + - enabled + type: string + x-display-name: Continuous Statistics + cookie: + $ref: '#/components/schemas/cookie' + default_backend: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + x-dynamic-enum: + operation: getBackends + property: name + default_server: + $ref: '#/components/schemas/default_server' + disable_h2_upgrade: + enum: + - enabled + - disabled + type: string + x-display-name: Disable HTTP/2 Upgrade + disabled: + type: boolean + dontlog_normal: + enum: + - enabled + - disabled + type: string + x-display-name: Dontlog Normal + dontlognull: + enum: + - enabled + - disabled + type: string + x-display-name: Don't Log Null + dynamic_cookie_key: + pattern: ^[^\s]+$ + type: string + email_alert: + $ref: '#/components/schemas/email_alert' + enabled: + type: boolean + error_files: + items: + $ref: '#/components/schemas/errorfile' + type: array + x-go-name: ErrorFiles + x-omitempty: true + error_log_format: + type: string + errorfiles_from_http_errors: + items: + $ref: '#/components/schemas/errorfiles' + type: array + x-go-name: ErrorFilesFromHTTPErrors + x-omitempty: true + errorloc302: + $ref: '#/components/schemas/errorloc' + errorloc303: + $ref: '#/components/schemas/errorloc' + external_check: + enum: + - enabled + - disabled + type: string + x-display-name: External Check + external_check_command: + pattern: ^[^\s]+$ + type: string + x-display-name: External Check Command + external_check_path: + pattern: ^[^\s]+$ + type: string + x-display-name: External Check Path + forwardfor: + $ref: '#/components/schemas/forwardfor' + from: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + fullconn: + nullable: true + type: integer + h1_case_adjust_bogus_client: + enum: + - enabled + - disabled + type: string + x-display-name: H1 Adjust Bogus Client + h1_case_adjust_bogus_server: + enum: + - enabled + - disabled + type: string + x-display-name: H1 Adjust Bogus Server + hash_balance_factor: + nullable: true + type: integer + hash_preserve_affinity: + enum: + - always + - maxconn + - maxqueue + type: string + hash_type: + $ref: '#/components/schemas/hash_type' + http-buffer-request: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP bufferrequest + http-drop-request-trailers: + enum: + - enabled + - disabled + type: string + x-display-name: Drop HTTP Request Trailers + http-drop-response-trailers: + enum: + - enabled + - disabled + type: string + x-display-name: Drop HTTP Response Trailers + http-use-htx: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Use HTX + http_connection_mode: + enum: + - httpclose + - http-server-close + - http-keep-alive + type: string + http_ignore_probes: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Ignore Probes + http_keep_alive_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + http_no_delay: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP No Delay + http_pretend_keepalive: + enum: + - enabled + - disabled + type: string + http_request_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + http_restrict_req_hdr_names: + enum: + - preserve + - delete + - reject + type: string + x-display-name: Restrict HTTP Request Header Names + http_reuse: + enum: + - aggressive + - always + - never + - safe + type: string + http_send_name_header: + description: Add the server name to a request + nullable: true + type: string + http_use_proxy_header: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Use Proxy Header + httpchk_params: + $ref: '#/components/schemas/httpchk_params' + httplog: + type: boolean + x-display-name: HTTP Log + httpslog: + enum: + - enabled + - disabled + type: string + x-display-name: Httpslog + idle_close_on_response: + enum: + - enabled + - disabled + type: string + x-display-name: Idle Close On Response + independent_streams: + enum: + - enabled + - disabled + type: string + x-display-name: Independent Streams + load_server_state_from_file: + enum: + - global + - local + - none + type: string + log_format: + type: string + log_format_sd: + type: string + x-display-name: Log Format SD + log_health_checks: + enum: + - enabled + - disabled + type: string + x-display-name: Log Health Checks + log_separate_errors: + enum: + - enabled + - disabled + type: string + log_steps: + items: + enum: + - accept + - request + - connect + - response + - close + - error + - any + type: string + type: array + x-go-name: LogSteps + x-omitempty: true + log_tag: + pattern: ^[^\s]+$ + type: string + logasap: + enum: + - enabled + - disabled + type: string + x-display-name: Log ASAP + max_keep_alive_queue: + description: Maximum server queue size for maintaining keep-alive connections + nullable: true + type: integer + maxconn: + nullable: true + type: integer + x-display-name: Max Connections + metadata: + additionalProperties: + type: object + mode: + enum: + - tcp + - http + - log + type: string + monitor_uri: + $ref: '#/components/schemas/monitor_uri' + mysql_check_params: + $ref: '#/components/schemas/mysql_check_params' + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + nolinger: + enum: + - enabled + - disabled + type: string + x-display-name: Nolinger + originalto: + $ref: '#/components/schemas/originalto' + persist: + enum: + - enabled + - disabled + type: string + x-display-name: Persist + persist_rule: + $ref: '#/components/schemas/persist_rule' + pgsql_check_params: + $ref: '#/components/schemas/pgsql_check_params' + prefer_last_server: + enum: + - enabled + - disabled + type: string + x-display-name: Prefer Last Server + queue_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + redispatch: + $ref: '#/components/schemas/redispatch' + retries: + nullable: true + type: integer + retry_on: + description: Specify when to attempt to automatically retry a failed request + type: string + server_fin_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + server_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + smtpchk_params: + $ref: '#/components/schemas/smtpchk_params' + socket_stats: + enum: + - enabled + - disabled + type: string + x-display-name: Socket Stats + source: + $ref: '#/components/schemas/source' + splice_auto: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Auto + splice_request: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Request + splice_response: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Response + srvtcpka: + enum: + - enabled + - disabled + type: string + x-display-name: Server TCP Keep Alive + srvtcpka_cnt: + nullable: true + type: integer + x-display-name: Srvtcpka Cnt + srvtcpka_idle: + nullable: true + type: integer + x-default-unit: s + x-display-name: Srvtcpka Idle + x-duration: true + srvtcpka_intvl: + nullable: true + type: integer + x-default-unit: s + x-display-name: Srvtcpka Intvl + x-duration: true + stats_options: + $ref: '#/components/schemas/stats_options' + tarpit_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + tcp_smart_accept: + enum: + - enabled + - disabled + type: string + x-display-name: Tcp Smart Accept + tcp_smart_connect: + enum: + - enabled + - disabled + type: string + x-display-name: Tcp Smart Connect + tcpka: + enum: + - enabled + - disabled + type: string + x-display-name: TCP Keep Alive + tcplog: + type: boolean + x-display-name: TCP Log + transparent: + enum: + - enabled + - disabled + type: string + x-display-name: Transparent + tunnel_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + unique_id_format: + type: string + x-display-name: Unique ID format + unique_id_header: + type: string + x-display-name: Unique ID header + required: + - name + title: Defaults Base + type: object + defaults_sections: + description: HAProxy defaults sections array + items: + $ref: '#/components/schemas/defaults' + title: Defaults Sections + type: array + x-go-type: models.DefaultsSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + device_atlas_options: + properties: + json_file: + type: string + x-display-name: JSON file + log_level: + type: string + x-display-name: Log Level + properties_cookie: + type: string + x-display-name: Properties Cookie + separator: + type: string + x-display-name: Separator + type: object + dgram_bind: + description: HAProxy log forward dgram bind configuration + properties: + address: + pattern: ^[^\s]+$ + type: string + interface: + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[^\s]+$ + type: string + namespace: + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + port-range-end: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + transparent: + type: boolean + required: + - name + title: Dgram Bind + type: object + x-go-type: models.DgramBind + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + dgram_binds: + description: HAProxy dgram bind array + items: + $ref: '#/components/schemas/dgram_bind' + title: Dgram Bind + type: array + x-go-type: models.DgramBinds + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + email_alert: + description: Send emails for important log messages. + properties: + from: + pattern: ^\S+@\S+$ + type: string + level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + type: string + mailers: + type: string + x-dynamic-enum: + operation: getMailersSections + property: name + metadata: + additionalProperties: + type: object + myhostname: + type: string + to: + pattern: ^\S+@\S+$ + type: string + required: + - from + - mailers + - to + title: Email Alert + type: object + email_alerts: + description: Email Alerts array (corresponds to email-alert directives) + items: + $ref: '#/components/schemas/email_alert' + title: Email Alerts Array + type: array + endpoint: + description: Endpoint definition + properties: + description: + description: Endpoint description + type: string + title: + description: Endpoint title + type: string + url: + description: Path to the endpoint + type: string + title: Endpoint + type: object + endpoints: + description: Collection of endpoints + items: + $ref: '#/components/schemas/endpoint' + title: Endpoints Array + type: array + x-go-type: models.Endpoints + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + environment_options: + properties: + presetenv: + items: + properties: + name: + type: string + x-display-name: Name + value: + type: string + x-display-name: Value + required: + - name + - value + type: object + x-go-name: PresetEnv + type: array + x-display-name: Preset environment variables + x-go-name: PresetEnvs + x-omitempty: true + resetenv: + description: Remove all environment variables except the ones specified + type: string + setenv: + items: + properties: + name: + type: string + x-display-name: Name + value: + type: string + x-display-name: Value + required: + - name + - value + type: object + x-go-name: SetEnv + type: array + x-display-name: Set environment variables + x-go-name: SetEnvs + x-omitempty: true + unsetenv: + description: Removes environment variables specified in arguments + type: string + type: object + error: + additionalProperties: + type: string + description: API Error + properties: + code: + nullable: true + type: integer + message: + nullable: true + type: string + required: + - code + - message + title: Error + type: object + x-go-type: models.Error + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + errorfile: + properties: + code: + enum: + - 200 + - 400 + - 401 + - 403 + - 404 + - 405 + - 407 + - 408 + - 410 + - 413 + - 425 + - 429 + - 500 + - 501 + - 502 + - 503 + - 504 + type: integer + file: + type: string + type: object + x-display-name: Error File + errorfiles: + properties: + codes: + items: + enum: + - 200 + - 400 + - 401 + - 403 + - 404 + - 405 + - 407 + - 408 + - 410 + - 413 + - 425 + - 429 + - 500 + - 501 + - 502 + - 503 + - 504 + type: integer + type: array + x-omitempty: true + metadata: + additionalProperties: + type: object + name: + type: string + type: object + errorloc: + properties: + code: + enum: + - 200 + - 400 + - 401 + - 403 + - 404 + - 405 + - 407 + - 408 + - 410 + - 413 + - 425 + - 429 + - 500 + - 501 + - 502 + - 503 + - 504 + type: integer + metadata: + additionalProperties: + type: object + url: + type: string + required: + - url + - code + type: object + fcgi_app: + allOf: + - $ref: '#/components/schemas/fcgi_app_base' + - properties: + acl_list: + $ref: '#/components/schemas/acls' + type: object + description: App with all its children resources + type: object + x-go-name: FCGIApp + x-go-type: models.FCGIApp + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + fcgi_app_base: + description: HAProxy FastCGI application configuration + properties: + docroot: + description: Defines the document root on the remote host. The parameter serves to build the default value of FastCGI parameters SCRIPT_FILENAME and PATH_TRANSLATED. It is a mandatory setting. + type: string + get_values: + description: Enables or disables the retrieval of variables related to connection management. + enum: + - enabled + - disabled + type: string + index: + description: Defines the script name to append after a URI that ends with a slash ("/") to set the default value for the FastCGI parameter SCRIPT_NAME. It is an optional setting. + type: string + keep_conn: + description: Tells the FastCGI application whether or not to keep the connection open after it sends a response. If disabled, the FastCGI application closes the connection after responding to this request. + enum: + - enabled + - disabled + type: string + log_stderrs: + items: + $ref: '#/components/schemas/fcgi_log_stderr' + type: array + x-omitempty: true + max_reqs: + default: 1 + description: Defines the maximum number of concurrent requests this application can accept. If the FastCGI application retrieves the variable FCGI_MAX_REQS during connection establishment, it can override this option. Furthermore, if the application does not do multiplexing, it will ignore this option. + minimum: 1 + type: integer + metadata: + additionalProperties: + type: object + mpxs_conns: + description: Enables or disables the support of connection multiplexing. If the FastCGI application retrieves the variable FCGI_MPXS_CONNS during connection establishment, it can override this option. + enum: + - enabled + - disabled + type: string + name: + description: Declares a FastCGI application + pattern: ^[^\s]+$ + type: string + pass_headers: + items: + $ref: '#/components/schemas/fcgi_pass_header' + type: array + x-omitempty: true + path_info: + description: |- + Defines a regular expression to extract the script-name and the path-info from the URI. + Thus, must have two captures: the first to capture the script name, and the second to capture the path- info. + If not defined, it does not perform matching on the URI, and does not fill the FastCGI parameters PATH_INFO and PATH_TRANSLATED. + type: string + set_params: + items: + $ref: '#/components/schemas/fcgi_set_param' + type: array + x-omitempty: true + required: + - name + - docroot + title: FCGI application base + type: object + fcgi_apps: + items: + $ref: '#/components/schemas/fcgi_app' + type: array + x-go-type: models.FCGIApps + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + fcgi_log_stderr: + description: |- + Enables logging of STDERR messages that the FastCGI application reports. + It is an optional setting. By default, HAProxy Enterprise ignores STDERR messages. + properties: + address: + type: string + facility: + title: Facility + type: string + format: + title: Format + type: string + global: + title: Global + type: boolean + len: + title: Length + type: integer + level: + title: Level + type: string + x-dependency: + facility: + required: true + minlevel: + title: Minimum level + type: string + x-dependency: + facility: + required: true + sample: + properties: + ranges: + title: Range + type: string + size: + title: Size + type: integer + required: + - ranges + - size + title: Sample + type: object + type: object + fcgi_pass_header: + description: |- + Specifies the name of a request header to pass to the FastCGI application. + Optionally, you can follow it with an ACL-based condition, in which case the FastCGI application evaluates it only if the condition is true. + Most request headers are already available to the FastCGI application with the prefix "HTTP". + Thus, you only need this directive to pass headers that are purposefully omitted. + Currently, the headers "Authorization", "Proxy-Authorization", and hop-by-hop headers are omitted. + Note that the headers "Content-type" and "Content-length" never pass to the FastCGI application because they are already converted into parameters. + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + name: + type: string + type: object + fcgi_set_param: + description: |- + Sets a FastCGI parameter to pass to this application. + Its value, defined by can take a formatted string, the same as the log directive. + Optionally, you can follow it with an ACL-based condition, in which case the FastCGI application evaluates it only if the condition is true. + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + format: + type: string + name: + type: string + type: object + fifty_one_degrees_options: + properties: + cache_size: + type: integer + x-display-name: Cache Size + data_file: + type: string + x-display-name: Data File + property_name_list: + type: string + x-display-name: Name List + property_separator: + type: string + x-display-name: Property Separator + type: object + filter: + additionalProperties: false + description: HAProxy filters + example: + trace_name: name + trace_rnd_parsing: true + type: trace + properties: + app_name: + description: Name of the fcgi-app section this filter will use. + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: fcgi-app + bandwidth_limit_name: + description: Filter name that will be used by 'set-bandwidth-limit' actions to reference a specific bandwidth limitation filter + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - bwlim-in + - bwlim-out + cache_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: cache + default_limit: + description: |- + The max number of bytes that can be forwarded over the period. + The value must be specified for per-stream and shared bandwidth limitation filters. + It follows the HAProxy size format and is expressed in bytes. + type: integer + x-dependency: + type: + required: true + value: + - bwlim-in + - bwlim-out + x-size: true + default_period: + description: |- + The default time period used to evaluate the bandwidth limitation rate. + It can be specified for per-stream bandwidth limitation filters only. + It follows the HAProxy time format and is expressed in milliseconds. + type: integer + x-default-unit: ms + x-dependency: + default_limit: + required: true + type: + required: true + value: + - bwlim-in + - bwlim-out + x-duration: true + key: + description: |- + A sample expression rule. + It describes what elements will be analyzed, extracted, combined, and used to select which table entry to update the counters. + It must be specified for shared bandwidth limitation filters only. + type: string + x-dependency: + limit: + required: true + type: + required: true + value: + - bwlim-in + - bwlim-out + limit: + description: |- + The max number of bytes that can be forwarded over the period. + The value must be specified for per-stream and shared bandwidth limitation filters. + It follows the HAProxy size format and is expressed in bytes. + type: integer + x-dependency: + type: + required: true + value: + - bwlim-in + - bwlim-out + x-size: true + metadata: + additionalProperties: + type: object + min_size: + description: |- + The optional minimum number of bytes forwarded at a time by a stream excluding the last packet that may be smaller. + This value can be specified for per-stream and shared bandwidth limitation filters. + It follows the HAProxy size format and is expressed in bytes. + type: integer + x-dependency: + type: + required: true + value: + - bwlim-in + - bwlim-out + x-size: true + spoe_config: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: spoe + spoe_engine: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: spoe + table: + description: |- + An optional table to be used instead of the default one, which is the stick-table declared in the current proxy. + It can be specified for shared bandwidth limitation filters only. + type: string + x-dependency: + limit: + required: true + type: + required: true + value: + - bwlim-in + - bwlim-out + trace_hexdump: + type: boolean + x-dependency: + type: + value: trace + trace_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: trace + trace_rnd_forwarding: + type: boolean + x-dependency: + type: + value: trace + x-display-name: Trace Random Forwarding + trace_rnd_parsing: + type: boolean + x-dependency: + type: + value: trace + x-display-name: Trace Random Parsing + type: + enum: + - bwlim-in + - bwlim-out + - cache + - compression + - fcgi-app + - spoe + - trace + type: string + required: + - type + title: Filter + type: object + x-go-type: models.Filter + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + filters: + description: HAProxy filters array (corresponds to filter directive) + items: + $ref: '#/components/schemas/filter' + title: Filters Array + type: array + x-go-type: models.Filters + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + forwardfor: + properties: + enabled: + enum: + - enabled + type: string + except: + pattern: ^[^\s]+$ + type: string + header: + pattern: ^[^\s]+$ + type: string + ifnone: + type: boolean + required: + - enabled + type: object + x-display-name: ForwardFor + frontend: + allOf: + - $ref: '#/components/schemas/frontend_base' + - properties: + acl_list: + $ref: '#/components/schemas/acls' + backend_switching_rule_list: + $ref: '#/components/schemas/backend_switching_rules' + binds: + additionalProperties: + $ref: '#/components/schemas/bind' + capture_list: + $ref: '#/components/schemas/captures' + filter_list: + $ref: '#/components/schemas/filters' + http_after_response_rule_list: + $ref: '#/components/schemas/http_after_response_rules' + http_error_rule_list: + $ref: '#/components/schemas/http_error_rules' + http_request_rule_list: + $ref: '#/components/schemas/http_request_rules' + http_response_rule_list: + $ref: '#/components/schemas/http_response_rules' + log_target_list: + $ref: '#/components/schemas/log_targets' + quic_initial_rule_list: + $ref: '#/components/schemas/quic_initial_rules' + ssl_front_use_list: + $ref: '#/components/schemas/ssl_front_uses' + tcp_request_rule_list: + $ref: '#/components/schemas/tcp_request_rules' + type: object + description: Frontend with all its children resources + type: object + x-go-name: Frontend + x-go-type: models.Frontend + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + frontend_base: + additionalProperties: false + description: HAProxy frontend configuration + example: + default_backend: test_backend + http_connection_mode: http-keep-alive + maxconn: 2000 + mode: http + name: test_frontend + properties: + abortonclose: + enum: + - enabled + - disabled + type: string + accept_invalid_http_request: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Invalid HTTP Request + accept_unsafe_violations_in_http_request: + enum: + - enabled + - disabled + type: string + x-display-name: Accept Unsafe Violations in HTTP Request + backlog: + nullable: true + type: integer + x-display-name: Backlog + clflog: + type: boolean + x-dependency: + mode: + value: http + x-display-name: CLF Log + client_fin_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + client_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + clitcpka: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: tcp + x-display-name: Client TCP Keep Alive + clitcpka_cnt: + nullable: true + type: integer + x-display-name: Clitcpka Cnt + clitcpka_idle: + nullable: true + type: integer + x-default-unit: s + x-display-name: Clitcpka Idle + x-duration: true + clitcpka_intvl: + nullable: true + type: integer + x-default-unit: s + x-display-name: Clitcpka Intvl + x-duration: true + compression: + $ref: '#/components/schemas/compression' + contstats: + enum: + - enabled + type: string + x-display-name: Continuous Statistics + default_backend: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + x-dynamic-enum: + operation: getBackends + property: name + description: + type: string + x-display-name: Description + disable_h2_upgrade: + enum: + - enabled + - disabled + type: string + x-display-name: Disable HTTP/2 Upgrade + disabled: + type: boolean + dontlog_normal: + enum: + - enabled + - disabled + type: string + dontlognull: + enum: + - enabled + - disabled + type: string + x-display-name: Don't Log Null + email_alert: + $ref: '#/components/schemas/email_alert' + enabled: + type: boolean + error_files: + items: + $ref: '#/components/schemas/errorfile' + type: array + x-go-name: ErrorFiles + x-omitempty: true + error_log_format: + type: string + errorfiles_from_http_errors: + items: + $ref: '#/components/schemas/errorfiles' + type: array + x-go-name: ErrorFilesFromHTTPErrors + x-omitempty: true + errorloc302: + $ref: '#/components/schemas/errorloc' + errorloc303: + $ref: '#/components/schemas/errorloc' + forwardfor: + $ref: '#/components/schemas/forwardfor' + from: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + guid: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + h1_case_adjust_bogus_client: + enum: + - enabled + - disabled + type: string + x-display-name: H1 Adjust Bogus Client + http-buffer-request: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP bufferrequest + http-drop-response-trailers: + enum: + - enabled + - disabled + type: string + x-display-name: Drop HTTP Response Trailers + http-use-htx: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: http + x-display-name: HTTP Use HTX + http_connection_mode: + enum: + - httpclose + - http-server-close + - http-keep-alive + type: string + x-dependency: + mode: + value: http + http_ignore_probes: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Ignore Probes + http_keep_alive_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + mode: + value: http + x-duration: true + http_no_delay: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP No Delay + http_request_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + mode: + value: http + x-duration: true + http_restrict_req_hdr_names: + enum: + - preserve + - delete + - reject + type: string + x-display-name: Restrict HTTP Request Header Names + http_use_proxy_header: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Use Proxy Header + httplog: + type: boolean + x-dependency: + mode: + value: http + x-display-name: HTTP Log + httpslog: + enum: + - enabled + - disabled + type: string + x-display-name: Httpslog + id: + nullable: true + type: integer + idle_close_on_response: + enum: + - enabled + - disabled + type: string + x-display-name: Idle Close On Response + independent_streams: + enum: + - enabled + - disabled + type: string + x-display-name: Independent Streams + log_format: + type: string + log_format_sd: + type: string + x-display-name: Log Format SD + log_separate_errors: + enum: + - enabled + - disabled + type: string + log_steps: + items: + enum: + - accept + - request + - connect + - response + - close + - error + - any + type: string + type: array + x-go-name: LogSteps + x-omitempty: true + log_tag: + pattern: ^[A-Za-z0-9-_.:${}"]+$ + type: string + logasap: + enum: + - enabled + - disabled + type: string + x-display-name: Log ASAP + maxconn: + nullable: true + type: integer + x-display-name: Max Connections + metadata: + additionalProperties: + type: object + mode: + enum: + - http + - tcp + type: string + monitor_fail: + $ref: '#/components/schemas/monitor_fail' + monitor_uri: + $ref: '#/components/schemas/monitor_uri' + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + nolinger: + enum: + - enabled + - disabled + type: string + x-display-name: Nolinger + originalto: + $ref: '#/components/schemas/originalto' + socket_stats: + enum: + - enabled + - disabled + type: string + x-display-name: Socket Stats + splice_auto: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Auto + splice_request: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Request + splice_response: + enum: + - enabled + - disabled + type: string + x-display-name: Splice Response + stats_options: + $ref: '#/components/schemas/stats_options' + stick_table: + $ref: '#/components/schemas/config_stick_table' + tarpit_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + tcp_smart_accept: + enum: + - enabled + - disabled + type: string + x-display-name: Tcp Smart Accept + tcpka: + enum: + - enabled + - disabled + type: string + x-dependency: + mode: + value: tcp + x-display-name: TCP Keep Alive + tcplog: + type: boolean + x-dependency: + mode: + value: tcp + x-display-name: TCP Log + unique_id_format: + type: string + x-display-name: Unique ID format + unique_id_header: + type: string + x-display-name: Unique ID header + required: + - name + title: Frontend Base + type: object + frontends: + description: HAProxy frontends array + items: + $ref: '#/components/schemas/frontend' + title: Frontends + type: array + x-go-type: models.Frontends + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + general_file: + description: General use file + properties: + description: + type: string + file: + type: string + id: + type: string + size: + description: File size in bytes. + nullable: true + type: integer + storage_name: + type: string + title: General use file + type: object + x-go-type: models.GeneralFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + general_files: + description: Array of general use files + items: + $ref: '#/components/schemas/general_file' + title: General Files Array + type: array + x-go-type: models.GeneralFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + global: + allOf: + - $ref: '#/components/schemas/global_base' + - properties: + log_target_list: + $ref: '#/components/schemas/log_targets' + type: object + description: Frontend with all its children resources + type: object + x-go-name: Global + x-go-type: models.Global + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + global_base: + additionalProperties: false + description: HAProxy global configuration + properties: + chroot: + pattern: ^[^\s]+$ + type: string + x-display-name: Chroot + close_spread_time: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + cluster_secret: + type: string + x-display-name: Cluster Secret + cpu_maps: + items: + properties: + cpu_set: + type: string + x-display-name: CPU Set + process: + type: string + x-display-name: Process/Thread Set + required: + - process + - cpu_set + type: object + x-go-name: CPUMap + type: array + x-display-name: CPU Maps + x-go-name: CPUMaps + x-omitempty: true + cpu_policy: + enum: + - none + - efficiency + - first-usable-node + - group-by-2-ccx + - group-by-2-clusters + - group-by-3-ccx + - group-by-3-clusters + - group-by-4-ccx + - group-by-4-cluster + - group-by-ccx + - group-by-cluster + - performance + - resource + type: string + x-display-name: CPU Policy + cpu_set: + items: + properties: + directive: + enum: + - reset + - drop-cpu + - only-cpu + - drop-node + - only-node + - drop-cluster + - only-cluster + - drop-core + - only-core + - drop-thread + - only-thread + type: string + set: + type: string + required: + - directive + type: object + x-go-name: CPUSet + type: array + x-display-name: CPU Set + x-go-name: CPUSets + x-omitempty: true + daemon: + type: boolean + debug_options: + $ref: '#/components/schemas/debug_options' + default_path: + properties: + path: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: origin + type: + enum: + - current + - config + - parent + - origin + type: string + required: + - type + type: object + x-go-name: GlobalDefaultPath + description: + description: Text that describes the instance + type: string + device_atlas_options: + $ref: '#/components/schemas/device_atlas_options' + dns_accept_family: + pattern: ^[^\s]+$ + type: string + x-display-name: DNS accept family + environment_options: + $ref: '#/components/schemas/environment_options' + expose_deprecated_directives: + type: boolean + expose_experimental_directives: + type: boolean + external_check: + type: boolean + x-display-name: External Check + fifty_one_degrees_options: + $ref: '#/components/schemas/fifty_one_degrees_options' + force_cfg_parser_pause: + description: Pause the configuration parser to simulate long reloads + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + gid: + type: integer + x-display-name: GID + grace: + description: Defines a delay between SIGUSR1 and real soft-stop + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + group: + pattern: ^[^\s]+$ + type: string + x-display-name: Group + h1_accept_payload_with_any_method: + type: boolean + h1_case_adjust: + items: + properties: + from: + type: string + to: + type: string + required: + - from + - to + type: object + x-go-name: H1CaseAdjust + type: array + x-go-name: H1CaseAdjusts + x-omitempty: true + h1_case_adjust_file: + type: string + h1_do_not_close_on_insecure_transfer_encoding: + type: boolean + h2_workaround_bogus_websocket_clients: + type: boolean + hard_stop_after: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Hard Stop After + x-duration: true + harden: + properties: + reject_privileged_ports: + properties: + quic: + enum: + - enabled + - disabled + type: string + tcp: + enum: + - enabled + - disabled + type: string + type: object + x-go-name: GlobalHardenRejectPrivilegedPorts + type: object + x-go-name: GlobalHarden + http_client_options: + $ref: '#/components/schemas/http_client_options' + http_err_codes: + description: Replace, reduce or extend the list of status codes that define an error + items: + $ref: '#/components/schemas/http_codes' + type: array + x-omitempty: true + http_fail_codes: + description: Replace, reduce or extend the list of status codes that define a failure + items: + $ref: '#/components/schemas/http_codes' + type: array + x-omitempty: true + insecure_fork_wanted: + type: boolean + insecure_setuid_wanted: + type: boolean + limited_quic: + type: boolean + localpeer: + pattern: ^[^\s]+$ + type: string + x-display-name: Local instance's peer name. + log_send_hostname: + properties: + enabled: + enum: + - enabled + - disabled + type: string + param: + pattern: ^[^\s]+$ + type: string + required: + - enabled + type: object + x-display-name: Log Send Hostname + x-go-name: GlobalLogSendHostname + lua_options: + $ref: '#/components/schemas/lua_options' + master-worker: + type: boolean + x-display-name: Master Worker Mode + metadata: + additionalProperties: + type: object + mworker_max_reloads: + description: The number of times a worker can survive a reload + minimum: 0 + nullable: true + type: integer + nbthread: + type: integer + x-display-name: Number of Threads + no_quic: + description: Disable the use of the QUIC protocol + type: boolean + x-display-name: Disable QUIC + node: + type: string + numa_cpu_mapping: + enum: + - enabled + - disabled + type: string + ocsp_update_options: + $ref: '#/components/schemas/ocsp_update_options' + performance_options: + $ref: '#/components/schemas/performance_options' + pidfile: + type: string + x-display-name: PID File + pp2_never_send_local: + type: boolean + prealloc_fd: + type: boolean + x-display-name: Prealloc FD + runtime_apis: + items: + allOf: + - $ref: '#/components/schemas/bind_params' + - properties: + address: + pattern: ^[^\s]+$ + type: string + name: + pattern: ^[^\s]+$ + type: string + required: + - address + type: object + x-go-name: RuntimeAPI + type: array + x-display-name: Runtime APIs + x-go-name: RuntimeAPIs + x-omitempty: true + set_dumpable: + type: boolean + set_var: + items: + properties: + expr: + type: string + x-display-name: Expression + name: + type: string + x-display-name: Name + required: + - name + - expr + type: object + x-go-name: SetVar + type: array + x-display-name: Set variables + x-go-name: SetVars + x-omitempty: true + set_var_fmt: + items: + properties: + format: + type: string + x-display-name: Format + name: + type: string + x-display-name: Name + required: + - name + - format + type: object + x-go-name: SetVarFmt + type: array + x-display-name: Set variable formats + x-go-name: SetVarFmts + x-omitempty: true + setcap: + pattern: ^[^\s]+$ + type: string + x-display-name: OS Capabilities + x-omitempty: true + shm_stats_file: + description: Shared Memory Statistics File (EXPERIMENTAL) + pattern: ^[^\s]+$ + type: string + shm_stats_file_max_objects: + description: Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL) + minimum: 0 + nullable: true + type: integer + ssl_options: + $ref: '#/components/schemas/ssl_options' + stats_file: + type: string + stats_maxconn: + nullable: true + type: integer + x-display-name: Stats maxconn + stats_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + strict_limits: + type: boolean + thread_group_lines: + items: + properties: + group: + type: string + x-display-name: Group + num_or_range: + type: string + x-display-name: Number or Range + required: + - group + - num_or_range + type: object + x-go-name: ThreadGroup + type: array + x-display-name: Thread Groups + x-go-name: ThreadGroupLines + x-omitempty: true + thread_groups: + type: integer + x-display-name: Number of Thread Groups + tune_buffer_options: + $ref: '#/components/schemas/tune_buffer_options' + tune_lua_options: + $ref: '#/components/schemas/tune_lua_options' + tune_options: + $ref: '#/components/schemas/tune_options' + tune_quic_options: + $ref: '#/components/schemas/tune_quic_options' + tune_ssl_options: + $ref: '#/components/schemas/tune_ssl_options' + tune_vars_options: + $ref: '#/components/schemas/tune_vars_options' + tune_zlib_options: + $ref: '#/components/schemas/tune_zlib_options' + uid: + type: integer + x-display-name: UID + ulimit_n: + type: integer + user: + pattern: ^[^\s]+$ + type: string + x-display-name: User + warn_blocked_traffic_after: + description: Delay after which a stuck task triggers a warning + minimum: 1 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + wurfl_options: + $ref: '#/components/schemas/wurfl_options' + title: Global Base + type: object + group: + description: HAProxy userlist group + properties: + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:${}"]+$ + type: string + users: + type: string + required: + - name + title: Group + type: object + x-go-type: models.Group + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + groups: + description: HAProxy userlist groups array + items: + $ref: '#/components/schemas/group' + title: Groups + type: array + x-go-type: models.Groups + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + hash_type: + properties: + function: + enum: + - sdbm + - djb2 + - wt6 + - crc32 + - none + type: string + method: + enum: + - map-based + - consistent + type: string + modifier: + enum: + - avalanche + type: string + type: object + health: + properties: + haproxy: + enum: + - up + - down + - unknown + type: string + type: object + x-go-type: models.Health + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_after_response_rule: + additionalProperties: false + description: HAProxy HTTP after response rule configuration (corresponds to http-after-response directives) + example: + cond: unless + cond_test: '{ src 192.168.0.0/16 }' + hdr_format: max-age=31536000 + hdr_name: Strict-Transport-Security + type: set-header + properties: + acl_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - del-acl + acl_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - del-acl + x-display-name: ACK Key Format + capture_id: + nullable: true + type: integer + x-dependency: + type: + value: capture + x-display-name: Capture SlotID + capture_len: + type: integer + x-dependency: + type: + required: true + value: capture + x-display-name: Capture Len + capture_sample: + pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+) + type: string + x-dependency: + type: + value: capture + x-display-name: Capture Sample + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + hdr_format: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + - set-header + - add-header + x-display-name: Header Format + hdr_match: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + x-display-name: Header Match + hdr_method: + type: string + x-dependency: + type: + value: + - del-header + x-display-name: Header Match Method + hdr_name: + type: string + x-dependency: + type: + required: true + value: + - add-header + - replace-header + - del-header + - set-header + - replace-value + x-display-name: Header Name + log_level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + - silent + type: string + x-dependency: + type: + required: true + value: set-log-level + map_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + map_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + x-display-name: Map Key Format + map_valuefmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: set-map + x-display-name: Map Value Format + metadata: + additionalProperties: + type: object + sc_expr: + type: string + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Expression Value + sc_id: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + sc_idx: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-set-gpt + sc_int: + nullable: true + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Integer Value + status: + maximum: 999 + minimum: 100 + type: integer + x-dependency: + type: + required: true + value: set-status + status_reason: + type: string + x-dependency: + type: + value: set-status + strict_mode: + enum: + - "on" + - "off" + type: string + x-dependency: + type: + required: true + value: strict-mode + type: + enum: + - add-header + - allow + - capture + - del-acl + - del-header + - del-map + - replace-header + - replace-value + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + - set-header + - set-log-level + - set-map + - set-status + - set-var + - set-var-fmt + - strict-mode + - unset-var + - do-log + type: string + var_expr: + type: string + x-dependency: + type: + required: true + value: set-var + x-display-name: Var Expression + var_format: + type: string + x-dependency: + type: + required: true + value: set-var-fmt + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + required: + - type + title: HTTP after Response Rule + type: object + x-go-type: models.HTTPAfterResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_after_response_rules: + description: HAProxy HTTP after response rules array (corresponds to http-after-response directives) + items: + $ref: '#/components/schemas/http_after_response_rule' + title: HTTP After Response Rules Array + type: array + x-go-type: models.HTTPAfterResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_check: + properties: + addr: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: connect + alpn: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: connect + x-display-name: ALPN Protocols + body: + type: string + x-dependency: + type: + value: send + body_log_format: + type: string + x-dependency: + type: + value: send + check_comment: + type: string + x-dependency: + type: + value: + - comment + - connect + - expect + - send + default: + type: boolean + x-dependency: + type: + value: connect + error_status: + enum: + - L7OKC + - L7RSP + - L7STS + - L6RSP + - L4CON + type: string + x-dependency: + type: + value: expect + exclamation_mark: + type: boolean + x-dependency: + type: + value: expect + x-display-name: Expect Exclamation Mark + headers: + items: + $ref: '#/components/schemas/return_header' + type: array + x-dependency: + type: + value: send + x-go-name: CheckHeaders + x-omitempty: true + linger: + type: boolean + x-dependency: + type: + value: connect + match: + enum: + - status + - rstatus + - hdr + - fhdr + - string + - rstring + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: expect + x-display-name: Expect Match + metadata: + additionalProperties: + type: object + method: + enum: + - HEAD + - PUT + - POST + - GET + - TRACE + - PATCH + - DELETE + - CONNECT + - OPTIONS + type: string + x-dependency: + type: + value: send + min_recv: + nullable: true + type: integer + x-dependency: + type: + value: expect + ok_status: + enum: + - L7OK + - L7OKC + - L6OK + - L4OK + type: string + x-dependency: + type: + value: expect + on_error: + type: string + x-dependency: + type: + value: expect + on_success: + type: string + x-dependency: + type: + value: expect + pattern: + type: string + x-dependency: + type: + required: true + value: expect + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + x-dependency: + type: + value: connect + port_string: + type: string + x-dependency: + type: + value: connect + proto: + type: string + x-dependency: + type: + value: connect + send_proxy: + type: boolean + x-dependency: + type: + value: connect + sni: + type: string + x-dependency: + type: + value: connect + ssl: + type: boolean + x-dependency: + type: + value: connect + status-code: + type: string + x-dependency: + type: + value: expect + tout_status: + enum: + - L7TOUT + - L6TOUT + - L4TOUT + type: string + x-dependency: + type: + value: expect + type: + enum: + - comment + - connect + - disable-on-404 + - expect + - send + - send-state + - set-var + - set-var-fmt + - unset-var + type: string + uri: + type: string + x-dependency: + type: + value: send + uri_log_format: + type: string + x-dependency: + type: + value: send + var_expr: + type: string + x-dependency: + type: + required: true + value: + - set-var + x-display-name: Var Expression + var_format: + type: string + x-dependency: + type: + required: true + value: + - set-var-fmt + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + version: + type: string + x-dependency: + type: + value: send + via_socks4: + type: boolean + x-dependency: + type: + value: connect + required: + - type + title: HTTP Check + type: object + x-go-type: models.HTTPCheck + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_checks: + items: + $ref: '#/components/schemas/http_check' + title: HTTP Checks Array + type: array + x-go-type: models.HTTPChecks + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_client_options: + properties: + resolvers_disabled: + enum: + - enabled + - disabled + type: string + x-display-name: HTTP Client Resolvers Disabled + resolvers_id: + type: string + x-display-name: HTTP Client Resolvers ID + resolvers_prefer: + enum: + - ipv4 + - ipv6 + type: string + x-display-name: HTTP Client Resolvers Prefer + retries: + type: integer + x-display-name: HTTP Client Retries + ssl_ca_file: + type: string + x-display-name: HTTP Client SSL CA File + ssl_verify: + enum: + - "" + - none + - required + nullable: true + type: string + x-display-name: HTTP Client SSL Verify + timeout_connect: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: HTTP Client Connect Timeout + x-duration: true + type: object + http_codes: + properties: + value: + pattern: ^[a-zA-Z0-9 +\-,]+$ + type: string + x-display-name: Value + required: + - value + type: object + x-go-name: HTTPCodes + http_error_rule: + additionalProperties: false + description: HAProxy HTTP error rule configuration (corresponds to http-error directives) + example: + index: 0 + status: 425 + type: status + properties: + metadata: + additionalProperties: + type: object + return_content: + type: string + x-dependency: + return_content_format: + required: true + value: + - errofile + - errorfiles + - file + - lf-file + - string + - lf-string + return_content_format: + enum: + - default-errorfiles + - errorfile + - errorfiles + - file + - lf-file + - string + - lf-string + type: string + x-dependency: + type: + value: status + return_content_type: + nullable: true + type: string + x-dependency: + type: + value: status + x-display-name: Return content type + return_hdrs: + items: + $ref: '#/components/schemas/return_header' + type: array + x-dependency: + return_content_format: + value: + - file + - lf-file + - string + - lf-string + x-go-name: ReturnHeaders + x-omitempty: true + status: + enum: + - 200 + - 400 + - 401 + - 403 + - 404 + - 405 + - 407 + - 408 + - 410 + - 413 + - 425 + - 429 + - 500 + - 501 + - 502 + - 503 + - 504 + type: integer + x-dependency: + type: + required: true + value: status + type: + enum: + - status + type: string + required: + - type + - status + title: HTTP Error Rule + type: object + x-go-type: models.HTTPErrorRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_error_rules: + description: HAProxy HTTP error rules array (corresponds to http-error directives) + items: + $ref: '#/components/schemas/http_error_rule' + title: HTTP Error Rules Array + type: array + x-go-type: models.HTTPErrorRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_errors_section: + additionalProperties: false + description: A globally declared group of HTTP errors + example: + error_files: + - code: 400 + name: /etc/haproxy/errorfiles/site1/400.http + - code: 404 + name: /etc/haproxy/errorfiles/site1/404.http + name: website-1 + properties: + error_files: + items: + $ref: '#/components/schemas/errorfile' + type: array + x-go-name: ErrorFiles + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_]+$ + type: string + required: + - name + - error_files + title: http-errors section + type: object + x-go-type: models.HTTPErrorsSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_errors_sections: + description: An array of HAProxy http-error sections + items: + $ref: '#/components/schemas/http_errors_section' + title: http-errors sections + type: array + x-go-type: models.HTTPErrorsSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_request_rule: + additionalProperties: false + description: HAProxy HTTP request rule configuration (corresponds to http-request directives) + example: + cond: unless + cond_test: '{ src 192.168.0.0/16 }' + hdr_format: '%T' + hdr_name: X-Haproxy-Current-Date + index: 0 + type: add-header + properties: + acl_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - add-acl + - del-acl + x-display-name: ACL File + acl_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - add-acl + - del-acl + x-display-name: ACL Key Format + auth_realm: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: auth + x-display-name: Authentication Realm + bandwidth_limit_limit: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Standard HAProxy expression + bandwidth_limit_name: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Bandwidth limit name + bandwidth_limit_period: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Standard HAProxy expression + cache_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: cache-use + x-display-name: Cache Name + capture_id: + nullable: true + type: integer + x-dependency: + type: + value: capture + x-display-name: Capture SlotID + capture_len: + type: integer + x-dependency: + type: + required: true + value: capture + x-display-name: Capture Len + capture_sample: + pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+) + type: string + x-dependency: + type: + value: capture + x-display-name: Capture Sample + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + deny_status: + maximum: 599 + minimum: 200 + nullable: true + type: integer + x-dependency: + type: + value: + - deny + - tarpit + expr: + type: string + x-dependency: + type: + required: true + value: + - do-resolve + - pause + - set-bc-mark + - set-bc-tos + - set-dst + - set-dst-port + - set-fc-mark + - set-fc-tos + - set-priority-class + - set-priority-offset + - set-src + - set-src-port + - set-retries + x-display-name: Standard HAProxy expression + hdr_format: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + - set-header + - add-header + x-display-name: Header Format + hdr_match: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + x-display-name: Header Match + hdr_method: + type: string + x-dependency: + type: + value: + - del-header + x-display-name: Header Match Method + hdr_name: + type: string + x-dependency: + type: + required: true + value: + - add-header + - replace-header + - del-header + - set-header + - replace-value + x-display-name: Header Name + hint_format: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: early-hint + x-display-name: Hint Format + hint_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: early-hint + x-display-name: Hint Name + log_level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + - silent + type: string + x-dependency: + type: + required: true + value: set-log-level + lua_action: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: lua + lua_params: + type: string + x-dependency: + type: + value: lua + map_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + map_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + x-display-name: Map Key Format + map_valuefmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: set-map + x-display-name: Map Value Format + mark_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + type: + required: true + value: set-mark + x-display-name: Mark Value + metadata: + additionalProperties: + type: object + method_fmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: set-method + nice_value: + maximum: 1024 + minimum: -1024 + type: integer + x-dependency: + type: + required: true + value: set-nice + x-display-name: Nice Value + normalizer: + enum: + - fragment-encode + - fragment-strip + - path-merge-slashes + - path-strip-dot + - path-strip-dotdot + - percent-decode-unreserved + - percent-to-uppercase + - query-sort-by-name + type: string + x-dependency: + type: + required: true + value: normalize-uri + normalizer_full: + type: boolean + x-dependency: + normalizer: + value: path-strip-dotdot + type: + value: normalize-uri + normalizer_strict: + type: boolean + x-dependency: + normalizer: + value: + - percent-decode-unreserved + - percent-to-uppercase + type: + value: normalize-uri + path_fmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-path + - set-pathq + - replace-path + - replace-pathq + path_match: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-path + - set-pathq + - replace-path + - replace-pathq + protocol: + enum: + - ipv4 + - ipv6 + type: string + x-dependency: + type: + required: false + value: do-resolve + x-display-name: Protocol + query-fmt: + type: string + x-dependency: + type: + required: true + value: set-query + redir_code: + enum: + - 301 + - 302 + - 303 + - 307 + - 308 + nullable: true + type: integer + x-dependency: + type: + value: redirect + x-display-name: Redirect Code + redir_option: + type: string + x-dependency: + type: + value: redirect + x-display-name: Redirect Option + redir_type: + enum: + - location + - prefix + - scheme + type: string + x-dependency: + type: + required: true + value: redirect + x-display-name: Redirect Type + redir_value: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: redirect + x-display-name: Redirect Value + resolvers: + type: string + x-dependency: + type: + required: true + value: do-resolve + x-display-name: Resolvers + return_content: + type: string + x-dependency: + return_content_format: + required: true + value: + - errofile + - errorfiles + - file + - lf-file + - string + - lf-string + return_content_format: + enum: + - default-errorfiles + - errorfile + - errorfiles + - file + - lf-file + - string + - lf-string + type: string + x-dependency: + type: + value: + - deny + - tarpit + - return + return_content_type: + nullable: true + type: string + x-dependency: + type: + value: + - deny + - tarpit + - return + x-display-name: Return content type + return_hdrs: + items: + $ref: '#/components/schemas/return_header' + type: array + x-dependency: + return_content_format: + value: + - file + - lf-file + - string + - lf-string + x-go-name: ReturnHeaders + x-omitempty: true + return_status_code: + maximum: 599 + minimum: 200 + nullable: true + type: integer + x-dependency: + type: + value: return + x-display-name: Return Error Code + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL + sc_expr: + type: string + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Expression Value + sc_id: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + sc_idx: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-set-gpt + sc_int: + nullable: true + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Integer Value + service_name: + type: string + x-dependency: + type: + required: true + value: use-service + spoe_engine: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: send-spoe-group + x-display-name: SPOE Engine + spoe_group: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: send-spoe-group + x-display-name: SPOE Group + strict_mode: + enum: + - "on" + - "off" + type: string + x-dependency: + type: + required: true + value: strict-mode + timeout: + type: string + x-dependency: + type: + required: true + value: set-timeout + timeout_type: + enum: + - server + - tunnel + - client + type: string + x-dependency: + type: + required: true + value: set-timeout + tos_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + type: + required: true + value: set-tos + x-display-name: Tos Value + track_sc_key: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: track-sc + x-display-name: track-sc Key + track_sc_stick_counter: + nullable: true + type: integer + x-dependency: + type: + value: track-sc + x-display-name: track-sc StickCounter + track_sc_table: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: track-sc + x-display-name: track-sc Table + type: + enum: + - add-acl + - add-header + - allow + - auth + - cache-use + - capture + - del-acl + - del-header + - del-map + - deny + - disable-l7-retry + - do-resolve + - early-hint + - lua + - normalize-uri + - pause + - redirect + - reject + - replace-header + - replace-path + - replace-pathq + - replace-uri + - replace-value + - return + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + - send-spoe-group + - set-bc-mark + - set-bc-tos + - set-dst + - set-dst-port + - set-fc-mark + - set-fc-tos + - set-header + - set-log-level + - set-map + - set-mark + - set-method + - set-nice + - set-path + - set-pathq + - set-priority-class + - set-priority-offset + - set-query + - set-src + - set-src-port + - set-timeout + - set-tos + - set-uri + - set-var + - set-var-fmt + - silent-drop + - strict-mode + - tarpit + - track-sc + - unset-var + - use-service + - wait-for-body + - wait-for-handshake + - set-bandwidth-limit + - set-retries + - do-log + type: string + uri-fmt: + type: string + x-dependency: + type: + required: true + value: + - set-uri + - replace-uri + uri-match: + type: string + x-dependency: + type: + required: true + value: replace-uri + var_expr: + type: string + x-dependency: + type: + required: true + value: set-var + x-display-name: Var Expression + var_format: + type: string + x-dependency: + type: + required: true + value: set-var-fmt + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - do-resolve + - unset-var + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + wait_at_least: + nullable: true + type: integer + x-dependency: + type: + value: wait-for-body + x-size: true + wait_time: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + type: + required: true + value: wait-for-body + x-duration: true + required: + - type + title: HTTP Request Rule + type: object + x-go-type: models.HTTPRequestRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_request_rules: + description: HAProxy HTTP request rules array (corresponds to http-request directives) + items: + $ref: '#/components/schemas/http_request_rule' + title: HTTP Request Rules Array + type: array + x-go-type: models.HTTPRequestRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_response_rule: + additionalProperties: false + description: HAProxy HTTP response rule configuration (corresponds to http-response directives) + example: + cond: unless + cond_test: '{ src 192.168.0.0/16 }' + hdr_format: '%T' + hdr_name: X-Haproxy-Current-Date + index: 0 + type: add-header + properties: + acl_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - add-acl + - del-acl + acl_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - add-acl + - del-acl + x-display-name: ACK Key Format + bandwidth_limit_limit: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Standard HAProxy expression + bandwidth_limit_name: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Bandwidth limit name + bandwidth_limit_period: + type: string + x-dependency: + type: + value: set-bandwidth-limit + x-display-name: Standard HAProxy expression + cache_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: cache-store + x-display-name: Cache Name + capture_id: + nullable: true + type: integer + x-dependency: + type: + required: true + value: capture + x-display-name: Capture SlotID + capture_sample: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: capture + x-display-name: Capture Sample + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + deny_status: + maximum: 599 + minimum: 200 + nullable: true + type: integer + x-dependency: + type: + value: deny + expr: + type: string + x-dependency: + type: + required: true + value: + - pause + - set-fc-mark + - set-fc-tos + x-display-name: Standard HAProxy expression + hdr_format: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + - set-header + - add-header + x-display-name: Header Format + hdr_match: + type: string + x-dependency: + type: + required: true + value: + - replace-header + - replace-value + x-display-name: Header Match + hdr_method: + type: string + x-dependency: + type: + value: + - del-header + x-display-name: Header Match Method + hdr_name: + type: string + x-dependency: + type: + required: true + value: + - add-header + - replace-header + - del-header + - set-header + - replace-value + x-display-name: Header Name + log_level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + - silent + type: string + x-dependency: + type: + required: true + value: set-log-level + lua_action: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: lua + lua_params: + type: string + x-dependency: + type: + value: lua + map_file: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + map_keyfmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-map + - del-map + x-display-name: Map Key Format + map_valuefmt: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: set-map + x-display-name: Map Value Format + mark_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + type: + required: true + value: set-mark + x-display-name: Mark Value + metadata: + additionalProperties: + type: object + nice_value: + maximum: 1024 + minimum: -1024 + type: integer + x-dependency: + type: + required: true + value: set-nice + x-display-name: Nice Value + redir_code: + enum: + - 301 + - 302 + - 303 + - 307 + - 308 + nullable: true + type: integer + x-dependency: + type: + value: redirect + x-display-name: Redirect Code + redir_option: + type: string + x-dependency: + type: + required: true + value: redirect + x-display-name: Redirect Option + redir_type: + enum: + - location + - prefix + - scheme + type: string + x-dependency: + type: + required: true + value: redirect + x-display-name: Redirect Type + redir_value: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: redirect + x-display-name: Redirect Value + return_content: + type: string + x-dependency: + return_content_format: + required: true + value: + - errofile + - errorfiles + - file + - lf-file + - string + - lf-string + return_content_format: + enum: + - default-errorfiles + - errorfile + - errorfiles + - file + - lf-file + - string + - lf-string + type: string + x-dependency: + type: + value: + - deny + - return + return_content_type: + nullable: true + type: string + x-dependency: + type: + value: + - deny + - return + x-display-name: Return content type + return_hdrs: + items: + $ref: '#/components/schemas/return_header' + type: array + x-dependency: + return_content_format: + value: + - file + - lf-file + - string + - lf-string + x-go-name: ReturnHeaders + x-omitempty: true + return_status_code: + maximum: 599 + minimum: 200 + nullable: true + type: integer + x-dependency: + type: + value: return + x-display-name: Return Error Code + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL + sc_expr: + type: string + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Expression Value + sc_id: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + sc_idx: + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-set-gpt + sc_int: + nullable: true + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Integer Value + spoe_engine: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: send-spoe-group + spoe_group: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: send-spoe-group + status: + maximum: 999 + minimum: 100 + type: integer + x-dependency: + type: + required: true + value: set-status + status_reason: + type: string + x-dependency: + type: + value: set-status + strict_mode: + enum: + - "on" + - "off" + type: string + x-dependency: + type: + required: true + value: strict-mode + timeout: + type: string + x-dependency: + type: + required: true + value: set-timeout + timeout_type: + enum: + - server + - tunnel + - client + type: string + x-dependency: + type: + required: true + value: set-timeout + tos_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + type: + required: true + value: set-tos + x-display-name: Tos Value + track_sc_key: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: track-sc + x-display-name: track-sc Key + track_sc_stick_counter: + nullable: true + type: integer + x-dependency: + type: + value: track-sc + x-display-name: track-sc StickCounter + track_sc_table: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: track-sc + x-display-name: track-sc Table + type: + enum: + - add-acl + - add-header + - allow + - cache-store + - capture + - del-acl + - del-header + - del-map + - deny + - lua + - pause + - redirect + - replace-header + - replace-value + - return + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + - send-spoe-group + - set-fc-mark + - set-fc-tos + - set-header + - set-log-level + - set-map + - set-mark + - set-nice + - set-status + - set-timeout + - set-tos + - set-var + - set-var-fmt + - silent-drop + - strict-mode + - track-sc + - unset-var + - wait-for-body + - set-bandwidth-limit + - do-log + type: string + var_expr: + type: string + x-dependency: + type: + required: true + value: set-var + x-display-name: Var Expression + var_format: + type: string + x-dependency: + type: + required: true + value: set-var-fmt + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + required: true + value: + - set-var + - set-var-fmt + - unset-var + wait_at_least: + nullable: true + type: integer + x-dependency: + type: + value: wait-for-body + x-size: true + wait_time: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-dependency: + type: + required: true + value: wait-for-body + x-duration: true + required: + - type + title: HTTP Response Rule + type: object + x-go-type: models.HTTPResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_response_rules: + description: HAProxy HTTP response rules array (corresponds to http-response directives) + items: + $ref: '#/components/schemas/http_response_rule' + title: HTTP Response Rules Array + type: array + x-go-type: models.HTTPResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + httpchk_params: + properties: + host: + type: string + method: + enum: + - HEAD + - PUT + - POST + - GET + - TRACE + - PATCH + - DELETE + - CONNECT + - OPTIONS + type: string + uri: + pattern: ^[^ ]*$ + type: string + version: + type: string + type: object + x-display-name: HTTP Check + info: + description: General API, OS and hardware information + example: + api: + build_date: "2019-08-21T17:31:56.000Z" + version: v1.2.1 45a3288.dev + system: + cpu_info: + model: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz + num_cpus: 4 + hostname: test + mem_info: + dataplaneapi_memory: 4.4755536e+07 + free_memory: 5.790642176e+09 + total_memory: 1.6681517056e+10 + os_string: 'Linux 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019' + time: 1.566401525e+09 + uptime: 87340 + properties: + api: + properties: + build_date: + description: HAProxy Dataplane API build date + format: date-time + type: string + version: + description: HAProxy Dataplane API version string + type: string + type: object + system: + properties: + cpu_info: + properties: + model: + type: string + num_cpus: + description: Number of logical CPUs + type: integer + type: object + hostname: + description: Hostname where the HAProxy is running + type: string + mem_info: + properties: + dataplaneapi_memory: + type: integer + free_memory: + type: integer + total_memory: + type: integer + type: object + os_string: + description: OS string + type: string + time: + description: Current time in milliseconds since Epoch. + type: integer + uptime: + description: System uptime + nullable: true + type: integer + type: object + title: Information + type: object + x-go-type: models.Info + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_forward: + allOf: + - $ref: '#/components/schemas/log_forward_base' + - properties: + binds: + additionalProperties: + $ref: '#/components/schemas/bind' + dgram_binds: + additionalProperties: + $ref: '#/components/schemas/dgram_bind' + log_target_list: + $ref: '#/components/schemas/log_targets' + type: object + description: LogForward with all its children resources + type: object + x-go-name: LogForward + x-go-type: models.LogForward + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_forward_base: + additionalProperties: false + description: HAProxy log forward configuration + properties: + assume-rfc6587-ntf: + type: boolean + x-display-name: Assume RFC-6587 Non-Transparent Framing + backlog: + nullable: true + type: integer + dont-parse-log: + type: boolean + x-display-name: Don't Parse Log + maxconn: + nullable: true + type: integer + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + timeout_client: + maximum: 2.147483647e+09 + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + required: + - name + title: Log Forward + type: object + log_forwards: + description: HAProxy log forwards array + items: + $ref: '#/components/schemas/log_forward' + title: Log Forwards + type: array + x-go-type: models.LogForwards + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_profile: + description: Defines a logging profile for one or more steps. + properties: + log_tag: + description: Override syslog log tag set by other "log-tag" directives. + type: string + metadata: + additionalProperties: + type: object + name: + description: Name of the logging profile. + minLength: 1 + type: string + steps: + $ref: '#/components/schemas/log_profile_steps' + required: + - name + title: Log Profile + type: object + x-go-type: models.LogProfile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_profile_step: + description: Defines what to log for a given step. + properties: + drop: + description: If enabled, no log shall be emitted for the given step. + enum: + - enabled + - disabled + type: string + format: + description: Override "log-format" or "error-log-format" strings depending on the step. + type: string + metadata: + additionalProperties: + type: object + sd: + description: Override the "log-format-sd" string. + type: string + step: + description: Logging step name. + enum: + - accept + - any + - close + - connect + - error + - request + - response + - http-req + - http-res + - http-after-res + - quic-init + - tcp-req-conn + - tcp-req-cont + - tcp-req-sess + type: string + required: + - step + title: Log Profile Step + type: object + log_profile_steps: + description: List of steps where to override the logging. + items: + $ref: '#/components/schemas/log_profile_step' + type: array + x-omitempty: true + log_profiles: + description: List of Logging Profiles + items: + $ref: '#/components/schemas/log_profile' + type: array + x-go-type: models.LogProfiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_target: + additionalProperties: false + description: Per-instance logging of events and traffic. + properties: + address: + pattern: ^[^\s]+$ + type: string + x-dependency: + global: + required: true + value: false + nolog: + required: true + value: false + facility: + enum: + - kern + - user + - mail + - daemon + - auth + - syslog + - lpr + - news + - uucp + - cron + - auth2 + - ftp + - ntp + - audit + - alert + - cron2 + - local0 + - local1 + - local2 + - local3 + - local4 + - local5 + - local6 + - local7 + type: string + x-dependency: + global: + required: true + value: false + nolog: + required: true + value: false + format: + enum: + - local + - rfc3164 + - rfc5424 + - priority + - short + - timed + - iso + - raw + type: string + x-dependency: + global: + value: false + nolog: + value: false + global: + type: boolean + length: + type: integer + x-dependency: + global: + value: false + nolog: + value: false + level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + type: string + x-dependency: + global: + value: false + nolog: + value: false + metadata: + additionalProperties: + type: object + minlevel: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + type: string + x-dependency: + global: + value: false + level: + required: false + nolog: + value: false + nolog: + type: boolean + profile: + type: string + sample_range: + type: string + x-dependency: + global: + value: false + nolog: + value: false + sample_size: + type: integer + x-dependency: + global: + value: false + nolog: + value: false + sample_range: + required: true + title: Log Target + type: object + x-go-type: models.LogTarget + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_targets: + description: HAProxy log target array (corresponds to log directives) + items: + $ref: '#/components/schemas/log_target' + title: Log Target Array + type: array + x-go-type: models.LogTargets + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + lua_options: + properties: + load_per_thread: + type: string + loads: + items: + properties: + file: + pattern: ^[^\s]+$ + type: string + required: + - file + type: object + x-go-name: LuaLoad + type: array + x-omitempty: true + prepend_path: + items: + properties: + path: + pattern: ^[^\s]+$ + type: string + type: + enum: + - path + - cpath + type: string + required: + - path + type: object + x-go-name: LuaPrependPath + type: array + x-omitempty: true + type: object + mailer_entries: + description: HAProxy mailer entries + items: + $ref: '#/components/schemas/mailer_entry' + title: Mailer Entries + type: array + x-go-type: models.MailerEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailer_entry: + description: Mailer entry of a Mailers section + properties: + address: + pattern: ^\S+$ + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_${}"]+$ + type: string + port: + maximum: 65535 + minimum: 1 + type: integer + required: + - name + - address + - port + title: Mailer Entry + type: object + x-go-type: models.MailerEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailers_section: + allOf: + - $ref: '#/components/schemas/mailers_section_base' + - properties: + mailer_entries: + additionalProperties: + $ref: '#/components/schemas/mailer_entry' + type: object + description: MailersSection with all its children resources + type: object + x-go-name: MailersSection + x-go-type: models.MailersSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailers_section_base: + additionalProperties: false + description: A list of SMTP servers used by HAProxy to send emails. + properties: + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_]+$ + type: string + timeout: + description: Timeout to send an email in milliseconds + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + required: + - name + title: Mailers Section Base + type: object + mailers_sections: + description: HAProxy mailers_section array + items: + $ref: '#/components/schemas/mailers_section' + title: Mailers Sections + type: array + x-go-type: models.MailersSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map: + description: Map File + properties: + description: + type: string + file: + type: string + id: + type: string + size: + description: File size in bytes. + nullable: true + type: integer + storage_name: + type: string + title: Map File + type: object + x-go-type: models.Map + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map_entries: + description: Entries of one runtime map + items: + $ref: '#/components/schemas/map_entry' + title: Maps Entries + type: array + x-go-type: models.MapEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map_entry: + description: One Map Entry + properties: + id: + readOnly: true + type: string + key: + type: string + value: + type: string + title: One Map Entry + type: object + x-go-type: models.MapEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + maps: + description: Array of runtime map files + items: + $ref: '#/components/schemas/map' + title: Map Files Array + type: array + x-go-type: models.Maps + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + monitor_fail: + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + required: + - cond + - cond_test + type: object + monitor_uri: + type: string + mysql_check_params: + properties: + client_version: + enum: + - pre-41 + - post-41 + type: string + username: + type: string + type: object + nameserver: + description: Nameserver used in Runtime DNS configuration + example: + address: 10.0.0.1 + name: ns1 + port: 53 + properties: + address: + pattern: ^[^\s]+$ + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:${}"]+$ + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + required: + - name + - address + title: Nameserver + type: object + x-go-type: models.Nameserver + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + nameservers: + description: Nameservers array + items: + $ref: '#/components/schemas/nameserver' + title: Nameservers + type: array + x-go-type: models.Nameservers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + native_stat: + description: Current stats for one object. + properties: + backend_name: + type: string + x-dependency: + type: server + name: + type: string + stats: + $ref: '#/components/schemas/native_stat_stats' + type: + enum: + - backend + - server + - frontend + type: string + title: Stats + type: object + native_stat_stats: + example: + bin: 4.326578e+06 + bout: 8.8990129e+08 + comp_byp: 0 + comp_in: 0 + comp_out: 0 + comp_rsp: 0 + conn_rate: 12 + conn_rate_max: 456 + conn_tot: 45682 + dcon: 0 + dreq: 4 + dresp: 1 + dses: 0 + ereq: 54 + hrsp_1xx: 0 + hrsp_2xx: 165 + hrsp_3xx: 12 + hrsp_4xx: 50 + hrsp_5xx: 4 + hrsp_other: 0 + iid: 0 + intercepted: 346 + last_chk: L4OK in 0ms + mode: http + pid: 3204 + rate: 64 + rate_lim: 20000 + rate_max: 4000 + req_rate: 49 + req_rate_max: 3965 + req_total: 1.254786e+06 + scur: 129 + slim: 2000 + smax: 2000 + status: UP + stot: 12902 + properties: + act: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + addr: + type: string + x-dependency: + type: server + agent_code: + nullable: true + type: integer + x-dependency: + type: server + agent_desc: + type: string + x-dependency: + type: server + agent_duration: + nullable: true + type: integer + x-dependency: + type: server + agent_fall: + nullable: true + type: integer + x-dependency: + type: server + agent_health: + nullable: true + type: integer + x-dependency: + type: server + agent_rise: + nullable: true + type: integer + x-dependency: + type: server + agent_status: + enum: + - UNK + - INI + - SOCKERR + - L4OK + - L4TOUT + - L4CON + - L7OK + - L7STS + type: string + x-dependency: + type: server + algo: + type: string + x-dependency: + type: backend + bck: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + bin: + nullable: true + type: integer + bout: + nullable: true + type: integer + check_code: + nullable: true + type: integer + x-dependency: + type: server + check_desc: + type: string + x-dependency: + type: server + check_duration: + nullable: true + type: integer + x-dependency: + type: server + check_fall: + nullable: true + type: integer + x-dependency: + type: server + check_health: + nullable: true + type: integer + x-dependency: + type: server + check_rise: + nullable: true + type: integer + x-dependency: + type: server + check_status: + enum: + - UNK + - INI + - SOCKERR + - L4OK + - L4TOUT + - L4CON + - L6OK + - L6TOUT + - L6RSP + - L7OK + - L7OKC + - L7TOUT + - L7RSP + - L7STS + type: string + x-dependency: + type: server + chkdown: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + chkfail: + nullable: true + type: integer + x-dependency: + type: server + cli_abrt: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + comp_byp: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + comp_in: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + comp_out: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + comp_rsp: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + conn_rate: + nullable: true + type: integer + x-dependency: + type: frontend + conn_rate_max: + nullable: true + type: integer + x-dependency: + type: frontend + conn_tot: + nullable: true + type: integer + x-dependency: + type: frontend + cookie: + type: string + x-dependency: + type: + - server + - backend + ctime: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + dcon: + nullable: true + type: integer + x-dependency: + type: frontend + downtime: + nullable: true + type: integer + x-dependency: + type: server + dreq: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + dresp: + nullable: true + type: integer + dses: + nullable: true + type: integer + x-dependency: + type: frontend + econ: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + ereq: + nullable: true + type: integer + x-dependency: + type: frontend + eresp: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + hanafail: + type: string + x-dependency: + type: server + hrsp_1xx: + nullable: true + type: integer + hrsp_2xx: + nullable: true + type: integer + hrsp_3xx: + nullable: true + type: integer + hrsp_4xx: + nullable: true + type: integer + hrsp_5xx: + nullable: true + type: integer + hrsp_other: + nullable: true + type: integer + iid: + nullable: true + type: integer + intercepted: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + last_agt: + nullable: true + type: string + x-dependency: + type: server + last_chk: + nullable: true + type: string + x-dependency: + type: server + lastchg: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + lastsess: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + lbtot: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + mode: + enum: + - tcp + - http + - health + - unknown + type: string + pid: + nullable: true + type: integer + qcur: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + qlimit: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + qmax: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + qtime: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + rate: + nullable: true + type: integer + rate_lim: + nullable: true + type: integer + x-dependency: + type: frontend + rate_max: + nullable: true + type: integer + req_rate: + nullable: true + type: integer + x-dependency: + type: frontend + req_rate_max: + nullable: true + type: integer + x-dependency: + type: frontend + req_tot: + nullable: true + type: integer + x-dependency: + type: + - frontend + - backend + rtime: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + scur: + nullable: true + type: integer + sid: + nullable: true + type: integer + x-dependency: + type: server + slim: + nullable: true + type: integer + smax: + nullable: true + type: integer + srv_abrt: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + status: + enum: + - UP + - DOWN + - NOLB + - MAINT + - no check + type: string + stot: + nullable: true + type: integer + throttle: + nullable: true + type: integer + x-dependency: + type: server + tracked: + type: string + x-dependency: + type: server + ttime: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + weight: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + wredis: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + wretr: + nullable: true + type: integer + x-dependency: + type: + - server + - backend + type: object + native_stats: + description: HAProxy stats array + properties: + error: + type: string + runtimeAPI: + type: string + stats: + items: + $ref: '#/components/schemas/native_stat' + type: array + x-omitempty: true + title: Stats Array + type: object + x-go-type: models.NativeStats + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + x-omitempty: true + ocsp_update_options: + properties: + disable: + default: false + nullable: true + type: boolean + x-display-name: Disable OCSP Update + httpproxy: + properties: + address: + example: 127.0.0.1 + pattern: ^[^\s]+$ + type: string + port: + example: 80 + maximum: 65535 + minimum: 1 + nullable: true + type: integer + type: object + x-display-name: OCSP Update HTTP Proxy + x-omitempty: true + maxdelay: + description: Sets the maximum interval between two automatic updates of the same OCSP response.This time is expressed in seconds + nullable: true + type: integer + x-default-unit: s + x-display-name: OCSP Update Maximum Delay + x-duration: false + mindelay: + description: Sets the minimum interval between two automatic updates of the same OCSP response. This time is expressed in seconds + nullable: true + type: integer + x-default-unit: s + x-display-name: OCSP Update Minimum Delay + x-duration: false + mode: + enum: + - enabled + - disabled + type: string + x-display-name: OCSP Update Mode + type: object + originalto: + properties: + enabled: + enum: + - enabled + type: string + except: + pattern: ^[^\s]+$ + type: string + header: + pattern: ^[^\s]+$ + type: string + required: + - enabled + type: object + x-display-name: OriginalTo + peer_entries: + description: HAProxy peer entries array + items: + $ref: '#/components/schemas/peer_entry' + title: Peer entries + type: array + x-go-type: models.PeerEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_entry: + description: Peer Entry from peers table + properties: + address: + pattern: ^[^\s]+$ + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:${}"]+$ + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + shard: + type: integer + required: + - name + - address + - port + title: Peer Entry + type: object + x-go-type: models.PeerEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_section: + allOf: + - $ref: '#/components/schemas/peer_section_base' + - properties: + binds: + additionalProperties: + $ref: '#/components/schemas/bind' + log_target_list: + $ref: '#/components/schemas/log_targets' + peer_entries: + additionalProperties: + $ref: '#/components/schemas/peer_entry' + servers: + additionalProperties: + $ref: '#/components/schemas/server' + tables: + additionalProperties: + $ref: '#/components/schemas/table' + type: object + description: Peer Section with all its children resources + type: object + x-go-name: PeerSection + x-go-type: models.PeerSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_section_base: + additionalProperties: false + description: HAProxy peer_section configuration + properties: + default_bind: + $ref: '#/components/schemas/default_bind' + default_server: + $ref: '#/components/schemas/default_server' + disabled: + type: boolean + enabled: + type: boolean + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + shards: + description: |- + In some configurations, one would like to distribute the stick-table contents + to some peers in place of sending all the stick-table contents to each peer + declared in the "peers" section. In such cases, "shards" specifies the + number of peer involved in this stick-table contents distribution. + type: integer + required: + - name + title: Peer Section Base + type: object + peer_sections: + description: HAProxy peer_section array + items: + $ref: '#/components/schemas/peer_section' + title: Peer_Section + type: array + x-go-type: models.PeerSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + performance_options: + properties: + busy_polling: + type: boolean + fd_hard_limit: + nullable: true + type: integer + max_spread_checks: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + maxcompcpuusage: + type: integer + x-display-name: Maximum HAProxy CPU usage + maxcomprate: + description: Maximum per-process input compression rate + type: integer + maxconn: + type: integer + x-display-name: Max Connections + maxconnrate: + description: Maximum per-process number of concurrent connections + type: integer + maxpipes: + type: integer + x-display-name: Maximum per-process number of pipes + maxsessrate: + description: Maximum per-process number of sessions per second + type: integer + maxzlibmem: + description: Maximum amount of RAM in megabytes per process usable by the zlib + type: integer + noepoll: + description: Disable the use of the "epoll" event polling system on Linux + type: boolean + noevports: + description: Disable the use of the event ports event polling system on SunOS system derived from Solaris 10 and later + type: boolean + nogetaddrinfo: + description: Disable the use of getaddrinfo for name resolving + type: boolean + nokqueue: + description: Disable the use of the "kqueue" event polling system on BSD + type: boolean + noktls: + description: Disables the use of ktls. It is equivalent to the command line argument "-dT" + type: boolean + nopoll: + description: Disable the use of the "poll" event polling system + type: boolean + noreuseport: + type: boolean + x-display-name: Disable the use of SO_REUSEPORT + nosplice: + description: Disable the use of kernel tcp splicing between sockets on Linux + type: boolean + profiling_memory: + description: Enable or disables per-function memory profiling + enum: + - enabled + - disabled + type: string + profiling_tasks: + description: Enable or disables per-task CPU profiling + enum: + - auto + - enabled + - disabled + type: string + server_state_base: + pattern: ^[^\s]+$ + type: string + x-display-name: Server State Base + server_state_file: + pattern: ^[^\s]+$ + type: string + x-display-name: Server State File + spread_checks: + description: Add some randomness in the check interval + type: integer + thread_hard_limit: + nullable: true + type: integer + type: object + persist_rule: + properties: + rdp_cookie_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + type: + value: rdp-cookie + x-display-name: Rdp Cookie Name + type: + enum: + - rdp-cookie + type: string + required: + - type + type: object + pgsql_check_params: + properties: + username: + type: string + type: object + process_info: + description: General HAProxy process information + properties: + error: + type: string + info: + $ref: '#/components/schemas/process_info_item' + runtimeAPI: + type: string + title: HAProxy Information + type: object + x-go-type: models.ProcessInfo + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + x-omitempty: true + process_info_item: + properties: + active_peers: + nullable: true + type: integer + busy_polling: + nullable: true + type: integer + bytes_out_rate: + nullable: true + type: integer + compress_bps_in: + nullable: true + type: integer + compress_bps_out: + nullable: true + type: integer + compress_bps_rate_lim: + nullable: true + type: integer + conn_rate: + nullable: true + type: integer + conn_rate_limit: + nullable: true + type: integer + connected_peers: + nullable: true + type: integer + cum_conns: + nullable: true + type: integer + cum_req: + nullable: true + type: integer + cum_ssl_conns: + nullable: true + type: integer + curr_conns: + nullable: true + type: integer + curr_ssl_conns: + nullable: true + type: integer + dropped_logs: + nullable: true + type: integer + failed_resolutions: + nullable: true + type: integer + hard_max_conn: + nullable: true + type: integer + idle_pct: + nullable: true + type: integer + jobs: + nullable: true + type: integer + listeners: + nullable: true + type: integer + max_conn: + nullable: true + type: integer + max_conn_rate: + nullable: true + type: integer + max_pipes: + nullable: true + type: integer + max_sess_rate: + nullable: true + type: integer + max_sock: + nullable: true + type: integer + max_ssl_conns: + nullable: true + type: integer + max_ssl_rate: + nullable: true + type: integer + max_zlib_mem_usage: + nullable: true + type: integer + mem_max_mb: + nullable: true + type: integer + nbthread: + description: Number of threads + nullable: true + type: integer + x-display-name: Number of Threads + node: + type: string + pid: + description: Process id of the replying worker process + nullable: true + type: integer + x-display-name: PID + pipes_free: + nullable: true + type: integer + pipes_used: + nullable: true + type: integer + pool_alloc_mb: + nullable: true + type: integer + pool_failed: + nullable: true + type: integer + pool_used_mb: + nullable: true + type: integer + process_num: + description: Process number + nullable: true + type: integer + x-display-name: Process Number + processes: + description: Number of spawned processes + nullable: true + type: integer + x-display-name: Number of processes + release_date: + description: HAProxy version release date + format: date + type: string + run_queue: + nullable: true + type: integer + sess_rate: + nullable: true + type: integer + sess_rate_limit: + nullable: true + type: integer + ssl_backend_key_rate: + nullable: true + type: integer + ssl_backend_max_key_rate: + nullable: true + type: integer + ssl_cache_lookups: + nullable: true + type: integer + ssl_cache_misses: + nullable: true + type: integer + ssl_frontend_key_rate: + nullable: true + type: integer + ssl_frontend_max_key_rate: + nullable: true + type: integer + ssl_frontend_session_reuse: + nullable: true + type: integer + ssl_rate: + nullable: true + type: integer + ssl_rate_limit: + nullable: true + type: integer + stopping: + nullable: true + type: integer + tasks: + nullable: true + type: integer + total_bytes_out: + nullable: true + type: integer + ulimit_n: + nullable: true + type: integer + unstoppable: + nullable: true + type: integer + uptime: + description: HAProxy uptime in s + nullable: true + type: integer + version: + description: HAProxy version string + type: string + zlib_mem_usage: + nullable: true + type: integer + type: object + program: + description: HAProxy program configuration + example: + command: spoa-mirror --runtime 0 --mirror-url http://test.local + group: mygroupname + name: mirror + start-on-reload: enabled + user: myusername + properties: + command: + description: The command to be run, with flags and options. + type: string + group: + description: The group to run the command as, if different than the HAProxy group. + type: string + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + start-on-reload: + description: HAProxy stops and recreates child programs at reload. + enum: + - enabled + - disabled + type: string + user: + description: The user to run the command as, if different than the HAProxy user. + type: string + required: + - name + - command + title: Program + type: object + x-go-type: models.Program + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + programs: + items: + $ref: '#/components/schemas/program' + type: array + x-go-type: models.Programs + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + quic_initial_rule: + additionalProperties: false + description: QUIC Initial configuration + example: + type: reject + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + metadata: + additionalProperties: + type: object + type: + enum: + - reject + - accept + - send-retry + - dgram-drop + type: string + required: + - type + title: QUIC Initial + type: object + x-go-name: QUICInitialRule + x-go-type: models.QUICInitialRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + quic_initial_rules: + items: + $ref: '#/components/schemas/quic_initial_rule' + title: QUIC Initials Array + type: array + x-go-name: QUICInitialRules + x-go-type: models.QUICInitialRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + redispatch: + properties: + enabled: + enum: + - enabled + - disabled + type: string + interval: + nullable: true + type: integer + required: + - enabled + type: object + reload: + description: HAProxy reload + example: + id: 2019-01-03-44 + status: in_progress + properties: + id: + pattern: ^\d{4}-\d{2}-\d{2}-\d+$ + type: string + reload_timestamp: + type: integer + response: + type: string + status: + enum: + - failed + - in_progress + - succeeded + type: string + title: HAProxy reload + type: object + x-go-type: models.Reload + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + reloads: + description: HAProxy reloads array + items: + $ref: '#/components/schemas/reload' + title: HAProxy Reloads Array + type: array + x-go-type: models.Reloads + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + resolver: + allOf: + - $ref: '#/components/schemas/resolver_base' + - properties: + nameservers: + additionalProperties: + $ref: '#/components/schemas/nameserver' + type: object + description: Resolver with all its children resources + type: object + x-go-name: Resolver + x-go-type: models.Resolver + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + resolver_base: + description: Runtime DNS configuration + properties: + accepted_payload_size: + maximum: 8192 + minimum: 512 + type: integer + hold_nx: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + hold_obsolete: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + hold_other: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + hold_refused: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + hold_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + hold_valid: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + parse-resolv-conf: + type: boolean + resolve_retries: + minimum: 1 + type: integer + timeout_resolve: + minimum: 0 + type: integer + x-default-unit: ms + x-duration: true + timeout_retry: + minimum: 0 + type: integer + x-default-unit: ms + x-duration: true + required: + - name + title: Resolver Base + type: object + resolvers: + description: HAProxy resolvers array + items: + $ref: '#/components/schemas/resolver' + title: Resolvers + type: array + x-go-type: models.Resolvers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + return_header: + properties: + fmt: + type: string + name: + type: string + required: + - name + - fmt + type: object + x-go-name: ReturnHeader + ring: + allOf: + - $ref: '#/components/schemas/ring_base' + - properties: + servers: + additionalProperties: + $ref: '#/components/schemas/server' + type: object + description: Ring with all its children resources + type: object + x-go-name: Ring + x-go-type: models.Ring + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ring_base: + additionalProperties: false + description: HAProxy ring configuration + properties: + description: + description: The description is an optional description string of the ring + type: string + format: + description: Format used to store events into the ring buffer + enum: + - iso + - local + - raw + - rfc3164 + - rfc5424 + - short + - priority + - timed + type: string + maxlen: + description: The maximum length of an event message stored into the ring + nullable: true + type: integer + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + size: + description: Optional size in bytes for the ring-buffer + minimum: 0 + nullable: true + type: integer + x-size: true + timeout_connect: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + timeout_server: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + required: + - name + title: Ring Base + type: object + rings: + description: HAProxy rings array + items: + $ref: '#/components/schemas/ring' + title: Rings + type: array + x-go-type: models.Rings + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + runtime_add_server: + description: Settable properties when adding a new server using HAProxy's runtime. + properties: + address: + pattern: ^[^\s]+$ + readOnly: true + type: string + agent-addr: + pattern: ^[^\s]+$ + type: string + agent-check: + enum: + - enabled + - disabled + type: string + x-dependency: + agent-port: + required: true + agent-inter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + agent-port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + agent-send: + type: string + allow_0rtt: + type: boolean + alpn: + pattern: ^[^\s]+$ + type: string + x-display-name: ALPN Protocols + backup: + enum: + - enabled + - disabled + type: string + check: + enum: + - enabled + - disabled + type: string + check-send-proxy: + enum: + - enabled + - disabled + type: string + check-sni: + pattern: ^[^\s]+$ + type: string + check-ssl: + enum: + - enabled + - disabled + type: string + check_alpn: + pattern: ^[^\s]+$ + type: string + x-display-name: Protocols + check_proto: + pattern: ^[^\s]+$ + type: string + x-display-name: Name + check_via_socks4: + enum: + - enabled + - disabled + type: string + ciphers: + type: string + x-dependency: + ssl: + value: enabled + ciphersuites: + type: string + x-dependency: + ssl: + value: enabled + crl_file: + type: string + x-dependency: + ssl: + value: enabled + downinter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + error_limit: + nullable: true + type: integer + x-display-name: Healthcheck error limit + fall: + nullable: true + type: integer + x-display-name: Nr. of consecutive failed checks + fastinter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + force_sslv3: + enum: + - enabled + - disabled + type: string + force_tlsv10: + enum: + - enabled + - disabled + type: string + force_tlsv11: + enum: + - enabled + - disabled + type: string + force_tlsv12: + enum: + - enabled + - disabled + type: string + force_tlsv13: + enum: + - enabled + - disabled + type: string + health_check_address: + pattern: ^[^\s]+$ + type: string + health_check_port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + id: + readOnly: true + type: string + inter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + maintenance: + enum: + - enabled + - disabled + type: string + maxconn: + nullable: true + type: integer + x-display-name: Max Concurrent Connections + maxqueue: + nullable: true + type: integer + x-display-name: Max Number of Connections + minconn: + nullable: true + type: integer + name: + readOnly: true + type: string + no_sslv3: + enum: + - enabled + - disabled + type: string + no_tlsv10: + enum: + - enabled + - disabled + type: string + no_tlsv11: + enum: + - enabled + - disabled + type: string + no_tlsv12: + enum: + - enabled + - disabled + type: string + no_tlsv13: + enum: + - enabled + - disabled + type: string + npn: + type: string + x-dependency: + ssl: + value: enabled + observe: + enum: + - layer4 + - layer7 + type: string + x-dependency: + ssl: + value: enabled + on-error: + enum: + - fastinter + - fail-check + - sudden-death + - mark-down + type: string + on-marked-down: + enum: + - shutdown-sessions + type: string + on-marked-up: + enum: + - shutdown-backup-sessions + type: string + pool_low_conn: + nullable: true + type: integer + pool_max_conn: + nullable: true + type: integer + pool_purge_delay: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + port: + maximum: 65535 + minimum: 1 + nullable: true + readOnly: true + type: integer + proto: + pattern: ^[^\s]+$ + type: string + proxy-v2-options: + items: + enum: + - authority + - cert-cn + - cert-key + - cert-sig + - crc32c + - ssl + - ssl-cipher + - unique-id + type: string + type: array + x-omitempty: true + rise: + nullable: true + type: integer + send-proxy: + enum: + - enabled + - disabled + type: string + send-proxy-v2: + enum: + - enabled + - disabled + type: string + send_proxy_v2_ssl: + enum: + - enabled + - disabled + type: string + send_proxy_v2_ssl_cn: + enum: + - enabled + - disabled + type: string + slowstart: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + sni: + pattern: ^[^\s]+$ + type: string + source: + type: string + ssl: + enum: + - enabled + - disabled + type: string + ssl_cafile: + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: enabled + x-display-name: SSL CA File + ssl_certificate: + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: enabled + ssl_max_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_min_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_reuse: + enum: + - enabled + - disabled + type: string + tfo: + enum: + - enabled + - disabled + type: string + tls_tickets: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: enabled + track: + type: string + verify: + enum: + - none + - required + type: string + x-dependency: + ssl: + value: enabled + verifyhost: + type: string + x-dependency: + ssl: + value: enabled + verify: + value: required + weight: + nullable: true + type: integer + ws: + enum: + - auto + - h1 + - h2 + type: string + x-display-name: Relaying websocket stream protocol + title: Runtime Add Server + type: object + x-go-type: models.RuntimeAddServer + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + runtime_server: + description: Runtime transient server properties + example: + address: 127.0.0.5 + admin_state: ready + operational_state: up + port: 80 + server_id: 1 + server_name: web_server + properties: + address: + pattern: ^[^\s]+$ + type: string + admin_state: + enum: + - ready + - maint + - drain + type: string + agent_addr: + readOnly: true + type: string + agent_port: + maximum: 65535 + minimum: 0 + nullable: true + readOnly: true + type: integer + agent_state: + nullable: true + readOnly: true + type: integer + backend_forced_id: + nullable: true + readOnly: true + type: integer + backend_id: + nullable: true + readOnly: true + type: integer + backend_name: + readOnly: true + type: string + check_addr: + readOnly: true + type: string + check_health: + nullable: true + readOnly: true + type: integer + check_port: + maximum: 65535 + minimum: 0 + nullable: true + readOnly: true + type: integer + check_result: + nullable: true + readOnly: true + type: integer + check_state: + nullable: true + readOnly: true + type: integer + check_status: + nullable: true + readOnly: true + type: integer + forced_id: + nullable: true + readOnly: true + type: integer + fqdn: + readOnly: true + type: string + id: + readOnly: true + type: string + iweight: + nullable: true + readOnly: true + type: integer + last_time_change: + nullable: true + readOnly: true + type: integer + name: + readOnly: true + type: string + operational_state: + enum: + - up + - down + - stopping + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + srvrecord: + readOnly: true + type: string + use_ssl: + readOnly: true + type: boolean + uweight: + nullable: true + readOnly: true + type: integer + weight: + nullable: true + type: integer + title: Runtime Server + type: object + x-go-type: models.RuntimeServer + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + runtime_servers: + description: HAProxy runtime servers array + items: + $ref: '#/components/schemas/runtime_server' + title: HAProxy Runtime Servers Array + type: array + x-go-type: models.RuntimeServers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server: + additionalProperties: false + allOf: + - $ref: '#/components/schemas/server_params' + - properties: + address: + pattern: ^[^\s]+$ + type: string + id: + nullable: true + type: integer + metadata: + additionalProperties: + type: object + name: + pattern: ^[^\s]+$ + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + required: + - name + - address + type: object + description: HAProxy backend server configuration + example: + address: 10.1.1.1 + name: www + port: 8080 + title: Server + x-go-type: models.Server + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_params: + properties: + agent-addr: + pattern: ^[^\s]+$ + type: string + agent-check: + enum: + - enabled + - disabled + type: string + x-dependency: + agent-port: + required: true + agent-inter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + agent-port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + agent-send: + type: string + allow_0rtt: + type: boolean + alpn: + pattern: ^[^\s]+$ + type: string + x-display-name: ALPN Protocols + backup: + enum: + - enabled + - disabled + type: string + cc: + type: string + x-display-name: TCP Congestion Control Algorithm + check: + enum: + - enabled + - disabled + type: string + check-pool-conn-name: + pattern: ^[^\s]+$ + type: string + check-reuse-pool: + enum: + - enabled + - disabled + type: string + check-send-proxy: + enum: + - enabled + - disabled + type: string + check-sni: + pattern: ^[^\s]+$ + type: string + check-ssl: + enum: + - enabled + - disabled + type: string + check_alpn: + pattern: ^[^\s]+$ + type: string + x-display-name: Protocols + check_proto: + pattern: ^[^\s]+$ + type: string + x-display-name: Name + check_sni_auto: + enum: + - enabled + - disabled + type: string + check_via_socks4: + enum: + - enabled + - disabled + type: string + ciphers: + type: string + x-dependency: + ssl: + value: enabled + ciphersuites: + type: string + x-dependency: + ssl: + value: enabled + client_sigalgs: + type: string + x-dependency: + ssl: + value: true + cookie: + pattern: ^[^\s]+$ + type: string + crl_file: + type: string + x-dependency: + ssl: + value: enabled + curves: + type: string + x-dependency: + ssl: + value: true + downinter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + error_limit: + type: integer + x-display-name: Error count + fall: + nullable: true + type: integer + x-display-name: Nr. of consecutive failed checks + fastinter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + force_sslv3: + description: This field is deprecated in favor of sslv3, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + force_tlsv10: + description: This field is deprecated in favor of tlsv10, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + force_tlsv11: + description: This field is deprecated in favor of tlsv11, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + force_tlsv12: + description: This field is deprecated in favor of tlsv12, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + force_tlsv13: + description: This field is deprecated in favor of tlsv13, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + guid: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + hash_key: + pattern: ^[^\s]+$ + type: string + health_check_address: + pattern: ^[^\s]+$ + type: string + health_check_port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + idle_ping: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + init-addr: + nullable: true + pattern: ^[^\s]+$ + type: string + init-state: + enum: + - fully-up + - up + - down + - fully-down + type: string + inter: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + ktls: + enum: + - "on" + - "off" + type: string + x-display-name: |- + Enables or disables ktls for those sockets. If enabled, kTLS will be used if the kernel supports it and the cipher is compatible. + This is only available on Linux kernel 4.17 and above. + EXPERIMENTAL OPTION. + log-bufsize: + nullable: true + type: integer + log_proto: + enum: + - legacy + - octet-count + type: string + maintenance: + enum: + - enabled + - disabled + type: string + max_reuse: + nullable: true + type: integer + maxconn: + nullable: true + type: integer + x-display-name: Max Concurrent Connections + maxqueue: + nullable: true + type: integer + x-display-name: Max Number of Connections + minconn: + nullable: true + type: integer + namespace: + type: string + no_sslv3: + description: This field is deprecated in favor of sslv3, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + no_tlsv10: + description: This field is deprecated in favor of tlsv10, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + no_tlsv11: + description: This field is deprecated in favor of tlsv11, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + no_tlsv12: + description: This field is deprecated in favor of tlsv12, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + no_tlsv13: + description: This field is deprecated in favor of force_tlsv13, and will be removed in a future release + enum: + - enabled + - disabled + type: string + x-deprecated: true + no_verifyhost: + enum: + - enabled + - disabled + type: string + npn: + type: string + x-dependency: + ssl: + value: enabled + observe: + enum: + - layer4 + - layer7 + type: string + x-dependency: + ssl: + value: enabled + on-error: + enum: + - fastinter + - fail-check + - sudden-death + - mark-down + type: string + on-marked-down: + enum: + - shutdown-sessions + type: string + on-marked-up: + enum: + - shutdown-backup-sessions + type: string + pool_conn_name: + pattern: ^[^\s]+$ + type: string + pool_low_conn: + nullable: true + type: integer + pool_max_conn: + nullable: true + type: integer + pool_purge_delay: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + proto: + pattern: ^[^\s]+$ + type: string + proxy-v2-options: + items: + enum: + - authority + - cert-cn + - cert-key + - cert-sig + - crc32c + - ssl + - ssl-cipher + - unique-id + type: string + type: array + x-omitempty: true + redir: + type: string + x-display-name: Prefix + renegotiate: + description: Toggles the secure renegotiation mechanism for an SSL backend. + enum: + - enabled + - disabled + type: string + resolve-net: + pattern: ^([A-Za-z0-9.:/]+)(,[A-Za-z0-9.:/]+)*$ + type: string + resolve-prefer: + enum: + - ipv4 + - ipv6 + type: string + resolve_opts: + pattern: ^(allow-dup-ip|ignore-weight|prevent-dup-ip)(,(allow-dup-ip|ignore-weight|prevent-dup-ip))*$ + type: string + resolvers: + pattern: ^[^\s]+$ + type: string + x-dynamic-enum: + operation: getResolvers + property: name + rise: + nullable: true + type: integer + send-proxy: + enum: + - enabled + - disabled + type: string + send-proxy-v2: + enum: + - enabled + - disabled + type: string + send_proxy_v2_ssl: + enum: + - enabled + - disabled + type: string + send_proxy_v2_ssl_cn: + enum: + - enabled + - disabled + type: string + set-proxy-v2-tlv-fmt: + properties: + id: + type: string + value: + type: string + required: + - id + - value + type: object + shard: + type: integer + sigalgs: + type: string + x-dependency: + ssl: + value: true + slowstart: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + sni: + pattern: ^[^\s]+$ + type: string + sni_auto: + enum: + - enabled + - disabled + type: string + socks4: + pattern: ^[^\s]+$ + type: string + x-dependency: + check-via-socks4: + required: true + source: + type: string + ssl: + enum: + - enabled + - disabled + type: string + ssl_cafile: + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: enabled + x-display-name: SSL CA File + ssl_certificate: + pattern: ^[^\s]+$ + type: string + x-dependency: + ssl: + value: enabled + ssl_max_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_min_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_reuse: + enum: + - enabled + - disabled + type: string + sslv3: + enum: + - enabled + - disabled + type: string + stick: + enum: + - enabled + - disabled + type: string + strict-maxconn: + type: boolean + tcp_md5sig: + pattern: ^[^\s]+$ + type: string + tcp_ut: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-duration: true + tfo: + enum: + - enabled + - disabled + type: string + tls_tickets: + enum: + - enabled + - disabled + type: string + x-dependency: + ssl: + value: enabled + tlsv10: + enum: + - enabled + - disabled + type: string + tlsv11: + enum: + - enabled + - disabled + type: string + tlsv12: + enum: + - enabled + - disabled + type: string + tlsv13: + enum: + - enabled + - disabled + type: string + track: + type: string + verify: + enum: + - none + - required + type: string + x-dependency: + ssl: + value: enabled + verifyhost: + type: string + x-dependency: + ssl: + value: enabled + verify: + value: required + weight: + nullable: true + type: integer + ws: + enum: + - auto + - h1 + - h2 + type: string + x-display-name: Relaying websocket stream protocol + type: object + server_switching_rule: + additionalProperties: false + description: HAProxy server switching rule configuration (corresponds to use-server directive) + example: + cond: if + cond_test: '{ req.ssl_sni -i www.example.com }' + target_server: www + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + metadata: + additionalProperties: + type: object + target_server: + pattern: ^[^\s]+$ + type: string + x-dynamic-enum: + operation: getServers + property: name + required: + - target_server + title: Server Switching Rule + type: object + x-go-type: models.ServerSwitchingRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_switching_rules: + description: HAProxy backend server switching rules array (corresponds to use-server directives) + items: + $ref: '#/components/schemas/server_switching_rule' + title: Server Switching Rules Array + type: array + x-go-type: models.ServerSwitchingRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_template: + additionalProperties: false + allOf: + - $ref: '#/components/schemas/server_params' + - properties: + fqdn: + type: string + id: + nullable: true + type: integer + metadata: + additionalProperties: + type: object + num_or_range: + type: string + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + prefix: + pattern: ^[^\s]+$ + type: string + required: + - prefix + - num_or_range + - fqdn + type: object + description: Set a template to initialize servers with shared parameters. + example: + fqdn: google.com + num_or_range: 1-3 + port: 80 + prefix: srv + title: Server template + x-go-type: models.ServerTemplate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_templates: + description: HAProxy backend server templates array + items: + $ref: '#/components/schemas/server_template' + title: Server templates + type: array + x-go-type: models.ServerTemplates + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + servers: + description: HAProxy backend servers array + items: + $ref: '#/components/schemas/server' + title: Servers + type: array + x-go-type: models.Servers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + site: + additionalProperties: false + description: | + Site configuration. Sites are considered as one service and all farms connected to that service. + Farms are connected to service using use-backend and default_backend directives. Sites let you + configure simple HAProxy configurations, for more advanced options use /haproxy/configuration + endpoints. + example: + farms: + - balance: + algorithm: roundrobin + mode: http + name: www_backend + servers: + - address: 127.0.1.1 + name: www_server + port: 4567 + - address: 127.0.1.2 + name: www_server_new + port: 4567 + use_as: default + name: test_site + service: + http_connection_mode: httpclose + maxconn: 2000 + mode: http + properties: + farms: + items: + properties: + balance: + $ref: '#/components/schemas/balance' + cond: + enum: + - if + - unless + type: string + x-dependency: + use_as: + required: true + value: conditional + x-display-name: Condition + cond_test: + type: string + x-dependency: + use_as: + required: true + value: conditional + x-display-name: Condition Test + forwardfor: + $ref: '#/components/schemas/forwardfor' + mode: + enum: + - http + - tcp + type: string + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + servers: + items: + $ref: '#/components/schemas/server' + type: array + x-omitempty: true + use_as: + enum: + - default + - conditional + type: string + required: + - name + - use_as + type: object + x-go-name: SiteFarm + type: array + x-omitempty: true + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + service: + properties: + http_connection_mode: + enum: + - http-tunnel + - httpclose + - forced-close + - http-server-close + - http-keep-alive + type: string + x-dependency: + mode: + value: http + x-display-name: HTTP Connection Mode + listeners: + items: + $ref: '#/components/schemas/bind' + type: array + x-omitempty: true + maxconn: + nullable: true + type: integer + x-display-name: Max Connections + mode: + enum: + - http + - tcp + type: string + type: object + required: + - name + title: Site + type: object + x-go-type: models.Site + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + sites: + description: | + Sites array. Sites are considered as one service and all farms connected to that service. + Farms are connected to service using use-backend and default_backend directives. Sites let you + configure simple HAProxy configurations, for more advanced options use /haproxy/configuration + endpoints. + items: + $ref: '#/components/schemas/site' + title: Sites + type: array + x-go-type: models.Sites + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + smtpchk_params: + properties: + domain: + type: string + hello: + type: string + type: object + source: + properties: + address: + type: string + address_second: + type: string + hdr: + type: string + x-dependency: + usesrc: + value: hdr_ip + interface: + type: string + occ: + type: string + x-dependency: + usesrc: + value: hdr_ip + port: + maximum: 65535 + minimum: 1 + type: integer + port_second: + maximum: 65535 + minimum: 1 + type: integer + usesrc: + enum: + - address + - client + - clientip + - hdr_ip + type: string + required: + - address + type: object + spoe_agent: + description: SPOE agent configuration + properties: + async: + enum: + - enabled + - disabled + type: string + continue-on-error: + enum: + - enabled + type: string + dontlog-normal: + enum: + - enabled + - disabled + type: string + engine-name: + type: string + force-set-var: + enum: + - enabled + type: string + groups: + type: string + hello_timeout: + type: integer + x-default-unit: ms + x-duration: true + idle_timeout: + type: integer + x-default-unit: ms + x-duration: true + log: + $ref: '#/components/schemas/log_targets' + max-frame-size: + type: integer + max-waiting-frames: + type: integer + maxconnrate: + type: integer + maxerrrate: + type: integer + messages: + type: string + name: + type: string + option_set-on-error: + pattern: ^[A-Za-z0-9-_.]+$ + type: string + option_set-process-time: + pattern: ^[A-Za-z0-9-_.]+$ + type: string + option_set-total-time: + pattern: ^[A-Za-z0-9-_.]+$ + type: string + option_var-prefix: + pattern: ^[A-Za-z0-9-_.]+$ + type: string + pipelining: + enum: + - enabled + - disabled + type: string + processing_timeout: + type: integer + x-default-unit: ms + x-duration: true + register-var-names: + type: string + send-frag-payload: + enum: + - enabled + - disabled + type: string + use-backend: + type: string + required: + - name + title: SPOE agent + type: object + x-go-type: models.SpoeAgent + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_agents: + description: SPOE Agents of one scope in SPOE file + items: + $ref: '#/components/schemas/spoe_agent' + title: SPOE Agents + type: array + x-go-type: models.SpoeAgents + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_files: + description: SPOE files + items: + type: string + title: SPOE files + type: array + x-go-type: models.SpoeFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + x-omitempty: true + spoe_group: + description: SPOE group section configuration + properties: + messages: + type: string + name: + type: string + required: + - name + title: SPOE group + type: object + x-go-type: models.SpoeGroup + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_groups: + description: SPOE Groups of one scope in SPOE file + items: + $ref: '#/components/schemas/spoe_group' + title: SPOE Groups + type: array + x-go-type: models.SpoeGroups + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_message: + description: SPOE message section configuration + properties: + acl: + $ref: '#/components/schemas/acls' + args: + type: string + event: + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + name: + enum: + - on-backend-http-request + - on-backend-tcp-request + - on-client-session + - on-frontend-http-request + - on-frontend-tcp-request + - on-http-response + - on-server-session + - on-tcp-response + type: string + required: + - name + type: object + name: + type: string + required: + - name + title: SPOE message + type: object + x-go-type: models.SpoeMessage + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_messages: + description: SPOE Messages of one scope in SPOE file + items: + $ref: '#/components/schemas/spoe_message' + title: SPOE Messages + type: array + x-go-type: models.SpoeMessages + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_scope: + description: SPOE scope name + title: SPOE scope + type: string + x-go-type: models.SpoeScope + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_scopes: + description: All SPOE Scopes + items: + $ref: '#/components/schemas/spoe_scope' + title: SPOE Scopes + type: array + x-go-type: models.SpoeScopes + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_transaction: + description: SPOE configuration transaction + example: + _version: 2 + id: 273e3385-2d0c-4fb1-aa27-93cbb31ff203 + status: in_progress + properties: + _version: + type: integer + id: + pattern: ^[^\s]+$ + type: string + status: + enum: + - failed + - in_progress + - success + type: string + title: SPOE configuration transaction + type: object + x-go-type: models.SpoeTransaction + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_transactions: + description: SPOE Configuration transactions array + items: + $ref: '#/components/schemas/spoe_transaction' + title: SPOE Transactions array + type: array + x-go-type: models.SpoeTransactions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_ca_file: + description: A file containing one or more SSL/TLS certificates and keys + properties: + count: + type: string + file: + type: string + storage_name: + type: string + title: SSL File + type: object + x-go-type: models.SslCaFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_ca_files: + description: Array of SSL CA files + items: + $ref: '#/components/schemas/ssl_ca_file' + title: SSL CA Files Array + type: array + x-go-type: models.SslCaFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_certificate: + description: A file containing one or more SSL/TLS certificates and keys + properties: + algorithm: + readOnly: true + type: string + authority_key_id: + readOnly: true + type: string + chain_issuer: + readOnly: true + type: string + x-omitempty: true + chain_subject: + readOnly: true + type: string + x-omitempty: true + description: + readOnly: true + type: string + domains: + readOnly: true + type: string + x-omitempty: true + file: + readOnly: true + type: string + ip_addresses: + readOnly: true + type: string + x-omitempty: true + issuers: + readOnly: true + type: string + x-omitempty: true + not_after: + format: date-time + nullable: true + readOnly: true + type: string + x-go-custom-tag: gorm:"type:timestamp with time zone" + not_before: + format: date-time + nullable: true + readOnly: true + type: string + x-go-custom-tag: gorm:"type:timestamp with time zone" + serial: + type: string + sha1_finger_print: + readOnly: true + type: string + sha256_finger_print: + readOnly: true + type: string + size: + description: File size in bytes. + nullable: true + readOnly: true + type: integer + status: + description: Only set when using the runtime API. + readOnly: true + type: string + x-omitempty: true + storage_name: + readOnly: true + type: string + subject: + readOnly: true + type: string + subject_alternative_names: + readOnly: true + type: string + subject_key_id: + readOnly: true + type: string + title: SSL File + type: object + x-go-type: models.SslCertificate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_certificate_id: + description: SSL Certificate ID + properties: + certificate_id: + properties: + hash_algorithm: + type: string + issuer_key_hash: + type: string + issuer_name_hash: + type: string + serial_number: + type: string + type: object + x-go-name: CertificateId + certificate_id_key: + type: string + certificate_path: + type: string + title: SSL Certificate ID + type: object + ssl_certificates: + description: Array of ssl certificate files + items: + $ref: '#/components/schemas/ssl_certificate' + title: SSL Certificate Files Array + type: array + x-go-type: models.SslCertificates + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crl: + description: A file containing one or more SSL/TLS CRLs + properties: + description: + type: string + file: + type: string + storage_name: + type: string + title: SSL CRL File + type: object + ssl_crl_entries: + items: + $ref: '#/components/schemas/ssl_crl_entry' + type: array + x-go-type: models.SslCrlEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crl_entry: + description: A certificate revocation list entry. + properties: + issuer: + type: string + last_update: + format: date + type: string + next_update: + format: date + type: string + revoked_certificates: + items: + properties: + revocation_date: + format: date + type: string + serial_number: + type: string + type: object + x-go-name: RevokedCertificates + type: array + x-omitempty: true + signature_algorithm: + type: string + status: + type: string + storage_name: + type: string + version: + type: string + title: One CRL Entry + type: object + ssl_crls: + description: Array of ssl crl files + items: + $ref: '#/components/schemas/ssl_crl' + title: SSL CRL Files Array + type: array + x-go-type: models.SslCrls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list: + description: SSL Crt List file + properties: + file: + type: string + title: SSL Crt List + type: object + x-go-type: models.SslCrtList + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entries: + description: Array of SSL Crt List Entry + items: + $ref: '#/components/schemas/ssl_crt_list_entry' + title: SSL Crt List Entry Array + type: array + x-go-type: models.SslCrtListEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entry: + description: SSL Crt List Entry + properties: + file: + type: string + line_number: + minimum: 0 + type: integer + sni_filter: + items: + type: string + type: array + x-go-name: SNIFilter + x-omitempty: true + ssl_bind_config: + type: string + x-go-name: SSLBindConfig + title: SSL Crt List Entry + type: object + x-go-type: models.SslCrtListEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_file: + description: A file referencing one or more certificates with their configuration. + properties: + description: + type: string + file: + type: string + size: + description: File size in bytes. + nullable: true + type: integer + storage_name: + type: string + title: SSL CRT List File + type: object + x-go-type: models.SslCrtListFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_files: + description: List of SSL certificate list files (crt-list) + items: + $ref: '#/components/schemas/ssl_crt_list_file' + title: List of SSL certificate list files + type: array + x-go-type: models.SslCrtListFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_lists: + description: Array of SSL Crt List + items: + $ref: '#/components/schemas/ssl_crt_list' + title: SSL Crt List Array + type: array + x-go-type: models.SslCrtLists + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_front_use: + description: Assign a certificate to the current frontend + properties: + allow_0rtt: + type: boolean + alpn: + type: string + x-display-name: ALPN Protocols + ca_file: + type: string + certificate: + description: Certificate filename + pattern: ^[^\s]+$ + type: string + ciphers: + type: string + ciphersuites: + type: string + client_sigalgs: + type: string + crl_file: + type: string + curves: + type: string + ecdhe: + type: string + issuer: + description: OCSP issuer filename + type: string + key: + description: Private key filename + type: string + metadata: + additionalProperties: + type: object + no_alpn: + type: boolean + no_ca_names: + type: boolean + npn: + type: string + ocsp: + description: OCSP response filename + type: string + ocsp_update: + description: Automatic OCSP response update + enum: + - enabled + - disabled + type: string + sctl: + description: Signed Certificate Timestamp List filename + type: string + sigalgs: + type: string + ssl_max_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + ssl_min_ver: + enum: + - SSLv3 + - TLSv1.0 + - TLSv1.1 + - TLSv1.2 + - TLSv1.3 + type: string + verify: + enum: + - none + - optional + - required + type: string + required: + - certificate + title: SSL Frontend Use certificate + type: object + x-go-name: SSLFrontUse + x-go-type: models.SSLFrontUse + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_front_uses: + items: + $ref: '#/components/schemas/ssl_front_use' + type: array + x-go-name: SSLFrontUses + x-go-type: models.SSLFrontUses + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + x-omitempty: true + ssl_ocsp_response: + description: SSL OCSP Response + properties: + base64_response: + type: string + ocsp_response_status: + type: string + produced_at: + format: date + type: string + responder_id: + items: + type: string + type: array + x-omitempty: true + response_type: + type: string + responses: + properties: + cert_status: + type: string + certificate_id: + $ref: '#/components/schemas/ssl_certificate_id/properties/certificate_id' + next_update: + format: date + type: string + revocation_reason: + type: string + x-omitempty: true + this_update: + format: date + type: string + type: object + x-go-name: OCSPResponses + version: + type: string + title: SSL OCSP Response + type: object + ssl_ocsp_update: + description: SSL OCSP Update + properties: + cert_id: + type: string + failures: + type: integer + last_update: + type: string + last_update_status: + type: integer + last_update_status_str: + type: string + next_update: + type: string + path: + type: string + successes: + type: integer + title: SSL OCSP Update + type: object + ssl_options: + properties: + acme_scheduler: + enum: + - auto + - "off" + type: string + x-display-name: ACME Scheduler + ca_base: + type: string + x-display-name: SSL CA Certificates Base Directory + crt_base: + type: string + x-display-name: SSL Certificates Base Directory + default_bind_ciphers: + type: string + x-display-name: SSL Default Bind Ciphers + default_bind_ciphersuites: + type: string + x-display-name: SSL Default Bind Ciphersuites + default_bind_client_sigalgs: + type: string + x-display-name: SSL Default Bind Client Sigalgs + default_bind_curves: + type: string + x-display-name: SSL Default Bind Curves + default_bind_options: + type: string + x-display-name: SSL Default Bind Options + default_bind_sigalgs: + type: string + x-display-name: SSL Default Bind Sigalgs + default_server_ciphers: + type: string + x-display-name: SSL Default Server Ciphers + default_server_ciphersuites: + type: string + x-display-name: SSL Default Server Ciphersuites + default_server_client_sigalgs: + type: string + x-display-name: SSL Default Server Client Sigalgs + default_server_curves: + type: string + x-display-name: SSL Default Server Curves + default_server_options: + type: string + x-display-name: SSL Default Server Options + default_server_sigalgs: + type: string + x-display-name: SSL Default Server Sigalgs + dh_param_file: + type: string + engines: + items: + properties: + algorithms: + nullable: true + type: string + x-display-name: Algorithms + name: + type: string + x-display-name: Name + required: + - name + type: object + x-go-name: SslEngine + type: array + x-display-name: SSL Engines + x-go-name: SslEngines + x-omitempty: true + issuers_chain_path: + type: string + load_extra_files: + type: string + x-display-name: SSL Load Extra Files + maxsslconn: + description: Maximum per-process number of concurrent SSL connections + type: integer + maxsslrate: + description: Maximum per-process number of SSL sessions per second + type: integer + mode_async: + enum: + - enabled + - disabled + type: string + x-display-name: Asynchronous TLS I/O operations + passphrase_cmd: + type: string + propquery: + type: string + x-display-name: SSL Query String Property + provider: + type: string + x-display-name: SSL Provider + provider_path: + type: string + x-display-name: SSL Provider Path + security_level: + maximum: 5 + minimum: 0 + nullable: true + type: integer + server_verify: + enum: + - none + - required + type: string + x-display-name: Verify server certificates + skip_self_issued_ca: + type: boolean + x-display-name: Self issued CA, aka x509 root CA + type: object + ssl_providers: + description: SSL Providers + properties: + providers: + items: + type: string + type: array + title: SSL Providers + type: object + stats_auth: + properties: + passwd: + type: string + user: + type: string + required: + - user + - passwd + type: object + stats_http_request: + properties: + cond: + type: string + cond_test: + type: string + x-dependency: + cond: + required: true + realm: + type: string + x-dependency: + type: + value: auth + type: + enum: + - allow + - deny + - auth + type: string + required: + - type + type: object + stats_options: + properties: + stats_admin: + type: boolean + x-display-name: Stats Admin + stats_admin_cond: + enum: + - if + - unless + type: string + x-dependency: + stats_admin: + required: true + value: true + x-display-name: Stats Admin Condition + stats_admin_cond_test: + type: string + x-dependency: + stats_admin_cond: + required: true + x-display-name: Stats Admin Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + stats_auths: + items: + $ref: '#/components/schemas/stats_auth' + type: array + x-display-name: Stats Auths + x-omitempty: true + stats_enable: + type: boolean + x-display-name: Stats Enable + stats_hide_version: + type: boolean + x-display-name: Stats Hide Version + stats_http_requests: + items: + $ref: '#/components/schemas/stats_http_request' + type: array + x-display-name: Stats HTTP Requests + x-omitempty: true + stats_maxconn: + minimum: 1 + type: integer + stats_realm: + type: boolean + x-display-name: Stats Realm + stats_realm_realm: + nullable: true + type: string + x-dependency: + stats_realm: + required: true + value: true + stats_refresh_delay: + minimum: 0 + nullable: true + type: integer + x-default-unit: s + x-duration: true + stats_show_desc: + nullable: true + type: string + stats_show_legends: + type: boolean + x-display-name: Stats Show Legends + stats_show_modules: + type: boolean + x-display-name: Stats Show Modules + stats_show_node_name: + nullable: true + pattern: ^[^\s]+$ + type: string + x-omitempty: false + stats_uri_prefix: + pattern: ^[^\s]+$ + type: string + type: object + stick_rule: + additionalProperties: false + description: Define a pattern used to create an entry in a stickiness table or matching condition or associate a user to a server. + example: + pattern: src + type: match + properties: + cond: + enum: + - if + - unless + type: string + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + metadata: + additionalProperties: + type: object + pattern: + pattern: ^[^\s]+$ + type: string + table: + pattern: ^[^\s]+$ + type: string + type: + enum: + - match + - "on" + - store-request + - store-response + type: string + required: + - type + - pattern + title: Stick Rule + type: object + x-go-type: models.StickRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_rules: + description: HAProxy backend stick rules array (corresponds to stick store-request, stick match, stick on, stick store-response) + items: + $ref: '#/components/schemas/stick_rule' + title: Stick Rules Array + type: array + x-go-type: models.StickRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_table: + description: Stick Table Information + properties: + fields: + items: + properties: + field: + enum: + - bytes_in_cnt + - bytes_in_rate + - bytes_out_cnt + - bytes_out_rate + - conn_cnt + - conn_cur + - conn_rate + - glitch_cnt + - glitch_rate + - gpc + - gpc_rate + - gpc0 + - gpc0_rate + - gpc1 + - gpc1_rate + - gpt0 + - gpt + - http_req_cnt + - http_req_rate + - http_err_cnt + - http_err_rate + - http_fail_cnt + - http_fail_rate + - server_id + - sess_cnt + - sess_rate + type: string + idx: + type: integer + x-dependency: + field: + value: + - gpc + - gpc_rate + - gpt + period: + type: integer + x-dependency: + type: + value: rate + type: + enum: + - rate + - counter + type: string + type: object + x-go-name: StickTableField + type: array + x-omitempty: true + name: + type: string + size: + nullable: true + type: integer + type: + enum: + - ip + - ipv6 + - integer + - string + - binary + type: string + used: + nullable: true + type: integer + title: Stick Table + type: object + x-go-type: models.StickTable + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_table_entries: + description: Entries of one runtime stick table + items: + $ref: '#/components/schemas/stick_table_entry' + title: Stick Tables Entries + type: array + x-go-type: models.StickTableEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_table_entry: + description: One entry in stick table + properties: + bytes_in_cnt: + nullable: true + type: integer + bytes_in_rate: + nullable: true + type: integer + bytes_out_cnt: + nullable: true + type: integer + bytes_out_rate: + nullable: true + type: integer + conn_cnt: + nullable: true + type: integer + conn_cur: + nullable: true + type: integer + conn_rate: + nullable: true + type: integer + exp: + nullable: true + type: integer + glitch_cnt: + nullable: true + type: integer + glitch_rate: + nullable: true + type: integer + gpc: + properties: + idx: + type: integer + value: + nullable: true + type: integer + type: object + gpc_rate: + properties: + idx: + type: integer + value: + nullable: true + type: integer + type: object + gpc0: + nullable: true + type: integer + gpc0_rate: + nullable: true + type: integer + gpc1: + nullable: true + type: integer + gpc1_rate: + nullable: true + type: integer + gpt: + properties: + idx: + type: integer + value: + nullable: true + type: integer + type: object + gpt0: + nullable: true + type: integer + http_err_cnt: + nullable: true + type: integer + http_err_rate: + nullable: true + type: integer + http_fail_cnt: + nullable: true + type: integer + http_fail_rate: + nullable: true + type: integer + http_req_cnt: + nullable: true + type: integer + http_req_rate: + nullable: true + type: integer + id: + type: string + key: + type: string + server_id: + nullable: true + type: integer + sess_cnt: + nullable: true + type: integer + sess_rate: + nullable: true + type: integer + use: + type: boolean + title: Stick Table Entry + type: object + x-go-type: models.StickTableEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_tables: + description: Array of runtime stick tables + items: + $ref: '#/components/schemas/stick_table' + title: Stick Tables Array + type: array + x-go-type: models.StickTables + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + table: + properties: + expire: + nullable: true + pattern: ^\d+(ms|s|m|h|d)?$ + type: string + x-default-unit: ms + x-duration: true + metadata: + additionalProperties: + type: object + name: + type: string + no_purge: + type: boolean + x-display-name: No Purge + recv_only: + type: boolean + x-display-name: Receive Only + size: + pattern: ^\d+(k|K|m|M|g|G)?$ + type: string + x-size: true + store: + type: string + type: + enum: + - ip + - integer + - string + - binary + type: string + type_len: + nullable: true + type: integer + x-display-name: Type + write_to: + nullable: true + type: string + required: + - name + type: object + x-go-type: models.StickTable + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tables: + description: HAProxy table array + items: + $ref: '#/components/schemas/table' + title: Tables + type: array + x-go-type: models.StickTables + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_check: + properties: + action: + enum: + - comment + - connect + - expect + - send + - send-lf + - send-binary + - send-binary-lf + - set-var + - set-var-fmt + - unset-var + type: string + addr: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + value: connect + alpn: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + value: connect + x-display-name: ALPN Protocols + check_comment: + type: string + x-dependency: + action: + value: + - connect + - expect + - send + - send-lf + - send-binary + - send-binary-lf + data: + type: string + x-dependency: + action: + required: true + value: send + default: + type: boolean + x-dependency: + action: + value: connect + error_status: + enum: + - L7OKC + - L7RSP + - L7STS + - L6RSP + - L4CON + type: string + x-dependency: + action: + value: expect + exclamation_mark: + type: boolean + x-dependency: + action: + value: expect + x-display-name: Expect Exclamation Mark + fmt: + type: string + x-dependency: + action: + required: true + value: send-lf + hex_fmt: + type: string + x-dependency: + action: + required: true + value: send-binary-lf + hex_string: + type: string + x-dependency: + action: + required: true + value: send-binary + linger: + type: boolean + x-dependency: + action: + value: connect + match: + enum: + - string + - rstring + - string-lf + - binary + - rbinary + - binary-lf + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: expect + x-display-name: Expect Match + metadata: + additionalProperties: + type: object + min_recv: + type: integer + x-dependency: + action: + value: expect + ok_status: + enum: + - L7OK + - L7OKC + - L6OK + - L4OK + type: string + x-dependency: + action: + value: expect + on_error: + type: string + x-dependency: + action: + value: expect + on_success: + type: string + x-dependency: + action: + value: expect + pattern: + type: string + x-dependency: + action: + required: true + value: expect + port: + maximum: 65535 + minimum: 1 + nullable: true + type: integer + x-dependency: + action: + value: connect + port_string: + type: string + x-dependency: + action: + value: connect + proto: + type: string + x-dependency: + action: + value: connect + send_proxy: + type: boolean + x-dependency: + action: + value: connect + sni: + type: string + x-dependency: + action: + value: connect + ssl: + type: boolean + x-dependency: + action: + value: connect + status-code: + type: string + x-dependency: + action: + value: expect + tout_status: + enum: + - L7TOUT + - L6TOUT + - L4TOUT + type: string + x-dependency: + action: + value: expect + var_expr: + type: string + x-dependency: + action: + required: true + value: + - set-var + x-display-name: Var Expression + var_fmt: + type: string + x-dependency: + action: + required: true + value: + - set-var-fmt + x-display-name: Var Log format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: + - set-var + - set-var-fmt + - unset-var + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: + - set-var + - set-var-fmt + - unset-var + via_socks4: + type: boolean + x-dependency: + action: + value: connect + required: + - action + title: TCP Check + type: object + x-go-type: models.TCPCheck + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_checks: + items: + $ref: '#/components/schemas/tcp_check' + title: TCP Checks Array + type: array + x-go-type: models.TCPChecks + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_request_rule: + additionalProperties: false + description: HAProxy TCP Request Rule configuration (corresponds to tcp-request) + example: + cond: if + cond_test: '{ src 192.168.0.0/16 }' + index: 0 + type: connection + properties: + action: + enum: + - accept + - attach-srv + - capture + - do-resolve + - expect-netscaler-cip + - expect-proxy + - lua + - reject + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + - send-spoe-group + - set-bandwidth-limit + - set-bc-mark + - set-bc-tos + - set-dst-port + - set-dst + - set-fc-mark + - set-fc-tos + - set-log-level + - set-mark + - set-nice + - set-priority-class + - set-priority-offset + - set-src + - set-src-port + - set-tos + - set-var + - set-var-fmt + - silent-drop + - switch-mode + - track-sc + - unset-var + - use-service + - set-retries + - do-log + type: string + x-dependency: + type: + required: true + value: + - connection + - content + - session + bandwidth_limit_limit: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Standard HAProxy expression + bandwidth_limit_name: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Bandwidth limit name + bandwidth_limit_period: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Standard HAProxy expression + capture_len: + type: integer + x-dependency: + action: + required: true + value: capture + type: + required: true + value: + - connection + - content + x-display-name: Capture Length + capture_sample: + pattern: ^(?:[A-Za-z]+\("([A-Za-z\s]+)"\)|[A-Za-z]+) + type: string + x-dependency: + action: + required: true + value: capture + type: + required: true + value: + - connection + - content + x-display-name: Capture Sample + cond: + enum: + - if + - unless + type: string + x-dependency: + type: + value: + - connection + - content + - session + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + type: + required: true + value: + - connection + - content + - session + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + expr: + type: string + x-dependency: + action: + required: true + value: + - do-resolve + - set-bc-mark + - set-bc-tos + - set-dst + - set-dst-port + - set-fc-mark + - set-fc-tos + - set-priority-class + - set-priority-offset + - set-src + - set-src-port + - set-var + - set-retries + type: + value: + - session + - connection + - content + x-display-name: Standard HAProxy expression + gpt_value: + type: string + x-dependency: + action: + required: true + value: sc-set-gpt0 + type: + required: true + value: + - connection + - content + - session + x-display-name: Sticky counter value + log_level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + - silent + type: string + x-dependency: + action: + required: true + value: set-log-level + type: + value: content + lua_action: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: lua + type: + value: + - connection + - content + x-display-name: Lua action name + lua_params: + type: string + x-dependency: + action: + value: lua + type: + value: + - connection + - content + x-display-name: Lua action params + mark_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + action: + required: true + value: set-mark + type: + value: + - connection + - content + x-display-name: Mark Value + metadata: + additionalProperties: + type: object + nice_value: + maximum: 1024 + minimum: -1024 + type: integer + x-dependency: + action: + required: true + value: set-nice + type: + value: content + x-display-name: Nice Value + resolve_protocol: + enum: + - ipv4 + - ipv6 + type: string + x-dependency: + action: + required: false + value: do-resolve + type: + required: true + value: + - content + x-display-name: Protocol + resolve_resolvers: + type: string + x-dependency: + action: + required: true + value: do-resolve + type: + required: true + value: + - content + x-display-name: Resolvers + resolve_var: + type: string + x-dependency: + action: + required: true + value: do-resolve + type: + required: true + value: + - content + x-display-name: Variable name + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL + sc_idx: + type: string + x-dependency: + action: + required: true + value: + - sc-set-gpt + type: + required: true + value: + - connection + - content + - session + x-display-name: Sticky counter Index + sc_inc_id: + type: string + x-dependency: + action: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + type: + required: true + value: + - connection + - content + - session + x-display-name: Sticky counter ID + sc_int: + nullable: true + type: integer + x-dependency: + type: + required: true + value: + - sc-add-gpc + - sc-set-gpt0 + x-display-name: ScSet Integer Value + server_name: + type: string + x-dependency: + action: + required: true + value: attach-srv + type: + value: session + x-display-name: Server name + service_name: + type: string + x-dependency: + action: + required: true + value: use-service + type: + value: content + x-display-name: Service name + spoe_engine_name: + type: string + x-dependency: + action: + required: true + value: send-spoe-group + type: + required: true + value: + - content + x-display-name: Engine name + spoe_group_name: + type: string + x-dependency: + action: + required: true + value: send-spoe-group + type: + required: true + value: + - content + x-display-name: Group name + switch_mode_proto: + type: string + x-dependency: + action: + required: true + value: switch-mode + type: + value: content + x-display-name: Switch Mode Proto + timeout: + nullable: true + type: integer + x-default-unit: ms + x-dependency: + type: + required: true + value: inspect-delay + x-duration: true + tos_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + action: + required: true + value: set-tos + type: + value: + - connection + - content + x-display-name: Tos Value + track_key: + type: string + x-dependency: + action: + required: true + value: + - track-sc + type: + value: + - session + - connection + - content + x-display-name: Sample expression rule + track_stick_counter: + nullable: true + type: integer + x-dependency: + action: + required: false + value: + - track-sc + type: + value: + - session + - connection + - content + x-display-name: Track Stick Counter + track_table: + type: string + x-dependency: + action: + required: false + value: + - track-sc + type: + value: + - session + - connection + - content + x-display-name: Optional table name + type: + enum: + - connection + - content + - inspect-delay + - session + type: string + var_format: + type: string + x-dependency: + action: + required: true + value: set-var-fmt + type: + value: + - session + - connection + - content + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: + - set-var + - unset-var + - set-var-fmt + type: + value: + - session + - connection + - content + x-display-name: Variable name + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: + - set-var + - unset-var + - set-var-fmt + type: + value: + - session + - connection + - content + x-display-name: Variable scope + required: + - type + title: TCP Request Rule + type: object + x-go-type: models.TCPRequestRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_request_rules: + description: HAProxy TCP request rules array (corresponds to tcp-request directive) + items: + $ref: '#/components/schemas/tcp_request_rule' + title: TCP Request Rules Array + type: array + x-go-type: models.TCPRequestRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_response_rule: + additionalProperties: false + description: HAProxy TCP Response Rule configuration (corresponds to tcp-response) + example: + cond: if + cond_test: '{ src 192.168.0.0/16 }' + index: 0 + type: content + properties: + action: + enum: + - accept + - close + - lua + - reject + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + - send-spoe-group + - set-bandwidth-limit + - set-fc-mark + - set-fc-tos + - set-log-level + - set-mark + - set-nice + - set-tos + - set-var + - set-var-fmt + - silent-drop + - unset-var + - do-log + type: string + x-dependency: + type: + required: true + value: content + bandwidth_limit_limit: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Standard HAProxy expression + bandwidth_limit_name: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Bandwidth limit name + bandwidth_limit_period: + type: string + x-dependency: + action: + value: set-bandwidth-limit + type: + value: content + x-display-name: Standard HAProxy expression + cond: + enum: + - if + - unless + type: string + x-dependency: + type: + value: content + x-display-name: Condition + cond_test: + type: string + x-dependency: + cond: + required: true + type: + value: content + x-display-name: Condition Test + x-dynamic-enum: + freeFormat: true + operation: getACLs + property: acl_name + expr: + type: string + x-dependency: + action: + required: true + value: + - set-src-port + - sc-set-gpt0 + - set-fc-mark + - set-fc-tos + type: + value: content + x-display-name: Standard HAProxy expression + log_level: + enum: + - emerg + - alert + - crit + - err + - warning + - notice + - info + - debug + - silent + type: string + x-dependency: + action: + required: true + value: set-log-level + type: + value: content + lua_action: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: lua + type: + value: content + x-display-name: Lua action name + lua_params: + type: string + x-dependency: + action: + value: lua + type: + value: content + x-display-name: Lua action params + mark_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + action: + required: true + value: set-mark + type: + value: content + x-display-name: Mark Value + metadata: + additionalProperties: + type: object + nice_value: + maximum: 1024 + minimum: -1024 + type: integer + x-dependency: + action: + required: true + value: set-nice + type: + value: content + x-display-name: Nice Value + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL + sc_expr: + type: string + x-dependency: + action: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + type: + value: content + x-display-name: ScSet Expression Value + sc_id: + type: integer + x-dependency: + action: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + - sc-inc-gpc0 + - sc-inc-gpc1 + - sc-set-gpt + - sc-set-gpt0 + type: + value: content + sc_idx: + type: integer + x-dependency: + action: + required: true + value: + - sc-add-gpc + - sc-set-gpt + - sc-inc-gpc + type: + value: content + sc_int: + nullable: true + type: integer + x-dependency: + action: + required: true + value: + - sc-add-gpc + - sc-inc-gpc + type: + value: content + x-display-name: ScSet Integer Value + spoe_engine: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: send-spoe-group + type: + value: content + x-display-name: SPOE Engine + spoe_group: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: send-spoe-group + type: + value: content + x-display-name: SPOE Group + timeout: + nullable: true + type: integer + x-default-unit: ms + x-dependency: + type: + required: true + value: inspect-delay + x-duration: true + tos_value: + pattern: ^(0x[0-9A-Fa-f]+|[0-9]+)$ + type: string + x-dependency: + action: + required: true + value: set-tos + type: + value: content + x-display-name: Tos Value + type: + enum: + - content + - inspect-delay + type: string + var_format: + type: string + x-dependency: + action: + required: true + value: set-var-fmt + type: + value: content + x-display-name: Var Format + var_name: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + required: true + value: + - unset-var + type: + value: content + var_scope: + pattern: ^[^\s]+$ + type: string + x-dependency: + action: + value: unset-var + type: + value: content + required: + - type + title: TCP Response Rule + type: object + x-go-type: models.TCPResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_response_rules: + description: HAProxy TCP response rules array (corresponds to tcp-response directive) + items: + $ref: '#/components/schemas/tcp_response_rule' + title: TCP Response Rules Array + type: array + x-go-type: models.TCPResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + trace_entries: + description: list of entries in a traces section + items: + $ref: '#/components/schemas/trace_entry' + type: array + trace_entry: + description: Configure a trace event + properties: + metadata: + additionalProperties: + type: object + trace: + description: Trace parameters + minLength: 1 + type: string + required: + - trace + title: Trace event + type: object + x-go-type: models.TraceEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + traces: + additionalProperties: false + description: Trace events configuration + properties: + entries: + $ref: '#/components/schemas/trace_entries' + metadata: + additionalProperties: + type: object + type: object + x-go-name: Traces + x-go-type: models.Traces + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + transaction: + description: HAProxy configuration transaction + example: + _version: 2 + id: 273e3385-2d0c-4fb1-aa27-93cbb31ff203 + status: in_progress + properties: + _version: + type: integer + id: + pattern: ^[^\s]+$ + type: string + status: + enum: + - failed + - outdated + - in_progress + - success + type: string + title: Configuration transaction + type: object + x-go-type: models.Transaction + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + transactions: + description: Configuration transactions array + items: + $ref: '#/components/schemas/transaction' + title: Transactions array + type: array + x-go-type: models.Transactions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tune_buffer_options: + properties: + buffers_limit: + nullable: true + type: integer + x-display-name: Buffers Limit + buffers_reserve: + minimum: 2 + type: integer + x-display-name: Buffers Reserve + bufsize: + type: integer + x-display-name: Buffer Size + x-size: true + bufsize_small: + description: Size of small buffers (for memory-restrained situations) + minimum: 1 + nullable: true + type: integer + x-size: true + pipesize: + type: integer + x-display-name: Pipe Buffer Size + x-size: true + rcvbuf_backend: + nullable: true + type: integer + x-display-name: Backend Receive Buffer Size + x-size: true + rcvbuf_client: + nullable: true + type: integer + x-display-name: Client Receive Buffer Size + x-size: true + rcvbuf_frontend: + nullable: true + type: integer + x-display-name: Frontend Receive Buffer Size + x-size: true + rcvbuf_server: + nullable: true + type: integer + x-display-name: Server Receive Buffer Size + x-size: true + recv_enough: + type: integer + x-display-name: Receive Enough Socket Buffer Size + x-size: true + sndbuf_backend: + nullable: true + type: integer + x-display-name: Backend Send Buffer Size + x-size: true + sndbuf_client: + nullable: true + type: integer + x-display-name: Client Send Buffer Size + x-size: true + sndbuf_frontend: + nullable: true + type: integer + x-display-name: Frontend Send Buffer Size + x-size: true + sndbuf_server: + nullable: true + type: integer + x-display-name: Server Send Buffer Size + x-size: true + type: object + tune_lua_options: + properties: + bool_sample_conversion: + enum: + - normal + - pre-3.1-bug + type: string + burst_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Burst execution timeout + x-duration: true + forced_yield: + type: integer + x-display-name: Lua Forced Yield + log_loggers: + enum: + - enabled + - disabled + type: string + x-display-name: Send Lua Logs to the Loggers + log_stderr: + enum: + - auto + - enabled + - disabled + type: string + x-display-name: Send Lua Logs to stderr + maxmem: + nullable: true + type: integer + x-display-name: Lua Maximum Memory Usage + service_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Lua Service timeout + x-duration: true + session_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Lua Session Timeout + x-duration: true + task_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Lua Task Timeout + x-duration: true + type: object + tune_options: + properties: + applet_zero_copy_forwarding: + description: Enables of disabled the zero-copy forwarding of data for the applets + enum: + - enabled + - disabled + type: string + comp_maxlevel: + type: integer + x-display-name: Maximum Compression Level + disable_fast_forward: + type: boolean + x-display-name: Disable fast-forwarding + disable_zero_copy_forwarding: + type: boolean + x-display-name: Disable zero-copy forwarding + epoll_mask_events: + items: + enum: + - err + - hup + - rdhup + type: string + type: array + x-omitempty: true + events_max_events_at_once: + maximum: 10000 + minimum: 1 + type: integer + fail_alloc: + type: boolean + x-display-name: Failed Allocation Chance + fd_edge_triggered: + enum: + - enabled + - disabled + type: string + x-display-name: Edge-triggered polling mode + glitches_kill_cpu_usage: + maximum: 100 + minimum: 0 + nullable: true + type: integer + x-display-name: CPU Usage Kill glitched Connections + h1_zero_copy_fwd_recv: + description: enable or disable the zero-copy receives of data for the HTTP/1 multiplexer + enum: + - enabled + - disabled + type: string + h1_zero_copy_fwd_send: + description: enable or disable the zero-copy sends of data for the HTTP/1 multiplexer + enum: + - enabled + - disabled + type: string + h2_be_glitches_threshold: + description: Automatically kill a backend connection past a number of glitches + nullable: true + type: integer + h2_be_initial_window_size: + description: Initial window size for outgoing connections + type: integer + h2_be_max_concurrent_streams: + description: Maximum number of concurrent streams per outgoing connection + type: integer + h2_be_rxbuf: + description: HTTP/2 receive buffer size for outgoing connections + nullable: true + type: integer + x-size: true + h2_fe_glitches_threshold: + description: Automatically kill a frontend connection past a number of glitches + nullable: true + type: integer + h2_fe_initial_window_size: + description: Initial window size for incoming connections + type: integer + h2_fe_max_concurrent_streams: + description: Maximum number of concurrent streams per incoming connection + type: integer + h2_fe_max_total_streams: + description: Maximum number of total streams processed per incoming HTTP/2 connection + nullable: true + type: integer + h2_fe_rxbuf: + description: HTTP/2 receive buffer size for incoming connections + nullable: true + type: integer + x-size: true + h2_header_table_size: + maximum: 65535 + type: integer + x-display-name: HTTP/2 Dynamic Header Table Size + h2_initial_window_size: + nullable: true + type: integer + x-display-name: HTTP/2 Initial Window Size + h2_max_concurrent_streams: + type: integer + x-display-name: HTTP/2 Maximum Number of Concurrent Streams + h2_max_frame_size: + type: integer + x-display-name: HTTP/2 Maximum Frame Size + h2_zero_copy_fwd_send: + description: enable or disable the zero-copy sends of data for the HTTP/2 multiplexer + enum: + - enabled + - disabled + type: string + http_cookielen: + type: integer + x-display-name: Maximum Cookie Length + http_logurilen: + type: integer + x-display-name: Maximum URI Length + http_maxhdr: + maximum: 32767 + minimum: 1 + type: integer + x-display-name: Maximum Number of Headers + idle_pool_shared: + enum: + - enabled + - disabled + type: string + x-display-name: Share Idle Connections + idletimer: + maximum: 65535 + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: Idle Stream Duration + x-duration: true + listener_default_shards: + enum: + - by-process + - by-thread + - by-group + type: string + x-display-name: Listener Default Shards + listener_multi_queue: + enum: + - enabled + - disabled + type: string + x-display-name: Listener Multi Queue Accept + max_checks_per_thread: + nullable: true + type: integer + x-display-name: Maximum checks per thread + max_rules_at_once: + minimum: 0 + nullable: true + type: integer + x-display-name: Maximum rules at once + maxaccept: + type: integer + x-display-name: Maximum Accept Events + maxpollevents: + type: integer + x-display-name: Maximum Polled Events + maxrewrite: + type: integer + x-display-name: Maximum Rewrite Space + memory_hot_size: + nullable: true + type: integer + x-display-name: Per-thread Amount of Memory + notsent_lowat_client: + nullable: true + type: integer + x-display-name: Client Not Sent Low Watermark + x-size: true + notsent_lowat_server: + nullable: true + type: integer + x-display-name: Server Not Sent Low Watermark + x-size: true + pattern_cache_size: + nullable: true + type: integer + x-display-name: Pattern Lookup Cache Size + peers_max_updates_at_once: + description: Maximum number of stick-table updates at once + type: integer + pool_high_fd_ratio: + type: integer + x-display-name: Max Used High FD Ratio + pool_low_fd_ratio: + type: integer + x-display-name: Max Used Low FD Ratio + pt_zero_copy_forwarding: + description: enable or disable the zero-copy forwarding of data for the pass-through multiplexer + enum: + - enabled + - disabled + type: string + renice_runtime: + description: Scheduling priority applied after the configuration parsing + maximum: 19 + minimum: -20 + nullable: true + type: integer + renice_startup: + description: Scheduling priority applied before the rest of the configuration + maximum: 19 + minimum: -20 + nullable: true + type: integer + ring_queues: + description: Number of write queues in front of ring buffers + nullable: true + type: integer + runqueue_depth: + type: integer + x-display-name: Max Tasks in Run Queue + sched_low_latency: + enum: + - enabled + - disabled + type: string + x-display-name: Low Latency Task Scheduler + stick_counters: + nullable: true + type: integer + x-display-name: Number of stick-counters + takeover_other_tg_connections: + enum: + - none + - restricted + - full + type: string + x-display-name: Takeover Other Thread Groups Connections + type: object + tune_quic_options: + properties: + frontend_conn_tx_buffers_limit: + nullable: true + type: integer + x-display-name: QUIC Frontend Connection TX Buffer Limit + frontend_max_idle_timeout: + minimum: 0 + nullable: true + type: integer + x-default-unit: ms + x-display-name: QUIC Frontend Max Idle Timeout + x-duration: true + frontend_max_streams_bidi: + nullable: true + type: integer + x-display-name: QUIC Max Number of Bidirectional Streams + frontend_max_tx_memory: + nullable: true + type: integer + x-display-name: QUIC Frontend Max Tx Memory + x-size: true + max_frame_loss: + nullable: true + type: integer + x-display-name: QUIC Max Limit for Frame Loss + reorder_ratio: + description: Ratio applied to the packet reordering threshold + maximum: 100 + minimum: 0 + nullable: true + type: integer + retry_threshold: + nullable: true + type: integer + x-display-name: QUIC Retry Threshold + socket_owner: + enum: + - listener + - connection + type: string + x-display-name: QUIC Socket Owner + zero_copy_fwd_send: + description: Enables or disables the zero-copy sends for the QUIC multiplexer + enum: + - enabled + - disabled + type: string + type: object + tune_ssl_options: + properties: + cachesize: + nullable: true + type: integer + x-display-name: SSL Cache Size + capture_buffer_size: + nullable: true + type: integer + x-display-name: SSL Maximum Size of Cipherlist Buffer + ctx_cache_size: + type: integer + x-display-name: SSL Number of Certificates in Cache + default_dh_param: + type: integer + x-display-name: SSL Default DH Parameter Size + force_private_cache: + type: boolean + x-display-name: SSL Force Private Cache + keylog: + enum: + - enabled + - disabled + type: string + x-display-name: SSL Log TLS Keys + lifetime: + minimum: 0 + nullable: true + type: integer + x-default-unit: s + x-display-name: SSL Session Lifetime + x-duration: true + maxrecord: + nullable: true + type: integer + x-display-name: SSL Maximum Size + x-size: false + ocsp_update_max_delay: + description: SSL Maximum Interval Between Two Automatic Updates of the same OCSP Response + nullable: true + type: integer + ocsp_update_min_delay: + description: SSL Minimum Interval Between Two Automatic Updates of the same OCSP Response + nullable: true + type: integer + type: object + tune_vars_options: + properties: + global_max_size: + nullable: true + type: integer + x-display-name: Variables Global Max Size + x-size: false + proc_max_size: + nullable: true + type: integer + x-display-name: Variables Process Max Size + x-size: false + reqres_max_size: + nullable: true + type: integer + x-display-name: Variables Request/Response Max Size + x-size: false + sess_max_size: + nullable: true + type: integer + x-display-name: Variables Session Max Size + x-size: false + txn_max_size: + nullable: true + type: integer + x-display-name: Variables Transaction Max Size + x-size: false + type: object + tune_zlib_options: + properties: + memlevel: + maximum: 9 + minimum: 1 + type: integer + x-display-name: Zlib Memory Level + windowsize: + maximum: 15 + minimum: 8 + type: integer + x-display-name: Zlib Window Size + type: object + user: + description: HAProxy userlist user + properties: + groups: + type: string + metadata: + additionalProperties: + type: object + password: + type: string + secure_password: + type: boolean + username: + pattern: ^[A-Za-z0-9-_.:${}"]+$ + type: string + required: + - username + - secure_password + - password + title: User + type: object + x-go-type: models.User + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + userlist: + allOf: + - $ref: '#/components/schemas/userlist_base' + - properties: + groups: + additionalProperties: + $ref: '#/components/schemas/group' + users: + additionalProperties: + $ref: '#/components/schemas/user' + type: object + description: Userlist with all its children resources + type: object + x-go-name: Userlist + x-go-type: models.Userlist + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + userlist_base: + description: HAProxy configuration of access control + properties: + metadata: + additionalProperties: + type: object + name: + pattern: ^[A-Za-z0-9-_.:]+$ + type: string + required: + - name + title: Userlist Base + type: object + userlists: + description: HAProxy userlists array + items: + $ref: '#/components/schemas/userlist' + title: Userlists + type: array + x-go-type: models.Userlists + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + users: + description: HAProxy userlist users array + items: + $ref: '#/components/schemas/user' + title: Users + type: array + x-go-type: models.Users + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + wurfl_options: + properties: + cache_size: + description: Sets the WURFL Useragent cache size + type: integer + data_file: + description: The path of the WURFL data file + type: string + information_list: + description: A space-delimited list of WURFL capabilities + type: string + information_list_separator: + description: A char that will be used to separate values in a response header containing WURFL results + type: string + patch_file: + description: A list of WURFL patch file paths + type: string + type: object + securitySchemes: + basic_auth: + scheme: basic + type: http +paths: + /: + get: + description: Returns a list of root endpoints. + operationId: getAPIEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of root endpoints + tags: + - Discovery + /cluster: + delete: + description: Delete cluster settings and move the node back to single mode + operationId: deleteCluster + parameters: + - description: In case of moving to single mode do we keep or clean configuration + in: query + name: configuration + schema: + enum: + - keep + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + responses: + "204": + description: Cluster settings deleted and node moved to single mode + default: + $ref: '#/components/responses/DefaultError' + summary: Delete cluster settings + tags: + - Cluster + get: + description: Returns cluster data + operationId: getCluster + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return cluster data + tags: + - Cluster + post: + description: Post cluster settings + operationId: postCluster + parameters: + - description: In case of moving to single mode do we keep or clean configuration + in: query + name: configuration + schema: + enum: + - keep + type: string + - description: Force the advertised address when joining a cluster + in: query + name: advertised_address + schema: + type: string + - description: Force the advertised port when joining a cluster + in: query + name: advertised_port + schema: + maximum: 65535 + minimum: 1 + type: integer + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + description: Cluster settings changed + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Post cluster settings + tags: + - Cluster + x-codegen-request-body-name: data + put: + description: Edit cluster settings + operationId: editCluster + parameters: + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + description: Cluster settings changed + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Edit cluster settings + tags: + - Cluster + x-codegen-request-body-name: data + /cluster/certificate: + post: + description: Initiates a certificate refresh + operationId: initiateCertificateRefresh + responses: + "200": + description: refresh activated + "403": + description: refresh not possible + default: + $ref: '#/components/responses/DefaultError' + summary: Initiates a certificate refresh + tags: + - Cluster + /health: + get: + description: Return managed services health + operationId: getHealth + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/health' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return managed services health + tags: + - Health + /info: + get: + description: Return API, hardware and OS information + operationId: getInfo + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/info' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return API, hardware and OS information + tags: + - Information + /service_discovery/aws: + get: + description: Return all configured AWS regions. + operationId: getAWSRegions + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegions' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all configured AWS regions + tags: + - ServiceDiscovery + post: + description: |- + Add a new AWS region. + Credentials are not required in case Dataplane API is running in an EC2 instance with proper IAM role attached. + operationId: createAWSRegion + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + description: Resource created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new AWS region + tags: + - ServiceDiscovery + x-codegen-request-body-name: data + /service_discovery/aws/{id}: + delete: + description: Delete an AWS region configuration by it's id. + operationId: deleteAWSRegion + parameters: + - description: AWS region ID + in: path + name: id + required: true + schema: + type: string + responses: + "204": + description: Resource deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete an AWS region + tags: + - ServiceDiscovery + get: + description: Return one AWS Region configuration by it's id. + operationId: getAWSRegion + parameters: + - description: AWS region id + in: path + name: id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an AWS region + tags: + - ServiceDiscovery + put: + description: Replace an AWS region configuration by its id. + operationId: replaceAWSRegion + parameters: + - description: AWS Region ID + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + description: Resource updated + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an AWS region + tags: + - ServiceDiscovery + x-codegen-request-body-name: data + /service_discovery/consul: + get: + description: Returns all configured Consul servers. + operationId: getConsuls + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/consuls' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all configured Consul servers + tags: + - ServiceDiscovery + post: + description: Adds a new Consul server. + operationId: createConsul + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + description: Consul created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Consul server + tags: + - ServiceDiscovery + x-codegen-request-body-name: data + /service_discovery/consul/{id}: + delete: + description: Deletes a Consul server configuration by it's id. + operationId: deleteConsul + parameters: + - description: Consul server Index + in: path + name: id + required: true + schema: + type: string + responses: + "204": + description: Consul server deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Consul server + tags: + - ServiceDiscovery + get: + description: Returns one Consul server configuration by it's id. + operationId: getConsul + parameters: + - description: Consul server id + in: path + name: id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Consul server + tags: + - ServiceDiscovery + put: + description: Replaces a Consul server configuration by it's id. + operationId: replaceConsul + parameters: + - description: Consul Index + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + description: Consul server replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Consul server + tags: + - ServiceDiscovery + x-codegen-request-body-name: data + /services: + get: + description: Returns a list of API managed services endpoints. + operationId: getServicesEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of service endpoints + tags: + - Discovery + /services/haproxy: + get: + description: Returns a list of HAProxy related endpoints. + operationId: getHaproxyEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy related endpoints + tags: + - Discovery + /services/haproxy/configuration: + get: + description: Returns a list of endpoints to be used for advanced configuration of HAProxy objects. + operationId: getConfigurationEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy advanced configuration endpoints + tags: + - Discovery + /services/haproxy/configuration/acme: + get: + description: Returns an array of all configured ACME providers. + operationId: getAcmeProviders + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_providers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of ACME providers + tags: + - Acme + post: + description: Adds a new ACME provider to the configuration file. + operationId: createAcmeProvider + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + description: ACME provider created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add an ACME provider + tags: + - Acme + x-codegen-request-body-name: data + /services/haproxy/configuration/acme/{name}: + delete: + description: Deletes an ACME provider from the configuration by its name. + operationId: deleteAcmeProvider + parameters: + - description: ACME provider name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: ACME provider deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete an ACME provider + tags: + - Acme + get: + description: Returns one ACME provider configuration by its name. + operationId: getAcmeProvider + parameters: + - description: ACME provider name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an ACME provider + tags: + - Acme + put: + description: Replaces an ACME provider configuration by its name. + operationId: editAcmeProvider + parameters: + - description: ACME provider name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + description: ACME provider replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an ACME provider + tags: + - Acme + x-codegen-request-body-name: data + /services/haproxy/configuration/backends: + get: + description: Returns an array of all configured backends. + operationId: getBackends + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backends' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of backends + tags: + - Backend + post: + description: Adds a new backend to the configuration file. + operationId: createBackend + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + description: Backend created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a backend + tags: + - Backend + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{name}: + delete: + description: Deletes a backend from the configuration by its name. + operationId: deleteBackend + parameters: + - description: Backend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Backend deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a backend + tags: + - Backend + get: + description: Returns one backend configuration by its name. + operationId: getBackend + parameters: + - description: Backend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a backend + tags: + - Backend + put: + description: Replaces a backend configuration by its name. + operationId: replaceBackend + parameters: + - description: Backend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + description: Backend replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a backend + tags: + - Backend + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/acls: + get: + description: Returns all ACL lines that are configured in specified Backend. + operationId: getAllAclBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ACL name + in: query + name: acl_name + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all ACL lines + tags: + - ACL + put: + description: Replaces a whole list of ACLs with the list given in parameter for the specified Backend. + operationId: replaceAllAclBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: All ACL lines replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an ACL list + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/acls/{index}: + delete: + description: Deletes a ACL line configuration by its index from the specified Backend. + operationId: deleteAclBackend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: ACL line deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a ACL line + tags: + - ACL + get: + description: Returns one ACL line configuration by its index in the specified Backend. + operationId: getAclBackend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one ACL line + tags: + - ACL + post: + description: Adds a new ACL line of the specified type in the specified Backend. + operationId: createAclBackend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new ACL line + tags: + - ACL + x-codegen-request-body-name: data + put: + description: Replaces a ACL line configuration by its index in the specified Backend. + operationId: replaceAclBackend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a ACL line + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/filters: + get: + description: Returns all Filters that are configured in specified Backend. + operationId: getAllFilterBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Filters + tags: + - Filter + put: + description: Replaces a whole list of Filters with the list given in parameter for the specified Backend. + operationId: replaceAllFilterBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: All Filters replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Filter list + tags: + - Filter + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/filters/{index}: + delete: + description: Deletes a Filter configuration by its index from the specified Backend. + operationId: deleteFilterBackend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Filter deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Filter + tags: + - Filter + get: + description: Returns one Filter configuration by its index in the specified Backend. + operationId: getFilterBackend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Filter + tags: + - Filter + post: + description: Adds a new Filter of the specified type in the specified Backend. + operationId: createFilterBackend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Filter created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Filter + tags: + - Filter + x-codegen-request-body-name: data + put: + description: Replaces a Filter configuration by its index in the specified Backend. + operationId: replaceFilterBackend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Filter replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Filter + tags: + - Filter + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules: + get: + description: Returns all HTTP After Response Rules that are configured in specified Backend. + operationId: getAllHTTPAfterResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP After Response Rules + tags: + - HTTPAfterResponseRule + put: + description: Replaces a whole list of HTTP After Response Rules with the list given in parameter for the specified Backend. + operationId: replaceAllHTTPAfterResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: All HTTP After Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP After Response Rule list + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_after_response_rules/{index}: + delete: + description: Deletes a HTTP After Response Rule configuration by its index from the specified Backend. + operationId: deleteHTTPAfterResponseRuleBackend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP After Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + get: + description: Returns one HTTP After Response Rule configuration by its index in the specified Backend. + operationId: getHTTPAfterResponseRuleBackend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP After Response Rule + tags: + - HTTPAfterResponseRule + post: + description: Adds a new HTTP After Response Rule of the specified type in the specified Backend. + operationId: createHTTPAfterResponseRuleBackend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP After Response Rule configuration by its index in the specified Backend. + operationId: replaceHTTPAfterResponseRuleBackend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_checks: + get: + description: Returns all HTTP Checks that are configured in specified Backend. + operationId: getAllHTTPCheckBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Checks + tags: + - HTTPCheck + put: + description: Replaces a whole list of HTTP Checks with the list given in parameter for the specified Backend. + operationId: replaceAllHTTPCheckBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: All HTTP Checks replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Check list + tags: + - HTTPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_checks/{index}: + delete: + description: Deletes a HTTP Check configuration by its index from the specified Backend. + operationId: deleteHTTPCheckBackend + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Check deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Check + tags: + - HTTPCheck + get: + description: Returns one HTTP Check configuration by its index in the specified Backend. + operationId: getHTTPCheckBackend + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Check + tags: + - HTTPCheck + post: + description: Adds a new HTTP Check of the specified type in the specified Backend. + operationId: createHTTPCheckBackend + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: HTTP Check created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Check + tags: + - HTTPCheck + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Check configuration by its index in the specified Backend. + operationId: replaceHTTPCheckBackend + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: HTTP Check replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Check + tags: + - HTTPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_error_rules: + get: + description: Returns all HTTP Error Rules that are configured in specified Backend. + operationId: getAllHTTPErrorRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Error Rules + tags: + - HTTPErrorRule + put: + description: Replaces a whole list of HTTP Error Rules with the list given in parameter for the specified Backend. + operationId: replaceAllHTTPErrorRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: All HTTP Error Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Error Rule list + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_error_rules/{index}: + delete: + description: Deletes a HTTP Error Rule configuration by its index from the specified Backend. + operationId: deleteHTTPErrorRuleBackend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Error Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Error Rule + tags: + - HTTPErrorRule + get: + description: Returns one HTTP Error Rule configuration by its index in the specified Backend. + operationId: getHTTPErrorRuleBackend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Error Rule + tags: + - HTTPErrorRule + post: + description: Adds a new HTTP Error Rule of the specified type in the specified Backend. + operationId: createHTTPErrorRuleBackend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Error Rule configuration by its index in the specified Backend. + operationId: replaceHTTPErrorRuleBackend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_request_rules: + get: + description: Returns all HTTP Request Rules that are configured in specified Backend. + operationId: getAllHTTPRequestRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Request Rules + tags: + - HTTPRequestRule + put: + description: Replaces a whole list of HTTP Request Rules with the list given in parameter for the specified Backend. + operationId: replaceAllHTTPRequestRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: All HTTP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Request Rule list + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_request_rules/{index}: + delete: + description: Deletes a HTTP Request Rule configuration by its index from the specified Backend. + operationId: deleteHTTPRequestRuleBackend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Request Rule + tags: + - HTTPRequestRule + get: + description: Returns one HTTP Request Rule configuration by its index in the specified Backend. + operationId: getHTTPRequestRuleBackend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Request Rule + tags: + - HTTPRequestRule + post: + description: Adds a new HTTP Request Rule of the specified type in the specified Backend. + operationId: createHTTPRequestRuleBackend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Request Rule configuration by its index in the specified Backend. + operationId: replaceHTTPRequestRuleBackend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_response_rules: + get: + description: Returns all HTTP Response Rules that are configured in specified Backend. + operationId: getAllHTTPResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Response Rules + tags: + - HTTPResponseRule + put: + description: Replaces a whole list of HTTP Response Rules with the list given in parameter for the specified Backend. + operationId: replaceAllHTTPResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: All HTTP Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Response Rule list + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/http_response_rules/{index}: + delete: + description: Deletes a HTTP Response Rule configuration by its index from the specified Backend. + operationId: deleteHTTPResponseRuleBackend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Response Rule + tags: + - HTTPResponseRule + get: + description: Returns one HTTP Response Rule configuration by its index in the specified Backend. + operationId: getHTTPResponseRuleBackend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Response Rule + tags: + - HTTPResponseRule + post: + description: Adds a new HTTP Response Rule of the specified type in the specified Backend. + operationId: createHTTPResponseRuleBackend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Response Rule configuration by its index in the specified Backend. + operationId: replaceHTTPResponseRuleBackend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/log_targets: + get: + description: Returns all Log Targets that are configured in specified Backend. + operationId: getAllLogTargetBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of Log Targets with the list given in parameter for the specified Backend. + operationId: replaceAllLogTargetBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/log_targets/{index}: + delete: + description: Deletes a Log Target configuration by its index from the specified Backend. + operationId: deleteLogTargetBackend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Log Target + tags: + - LogTarget + get: + description: Returns one Log Target configuration by its index in the specified Backend. + operationId: getLogTargetBackend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Log Target + tags: + - LogTarget + post: + description: Adds a new Log Target of the specified type in the specified Backend. + operationId: createLogTargetBackend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a Log Target configuration by its index in the specified Backend. + operationId: replaceLogTargetBackend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_switching_rules: + get: + description: Returns all Server Switching Rules that are configured in specified backend. + operationId: getServerSwitchingRules + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Server Switching Rules + tags: + - ServerSwitchingRule + put: + description: Replaces a whole list of Server Switching Rules with the list given in parameter for the specified backend. + operationId: replaceServerSwitchingRules + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + description: All Server Switching Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Server Switching Rule list + tags: + - ServerSwitchingRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}: + delete: + description: Deletes a Server Switching Rule configuration by its index from the specified backend. + operationId: deleteServerSwitchingRule + parameters: + - description: Server Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Server Switching Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Server Switching Rule + tags: + - ServerSwitchingRule + get: + description: Returns one Server Switching Rule configuration by its index in the specified backend. + operationId: getServerSwitchingRule + parameters: + - description: Server Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Server Switching Rule + tags: + - ServerSwitchingRule + post: + description: Adds a new Server Switching Rule in the specified backend. + operationId: createServerSwitchingRule + parameters: + - description: Server Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + description: Server Switching Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Server Switching Rule + tags: + - ServerSwitchingRule + x-codegen-request-body-name: data + put: + description: Replaces a Server Switching Rule configuration by its index in the specified backend. + operationId: replaceServerSwitchingRule + parameters: + - description: Server Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + description: Server Switching Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Server Switching Rule + tags: + - ServerSwitchingRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_templates: + get: + description: Returns all server templates that are configured in specified backend. + operationId: getServerTemplates + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_templates' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of server templates + tags: + - ServerTemplate + post: + description: Adds a new server template in the specified backend. + operationId: createServerTemplate + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + description: Server Template created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new server template + tags: + - ServerTemplate + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}: + delete: + description: Deletes a server template configuration by its prefix from the specified backend. + operationId: deleteServerTemplate + parameters: + - description: Server template prefix + in: path + name: prefix + required: true + schema: + type: string + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Server Template deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a server template + tags: + - ServerTemplate + get: + description: Returns one server template configuration by its prefix in the specified backend. + operationId: getServerTemplate + parameters: + - description: Server template prefix + in: path + name: prefix + required: true + schema: + type: string + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one server template + tags: + - ServerTemplate + put: + description: Replaces a server template configuration by its prefix in the specified backend. + operationId: replaceServerTemplate + parameters: + - description: Server template prefix + in: path + name: prefix + required: true + schema: + type: string + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + description: Server Template replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a server template + tags: + - ServerTemplate + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/servers: + get: + description: Returns all servers that are configured in specified Backend. + operationId: getAllServerBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/servers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of servers + tags: + - Server + post: + description: Adds a new server in the specified Backend. + operationId: createServerBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/servers/{name}: + delete: + description: Deletes a server configuration by its name from the specified Backend. + operationId: deleteServerBackend + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Server deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a server + tags: + - Server + get: + description: Returns one server configuration by its name in the specified Backend. + operationId: getServerBackend + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one server + tags: + - Server + put: + description: Replaces a server configuration by its name in the specified Backend. + operationId: replaceServerBackend + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/stick_rules: + get: + description: Returns all Stick Rules that are configured in specified backend. + operationId: getStickRules + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Stick Rules + tags: + - StickRule + put: + description: Replaces a whole list of Stick Rules with the list given in parameter for the specified backend. + operationId: replaceStickRules + parameters: + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + description: All Stick Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Stick Rule list + tags: + - StickRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}: + delete: + description: Deletes a Stick Rule configuration by its index from the specified backend. + operationId: deleteStickRule + parameters: + - description: Stick Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Stick Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Stick Rule + tags: + - StickRule + get: + description: Returns one Stick Rule configuration by its index in the specified backend. + operationId: getStickRule + parameters: + - description: Stick Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Stick Rule + tags: + - StickRule + post: + description: Adds a new Stick Rule in the specified backend. + operationId: createStickRule + parameters: + - description: Stick Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + description: Stick Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Stick Rule + tags: + - StickRule + x-codegen-request-body-name: data + put: + description: Replaces a Stick Rule configuration by its index in the specified backend. + operationId: replaceStickRule + parameters: + - description: Stick Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent backend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + description: Stick Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Stick Rule + tags: + - StickRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_checks: + get: + description: Returns all TCP Checks that are configured in specified Backend. + operationId: getAllTCPCheckBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Checks + tags: + - TCPCheck + put: + description: Replaces a whole list of TCP Checks with the list given in parameter for the specified Backend. + operationId: replaceAllTCPCheckBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: All TCP Checks replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Check list + tags: + - TCPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_checks/{index}: + delete: + description: Deletes a TCP Check configuration by its index from the specified Backend. + operationId: deleteTCPCheckBackend + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Check deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Check + tags: + - TCPCheck + get: + description: Returns one TCP Check configuration by its index in the specified Backend. + operationId: getTCPCheckBackend + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Check + tags: + - TCPCheck + post: + description: Adds a new TCP Check of the specified type in the specified Backend. + operationId: createTCPCheckBackend + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: TCP Check created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Check + tags: + - TCPCheck + x-codegen-request-body-name: data + put: + description: Replaces a TCP Check configuration by its index in the specified Backend. + operationId: replaceTCPCheckBackend + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: TCP Check replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Check + tags: + - TCPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules: + get: + description: Returns all TCP Request Rules that are configured in specified Backend. + operationId: getAllTCPRequestRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Request Rules + tags: + - TCPRequestRule + put: + description: Replaces a whole list of TCP Request Rules with the list given in parameter for the specified Backend. + operationId: replaceAllTCPRequestRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: All TCP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule list + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_request_rules/{index}: + delete: + description: Deletes a TCP Request Rule configuration by its index from the specified Backend. + operationId: deleteTCPRequestRuleBackend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Request Rule + tags: + - TCPRequestRule + get: + description: Returns one TCP Request Rule configuration by its index in the specified Backend. + operationId: getTCPRequestRuleBackend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Request Rule + tags: + - TCPRequestRule + post: + description: Adds a new TCP Request Rule of the specified type in the specified Backend. + operationId: createTCPRequestRuleBackend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a TCP Request Rule configuration by its index in the specified Backend. + operationId: replaceTCPRequestRuleBackend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules: + get: + description: Returns all TCP Response Rules that are configured in specified Backend. + operationId: getAllTCPResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Response Rules + tags: + - TCPResponseRule + put: + description: Replaces a whole list of TCP Response Rules with the list given in parameter for the specified Backend. + operationId: replaceAllTCPResponseRuleBackend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: All TCP Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Response Rule list + tags: + - TCPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/tcp_response_rules/{index}: + delete: + description: Deletes a TCP Response Rule configuration by its index from the specified Backend. + operationId: deleteTCPResponseRuleBackend + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Response Rule + tags: + - TCPResponseRule + get: + description: Returns one TCP Response Rule configuration by its index in the specified Backend. + operationId: getTCPResponseRuleBackend + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Response Rule + tags: + - TCPResponseRule + post: + description: Adds a new TCP Response Rule of the specified type in the specified Backend. + operationId: createTCPResponseRuleBackend + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: TCP Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Response Rule + tags: + - TCPResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a TCP Response Rule configuration by its index in the specified Backend. + operationId: replaceTCPResponseRuleBackend + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: TCP Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Response Rule + tags: + - TCPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/caches: + get: + description: Returns an array of all configured caches. + operationId: getCaches + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/caches' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of caches + tags: + - Cache + post: + description: Adds a new cache section to the configuration file. + operationId: createCache + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + description: Cache created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a cache + tags: + - Cache + x-codegen-request-body-name: data + /services/haproxy/configuration/caches/{name}: + delete: + description: Deletes a cache from the configuration by its name. + operationId: deleteCache + parameters: + - description: Cache name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Cache deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a cache + tags: + - Cache + get: + description: Returns one cache section configuration by its name. + operationId: getCache + parameters: + - description: Cache name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a cache + tags: + - Cache + put: + description: Replaces a cache configuration by its name. + operationId: replaceCache + parameters: + - description: Cache name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + description: Cache replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a cache + tags: + - Cache + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores: + get: + description: Returns all crt stores that are configured. + operationId: getCrtStores + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_stores' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of crt stores + tags: + - CrtStore + post: + description: Adds a new crt store to the configuration. + operationId: createCrtStore + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + description: Crt Store created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new crt store + tags: + - CrtStore + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads: + get: + description: Returns all crt loads that are configured in the specified crt store. + operationId: getCrtLoads + parameters: + - description: Parent crt_store name + in: path + name: crt_store + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_loads' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of crt loads + tags: + - CrtLoad + post: + description: Adds a new crt load to the specified crt store. + operationId: createCrtLoad + parameters: + - description: Parent crt_store name + in: path + name: crt_store + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + description: Crt Load created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a crt load + tags: + - CrtLoad + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}: + delete: + description: Deletes a crt load configuration by its certificate filename from the specified crt store. + operationId: deleteCrtLoad + parameters: + - description: Parent crt_store name + in: path + name: crt_store + required: true + schema: + type: string + - description: Certificate filename + in: path + name: certificate + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Crt Load deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a crt load + tags: + - CrtLoad + get: + description: Returns one crt load configuration by its certificate filename in the specified crt store. + operationId: getCrtLoad + parameters: + - description: Parent crt_store name + in: path + name: crt_store + required: true + schema: + type: string + - description: Certificate filename + in: path + name: certificate + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one crt load + tags: + - CrtLoad + put: + description: Replaces a crt load configuration by its certificate filename in the specified crt store. + operationId: replaceCrtLoad + parameters: + - description: Parent crt_store name + in: path + name: crt_store + required: true + schema: + type: string + - description: Certificate filename + in: path + name: certificate + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + description: Crt Load replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a crt load + tags: + - CrtLoad + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores/{name}: + delete: + description: Deletes a crt store configuration by its name. + operationId: deleteCrtStore + parameters: + - description: Crt store name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Crt Store deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a crt store + tags: + - CrtStore + get: + description: Returns one crt store configuration by its name. + operationId: getCrtStore + parameters: + - description: Crt store name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one crt store + tags: + - CrtStore + put: + description: Replaces a crt store configuration by its name. + operationId: editCrtStore + parameters: + - description: Crt store name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + description: Crt Store replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a crt store + tags: + - CrtStore + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults: + get: + description: Returns an array of all configured defaults sections. + operationId: getDefaultsSections + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults_sections' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of defaults sections + tags: + - Defaults + post: + description: Adds a new defaults section to the configuration file. + operationId: addDefaultsSection + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Defaults section created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a defaults section + tags: + - Defaults + x-codegen-request-body-name: data + put: + deprecated: true + description: Adds a new defaults section to the configuration file. + operationId: createDefaultsSection + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Defaults section created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a defaults section + tags: + - Defaults + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{name}: + delete: + description: Deletes a defaults section from the configuration by its name. + operationId: deleteDefaultsSection + parameters: + - description: Defaults section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Defaults section deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a defaults section + tags: + - Defaults + get: + description: Returns one defaults section configuration by its name. + operationId: getDefaultsSection + parameters: + - description: Defaults section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a defaults section + tags: + - Defaults + put: + description: Replaces a defaults section configuration by its name. + operationId: replaceDefaultsSection + parameters: + - description: Defaults section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Defaults section replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a defaults section + tags: + - Defaults + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/acls: + get: + description: Returns all ACL lines that are configured in specified Defaults. + operationId: getAllAclDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ACL name + in: query + name: acl_name + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all ACL lines + tags: + - ACL + put: + description: Replaces a whole list of ACLs with the list given in parameter for the specified Defaults. + operationId: replaceAllAclDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: All ACL lines replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an ACL list + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/acls/{index}: + delete: + description: Deletes a ACL line configuration by its index from the specified Defaults. + operationId: deleteAclDefaults + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: ACL line deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a ACL line + tags: + - ACL + get: + description: Returns one ACL line configuration by its index in the specified Defaults. + operationId: getAclDefaults + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one ACL line + tags: + - ACL + post: + description: Adds a new ACL line of the specified type in the specified Defaults. + operationId: createAclDefaults + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new ACL line + tags: + - ACL + x-codegen-request-body-name: data + put: + description: Replaces a ACL line configuration by its index in the specified Defaults. + operationId: replaceAclDefaults + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a ACL line + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules: + get: + description: Returns all HTTP After Response Rules that are configured in specified Defaults. + operationId: getAllHTTPAfterResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP After Response Rules + tags: + - HTTPAfterResponseRule + put: + description: Replaces a whole list of HTTP After Response Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllHTTPAfterResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: All HTTP After Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP After Response Rule list + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_after_response_rules/{index}: + delete: + description: Deletes a HTTP After Response Rule configuration by its index from the specified Defaults. + operationId: deleteHTTPAfterResponseRuleDefaults + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP After Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + get: + description: Returns one HTTP After Response Rule configuration by its index in the specified Defaults. + operationId: getHTTPAfterResponseRuleDefaults + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP After Response Rule + tags: + - HTTPAfterResponseRule + post: + description: Adds a new HTTP After Response Rule of the specified type in the specified Defaults. + operationId: createHTTPAfterResponseRuleDefaults + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP After Response Rule configuration by its index in the specified Defaults. + operationId: replaceHTTPAfterResponseRuleDefaults + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_checks: + get: + description: Returns all HTTP Checks that are configured in specified Defaults. + operationId: getAllHTTPCheckDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Checks + tags: + - HTTPCheck + put: + description: Replaces a whole list of HTTP Checks with the list given in parameter for the specified Defaults. + operationId: replaceAllHTTPCheckDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: All HTTP Checks replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Check list + tags: + - HTTPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_checks/{index}: + delete: + description: Deletes a HTTP Check configuration by its index from the specified Defaults. + operationId: deleteHTTPCheckDefaults + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Check deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Check + tags: + - HTTPCheck + get: + description: Returns one HTTP Check configuration by its index in the specified Defaults. + operationId: getHTTPCheckDefaults + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Check + tags: + - HTTPCheck + post: + description: Adds a new HTTP Check of the specified type in the specified Defaults. + operationId: createHTTPCheckDefaults + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: HTTP Check created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Check + tags: + - HTTPCheck + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Check configuration by its index in the specified Defaults. + operationId: replaceHTTPCheckDefaults + parameters: + - description: HTTP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: HTTP Check replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Check + tags: + - HTTPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_error_rules: + get: + description: Returns all HTTP Error Rules that are configured in specified Defaults. + operationId: getAllHTTPErrorRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Error Rules + tags: + - HTTPErrorRule + put: + description: Replaces a whole list of HTTP Error Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllHTTPErrorRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: All HTTP Error Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Error Rule list + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_error_rules/{index}: + delete: + description: Deletes a HTTP Error Rule configuration by its index from the specified Defaults. + operationId: deleteHTTPErrorRuleDefaults + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Error Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Error Rule + tags: + - HTTPErrorRule + get: + description: Returns one HTTP Error Rule configuration by its index in the specified Defaults. + operationId: getHTTPErrorRuleDefaults + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Error Rule + tags: + - HTTPErrorRule + post: + description: Adds a new HTTP Error Rule of the specified type in the specified Defaults. + operationId: createHTTPErrorRuleDefaults + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Error Rule configuration by its index in the specified Defaults. + operationId: replaceHTTPErrorRuleDefaults + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_request_rules: + get: + description: Returns all HTTP Request Rules that are configured in specified Defaults. + operationId: getAllHTTPRequestRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Request Rules + tags: + - HTTPRequestRule + put: + description: Replaces a whole list of HTTP Request Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllHTTPRequestRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: All HTTP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Request Rule list + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_request_rules/{index}: + delete: + description: Deletes a HTTP Request Rule configuration by its index from the specified Defaults. + operationId: deleteHTTPRequestRuleDefaults + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Request Rule + tags: + - HTTPRequestRule + get: + description: Returns one HTTP Request Rule configuration by its index in the specified Defaults. + operationId: getHTTPRequestRuleDefaults + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Request Rule + tags: + - HTTPRequestRule + post: + description: Adds a new HTTP Request Rule of the specified type in the specified Defaults. + operationId: createHTTPRequestRuleDefaults + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Request Rule configuration by its index in the specified Defaults. + operationId: replaceHTTPRequestRuleDefaults + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_response_rules: + get: + description: Returns all HTTP Response Rules that are configured in specified Defaults. + operationId: getAllHTTPResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Response Rules + tags: + - HTTPResponseRule + put: + description: Replaces a whole list of HTTP Response Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllHTTPResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: All HTTP Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Response Rule list + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/http_response_rules/{index}: + delete: + description: Deletes a HTTP Response Rule configuration by its index from the specified Defaults. + operationId: deleteHTTPResponseRuleDefaults + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Response Rule + tags: + - HTTPResponseRule + get: + description: Returns one HTTP Response Rule configuration by its index in the specified Defaults. + operationId: getHTTPResponseRuleDefaults + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Response Rule + tags: + - HTTPResponseRule + post: + description: Adds a new HTTP Response Rule of the specified type in the specified Defaults. + operationId: createHTTPResponseRuleDefaults + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Response Rule configuration by its index in the specified Defaults. + operationId: replaceHTTPResponseRuleDefaults + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/log_targets: + get: + description: Returns all Log Targets that are configured in specified Defaults. + operationId: getAllLogTargetDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of Log Targets with the list given in parameter for the specified Defaults. + operationId: replaceAllLogTargetDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/log_targets/{index}: + delete: + description: Deletes a Log Target configuration by its index from the specified Defaults. + operationId: deleteLogTargetDefaults + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Log Target + tags: + - LogTarget + get: + description: Returns one Log Target configuration by its index in the specified Defaults. + operationId: getLogTargetDefaults + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Log Target + tags: + - LogTarget + post: + description: Adds a new Log Target of the specified type in the specified Defaults. + operationId: createLogTargetDefaults + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a Log Target configuration by its index in the specified Defaults. + operationId: replaceLogTargetDefaults + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules: + get: + description: Returns all QUIC Initial Rules that are configured in specified Defaults. + operationId: getAllQUICInitialRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all QUIC Initial Rules + tags: + - QUICInitialRule + put: + description: Replaces a whole list of QUIC Initial Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllQUICInitialRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: All QUIC Initial Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a QUIC Initial Rule list + tags: + - QUICInitialRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/quic_initial_rules/{index}: + delete: + description: Deletes a QUIC Initial Rule configuration by its index from the specified Defaults. + operationId: deleteQUICInitialRuleDefaults + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: QUIC Initial Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a QUIC Initial Rule + tags: + - QUICInitialRule + get: + description: Returns one QUIC Initial Rule configuration by its index in the specified Defaults. + operationId: getQUICInitialRuleDefaults + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one QUIC Initial Rule + tags: + - QUICInitialRule + post: + description: Adds a new QUIC Initial Rule of the specified type in the specified Defaults. + operationId: createQUICInitialRuleDefaults + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: QUIC Initial Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new QUIC Initial Rule + tags: + - QUICInitialRule + x-codegen-request-body-name: data + put: + description: Replaces a QUIC Initial Rule configuration by its index in the specified Defaults. + operationId: replaceQUICInitialRuleDefaults + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: QUIC Initial Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a QUIC Initial Rule + tags: + - QUICInitialRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_checks: + get: + description: Returns all TCP Checks that are configured in specified Defaults. + operationId: getAllTCPCheckDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Checks + tags: + - TCPCheck + put: + description: Replaces a whole list of TCP Checks with the list given in parameter for the specified Defaults. + operationId: replaceAllTCPCheckDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: All TCP Checks replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Check list + tags: + - TCPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_checks/{index}: + delete: + description: Deletes a TCP Check configuration by its index from the specified Defaults. + operationId: deleteTCPCheckDefaults + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Check deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Check + tags: + - TCPCheck + get: + description: Returns one TCP Check configuration by its index in the specified Defaults. + operationId: getTCPCheckDefaults + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Check + tags: + - TCPCheck + post: + description: Adds a new TCP Check of the specified type in the specified Defaults. + operationId: createTCPCheckDefaults + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: TCP Check created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Check + tags: + - TCPCheck + x-codegen-request-body-name: data + put: + description: Replaces a TCP Check configuration by its index in the specified Defaults. + operationId: replaceTCPCheckDefaults + parameters: + - description: TCP Check Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: TCP Check replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Check + tags: + - TCPCheck + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules: + get: + description: Returns all TCP Request Rules that are configured in specified Defaults. + operationId: getAllTCPRequestRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Request Rules + tags: + - TCPRequestRule + put: + description: Replaces a whole list of TCP Request Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllTCPRequestRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: All TCP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule list + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_request_rules/{index}: + delete: + description: Deletes a TCP Request Rule configuration by its index from the specified Defaults. + operationId: deleteTCPRequestRuleDefaults + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Request Rule + tags: + - TCPRequestRule + get: + description: Returns one TCP Request Rule configuration by its index in the specified Defaults. + operationId: getTCPRequestRuleDefaults + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Request Rule + tags: + - TCPRequestRule + post: + description: Adds a new TCP Request Rule of the specified type in the specified Defaults. + operationId: createTCPRequestRuleDefaults + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a TCP Request Rule configuration by its index in the specified Defaults. + operationId: replaceTCPRequestRuleDefaults + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules: + get: + description: Returns all TCP Response Rules that are configured in specified Defaults. + operationId: getAllTCPResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Response Rules + tags: + - TCPResponseRule + put: + description: Replaces a whole list of TCP Response Rules with the list given in parameter for the specified Defaults. + operationId: replaceAllTCPResponseRuleDefaults + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: All TCP Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Response Rule list + tags: + - TCPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/defaults/{parent_name}/tcp_response_rules/{index}: + delete: + description: Deletes a TCP Response Rule configuration by its index from the specified Defaults. + operationId: deleteTCPResponseRuleDefaults + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Response Rule + tags: + - TCPResponseRule + get: + description: Returns one TCP Response Rule configuration by its index in the specified Defaults. + operationId: getTCPResponseRuleDefaults + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Response Rule + tags: + - TCPResponseRule + post: + description: Adds a new TCP Response Rule of the specified type in the specified Defaults. + operationId: createTCPResponseRuleDefaults + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: TCP Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Response Rule + tags: + - TCPResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a TCP Response Rule configuration by its index in the specified Defaults. + operationId: replaceTCPResponseRuleDefaults + parameters: + - description: TCP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: TCP Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Response Rule + tags: + - TCPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/fcgi_apps: + get: + description: Returns an array of all configured FCGI applications. + operationId: getFCGIApps + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_apps' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of FCGI apps + tags: + - FCGIApp + post: + description: Adds a new FCGI application to the configuration file. + operationId: createFCGIApp + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + description: FCGI app created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add an FCGI app + tags: + - FCGIApp + x-codegen-request-body-name: data + /services/haproxy/configuration/fcgi_apps/{name}: + delete: + description: Deletes a FCGI application from the configuration by its name. + operationId: deleteFCGIApp + parameters: + - description: FCGI app name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: FCGI app deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete an FCGI app + tags: + - FCGIApp + get: + description: Returns one FCGI application configuration by its name. + operationId: getFCGIApp + parameters: + - description: FCGI app name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a FCGI app + tags: + - FCGIApp + put: + description: Replaces a FCGI application configuration by its name. + operationId: replaceFCGIApp + parameters: + - description: FCGI app name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + description: FCGI app replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a FCGI app + tags: + - FCGIApp + x-codegen-request-body-name: data + /services/haproxy/configuration/fcgi_apps/{parent_name}/acls: + get: + description: Returns all ACL lines that are configured in specified FCGIApp. + operationId: getAllAclFCGIApp + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ACL name + in: query + name: acl_name + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all ACL lines + tags: + - ACL + put: + description: Replaces a whole list of ACLs with the list given in parameter for the specified FCGIApp. + operationId: replaceAllAclFCGIApp + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: All ACL lines replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an ACL list + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/fcgi_apps/{parent_name}/acls/{index}: + delete: + description: Deletes a ACL line configuration by its index from the specified FCGIApp. + operationId: deleteAclFCGIApp + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: ACL line deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a ACL line + tags: + - ACL + get: + description: Returns one ACL line configuration by its index in the specified FCGIApp. + operationId: getAclFCGIApp + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one ACL line + tags: + - ACL + post: + description: Adds a new ACL line of the specified type in the specified FCGIApp. + operationId: createAclFCGIApp + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new ACL line + tags: + - ACL + x-codegen-request-body-name: data + put: + description: Replaces a ACL line configuration by its index in the specified FCGIApp. + operationId: replaceAclFCGIApp + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a ACL line + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends: + get: + description: Returns an array of all configured frontends. + operationId: getFrontends + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/frontends' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of frontends + tags: + - Frontend + post: + description: Adds a new frontend to the configuration file. + operationId: createFrontend + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + description: Frontend created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a frontend + tags: + - Frontend + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{name}: + delete: + description: Deletes a frontend from the configuration by its name. + operationId: deleteFrontend + parameters: + - description: Frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Frontend deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a frontend + tags: + - Frontend + get: + description: Returns one frontend configuration by its name. + operationId: getFrontend + parameters: + - description: Frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a frontend + tags: + - Frontend + put: + description: Replaces a frontend configuration by its name. + operationId: replaceFrontend + parameters: + - description: Frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + description: Frontend replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a frontend + tags: + - Frontend + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/acls: + get: + description: Returns all ACL lines that are configured in specified Frontend. + operationId: getAllAclFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ACL name + in: query + name: acl_name + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all ACL lines + tags: + - ACL + put: + description: Replaces a whole list of ACLs with the list given in parameter for the specified Frontend. + operationId: replaceAllAclFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: All ACL lines replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an ACL list + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/acls/{index}: + delete: + description: Deletes a ACL line configuration by its index from the specified Frontend. + operationId: deleteAclFrontend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: ACL line deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a ACL line + tags: + - ACL + get: + description: Returns one ACL line configuration by its index in the specified Frontend. + operationId: getAclFrontend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one ACL line + tags: + - ACL + post: + description: Adds a new ACL line of the specified type in the specified Frontend. + operationId: createAclFrontend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new ACL line + tags: + - ACL + x-codegen-request-body-name: data + put: + description: Replaces a ACL line configuration by its index in the specified Frontend. + operationId: replaceAclFrontend + parameters: + - description: ACL line Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: ACL line replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a ACL line + tags: + - ACL + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules: + get: + description: Returns all Backend Switching Rules that are configured in specified frontend. + operationId: getBackendSwitchingRules + parameters: + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Backend Switching Rules + tags: + - BackendSwitchingRule + put: + description: Replaces a whole list of Backend Switching Rules with the list given in parameter for the specified frontend. + operationId: replaceBackendSwitchingRules + parameters: + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + description: All Backend Switching Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Backend Switching Rule list + tags: + - BackendSwitchingRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}: + delete: + description: Deletes a Backend Switching Rule configuration by its index from the specified frontend. + operationId: deleteBackendSwitchingRule + parameters: + - description: Backend Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Backend Switching Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Backend Switching Rule + tags: + - BackendSwitchingRule + get: + description: Returns one Backend Switching Rule configuration by its index in the specified frontend. + operationId: getBackendSwitchingRule + parameters: + - description: Backend Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Backend Switching Rule + tags: + - BackendSwitchingRule + post: + description: Adds a new Backend Switching Rule in the specified frontend. + operationId: createBackendSwitchingRule + parameters: + - description: Backend Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + description: Backend Switching Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Backend Switching Rule + tags: + - BackendSwitchingRule + x-codegen-request-body-name: data + put: + description: Replaces a Backend Switching Rule configuration by its index in the specified frontend. + operationId: replaceBackendSwitchingRule + parameters: + - description: Backend Switching Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + description: Backend Switching Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Backend Switching Rule + tags: + - BackendSwitchingRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/binds: + get: + description: Returns all binds that are configured in specified Frontend. + operationId: getAllBindFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/binds' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of binds + tags: + - Bind + post: + description: Adds a new bind in the specified Frontend. + operationId: createBindFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/binds/{name}: + delete: + description: Deletes a bind configuration by its name from the specified Frontend. + operationId: deleteBindFrontend + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Bind deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a bind + tags: + - Bind + get: + description: Returns one bind configuration by its name in the specified Frontend. + operationId: getBindFrontend + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one bind + tags: + - Bind + put: + description: Replaces a bind configuration by its name in the specified Frontend. + operationId: replaceBindFrontend + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/captures: + get: + description: Returns all Declare Captures that are configured in specified frontend. + operationId: getDeclareCaptures + parameters: + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Declare Captures + tags: + - DeclareCapture + put: + description: Replaces a whole list of Declare Captures with the list given in parameter for the specified frontend. + operationId: replaceDeclareCaptures + parameters: + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + description: All Declare Captures replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Declare Capture list + tags: + - DeclareCapture + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/captures/{index}: + delete: + description: Deletes a Declare Capture configuration by its index from the specified frontend. + operationId: deleteDeclareCapture + parameters: + - description: Capture Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Declare Capture deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Declare Capture + tags: + - DeclareCapture + get: + description: Returns one Declare Capture configuration by its index in the specified frontend. + operationId: getDeclareCapture + parameters: + - description: Capture Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Declare Capture + tags: + - DeclareCapture + post: + description: Adds a new Declare Capture in the specified frontend. + operationId: createDeclareCapture + parameters: + - description: Capture Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + description: Declare Capture created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Declare Capture + tags: + - DeclareCapture + x-codegen-request-body-name: data + put: + description: Replaces a Declare Capture configuration by its index in the specified frontend. + operationId: replaceDeclareCapture + parameters: + - description: Capture Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent frontend name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + description: Declare Capture replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Declare Capture + tags: + - DeclareCapture + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/filters: + get: + description: Returns all Filters that are configured in specified Frontend. + operationId: getAllFilterFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Filters + tags: + - Filter + put: + description: Replaces a whole list of Filters with the list given in parameter for the specified Frontend. + operationId: replaceAllFilterFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: All Filters replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Filter list + tags: + - Filter + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/filters/{index}: + delete: + description: Deletes a Filter configuration by its index from the specified Frontend. + operationId: deleteFilterFrontend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Filter deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Filter + tags: + - Filter + get: + description: Returns one Filter configuration by its index in the specified Frontend. + operationId: getFilterFrontend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Filter + tags: + - Filter + post: + description: Adds a new Filter of the specified type in the specified Frontend. + operationId: createFilterFrontend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Filter created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Filter + tags: + - Filter + x-codegen-request-body-name: data + put: + description: Replaces a Filter configuration by its index in the specified Frontend. + operationId: replaceFilterFrontend + parameters: + - description: Filter Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Filter replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Filter + tags: + - Filter + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules: + get: + description: Returns all HTTP After Response Rules that are configured in specified Frontend. + operationId: getAllHTTPAfterResponseRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP After Response Rules + tags: + - HTTPAfterResponseRule + put: + description: Replaces a whole list of HTTP After Response Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllHTTPAfterResponseRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: All HTTP After Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP After Response Rule list + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_after_response_rules/{index}: + delete: + description: Deletes a HTTP After Response Rule configuration by its index from the specified Frontend. + operationId: deleteHTTPAfterResponseRuleFrontend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP After Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + get: + description: Returns one HTTP After Response Rule configuration by its index in the specified Frontend. + operationId: getHTTPAfterResponseRuleFrontend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP After Response Rule + tags: + - HTTPAfterResponseRule + post: + description: Adds a new HTTP After Response Rule of the specified type in the specified Frontend. + operationId: createHTTPAfterResponseRuleFrontend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP After Response Rule configuration by its index in the specified Frontend. + operationId: replaceHTTPAfterResponseRuleFrontend + parameters: + - description: HTTP After Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: HTTP After Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP After Response Rule + tags: + - HTTPAfterResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_error_rules: + get: + description: Returns all HTTP Error Rules that are configured in specified Frontend. + operationId: getAllHTTPErrorRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Error Rules + tags: + - HTTPErrorRule + put: + description: Replaces a whole list of HTTP Error Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllHTTPErrorRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: All HTTP Error Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Error Rule list + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_error_rules/{index}: + delete: + description: Deletes a HTTP Error Rule configuration by its index from the specified Frontend. + operationId: deleteHTTPErrorRuleFrontend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Error Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Error Rule + tags: + - HTTPErrorRule + get: + description: Returns one HTTP Error Rule configuration by its index in the specified Frontend. + operationId: getHTTPErrorRuleFrontend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Error Rule + tags: + - HTTPErrorRule + post: + description: Adds a new HTTP Error Rule of the specified type in the specified Frontend. + operationId: createHTTPErrorRuleFrontend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Error Rule configuration by its index in the specified Frontend. + operationId: replaceHTTPErrorRuleFrontend + parameters: + - description: HTTP Error Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: HTTP Error Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Error Rule + tags: + - HTTPErrorRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_request_rules: + get: + description: Returns all HTTP Request Rules that are configured in specified Frontend. + operationId: getAllHTTPRequestRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Request Rules + tags: + - HTTPRequestRule + put: + description: Replaces a whole list of HTTP Request Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllHTTPRequestRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: All HTTP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Request Rule list + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_request_rules/{index}: + delete: + description: Deletes a HTTP Request Rule configuration by its index from the specified Frontend. + operationId: deleteHTTPRequestRuleFrontend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Request Rule + tags: + - HTTPRequestRule + get: + description: Returns one HTTP Request Rule configuration by its index in the specified Frontend. + operationId: getHTTPRequestRuleFrontend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Request Rule + tags: + - HTTPRequestRule + post: + description: Adds a new HTTP Request Rule of the specified type in the specified Frontend. + operationId: createHTTPRequestRuleFrontend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Request Rule configuration by its index in the specified Frontend. + operationId: replaceHTTPRequestRuleFrontend + parameters: + - description: HTTP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: HTTP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Request Rule + tags: + - HTTPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_response_rules: + get: + description: Returns all HTTP Response Rules that are configured in specified Frontend. + operationId: getAllHTTPResponseRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all HTTP Response Rules + tags: + - HTTPResponseRule + put: + description: Replaces a whole list of HTTP Response Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllHTTPResponseRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: All HTTP Response Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace an HTTP Response Rule list + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/http_response_rules/{index}: + delete: + description: Deletes a HTTP Response Rule configuration by its index from the specified Frontend. + operationId: deleteHTTPResponseRuleFrontend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP Response Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP Response Rule + tags: + - HTTPResponseRule + get: + description: Returns one HTTP Response Rule configuration by its index in the specified Frontend. + operationId: getHTTPResponseRuleFrontend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HTTP Response Rule + tags: + - HTTPResponseRule + post: + description: Adds a new HTTP Response Rule of the specified type in the specified Frontend. + operationId: createHTTPResponseRuleFrontend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + put: + description: Replaces a HTTP Response Rule configuration by its index in the specified Frontend. + operationId: replaceHTTPResponseRuleFrontend + parameters: + - description: HTTP Response Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: HTTP Response Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP Response Rule + tags: + - HTTPResponseRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/log_targets: + get: + description: Returns all Log Targets that are configured in specified Frontend. + operationId: getAllLogTargetFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of Log Targets with the list given in parameter for the specified Frontend. + operationId: replaceAllLogTargetFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/log_targets/{index}: + delete: + description: Deletes a Log Target configuration by its index from the specified Frontend. + operationId: deleteLogTargetFrontend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Log Target + tags: + - LogTarget + get: + description: Returns one Log Target configuration by its index in the specified Frontend. + operationId: getLogTargetFrontend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Log Target + tags: + - LogTarget + post: + description: Adds a new Log Target of the specified type in the specified Frontend. + operationId: createLogTargetFrontend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a Log Target configuration by its index in the specified Frontend. + operationId: replaceLogTargetFrontend + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules: + get: + description: Returns all QUIC Initial Rules that are configured in specified Frontend. + operationId: getAllQUICInitialRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all QUIC Initial Rules + tags: + - QUICInitialRule + put: + description: Replaces a whole list of QUIC Initial Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllQUICInitialRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: All QUIC Initial Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a QUIC Initial Rule list + tags: + - QUICInitialRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/quic_initial_rules/{index}: + delete: + description: Deletes a QUIC Initial Rule configuration by its index from the specified Frontend. + operationId: deleteQUICInitialRuleFrontend + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: QUIC Initial Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a QUIC Initial Rule + tags: + - QUICInitialRule + get: + description: Returns one QUIC Initial Rule configuration by its index in the specified Frontend. + operationId: getQUICInitialRuleFrontend + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one QUIC Initial Rule + tags: + - QUICInitialRule + post: + description: Adds a new QUIC Initial Rule of the specified type in the specified Frontend. + operationId: createQUICInitialRuleFrontend + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: QUIC Initial Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new QUIC Initial Rule + tags: + - QUICInitialRule + x-codegen-request-body-name: data + put: + description: Replaces a QUIC Initial Rule configuration by its index in the specified Frontend. + operationId: replaceQUICInitialRuleFrontend + parameters: + - description: QUIC Initial Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: QUIC Initial Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a QUIC Initial Rule + tags: + - QUICInitialRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses: + get: + description: Returns all SSL Front Uses that are configured in specified Frontend. + operationId: getAllSSLFrontUses + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_uses' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all SSL Front Uses + tags: + - SSLFrontUse + post: + description: Adds a new SSL Front Use in the specified Frontend. + operationId: createSSLFrontUse + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + description: SSL Front Use created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new SSL Front Use + tags: + - SSLFrontUse + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/ssl_front_uses/{index}: + delete: + description: Deletes a SSL Front Use configuration by its index from the specified Frontend. + operationId: deleteSSLFrontUse + parameters: + - description: SSL Front Use Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: SSL Front Use deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a SSL Front Use + tags: + - SSLFrontUse + get: + description: Returns one SSL Front Use configuration by its index in the specified Frontend. + operationId: getSSLFrontUse + parameters: + - description: SSL Front Use Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one SSL Front Use + tags: + - SSLFrontUse + put: + description: Replaces a SSL Front Use configuration by its index in the specified Frontend. + operationId: replaceSSLFrontUse + parameters: + - description: SSL Front Use Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + description: SSL Front Use replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a SSL Front Use + tags: + - SSLFrontUse + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules: + get: + description: Returns all TCP Request Rules that are configured in specified Frontend. + operationId: getAllTCPRequestRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all TCP Request Rules + tags: + - TCPRequestRule + put: + description: Replaces a whole list of TCP Request Rules with the list given in parameter for the specified Frontend. + operationId: replaceAllTCPRequestRuleFrontend + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: All TCP Request Rules replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule list + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/tcp_request_rules/{index}: + delete: + description: Deletes a TCP Request Rule configuration by its index from the specified Frontend. + operationId: deleteTCPRequestRuleFrontend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: TCP Request Rule deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a TCP Request Rule + tags: + - TCPRequestRule + get: + description: Returns one TCP Request Rule configuration by its index in the specified Frontend. + operationId: getTCPRequestRuleFrontend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one TCP Request Rule + tags: + - TCPRequestRule + post: + description: Adds a new TCP Request Rule of the specified type in the specified Frontend. + operationId: createTCPRequestRuleFrontend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + put: + description: Replaces a TCP Request Rule configuration by its index in the specified Frontend. + operationId: replaceTCPRequestRuleFrontend + parameters: + - description: TCP Request Rule Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: TCP Request Rule replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a TCP Request Rule + tags: + - TCPRequestRule + x-codegen-request-body-name: data + /services/haproxy/configuration/global: + get: + description: Returns global part of configuration. + operationId: getGlobal + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/global' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return a global part of configuration + tags: + - Global + put: + description: Replace global part of config. + operationId: replaceGlobal + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/global' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/global' + description: Global replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/global' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace global + tags: + - Global + x-codegen-request-body-name: data + /services/haproxy/configuration/global/log_targets: + get: + description: Returns all Log Targets that are configured in the global section. + operationId: getAllLogTargetGlobal + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all global Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of global Log Targets with the list given in parameter. + operationId: replaceAllLogTargetGlobal + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All global Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a global Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/global/log_targets/{index}: + delete: + description: Deletes a global Log Target configuration by its index. + operationId: deleteLogTargetGlobal + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Global Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a global Log Target + tags: + - LogTarget + get: + description: Returns one global Log Target configuration by its index. + operationId: getLogTargetGlobal + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one global Log Target + tags: + - LogTarget + post: + description: Adds a new global Log Target. + operationId: createLogTargetGlobal + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Global Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new global Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a global Log Target configuration by its index. + operationId: replaceLogTargetGlobal + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Global Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a global Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/groups: + get: + description: Returns an array of all groups belonging to the specified userlist. + operationId: getGroups + parameters: + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/groups' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of groups + tags: + - Group + post: + description: Adds a new group to the specified userlist. + operationId: createGroup + parameters: + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/group' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/group' + description: Group created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/group' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a group + tags: + - Group + x-codegen-request-body-name: data + /services/haproxy/configuration/groups/{name}: + delete: + description: Deletes a group from the specified userlist by name. + operationId: deleteGroup + parameters: + - description: Group name + in: path + name: name + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Group deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a group + tags: + - Group + get: + description: Returns one group from the specified userlist by name. + operationId: getGroup + parameters: + - description: Group name + in: path + name: name + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/group' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a group + tags: + - Group + put: + description: Replaces a group in the specified userlist by name. + operationId: replaceGroup + parameters: + - description: Group name + in: path + name: name + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/group' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/group' + description: Group replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/group' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a group + tags: + - Group + x-codegen-request-body-name: data + /services/haproxy/configuration/http_errors_sections: + get: + description: Returns an array of all configured HTTP errors sections. + operationId: getHTTPErrorsSections + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_sections' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of HTTP errors sections + tags: + - HTTPErrors + post: + description: Adds a new HTTP errors section to the configuration file. + operationId: createHTTPErrorsSection + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + description: HTTP errors section created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a HTTP errors section + tags: + - HTTPErrors + x-codegen-request-body-name: data + /services/haproxy/configuration/http_errors_sections/{name}: + delete: + description: Deletes a HTTP errors section from the configuration by its name. + operationId: deleteHTTPErrorsSection + parameters: + - description: HTTP errors section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: HTTP errors section deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a HTTP errors section + tags: + - HTTPErrors + get: + description: Returns one HTTP errors section configuration by its name. + operationId: getHTTPErrorsSection + parameters: + - description: HTTP errors section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a HTTP errors section + tags: + - HTTPErrors + put: + description: Replaces a HTTP errors section configuration by its name. + operationId: replaceHTTPErrorsSection + parameters: + - description: HTTP errors section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + description: HTTP errors section replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a HTTP errors section + tags: + - HTTPErrors + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards: + get: + description: Returns an array of all configured log forwards. + operationId: getLogForwards + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forwards' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of log forwards + tags: + - LogForward + post: + description: Adds a new log forward to the configuration file. + operationId: createLogForward + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + description: Log forward created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a log forward + tags: + - LogForward + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{name}: + delete: + description: Deletes a log forward from the configuration by its name. + operationId: deleteLogForward + parameters: + - description: Log forward name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log forward deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a log forward + tags: + - LogForward + get: + description: Returns one log forward configuration by its name. + operationId: getLogForward + parameters: + - description: Log forward name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a log forward + tags: + - LogForward + put: + description: Replaces a log forward configuration by its name. + operationId: replaceLogForward + parameters: + - description: Log forward name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + description: Log forward replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a log forward + tags: + - LogForward + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/binds: + get: + description: Returns all binds that are configured in specified LogForward. + operationId: getAllBindLogForward + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/binds' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of binds + tags: + - Bind + post: + description: Adds a new bind in the specified LogForward. + operationId: createBindLogForward + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/binds/{name}: + delete: + description: Deletes a bind configuration by its name from the specified LogForward. + operationId: deleteBindLogForward + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Bind deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a bind + tags: + - Bind + get: + description: Returns one bind configuration by its name in the specified LogForward. + operationId: getBindLogForward + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one bind + tags: + - Bind + put: + description: Replaces a bind configuration by its name in the specified LogForward. + operationId: replaceBindLogForward + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds: + get: + description: Returns all dgram binds that are configured in specified log forward. + operationId: getDgramBinds + parameters: + - description: Parent log forward name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_binds' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of dgram binds + tags: + - DgramBind + post: + description: Adds a new dgram bind in the specified log forward. + operationId: createDgramBind + parameters: + - description: Parent log forward name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + description: Dgram Bind created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new dgram bind + tags: + - DgramBind + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}: + delete: + description: Deletes a dgram bind configuration by its name from the specified log forward. + operationId: deleteDgramBind + parameters: + - description: Dgram Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent log forward name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Dgram Bind deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a dgram bind + tags: + - DgramBind + get: + description: Returns one dgram bind configuration by its name in the specified log forward. + operationId: getDgramBind + parameters: + - description: Dgram Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent log forward name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one dgram bind + tags: + - DgramBind + put: + description: Replaces a dgram bind configuration by its name in the specified log forward. + operationId: replaceDgramBind + parameters: + - description: Dgram Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent log forward name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + description: Dgram Bind replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a dgram bind + tags: + - DgramBind + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/log_targets: + get: + description: Returns all Log Targets that are configured in specified LogForward. + operationId: getAllLogTargetLogForward + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of Log Targets with the list given in parameter for the specified LogForward. + operationId: replaceAllLogTargetLogForward + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/log_targets/{index}: + delete: + description: Deletes a Log Target configuration by its index from the specified LogForward. + operationId: deleteLogTargetLogForward + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Log Target + tags: + - LogTarget + get: + description: Returns one Log Target configuration by its index in the specified LogForward. + operationId: getLogTargetLogForward + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Log Target + tags: + - LogTarget + post: + description: Adds a new Log Target of the specified type in the specified LogForward. + operationId: createLogTargetLogForward + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a Log Target configuration by its index in the specified LogForward. + operationId: replaceLogTargetLogForward + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/log_profiles: + get: + description: Returns an array of all configured log profiles. + operationId: getLogProfiles + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profiles' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of log profiles + tags: + - LogProfile + post: + description: Adds a new log profile to the configuration file. + operationId: createLogProfile + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + description: Log profile created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a log profile + tags: + - LogProfile + x-codegen-request-body-name: data + /services/haproxy/configuration/log_profiles/{name}: + delete: + description: Deletes a log profile from the configuration by its name. + operationId: deleteLogProfile + parameters: + - description: Log profile name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log profile deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a log profile + tags: + - LogProfile + get: + description: Returns one log profile configuration by its name. + operationId: getLogProfile + parameters: + - description: Log profile name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a log profile + tags: + - LogProfile + put: + description: Replaces a log profile configuration by its name. + operationId: editLogProfile + parameters: + - description: Log profile name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + description: Log profile replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a log profile + tags: + - LogProfile + x-codegen-request-body-name: data + /services/haproxy/configuration/mailer_entries: + get: + deprecated: true + description: Returns an array of all mailer entries belonging to the specified mailers section. + operationId: getMailerEntries + parameters: + - description: Parent mailers section name + in: query + name: mailers_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entries' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of mailer entries + tags: + - MailerEntry + post: + deprecated: true + description: Adds a new mailer entry to the specified mailers section. + operationId: createMailerEntry + parameters: + - description: Parent mailers section name + in: query + name: mailers_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + description: Mailer entry created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a mailer entry + tags: + - MailerEntry + x-codegen-request-body-name: data + /services/haproxy/configuration/mailer_entries/{name}: + delete: + deprecated: true + description: Deletes a mailer entry from the specified mailers section by name. + operationId: deleteMailerEntry + parameters: + - description: Mailer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent mailers section name + in: query + name: mailers_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Mailer entry deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a mailer entry + tags: + - MailerEntry + get: + deprecated: true + description: Returns one mailer entry from the specified mailers section by name. + operationId: getMailerEntry + parameters: + - description: Mailer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent mailers section name + in: query + name: mailers_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a mailer entry + tags: + - MailerEntry + put: + deprecated: true + description: Replaces a mailer entry in the specified mailers section by name. + operationId: replaceMailerEntry + parameters: + - description: Mailer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent mailers section name + in: query + name: mailers_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + description: Mailer entry replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a mailer entry + tags: + - MailerEntry + x-codegen-request-body-name: data + /services/haproxy/configuration/mailers_section: + get: + deprecated: true + description: Returns an array of all configured mailers sections. + operationId: getMailersSections + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_sections' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of mailers sections + tags: + - Mailers + post: + deprecated: true + description: Adds a new mailers section to the configuration file. + operationId: createMailersSection + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + description: Mailers section created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a mailers section + tags: + - Mailers + x-codegen-request-body-name: data + /services/haproxy/configuration/mailers_section/{name}: + delete: + deprecated: true + description: Deletes a mailers section from the configuration by its name. + operationId: deleteMailersSection + parameters: + - description: Mailers section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Mailers section deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a mailers section + tags: + - Mailers + get: + deprecated: true + description: Returns one mailers section configuration by its name. + operationId: getMailersSection + parameters: + - description: Mailers section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a mailers section + tags: + - Mailers + put: + deprecated: true + description: Replaces a mailers section configuration by its name. + operationId: editMailersSection + parameters: + - description: Mailers section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + description: Mailers section replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a mailers section + tags: + - Mailers + x-codegen-request-body-name: data + /services/haproxy/configuration/nameservers: + get: + description: Returns an array of all nameservers belonging to the specified resolver. + operationId: getNameservers + parameters: + - description: Parent resolver name + in: query + name: resolver + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/nameservers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of nameservers + tags: + - Nameserver + post: + description: Adds a new nameserver to the specified resolver. + operationId: createNameserver + parameters: + - description: Parent resolver name + in: query + name: resolver + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + description: Nameserver created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a nameserver + tags: + - Nameserver + x-codegen-request-body-name: data + /services/haproxy/configuration/nameservers/{name}: + delete: + description: Deletes a nameserver from the specified resolver by name. + operationId: deleteNameserver + parameters: + - description: Nameserver name + in: path + name: name + required: true + schema: + type: string + - description: Parent resolver name + in: query + name: resolver + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Nameserver deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a nameserver + tags: + - Nameserver + get: + description: Returns one nameserver from the specified resolver by name. + operationId: getNameserver + parameters: + - description: Nameserver name + in: path + name: name + required: true + schema: + type: string + - description: Parent resolver name + in: query + name: resolver + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a nameserver + tags: + - Nameserver + put: + description: Replaces a nameserver in the specified resolver by name. + operationId: replaceNameserver + parameters: + - description: Nameserver name + in: path + name: name + required: true + schema: + type: string + - description: Parent resolver name + in: query + name: resolver + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + description: Nameserver replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a nameserver + tags: + - Nameserver + x-codegen-request-body-name: data + /services/haproxy/configuration/peer_entries: + get: + description: Returns an array of all peer entries belonging to the specified peer section. + operationId: getPeerEntries + parameters: + - description: Parent peer section name + in: query + name: peer_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entries' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of peer entries + tags: + - PeerEntry + post: + description: Adds a new peer entry to the specified peer section. + operationId: createPeerEntry + parameters: + - description: Parent peer section name + in: query + name: peer_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + description: Peer entry created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a peer entry + tags: + - PeerEntry + x-codegen-request-body-name: data + /services/haproxy/configuration/peer_entries/{name}: + delete: + description: Deletes a peer entry from the specified peer section by name. + operationId: deletePeerEntry + parameters: + - description: Peer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent peer section name + in: query + name: peer_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Peer entry deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a peer entry + tags: + - PeerEntry + get: + description: Returns one peer entry from the specified peer section by name. + operationId: getPeerEntry + parameters: + - description: Peer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent peer section name + in: query + name: peer_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a peer entry + tags: + - PeerEntry + put: + description: Replaces a peer entry in the specified peer section by name. + operationId: replacePeerEntry + parameters: + - description: Peer entry name + in: path + name: name + required: true + schema: + type: string + - description: Parent peer section name + in: query + name: peer_section + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + description: Peer entry replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a peer entry + tags: + - PeerEntry + x-codegen-request-body-name: data + /services/haproxy/configuration/peer_section: + get: + description: Returns an array of all configured peer sections. + operationId: getPeerSections + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_sections' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of peer sections + tags: + - Peer + post: + description: Adds a new peer section to the configuration file. + operationId: createPeer + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + description: Peer section created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a peer section + tags: + - Peer + x-codegen-request-body-name: data + /services/haproxy/configuration/peer_section/{name}: + delete: + description: Deletes a peer section from the configuration by its name. + operationId: deletePeer + parameters: + - description: Peer section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Peer section deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a peer section + tags: + - Peer + get: + description: Returns one peer section configuration by its name. + operationId: getPeerSection + parameters: + - description: Peer section name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a peer section + tags: + - Peer + /services/haproxy/configuration/peers/{parent_name}/binds: + get: + description: Returns all binds that are configured in specified Peer. + operationId: getAllBindPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/binds' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of binds + tags: + - Bind + post: + description: Adds a new bind in the specified Peer. + operationId: createBindPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/binds/{name}: + delete: + description: Deletes a bind configuration by its name from the specified Peer. + operationId: deleteBindPeer + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Bind deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a bind + tags: + - Bind + get: + description: Returns one bind configuration by its name in the specified Peer. + operationId: getBindPeer + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one bind + tags: + - Bind + put: + description: Replaces a bind configuration by its name in the specified Peer. + operationId: replaceBindPeer + parameters: + - description: Bind name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Bind replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a bind + tags: + - Bind + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/log_targets: + get: + description: Returns all Log Targets that are configured in specified Peer. + operationId: getAllLogTargetPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all Log Targets + tags: + - LogTarget + put: + description: Replaces a whole list of Log Targets with the list given in parameter for the specified Peer. + operationId: replaceAllLogTargetPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: All Log Targets replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target list + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/log_targets/{index}: + delete: + description: Deletes a Log Target configuration by its index from the specified Peer. + operationId: deleteLogTargetPeer + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Log Target deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a Log Target + tags: + - LogTarget + get: + description: Returns one Log Target configuration by its index in the specified Peer. + operationId: getLogTargetPeer + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one Log Target + tags: + - LogTarget + post: + description: Adds a new Log Target of the specified type in the specified Peer. + operationId: createLogTargetPeer + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + put: + description: Replaces a Log Target configuration by its index in the specified Peer. + operationId: replaceLogTargetPeer + parameters: + - description: Log Target Index + in: path + name: index + required: true + schema: + type: integer + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Log Target replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a Log Target + tags: + - LogTarget + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/servers: + get: + description: Returns all servers that are configured in specified Peer. + operationId: getAllServerPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/servers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of servers + tags: + - Server + post: + description: Adds a new server in the specified Peer. + operationId: createServerPeer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/servers/{name}: + delete: + description: Deletes a server configuration by its name from the specified Peer. + operationId: deleteServerPeer + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Server deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a server + tags: + - Server + get: + description: Returns one server configuration by its name in the specified Peer. + operationId: getServerPeer + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one server + tags: + - Server + put: + description: Replaces a server configuration by its name in the specified Peer. + operationId: replaceServerPeer + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/tables: + get: + description: Returns all tables that are configured in specified peers section. + operationId: getTables + parameters: + - description: Parent peers section name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tables' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of tables + tags: + - Table + post: + description: Adds a new table in the specified peers section. + operationId: createTable + parameters: + - description: Parent peers section name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/table' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/table' + description: Table created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/table' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new table + tags: + - Table + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/tables/{name}: + delete: + description: Deletes a table configuration by its name from the specified peers section. + operationId: deleteTable + parameters: + - description: Table name + in: path + name: name + required: true + schema: + type: string + - description: Parent peers section name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Table deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a table + tags: + - Table + get: + description: Returns one table configuration by its name in the specified peers section. + operationId: getTable + parameters: + - description: Table name + in: path + name: name + required: true + schema: + type: string + - description: Parent peers section name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/table' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one table + tags: + - Table + put: + description: Replaces a table configuration by its name in the specified peers section. + operationId: replaceTable + parameters: + - description: Table name + in: path + name: name + required: true + schema: + type: string + - description: Parent peers section name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/table' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/table' + description: Table replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/table' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a table + tags: + - Table + x-codegen-request-body-name: data + /services/haproxy/configuration/programs: + get: + deprecated: true + description: Returns an array of all configured programs in the process-manager configuration file. + operationId: getPrograms + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/programs' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of programs + tags: + - ProcessManager + post: + deprecated: true + description: Adds a new program to the process-manager configuration file. + operationId: createProgram + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/program' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/program' + description: Program created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/program' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a program + tags: + - ProcessManager + x-codegen-request-body-name: data + /services/haproxy/configuration/programs/{name}: + delete: + deprecated: true + description: Deletes a program from the process-manager configuration file by its name. + operationId: deleteProgram + parameters: + - description: Program name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Program deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a program + tags: + - ProcessManager + get: + deprecated: true + description: Returns one program by its name from the process-manager configuration file. + operationId: getProgram + parameters: + - description: Program name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/program' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a program + tags: + - ProcessManager + put: + deprecated: true + description: Replaces a program from the process-manager configuration by its name. + operationId: replaceProgram + parameters: + - description: Program name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/program' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/program' + description: Program replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/program' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a program + tags: + - ProcessManager + x-codegen-request-body-name: data + /services/haproxy/configuration/raw: + get: + description: Returns HAProxy configuration file in plain text format. + operationId: getHAProxyConfiguration + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return HAProxy configuration as a plain text + tags: + - Configuration + post: + description: Push a new haproxy configuration file in plain text format. + operationId: postHAProxyConfiguration + parameters: + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: If set, no version check will be done and the pushed configuration will be applied directly. + in: query + name: skip_version + schema: + default: false + type: boolean + - description: If set, HAProxy will not be reloaded after the configuration is pushed. + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, the configuration will only be validated and not applied. + in: query + name: only_validate + schema: + default: false + type: boolean + - description: List of runtime actions to execute after the configuration is applied. + in: header + name: X-Runtime-Actions + schema: + type: string + requestBody: + content: + text/plain: + schema: + type: string + required: true + responses: + "201": + content: + text/plain: + schema: + type: string + description: New HAProxy configuration pushed + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + "202": + content: + text/plain: + schema: + type: string + description: Configuration change accepted and reload requested + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + content: + text/plain: + schema: + type: string + description: Bad request + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Push new haproxy configuration + tags: + - Configuration + x-codegen-request-body-name: data + /services/haproxy/configuration/resolvers: + get: + description: Returns an array of all configured resolvers. + operationId: getResolvers + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/resolvers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of resolvers + tags: + - Resolver + post: + description: Adds a new resolver to the configuration file. + operationId: createResolver + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + description: Resolver created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a resolver + tags: + - Resolver + x-codegen-request-body-name: data + /services/haproxy/configuration/resolvers/{name}: + delete: + description: Deletes a resolver from the configuration by its name. + operationId: deleteResolver + parameters: + - description: Resolver name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Resolver deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a resolver + tags: + - Resolver + get: + description: Returns one resolver configuration by its name. + operationId: getResolver + parameters: + - description: Resolver name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a resolver + tags: + - Resolver + put: + description: Replaces a resolver configuration by its name. + operationId: replaceResolver + parameters: + - description: Resolver name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + description: Resolver replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a resolver + tags: + - Resolver + x-codegen-request-body-name: data + /services/haproxy/configuration/rings: + get: + description: Returns an array of all configured rings. + operationId: getRings + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/rings' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of rings + tags: + - Ring + post: + description: Adds a new ring to the configuration file. + operationId: createRing + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + description: Ring created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a ring + tags: + - Ring + x-codegen-request-body-name: data + /services/haproxy/configuration/rings/{name}: + delete: + description: Deletes a ring from the configuration by its name. + operationId: deleteRing + parameters: + - description: Ring name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Ring deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a ring + tags: + - Ring + get: + description: Returns one ring configuration by its name. + operationId: getRing + parameters: + - description: Ring name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a ring + tags: + - Ring + put: + description: Replaces a ring configuration by its name. + operationId: replaceRing + parameters: + - description: Ring name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + description: Ring replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a ring + tags: + - Ring + x-codegen-request-body-name: data + /services/haproxy/configuration/rings/{parent_name}/servers: + get: + description: Returns all servers that are configured in specified Ring. + operationId: getAllServerRing + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/servers' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of servers + tags: + - Server + post: + description: Adds a new server in the specified Ring. + operationId: createServerRing + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/rings/{parent_name}/servers/{name}: + delete: + description: Deletes a server configuration by its name from the specified Ring. + operationId: deleteServerRing + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Server deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a server + tags: + - Server + get: + description: Returns one server configuration by its name in the specified Ring. + operationId: getServerRing + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one server + tags: + - Server + put: + description: Replaces a server configuration by its name in the specified Ring. + operationId: replaceServerRing + parameters: + - description: Server name + in: path + name: name + required: true + schema: + type: string + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/server' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Server replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/server' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a server + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/configuration/traces: + delete: + description: Delete the whole traces section. + operationId: deleteTraces + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Traces configuration deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete the traces configuration + tags: + - Traces + get: + description: Return the traces section contents. + operationId: getTraces + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return the traces configuration + tags: + - Traces + post: + description: Create the traces section. + operationId: createTraces + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + description: Traces configuration created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a traces configuration + tags: + - Traces + x-codegen-request-body-name: data + put: + description: Replace the traces section contents + operationId: replaceTraces + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + description: Traces configuration replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace the traces configuration + tags: + - Traces + x-codegen-request-body-name: data + /services/haproxy/configuration/traces/entries: + delete: + description: Deletes a trace entry from the traces section. + operationId: deleteTraceEntry + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + required: true + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Trace entry deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a trace entry + tags: + - Traces + x-codegen-request-body-name: data + post: + description: Adds a new trace entry into the traces section. The traces section will be created if needed. + operationId: createTraceEntry + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + description: Trace entry created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new trace entry + tags: + - Traces + x-codegen-request-body-name: data + /services/haproxy/configuration/userlists: + get: + description: Returns an array of all configured userlists. + operationId: getUserlists + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/userlists' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of userlists + tags: + - Userlist + post: + description: Adds a new userlist to the configuration file. + operationId: createUserlist + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + description: Userlist created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a userlist + tags: + - Userlist + x-codegen-request-body-name: data + /services/haproxy/configuration/userlists/{name}: + delete: + description: Deletes a userlist from the configuration by its name. + operationId: deleteUserlist + parameters: + - description: Userlist name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Userlist deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a userlist + tags: + - Userlist + get: + description: Returns one userlist configuration by its name. + operationId: getUserlist + parameters: + - description: Userlist name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Indicates if the action affects the specified child resources as well + in: query + name: full_section + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a userlist + tags: + - Userlist + /services/haproxy/configuration/users: + get: + description: Returns an array of all users belonging to the specified userlist. + operationId: getUsers + parameters: + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/users' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of users + tags: + - User + post: + description: Adds a new user to the specified userlist. + operationId: createUser + parameters: + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/user' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/user' + description: User created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/user' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a user + tags: + - User + x-codegen-request-body-name: data + /services/haproxy/configuration/users/{username}: + delete: + description: Deletes a user from the specified userlist by username. + operationId: deleteUser + parameters: + - description: User username + in: path + name: username + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: User deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a user + tags: + - User + get: + description: Returns one user from the specified userlist by username. + operationId: getUser + parameters: + - description: User username + in: path + name: username + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/user' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a user + tags: + - User + put: + description: Replaces a user in the specified userlist by username. + operationId: replaceUser + parameters: + - description: User username + in: path + name: username + required: true + schema: + type: string + - description: Parent userlist name + in: query + name: userlist + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/user' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/user' + description: User replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/user' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a user + tags: + - User + x-codegen-request-body-name: data + /services/haproxy/configuration/version: + get: + description: Returns the current HAProxy configuration file version. + operationId: getConfigurationVersion + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: integer + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return HAProxy configuration version + tags: + - Configuration + /services/haproxy/reloads: + get: + description: Returns a list of HAProxy reloads. + operationId: getReloads + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/reloads' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy Reloads. + tags: + - Reloads + /services/haproxy/reloads/{id}: + get: + description: Returns one HAProxy reload status. + operationId: getReload + parameters: + - description: Reload id + in: path + name: id + required: true + schema: + pattern: ^\d{4}-\d{2}-\d{2}-\d+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/reload' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HAProxy reload status + tags: + - Reloads + /services/haproxy/runtime: + get: + description: Returns a list of endpoints to be used for advanced runtime settings of HAProxy objects. + operationId: getRuntimeEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy advanced runtime endpoints + tags: + - Discovery + /services/haproxy/runtime/acls: + get: + description: Returns all ACL files using the runtime socket. + operationId: getAllRuntimeAclFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all ACL files + tags: + - ACL Runtime + /services/haproxy/runtime/acls/{id}: + get: + description: Returns an ACL file by id using the runtime socket. + operationId: getRuntimeAclFile + parameters: + - description: ACL file entry ID + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an ACL file + tags: + - ACL Runtime + /services/haproxy/runtime/acls/{parent_name}/entries: + get: + description: Returns an ACL runtime setting using the runtime socket. + operationId: getAllRuntimeAclFileEntries + parameters: + - description: ACL file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return ACL entries + tags: + - ACL Runtime + post: + description: Adds an entry into the ACL file using the runtime socket. + operationId: createRuntimeAclFileEntry + parameters: + - description: ACL file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + description: ACL entry created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add entry to an ACL file + tags: + - ACL Runtime + x-codegen-request-body-name: data + put: + description: Adds a new ACL payload. + operationId: addPayloadRuntimeACL + parameters: + - description: ACL file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + description: ACL payload added + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new ACL payload + tags: + - ACL Runtime + x-codegen-request-body-name: data + /services/haproxy/runtime/acls/{parent_name}/entries/{id}: + delete: + description: Deletes the entry from the ACL by its value using the runtime socket. + operationId: deleteRuntimeAclFileEntry + parameters: + - description: ACL file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: File entry ID + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "204": + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete an ACL entry + tags: + - ACL Runtime + get: + description: Returns the ACL entry by its ID using the runtime socket. + operationId: getRuntimeAclFileEntry + parameters: + - description: ACL file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: File entry ID + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an ACL entry + tags: + - ACL Runtime + /services/haproxy/runtime/acme: + get: + description: Returns the status of each managed ACME certificate. + operationId: getAcmeStatus + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/acme_status' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: ACME Status + tags: + - AcmeRuntime + put: + description: Force renewal of an ACME certificate. + operationId: renewAcmeCertificate + parameters: + - description: Certificate file name + in: query + name: certificate + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + description: Operation started + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Renew ACME certificate + tags: + - AcmeRuntime + /services/haproxy/runtime/backends/{parent_name}/servers: + get: + description: Returns an array of all servers' runtime settings. + operationId: getAllRuntimeServer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_servers' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of runtime servers' settings + tags: + - Server + post: + description: Adds a new server to the specified backend + operationId: addRuntimeServer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_add_server' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_add_server' + description: Server added + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Adds a new server to a backend + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/runtime/backends/{parent_name}/servers/{name}: + delete: + description: Deletes a server from the specified backend + operationId: deleteRuntimeServer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Server name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "204": + description: Server deleted + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes a server from a backend + tags: + - Server + get: + description: Returns one server runtime settings by it's name in the specified backend. + operationId: getRuntimeServer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Server name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one server runtime settings + tags: + - Server + put: + description: Replaces a server transient settings by it's name in the specified backend. + operationId: replaceRuntimeServer + parameters: + - description: Parent name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Server name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + description: Server transient settings replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace server transient settings + tags: + - Server + x-codegen-request-body-name: data + /services/haproxy/runtime/info: + get: + description: Return HAProxy process information + operationId: getHaproxyProcessInfo + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/process_info' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return HAProxy process information + tags: + - Information + /services/haproxy/runtime/maps: + get: + description: Returns runtime map files. + operationId: getAllRuntimeMapFiles + parameters: + - description: If true, also show unmanaged map files loaded in haproxy + in: query + name: include_unmanaged + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/maps' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return runtime map files + tags: + - Maps + /services/haproxy/runtime/maps/{name}: + delete: + description: Remove all map entries from the map file. + operationId: clearRuntimeMap + parameters: + - description: Map file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: If true, deletes file from disk + in: query + name: forceDelete + schema: + type: boolean + - description: If true, immediately syncs changes to disk + in: query + name: force_sync + schema: + default: false + type: boolean + responses: + "204": + description: All map entries deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Remove all map entries from the map file + tags: + - Maps + get: + description: Returns one runtime map file. + operationId: getOneRuntimeMap + parameters: + - description: Map file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/map' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one runtime map file + tags: + - Maps + put: + description: Adds a new map payload. + operationId: addPayloadRuntimeMap + parameters: + - description: Map file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: If true, immediately syncs changes to disk + in: query + name: force_sync + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + description: Map payload added + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new map payload + tags: + - Maps + x-codegen-request-body-name: data + /services/haproxy/runtime/maps/{parent_name}/entries: + get: + description: Returns an array of all entries in a given runtime map file. + operationId: showRuntimeMap + parameters: + - description: Map file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one map runtime entries + tags: + - Maps + post: + description: Adds an entry into the map file. + operationId: addMapEntry + parameters: + - description: Map file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: If true, immediately syncs changes to disk + in: query + name: force_sync + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + description: Map entry created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Adds an entry into the map file + tags: + - Maps + x-codegen-request-body-name: data + /services/haproxy/runtime/maps/{parent_name}/entries/{id}: + delete: + description: Delete all the map entries from the map by its id. + operationId: deleteRuntimeMapEntry + parameters: + - description: Map file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Map id + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: If true, immediately syncs changes to disk + in: query + name: force_sync + schema: + default: false + type: boolean + responses: + "204": + description: Map key/value deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes all the map entries from the map by its id + tags: + - Maps + get: + description: Returns one map runtime setting by it's id. + operationId: getRuntimeMapEntry + parameters: + - description: Map file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Map id + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one map runtime setting + tags: + - Maps + put: + description: Replaces the value corresponding to each id in a map. + operationId: replaceRuntimeMapEntry + parameters: + - description: Map file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Map id + in: path + name: id + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: If true, immediately syncs changes to disk + in: query + name: force_sync + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + properties: + value: + description: Map value + type: string + required: + - value + type: object + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + description: Map value replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace the value corresponding to each id in a map + tags: + - Maps + x-codegen-request-body-name: data + /services/haproxy/runtime/ssl_ca_files: + get: + description: Returns all SSL CA files using the runtime socket. + operationId: getAllCaFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_ca_files' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all SSL CA files + tags: + - SSLRuntime + post: + description: Creates a new SSL CA file using the runtime socket. + operationId: createCaFile + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: CA certificate file + format: binary + type: string + required: + - file_upload + type: object + responses: + "201": + description: SSL CA file created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Creates a new SSL CA file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_ca_files/{name}: + delete: + description: Deletes a CA file + operationId: deleteCaFile + parameters: + - description: SSL CA file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "204": + description: SSL CA deleted + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes a CA file + tags: + - SSLRuntime + get: + description: Returns an SSL CA file by name using the runtime socket. + operationId: getCaFile + parameters: + - description: SSL CA file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_ca_file' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an SSL CA file + tags: + - SSLRuntime + put: + description: Replace the contents of a CA file using the runtime socket. + operationId: setCaFile + parameters: + - description: SSL CA file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + format: binary + type: string + required: + - file_upload + type: object + responses: + "200": + description: SSL CA payload added + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Update the contents of a CA file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_ca_files/{name}/entries: + post: + description: Adds an entry to an existing CA file using the runtime socket. + operationId: addCaEntry + parameters: + - description: SSL CA file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: Payload of the cert entry + format: binary + type: string + required: + - file_upload + type: object + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a certificate to a CA file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}: + get: + description: Returns an SSL CA file cert entry. + operationId: getCaEntry + parameters: + - description: SSL CA file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: SSL CA file index + in: path + name: index + required: true + schema: + minimum: 0 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return an SSL CA file cert entry + tags: + - SSLRuntime + /services/haproxy/runtime/ssl_certs: + get: + description: Returns certificate files descriptions from runtime. + operationId: getAllCerts + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificates' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return a list of SSL certificate files + tags: + - SSLRuntime + post: + description: Creates a new SSL certificate file using the runtime socket. + operationId: createCert + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: Certificate file + format: binary + type: string + required: + - file_upload + type: object + responses: + "201": + description: Certificate created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Create a new SSL certificate file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_certs/{name}: + delete: + description: Deletes a certificate using the runtime socket. + operationId: deleteCert + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "204": + description: File deleted + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a certificate + tags: + - SSLRuntime + get: + description: Returns one structured certificate using the runtime socket. + operationId: getCert + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return one structured certificate + tags: + - SSLRuntime + put: + description: Sets a certificate payload using the runtime socket. + operationId: replaceCert + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + format: binary + type: string + required: + - file_upload + type: object + responses: + "200": + description: File updated + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace the contents of a certificate + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_crl_files: + get: + description: Returns all the certificate revocation list files using the runtime socket. + operationId: getAllCrl + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crls' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of all the CRL files + tags: + - SSLRuntime + post: + description: Creates a new CRL file with its contents using the runtime socket. + operationId: createCrl + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: CRL file + format: binary + type: string + required: + - file_upload + type: object + responses: + "201": + description: CRL file created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Create a new CRL file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_crl_files/{name}: + delete: + description: Deletes a CRL file using the runtime socket. + operationId: deleteCrl + parameters: + - description: CRL file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "204": + description: File deleted + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a CRL file + tags: + - SSLRuntime + get: + description: Returns one or all entries in a CRL file using the runtime socket. + operationId: getCrl + parameters: + - description: CRL file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Entry index to return. Starts at 1. If not provided, all entries are returned. + in: query + name: index + schema: + minimum: 1 + nullable: true + type: integer + x-go-type-skip-optional-pointer: false + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crl_entries' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Get the contents of a CRL file + tags: + - SSLRuntime + put: + description: Replaces the contents of a CRL file using the runtime socket. + operationId: replaceCrl + parameters: + - description: CRL file name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: CRL file contents + format: binary + type: string + required: + - file_upload + type: object + responses: + "200": + description: File modified + "400": + $ref: '#/components/responses/BadRequest' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace the contents of a CRL file + tags: + - SSLRuntime + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_crt_lists: + get: + description: Returns an array of crt-list file descriptions from runtime. + operationId: getAllCrtLists + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_lists' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Get the list of all crt-list files + tags: + - SSLRuntime + /services/haproxy/runtime/ssl_crt_lists/entries: + delete: + description: Deletes a single entry from the given crt-list using the runtime socket. + operationId: deleteCrtListEntry + parameters: + - description: SSL crt list name + in: query + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: SSL cert entry name + in: query + name: cert_file + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: The line number where the entry is located, in case several entries share the same certificate. + in: query + name: line_number + schema: + minimum: 1 + nullable: true + type: integer + x-go-type-skip-optional-pointer: false + responses: + "204": + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete an entry from a crt-list + tags: + - SSLRuntime + get: + description: Returns an array of entries present inside the given crt-list file. Their index can be used to delete them. + operationId: getAllCrtListEntries + parameters: + - description: SSL crt-list filename + in: query + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entries' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Get all the entries inside a crt-list + tags: + - SSLRuntime + post: + description: Appends an entry to the given crt-list using the runtime socket. + operationId: addCrtListEntry + parameters: + - description: SSL crt-list filename + in: query + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + required: true + responses: + "201": + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add an entry into a crt-list + tags: + - SSLRuntime + x-codegen-request-body-name: data + /services/haproxy/runtime/stick_tables: + get: + description: Returns an array of all stick tables. + operationId: getStickTables + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_tables' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return Stick Tables + tags: + - StickTable + /services/haproxy/runtime/stick_tables/{name}: + get: + description: Returns one stick table from runtime. + operationId: getStickTable + parameters: + - description: Stick table name + in: path + name: name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_table' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return Stick Table + tags: + - StickTable + /services/haproxy/runtime/stick_tables/{parent_name}/entries: + get: + description: Returns an array of all entries in a given stick tables. + operationId: getStickTableEntries + parameters: + - description: Stick table name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: A list of filters in format data. separated by comma + in: query + name: filter + schema: + pattern: ^[^\r\n;#]+$ + type: string + - description: Key which we want the entries for + in: query + name: key + schema: + pattern: ^[^\r\n;#]+$ + type: string + - description: Max number of entries to be returned for pagination + in: query + name: count + schema: + type: integer + x-go-type-skip-optional-pointer: false + - description: Offset which indicates how many items we skip in pagination + in: query + name: offset + schema: + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/stick_table_entries' + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Return Stick Table Entries + tags: + - StickTable + post: + description: Create or update a stick-table entry in the table. + operationId: setStickTableEntries + parameters: + - description: Stick table name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + requestBody: + content: + application/json: + schema: + properties: + data_type: + $ref: '#/components/schemas/stick_table_entry' + key: + pattern: ^[^\r\n;#]+$ + type: string + required: + - key + - data_type + type: object + responses: + "204": + description: Successful operation + default: + $ref: '#/components/responses/DefaultError' + summary: Set Entry to Stick Table + tags: + - StickTable + x-codegen-request-body-name: stick_table_entry + /services/haproxy/sites: + get: + description: Returns an array of all configured sites. + operationId: getSites + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/sites' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of sites + tags: + - Sites + post: + description: Adds a new site to the configuration file. + operationId: createSite + parameters: + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/site' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/site' + description: Site created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/site' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a site + tags: + - Sites + x-codegen-request-body-name: data + /services/haproxy/sites/{name}: + delete: + description: Deletes a site from the configuration by it's name. + operationId: deleteSite + parameters: + - description: Site frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Site deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a site + tags: + - Sites + get: + description: Returns one site configuration by it's name. + operationId: getSite + parameters: + - description: Site frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/site' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a site + tags: + - Sites + put: + description: Replaces a site configuration by it's name. + operationId: replaceSite + parameters: + - description: Site frontend name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + in: query + name: version + schema: + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/site' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/site' + description: Site replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/site' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a site + tags: + - Sites + x-codegen-request-body-name: data + /services/haproxy/spoe: + get: + description: Returns a list of endpoints to be used for SPOE settings of HAProxy. + operationId: getSpoeEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy SPOE endpoints + tags: + - Discovery + /services/haproxy/spoe/{parent_name}/version: + get: + description: Returns SPOE configuration version. + operationId: getSpoeConfigurationVersion + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: integer + description: SPOE configuration version + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a SPOE configuration version + tags: + - Spoe + /services/haproxy/spoe/spoe_files: + get: + description: Returns all available SPOE files. + operationId: getAllSpoeFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_files' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return all available SPOE files + tags: + - Spoe + post: + description: Creates SPOE file with its entries. + operationId: createSpoe + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: The spoe file to upload + format: binary + type: string + type: object + responses: + "201": + content: + application/json: + schema: + type: string + description: SPOE file created with its entries + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Creates SPOE file with its entries + tags: + - Spoe + x-codegen-request-body-name: file_upload + /services/haproxy/spoe/spoe_files/{name}: + delete: + description: Deletes SPOE file. + operationId: deleteSpoeFile + parameters: + - description: SPOE file name + in: path + name: name + required: true + schema: + type: string + responses: + "204": + description: SPOE file deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete SPOE file + tags: + - Spoe + get: + description: Returns one SPOE file. + operationId: getOneSpoeFile + parameters: + - description: SPOE file name + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + properties: + data: + type: string + type: object + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one SPOE file + tags: + - Spoe + /services/haproxy/spoe/spoe_files/{parent_name}/scopes: + get: + description: Returns an array of all configured spoe scopes. + operationId: getAllSpoeScope + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scopes' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of spoe scopes + tags: + - Spoe + post: + description: Adds a new spoe scope. + operationId: createSpoeScope + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + description: Spoe scope created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new spoe scope + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}: + delete: + description: Deletes a SPOE scope from the configuration file. + operationId: deleteSpoeScope + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + responses: + "204": + description: Spoe scope deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a SPOE scope + tags: + - Spoe + get: + description: Returns one SPOE scope in one SPOE file. + operationId: getSpoeScope + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one SPOE scope + tags: + - Spoe + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents: + get: + description: Returns an array of all configured spoe agents in one scope. + operationId: getAllSpoeAgent + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agents' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of spoe agents in one scope + tags: + - Spoe + post: + description: Adds a new spoe agent to the spoe scope. + operationId: createSpoeAgent + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + description: Spoe agent created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new spoe agent to scope + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}: + delete: + description: Deletes a SPOE agent from the configuration in one SPOE scope. + operationId: deleteSpoeAgent + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe agent name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + responses: + "204": + description: Spoe agent deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a SPOE agent + tags: + - Spoe + get: + description: Returns one spoe agent configuration in one SPOE scope. + operationId: getSpoeAgent + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe agent name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a spoe agent + tags: + - Spoe + put: + description: Replaces a SPOE agent configuration in one SPOE scope. + operationId: replaceSpoeAgent + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe agent name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + description: Spoe agent replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a SPOE agent + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups: + get: + description: Returns an array of all configured SPOE groups in one SPOE scope. + operationId: getAllSpoeGroup + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_groups' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of SPOE groups + tags: + - Spoe + post: + description: Adds a new SPOE groups to the SPOE scope. + operationId: createSpoeGroup + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + description: Spoe groups created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new SPOE groups + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}: + delete: + description: Deletes a SPOE groups from the one SPOE scope. + operationId: deleteSpoeGroup + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe group name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + responses: + "204": + description: Spoe group deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a SPOE groups + tags: + - Spoe + get: + description: Returns one SPOE groups configuration in one SPOE scope. + operationId: getSpoeGroup + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe group name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a SPOE groups + tags: + - Spoe + put: + description: Replaces a SPOE groups configuration in one SPOE scope. + operationId: replaceSpoeGroup + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe group name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + description: Spoe groups replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a SPOE groups + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages: + get: + description: Returns an array of all configured spoe messages in one scope. + operationId: getAllSpoeMessage + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_messages' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + default: + $ref: '#/components/responses/DefaultError' + summary: Return an array of spoe messages in one scope + tags: + - Spoe + post: + description: Adds a new spoe message to the spoe scope. + operationId: createSpoeMessage + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + description: Spoe message created + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Add a new spoe message to scope + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}: + delete: + description: Deletes a spoe message from the SPOE scope. + operationId: deleteSpoeMessage + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe message name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + responses: + "204": + description: Spoe message deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a spoe message + tags: + - Spoe + get: + description: Returns one spoe message configuration in SPOE scope. + operationId: getSpoeMessage + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe message name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a spoe message + tags: + - Spoe + put: + description: Replaces a spoe message configuration in one SPOE scope. + operationId: replaceSpoeMessage + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Spoe scope name + in: path + name: scope_name + required: true + schema: + type: string + - description: Spoe message name + in: path + name: name + required: true + schema: + type: string + - description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + in: query + name: transaction_id + schema: + type: string + - description: Version used for checking configuration version. Cannot be used when transaction is specified. + in: query + name: version + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + description: Spoe message replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a spoe message + tags: + - Spoe + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/transactions: + get: + description: Returns a list of SPOE configuration transactions. Transactions can be filtered by their status. + operationId: getAllSpoeTransaction + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Filter by transaction status + in: query + name: status + schema: + enum: + - failed + - in_progress + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transactions' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of SPOE configuration transactions. + tags: + - SpoeTransactions + post: + description: Starts a new transaction and returns it's id + operationId: startSpoeTransaction + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Configuration version on which to work on + in: query + name: version + required: true + schema: + type: integer + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + description: Transaction started + "429": + content: + application/json: + schema: + properties: + code: + type: integer + message: + type: string + type: object + description: Too many open transactions + default: + $ref: '#/components/responses/DefaultError' + summary: Start a new transaction + tags: + - SpoeTransactions + /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}: + delete: + description: Deletes a transaction. + operationId: deleteSpoeTransaction + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + responses: + "204": + description: Transaction deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a transaction + tags: + - SpoeTransactions + get: + description: Returns one SPOE configuration transactions. + operationId: getSpoeTransaction + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one SPOE configuration transactions + tags: + - SpoeTransactions + put: + description: Commit transaction, execute all operations in transaction and return msg + operationId: commitSpoeTransaction + parameters: + - description: SPOE file name + in: path + name: parent_name + required: true + schema: + pattern: ^[^\r\n<>*;$#&{}"]+$ + type: string + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + description: Transaction successfully committed + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Commit transaction + tags: + - SpoeTransactions + /services/haproxy/stats: + get: + description: Returns a list of HAProxy stats endpoints. + operationId: getStatsEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy stats endpoints + tags: + - Discovery + /services/haproxy/stats/native: + get: + description: Getting stats from the HAProxy. + operationId: getStats + parameters: + - description: Object type to get stats for (one of frontend, backend, server) + in: query + name: type + schema: + enum: + - frontend + - backend + - server + type: string + - description: Object name to get stats for + in: query + name: name + schema: + type: string + - description: Object parent name to get stats for, in case the object is a server + in: query + name: parent + schema: + type: string + x-dependency: + query.type: server + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/native_stats' + description: Success + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/native_stats' + description: Internal Server Error + default: + $ref: '#/components/responses/DefaultError' + summary: Gets stats + tags: + - Stats + /services/haproxy/storage: + get: + description: Returns a list of endpoints that use HAProxy storage for persistency, e.g. maps, ssl certificates... + operationId: getStorageEndpoints + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy storage endpoints + tags: + - Discovery + /services/haproxy/storage/general: + get: + description: Returns a list of all managed general use files + operationId: getAllStorageGeneralFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/general_files' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a list of all managed general use files + tags: + - Storage + post: + description: Creates a managed storage general use file with contents. + operationId: createStorageGeneralFile + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: application/octet-stream + schema: + properties: + file_upload: + description: General use file content + format: binary + type: string + type: object + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/general_file' + description: General use file created with its contents + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Creates a managed storage general use file with contents + tags: + - Storage + x-codegen-request-body-name: file_upload + /services/haproxy/storage/general/{name}: + delete: + description: Deletes a managed general use file from disk. + operationId: deleteStorageGeneralFile + parameters: + - description: General use file storage_name + in: path + name: name + required: true + schema: + type: string + responses: + "204": + description: General use file deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes a managed general use file from disk + tags: + - Storage + get: + description: Returns the contents of one managed general use file from disk + operationId: getOneStorageGeneralFile + parameters: + - description: General use file storage_name + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return the contents of one managed general use file from disk + tags: + - Storage + put: + description: Replaces the contents of a managed general use file on disk + operationId: replaceStorageGeneralFile + parameters: + - description: General use file storage_name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: application/octet-stream + schema: + properties: + file_upload: + description: General use file content + format: binary + type: string + type: object + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: General use file replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace contents of a managed general use file on disk + tags: + - Storage + x-codegen-request-body-name: file_upload + /services/haproxy/storage/maps: + get: + description: Returns a list of all managed map files + operationId: getAllStorageMapFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/maps' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return a list of all managed map files + tags: + - Storage + post: + description: Creates a managed storage map file with its entries. + operationId: createStorageMapFile + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: The map file contents + format: binary + type: string + type: object + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/map' + description: Map file created with its entries + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Creates a managed storage map file with its entries + tags: + - Storage + x-codegen-request-body-name: file_upload + /services/haproxy/storage/maps/{name}: + delete: + description: Deletes a managed map file from disk. + operationId: deleteStorageMap + parameters: + - description: Map file storage_name + in: path + name: name + required: true + schema: + type: string + responses: + "204": + description: Map file deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes a managed map file from disk + tags: + - Storage + get: + description: Returns the contents of one managed map file from disk + operationId: getOneStorageMap + parameters: + - description: Map file storage_name + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return the contents of one managed map file from disk + tags: + - Storage + put: + description: Replaces the contents of a managed map file on disk + operationId: replaceStorageMapFile + parameters: + - description: Map file storage_name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + text/plain: + schema: + type: string + required: true + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Map file replaced + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace contents of a managed map file on disk + tags: + - Storage + x-codegen-request-body-name: data + /services/haproxy/storage/ssl_certificates: + get: + description: Returns all available SSL certificates on disk. + operationId: getAllStorageSSLCertificates + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificates' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return all available SSL certificates on disk + tags: + - Storage + post: + description: Creates SSL certificate. + operationId: createStorageSSLCertificate + parameters: + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: The SSL certificate to upload + format: binary + type: string + type: object + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: SSL certificate created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: SSL certificate created requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Create SSL certificate + tags: + - Storage + x-codegen-request-body-name: file_upload + /services/haproxy/storage/ssl_certificates/{name}: + delete: + description: Deletes SSL certificate from disk. + operationId: deleteStorageSSLCertificate + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: SSL certificate deleted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: SSL certificate deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete SSL certificate from disk + tags: + - Storage + get: + description: Returns one SSL certificate from disk. + operationId: getOneStorageSSLCertificate + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one SSL certificate from disk + tags: + - Storage + put: + description: Replaces SSL certificate on disk. + operationId: replaceStorageSSLCertificate + parameters: + - description: SSL certificate name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + text/plain: + schema: + type: string + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: SSL certificate replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + description: SSL certificate replaced and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace SSL certificates on disk + tags: + - Storage + x-codegen-request-body-name: data + /services/haproxy/storage/ssl_crt_lists: + get: + description: Returns all available certificate lists on disk. + operationId: getAllStorageSSLCrtListFiles + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_files' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return all available certificate lists on disk + tags: + - Storage + post: + description: Creates a certificate list. + operationId: createStorageSSLCrtListFile + parameters: + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + properties: + file_upload: + description: The certificate list to upload + format: binary + type: string + type: object + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + description: Certificate list created + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + description: Certificate list created requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Create a certificate list + tags: + - Storage + x-codegen-request-body-name: file_upload + /services/haproxy/storage/ssl_crt_lists/{name}: + delete: + description: Deletes a certificate list from disk. + operationId: deleteStorageSSLCrtListFile + parameters: + - description: Certificate list name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Certificate list deleted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Certificate list deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a certificate list from disk + tags: + - Storage + get: + description: Returns one certificate list from disk. + operationId: getOneStorageSSLCrtListFile + parameters: + - description: Certificate list name + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one certificate list from disk + tags: + - Storage + put: + description: Replaces a certificate list on disk. + operationId: replaceStorageSSLCrtListFile + parameters: + - description: Certificate list name + in: path + name: name + required: true + schema: + type: string + - description: If set, no reload will be initiated after config change + in: query + name: skip_reload + schema: + default: false + type: boolean + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + text/plain: + schema: + type: string + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + description: Certificate list replaced + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + description: Certificate list replaced and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Replace a certificate lists on disk + tags: + - Storage + x-codegen-request-body-name: data + /services/haproxy/storage/ssl_crt_lists/{name}/entries: + delete: + description: Deletes an entry from a certificate list. + operationId: deleteStorageSSLCrtListEntry + parameters: + - description: SSL crt list name + in: path + name: name + required: true + schema: + type: string + - description: SSL certificate filename + in: query + name: certificate + required: true + schema: + type: string + - description: The line number in the crt-list + in: query + name: line_number + required: true + schema: + minimum: 0 + type: integer + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "204": + description: Successful operation + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Deletes an entry from CrtList file + tags: + - Storage + get: + description: Returns all the entries in a certificate list. + operationId: getStorageSSLCrtListEntries + parameters: + - description: SSL crt-list file + in: path + name: name + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entries' + description: Successful operation + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Returns all the entries in a CrtList + tags: + - Storage + post: + description: Creates a new entry in a certificate list. + operationId: createStorageSSLCrtListEntry + parameters: + - description: SSL crt-list file + in: path + name: name + required: true + schema: + type: string + - description: If set, do a force reload, do not wait for the configured reload-delay. + in: query + name: force_reload + schema: + default: false + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + description: New entry added + "202": + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "409": + $ref: '#/components/responses/AlreadyExists' + default: + $ref: '#/components/responses/DefaultError' + summary: Creates a new entry in a CrtList + tags: + - Storage + x-codegen-request-body-name: data + /services/haproxy/transactions: + get: + description: Returns a list of HAProxy configuration transactions. Transactions can be filtered by their status. + operationId: getTransactions + parameters: + - description: Filter by transaction status + in: query + name: status + schema: + enum: + - failed + - in_progress + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/transactions' + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Return list of HAProxy configuration transactions. + tags: + - Transactions + post: + description: Starts a new transaction and returns it's id + operationId: startTransaction + parameters: + - description: Configuration version on which to work on + in: query + name: version + required: true + schema: + type: integer + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + description: Transaction started + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "429": + content: + application/json: + schema: + properties: + code: + type: integer + message: + type: string + type: object + description: Too many open transactions + default: + $ref: '#/components/responses/DefaultError' + summary: Start a new transaction + tags: + - Transactions + /services/haproxy/transactions/{id}: + delete: + description: Deletes a transaction. + operationId: deleteTransaction + parameters: + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + responses: + "204": + description: Transaction deleted + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Delete a transaction + tags: + - Transactions + get: + description: Returns one HAProxy configuration transactions. + operationId: getTransaction + parameters: + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "404": + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/DefaultError' + summary: Return one HAProxy configuration transactions + tags: + - Transactions + put: + description: Commit transaction, execute all operations in transaction and return msg + operationId: commitTransaction + parameters: + - description: Transaction id + in: path + name: id + required: true + schema: + type: string + - description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + in: query + name: force_reload + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + description: Transaction successfully committed + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + description: Configuration change accepted and reload requested + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + Reload-ID: + description: ID of the requested reload + schema: + type: string + "400": + $ref: '#/components/responses/BadRequest' + "404": + $ref: '#/components/responses/NotFound' + "406": + $ref: '#/components/responses/NotAcceptable' + default: + $ref: '#/components/responses/DefaultError' + summary: Commit transaction + tags: + - Transactions + /specification: + get: + description: Return Data Plane API OpenAPI specification + operationId: getSpecification + responses: + "200": + content: + application/json: + schema: + type: object + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Data Plane API Specification + tags: + - Specification + /specification_openapiv3: + get: + description: Return Data Plane API OpenAPI v3 specification + operationId: getOpenapiv3Specification + responses: + "200": + content: + application/json: + schema: + type: object + description: Success + default: + $ref: '#/components/responses/DefaultError' + summary: Data Plane API v3 Specification + tags: + - SpecificationOpenapiv3 diff --git a/specification/models/common/responses/models.yaml b/specification/models/common/responses/models.yaml new file mode 100644 index 00000000..f5c90ff8 --- /dev/null +++ b/specification/models/common/responses/models.yaml @@ -0,0 +1,70 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Common responses + version: "3.0" + description: Common response types +servers: + - url: /v3 +components: + schemas: + error: + type: object + x-go-type: models.Error + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + responses: + DefaultError: + description: General Error + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/error' + AlreadyExists: + description: The specified resource already exists + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/error' + NotAcceptable: + description: The specified resource cannot be handled + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/error' + BadRequest: + description: Bad request + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/error' + NotFound: + description: The specified resource was not found + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/error' diff --git a/specification/paths/configuration/acl/handlers.conf.yaml b/specification/paths/configuration/acl/handlers.conf.yaml new file mode 100644 index 00000000..f325c7da --- /dev/null +++ b/specification/paths/configuration/acl/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: acl +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/acl/acl.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/acl/oapi.yaml b/specification/paths/configuration/acl/oapi.yaml new file mode 100644 index 00000000..239d08cf --- /dev/null +++ b/specification/paths/configuration/acl/oapi.yaml @@ -0,0 +1,362 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - ACL + description: An API for managing HAProxy ACL lines. +servers: + - url: /v3 +components: + schemas: + acl: + type: object + x-go-type: models.ACL + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acls: + type: array + items: + $ref: '#/components/schemas/acl' + x-go-type: models.Acls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/acls: + get: + summary: Return an array of all ACL lines + description: Returns all ACL lines that are configured in specified {{ .ParentType }}. + operationId: getAllAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: acl_name + in: query + description: ACL name + required: false + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an ACL list + description: Replaces a whole list of ACLs with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + '200': + description: All ACL lines replaced + content: + application/json: + schema: + $ref: '#/components/schemas/acls' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/acls/{index}: + get: + summary: Return one ACL line + description: Returns one ACL line configuration by its index in the specified {{ .ParentType }}. + operationId: getAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: index + in: path + description: ACL line Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new ACL line + description: Adds a new ACL line of the specified type in the specified {{ .ParentType }}. + operationId: createAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: index + in: path + description: ACL line Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + '201': + description: ACL line created + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a ACL line + description: Replaces a ACL line configuration by its index in the specified {{ .ParentType }}. + operationId: replaceAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: index + in: path + description: ACL line Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + '200': + description: ACL line replaced + content: + application/json: + schema: + $ref: '#/components/schemas/acl' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a ACL line + description: Deletes a ACL line configuration by its index from the specified {{ .ParentType }}. + operationId: deleteAcl{{ .ParentType }} + tags: + - ACL + parameters: + - name: index + in: path + description: ACL line Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: ACL line deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/acme/handlers.conf.yaml b/specification/paths/configuration/acme/handlers.conf.yaml new file mode 100644 index 00000000..91c081b2 --- /dev/null +++ b/specification/paths/configuration/acme/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: acme +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/acme/acme.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/acme/oapi.yaml b/specification/paths/configuration/acme/oapi.yaml new file mode 100644 index 00000000..ad2d7772 --- /dev/null +++ b/specification/paths/configuration/acme/oapi.yaml @@ -0,0 +1,252 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - ACME Provider + description: An API for managing HAProxy ACME provider configurations. +servers: + - url: /v3 +components: + schemas: + acme_provider: + type: object + x-go-type: models.AcmeProvider + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acme_providers: + type: array + items: + $ref: '#/components/schemas/acme_provider' + x-go-type: models.AcmeProviders + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/acme: + get: + summary: Return an array of ACME providers + description: Returns an array of all configured ACME providers. + operationId: getAcmeProviders + tags: + - Acme + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acme_providers' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add an ACME provider + description: Adds a new ACME provider to the configuration file. + operationId: createAcmeProvider + tags: + - Acme + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + '201': + description: ACME provider created + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/acme/{name}: + get: + summary: Return an ACME provider + description: Returns one ACME provider configuration by its name. + operationId: getAcmeProvider + tags: + - Acme + parameters: + - name: name + in: path + description: ACME provider name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an ACME provider + description: Replaces an ACME provider configuration by its name. + operationId: editAcmeProvider + tags: + - Acme + parameters: + - name: name + in: path + description: ACME provider name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + '200': + description: ACME provider replaced + content: + application/json: + schema: + $ref: '#/components/schemas/acme_provider' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete an ACME provider + description: Deletes an ACME provider from the configuration by its name. + operationId: deleteAcmeProvider + tags: + - Acme + parameters: + - name: name + in: path + description: ACME provider name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: ACME provider deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/backend/handlers.conf.yaml b/specification/paths/configuration/backend/handlers.conf.yaml new file mode 100644 index 00000000..2c724657 --- /dev/null +++ b/specification/paths/configuration/backend/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: backend +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/backend/backend.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/backend/oapi.yaml b/specification/paths/configuration/backend/oapi.yaml new file mode 100644 index 00000000..a9bd15ad --- /dev/null +++ b/specification/paths/configuration/backend/oapi.yaml @@ -0,0 +1,280 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Backend + description: An API for managing HAProxy backend configurations. +servers: + - url: /v3 +components: + schemas: + backend: + type: object + x-go-type: models.Backend + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backends: + type: array + items: + $ref: '#/components/schemas/backend' + x-go-type: models.Backends + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/backends: + get: + summary: Return an array of backends + description: Returns an array of all configured backends. + operationId: getBackends + tags: + - Backend + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backends' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a backend + description: Adds a new backend to the configuration file. + operationId: createBackend + tags: + - Backend + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + '201': + description: Backend created + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/backends/{name}: + get: + summary: Return a backend + description: Returns one backend configuration by its name. + operationId: getBackend + tags: + - Backend + parameters: + - name: name + in: path + description: Backend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a backend + description: Replaces a backend configuration by its name. + operationId: replaceBackend + tags: + - Backend + parameters: + - name: name + in: path + description: Backend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + '200': + description: Backend replaced + content: + application/json: + schema: + $ref: '#/components/schemas/backend' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a backend + description: Deletes a backend from the configuration by its name. + operationId: deleteBackend + tags: + - Backend + parameters: + - name: name + in: path + description: Backend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Backend deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/backend_switching_rule/handlers.conf.yaml b/specification/paths/configuration/backend_switching_rule/handlers.conf.yaml new file mode 100644 index 00000000..81f24817 --- /dev/null +++ b/specification/paths/configuration/backend_switching_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: backend_switching_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/backend_switching_rule/backend_switching_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/backend_switching_rule/oapi.yaml b/specification/paths/configuration/backend_switching_rule/oapi.yaml new file mode 100644 index 00000000..16bb5103 --- /dev/null +++ b/specification/paths/configuration/backend_switching_rule/oapi.yaml @@ -0,0 +1,354 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Backend Switching Rule + description: An API for managing HAProxy Backend Switching Rule entries. +servers: + - url: /v3 +components: + schemas: + backend_switching_rule: + type: object + x-go-type: models.BackendSwitchingRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + backend_switching_rules: + type: array + items: + $ref: '#/components/schemas/backend_switching_rule' + x-go-type: models.BackendSwitchingRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules: + get: + summary: Return an array of all Backend Switching Rules + description: Returns all Backend Switching Rules that are configured in specified frontend. + operationId: getBackendSwitchingRules + tags: + - BackendSwitchingRule + parameters: + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Backend Switching Rule list + description: Replaces a whole list of Backend Switching Rules with the list given in parameter for the specified frontend. + operationId: replaceBackendSwitchingRules + tags: + - BackendSwitchingRule + parameters: + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + '200': + description: All Backend Switching Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rules' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/backend_switching_rules/{index}: + get: + summary: Return one Backend Switching Rule + description: Returns one Backend Switching Rule configuration by its index in the specified frontend. + operationId: getBackendSwitchingRule + tags: + - BackendSwitchingRule + parameters: + - name: index + in: path + description: Backend Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Backend Switching Rule + description: Adds a new Backend Switching Rule in the specified frontend. + operationId: createBackendSwitchingRule + tags: + - BackendSwitchingRule + parameters: + - name: index + in: path + description: Backend Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + '201': + description: Backend Switching Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Backend Switching Rule + description: Replaces a Backend Switching Rule configuration by its index in the specified frontend. + operationId: replaceBackendSwitchingRule + tags: + - BackendSwitchingRule + parameters: + - name: index + in: path + description: Backend Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + '200': + description: Backend Switching Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/backend_switching_rule' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Backend Switching Rule + description: Deletes a Backend Switching Rule configuration by its index from the specified frontend. + operationId: deleteBackendSwitchingRule + tags: + - BackendSwitchingRule + parameters: + - name: index + in: path + description: Backend Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Backend Switching Rule deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/bind/handlers.conf.yaml b/specification/paths/configuration/bind/handlers.conf.yaml new file mode 100644 index 00000000..31965d6f --- /dev/null +++ b/specification/paths/configuration/bind/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: bind +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/bind/bind.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/bind/oapi.yaml b/specification/paths/configuration/bind/oapi.yaml new file mode 100644 index 00000000..4fee3de8 --- /dev/null +++ b/specification/paths/configuration/bind/oapi.yaml @@ -0,0 +1,288 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Bind + description: An API for managing HAProxy Bind lines. +servers: + - url: /v3 +components: + schemas: + bind: + type: object + x-go-type: models.Bind + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + binds: + type: array + items: + $ref: '#/components/schemas/bind' + x-go-type: models.Binds + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/binds: + get: + summary: Return an array of binds + description: Returns all binds that are configured in specified {{ .ParentType }}. + operationId: getAllBind{{ .ParentType }} + tags: + - Bind + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/binds' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new bind + description: Adds a new bind in the specified {{ .ParentType }}. + operationId: createBind{{ .ParentType }} + tags: + - Bind + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + '201': + description: Bind created + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/binds/{name}: + get: + summary: Return one bind + description: Returns one bind configuration by its name in the specified {{ .ParentType }}. + operationId: getBind{{ .ParentType }} + tags: + - Bind + parameters: + - name: name + in: path + description: Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a bind + description: Replaces a bind configuration by its name in the specified {{ .ParentType }}. + operationId: replaceBind{{ .ParentType }} + tags: + - Bind + parameters: + - name: name + in: path + description: Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + '200': + description: Bind replaced + content: + application/json: + schema: + $ref: '#/components/schemas/bind' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a bind + description: Deletes a bind configuration by its name from the specified {{ .ParentType }}. + operationId: deleteBind{{ .ParentType }} + tags: + - Bind + parameters: + - name: name + in: path + description: Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Bind deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/cache/handlers.conf.yaml b/specification/paths/configuration/cache/handlers.conf.yaml new file mode 100644 index 00000000..95c09928 --- /dev/null +++ b/specification/paths/configuration/cache/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: cache +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/cache/cache.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/cache/oapi.yaml b/specification/paths/configuration/cache/oapi.yaml new file mode 100644 index 00000000..e8ffd34f --- /dev/null +++ b/specification/paths/configuration/cache/oapi.yaml @@ -0,0 +1,252 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Cache + description: An API for managing HAProxy cache configurations. +servers: + - url: /v3 +components: + schemas: + cache: + type: object + x-go-type: models.Cache + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + caches: + type: array + items: + $ref: '#/components/schemas/cache' + x-go-type: models.Caches + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/caches: + get: + summary: Return an array of caches + description: Returns an array of all configured caches. + operationId: getCaches + tags: + - Cache + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/caches' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a cache + description: Adds a new cache section to the configuration file. + operationId: createCache + tags: + - Cache + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + '201': + description: Cache created + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/caches/{name}: + get: + summary: Return a cache + description: Returns one cache section configuration by its name. + operationId: getCache + tags: + - Cache + parameters: + - name: name + in: path + description: Cache name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a cache + description: Replaces a cache configuration by its name. + operationId: replaceCache + tags: + - Cache + parameters: + - name: name + in: path + description: Cache name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + '200': + description: Cache replaced + content: + application/json: + schema: + $ref: '#/components/schemas/cache' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a cache + description: Deletes a cache from the configuration by its name. + operationId: deleteCache + tags: + - Cache + parameters: + - name: name + in: path + description: Cache name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Cache deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/capture/handlers.conf.yaml b/specification/paths/configuration/capture/handlers.conf.yaml new file mode 100644 index 00000000..8d9c7af9 --- /dev/null +++ b/specification/paths/configuration/capture/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: capture +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/capture/capture.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/capture/oapi.yaml b/specification/paths/configuration/capture/oapi.yaml new file mode 100644 index 00000000..9ff6bad0 --- /dev/null +++ b/specification/paths/configuration/capture/oapi.yaml @@ -0,0 +1,354 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Capture + description: An API for managing HAProxy Declare Capture entries. +servers: + - url: /v3 +components: + schemas: + capture: + type: object + x-go-type: models.Capture + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + captures: + type: array + items: + $ref: '#/components/schemas/capture' + x-go-type: models.Captures + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/frontends/{parent_name}/captures: + get: + summary: Return an array of all Declare Captures + description: Returns all Declare Captures that are configured in specified frontend. + operationId: getDeclareCaptures + tags: + - DeclareCapture + parameters: + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Declare Capture list + description: Replaces a whole list of Declare Captures with the list given in parameter for the specified frontend. + operationId: replaceDeclareCaptures + tags: + - DeclareCapture + parameters: + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + '200': + description: All Declare Captures replaced + content: + application/json: + schema: + $ref: '#/components/schemas/captures' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/frontends/{parent_name}/captures/{index}: + get: + summary: Return one Declare Capture + description: Returns one Declare Capture configuration by its index in the specified frontend. + operationId: getDeclareCapture + tags: + - DeclareCapture + parameters: + - name: index + in: path + description: Capture Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Declare Capture + description: Adds a new Declare Capture in the specified frontend. + operationId: createDeclareCapture + tags: + - DeclareCapture + parameters: + - name: index + in: path + description: Capture Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + '201': + description: Declare Capture created + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Declare Capture + description: Replaces a Declare Capture configuration by its index in the specified frontend. + operationId: replaceDeclareCapture + tags: + - DeclareCapture + parameters: + - name: index + in: path + description: Capture Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + '200': + description: Declare Capture replaced + content: + application/json: + schema: + $ref: '#/components/schemas/capture' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Declare Capture + description: Deletes a Declare Capture configuration by its index from the specified frontend. + operationId: deleteDeclareCapture + tags: + - DeclareCapture + parameters: + - name: index + in: path + description: Capture Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent frontend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Declare Capture deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/crt_store/handlers.conf.yaml b/specification/paths/configuration/crt_store/handlers.conf.yaml new file mode 100644 index 00000000..5d210404 --- /dev/null +++ b/specification/paths/configuration/crt_store/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: crt_store +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/crt_store/crt_store.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/crt_store/oapi.yaml b/specification/paths/configuration/crt_store/oapi.yaml new file mode 100644 index 00000000..310ea8ba --- /dev/null +++ b/specification/paths/configuration/crt_store/oapi.yaml @@ -0,0 +1,558 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Crt Store + description: An API for managing HAProxy Crt Store and Crt Load entries. +servers: + - url: /v3 +components: + schemas: + crt_store: + type: object + x-go-type: models.CrtStore + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + crt_stores: + type: array + items: + $ref: '#/components/schemas/crt_store' + x-go-type: models.CrtStores + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + crt_load: + type: object + x-go-type: models.CrtLoad + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + crt_loads: + type: array + items: + $ref: '#/components/schemas/crt_load' + x-go-type: models.CrtLoads + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/crt_stores: + get: + summary: Return an array of crt stores + description: Returns all crt stores that are configured. + operationId: getCrtStores + tags: + - CrtStore + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_stores' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new crt store + description: Adds a new crt store to the configuration. + operationId: createCrtStore + tags: + - CrtStore + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + '201': + description: Crt Store created + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores/{name}: + get: + summary: Return one crt store + description: Returns one crt store configuration by its name. + operationId: getCrtStore + tags: + - CrtStore + parameters: + - name: name + in: path + description: Crt store name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a crt store + description: Replaces a crt store configuration by its name. + operationId: editCrtStore + tags: + - CrtStore + parameters: + - name: name + in: path + description: Crt store name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + '200': + description: Crt Store replaced + content: + application/json: + schema: + $ref: '#/components/schemas/crt_store' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a crt store + description: Deletes a crt store configuration by its name. + operationId: deleteCrtStore + tags: + - CrtStore + parameters: + - name: name + in: path + description: Crt store name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Crt Store deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads: + get: + summary: Return an array of crt loads + description: Returns all crt loads that are configured in the specified crt store. + operationId: getCrtLoads + tags: + - CrtLoad + parameters: + - name: crt_store + in: path + description: Parent crt_store name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_loads' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a crt load + description: Adds a new crt load to the specified crt store. + operationId: createCrtLoad + tags: + - CrtLoad + parameters: + - name: crt_store + in: path + description: Parent crt_store name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + '201': + description: Crt Load created + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/crt_stores/{crt_store}/crt_loads/{certificate}: + get: + summary: Return one crt load + description: Returns one crt load configuration by its certificate filename in the specified crt store. + operationId: getCrtLoad + tags: + - CrtLoad + parameters: + - name: crt_store + in: path + description: Parent crt_store name + required: true + schema: + type: string + - name: certificate + in: path + description: Certificate filename + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a crt load + description: Replaces a crt load configuration by its certificate filename in the specified crt store. + operationId: replaceCrtLoad + tags: + - CrtLoad + parameters: + - name: crt_store + in: path + description: Parent crt_store name + required: true + schema: + type: string + - name: certificate + in: path + description: Certificate filename + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + '200': + description: Crt Load replaced + content: + application/json: + schema: + $ref: '#/components/schemas/crt_load' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a crt load + description: Deletes a crt load configuration by its certificate filename from the specified crt store. + operationId: deleteCrtLoad + tags: + - CrtLoad + parameters: + - name: crt_store + in: path + description: Parent crt_store name + required: true + schema: + type: string + - name: certificate + in: path + description: Certificate filename + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Crt Load deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/defaults/handlers.conf.yaml b/specification/paths/configuration/defaults/handlers.conf.yaml new file mode 100644 index 00000000..0d6247c2 --- /dev/null +++ b/specification/paths/configuration/defaults/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: defaults +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/defaults/defaults.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/defaults/oapi.yaml b/specification/paths/configuration/defaults/oapi.yaml new file mode 100644 index 00000000..089f5a95 --- /dev/null +++ b/specification/paths/configuration/defaults/oapi.yaml @@ -0,0 +1,352 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Defaults + description: An API for managing HAProxy defaults section configurations. +servers: + - url: /v3 +components: + schemas: + defaults: + type: object + x-go-type: models.Defaults + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + defaults_sections: + type: array + items: + $ref: '#/components/schemas/defaults' + x-go-type: models.DefaultsSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/defaults: + get: + summary: Return an array of defaults sections + description: Returns an array of all configured defaults sections. + operationId: getDefaultsSections + tags: + - Defaults + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/defaults_sections' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a defaults section + description: Adds a new defaults section to the configuration file. + operationId: addDefaultsSection + tags: + - Defaults + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '201': + description: Defaults section created + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Add a defaults section + description: Adds a new defaults section to the configuration file. + operationId: createDefaultsSection + deprecated: true + tags: + - Defaults + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '201': + description: Defaults section created + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/defaults/{name}: + get: + summary: Return a defaults section + description: Returns one defaults section configuration by its name. + operationId: getDefaultsSection + tags: + - Defaults + parameters: + - name: name + in: path + description: Defaults section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a defaults section + description: Replaces a defaults section configuration by its name. + operationId: replaceDefaultsSection + tags: + - Defaults + parameters: + - name: name + in: path + description: Defaults section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '200': + description: Defaults section replaced + content: + application/json: + schema: + $ref: '#/components/schemas/defaults' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a defaults section + description: Deletes a defaults section from the configuration by its name. + operationId: deleteDefaultsSection + tags: + - Defaults + parameters: + - name: name + in: path + description: Defaults section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Defaults section deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/dgram_bind/handlers.conf.yaml b/specification/paths/configuration/dgram_bind/handlers.conf.yaml new file mode 100644 index 00000000..4f58d085 --- /dev/null +++ b/specification/paths/configuration/dgram_bind/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: dgram_bind +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/dgram_bind/dgram_bind.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/dgram_bind/oapi.yaml b/specification/paths/configuration/dgram_bind/oapi.yaml new file mode 100644 index 00000000..a0c8b7dd --- /dev/null +++ b/specification/paths/configuration/dgram_bind/oapi.yaml @@ -0,0 +1,286 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Dgram Bind + description: An API for managing HAProxy Dgram Bind entries. +servers: + - url: /v3 +components: + schemas: + dgram_bind: + type: object + x-go-type: models.DgramBind + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + dgram_binds: + type: array + items: + $ref: '#/components/schemas/dgram_bind' + x-go-type: models.DgramBinds + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds: + get: + summary: Return an array of dgram binds + description: Returns all dgram binds that are configured in specified log forward. + operationId: getDgramBinds + tags: + - DgramBind + parameters: + - name: parent_name + in: path + description: Parent log forward name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_binds' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new dgram bind + description: Adds a new dgram bind in the specified log forward. + operationId: createDgramBind + tags: + - DgramBind + parameters: + - name: parent_name + in: path + description: Parent log forward name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + '201': + description: Dgram Bind created + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/log_forwards/{parent_name}/dgram_binds/{name}: + get: + summary: Return one dgram bind + description: Returns one dgram bind configuration by its name in the specified log forward. + operationId: getDgramBind + tags: + - DgramBind + parameters: + - name: name + in: path + description: Dgram Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent log forward name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a dgram bind + description: Replaces a dgram bind configuration by its name in the specified log forward. + operationId: replaceDgramBind + tags: + - DgramBind + parameters: + - name: name + in: path + description: Dgram Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent log forward name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + '200': + description: Dgram Bind replaced + content: + application/json: + schema: + $ref: '#/components/schemas/dgram_bind' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a dgram bind + description: Deletes a dgram bind configuration by its name from the specified log forward. + operationId: deleteDgramBind + tags: + - DgramBind + parameters: + - name: name + in: path + description: Dgram Bind name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent log forward name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Dgram Bind deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/fcgi_app/handlers.conf.yaml b/specification/paths/configuration/fcgi_app/handlers.conf.yaml new file mode 100644 index 00000000..6b7d9ec8 --- /dev/null +++ b/specification/paths/configuration/fcgi_app/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: fcgi_app +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/fcgi_app/fcgi_app.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/fcgi_app/oapi.yaml b/specification/paths/configuration/fcgi_app/oapi.yaml new file mode 100644 index 00000000..273d78aa --- /dev/null +++ b/specification/paths/configuration/fcgi_app/oapi.yaml @@ -0,0 +1,280 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - FCGI App + description: An API for managing HAProxy FCGI application configurations. +servers: + - url: /v3 +components: + schemas: + fcgi_app: + type: object + x-go-type: models.FCGIApp + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + fcgi_apps: + type: array + items: + $ref: '#/components/schemas/fcgi_app' + x-go-type: models.FCGIApps + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/fcgi_apps: + get: + summary: Return an array of FCGI apps + description: Returns an array of all configured FCGI applications. + operationId: getFCGIApps + tags: + - FCGIApp + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_apps' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add an FCGI app + description: Adds a new FCGI application to the configuration file. + operationId: createFCGIApp + tags: + - FCGIApp + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + '201': + description: FCGI app created + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/fcgi_apps/{name}: + get: + summary: Return a FCGI app + description: Returns one FCGI application configuration by its name. + operationId: getFCGIApp + tags: + - FCGIApp + parameters: + - name: name + in: path + description: FCGI app name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a FCGI app + description: Replaces a FCGI application configuration by its name. + operationId: replaceFCGIApp + tags: + - FCGIApp + parameters: + - name: name + in: path + description: FCGI app name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + '200': + description: FCGI app replaced + content: + application/json: + schema: + $ref: '#/components/schemas/fcgi_app' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete an FCGI app + description: Deletes a FCGI application from the configuration by its name. + operationId: deleteFCGIApp + tags: + - FCGIApp + parameters: + - name: name + in: path + description: FCGI app name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: FCGI app deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/filter/handlers.conf.yaml b/specification/paths/configuration/filter/handlers.conf.yaml new file mode 100644 index 00000000..49371e42 --- /dev/null +++ b/specification/paths/configuration/filter/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: filter +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/filter/filter.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/filter/oapi.yaml b/specification/paths/configuration/filter/oapi.yaml new file mode 100644 index 00000000..0ba7e1bd --- /dev/null +++ b/specification/paths/configuration/filter/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Filter + description: An API for managing HAProxy Filter lines. +servers: + - url: /v3 +components: + schemas: + filter: + type: object + x-go-type: models.Filter + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + filters: + type: array + items: + $ref: '#/components/schemas/filter' + x-go-type: models.Filters + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/filters: + get: + summary: Return an array of all Filters + description: Returns all Filters that are configured in specified {{ .ParentType }}. + operationId: getAllFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Filter list + description: Replaces a whole list of Filters with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + '200': + description: All Filters replaced + content: + application/json: + schema: + $ref: '#/components/schemas/filters' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/filters/{index}: + get: + summary: Return one Filter + description: Returns one Filter configuration by its index in the specified {{ .ParentType }}. + operationId: getFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: index + in: path + description: Filter Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Filter + description: Adds a new Filter of the specified type in the specified {{ .ParentType }}. + operationId: createFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: index + in: path + description: Filter Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + '201': + description: Filter created + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Filter + description: Replaces a Filter configuration by its index in the specified {{ .ParentType }}. + operationId: replaceFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: index + in: path + description: Filter Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + '200': + description: Filter replaced + content: + application/json: + schema: + $ref: '#/components/schemas/filter' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Filter + description: Deletes a Filter configuration by its index from the specified {{ .ParentType }}. + operationId: deleteFilter{{ .ParentType }} + tags: + - Filter + parameters: + - name: index + in: path + description: Filter Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Filter deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/frontend/handlers.conf.yaml b/specification/paths/configuration/frontend/handlers.conf.yaml new file mode 100644 index 00000000..ea0ffc7b --- /dev/null +++ b/specification/paths/configuration/frontend/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: frontend +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/frontend/frontend.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/frontend/oapi.yaml b/specification/paths/configuration/frontend/oapi.yaml new file mode 100644 index 00000000..580e44d6 --- /dev/null +++ b/specification/paths/configuration/frontend/oapi.yaml @@ -0,0 +1,280 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Frontend + description: An API for managing HAProxy frontend configurations. +servers: + - url: /v3 +components: + schemas: + frontend: + type: object + x-go-type: models.Frontend + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + frontends: + type: array + items: + $ref: '#/components/schemas/frontend' + x-go-type: models.Frontends + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/frontends: + get: + summary: Return an array of frontends + description: Returns an array of all configured frontends. + operationId: getFrontends + tags: + - Frontend + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/frontends' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a frontend + description: Adds a new frontend to the configuration file. + operationId: createFrontend + tags: + - Frontend + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + '201': + description: Frontend created + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/frontends/{name}: + get: + summary: Return a frontend + description: Returns one frontend configuration by its name. + operationId: getFrontend + tags: + - Frontend + parameters: + - name: name + in: path + description: Frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a frontend + description: Replaces a frontend configuration by its name. + operationId: replaceFrontend + tags: + - Frontend + parameters: + - name: name + in: path + description: Frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + '200': + description: Frontend replaced + content: + application/json: + schema: + $ref: '#/components/schemas/frontend' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a frontend + description: Deletes a frontend from the configuration by its name. + operationId: deleteFrontend + tags: + - Frontend + parameters: + - name: name + in: path + description: Frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Frontend deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/global/handlers.conf.yaml b/specification/paths/configuration/global/handlers.conf.yaml new file mode 100644 index 00000000..6c7cb40a --- /dev/null +++ b/specification/paths/configuration/global/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: global +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/global/global.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/global/oapi.yaml b/specification/paths/configuration/global/oapi.yaml new file mode 100644 index 00000000..bb189fb6 --- /dev/null +++ b/specification/paths/configuration/global/oapi.yaml @@ -0,0 +1,111 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Global + description: An API for managing HAProxy global configuration. +servers: + - url: /v3 +components: + schemas: + global: + type: object + x-go-type: models.Global + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/global: + get: + summary: Return a global part of configuration + description: Returns global part of configuration. + operationId: getGlobal + tags: + - Global + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/global' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace global + description: Replace global part of config. + operationId: replaceGlobal + tags: + - Global + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/global' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/global' + '200': + description: Global replaced + content: + application/json: + schema: + $ref: '#/components/schemas/global' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data diff --git a/specification/paths/configuration/groups/handlers.conf.yaml b/specification/paths/configuration/groups/handlers.conf.yaml new file mode 100644 index 00000000..5d37b1f5 --- /dev/null +++ b/specification/paths/configuration/groups/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: groups +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/groups/groups.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/groups/oapi.yaml b/specification/paths/configuration/groups/oapi.yaml new file mode 100644 index 00000000..78a39ca4 --- /dev/null +++ b/specification/paths/configuration/groups/oapi.yaml @@ -0,0 +1,282 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Groups + description: An API for managing HAProxy userlist group configurations. +servers: + - url: /v3 +components: + schemas: + group: + type: object + x-go-type: models.Group + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + groups: + type: array + items: + $ref: '#/components/schemas/group' + x-go-type: models.Groups + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/groups: + get: + summary: Return an array of groups + description: Returns an array of all groups belonging to the specified userlist. + operationId: getGroups + tags: + - Group + parameters: + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/groups' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a group + description: Adds a new group to the specified userlist. + operationId: createGroup + tags: + - Group + parameters: + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/group' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/group' + '201': + description: Group created + content: + application/json: + schema: + $ref: '#/components/schemas/group' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/groups/{name}: + get: + summary: Return a group + description: Returns one group from the specified userlist by name. + operationId: getGroup + tags: + - Group + parameters: + - name: name + in: path + description: Group name + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/group' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a group + description: Replaces a group in the specified userlist by name. + operationId: replaceGroup + tags: + - Group + parameters: + - name: name + in: path + description: Group name + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/group' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/group' + '200': + description: Group replaced + content: + application/json: + schema: + $ref: '#/components/schemas/group' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a group + description: Deletes a group from the specified userlist by name. + operationId: deleteGroup + tags: + - Group + parameters: + - name: name + in: path + description: Group name + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Group deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/http/http_after_response_rule/handlers.conf.yaml b/specification/paths/configuration/http/http_after_response_rule/handlers.conf.yaml new file mode 100644 index 00000000..be620d05 --- /dev/null +++ b/specification/paths/configuration/http/http_after_response_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_after_response_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http/http_after_response_rule/http_after_response_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http/http_after_response_rule/oapi.yaml b/specification/paths/configuration/http/http_after_response_rule/oapi.yaml new file mode 100644 index 00000000..1a3b0fff --- /dev/null +++ b/specification/paths/configuration/http/http_after_response_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP After Response Rule + description: An API for managing HAProxy HTTP After Response Rules. +servers: + - url: /v3 +components: + schemas: + http_after_response_rule: + type: object + x-go-type: models.HTTPAfterResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_after_response_rules: + type: array + items: + $ref: '#/components/schemas/http_after_response_rule' + x-go-type: models.HTTPAfterResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_after_response_rules: + get: + summary: Return an array of all HTTP After Response Rules + description: Returns all HTTP After Response Rules that are configured in specified {{ .ParentType }}. + operationId: getAllHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an HTTP After Response Rule list + description: Replaces a whole list of HTTP After Response Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + '200': + description: All HTTP After Response Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_after_response_rules/{index}: + get: + summary: Return one HTTP After Response Rule + description: Returns one HTTP After Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: index + in: path + description: HTTP After Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new HTTP After Response Rule + description: Adds a new HTTP After Response Rule of the specified type in the specified {{ .ParentType }}. + operationId: createHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: index + in: path + description: HTTP After Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + '201': + description: HTTP After Response Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a HTTP After Response Rule + description: Replaces a HTTP After Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: index + in: path + description: HTTP After Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + '200': + description: HTTP After Response Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_after_response_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP After Response Rule + description: Deletes a HTTP After Response Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteHTTPAfterResponseRule{{ .ParentType }} + tags: + - HTTPAfterResponseRule + parameters: + - name: index + in: path + description: HTTP After Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP After Response Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/http/http_check/handlers.conf.yaml b/specification/paths/configuration/http/http_check/handlers.conf.yaml new file mode 100644 index 00000000..18724d7f --- /dev/null +++ b/specification/paths/configuration/http/http_check/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_check +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http/http_check/http_check.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http/http_check/oapi.yaml b/specification/paths/configuration/http/http_check/oapi.yaml new file mode 100644 index 00000000..4f8df4f5 --- /dev/null +++ b/specification/paths/configuration/http/http_check/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP Check + description: An API for managing HAProxy HTTP Checks. +servers: + - url: /v3 +components: + schemas: + http_check: + type: object + x-go-type: models.HTTPCheck + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_checks: + type: array + items: + $ref: '#/components/schemas/http_check' + x-go-type: models.HTTPChecks + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_checks: + get: + summary: Return an array of all HTTP Checks + description: Returns all HTTP Checks that are configured in specified {{ .ParentType }}. + operationId: getAllHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an HTTP Check list + description: Replaces a whole list of HTTP Checks with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + '200': + description: All HTTP Checks replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_checks' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_checks/{index}: + get: + summary: Return one HTTP Check + description: Returns one HTTP Check configuration by its index in the specified {{ .ParentType }}. + operationId: getHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: index + in: path + description: HTTP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new HTTP Check + description: Adds a new HTTP Check of the specified type in the specified {{ .ParentType }}. + operationId: createHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: index + in: path + description: HTTP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + '201': + description: HTTP Check created + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a HTTP Check + description: Replaces a HTTP Check configuration by its index in the specified {{ .ParentType }}. + operationId: replaceHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: index + in: path + description: HTTP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + '200': + description: HTTP Check replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_check' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP Check + description: Deletes a HTTP Check configuration by its index from the specified {{ .ParentType }}. + operationId: deleteHTTPCheck{{ .ParentType }} + tags: + - HTTPCheck + parameters: + - name: index + in: path + description: HTTP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP Check deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/http/http_error_rule/handlers.conf.yaml b/specification/paths/configuration/http/http_error_rule/handlers.conf.yaml new file mode 100644 index 00000000..fe95bd45 --- /dev/null +++ b/specification/paths/configuration/http/http_error_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_error_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http/http_error_rule/http_error_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http/http_error_rule/oapi.yaml b/specification/paths/configuration/http/http_error_rule/oapi.yaml new file mode 100644 index 00000000..87c46b16 --- /dev/null +++ b/specification/paths/configuration/http/http_error_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP Error Rule + description: An API for managing HAProxy HTTP Error Rules. +servers: + - url: /v3 +components: + schemas: + http_error_rule: + type: object + x-go-type: models.HTTPErrorRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_error_rules: + type: array + items: + $ref: '#/components/schemas/http_error_rule' + x-go-type: models.HTTPErrorRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_error_rules: + get: + summary: Return an array of all HTTP Error Rules + description: Returns all HTTP Error Rules that are configured in specified {{ .ParentType }}. + operationId: getAllHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an HTTP Error Rule list + description: Replaces a whole list of HTTP Error Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + '200': + description: All HTTP Error Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_error_rules/{index}: + get: + summary: Return one HTTP Error Rule + description: Returns one HTTP Error Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: index + in: path + description: HTTP Error Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new HTTP Error Rule + description: Adds a new HTTP Error Rule of the specified type in the specified {{ .ParentType }}. + operationId: createHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: index + in: path + description: HTTP Error Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + '201': + description: HTTP Error Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a HTTP Error Rule + description: Replaces a HTTP Error Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: index + in: path + description: HTTP Error Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + '200': + description: HTTP Error Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_error_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP Error Rule + description: Deletes a HTTP Error Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteHTTPErrorRule{{ .ParentType }} + tags: + - HTTPErrorRule + parameters: + - name: index + in: path + description: HTTP Error Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP Error Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/http/http_request_rule/handlers.conf.yaml b/specification/paths/configuration/http/http_request_rule/handlers.conf.yaml new file mode 100644 index 00000000..fc82eff1 --- /dev/null +++ b/specification/paths/configuration/http/http_request_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_request_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http/http_request_rule/http_request_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http/http_request_rule/oapi.yaml b/specification/paths/configuration/http/http_request_rule/oapi.yaml new file mode 100644 index 00000000..f8452a3f --- /dev/null +++ b/specification/paths/configuration/http/http_request_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP Request Rule + description: An API for managing HAProxy HTTP Request Rules. +servers: + - url: /v3 +components: + schemas: + http_request_rule: + type: object + x-go-type: models.HTTPRequestRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_request_rules: + type: array + items: + $ref: '#/components/schemas/http_request_rule' + x-go-type: models.HTTPRequestRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_request_rules: + get: + summary: Return an array of all HTTP Request Rules + description: Returns all HTTP Request Rules that are configured in specified {{ .ParentType }}. + operationId: getAllHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an HTTP Request Rule list + description: Replaces a whole list of HTTP Request Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + '200': + description: All HTTP Request Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_request_rules/{index}: + get: + summary: Return one HTTP Request Rule + description: Returns one HTTP Request Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: index + in: path + description: HTTP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new HTTP Request Rule + description: Adds a new HTTP Request Rule of the specified type in the specified {{ .ParentType }}. + operationId: createHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: index + in: path + description: HTTP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + '201': + description: HTTP Request Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a HTTP Request Rule + description: Replaces a HTTP Request Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: index + in: path + description: HTTP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + '200': + description: HTTP Request Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_request_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP Request Rule + description: Deletes a HTTP Request Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteHTTPRequestRule{{ .ParentType }} + tags: + - HTTPRequestRule + parameters: + - name: index + in: path + description: HTTP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP Request Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/http/http_response_rule/handlers.conf.yaml b/specification/paths/configuration/http/http_response_rule/handlers.conf.yaml new file mode 100644 index 00000000..c30f7afd --- /dev/null +++ b/specification/paths/configuration/http/http_response_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_response_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http/http_response_rule/http_response_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http/http_response_rule/oapi.yaml b/specification/paths/configuration/http/http_response_rule/oapi.yaml new file mode 100644 index 00000000..96fba1b3 --- /dev/null +++ b/specification/paths/configuration/http/http_response_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP Response Rule + description: An API for managing HAProxy HTTP Response Rules. +servers: + - url: /v3 +components: + schemas: + http_response_rule: + type: object + x-go-type: models.HTTPResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_response_rules: + type: array + items: + $ref: '#/components/schemas/http_response_rule' + x-go-type: models.HTTPResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_response_rules: + get: + summary: Return an array of all HTTP Response Rules + description: Returns all HTTP Response Rules that are configured in specified {{ .ParentType }}. + operationId: getAllHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an HTTP Response Rule list + description: Replaces a whole list of HTTP Response Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + '200': + description: All HTTP Response Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/http_response_rules/{index}: + get: + summary: Return one HTTP Response Rule + description: Returns one HTTP Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: index + in: path + description: HTTP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new HTTP Response Rule + description: Adds a new HTTP Response Rule of the specified type in the specified {{ .ParentType }}. + operationId: createHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: index + in: path + description: HTTP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + '201': + description: HTTP Response Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a HTTP Response Rule + description: Replaces a HTTP Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: index + in: path + description: HTTP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + '200': + description: HTTP Response Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_response_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP Response Rule + description: Deletes a HTTP Response Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteHTTPResponseRule{{ .ParentType }} + tags: + - HTTPResponseRule + parameters: + - name: index + in: path + description: HTTP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP Response Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/http_errors_section/handlers.conf.yaml b/specification/paths/configuration/http_errors_section/handlers.conf.yaml new file mode 100644 index 00000000..38828c82 --- /dev/null +++ b/specification/paths/configuration/http_errors_section/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: http_errors_section +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/http_errors_section/http_errors_section.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/http_errors_section/oapi.yaml b/specification/paths/configuration/http_errors_section/oapi.yaml new file mode 100644 index 00000000..df74eeb7 --- /dev/null +++ b/specification/paths/configuration/http_errors_section/oapi.yaml @@ -0,0 +1,252 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - HTTP Errors Sections + description: An API for managing HAProxy HTTP errors section configurations. +servers: + - url: /v3 +components: + schemas: + http_errors_section: + type: object + x-go-type: models.HTTPErrorsSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + http_errors_sections: + type: array + items: + $ref: '#/components/schemas/http_errors_section' + x-go-type: models.HTTPErrorsSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/http_errors_sections: + get: + summary: Return an array of HTTP errors sections + description: Returns an array of all configured HTTP errors sections. + operationId: getHTTPErrorsSections + tags: + - HTTPErrors + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_sections' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a HTTP errors section + description: Adds a new HTTP errors section to the configuration file. + operationId: createHTTPErrorsSection + tags: + - HTTPErrors + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + '201': + description: HTTP errors section created + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/http_errors_sections/{name}: + get: + summary: Return a HTTP errors section + description: Returns one HTTP errors section configuration by its name. + operationId: getHTTPErrorsSection + tags: + - HTTPErrors + parameters: + - name: name + in: path + description: HTTP errors section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a HTTP errors section + description: Replaces a HTTP errors section configuration by its name. + operationId: replaceHTTPErrorsSection + tags: + - HTTPErrors + parameters: + - name: name + in: path + description: HTTP errors section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + '200': + description: HTTP errors section replaced + content: + application/json: + schema: + $ref: '#/components/schemas/http_errors_section' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a HTTP errors section + description: Deletes a HTTP errors section from the configuration by its name. + operationId: deleteHTTPErrorsSection + tags: + - HTTPErrors + parameters: + - name: name + in: path + description: HTTP errors section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: HTTP errors section deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/log_forward/handlers.conf.yaml b/specification/paths/configuration/log_forward/handlers.conf.yaml new file mode 100644 index 00000000..a13860f1 --- /dev/null +++ b/specification/paths/configuration/log_forward/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: log_forward +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/log_forward/log_forward.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/log_forward/oapi.yaml b/specification/paths/configuration/log_forward/oapi.yaml new file mode 100644 index 00000000..f4395f73 --- /dev/null +++ b/specification/paths/configuration/log_forward/oapi.yaml @@ -0,0 +1,280 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Log Forward + description: An API for managing HAProxy log forward configurations. +servers: + - url: /v3 +components: + schemas: + log_forward: + type: object + x-go-type: models.LogForward + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_forwards: + type: array + items: + $ref: '#/components/schemas/log_forward' + x-go-type: models.LogForwards + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/log_forwards: + get: + summary: Return an array of log forwards + description: Returns an array of all configured log forwards. + operationId: getLogForwards + tags: + - LogForward + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_forwards' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a log forward + description: Adds a new log forward to the configuration file. + operationId: createLogForward + tags: + - LogForward + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + '201': + description: Log forward created + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/log_forwards/{name}: + get: + summary: Return a log forward + description: Returns one log forward configuration by its name. + operationId: getLogForward + tags: + - LogForward + parameters: + - name: name + in: path + description: Log forward name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a log forward + description: Replaces a log forward configuration by its name. + operationId: replaceLogForward + tags: + - LogForward + parameters: + - name: name + in: path + description: Log forward name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + '200': + description: Log forward replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_forward' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a log forward + description: Deletes a log forward from the configuration by its name. + operationId: deleteLogForward + tags: + - LogForward + parameters: + - name: name + in: path + description: Log forward name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Log forward deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/log_profile/handlers.conf.yaml b/specification/paths/configuration/log_profile/handlers.conf.yaml new file mode 100644 index 00000000..b8d19e56 --- /dev/null +++ b/specification/paths/configuration/log_profile/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: log_profile +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/log_profile/log_profile.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/log_profile/oapi.yaml b/specification/paths/configuration/log_profile/oapi.yaml new file mode 100644 index 00000000..2c0586cf --- /dev/null +++ b/specification/paths/configuration/log_profile/oapi.yaml @@ -0,0 +1,252 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Log Profile + description: An API for managing HAProxy log profile configurations. +servers: + - url: /v3 +components: + schemas: + log_profile: + type: object + x-go-type: models.LogProfile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_profiles: + type: array + items: + $ref: '#/components/schemas/log_profile' + x-go-type: models.LogProfiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/log_profiles: + get: + summary: Return an array of log profiles + description: Returns an array of all configured log profiles. + operationId: getLogProfiles + tags: + - LogProfile + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_profiles' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a log profile + description: Adds a new log profile to the configuration file. + operationId: createLogProfile + tags: + - LogProfile + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + '201': + description: Log profile created + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/log_profiles/{name}: + get: + summary: Return a log profile + description: Returns one log profile configuration by its name. + operationId: getLogProfile + tags: + - LogProfile + parameters: + - name: name + in: path + description: Log profile name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a log profile + description: Replaces a log profile configuration by its name. + operationId: editLogProfile + tags: + - LogProfile + parameters: + - name: name + in: path + description: Log profile name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + '200': + description: Log profile replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_profile' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a log profile + description: Deletes a log profile from the configuration by its name. + operationId: deleteLogProfile + tags: + - LogProfile + parameters: + - name: name + in: path + description: Log profile name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Log profile deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/log_target/handlers.conf.yaml b/specification/paths/configuration/log_target/handlers.conf.yaml new file mode 100644 index 00000000..409ffd12 --- /dev/null +++ b/specification/paths/configuration/log_target/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: log_target +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/log_target/log_target.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/log_target/oapi.yaml b/specification/paths/configuration/log_target/oapi.yaml new file mode 100644 index 00000000..ffc25a48 --- /dev/null +++ b/specification/paths/configuration/log_target/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Log Target + description: An API for managing HAProxy Log Target lines. +servers: + - url: /v3 +components: + schemas: + log_target: + type: object + x-go-type: models.LogTarget + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_targets: + type: array + items: + $ref: '#/components/schemas/log_target' + x-go-type: models.LogTargets + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/log_targets: + get: + summary: Return an array of all Log Targets + description: Returns all Log Targets that are configured in specified {{ .ParentType }}. + operationId: getAllLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Log Target list + description: Replaces a whole list of Log Targets with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + '200': + description: All Log Targets replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/log_targets/{index}: + get: + summary: Return one Log Target + description: Returns one Log Target configuration by its index in the specified {{ .ParentType }}. + operationId: getLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Log Target + description: Adds a new Log Target of the specified type in the specified {{ .ParentType }}. + operationId: createLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '201': + description: Log Target created + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Log Target + description: Replaces a Log Target configuration by its index in the specified {{ .ParentType }}. + operationId: replaceLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '200': + description: Log Target replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Log Target + description: Deletes a Log Target configuration by its index from the specified {{ .ParentType }}. + operationId: deleteLogTarget{{ .ParentType }} + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Log Target deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/log_targets_global/handlers.conf.yaml b/specification/paths/configuration/log_targets_global/handlers.conf.yaml new file mode 100644 index 00000000..65ed6ad8 --- /dev/null +++ b/specification/paths/configuration/log_targets_global/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: log_targets_global +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/log_targets_global/log_targets_global.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/log_targets_global/oapi.yaml b/specification/paths/configuration/log_targets_global/oapi.yaml new file mode 100644 index 00000000..32bdce2a --- /dev/null +++ b/specification/paths/configuration/log_targets_global/oapi.yaml @@ -0,0 +1,312 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Log Target Global + description: An API for managing HAProxy global Log Target entries. +servers: + - url: /v3 +components: + schemas: + log_target: + type: object + x-go-type: models.LogTarget + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + log_targets: + type: array + items: + $ref: '#/components/schemas/log_target' + x-go-type: models.LogTargets + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/global/log_targets: + get: + summary: Return an array of all global Log Targets + description: Returns all Log Targets that are configured in the global section. + operationId: getAllLogTargetGlobal + tags: + - LogTarget + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a global Log Target list + description: Replaces a whole list of global Log Targets with the list given in parameter. + operationId: replaceAllLogTargetGlobal + tags: + - LogTarget + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + '200': + description: All global Log Targets replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_targets' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/global/log_targets/{index}: + get: + summary: Return one global Log Target + description: Returns one global Log Target configuration by its index. + operationId: getLogTargetGlobal + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new global Log Target + description: Adds a new global Log Target. + operationId: createLogTargetGlobal + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '201': + description: Global Log Target created + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a global Log Target + description: Replaces a global Log Target configuration by its index. + operationId: replaceLogTargetGlobal + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '200': + description: Global Log Target replaced + content: + application/json: + schema: + $ref: '#/components/schemas/log_target' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a global Log Target + description: Deletes a global Log Target configuration by its index. + operationId: deleteLogTargetGlobal + tags: + - LogTarget + parameters: + - name: index + in: path + description: Log Target Index + required: true + schema: + type: integer + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Global Log Target deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/mailers/handlers.conf.yaml b/specification/paths/configuration/mailers/handlers.conf.yaml new file mode 100644 index 00000000..17ddbdcc --- /dev/null +++ b/specification/paths/configuration/mailers/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: mailers +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/mailers/mailers.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/mailers/oapi.yaml b/specification/paths/configuration/mailers/oapi.yaml new file mode 100644 index 00000000..1ac32dc8 --- /dev/null +++ b/specification/paths/configuration/mailers/oapi.yaml @@ -0,0 +1,564 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Mailers + description: An API for managing HAProxy mailers section and mailer entry configurations. +servers: + - url: /v3 +components: + schemas: + mailers_section: + type: object + x-go-type: models.MailersSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailers_sections: + type: array + items: + $ref: '#/components/schemas/mailers_section' + x-go-type: models.MailersSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailer_entry: + type: object + x-go-type: models.MailerEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + mailer_entries: + type: array + items: + $ref: '#/components/schemas/mailer_entry' + x-go-type: models.MailerEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/mailers_section: + get: + summary: Return an array of mailers sections + description: Returns an array of all configured mailers sections. + operationId: getMailersSections + deprecated: true + tags: + - Mailers + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_sections' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a mailers section + description: Adds a new mailers section to the configuration file. + operationId: createMailersSection + deprecated: true + tags: + - Mailers + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + '201': + description: Mailers section created + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/mailers_section/{name}: + get: + summary: Return a mailers section + description: Returns one mailers section configuration by its name. + operationId: getMailersSection + deprecated: true + tags: + - Mailers + parameters: + - name: name + in: path + description: Mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a mailers section + description: Replaces a mailers section configuration by its name. + operationId: editMailersSection + deprecated: true + tags: + - Mailers + parameters: + - name: name + in: path + description: Mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + '200': + description: Mailers section replaced + content: + application/json: + schema: + $ref: '#/components/schemas/mailers_section' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a mailers section + description: Deletes a mailers section from the configuration by its name. + operationId: deleteMailersSection + deprecated: true + tags: + - Mailers + parameters: + - name: name + in: path + description: Mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Mailers section deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + + /services/haproxy/configuration/mailer_entries: + get: + summary: Return an array of mailer entries + description: Returns an array of all mailer entries belonging to the specified mailers section. + operationId: getMailerEntries + deprecated: true + tags: + - MailerEntry + parameters: + - name: mailers_section + in: query + description: Parent mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entries' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a mailer entry + description: Adds a new mailer entry to the specified mailers section. + operationId: createMailerEntry + deprecated: true + tags: + - MailerEntry + parameters: + - name: mailers_section + in: query + description: Parent mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + '201': + description: Mailer entry created + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/mailer_entries/{name}: + get: + summary: Return a mailer entry + description: Returns one mailer entry from the specified mailers section by name. + operationId: getMailerEntry + deprecated: true + tags: + - MailerEntry + parameters: + - name: name + in: path + description: Mailer entry name + required: true + schema: + type: string + - name: mailers_section + in: query + description: Parent mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a mailer entry + description: Replaces a mailer entry in the specified mailers section by name. + operationId: replaceMailerEntry + deprecated: true + tags: + - MailerEntry + parameters: + - name: name + in: path + description: Mailer entry name + required: true + schema: + type: string + - name: mailers_section + in: query + description: Parent mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + '200': + description: Mailer entry replaced + content: + application/json: + schema: + $ref: '#/components/schemas/mailer_entry' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a mailer entry + description: Deletes a mailer entry from the specified mailers section by name. + operationId: deleteMailerEntry + deprecated: true + tags: + - MailerEntry + parameters: + - name: name + in: path + description: Mailer entry name + required: true + schema: + type: string + - name: mailers_section + in: query + description: Parent mailers section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Mailer entry deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/peers/handlers.conf.yaml b/specification/paths/configuration/peers/handlers.conf.yaml new file mode 100644 index 00000000..898e12fa --- /dev/null +++ b/specification/paths/configuration/peers/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: peers +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/peers/peers.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/peers/oapi.yaml b/specification/paths/configuration/peers/oapi.yaml new file mode 100644 index 00000000..dd3ebfa7 --- /dev/null +++ b/specification/paths/configuration/peers/oapi.yaml @@ -0,0 +1,484 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Peers + description: An API for managing HAProxy peer section and peer entry configurations. +servers: + - url: /v3 +components: + schemas: + peer_section: + type: object + x-go-type: models.PeerSection + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_sections: + type: array + items: + $ref: '#/components/schemas/peer_section' + x-go-type: models.PeerSections + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_entry: + type: object + x-go-type: models.PeerEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + peer_entries: + type: array + items: + $ref: '#/components/schemas/peer_entry' + x-go-type: models.PeerEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/peer_section: + get: + summary: Return an array of peer sections + description: Returns an array of all configured peer sections. + operationId: getPeerSections + tags: + - Peer + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_sections' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a peer section + description: Adds a new peer section to the configuration file. + operationId: createPeer + tags: + - Peer + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + '201': + description: Peer section created + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/peer_section/{name}: + get: + summary: Return a peer section + description: Returns one peer section configuration by its name. + operationId: getPeerSection + tags: + - Peer + parameters: + - name: name + in: path + description: Peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_section' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete a peer section + description: Deletes a peer section from the configuration by its name. + operationId: deletePeer + tags: + - Peer + parameters: + - name: name + in: path + description: Peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Peer section deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + + /services/haproxy/configuration/peer_entries: + get: + summary: Return an array of peer entries + description: Returns an array of all peer entries belonging to the specified peer section. + operationId: getPeerEntries + tags: + - PeerEntry + parameters: + - name: peer_section + in: query + description: Parent peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entries' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a peer entry + description: Adds a new peer entry to the specified peer section. + operationId: createPeerEntry + tags: + - PeerEntry + parameters: + - name: peer_section + in: query + description: Parent peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + '201': + description: Peer entry created + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/peer_entries/{name}: + get: + summary: Return a peer entry + description: Returns one peer entry from the specified peer section by name. + operationId: getPeerEntry + tags: + - PeerEntry + parameters: + - name: name + in: path + description: Peer entry name + required: true + schema: + type: string + - name: peer_section + in: query + description: Parent peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a peer entry + description: Replaces a peer entry in the specified peer section by name. + operationId: replacePeerEntry + tags: + - PeerEntry + parameters: + - name: name + in: path + description: Peer entry name + required: true + schema: + type: string + - name: peer_section + in: query + description: Parent peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + '200': + description: Peer entry replaced + content: + application/json: + schema: + $ref: '#/components/schemas/peer_entry' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a peer entry + description: Deletes a peer entry from the specified peer section by name. + operationId: deletePeerEntry + tags: + - PeerEntry + parameters: + - name: name + in: path + description: Peer entry name + required: true + schema: + type: string + - name: peer_section + in: query + description: Parent peer section name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Peer entry deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/program/handlers.conf.yaml b/specification/paths/configuration/program/handlers.conf.yaml new file mode 100644 index 00000000..8d6897ca --- /dev/null +++ b/specification/paths/configuration/program/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: program +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/program/program.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/program/oapi.yaml b/specification/paths/configuration/program/oapi.yaml new file mode 100644 index 00000000..19963b9a --- /dev/null +++ b/specification/paths/configuration/program/oapi.yaml @@ -0,0 +1,257 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Program + description: An API for managing HAProxy program configurations. +servers: + - url: /v3 +components: + schemas: + program: + type: object + x-go-type: models.Program + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + programs: + type: array + items: + $ref: '#/components/schemas/program' + x-go-type: models.Programs + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/programs: + get: + summary: Return an array of programs + description: Returns an array of all configured programs in the process-manager configuration file. + operationId: getPrograms + deprecated: true + tags: + - ProcessManager + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/programs' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a program + description: Adds a new program to the process-manager configuration file. + operationId: createProgram + deprecated: true + tags: + - ProcessManager + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/program' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/program' + '201': + description: Program created + content: + application/json: + schema: + $ref: '#/components/schemas/program' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/programs/{name}: + get: + summary: Return a program + description: Returns one program by its name from the process-manager configuration file. + operationId: getProgram + deprecated: true + tags: + - ProcessManager + parameters: + - name: name + in: path + description: Program name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/program' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a program + description: Replaces a program from the process-manager configuration by its name. + operationId: replaceProgram + deprecated: true + tags: + - ProcessManager + parameters: + - name: name + in: path + description: Program name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/program' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/program' + '200': + description: Program replaced + content: + application/json: + schema: + $ref: '#/components/schemas/program' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a program + description: Deletes a program from the process-manager configuration file by its name. + operationId: deleteProgram + deprecated: true + tags: + - ProcessManager + parameters: + - name: name + in: path + description: Program name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Program deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/quic/quic_initial_rule/handlers.conf.yaml b/specification/paths/configuration/quic/quic_initial_rule/handlers.conf.yaml new file mode 100644 index 00000000..2a79a0d8 --- /dev/null +++ b/specification/paths/configuration/quic/quic_initial_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: quic_initial_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/quic/quic_initial_rule/quic_initial_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/quic/quic_initial_rule/oapi.yaml b/specification/paths/configuration/quic/quic_initial_rule/oapi.yaml new file mode 100644 index 00000000..0c5f9d8f --- /dev/null +++ b/specification/paths/configuration/quic/quic_initial_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - QUIC Initial Rule + description: An API for managing HAProxy QUIC Initial Rules. +servers: + - url: /v3 +components: + schemas: + quic_initial_rule: + type: object + x-go-type: models.QUICInitialRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + quic_initial_rules: + type: array + items: + $ref: '#/components/schemas/quic_initial_rule' + x-go-type: models.QUICInitialRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/quic_initial_rules: + get: + summary: Return an array of all QUIC Initial Rules + description: Returns all QUIC Initial Rules that are configured in specified {{ .ParentType }}. + operationId: getAllQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a QUIC Initial Rule list + description: Replaces a whole list of QUIC Initial Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + '200': + description: All QUIC Initial Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/quic_initial_rules/{index}: + get: + summary: Return one QUIC Initial Rule + description: Returns one QUIC Initial Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: index + in: path + description: QUIC Initial Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new QUIC Initial Rule + description: Adds a new QUIC Initial Rule of the specified type in the specified {{ .ParentType }}. + operationId: createQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: index + in: path + description: QUIC Initial Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + '201': + description: QUIC Initial Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a QUIC Initial Rule + description: Replaces a QUIC Initial Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: index + in: path + description: QUIC Initial Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + '200': + description: QUIC Initial Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/quic_initial_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a QUIC Initial Rule + description: Deletes a QUIC Initial Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteQUICInitialRule{{ .ParentType }} + tags: + - QUICInitialRule + parameters: + - name: index + in: path + description: QUIC Initial Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: QUIC Initial Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/raw/handlers.conf.yaml b/specification/paths/configuration/raw/handlers.conf.yaml new file mode 100644 index 00000000..c8eaf3f0 --- /dev/null +++ b/specification/paths/configuration/raw/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: raw +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/raw/raw.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/raw/oapi.yaml b/specification/paths/configuration/raw/oapi.yaml new file mode 100644 index 00000000..216a647b --- /dev/null +++ b/specification/paths/configuration/raw/oapi.yaml @@ -0,0 +1,159 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Raw Configuration + description: An API for managing HAProxy raw configuration. +servers: + - url: /v3 +paths: + /services/haproxy/configuration/raw: + get: + summary: Return HAProxy configuration as a plain text + description: Returns HAProxy configuration file in plain text format. + operationId: getHAProxyConfiguration + tags: + - Configuration + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + responses: + '200': + description: Successful operation + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + text/plain: + schema: + type: string + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Push new haproxy configuration + description: Push a new haproxy configuration file in plain text format. + operationId: postHAProxyConfiguration + tags: + - Configuration + parameters: + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: skip_version + in: query + description: If set, no version check will be done and the pushed configuration will be applied directly. + required: false + schema: + type: boolean + default: false + - name: skip_reload + in: query + description: If set, HAProxy will not be reloaded after the configuration is pushed. + required: false + schema: + type: boolean + default: false + - name: only_validate + in: query + description: If set, the configuration will only be validated and not applied. + required: false + schema: + type: boolean + default: false + - name: X-Runtime-Actions + in: header + description: List of runtime actions to execute after the configuration is applied. + required: false + schema: + type: string + requestBody: + required: true + content: + text/plain: + schema: + type: string + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + text/plain: + schema: + type: string + '201': + description: New HAProxy configuration pushed + headers: + Cluster-Version: + description: Cluster configuration version + schema: + type: string + Configuration-Checksum: + description: Configuration file md5 checksum + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + text/plain: + schema: + type: string + '400': + description: Bad request + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + text/plain: + schema: + type: string + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data diff --git a/specification/paths/configuration/resolver/handlers.conf.yaml b/specification/paths/configuration/resolver/handlers.conf.yaml new file mode 100644 index 00000000..7d53ef4d --- /dev/null +++ b/specification/paths/configuration/resolver/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: resolver +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/resolver/resolver.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/resolver/oapi.yaml b/specification/paths/configuration/resolver/oapi.yaml new file mode 100644 index 00000000..437523f6 --- /dev/null +++ b/specification/paths/configuration/resolver/oapi.yaml @@ -0,0 +1,554 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Resolver + description: An API for managing HAProxy resolver and nameserver configurations. +servers: + - url: /v3 +components: + schemas: + resolver: + type: object + x-go-type: models.Resolver + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + resolvers: + type: array + items: + $ref: '#/components/schemas/resolver' + x-go-type: models.Resolvers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + nameserver: + type: object + x-go-type: models.Nameserver + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + nameservers: + type: array + items: + $ref: '#/components/schemas/nameserver' + x-go-type: models.Nameservers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/resolvers: + get: + summary: Return an array of resolvers + description: Returns an array of all configured resolvers. + operationId: getResolvers + tags: + - Resolver + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/resolvers' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a resolver + description: Adds a new resolver to the configuration file. + operationId: createResolver + tags: + - Resolver + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + '201': + description: Resolver created + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/resolvers/{name}: + get: + summary: Return a resolver + description: Returns one resolver configuration by its name. + operationId: getResolver + tags: + - Resolver + parameters: + - name: name + in: path + description: Resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a resolver + description: Replaces a resolver configuration by its name. + operationId: replaceResolver + tags: + - Resolver + parameters: + - name: name + in: path + description: Resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + '200': + description: Resolver replaced + content: + application/json: + schema: + $ref: '#/components/schemas/resolver' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a resolver + description: Deletes a resolver from the configuration by its name. + operationId: deleteResolver + tags: + - Resolver + parameters: + - name: name + in: path + description: Resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Resolver deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + + /services/haproxy/configuration/nameservers: + get: + summary: Return an array of nameservers + description: Returns an array of all nameservers belonging to the specified resolver. + operationId: getNameservers + tags: + - Nameserver + parameters: + - name: resolver + in: query + description: Parent resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/nameservers' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a nameserver + description: Adds a new nameserver to the specified resolver. + operationId: createNameserver + tags: + - Nameserver + parameters: + - name: resolver + in: query + description: Parent resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + '201': + description: Nameserver created + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/nameservers/{name}: + get: + summary: Return a nameserver + description: Returns one nameserver from the specified resolver by name. + operationId: getNameserver + tags: + - Nameserver + parameters: + - name: name + in: path + description: Nameserver name + required: true + schema: + type: string + - name: resolver + in: query + description: Parent resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a nameserver + description: Replaces a nameserver in the specified resolver by name. + operationId: replaceNameserver + tags: + - Nameserver + parameters: + - name: name + in: path + description: Nameserver name + required: true + schema: + type: string + - name: resolver + in: query + description: Parent resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + '200': + description: Nameserver replaced + content: + application/json: + schema: + $ref: '#/components/schemas/nameserver' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a nameserver + description: Deletes a nameserver from the specified resolver by name. + operationId: deleteNameserver + tags: + - Nameserver + parameters: + - name: name + in: path + description: Nameserver name + required: true + schema: + type: string + - name: resolver + in: query + description: Parent resolver name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Nameserver deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/ring/handlers.conf.yaml b/specification/paths/configuration/ring/handlers.conf.yaml new file mode 100644 index 00000000..003a3a86 --- /dev/null +++ b/specification/paths/configuration/ring/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ring +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/ring/ring.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/ring/oapi.yaml b/specification/paths/configuration/ring/oapi.yaml new file mode 100644 index 00000000..d8bb7fcf --- /dev/null +++ b/specification/paths/configuration/ring/oapi.yaml @@ -0,0 +1,280 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Ring + description: An API for managing HAProxy ring configurations. +servers: + - url: /v3 +components: + schemas: + ring: + type: object + x-go-type: models.Ring + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + rings: + type: array + items: + $ref: '#/components/schemas/ring' + x-go-type: models.Rings + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/rings: + get: + summary: Return an array of rings + description: Returns an array of all configured rings. + operationId: getRings + tags: + - Ring + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/rings' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a ring + description: Adds a new ring to the configuration file. + operationId: createRing + tags: + - Ring + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + '201': + description: Ring created + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/rings/{name}: + get: + summary: Return a ring + description: Returns one ring configuration by its name. + operationId: getRing + tags: + - Ring + parameters: + - name: name + in: path + description: Ring name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a ring + description: Replaces a ring configuration by its name. + operationId: replaceRing + tags: + - Ring + parameters: + - name: name + in: path + description: Ring name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + '200': + description: Ring replaced + content: + application/json: + schema: + $ref: '#/components/schemas/ring' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a ring + description: Deletes a ring from the configuration by its name. + operationId: deleteRing + tags: + - Ring + parameters: + - name: name + in: path + description: Ring name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Ring deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/server/handlers.conf.yaml b/specification/paths/configuration/server/handlers.conf.yaml new file mode 100644 index 00000000..856da769 --- /dev/null +++ b/specification/paths/configuration/server/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: server +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/server/server.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/server/oapi.yaml b/specification/paths/configuration/server/oapi.yaml new file mode 100644 index 00000000..6d1a1c48 --- /dev/null +++ b/specification/paths/configuration/server/oapi.yaml @@ -0,0 +1,288 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Server + description: An API for managing HAProxy Server entries. +servers: + - url: /v3 +components: + schemas: + server: + type: object + x-go-type: models.Server + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + servers: + type: array + items: + $ref: '#/components/schemas/server' + x-go-type: models.Servers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/servers: + get: + summary: Return an array of servers + description: Returns all servers that are configured in specified {{ .ParentType }}. + operationId: getAllServer{{ .ParentType }} + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/servers' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new server + description: Adds a new server in the specified {{ .ParentType }}. + operationId: createServer{{ .ParentType }} + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server' + '201': + description: Server created + content: + application/json: + schema: + $ref: '#/components/schemas/server' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/servers/{name}: + get: + summary: Return one server + description: Returns one server configuration by its name in the specified {{ .ParentType }}. + operationId: getServer{{ .ParentType }} + tags: + - Server + parameters: + - name: name + in: path + description: Server name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a server + description: Replaces a server configuration by its name in the specified {{ .ParentType }}. + operationId: replaceServer{{ .ParentType }} + tags: + - Server + parameters: + - name: name + in: path + description: Server name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server' + '200': + description: Server replaced + content: + application/json: + schema: + $ref: '#/components/schemas/server' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a server + description: Deletes a server configuration by its name from the specified {{ .ParentType }}. + operationId: deleteServer{{ .ParentType }} + tags: + - Server + parameters: + - name: name + in: path + description: Server name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Server deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/server_switching_rule/handlers.conf.yaml b/specification/paths/configuration/server_switching_rule/handlers.conf.yaml new file mode 100644 index 00000000..a0cf362f --- /dev/null +++ b/specification/paths/configuration/server_switching_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: server_switching_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/server_switching_rule/server_switching_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/server_switching_rule/oapi.yaml b/specification/paths/configuration/server_switching_rule/oapi.yaml new file mode 100644 index 00000000..704ad3a7 --- /dev/null +++ b/specification/paths/configuration/server_switching_rule/oapi.yaml @@ -0,0 +1,354 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Server Switching Rule + description: An API for managing HAProxy Server Switching Rule entries. +servers: + - url: /v3 +components: + schemas: + server_switching_rule: + type: object + x-go-type: models.ServerSwitchingRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_switching_rules: + type: array + items: + $ref: '#/components/schemas/server_switching_rule' + x-go-type: models.ServerSwitchingRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/backends/{parent_name}/server_switching_rules: + get: + summary: Return an array of all Server Switching Rules + description: Returns all Server Switching Rules that are configured in specified backend. + operationId: getServerSwitchingRules + tags: + - ServerSwitchingRule + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Server Switching Rule list + description: Replaces a whole list of Server Switching Rules with the list given in parameter for the specified backend. + operationId: replaceServerSwitchingRules + tags: + - ServerSwitchingRule + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + '200': + description: All Server Switching Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rules' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_switching_rules/{index}: + get: + summary: Return one Server Switching Rule + description: Returns one Server Switching Rule configuration by its index in the specified backend. + operationId: getServerSwitchingRule + tags: + - ServerSwitchingRule + parameters: + - name: index + in: path + description: Server Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Server Switching Rule + description: Adds a new Server Switching Rule in the specified backend. + operationId: createServerSwitchingRule + tags: + - ServerSwitchingRule + parameters: + - name: index + in: path + description: Server Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + '201': + description: Server Switching Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Server Switching Rule + description: Replaces a Server Switching Rule configuration by its index in the specified backend. + operationId: replaceServerSwitchingRule + tags: + - ServerSwitchingRule + parameters: + - name: index + in: path + description: Server Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + '200': + description: Server Switching Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/server_switching_rule' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Server Switching Rule + description: Deletes a Server Switching Rule configuration by its index from the specified backend. + operationId: deleteServerSwitchingRule + tags: + - ServerSwitchingRule + parameters: + - name: index + in: path + description: Server Switching Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Server Switching Rule deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/server_template/handlers.conf.yaml b/specification/paths/configuration/server_template/handlers.conf.yaml new file mode 100644 index 00000000..b232d52b --- /dev/null +++ b/specification/paths/configuration/server_template/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: server_template +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/server_template/server_template.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/server_template/oapi.yaml b/specification/paths/configuration/server_template/oapi.yaml new file mode 100644 index 00000000..7f67d28b --- /dev/null +++ b/specification/paths/configuration/server_template/oapi.yaml @@ -0,0 +1,286 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Server Template + description: An API for managing HAProxy Server Template entries. +servers: + - url: /v3 +components: + schemas: + server_template: + type: object + x-go-type: models.ServerTemplate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + server_templates: + type: array + items: + $ref: '#/components/schemas/server_template' + x-go-type: models.ServerTemplates + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/backends/{parent_name}/server_templates: + get: + summary: Return an array of server templates + description: Returns all server templates that are configured in specified backend. + operationId: getServerTemplates + tags: + - ServerTemplate + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_templates' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new server template + description: Adds a new server template in the specified backend. + operationId: createServerTemplate + tags: + - ServerTemplate + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + '201': + description: Server Template created + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/server_templates/{prefix}: + get: + summary: Return one server template + description: Returns one server template configuration by its prefix in the specified backend. + operationId: getServerTemplate + tags: + - ServerTemplate + parameters: + - name: prefix + in: path + description: Server template prefix + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a server template + description: Replaces a server template configuration by its prefix in the specified backend. + operationId: replaceServerTemplate + tags: + - ServerTemplate + parameters: + - name: prefix + in: path + description: Server template prefix + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + '200': + description: Server Template replaced + content: + application/json: + schema: + $ref: '#/components/schemas/server_template' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a server template + description: Deletes a server template configuration by its prefix from the specified backend. + operationId: deleteServerTemplate + tags: + - ServerTemplate + parameters: + - name: prefix + in: path + description: Server template prefix + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Server Template deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/ssl_front_use/handlers.conf.yaml b/specification/paths/configuration/ssl_front_use/handlers.conf.yaml new file mode 100644 index 00000000..b3e28537 --- /dev/null +++ b/specification/paths/configuration/ssl_front_use/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_front_use +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/ssl_front_use/ssl_front_use.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/ssl_front_use/oapi.yaml b/specification/paths/configuration/ssl_front_use/oapi.yaml new file mode 100644 index 00000000..4ea651f6 --- /dev/null +++ b/specification/paths/configuration/ssl_front_use/oapi.yaml @@ -0,0 +1,288 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SSL Front Use + description: An API for managing HAProxy SSL Front Use entries. +servers: + - url: /v3 +components: + schemas: + ssl_front_use: + type: object + x-go-type: models.SSLFrontUse + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_front_uses: + type: array + items: + $ref: '#/components/schemas/ssl_front_use' + x-go-type: models.SSLFrontUses + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/ssl_front_uses: + get: + summary: Return an array of all SSL Front Uses + description: Returns all SSL Front Uses that are configured in specified {{ .ParentType }}. + operationId: getAllSSLFrontUses + tags: + - SSLFrontUse + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_uses' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new SSL Front Use + description: Adds a new SSL Front Use in the specified {{ .ParentType }}. + operationId: createSSLFrontUse + tags: + - SSLFrontUse + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + '201': + description: SSL Front Use created + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/ssl_front_uses/{index}: + get: + summary: Return one SSL Front Use + description: Returns one SSL Front Use configuration by its index in the specified {{ .ParentType }}. + operationId: getSSLFrontUse + tags: + - SSLFrontUse + parameters: + - name: index + in: path + description: SSL Front Use Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a SSL Front Use + description: Replaces a SSL Front Use configuration by its index in the specified {{ .ParentType }}. + operationId: replaceSSLFrontUse + tags: + - SSLFrontUse + parameters: + - name: index + in: path + description: SSL Front Use Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + '200': + description: SSL Front Use replaced + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_front_use' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a SSL Front Use + description: Deletes a SSL Front Use configuration by its index from the specified {{ .ParentType }}. + operationId: deleteSSLFrontUse + tags: + - SSLFrontUse + parameters: + - name: index + in: path + description: SSL Front Use Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: SSL Front Use deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/stick_rule/handlers.conf.yaml b/specification/paths/configuration/stick_rule/handlers.conf.yaml new file mode 100644 index 00000000..bab5c377 --- /dev/null +++ b/specification/paths/configuration/stick_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: stick_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/stick_rule/stick_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/stick_rule/oapi.yaml b/specification/paths/configuration/stick_rule/oapi.yaml new file mode 100644 index 00000000..6ef2c2e4 --- /dev/null +++ b/specification/paths/configuration/stick_rule/oapi.yaml @@ -0,0 +1,354 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Stick Rule + description: An API for managing HAProxy Stick Rule entries. +servers: + - url: /v3 +components: + schemas: + stick_rule: + type: object + x-go-type: models.StickRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_rules: + type: array + items: + $ref: '#/components/schemas/stick_rule' + x-go-type: models.StickRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/backends/{parent_name}/stick_rules: + get: + summary: Return an array of all Stick Rules + description: Returns all Stick Rules that are configured in specified backend. + operationId: getStickRules + tags: + - StickRule + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Stick Rule list + description: Replaces a whole list of Stick Rules with the list given in parameter for the specified backend. + operationId: replaceStickRules + tags: + - StickRule + parameters: + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + '200': + description: All Stick Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rules' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/backends/{parent_name}/stick_rules/{index}: + get: + summary: Return one Stick Rule + description: Returns one Stick Rule configuration by its index in the specified backend. + operationId: getStickRule + tags: + - StickRule + parameters: + - name: index + in: path + description: Stick Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Stick Rule + description: Adds a new Stick Rule in the specified backend. + operationId: createStickRule + tags: + - StickRule + parameters: + - name: index + in: path + description: Stick Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + '201': + description: Stick Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a Stick Rule + description: Replaces a Stick Rule configuration by its index in the specified backend. + operationId: replaceStickRule + tags: + - StickRule + parameters: + - name: index + in: path + description: Stick Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + '200': + description: Stick Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/stick_rule' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Stick Rule + description: Deletes a Stick Rule configuration by its index from the specified backend. + operationId: deleteStickRule + tags: + - StickRule + parameters: + - name: index + in: path + description: Stick Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent backend name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Stick Rule deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/table/handlers.conf.yaml b/specification/paths/configuration/table/handlers.conf.yaml new file mode 100644 index 00000000..88db4bc6 --- /dev/null +++ b/specification/paths/configuration/table/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: table +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/table/table.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/table/oapi.yaml b/specification/paths/configuration/table/oapi.yaml new file mode 100644 index 00000000..582d1f3f --- /dev/null +++ b/specification/paths/configuration/table/oapi.yaml @@ -0,0 +1,286 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Table + description: An API for managing HAProxy Stick Table entries. +servers: + - url: /v3 +components: + schemas: + table: + type: object + x-go-type: models.StickTable + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tables: + type: array + items: + $ref: '#/components/schemas/table' + x-go-type: models.StickTables + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/peers/{parent_name}/tables: + get: + summary: Return an array of tables + description: Returns all tables that are configured in specified peers section. + operationId: getTables + tags: + - Table + parameters: + - name: parent_name + in: path + description: Parent peers section name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tables' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new table + description: Adds a new table in the specified peers section. + operationId: createTable + tags: + - Table + parameters: + - name: parent_name + in: path + description: Parent peers section name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/table' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/table' + '201': + description: Table created + content: + application/json: + schema: + $ref: '#/components/schemas/table' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/peers/{parent_name}/tables/{name}: + get: + summary: Return one table + description: Returns one table configuration by its name in the specified peers section. + operationId: getTable + tags: + - Table + parameters: + - name: name + in: path + description: Table name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent peers section name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/table' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a table + description: Replaces a table configuration by its name in the specified peers section. + operationId: replaceTable + tags: + - Table + parameters: + - name: name + in: path + description: Table name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent peers section name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/table' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/table' + '200': + description: Table replaced + content: + application/json: + schema: + $ref: '#/components/schemas/table' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a table + description: Deletes a table configuration by its name from the specified peers section. + operationId: deleteTable + tags: + - Table + parameters: + - name: name + in: path + description: Table name + required: true + schema: + type: string + - name: parent_name + in: path + description: Parent peers section name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Table deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/tcp/tcp_check/handlers.conf.yaml b/specification/paths/configuration/tcp/tcp_check/handlers.conf.yaml new file mode 100644 index 00000000..b403cd0a --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_check/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: tcp_check +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/tcp/tcp_check/tcp_check.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/tcp/tcp_check/oapi.yaml b/specification/paths/configuration/tcp/tcp_check/oapi.yaml new file mode 100644 index 00000000..eeeb0cb4 --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_check/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - TCP Check + description: An API for managing HAProxy TCP Checks. +servers: + - url: /v3 +components: + schemas: + tcp_check: + type: object + x-go-type: models.TCPCheck + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_checks: + type: array + items: + $ref: '#/components/schemas/tcp_check' + x-go-type: models.TCPChecks + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_checks: + get: + summary: Return an array of all TCP Checks + description: Returns all TCP Checks that are configured in specified {{ .ParentType }}. + operationId: getAllTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a TCP Check list + description: Replaces a whole list of TCP Checks with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + '200': + description: All TCP Checks replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_checks' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_checks/{index}: + get: + summary: Return one TCP Check + description: Returns one TCP Check configuration by its index in the specified {{ .ParentType }}. + operationId: getTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: index + in: path + description: TCP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new TCP Check + description: Adds a new TCP Check of the specified type in the specified {{ .ParentType }}. + operationId: createTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: index + in: path + description: TCP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + '201': + description: TCP Check created + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a TCP Check + description: Replaces a TCP Check configuration by its index in the specified {{ .ParentType }}. + operationId: replaceTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: index + in: path + description: TCP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + '200': + description: TCP Check replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_check' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a TCP Check + description: Deletes a TCP Check configuration by its index from the specified {{ .ParentType }}. + operationId: deleteTCPCheck{{ .ParentType }} + tags: + - TCPCheck + parameters: + - name: index + in: path + description: TCP Check Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: TCP Check deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/tcp/tcp_request_rule/handlers.conf.yaml b/specification/paths/configuration/tcp/tcp_request_rule/handlers.conf.yaml new file mode 100644 index 00000000..3e6fe1f7 --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_request_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: tcp_request_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/tcp/tcp_request_rule/tcp_request_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/tcp/tcp_request_rule/oapi.yaml b/specification/paths/configuration/tcp/tcp_request_rule/oapi.yaml new file mode 100644 index 00000000..bde31739 --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_request_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - TCP Request Rule + description: An API for managing HAProxy TCP Request Rules. +servers: + - url: /v3 +components: + schemas: + tcp_request_rule: + type: object + x-go-type: models.TCPRequestRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_request_rules: + type: array + items: + $ref: '#/components/schemas/tcp_request_rule' + x-go-type: models.TCPRequestRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_request_rules: + get: + summary: Return an array of all TCP Request Rules + description: Returns all TCP Request Rules that are configured in specified {{ .ParentType }}. + operationId: getAllTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a TCP Request Rule list + description: Replaces a whole list of TCP Request Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + '200': + description: All TCP Request Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_request_rules/{index}: + get: + summary: Return one TCP Request Rule + description: Returns one TCP Request Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: index + in: path + description: TCP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new TCP Request Rule + description: Adds a new TCP Request Rule of the specified type in the specified {{ .ParentType }}. + operationId: createTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: index + in: path + description: TCP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + '201': + description: TCP Request Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a TCP Request Rule + description: Replaces a TCP Request Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: index + in: path + description: TCP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + '200': + description: TCP Request Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_request_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a TCP Request Rule + description: Deletes a TCP Request Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteTCPRequestRule{{ .ParentType }} + tags: + - TCPRequestRule + parameters: + - name: index + in: path + description: TCP Request Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: TCP Request Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/tcp/tcp_response_rule/handlers.conf.yaml b/specification/paths/configuration/tcp/tcp_response_rule/handlers.conf.yaml new file mode 100644 index 00000000..c6421a68 --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_response_rule/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: tcp_response_rule +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/tcp/tcp_response_rule/tcp_response_rule.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/tcp/tcp_response_rule/oapi.yaml b/specification/paths/configuration/tcp/tcp_response_rule/oapi.yaml new file mode 100644 index 00000000..00716b36 --- /dev/null +++ b/specification/paths/configuration/tcp/tcp_response_rule/oapi.yaml @@ -0,0 +1,356 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - TCP Response Rule + description: An API for managing HAProxy TCP Response Rules. +servers: + - url: /v3 +components: + schemas: + tcp_response_rule: + type: object + x-go-type: models.TCPResponseRule + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + tcp_response_rules: + type: array + items: + $ref: '#/components/schemas/tcp_response_rule' + x-go-type: models.TCPResponseRules + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: +{{ range parents }} + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_response_rules: + get: + summary: Return an array of all TCP Response Rules + description: Returns all TCP Response Rules that are configured in specified {{ .ParentType }}. + operationId: getAllTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a TCP Response Rule list + description: Replaces a whole list of TCP Response Rules with the list given in parameter for the specified {{ .ParentType }}. + operationId: replaceAllTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + '200': + description: All TCP Response Rules replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rules' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/configuration/{{ .PathParentType }}/{parent_name}/tcp_response_rules/{index}: + get: + summary: Return one TCP Response Rule + description: Returns one TCP Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: getTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: index + in: path + description: TCP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new TCP Response Rule + description: Adds a new TCP Response Rule of the specified type in the specified {{ .ParentType }}. + operationId: createTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: index + in: path + description: TCP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + '201': + description: TCP Response Rule created + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + '409': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace a TCP Response Rule + description: Replaces a TCP Response Rule configuration by its index in the specified {{ .ParentType }}. + operationId: replaceTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: index + in: path + description: TCP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + '200': + description: TCP Response Rule replaced + content: + application/json: + schema: + $ref: '#/components/schemas/tcp_response_rule' + '400': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a TCP Response Rule + description: Deletes a TCP Response Rule configuration by its index from the specified {{ .ParentType }}. + operationId: deleteTCPResponseRule{{ .ParentType }} + tags: + - TCPResponseRule + parameters: + - name: index + in: path + description: TCP Response Rule Index + required: true + schema: + type: integer + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: TCP Response Rule deleted + '404': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../../models/common/responses/models.yaml#/components/responses/DefaultError' +{{ end }} diff --git a/specification/paths/configuration/traces/handlers.conf.yaml b/specification/paths/configuration/traces/handlers.conf.yaml new file mode 100644 index 00000000..a465046a --- /dev/null +++ b/specification/paths/configuration/traces/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: traces +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/traces/traces.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/traces/oapi.yaml b/specification/paths/configuration/traces/oapi.yaml new file mode 100644 index 00000000..ba0858ac --- /dev/null +++ b/specification/paths/configuration/traces/oapi.yaml @@ -0,0 +1,322 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Traces + description: An API for managing HAProxy Traces configuration. +servers: + - url: /v3 +components: + schemas: + traces: + type: object + x-go-type: models.Traces + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + trace_entry: + type: object + x-go-type: models.TraceEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/traces: + get: + summary: Return the traces configuration + description: Return the traces section contents. + operationId: getTraces + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a traces configuration + description: Create the traces section. + operationId: createTraces + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + '201': + description: Traces configuration created + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Replace the traces configuration + description: Replace the traces section contents + operationId: replaceTraces + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + '200': + description: Traces configuration replaced + content: + application/json: + schema: + $ref: '#/components/schemas/traces' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete the traces configuration + description: Delete the whole traces section. + operationId: deleteTraces + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Traces configuration deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/configuration/traces/entries: + post: + summary: Add a new trace entry + description: Adds a new trace entry into the traces section. The traces section will be created if needed. + operationId: createTraceEntry + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + '201': + description: Trace entry created + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a trace entry + description: Deletes a trace entry from the traces section. + operationId: deleteTraceEntry + tags: + - Traces + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/trace_entry' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Trace entry deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data diff --git a/specification/paths/configuration/userlist/handlers.conf.yaml b/specification/paths/configuration/userlist/handlers.conf.yaml new file mode 100644 index 00000000..9c48940b --- /dev/null +++ b/specification/paths/configuration/userlist/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: userlist +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/userlist/userlist.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/userlist/oapi.yaml b/specification/paths/configuration/userlist/oapi.yaml new file mode 100644 index 00000000..3b22281c --- /dev/null +++ b/specification/paths/configuration/userlist/oapi.yaml @@ -0,0 +1,484 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Userlist + description: An API for managing HAProxy userlist and user configurations. +servers: + - url: /v3 +components: + schemas: + userlist: + type: object + x-go-type: models.Userlist + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + userlists: + type: array + items: + $ref: '#/components/schemas/userlist' + x-go-type: models.Userlists + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + user: + type: object + x-go-type: models.User + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + users: + type: array + items: + $ref: '#/components/schemas/user' + x-go-type: models.Users + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/configuration/userlists: + get: + summary: Return an array of userlists + description: Returns an array of all configured userlists. + operationId: getUserlists + tags: + - Userlist + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/userlists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a userlist + description: Adds a new userlist to the configuration file. + operationId: createUserlist + tags: + - Userlist + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + '201': + description: Userlist created + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/userlists/{name}: + get: + summary: Return a userlist + description: Returns one userlist configuration by its name. + operationId: getUserlist + tags: + - Userlist + parameters: + - name: name + in: path + description: Userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: full_section + in: query + description: Indicates if the action affects the specified child resources as well + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/userlist' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete a userlist + description: Deletes a userlist from the configuration by its name. + operationId: deleteUserlist + tags: + - Userlist + parameters: + - name: name + in: path + description: Userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Userlist deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + + /services/haproxy/configuration/users: + get: + summary: Return an array of users + description: Returns an array of all users belonging to the specified userlist. + operationId: getUsers + tags: + - User + parameters: + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/users' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a user + description: Adds a new user to the specified userlist. + operationId: createUser + tags: + - User + parameters: + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/user' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/user' + '201': + description: User created + content: + application/json: + schema: + $ref: '#/components/schemas/user' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + + /services/haproxy/configuration/users/{username}: + get: + summary: Return a user + description: Returns one user from the specified userlist by username. + operationId: getUser + tags: + - User + parameters: + - name: username + in: path + description: User username + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/user' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a user + description: Replaces a user in the specified userlist by username. + operationId: replaceUser + tags: + - User + parameters: + - name: username + in: path + description: User username + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/user' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/user' + '200': + description: User replaced + content: + application/json: + schema: + $ref: '#/components/schemas/user' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a user + description: Deletes a user from the specified userlist by username. + operationId: deleteUser + tags: + - User + parameters: + - name: username + in: path + description: User username + required: true + schema: + type: string + - name: userlist + in: query + description: Parent userlist name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: User deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/configuration/version/handlers.conf.yaml b/specification/paths/configuration/version/handlers.conf.yaml new file mode 100644 index 00000000..36f21a51 --- /dev/null +++ b/specification/paths/configuration/version/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: version +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/configuration/version/version.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/configuration/version/oapi.yaml b/specification/paths/configuration/version/oapi.yaml new file mode 100644 index 00000000..bc018053 --- /dev/null +++ b/specification/paths/configuration/version/oapi.yaml @@ -0,0 +1,37 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Configuration Version + description: An API for getting the HAProxy configuration version. +servers: + - url: /v3 +paths: + /services/haproxy/configuration/version: + get: + summary: Return HAProxy configuration version + description: Returns the current HAProxy configuration file version. + operationId: getConfigurationVersion + tags: + - Configuration + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + type: integer + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/cluster/handlers.conf.yaml b/specification/paths/dataplane/cluster/handlers.conf.yaml new file mode 100644 index 00000000..aaca92fe --- /dev/null +++ b/specification/paths/dataplane/cluster/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: cluster +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/cluster/cluster.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/cluster/oapi.yaml b/specification/paths/dataplane/cluster/oapi.yaml new file mode 100644 index 00000000..a0198c87 --- /dev/null +++ b/specification/paths/dataplane/cluster/oapi.yaml @@ -0,0 +1,151 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Cluster +servers: + - url: /v3 +components: + schemas: + cluster_settings: + type: object + x-go-type: models.ClusterSettings + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /cluster: + get: + summary: Return cluster data + description: Returns cluster data + operationId: getCluster + tags: + - Cluster + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Post cluster settings + description: Post cluster settings + operationId: postCluster + tags: + - Cluster + parameters: + - name: configuration + in: query + description: In case of moving to single mode do we keep or clean configuration + required: false + schema: + type: string + enum: [keep] + - name: advertised_address + in: query + description: Force the advertised address when joining a cluster + required: false + schema: + type: string + - name: advertised_port + in: query + description: Force the advertised port when joining a cluster + required: false + schema: + type: integer + minimum: 1 + maximum: 65535 + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + responses: + '200': + description: Cluster settings changed + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Edit cluster settings + description: Edit cluster settings + operationId: editCluster + tags: + - Cluster + parameters: + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + responses: + '200': + description: Cluster settings changed + content: + application/json: + schema: + $ref: '#/components/schemas/cluster_settings' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete cluster settings + description: Delete cluster settings and move the node back to single mode + operationId: deleteCluster + tags: + - Cluster + parameters: + - name: configuration + in: query + description: In case of moving to single mode do we keep or clean configuration + required: false + schema: + type: string + enum: [keep] + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + responses: + '204': + description: Cluster settings deleted and node moved to single mode + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /cluster/certificate: + post: + summary: Initiates a certificate refresh + description: Initiates a certificate refresh + operationId: initiateCertificateRefresh + tags: + - Cluster + responses: + '200': + description: refresh activated + '403': + description: refresh not possible + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/discovery/handlers.conf.yaml b/specification/paths/dataplane/discovery/handlers.conf.yaml new file mode 100644 index 00000000..4f5b691c --- /dev/null +++ b/specification/paths/dataplane/discovery/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: discovery +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/discovery/discovery.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/discovery/oapi.yaml b/specification/paths/dataplane/discovery/oapi.yaml new file mode 100644 index 00000000..5ff32951 --- /dev/null +++ b/specification/paths/dataplane/discovery/oapi.yaml @@ -0,0 +1,143 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Discovery +servers: + - url: /v3 +components: + schemas: + endpoints: + type: array + items: + type: object + x-go-type: models.Endpoints + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /: + get: + summary: Return list of root endpoints + description: Returns a list of root endpoints. + operationId: getAPIEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services: + get: + summary: Return list of service endpoints + description: Returns a list of API managed services endpoints. + operationId: getServicesEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy: + get: + summary: Return list of HAProxy related endpoints + description: Returns a list of HAProxy related endpoints. + operationId: getHaproxyEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/stats: + get: + summary: Return list of HAProxy stats endpoints + description: Returns a list of HAProxy stats endpoints. + operationId: getStatsEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/configuration: + get: + summary: Return list of HAProxy advanced configuration endpoints + description: Returns a list of endpoints to be used for advanced configuration of HAProxy objects. + operationId: getConfigurationEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime: + get: + summary: Return list of HAProxy advanced runtime endpoints + description: Returns a list of endpoints to be used for advanced runtime settings of HAProxy objects. + operationId: getRuntimeEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/storage: + get: + summary: Return list of HAProxy storage endpoints + description: Returns a list of endpoints that use HAProxy storage for persistency, e.g. maps, ssl certificates... + operationId: getStorageEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/spoe: + get: + summary: Return list of HAProxy SPOE endpoints + description: Returns a list of endpoints to be used for SPOE settings of HAProxy. + operationId: getSpoeEndpoints + tags: + - Discovery + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/endpoints' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/health/handlers.conf.yaml b/specification/paths/dataplane/health/handlers.conf.yaml new file mode 100644 index 00000000..d270a3d4 --- /dev/null +++ b/specification/paths/dataplane/health/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: health +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/health/health.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/health/oapi.yaml b/specification/paths/dataplane/health/oapi.yaml new file mode 100644 index 00000000..dd4c1e17 --- /dev/null +++ b/specification/paths/dataplane/health/oapi.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Health +servers: + - url: /v3 +components: + schemas: + health: + type: object + x-go-type: models.Health + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /health: + get: + summary: Return managed services health + description: Return managed services health + operationId: getHealth + tags: + - Health + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/health' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/info/handlers.conf.yaml b/specification/paths/dataplane/info/handlers.conf.yaml new file mode 100644 index 00000000..4638f982 --- /dev/null +++ b/specification/paths/dataplane/info/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: info +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/info/info.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/info/oapi.yaml b/specification/paths/dataplane/info/oapi.yaml new file mode 100644 index 00000000..079acc16 --- /dev/null +++ b/specification/paths/dataplane/info/oapi.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Info +servers: + - url: /v3 +components: + schemas: + info: + type: object + x-go-type: models.Info + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /info: + get: + summary: Return API, hardware and OS information + description: Return API, hardware and OS information + operationId: getInfo + tags: + - Information + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/info' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/reloads/handlers.conf.yaml b/specification/paths/dataplane/reloads/handlers.conf.yaml new file mode 100644 index 00000000..73a85031 --- /dev/null +++ b/specification/paths/dataplane/reloads/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: reloads +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/reloads/reloads.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/reloads/oapi.yaml b/specification/paths/dataplane/reloads/oapi.yaml new file mode 100644 index 00000000..6bb25b41 --- /dev/null +++ b/specification/paths/dataplane/reloads/oapi.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Reloads +servers: + - url: /v3 +components: + schemas: + reload: + type: object + x-go-type: models.Reload + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + reloads: + type: array + items: + $ref: '#/components/schemas/reload' + x-go-type: models.Reloads + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/reloads: + get: + summary: Return list of HAProxy Reloads. + description: Returns a list of HAProxy reloads. + operationId: getReloads + tags: + - Reloads + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/reloads' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/reloads/{id}: + get: + summary: Return one HAProxy reload status + description: Returns one HAProxy reload status. + operationId: getReload + tags: + - Reloads + parameters: + - name: id + in: path + description: Reload id + required: true + schema: + type: string + pattern: '^\d{4}-\d{2}-\d{2}-\d+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/reload' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/sites/handlers.conf.yaml b/specification/paths/dataplane/sites/handlers.conf.yaml new file mode 100644 index 00000000..549a3729 --- /dev/null +++ b/specification/paths/dataplane/sites/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: sites +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/sites/sites.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/sites/oapi.yaml b/specification/paths/dataplane/sites/oapi.yaml new file mode 100644 index 00000000..17fc0ef9 --- /dev/null +++ b/specification/paths/dataplane/sites/oapi.yaml @@ -0,0 +1,250 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Sites +servers: + - url: /v3 +components: + schemas: + site: + type: object + x-go-type: models.Site + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + sites: + type: array + items: + $ref: '#/components/schemas/site' + x-go-type: models.Sites + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/sites: + get: + summary: Return an array of sites + description: Returns an array of all configured sites. + operationId: getSites + tags: + - Sites + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/sites' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a site + description: Adds a new site to the configuration file. + operationId: createSite + tags: + - Sites + parameters: + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/site' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/site' + '201': + description: Site created + content: + application/json: + schema: + $ref: '#/components/schemas/site' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/sites/{name}: + get: + summary: Return a site + description: Returns one site configuration by it's name. + operationId: getSite + tags: + - Sites + parameters: + - name: name + in: path + description: Site frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/site' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a site + description: Replaces a site configuration by it's name. + operationId: replaceSite + tags: + - Sites + parameters: + - name: name + in: path + description: Site frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/site' + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/site' + '200': + description: Site replaced + content: + application/json: + schema: + $ref: '#/components/schemas/site' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a site + description: Deletes a site from the configuration by it's name. + operationId: deleteSite + tags: + - Sites + parameters: + - name: name + in: path + description: Site frontend name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified, transaction has its own version. + required: false + schema: + type: integer + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Site deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/specification/handlers.conf.yaml b/specification/paths/dataplane/specification/handlers.conf.yaml new file mode 100644 index 00000000..e93049f2 --- /dev/null +++ b/specification/paths/dataplane/specification/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: specification +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/specification/specification.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/specification/oapi.yaml b/specification/paths/dataplane/specification/oapi.yaml new file mode 100644 index 00000000..5ed5062d --- /dev/null +++ b/specification/paths/dataplane/specification/oapi.yaml @@ -0,0 +1,38 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Specification +servers: + - url: /v3 +paths: + /specification: + get: + summary: Data Plane API Specification + description: Return Data Plane API OpenAPI specification + operationId: getSpecification + tags: + - Specification + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /specification_openapiv3: + get: + summary: Data Plane API v3 Specification + description: Return Data Plane API OpenAPI v3 specification + operationId: getOpenapiv3Specification + tags: + - SpecificationOpenapiv3 + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/stats/handlers.conf.yaml b/specification/paths/dataplane/stats/handlers.conf.yaml new file mode 100644 index 00000000..2b3677c3 --- /dev/null +++ b/specification/paths/dataplane/stats/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: stats +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/stats/stats.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/stats/oapi.yaml b/specification/paths/dataplane/stats/oapi.yaml new file mode 100644 index 00000000..a9b2d6e0 --- /dev/null +++ b/specification/paths/dataplane/stats/oapi.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Stats +servers: + - url: /v3 +components: + schemas: + native_stats: + type: object + x-go-type: models.NativeStats + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/stats/native: + get: + summary: Gets stats + description: Getting stats from the HAProxy. + operationId: getStats + tags: + - Stats + parameters: + - name: type + in: query + description: Object type to get stats for (one of frontend, backend, server) + required: false + schema: + type: string + enum: [frontend, backend, server] + - name: name + in: query + description: Object name to get stats for + required: false + schema: + type: string + - name: parent + in: query + description: Object parent name to get stats for, in case the object is a server + required: false + schema: + type: string + x-dependency: + query.type: server + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/native_stats' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/native_stats' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/dataplane/transactions/handlers.conf.yaml b/specification/paths/dataplane/transactions/handlers.conf.yaml new file mode 100644 index 00000000..60d833a0 --- /dev/null +++ b/specification/paths/dataplane/transactions/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: transactions +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/dataplane/transactions/transactions.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/dataplane/transactions/oapi.yaml b/specification/paths/dataplane/transactions/oapi.yaml new file mode 100644 index 00000000..0e3a1d45 --- /dev/null +++ b/specification/paths/dataplane/transactions/oapi.yaml @@ -0,0 +1,187 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Transactions +servers: + - url: /v3 +components: + schemas: + transaction: + type: object + x-go-type: models.Transaction + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + transactions: + type: array + items: + $ref: '#/components/schemas/transaction' + x-go-type: models.Transactions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/transactions: + get: + summary: Return list of HAProxy configuration transactions. + description: Returns a list of HAProxy configuration transactions. Transactions can be filtered by their status. + operationId: getTransactions + tags: + - Transactions + parameters: + - name: status + in: query + description: Filter by transaction status + required: false + schema: + type: string + enum: [failed, in_progress] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/transactions' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Start a new transaction + description: Starts a new transaction and returns it's id + operationId: startTransaction + tags: + - Transactions + parameters: + - name: version + in: query + description: Configuration version on which to work on + required: true + schema: + type: integer + responses: + '201': + description: Transaction started + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '429': + description: Too many open transactions + content: + application/json: + schema: + type: object + properties: + code: + type: integer + message: + type: string + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/transactions/{id}: + get: + summary: Return one HAProxy configuration transactions + description: Returns one HAProxy configuration transactions. + operationId: getTransaction + tags: + - Transactions + parameters: + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Commit transaction + description: Commit transaction, execute all operations in transaction and return msg + operationId: commitTransaction + tags: + - Transactions + parameters: + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '200': + description: Transaction successfully committed + headers: + Configuration-Version: + description: Configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + '406': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotAcceptable' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete a transaction + description: Deletes a transaction. + operationId: deleteTransaction + tags: + - Transactions + parameters: + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + responses: + '204': + description: Transaction deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/acl_entries/handlers.conf.yaml b/specification/paths/runtime/acl_entries/handlers.conf.yaml new file mode 100644 index 00000000..a3e99570 --- /dev/null +++ b/specification/paths/runtime/acl_entries/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: acl_entries +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/acl_entries/acl_entries.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/acl_entries/oapi.yaml b/specification/paths/runtime/acl_entries/oapi.yaml new file mode 100644 index 00000000..50c8b3e5 --- /dev/null +++ b/specification/paths/runtime/acl_entries/oapi.yaml @@ -0,0 +1,179 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime ACL Entries +servers: + - url: /v3 +components: + schemas: + acl_file_entry: + type: object + x-go-type: models.ACLFileEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_files_entries: + type: array + items: + $ref: '#/components/schemas/acl_file_entry' + x-go-type: models.ACLFilesEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/acls/{parent_name}/entries: + get: + summary: Return ACL entries + description: Returns an ACL runtime setting using the runtime socket. + operationId: getAllRuntimeAclFileEntries + tags: + - ACL Runtime + parameters: + - name: parent_name + in: path + description: ACL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add entry to an ACL file + description: Adds an entry into the ACL file using the runtime socket. + operationId: createRuntimeAclFileEntry + tags: + - ACL Runtime + parameters: + - name: parent_name + in: path + description: ACL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + responses: + '201': + description: ACL entry created + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + put: + summary: Add a new ACL payload + description: Adds a new ACL payload. + operationId: addPayloadRuntimeACL + tags: + - ACL Runtime + parameters: + - name: parent_name + in: path + description: ACL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + responses: + '201': + description: ACL payload added + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files_entries' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/runtime/acls/{parent_name}/entries/{id}: + get: + summary: Return an ACL entry + description: Returns the ACL entry by its ID using the runtime socket. + operationId: getRuntimeAclFileEntry + tags: + - ACL Runtime + parameters: + - name: parent_name + in: path + description: ACL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: File entry ID + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file_entry' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete an ACL entry + description: Deletes the entry from the ACL by its value using the runtime socket. + operationId: deleteRuntimeAclFileEntry + tags: + - ACL Runtime + parameters: + - name: parent_name + in: path + description: ACL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: File entry ID + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '204': + description: Successful operation + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/acl_files/handlers.conf.yaml b/specification/paths/runtime/acl_files/handlers.conf.yaml new file mode 100644 index 00000000..53776d26 --- /dev/null +++ b/specification/paths/runtime/acl_files/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: acl_files +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/acl_files/acl_files.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/acl_files/oapi.yaml b/specification/paths/runtime/acl_files/oapi.yaml new file mode 100644 index 00000000..6b1f263c --- /dev/null +++ b/specification/paths/runtime/acl_files/oapi.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime ACL Files +servers: + - url: /v3 +components: + schemas: + acl_file: + type: object + x-go-type: models.ACLFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + acl_files: + type: array + items: + $ref: '#/components/schemas/acl_file' + x-go-type: models.ACLFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/acls: + get: + summary: Return an array of all ACL files + description: Returns all ACL files using the runtime socket. + operationId: getAllRuntimeAclFiles + tags: + - ACL Runtime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/acl_files' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime/acls/{id}: + get: + summary: Return an ACL file + description: Returns an ACL file by id using the runtime socket. + operationId: getRuntimeAclFile + tags: + - ACL Runtime + parameters: + - name: id + in: path + description: ACL file entry ID + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/acl_file' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/acme/handlers.conf.yaml b/specification/paths/runtime/acme/handlers.conf.yaml new file mode 100644 index 00000000..9774706b --- /dev/null +++ b/specification/paths/runtime/acme/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: acme +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/acme/acme.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/acme/oapi.yaml b/specification/paths/runtime/acme/oapi.yaml new file mode 100644 index 00000000..1c63f01c --- /dev/null +++ b/specification/paths/runtime/acme/oapi.yaml @@ -0,0 +1,54 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime ACME +servers: + - url: /v3 +components: + schemas: + acme_status: + type: array + items: + type: object + x-go-type: models.AcmeStatus + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/acme: + get: + summary: ACME Status + description: Returns the status of each managed ACME certificate. + operationId: getAcmeStatus + tags: + - AcmeRuntime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/acme_status' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Renew ACME certificate + description: Force renewal of an ACME certificate. + operationId: renewAcmeCertificate + tags: + - AcmeRuntime + parameters: + - name: certificate + in: query + description: Certificate file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Operation started + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/map_entries/handlers.conf.yaml b/specification/paths/runtime/map_entries/handlers.conf.yaml new file mode 100644 index 00000000..e7dcecff --- /dev/null +++ b/specification/paths/runtime/map_entries/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: map_entries +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/map_entries/map_entries.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/map_entries/oapi.yaml b/specification/paths/runtime/map_entries/oapi.yaml new file mode 100644 index 00000000..b10dde61 --- /dev/null +++ b/specification/paths/runtime/map_entries/oapi.yaml @@ -0,0 +1,209 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Map Entries +servers: + - url: /v3 +components: + schemas: + map_entry: + type: object + x-go-type: models.MapEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map_entries: + type: array + items: + $ref: '#/components/schemas/map_entry' + x-go-type: models.MapEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/maps/{parent_name}/entries: + get: + summary: Return one map runtime entries + description: Returns an array of all entries in a given runtime map file. + operationId: showRuntimeMap + tags: + - Maps + parameters: + - name: parent_name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Adds an entry into the map file + description: Adds an entry into the map file. + operationId: addMapEntry + tags: + - Maps + parameters: + - name: parent_name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: force_sync + in: query + description: If true, immediately syncs changes to disk + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + responses: + '201': + description: Map entry created + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/runtime/maps/{parent_name}/entries/{id}: + get: + summary: Return one map runtime setting + description: Returns one map runtime setting by it's id. + operationId: getRuntimeMapEntry + tags: + - Maps + parameters: + - name: parent_name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Map id + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace the value corresponding to each id in a map + description: Replaces the value corresponding to each id in a map. + operationId: replaceRuntimeMapEntry + tags: + - Maps + parameters: + - name: parent_name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Map id + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: force_sync + in: query + description: If true, immediately syncs changes to disk + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - value + properties: + value: + type: string + description: Map value + responses: + '200': + description: Map value replaced + content: + application/json: + schema: + $ref: '#/components/schemas/map_entry' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Deletes all the map entries from the map by its id + description: Delete all the map entries from the map by its id. + operationId: deleteRuntimeMapEntry + tags: + - Maps + parameters: + - name: parent_name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Map id + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: force_sync + in: query + description: If true, immediately syncs changes to disk + required: false + schema: + type: boolean + default: false + responses: + '204': + description: Map key/value deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/maps/handlers.conf.yaml b/specification/paths/runtime/maps/handlers.conf.yaml new file mode 100644 index 00000000..adc842b7 --- /dev/null +++ b/specification/paths/runtime/maps/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: maps +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/maps/maps.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/maps/oapi.yaml b/specification/paths/runtime/maps/oapi.yaml new file mode 100644 index 00000000..aa4b5adf --- /dev/null +++ b/specification/paths/runtime/maps/oapi.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Maps +servers: + - url: /v3 +components: + schemas: + map: + type: object + x-go-type: models.Map + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + maps: + type: array + items: + $ref: '#/components/schemas/map' + x-go-type: models.Maps + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map_entry: + type: object + x-go-type: models.MapEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + map_entries: + type: array + items: + $ref: '#/components/schemas/map_entry' + x-go-type: models.MapEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/maps: + get: + summary: Return runtime map files + description: Returns runtime map files. + operationId: getAllRuntimeMapFiles + tags: + - Maps + parameters: + - name: include_unmanaged + in: query + description: If true, also show unmanaged map files loaded in haproxy + required: false + schema: + type: boolean + default: false + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/maps' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime/maps/{name}: + get: + summary: Return one runtime map file + description: Returns one runtime map file. + operationId: getOneRuntimeMap + tags: + - Maps + parameters: + - name: name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/map' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Add a new map payload + description: Adds a new map payload. + operationId: addPayloadRuntimeMap + tags: + - Maps + parameters: + - name: name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: force_sync + in: query + description: If true, immediately syncs changes to disk + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + responses: + '201': + description: Map payload added + content: + application/json: + schema: + $ref: '#/components/schemas/map_entries' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Remove all map entries from the map file + description: Remove all map entries from the map file. + operationId: clearRuntimeMap + tags: + - Maps + parameters: + - name: name + in: path + description: Map file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: forceDelete + in: query + description: If true, deletes file from disk + required: false + schema: + type: boolean + - name: force_sync + in: query + description: If true, immediately syncs changes to disk + required: false + schema: + type: boolean + default: false + responses: + '204': + description: All map entries deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/process_info/handlers.conf.yaml b/specification/paths/runtime/process_info/handlers.conf.yaml new file mode 100644 index 00000000..86188ef4 --- /dev/null +++ b/specification/paths/runtime/process_info/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: process_info +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/process_info/process_info.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/process_info/oapi.yaml b/specification/paths/runtime/process_info/oapi.yaml new file mode 100644 index 00000000..d71ddfe1 --- /dev/null +++ b/specification/paths/runtime/process_info/oapi.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Process Info +servers: + - url: /v3 +components: + schemas: + process_info: + type: object + x-go-type: models.ProcessInfo + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/info: + get: + summary: Return HAProxy process information + description: Return HAProxy process information + operationId: getHaproxyProcessInfo + tags: + - Information + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/process_info' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/servers/handlers.conf.yaml b/specification/paths/runtime/servers/handlers.conf.yaml new file mode 100644 index 00000000..e3180262 --- /dev/null +++ b/specification/paths/runtime/servers/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: servers +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/servers/servers.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/servers/oapi.yaml b/specification/paths/runtime/servers/oapi.yaml new file mode 100644 index 00000000..4268dd35 --- /dev/null +++ b/specification/paths/runtime/servers/oapi.yaml @@ -0,0 +1,189 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Servers +servers: + - url: /v3 +components: + schemas: + runtime_server: + type: object + x-go-type: models.RuntimeServer + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + runtime_servers: + type: array + items: + $ref: '#/components/schemas/runtime_server' + x-go-type: models.RuntimeServers + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + runtime_add_server: + type: object + x-go-type: models.RuntimeAddServer + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/backends/{parent_name}/servers: + get: + summary: Return an array of runtime servers' settings + description: Returns an array of all servers' runtime settings. + operationId: getAllRuntimeServer + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_servers' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Adds a new server to a backend + description: Adds a new server to the specified backend + operationId: addRuntimeServer + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_add_server' + responses: + '201': + description: Server added + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_add_server' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/runtime/backends/{parent_name}/servers/{name}: + get: + summary: Return one server runtime settings + description: Returns one server runtime settings by it's name in the specified backend. + operationId: getRuntimeServer + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: name + in: path + description: Server name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace server transient settings + description: Replaces a server transient settings by it's name in the specified backend. + operationId: replaceRuntimeServer + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: name + in: path + description: Server name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + responses: + '200': + description: Server transient settings replaced + content: + application/json: + schema: + $ref: '#/components/schemas/runtime_server' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Deletes a server from a backend + description: Deletes a server from the specified backend + operationId: deleteRuntimeServer + tags: + - Server + parameters: + - name: parent_name + in: path + description: Parent name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: name + in: path + description: Server name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '204': + description: Server deleted + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/ssl_ca_files/handlers.conf.yaml b/specification/paths/runtime/ssl_ca_files/handlers.conf.yaml new file mode 100644 index 00000000..eb64da35 --- /dev/null +++ b/specification/paths/runtime/ssl_ca_files/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_ca_files +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/ssl_ca_files/ssl_ca_files.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/ssl_ca_files/oapi.yaml b/specification/paths/runtime/ssl_ca_files/oapi.yaml new file mode 100644 index 00000000..d4d54832 --- /dev/null +++ b/specification/paths/runtime/ssl_ca_files/oapi.yaml @@ -0,0 +1,230 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime SSL CA Files +servers: + - url: /v3 +components: + schemas: + ssl_ca_file: + type: object + x-go-type: models.SslCaFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_ca_files: + type: array + items: + $ref: '#/components/schemas/ssl_ca_file' + x-go-type: models.SslCaFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_certificate: + type: object + x-go-type: models.SslCertificate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/ssl_ca_files: + get: + summary: Return an array of all SSL CA files + description: Returns all SSL CA files using the runtime socket. + operationId: getAllCaFiles + tags: + - SSLRuntime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_ca_files' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Creates a new SSL CA file + description: Creates a new SSL CA file using the runtime socket. + operationId: createCaFile + tags: + - SSLRuntime + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + description: CA certificate file + responses: + '201': + description: SSL CA file created + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_ca_files/{name}: + get: + summary: Return an SSL CA file + description: Returns an SSL CA file by name using the runtime socket. + operationId: getCaFile + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL CA file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_ca_file' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Update the contents of a CA file + description: Replace the contents of a CA file using the runtime socket. + operationId: setCaFile + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL CA file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + responses: + '200': + description: SSL CA payload added + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + delete: + summary: Deletes a CA file + description: Deletes a CA file + operationId: deleteCaFile + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL CA file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '204': + description: SSL CA deleted + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime/ssl_ca_files/{name}/entries: + post: + summary: Add a certificate to a CA file + description: Adds an entry to an existing CA file using the runtime socket. + operationId: addCaEntry + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL CA file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + description: Payload of the cert entry + responses: + '201': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_ca_files/{name}/entries/{index}: + get: + summary: Return an SSL CA file cert entry + description: Returns an SSL CA file cert entry. + operationId: getCaEntry + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL CA file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: index + in: path + description: SSL CA file index + required: true + schema: + type: integer + minimum: 0 + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/ssl_certs/handlers.conf.yaml b/specification/paths/runtime/ssl_certs/handlers.conf.yaml new file mode 100644 index 00000000..0c175b7a --- /dev/null +++ b/specification/paths/runtime/ssl_certs/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_certs +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/ssl_certs/ssl_certs.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/ssl_certs/oapi.yaml b/specification/paths/runtime/ssl_certs/oapi.yaml new file mode 100644 index 00000000..65be724d --- /dev/null +++ b/specification/paths/runtime/ssl_certs/oapi.yaml @@ -0,0 +1,148 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime SSL Certificates +servers: + - url: /v3 +components: + schemas: + ssl_certificate: + type: object + x-go-type: models.SslCertificate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_certificates: + type: array + items: + $ref: '#/components/schemas/ssl_certificate' + x-go-type: models.SslCertificates + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/ssl_certs: + get: + summary: Return a list of SSL certificate files + description: Returns certificate files descriptions from runtime. + operationId: getAllCerts + tags: + - SSLRuntime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificates' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Create a new SSL certificate file + description: Creates a new SSL certificate file using the runtime socket. + operationId: createCert + tags: + - SSLRuntime + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + description: Certificate file + responses: + '201': + description: Certificate created + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_certs/{name}: + get: + summary: Return one structured certificate + description: Returns one structured certificate using the runtime socket. + operationId: getCert + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace the contents of a certificate + description: Sets a certificate payload using the runtime socket. + operationId: replaceCert + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + responses: + '200': + description: File updated + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + delete: + summary: Delete a certificate + description: Deletes a certificate using the runtime socket. + operationId: deleteCert + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '204': + description: File deleted + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/ssl_crl_files/handlers.conf.yaml b/specification/paths/runtime/ssl_crl_files/handlers.conf.yaml new file mode 100644 index 00000000..c5f52e6c --- /dev/null +++ b/specification/paths/runtime/ssl_crl_files/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_crl_files +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/ssl_crl_files/ssl_crl_files.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/ssl_crl_files/oapi.yaml b/specification/paths/runtime/ssl_crl_files/oapi.yaml new file mode 100644 index 00000000..9c219729 --- /dev/null +++ b/specification/paths/runtime/ssl_crl_files/oapi.yaml @@ -0,0 +1,163 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime SSL CRL Files +servers: + - url: /v3 +components: + schemas: + ssl_crl_entries: + type: array + items: + type: object + x-go-type: models.SslCrlEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crls: + type: array + items: + type: object + x-go-type: models.SslCrls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/ssl_crl_files: + get: + summary: Return an array of all the CRL files + description: Returns all the certificate revocation list files using the runtime socket. + operationId: getAllCrl + tags: + - SSLRuntime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crls' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Create a new CRL file + description: Creates a new CRL file with its contents using the runtime socket. + operationId: createCrl + tags: + - SSLRuntime + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + description: CRL file + responses: + '201': + description: CRL file created + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/runtime/ssl_crl_files/{name}: + get: + summary: Get the contents of a CRL file + description: Returns one or all entries in a CRL file using the runtime socket. + operationId: getCrl + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: CRL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: index + in: query + description: Entry index to return. Starts at 1. If not provided, all entries are returned. + required: false + schema: + type: integer + minimum: 1 + nullable: true + # Keep the pointer so the handler can distinguish an omitted index from 0. + x-go-type-skip-optional-pointer: false + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crl_entries' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace the contents of a CRL file + description: Replaces the contents of a CRL file using the runtime socket. + operationId: replaceCrl + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: CRL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + required: + - file_upload + properties: + file_upload: + type: string + format: binary + description: CRL file contents + responses: + '200': + description: File modified + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + delete: + summary: Delete a CRL file + description: Deletes a CRL file using the runtime socket. + operationId: deleteCrl + tags: + - SSLRuntime + parameters: + - name: name + in: path + description: CRL file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '204': + description: File deleted + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/ssl_crt_lists/handlers.conf.yaml b/specification/paths/runtime/ssl_crt_lists/handlers.conf.yaml new file mode 100644 index 00000000..847df986 --- /dev/null +++ b/specification/paths/runtime/ssl_crt_lists/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_crt_lists +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/ssl_crt_lists/ssl_crt_lists.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/ssl_crt_lists/oapi.yaml b/specification/paths/runtime/ssl_crt_lists/oapi.yaml new file mode 100644 index 00000000..23f19a8b --- /dev/null +++ b/specification/paths/runtime/ssl_crt_lists/oapi.yaml @@ -0,0 +1,142 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime SSL CRT Lists +servers: + - url: /v3 +components: + schemas: + ssl_crt_list: + type: object + x-go-type: models.SslCrtList + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_lists: + type: array + items: + $ref: '#/components/schemas/ssl_crt_list' + x-go-type: models.SslCrtLists + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entry: + type: object + x-go-type: models.SslCrtListEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entries: + type: array + items: + $ref: '#/components/schemas/ssl_crt_list_entry' + x-go-type: models.SslCrtListEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/ssl_crt_lists: + get: + summary: Get the list of all crt-list files + description: Returns an array of crt-list file descriptions from runtime. + operationId: getAllCrtLists + tags: + - SSLRuntime + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_lists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime/ssl_crt_lists/entries: + get: + summary: Get all the entries inside a crt-list + description: Returns an array of entries present inside the given crt-list file. Their index can be used to delete them. + operationId: getAllCrtListEntries + tags: + - SSLRuntime + parameters: + - name: name + in: query + description: SSL crt-list filename + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entries' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add an entry into a crt-list + description: Appends an entry to the given crt-list using the runtime socket. + operationId: addCrtListEntry + tags: + - SSLRuntime + parameters: + - name: name + in: query + description: SSL crt-list filename + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + responses: + '201': + description: Successful operation + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete an entry from a crt-list + description: Deletes a single entry from the given crt-list using the runtime socket. + operationId: deleteCrtListEntry + tags: + - SSLRuntime + parameters: + - name: name + in: query + description: SSL crt list name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: cert_file + in: query + description: SSL cert entry name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: line_number + in: query + description: The line number where the entry is located, in case several entries share the same certificate. + required: false + schema: + type: integer + minimum: 1 + nullable: true + # Keep the pointer so the handler can distinguish an omitted line number from 0. + x-go-type-skip-optional-pointer: false + responses: + '204': + description: Successful operation + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/runtime/stick_table_entries/handlers.conf.yaml b/specification/paths/runtime/stick_table_entries/handlers.conf.yaml new file mode 100644 index 00000000..d70b7ee5 --- /dev/null +++ b/specification/paths/runtime/stick_table_entries/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: stick_table_entries +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/stick_table_entries/stick_table_entries.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/stick_table_entries/oapi.yaml b/specification/paths/runtime/stick_table_entries/oapi.yaml new file mode 100644 index 00000000..3c548636 --- /dev/null +++ b/specification/paths/runtime/stick_table_entries/oapi.yaml @@ -0,0 +1,107 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Stick Table Entries +servers: + - url: /v3 +components: + schemas: + stick_table_entry: + type: object + x-go-type: models.StickTableEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_table_entries: + type: array + items: + $ref: '#/components/schemas/stick_table_entry' + x-go-type: models.StickTableEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/stick_tables/{parent_name}/entries: + get: + summary: Return Stick Table Entries + description: Returns an array of all entries in a given stick tables. + operationId: getStickTableEntries + tags: + - StickTable + parameters: + - name: parent_name + in: path + description: Stick table name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: filter + in: query + description: A list of filters in format data. separated by comma + required: false + schema: + type: string + pattern: '^[^\r\n;#]+$' + - name: key + in: query + description: Key which we want the entries for + required: false + schema: + type: string + pattern: '^[^\r\n;#]+$' + - name: count + in: query + description: Max number of entries to be returned for pagination + required: false + schema: + type: integer + # Keep the pointer so the handler can distinguish an omitted count + # (return all entries from offset) from an explicit count=0 (empty page). + x-go-type-skip-optional-pointer: false + - name: offset + in: query + description: Offset which indicates how many items we skip in pagination + required: false + schema: + type: integer + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/stick_table_entries' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Set Entry to Stick Table + description: Create or update a stick-table entry in the table. + operationId: setStickTableEntries + tags: + - StickTable + parameters: + - name: parent_name + in: path + description: Stick table name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + requestBody: + content: + application/json: + schema: + type: object + required: + - key + - data_type + properties: + key: + type: string + pattern: '^[^\r\n;#]+$' + data_type: + $ref: '#/components/schemas/stick_table_entry' + responses: + '204': + description: Successful operation + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: stick_table_entry diff --git a/specification/paths/runtime/stick_tables/handlers.conf.yaml b/specification/paths/runtime/stick_tables/handlers.conf.yaml new file mode 100644 index 00000000..fb955bd5 --- /dev/null +++ b/specification/paths/runtime/stick_tables/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: stick_tables +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/runtime/stick_tables/stick_tables.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/runtime/stick_tables/oapi.yaml b/specification/paths/runtime/stick_tables/oapi.yaml new file mode 100644 index 00000000..84e62124 --- /dev/null +++ b/specification/paths/runtime/stick_tables/oapi.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Runtime Stick Tables +servers: + - url: /v3 +components: + schemas: + stick_table: + type: object + x-go-type: models.StickTable + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + stick_tables: + type: array + items: + $ref: '#/components/schemas/stick_table' + x-go-type: models.StickTables + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/runtime/stick_tables: + get: + summary: Return Stick Tables + description: Returns an array of all stick tables. + operationId: getStickTables + tags: + - StickTable + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/stick_tables' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/runtime/stick_tables/{name}: + get: + summary: Return Stick Table + description: Returns one stick table from runtime. + operationId: getStickTable + tags: + - StickTable + parameters: + - name: name + in: path + description: Stick table name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/stick_table' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/service_discovery/aws/handlers.conf.yaml b/specification/paths/service_discovery/aws/handlers.conf.yaml new file mode 100644 index 00000000..b41f257f --- /dev/null +++ b/specification/paths/service_discovery/aws/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: aws +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/service_discovery/aws/aws.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/service_discovery/aws/oapi.yaml b/specification/paths/service_discovery/aws/oapi.yaml new file mode 100644 index 00000000..95a8f30c --- /dev/null +++ b/specification/paths/service_discovery/aws/oapi.yaml @@ -0,0 +1,142 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Service Discovery AWS +servers: + - url: /v3 +components: + schemas: + awsRegion: + type: object + x-go-type: models.AwsRegion + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + awsRegions: + type: array + items: + $ref: '#/components/schemas/awsRegion' + x-go-type: models.AwsRegions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /service_discovery/aws: + get: + summary: Return an array of all configured AWS regions + description: Return all configured AWS regions. + operationId: getAWSRegions + tags: + - ServiceDiscovery + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegions' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new AWS region + description: |- + Add a new AWS region. + Credentials are not required in case Dataplane API is running in an EC2 instance with proper IAM role attached. + operationId: createAWSRegion + tags: + - ServiceDiscovery + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + responses: + '201': + description: Resource created + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /service_discovery/aws/{id}: + get: + summary: Return an AWS region + description: Return one AWS Region configuration by it's id. + operationId: getAWSRegion + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: AWS region id + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace an AWS region + description: Replace an AWS region configuration by its id. + operationId: replaceAWSRegion + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: AWS Region ID + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + responses: + '200': + description: Resource updated + content: + application/json: + schema: + $ref: '#/components/schemas/awsRegion' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete an AWS region + description: Delete an AWS region configuration by it's id. + operationId: deleteAWSRegion + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: AWS region ID + required: true + schema: + type: string + responses: + '204': + description: Resource deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/service_discovery/consul/handlers.conf.yaml b/specification/paths/service_discovery/consul/handlers.conf.yaml new file mode 100644 index 00000000..8c54396a --- /dev/null +++ b/specification/paths/service_discovery/consul/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: consul +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/service_discovery/consul/consul.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/service_discovery/consul/oapi.yaml b/specification/paths/service_discovery/consul/oapi.yaml new file mode 100644 index 00000000..d944034a --- /dev/null +++ b/specification/paths/service_discovery/consul/oapi.yaml @@ -0,0 +1,140 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Service Discovery Consul +servers: + - url: /v3 +components: + schemas: + consul: + type: object + x-go-type: models.Consul + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + consuls: + type: array + items: + $ref: '#/components/schemas/consul' + x-go-type: models.Consuls + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /service_discovery/consul: + get: + summary: Return an array of all configured Consul servers + description: Returns all configured Consul servers. + operationId: getConsuls + tags: + - ServiceDiscovery + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/consuls' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new Consul server + description: Adds a new Consul server. + operationId: createConsul + tags: + - ServiceDiscovery + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + responses: + '201': + description: Consul created + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /service_discovery/consul/{id}: + get: + summary: Return one Consul server + description: Returns one Consul server configuration by it's id. + operationId: getConsul + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: Consul server id + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a Consul server + description: Replaces a Consul server configuration by it's id. + operationId: replaceConsul + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: Consul Index + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + responses: + '200': + description: Consul server replaced + content: + application/json: + schema: + $ref: '#/components/schemas/consul' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a Consul server + description: Deletes a Consul server configuration by it's id. + operationId: deleteConsul + tags: + - ServiceDiscovery + parameters: + - name: id + in: path + description: Consul server Index + required: true + schema: + type: string + responses: + '204': + description: Consul server deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/agents/handlers.conf.yaml b/specification/paths/spoe/agents/handlers.conf.yaml new file mode 100644 index 00000000..98e0dc56 --- /dev/null +++ b/specification/paths/spoe/agents/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: agents +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/agents/agents.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/agents/oapi.yaml b/specification/paths/spoe/agents/oapi.yaml new file mode 100644 index 00000000..dfa1ee7d --- /dev/null +++ b/specification/paths/spoe/agents/oapi.yaml @@ -0,0 +1,265 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Agents +servers: + - url: /v3 +components: + schemas: + spoe_agent: + type: object + x-go-type: models.SpoeAgent + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_agents: + type: array + items: + $ref: '#/components/schemas/spoe_agent' + x-go-type: models.SpoeAgents + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents: + get: + summary: Return an array of spoe agents in one scope + description: Returns an array of all configured spoe agents in one scope. + operationId: getAllSpoeAgent + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agents' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new spoe agent to scope + description: Adds a new spoe agent to the spoe scope. + operationId: createSpoeAgent + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + responses: + '201': + description: Spoe agent created + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/agents/{name}: + get: + summary: Return a spoe agent + description: Returns one spoe agent configuration in one SPOE scope. + operationId: getSpoeAgent + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe agent name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a SPOE agent + description: Replaces a SPOE agent configuration in one SPOE scope. + operationId: replaceSpoeAgent + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe agent name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + responses: + '200': + description: Spoe agent replaced + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_agent' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a SPOE agent + description: Deletes a SPOE agent from the configuration in one SPOE scope. + operationId: deleteSpoeAgent + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe agent name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + responses: + '204': + description: Spoe agent deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/files/handlers.conf.yaml b/specification/paths/spoe/files/handlers.conf.yaml new file mode 100644 index 00000000..f870dba0 --- /dev/null +++ b/specification/paths/spoe/files/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: files +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/files/files.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/files/oapi.yaml b/specification/paths/spoe/files/oapi.yaml new file mode 100644 index 00000000..1da32478 --- /dev/null +++ b/specification/paths/spoe/files/oapi.yaml @@ -0,0 +1,119 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Files +servers: + - url: /v3 +components: + schemas: + spoe_files: + type: array + items: + type: string + x-go-type: models.SpoeFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files: + get: + summary: Return all available SPOE files + description: Returns all available SPOE files. + operationId: getAllSpoeFiles + tags: + - Spoe + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_files' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Creates SPOE file with its entries + description: Creates SPOE file with its entries. + operationId: createSpoe + tags: + - Spoe + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: The spoe file to upload + responses: + '201': + description: SPOE file created with its entries + content: + application/json: + schema: + type: string + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/spoe/spoe_files/{name}: + get: + summary: Return one SPOE file + description: Returns one SPOE file. + operationId: getOneSpoeFile + tags: + - Spoe + parameters: + - name: name + in: path + description: SPOE file name + required: true + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + type: object + properties: + data: + type: string + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete SPOE file + description: Deletes SPOE file. + operationId: deleteSpoeFile + tags: + - Spoe + parameters: + - name: name + in: path + description: SPOE file name + required: true + schema: + type: string + responses: + '204': + description: SPOE file deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/groups/handlers.conf.yaml b/specification/paths/spoe/groups/handlers.conf.yaml new file mode 100644 index 00000000..0891d5d8 --- /dev/null +++ b/specification/paths/spoe/groups/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: groups +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/groups/groups.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/groups/oapi.yaml b/specification/paths/spoe/groups/oapi.yaml new file mode 100644 index 00000000..3e06c7b5 --- /dev/null +++ b/specification/paths/spoe/groups/oapi.yaml @@ -0,0 +1,265 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Groups +servers: + - url: /v3 +components: + schemas: + spoe_group: + type: object + x-go-type: models.SpoeGroup + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_groups: + type: array + items: + $ref: '#/components/schemas/spoe_group' + x-go-type: models.SpoeGroups + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups: + get: + summary: Return an array of SPOE groups + description: Returns an array of all configured SPOE groups in one SPOE scope. + operationId: getAllSpoeGroup + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_groups' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new SPOE groups + description: Adds a new SPOE groups to the SPOE scope. + operationId: createSpoeGroup + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + responses: + '201': + description: Spoe groups created + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/groups/{name}: + get: + summary: Return a SPOE groups + description: Returns one SPOE groups configuration in one SPOE scope. + operationId: getSpoeGroup + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe group name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a SPOE groups + description: Replaces a SPOE groups configuration in one SPOE scope. + operationId: replaceSpoeGroup + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe group name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + responses: + '200': + description: Spoe groups replaced + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_group' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a SPOE groups + description: Deletes a SPOE groups from the one SPOE scope. + operationId: deleteSpoeGroup + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe group name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + responses: + '204': + description: Spoe group deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/messages/handlers.conf.yaml b/specification/paths/spoe/messages/handlers.conf.yaml new file mode 100644 index 00000000..22f3fcfb --- /dev/null +++ b/specification/paths/spoe/messages/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: messages +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/messages/messages.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/messages/oapi.yaml b/specification/paths/spoe/messages/oapi.yaml new file mode 100644 index 00000000..063af1c6 --- /dev/null +++ b/specification/paths/spoe/messages/oapi.yaml @@ -0,0 +1,265 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Messages +servers: + - url: /v3 +components: + schemas: + spoe_message: + type: object + x-go-type: models.SpoeMessage + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_messages: + type: array + items: + $ref: '#/components/schemas/spoe_message' + x-go-type: models.SpoeMessages + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages: + get: + summary: Return an array of spoe messages in one scope + description: Returns an array of all configured spoe messages in one scope. + operationId: getAllSpoeMessage + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_messages' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new spoe message to scope + description: Adds a new spoe message to the spoe scope. + operationId: createSpoeMessage + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + responses: + '201': + description: Spoe message created + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{scope_name}/messages/{name}: + get: + summary: Return a spoe message + description: Returns one spoe message configuration in SPOE scope. + operationId: getSpoeMessage + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe message name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a spoe message + description: Replaces a spoe message configuration in one SPOE scope. + operationId: replaceSpoeMessage + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe message name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + responses: + '200': + description: Spoe message replaced + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_message' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a spoe message + description: Deletes a spoe message from the SPOE scope. + operationId: deleteSpoeMessage + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: scope_name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: name + in: path + description: Spoe message name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + responses: + '204': + description: Spoe message deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/scopes/handlers.conf.yaml b/specification/paths/spoe/scopes/handlers.conf.yaml new file mode 100644 index 00000000..8fd98fde --- /dev/null +++ b/specification/paths/spoe/scopes/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: scopes +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/scopes/scopes.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/scopes/oapi.yaml b/specification/paths/spoe/scopes/oapi.yaml new file mode 100644 index 00000000..10c24892 --- /dev/null +++ b/specification/paths/spoe/scopes/oapi.yaml @@ -0,0 +1,183 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Scopes +servers: + - url: /v3 +components: + schemas: + spoe_scope: + type: string + x-go-type: models.SpoeScope + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_scopes: + type: array + items: + $ref: '#/components/schemas/spoe_scope' + x-go-type: models.SpoeScopes + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files/{parent_name}/scopes: + get: + summary: Return an array of spoe scopes + description: Returns an array of all configured spoe scopes. + operationId: getAllSpoeScope + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scopes' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Add a new spoe scope + description: Adds a new spoe scope. + operationId: createSpoeScope + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + responses: + '201': + description: Spoe scope created + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + /services/haproxy/spoe/spoe_files/{parent_name}/scopes/{name}: + get: + summary: Return one SPOE scope + description: Returns one SPOE scope in one SPOE file. + operationId: getSpoeScope + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: name + in: path + description: Spoe scope + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: Successful operation + headers: + Configuration-Version: + description: Spoe configuration file version + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_scope' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete a SPOE scope + description: Deletes a SPOE scope from the configuration file. + operationId: deleteSpoeScope + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: name + in: path + description: Spoe scope name + required: true + schema: + type: string + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + - name: version + in: query + description: Version used for checking configuration version. Cannot be used when transaction is specified. + required: false + schema: + type: integer + responses: + '204': + description: Spoe scope deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/transactions/handlers.conf.yaml b/specification/paths/spoe/transactions/handlers.conf.yaml new file mode 100644 index 00000000..28ac256a --- /dev/null +++ b/specification/paths/spoe/transactions/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: transactions +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/transactions/transactions.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/transactions/oapi.yaml b/specification/paths/spoe/transactions/oapi.yaml new file mode 100644 index 00000000..382177fe --- /dev/null +++ b/specification/paths/spoe/transactions/oapi.yaml @@ -0,0 +1,201 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Transactions +servers: + - url: /v3 +components: + schemas: + spoe_transaction: + type: object + x-go-type: models.SpoeTransaction + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + spoe_transactions: + type: array + items: + $ref: '#/components/schemas/spoe_transaction' + x-go-type: models.SpoeTransactions + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/spoe/spoe_files/{parent_name}/transactions: + get: + summary: Return list of SPOE configuration transactions. + description: Returns a list of SPOE configuration transactions. Transactions can be filtered by their status. + operationId: getAllSpoeTransaction + tags: + - SpoeTransactions + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: status + in: query + description: Filter by transaction status + required: false + schema: + type: string + enum: [failed, in_progress] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transactions' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Start a new transaction + description: Starts a new transaction and returns it's id + operationId: startSpoeTransaction + tags: + - SpoeTransactions + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: version + in: query + description: Configuration version on which to work on + required: true + schema: + type: integer + responses: + '201': + description: Transaction started + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + '429': + description: Too many open transactions + content: + application/json: + schema: + type: object + properties: + code: + type: integer + message: + type: string + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/spoe/spoe_files/{parent_name}/transactions/{id}: + get: + summary: Return one SPOE configuration transactions + description: Returns one SPOE configuration transactions. + operationId: getSpoeTransaction + tags: + - SpoeTransactions + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Commit transaction + description: Commit transaction, execute all operations in transaction and return msg + operationId: commitSpoeTransaction + tags: + - SpoeTransactions + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + '200': + description: Transaction successfully committed + content: + application/json: + schema: + $ref: '#/components/schemas/spoe_transaction' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + delete: + summary: Delete a transaction + description: Deletes a transaction. + operationId: deleteSpoeTransaction + tags: + - SpoeTransactions + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: id + in: path + description: Transaction id + required: true + schema: + type: string + responses: + '204': + description: Transaction deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/spoe/version/handlers.conf.yaml b/specification/paths/spoe/version/handlers.conf.yaml new file mode 100644 index 00000000..0c81b5ca --- /dev/null +++ b/specification/paths/spoe/version/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: version +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/spoe/version/version.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/spoe/version/oapi.yaml b/specification/paths/spoe/version/oapi.yaml new file mode 100644 index 00000000..c7e2eec6 --- /dev/null +++ b/specification/paths/spoe/version/oapi.yaml @@ -0,0 +1,38 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - SPOE Version +servers: + - url: /v3 +paths: + /services/haproxy/spoe/{parent_name}/version: + get: + summary: Return a SPOE configuration version + description: Returns SPOE configuration version. + operationId: getSpoeConfigurationVersion + tags: + - Spoe + parameters: + - name: parent_name + in: path + description: SPOE file name + required: true + schema: + type: string + pattern: '^[^\r\n<>*;$#&{}"]+$' + - name: transaction_id + in: query + description: ID of the transaction where we want to add the operation. Cannot be used when version is specified. + required: false + schema: + type: string + responses: + '200': + description: SPOE configuration version + content: + application/json: + schema: + type: integer + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/storage/general/handlers.conf.yaml b/specification/paths/storage/general/handlers.conf.yaml new file mode 100644 index 00000000..abcac1c0 --- /dev/null +++ b/specification/paths/storage/general/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: general +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/storage/general/general.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/storage/general/oapi.yaml b/specification/paths/storage/general/oapi.yaml new file mode 100644 index 00000000..a3e6c813 --- /dev/null +++ b/specification/paths/storage/general/oapi.yaml @@ -0,0 +1,174 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Storage General Files +servers: + - url: /v3 +components: + schemas: + general_file: + type: object + x-go-type: models.GeneralFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + general_files: + type: array + items: + $ref: '#/components/schemas/general_file' + x-go-type: models.GeneralFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/storage/general: + get: + summary: Return a list of all managed general use files + description: Returns a list of all managed general use files + operationId: getAllStorageGeneralFiles + tags: + - Storage + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/general_files' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Creates a managed storage general use file with contents + description: Creates a managed storage general use file with contents. + operationId: createStorageGeneralFile + tags: + - Storage + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: application/octet-stream + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: General use file content + responses: + '201': + description: General use file created with its contents + content: + application/json: + schema: + $ref: '#/components/schemas/general_file' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/storage/general/{name}: + get: + summary: Return the contents of one managed general use file from disk + description: Returns the contents of one managed general use file from disk + operationId: getOneStorageGeneralFile + tags: + - Storage + parameters: + - name: name + in: path + description: General use file storage_name + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/octet-stream: + schema: + type: string + format: binary + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace contents of a managed general use file on disk + description: Replaces the contents of a managed general use file on disk + operationId: replaceStorageGeneralFile + tags: + - Storage + parameters: + - name: name + in: path + description: General use file storage_name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: application/octet-stream + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: General use file content + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: General use file replaced + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + delete: + summary: Deletes a managed general use file from disk + description: Deletes a managed general use file from disk. + operationId: deleteStorageGeneralFile + tags: + - Storage + parameters: + - name: name + in: path + description: General use file storage_name + required: true + schema: + type: string + responses: + '204': + description: General use file deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/storage/maps/handlers.conf.yaml b/specification/paths/storage/maps/handlers.conf.yaml new file mode 100644 index 00000000..919fd912 --- /dev/null +++ b/specification/paths/storage/maps/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: maps +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/storage/maps/maps.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/storage/maps/oapi.yaml b/specification/paths/storage/maps/oapi.yaml new file mode 100644 index 00000000..95b35f36 --- /dev/null +++ b/specification/paths/storage/maps/oapi.yaml @@ -0,0 +1,167 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Storage Maps +servers: + - url: /v3 +components: + schemas: + map: + type: object + x-go-type: models.Map + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + maps: + type: array + items: + $ref: '#/components/schemas/map' + x-go-type: models.Maps + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/storage/maps: + get: + summary: Return a list of all managed map files + description: Returns a list of all managed map files + operationId: getAllStorageMapFiles + tags: + - Storage + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/maps' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Creates a managed storage map file with its entries + description: Creates a managed storage map file with its entries. + operationId: createStorageMapFile + tags: + - Storage + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: The map file contents + responses: + '201': + description: Map file created with its entries + content: + application/json: + schema: + $ref: '#/components/schemas/map' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/storage/maps/{name}: + get: + summary: Return the contents of one managed map file from disk + description: Returns the contents of one managed map file from disk + operationId: getOneStorageMap + tags: + - Storage + parameters: + - name: name + in: path + description: Map file storage_name + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/octet-stream: + schema: + type: string + format: binary + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace contents of a managed map file on disk + description: Replaces the contents of a managed map file on disk + operationId: replaceStorageMapFile + tags: + - Storage + parameters: + - name: name + in: path + description: Map file storage_name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + text/plain: + schema: + type: string + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Map file replaced + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Deletes a managed map file from disk + description: Deletes a managed map file from disk. + operationId: deleteStorageMap + tags: + - Storage + parameters: + - name: name + in: path + description: Map file storage_name + required: true + schema: + type: string + responses: + '204': + description: Map file deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/storage/ssl_certificates/handlers.conf.yaml b/specification/paths/storage/ssl_certificates/handlers.conf.yaml new file mode 100644 index 00000000..0b24dc1a --- /dev/null +++ b/specification/paths/storage/ssl_certificates/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_certificates +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/storage/ssl_certificates/ssl_certificates.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/storage/ssl_certificates/oapi.yaml b/specification/paths/storage/ssl_certificates/oapi.yaml new file mode 100644 index 00000000..74da4853 --- /dev/null +++ b/specification/paths/storage/ssl_certificates/oapi.yaml @@ -0,0 +1,221 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Storage SSL Certificates +servers: + - url: /v3 +components: + schemas: + ssl_certificate: + type: object + x-go-type: models.SslCertificate + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_certificates: + type: array + items: + $ref: '#/components/schemas/ssl_certificate' + x-go-type: models.SslCertificates + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/storage/ssl_certificates: + get: + summary: Return all available SSL certificates on disk + description: Returns all available SSL certificates on disk. + operationId: getAllStorageSSLCertificates + tags: + - Storage + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificates' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Create SSL certificate + description: Creates SSL certificate. + operationId: createStorageSSLCertificate + tags: + - Storage + parameters: + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: The SSL certificate to upload + responses: + '201': + description: SSL certificate created + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '202': + description: SSL certificate created requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/storage/ssl_certificates/{name}: + get: + summary: Return one SSL certificate from disk + description: Returns one SSL certificate from disk. + operationId: getOneStorageSSLCertificate + tags: + - Storage + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace SSL certificates on disk + description: Replaces SSL certificate on disk. + operationId: replaceStorageSSLCertificate + tags: + - Storage + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + text/plain: + schema: + type: string + responses: + '200': + description: SSL certificate replaced + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '202': + description: SSL certificate replaced and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_certificate' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete SSL certificate from disk + description: Deletes SSL certificate from disk. + operationId: deleteStorageSSLCertificate + tags: + - Storage + parameters: + - name: name + in: path + description: SSL certificate name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: SSL certificate deleted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: SSL certificate deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' diff --git a/specification/paths/storage/ssl_crt_lists/handlers.conf.yaml b/specification/paths/storage/ssl_crt_lists/handlers.conf.yaml new file mode 100644 index 00000000..9cddc4a4 --- /dev/null +++ b/specification/paths/storage/ssl_crt_lists/handlers.conf.yaml @@ -0,0 +1,12 @@ +package: ssl_crt_lists +generate: + chi-server: true + models: true + embedded-spec: true +output: handlers/storage/ssl_crt_lists/ssl_crt_lists.gen.go +output-options: + skip-prune: true + prefer-skip-optional-pointer: true + prefer-skip-optional-pointer-with-omitzero: true +import-mapping: + ../../../models/common/responses/models.yaml: "-" diff --git a/specification/paths/storage/ssl_crt_lists/oapi.yaml b/specification/paths/storage/ssl_crt_lists/oapi.yaml new file mode 100644 index 00000000..8fe82210 --- /dev/null +++ b/specification/paths/storage/ssl_crt_lists/oapi.yaml @@ -0,0 +1,348 @@ +openapi: 3.0.1 +info: + title: HAProxy Data Plane API - Storage SSL CRT Lists +servers: + - url: /v3 +components: + schemas: + ssl_crt_list_file: + type: object + x-go-type: models.SslCrtListFile + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_files: + type: array + items: + $ref: '#/components/schemas/ssl_crt_list_file' + x-go-type: models.SslCrtListFiles + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entry: + type: object + x-go-type: models.SslCrtListEntry + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models + ssl_crt_list_entries: + type: array + items: + $ref: '#/components/schemas/ssl_crt_list_entry' + x-go-type: models.SslCrtListEntries + x-go-type-import: + path: github.com/haproxytech/client-native/v6/models +paths: + /services/haproxy/storage/ssl_crt_lists: + get: + summary: Return all available certificate lists on disk + description: Returns all available certificate lists on disk. + operationId: getAllStorageSSLCrtListFiles + tags: + - Storage + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_files' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Create a certificate list + description: Creates a certificate list. + operationId: createStorageSSLCrtListFile + tags: + - Storage + parameters: + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + content: + multipart/form-data: + encoding: + file_upload: + contentType: text/plain + schema: + type: object + properties: + file_upload: + type: string + format: binary + description: The certificate list to upload + responses: + '201': + description: Certificate list created + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + '202': + description: Certificate list created requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: file_upload + /services/haproxy/storage/ssl_crt_lists/{name}: + get: + summary: Return one certificate list from disk + description: Returns one certificate list from disk. + operationId: getOneStorageSSLCrtListFile + tags: + - Storage + parameters: + - name: name + in: path + description: Certificate list name + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/octet-stream: + schema: + type: string + format: binary + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + put: + summary: Replace a certificate lists on disk + description: Replaces a certificate list on disk. + operationId: replaceStorageSSLCrtListFile + tags: + - Storage + parameters: + - name: name + in: path + description: Certificate list name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + text/plain: + schema: + type: string + responses: + '200': + description: Certificate list replaced + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + '202': + description: Certificate list replaced and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_file' + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Delete a certificate list from disk + description: Deletes a certificate list from disk. + operationId: deleteStorageSSLCrtListFile + tags: + - Storage + parameters: + - name: name + in: path + description: Certificate list name + required: true + schema: + type: string + - name: skip_reload + in: query + description: If set, no reload will be initiated after config change + required: false + schema: + type: boolean + default: false + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Certificate list deleted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Certificate list deleted + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + /services/haproxy/storage/ssl_crt_lists/{name}/entries: + get: + summary: Returns all the entries in a CrtList + description: Returns all the entries in a certificate list. + operationId: getStorageSSLCrtListEntries + tags: + - Storage + parameters: + - name: name + in: path + description: SSL crt-list file + required: true + schema: + type: string + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entries' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + post: + summary: Creates a new entry in a CrtList + description: Creates a new entry in a certificate list. + operationId: createStorageSSLCrtListEntry + tags: + - Storage + parameters: + - name: name + in: path + description: SSL crt-list file + required: true + schema: + type: string + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + responses: + '201': + description: New entry added + content: + application/json: + schema: + $ref: '#/components/schemas/ssl_crt_list_entry' + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '409': + $ref: '../../../models/common/responses/models.yaml#/components/responses/AlreadyExists' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError' + x-codegen-request-body-name: data + delete: + summary: Deletes an entry from CrtList file + description: Deletes an entry from a certificate list. + operationId: deleteStorageSSLCrtListEntry + tags: + - Storage + parameters: + - name: name + in: path + description: SSL crt list name + required: true + schema: + type: string + - name: certificate + in: query + description: SSL certificate filename + required: true + schema: + type: string + - name: line_number + in: query + description: The line number in the crt-list + required: true + schema: + type: integer + minimum: 0 + - name: force_reload + in: query + description: If set, do a force reload, do not wait for the configured reload-delay. + required: false + schema: + type: boolean + default: false + responses: + '202': + description: Configuration change accepted and reload requested + headers: + Reload-ID: + description: ID of the requested reload + schema: + type: string + '204': + description: Successful operation + '400': + $ref: '../../../models/common/responses/models.yaml#/components/responses/BadRequest' + '404': + $ref: '../../../models/common/responses/models.yaml#/components/responses/NotFound' + 'default': + $ref: '../../../models/common/responses/models.yaml#/components/responses/DefaultError'